diff --git a/Source/iop/Iop_SifCmd.cpp b/Source/iop/Iop_SifCmd.cpp index 06bd971adf..ad8af7f852 100644 --- a/Source/iop/Iop_SifCmd.cpp +++ b/Source/iop/Iop_SifCmd.cpp @@ -835,7 +835,7 @@ uint32 CSifCmd::SifSendCmd(uint32 commandId, uint32 packetPtr, uint32 packetSize dmaReg->size = sizeExtra; dmaReg->flags = 0; - m_sifMan.SifSetDma(m_sendCmdExtraStructAddr, 1); + m_sifMan.ExecuteSifDma(m_sendCmdExtraStructAddr, 1); } m_sifMan.SendPacket(packetData, packetSize); @@ -904,7 +904,7 @@ void CSifCmd::SifCallRpc(CMIPS& context) dmaReg->size = sendSize; dmaReg->flags = 0; - m_sifMan.SifSetDma(m_sendCmdExtraStructAddr, 1); + m_sifMan.ExecuteSifDma(m_sendCmdExtraStructAddr, 1); } SIFRPCCALL callPacket; diff --git a/Source/iop/Iop_SifMan.cpp b/Source/iop/Iop_SifMan.cpp index 3158b1b12d..00fce15401 100644 --- a/Source/iop/Iop_SifMan.cpp +++ b/Source/iop/Iop_SifMan.cpp @@ -13,6 +13,8 @@ using namespace Iop; +constexpr uint32 SIFDMA_XFER_ID = 0x2222; + std::string CSifMan::GetId() const { return "sifman"; @@ -121,13 +123,16 @@ uint32 CSifMan::SifSetDma(uint32 structAddr, uint32 count) //This is needed because RenderWare FS code doesn't expect SIF CMD callbacks to //arrive so quickly m_moduleData->dmaTransferTime = 0x800; - return count; + + ExecuteSifDma(structAddr, count); + return SIFDMA_XFER_ID; } uint32 CSifMan::SifDmaStat(uint32 transferId) { CLog::GetInstance().Print(LOG_NAME, FUNCTION_SIFDMASTAT "(transferId = %X);\r\n", transferId); + assert(transferId == SIFDMA_XFER_ID); if(m_moduleData->dmaTransferTime != 0) { return 0; @@ -155,5 +160,6 @@ uint32 CSifMan::SifSetDmaCallback(CMIPS& context, uint32 structAddr, uint32 coun context.m_State.nGPR[CMIPS::A0].nV0 = callbackParam; context.m_State.nGPR[CMIPS::A1].nV0 = callbackPtr; - return SifSetDma(structAddr, count); + ExecuteSifDma(structAddr, count); + return SIFDMA_XFER_ID; } diff --git a/Source/iop/Iop_SifMan.h b/Source/iop/Iop_SifMan.h index 4ed3ce0e82..7bde20d05f 100644 --- a/Source/iop/Iop_SifMan.h +++ b/Source/iop/Iop_SifMan.h @@ -34,10 +34,10 @@ namespace Iop virtual void GetOtherData(uint32, uint32, uint32) = 0; virtual void SetModuleResetHandler(const ModuleResetHandler&) = 0; virtual void SetCustomCommandHandler(const CustomCommandHandler&) = 0; - - virtual uint32 SifSetDma(uint32, uint32); + virtual void ExecuteSifDma(uint32, uint32) = 0; private: + uint32 SifSetDma(uint32, uint32); uint32 SifDmaStat(uint32); uint32 SifCheckInit(); uint32 SifSetDmaCallback(CMIPS&, uint32, uint32, uint32, uint32); diff --git a/Source/iop/Iop_SifManNull.cpp b/Source/iop/Iop_SifManNull.cpp index b7d449ca38..4d2be27d54 100644 --- a/Source/iop/Iop_SifManNull.cpp +++ b/Source/iop/Iop_SifManNull.cpp @@ -42,3 +42,7 @@ void CSifManNull::SetModuleResetHandler(const ModuleResetHandler&) void CSifManNull::SetCustomCommandHandler(const CustomCommandHandler&) { } + +void CSifManNull::ExecuteSifDma(uint32, uint32) +{ +} diff --git a/Source/iop/Iop_SifManNull.h b/Source/iop/Iop_SifManNull.h index 77bc4be37a..66c9dee732 100644 --- a/Source/iop/Iop_SifManNull.h +++ b/Source/iop/Iop_SifManNull.h @@ -17,5 +17,6 @@ namespace Iop void GetOtherData(uint32, uint32, uint32) override; void SetModuleResetHandler(const ModuleResetHandler&) override; void SetCustomCommandHandler(const CustomCommandHandler&) override; + void ExecuteSifDma(uint32, uint32) override; }; } diff --git a/Source/iop/Iop_SifManPs2.cpp b/Source/iop/Iop_SifManPs2.cpp index 3e9d32422e..e1b065c9af 100644 --- a/Source/iop/Iop_SifManPs2.cpp +++ b/Source/iop/Iop_SifManPs2.cpp @@ -63,13 +63,12 @@ void CSifManPs2::SetCustomCommandHandler(const CustomCommandHandler& customComma m_sif.SetCustomCommandHandler(customCommandHandler); } -uint32 CSifManPs2::SifSetDma(uint32 structAddr, uint32 count) +void CSifManPs2::ExecuteSifDma(uint32 structAddr, uint32 count) { - CSifMan::SifSetDma(structAddr, count); - if(structAddr == 0) { - return 0; + //Nothing to transfer + return; } auto dmaRegs = reinterpret_cast(m_iopRam + structAddr); @@ -89,8 +88,6 @@ uint32 CSifManPs2::SifSetDma(uint32 structAddr, uint32 count) memcpy(dst, src, dmaReg.size); } } - - return count; } uint8* CSifManPs2::GetEeRam() const diff --git a/Source/iop/Iop_SifManPs2.h b/Source/iop/Iop_SifManPs2.h index d1dd925785..f5ebfa198c 100644 --- a/Source/iop/Iop_SifManPs2.h +++ b/Source/iop/Iop_SifManPs2.h @@ -21,8 +21,7 @@ namespace Iop void GetOtherData(uint32, uint32, uint32) override; void SetModuleResetHandler(const ModuleResetHandler&) override; void SetCustomCommandHandler(const CustomCommandHandler&) override; - - uint32 SifSetDma(uint32, uint32) override; + void ExecuteSifDma(uint32, uint32) override; uint8* GetEeRam() const;