Make NDS sys bus hack work better

fixes e6f8450685
This commit is contained in:
CasualPokePlayer 2024-06-24 19:22:11 -07:00
parent 36a1c37cfe
commit 64ef1bfc17
2 changed files with 15 additions and 4 deletions

View File

@ -52,7 +52,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
public IMemoryCallbackSystem MemoryCallbacks => _memoryCallbacks;
private readonly MemoryCallbackSystem _memoryCallbacks = new(new[] { "System Bus" });
// FIXME: internally the code actually just does this for either bus (probably don't want to bother adding support)
private readonly MemoryCallbackSystem _memoryCallbacks = new([ "ARM9 System Bus" ]);
private LibMelonDS.MemoryCallback _readCallback;
private LibMelonDS.MemoryCallback _writeCallback;
@ -67,7 +68,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
{
if (getHasCBOfType())
{
MemoryCallbacks.CallMemoryCallbacks(address, 0, rawFlags, "System Bus");
MemoryCallbacks.CallMemoryCallbacks(address, 0, rawFlags, "ARM9 System Bus");
}
};
}

View File

@ -576,7 +576,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
Size = 1L << 32;
WordSize = 4;
EndianType = Endian.Little;
Writable = false;
Writable = true;
Arm9Bus = arm9;
Arm7Bus = arm7;
@ -596,7 +596,17 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS
public override byte PeekByte(long addr) => UseArm9 ? Arm9Bus.PeekByte(addr) : Arm7Bus.PeekByte(addr);
public override void PokeByte(long addr, byte val) => throw new InvalidOperationException();
public override void PokeByte(long addr, byte val)
{
if (UseArm9)
{
Arm9Bus.PokeByte(addr, val);
}
else
{
Arm7Bus.PokeByte(addr, val);
}
}
}
}
}