diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/gsp.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index df23ac542..24e9f18dc 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp | |||
| @@ -5,14 +5,50 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/log.h" | 6 | #include "common/log.h" |
| 7 | 7 | ||
| 8 | #include "core/mem_map.h" | ||
| 8 | #include "core/hle/hle.h" | 9 | #include "core/hle/hle.h" |
| 9 | #include "core/hle/service/gsp.h" | 10 | #include "core/hle/service/gsp.h" |
| 10 | 11 | ||
| 12 | #include "core/hw/lcd.h" | ||
| 13 | |||
| 11 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 14 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 12 | // Namespace GSP_GPU | 15 | // Namespace GSP_GPU |
| 13 | 16 | ||
| 14 | namespace GSP_GPU { | 17 | namespace GSP_GPU { |
| 15 | 18 | ||
| 19 | enum { | ||
| 20 | REG_FRAMEBUFFER_1 = 0x00400468, | ||
| 21 | REG_FRAMEBUFFER_2 = 0x00400494, | ||
| 22 | }; | ||
| 23 | |||
| 24 | /// Read a GSP GPU hardware register | ||
| 25 | void ReadHWRegs(Service::Interface* self) { | ||
| 26 | static const u32 framebuffer_1[] = {LCD::VRAM_TOP_LEFT_FRAME1, LCD::VRAM_TOP_RIGHT_FRAME1}; | ||
| 27 | static const u32 framebuffer_2[] = {LCD::VRAM_TOP_LEFT_FRAME2, LCD::VRAM_TOP_RIGHT_FRAME2}; | ||
| 28 | |||
| 29 | u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); | ||
| 30 | u32 reg_addr = cmd_buff[1]; | ||
| 31 | u32 size = cmd_buff[2]; | ||
| 32 | u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]); | ||
| 33 | |||
| 34 | switch (reg_addr) { | ||
| 35 | |||
| 36 | // Top framebuffer 1 addresses | ||
| 37 | case REG_FRAMEBUFFER_1: | ||
| 38 | memcpy(dst, framebuffer_1, size); | ||
| 39 | break; | ||
| 40 | |||
| 41 | // Top framebuffer 2 addresses | ||
| 42 | case REG_FRAMEBUFFER_2: | ||
| 43 | memcpy(dst, framebuffer_1, size); | ||
| 44 | break; | ||
| 45 | |||
| 46 | default: | ||
| 47 | ERROR_LOG(OSHLE, "GSP_GPU::ReadHWRegs unknown register read at address %08X", reg_addr); | ||
| 48 | } | ||
| 49 | |||
| 50 | } | ||
| 51 | |||
| 16 | void RegisterInterruptRelayQueue(Service::Interface* self) { | 52 | void RegisterInterruptRelayQueue(Service::Interface* self) { |
| 17 | u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); | 53 | u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); |
| 18 | u32 flags = cmd_buff[1]; | 54 | u32 flags = cmd_buff[1]; |
| @@ -26,7 +62,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 26 | {0x00010082, NULL, "WriteHWRegs"}, | 62 | {0x00010082, NULL, "WriteHWRegs"}, |
| 27 | {0x00020084, NULL, "WriteHWRegsWithMask"}, | 63 | {0x00020084, NULL, "WriteHWRegsWithMask"}, |
| 28 | {0x00030082, NULL, "WriteHWRegRepeat"}, | 64 | {0x00030082, NULL, "WriteHWRegRepeat"}, |
| 29 | {0x00040080, NULL, "ReadHWRegs"}, | 65 | {0x00040080, ReadHWRegs, "ReadHWRegs"}, |
| 30 | {0x00050200, NULL, "SetBufferSwap"}, | 66 | {0x00050200, NULL, "SetBufferSwap"}, |
| 31 | {0x00060082, NULL, "SetCommandList"}, | 67 | {0x00060082, NULL, "SetCommandList"}, |
| 32 | {0x000700C2, NULL, "RequestDma"}, | 68 | {0x000700C2, NULL, "RequestDma"}, |