Fix CR issues and Game Duplication + Move to Vector for Memory Map

This commit fixed the issues outlined in the CR (Mainly correlated to formatting), moves to a sorted vector from a sorted list for the memory map in addition to using binary search for sorting through rather than iteratively and fixes item duplication in the game list when directory is changed in Settings.
This commit is contained in:
◱ PixelyIon
2020-02-15 15:08:17 +05:30
committed by ◱ PixelyIon
parent 66d20a9429
commit 08bbc66b09
31 changed files with 418 additions and 355 deletions

View File

@ -21,7 +21,7 @@ namespace skyline::gpu::device {
void NvHostChannel::SetErrorNotifier(skyline::gpu::device::IoctlData &buffer) {}
void NvHostChannel::SetPriority(skyline::gpu::device::IoctlData &buffer) {
auto priority = state.process->ReadMemory<NvChannelPriority>(buffer.input[0].address);
auto priority = state.process->GetObject<NvChannelPriority>(buffer.input[0].address);
switch (priority) {
case NvChannelPriority::Low:
timeslice = 1300;

View File

@ -73,7 +73,7 @@ namespace skyline::gpu::device {
u64 gpuCharacteristicsBufSize; // InOut
u64 gpuCharacteristicsBufAddr; // In
GpuCharacteristics gpuCharacteristics; // Out
} data = state.process->ReadMemory<Data>(buffer.input[0].address);
} data = state.process->GetObject<Data>(buffer.input[0].address);
data.gpuCharacteristics = {
.arch = 0x120,
.impl = 0xB,
@ -119,7 +119,7 @@ namespace skyline::gpu::device {
u32 maskBufSize; // In
u32 reserved[3]; // In
u64 maskBuf; // Out
} data = state.process->ReadMemory<Data>(buffer.input[0].address);
} data = state.process->GetObject<Data>(buffer.input[0].address);
if (data.maskBufSize)
data.maskBuf = 0x3;
state.process->WriteMemory(data, buffer.output[0].address);

View File

@ -17,7 +17,7 @@ namespace skyline::gpu::device {
struct Data {
u32 size; // In
u32 handle; // Out
} data = state.process->ReadMemory<Data>(buffer.input[0].address);
} data = state.process->GetObject<Data>(buffer.input[0].address);
handleTable[handleIndex] = std::make_shared<NvMapObject>(idIndex++, data.size);
data.handle = handleIndex++;
state.process->WriteMemory(data, buffer.output[0].address);
@ -28,7 +28,7 @@ namespace skyline::gpu::device {
struct Data {
u32 id; // In
u32 handle; // Out
} data = state.process->ReadMemory<Data>(buffer.input[0].address);
} data = state.process->GetObject<Data>(buffer.input[0].address);
bool found{};
for (const auto &object : handleTable) {
if (object.second->id == data.id) {
@ -53,7 +53,7 @@ namespace skyline::gpu::device {
u8 kind; // In
u8 _pad0_[7];
u64 address; // InOut
} data = state.process->ReadMemory<Data>(buffer.input[0].address);
} data = state.process->GetObject<Data>(buffer.input[0].address);
auto &object = handleTable.at(data.handle);
object->heapMask = data.heapMask;
object->flags = data.flags;
@ -71,7 +71,7 @@ namespace skyline::gpu::device {
u32 address; // Out
u32 size; // Out
u64 flags; // Out
} data = state.process->ReadMemory<Data>(buffer.input[0].address);
} data = state.process->GetObject<Data>(buffer.input[0].address);
const auto &object = handleTable.at(data.handle);
if (object.use_count() > 1) {
data.address = static_cast<u32>(object->address);
@ -91,7 +91,7 @@ namespace skyline::gpu::device {
u32 handle; // In
Parameter parameter; // In
u32 result; // Out
} data = state.process->ReadMemory<Data>(buffer.input[0].address);
} data = state.process->GetObject<Data>(buffer.input[0].address);
auto &object = handleTable.at(data.handle);
switch (data.parameter) {
case Parameter::Size:
@ -132,7 +132,7 @@ namespace skyline::gpu::device {
struct Data {
u32 id; // Out
u32 handle; // In
} data = state.process->ReadMemory<Data>(buffer.input[0].address);
} data = state.process->GetObject<Data>(buffer.input[0].address);
data.id = handleTable.at(data.handle)->id;
state.process->WriteMemory(data, buffer.output[0].address);
state.logger->Debug("GetId: Input: Handle: 0x{:X}, Output: ID: 0x{:X}, Status: {}", data.handle, data.id, buffer.status);

View File

@ -3,7 +3,7 @@
#include <gpu.h>
namespace skyline::gpu {
Buffer::Buffer(const DeviceState &state, u32 slot, GbpBuffer &gbpBuffer) : state(state), slot(slot), gbpBuffer(gbpBuffer), resolution{gbpBuffer.width, gbpBuffer.height}, dataBuffer(gbpBuffer.size) {
Buffer::Buffer(const DeviceState &state, u32 slot, GbpBuffer &gbpBuffer) : state(state), slot(slot), gbpBuffer(gbpBuffer), resolution{gbpBuffer.width, gbpBuffer.height} {
if (gbpBuffer.nvmapHandle)
nvBuffer = state.gpu->GetDevice<device::NvMap>(device::NvDeviceType::nvmap)->handleTable.at(gbpBuffer.nvmapHandle);
else {
@ -30,8 +30,8 @@ namespace skyline::gpu {
}
}
void Buffer::UpdateBuffer() {
state.process->ReadMemory(dataBuffer.data(), nvBuffer->address + gbpBuffer.offset, gbpBuffer.size);
u8 *Buffer::GetAddress() {
return state.process->GetPointer<u8>(nvBuffer->address + gbpBuffer.offset);
}
BufferQueue::BufferQueue(const DeviceState &state) : state(state) {}
@ -89,7 +89,6 @@ namespace skyline::gpu {
} *data = reinterpret_cast<Data *>(in.data.data() + constant::TokenLength);
auto buffer = queue.at(data->slot);
buffer->status = BufferStatus::Queued;
buffer->UpdateBuffer();
displayQueue.emplace(buffer);
state.gpu->bufferEvent->Signal();
struct {

View File

@ -104,7 +104,6 @@ namespace skyline::gpu {
Resolution resolution; //!< The resolution of this buffer
GbpBuffer gbpBuffer; //!< The information about the underlying buffer
BufferStatus status{BufferStatus::Free}; //!< The status of this buffer
std::vector<u8> dataBuffer; //!< The vector holding the actual pixel data
std::shared_ptr<device::NvMap::NvMapObject> nvBuffer{}; //!< A shared pointer to the buffer's nvmap object
/**
@ -115,9 +114,9 @@ namespace skyline::gpu {
Buffer(const DeviceState &state, u32 slot, GbpBuffer &gbpBuffer);
/**
* @brief This reads the buffer from the process into the dataBuffer vector
* @return The address of the buffer on the kernel
*/
void UpdateBuffer();
u8* GetAddress();
};
/**