Skip to content

Commit

Permalink
Dead or Alive 2 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bigianb committed Jan 12, 2024
1 parent 4d92cbc commit 2edab83
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions Source/iop/IopBios.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CIopBios : public Iop::CBiosBase
KERNEL_RESULT_ERROR_ILLEGAL_CONTEXT = -100,
KERNEL_RESULT_ERROR_ILLEGAL_INTRCODE = -101,
KERNEL_RESULT_ERROR_CPUDI = -102,
KERNEL_RESULT_ERROR_INTRDISABLE = -103,
KERNEL_RESULT_ERROR_FOUND_HANDLER = -104,
KERNEL_RESULT_ERROR_NOTFOUND_HANDLER = -105,
KERNEL_RESULT_ERROR_NO_TIMER = -150,
Expand Down
25 changes: 20 additions & 5 deletions Source/iop/Iop_Intrman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,28 @@ uint32 CIntrman::DisableIntrLine(CMIPS& context, uint32 line, uint32 res)
CLog::GetInstance().Print(LOGNAME, FUNCTION_DISABLEINTRLINE "(line = %d, res = %08X);\r\n",
line, res);
#endif
uint32 ret = CIopBios::KERNEL_RESULT_OK;
uint32 stat = line;
UNION64_32 mask(
context.m_pMemoryMap->GetWord(CIntc::MASK0),
context.m_pMemoryMap->GetWord(CIntc::MASK1));
mask.f &= ~(1LL << line);
context.m_pMemoryMap->SetWord(CIntc::MASK0, mask.h0);
context.m_pMemoryMap->SetWord(CIntc::MASK1, mask.h1);
return 0;
if(mask.f & (1LL << line))
{
mask.f &= ~(1LL << line);
context.m_pMemoryMap->SetWord(CIntc::MASK0, mask.h0);
context.m_pMemoryMap->SetWord(CIntc::MASK1, mask.h1);
}
else
{
ret = CIopBios::KERNEL_RESULT_ERROR_INTRDISABLE;
stat = CIopBios::KERNEL_RESULT_ERROR_INTRDISABLE;
}
if(res != 0)
{
uint32* state = reinterpret_cast<uint32*>(m_ram + res);
(*state) = stat;
}
return ret;
}

uint32 CIntrman::EnableInterrupts(CMIPS& context)
Expand Down Expand Up @@ -210,7 +225,7 @@ uint32 CIntrman::SuspendInterrupts(CMIPS& context, uint32 statePtr)
uint32 CIntrman::ResumeInterrupts(CMIPS& context, uint32 state)
{
#ifdef _DEBUG
CLog::GetInstance().Print(LOGNAME, FUNCTION_RESUMEINTERRUPTS "();\r\n");
CLog::GetInstance().Print(LOGNAME, FUNCTION_RESUMEINTERRUPTS "(0x%x);\r\n", state);
#endif
uint32& statusRegister = context.m_State.nCOP0[CCOP_SCU::STATUS];
if(state)
Expand Down
6 changes: 6 additions & 0 deletions patches.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@
<Executable Name="SLPM_551.91;1" Title="L2 - Love x Loop">
<Patch Address="0x001B4828" Value="0x10000008" Description="Avoid bug in code that fiddles with SP and causes the stack to be clobbered by SifCallRpc. Requires proper data cache handling to avoid issue." />
</Executable>
<Executable Name="SCES_500.03;1" Title="Dead or Alive 2" Region="EU">
<Patch Address="0x002b4c44" Value="0x24060000" Description="Make the file reading RPC call synchronous. Requires proper data cache handling to avoid issue." />
</Executable>
<Executable Name="SLPS_250.02;1" Title="Dead or Alive 2">
<Patch Address="0x00290408" Value="0x24060000" Description="Make the file reading RPC call synchronous. Requires proper data cache handling to avoid issue." />
</Executable>
</Patches>

0 comments on commit 2edab83

Please sign in to comment.