From ac27ce21417c3e07e09aaddb52c7adef8c54e21e Mon Sep 17 00:00:00 2001 From: Darius Goad Date: Mon, 23 Feb 2015 20:53:16 -0600 Subject: [PATCH] Add WriteHWRegRepeat --- src/core/hle/service/gsp_gpu.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index c23cfa3c8..c92e91a05 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp @@ -167,6 +167,29 @@ static void WriteHWRegsWithMask(Service::Interface* self) { WriteHWRegsWithMask(reg_addr, size, src_data, mask_data); } +static void WriteHWRegRepeat(Service::Interface* self) { + u32* cmd_buff = Kernel::GetCommandBuffer(); + u32 reg_addr = cmd_buff[1]; + u32 size = cmd_buff[2]; + + // TODO: Return proper error codes + if (reg_addr + size >= 0x420000) { + LOG_ERROR(Service_GSP, "Write address out of range! (address=0x%08x, size=0x%08x)", reg_addr, size); + return; + } + + //Taking size to mean amount of times the reg is hammered. + /*// size should be word-aligned + if ((size % 4) != 0) { + LOG_ERROR(Service_GSP, "Invalid size 0x%08x", size); + return; + }*/ + + u32 data = cmd_buff[4]; + + for(int i = 0;i(reg_addr,data); +} + /// Read a GSP GPU hardware register static void ReadHWRegs(Service::Interface* self) { u32* cmd_buff = Kernel::GetCommandBuffer(); @@ -452,7 +475,7 @@ static void TriggerCmdReqQueue(Service::Interface* self) { const Interface::FunctionInfo FunctionTable[] = { {0x00010082, WriteHWRegs, "WriteHWRegs"}, {0x00020084, WriteHWRegsWithMask, "WriteHWRegsWithMask"}, - {0x00030082, nullptr, "WriteHWRegRepeat"}, + {0x00030082, WriteHWRegRepeat, "WriteHWRegRepeat"}, {0x00040080, ReadHWRegs, "ReadHWRegs"}, {0x00050200, SetBufferSwap, "SetBufferSwap"}, {0x00060082, nullptr, "SetCommandList"},