mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-23 14:19:55 -06:00
Properly pass through GBA GPIO writes
This commit is contained in:
88
src/NDS.cpp
88
src/NDS.cpp
@ -1803,6 +1803,19 @@ void ARM9Write8(u32 addr, u8 val)
|
||||
// checkme
|
||||
return;
|
||||
|
||||
case 0x08000000:
|
||||
case 0x09000000:
|
||||
if (ExMemCnt[0] & (1<<7)) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
{
|
||||
if ((addr & 0x00FFFFFF) >= 0xC4 && (addr & 0x00FFFFFF) <= 0xC9)
|
||||
{
|
||||
GBACart::WriteGPIO(addr & (GBACart::CartROMSize-1), val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0A000000:
|
||||
if (ExMemCnt[0] & (1<<7)) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
@ -1854,6 +1867,21 @@ void ARM9Write16(u32 addr, u16 val)
|
||||
*(u16*)&GPU::OAM[addr & 0x7FF] = val;
|
||||
return;
|
||||
|
||||
case 0x08000000:
|
||||
case 0x09000000:
|
||||
if (ExMemCnt[0] & (1<<7)) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
{
|
||||
// Note: the lower bound is adjusted such that a write starting
|
||||
// there will hit the first byte of the GPIO region.
|
||||
if ((addr & 0x00FFFFFF) >= 0xC3 && (addr & 0x00FFFFFF) <= 0xC9)
|
||||
{
|
||||
GBACart::WriteGPIO(addr & (GBACart::CartROMSize-1), val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0A000000:
|
||||
if (ExMemCnt[0] & (1<<7)) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
@ -1905,6 +1933,22 @@ void ARM9Write32(u32 addr, u32 val)
|
||||
*(u32*)&GPU::OAM[addr & 0x7FF] = val;
|
||||
return;
|
||||
|
||||
case 0x08000000:
|
||||
case 0x09000000:
|
||||
if (ExMemCnt[0] & (1<<7)) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
{
|
||||
// Note: the lower bound is adjusted such that a write starting
|
||||
// there will hit the first byte of the GPIO region.
|
||||
if ((addr & 0x00FFFFFF) >= 0xC1 && (addr & 0x00FFFFFF) <= 0xC9)
|
||||
{
|
||||
GBACart::WriteGPIO(addr & (GBACart::CartROMSize-1), val & 0xFF);
|
||||
GBACart::WriteGPIO((addr + 2) & (GBACart::CartROMSize-1), (val >> 16) & 0xFF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0A000000:
|
||||
if (ExMemCnt[0] & (1<<7)) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
@ -2177,6 +2221,19 @@ void ARM7Write8(u32 addr, u8 val)
|
||||
GPU::WriteVRAM_ARM7<u8>(addr, val);
|
||||
return;
|
||||
|
||||
case 0x08000000:
|
||||
case 0x09000000:
|
||||
if (!(ExMemCnt[0] & (1<<7))) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
{
|
||||
if ((addr & 0x00FFFFFF) >= 0xC4 && (addr & 0x00FFFFFF) <= 0xC9)
|
||||
{
|
||||
GBACart::WriteGPIO(addr & (GBACart::CartROMSize-1), val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0A000000:
|
||||
if (!(ExMemCnt[0] & (1<<7))) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
@ -2231,6 +2288,21 @@ void ARM7Write16(u32 addr, u16 val)
|
||||
GPU::WriteVRAM_ARM7<u16>(addr, val);
|
||||
return;
|
||||
|
||||
case 0x08000000:
|
||||
case 0x09000000:
|
||||
if (!(ExMemCnt[0] & (1<<7))) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
{
|
||||
// Note: the lower bound is adjusted such that a write starting
|
||||
// there will hit the first byte of the GPIO region.
|
||||
if ((addr & 0x00FFFFFF) >= 0xC3 && (addr & 0x00FFFFFF) <= 0xC9)
|
||||
{
|
||||
GBACart::WriteGPIO(addr & (GBACart::CartROMSize-1), val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0A000000:
|
||||
if (!(ExMemCnt[0] & (1<<7))) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
@ -2286,6 +2358,22 @@ void ARM7Write32(u32 addr, u32 val)
|
||||
GPU::WriteVRAM_ARM7<u32>(addr, val);
|
||||
return;
|
||||
|
||||
case 0x08000000:
|
||||
case 0x09000000:
|
||||
if (!(ExMemCnt[0] & (1<<7))) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
{
|
||||
// Note: the lower bound is adjusted such that a write starting
|
||||
// there will hit the first byte of the GPIO region.
|
||||
if ((addr & 0x00FFFFFF) >= 0xC1 && (addr & 0x00FFFFFF) <= 0xC9)
|
||||
{
|
||||
GBACart::WriteGPIO(addr & (GBACart::CartROMSize-1), val & 0xFF);
|
||||
GBACart::WriteGPIO((addr + 2) & (GBACart::CartROMSize-1), (val >> 16) & 0xFF);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x0A000000:
|
||||
if (!(ExMemCnt[0] & (1<<7))) return; // deselected CPU, skip the write
|
||||
if (GBACart::CartInserted)
|
||||
|
Reference in New Issue
Block a user