Skip to content

Commit

Permalink
Add workaround for case where game pass buffer = 0 in SifRegisterRpc.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpd002 committed Nov 19, 2024
1 parent 49d5021 commit 8837c10
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Source/iop/Iop_SifCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 949,16 @@ void CSifCmd::SifRegisterRpc(CMIPS& context)

if(serverDataAddr != 0)
{
if(buffer == 0)
{
//This is needed by Pia Carrot e Yokoso: GO Summer Fair.
//Game passes 0 for buffer and we have a check in ProcessInvocation to prevent copying RPC call
//parameters to address 0. On a real PS2, it probably doesn't really matter, but this is a
//questionable thing to do, so, let's be safe and allocate some buffer for the game.
CLog::GetInstance().Warn(LOG_NAME, "SifRegisterRpc: address 0 provided for RPC server buffer, allocating dummy buffer.\r\n");
buffer = m_sysMem.AllocateMemory(0x100, 0, 0);
}

auto serverData = reinterpret_cast<SIFRPCSERVERDATA*>(&m_ram[serverDataAddr]);
serverData->serverId = serverId;
serverData->function = function;
Expand Down

0 comments on commit 8837c10

Please sign in to comment.