unfuck the DSP code some

(still doesn't work)
This commit is contained in:
Arisotura 2022-10-10 00:22:46 +02:00
parent c177fae51f
commit b76e5adc1d
2 changed files with 28 additions and 24 deletions

View File

@ -2241,8 +2241,11 @@ u8 ARM9IORead8(u32 addr)
return DSi_CamModule::Read8(addr); return DSi_CamModule::Read8(addr);
} }
if (addr >= 0x04004300 && addr <= 0x04004400) if ((addr & 0xFFFFFF00) == 0x04004300)
return DSi_DSP::Read16(addr); {
if (!(SCFG_EXT[0] & (1<<18))) return 0;
return DSi_DSP::Read8(addr);
}
return NDS::ARM9IORead8(addr); return NDS::ARM9IORead8(addr);
} }
@ -2273,8 +2276,11 @@ u16 ARM9IORead16(u32 addr)
return DSi_CamModule::Read16(addr); return DSi_CamModule::Read16(addr);
} }
if (addr >= 0x04004300 && addr <= 0x04004400) if ((addr & 0xFFFFFF00) == 0x04004300)
return DSi_DSP::Read32(addr); {
if (!(SCFG_EXT[0] & (1<<18))) return 0;
return DSi_DSP::Read16(addr);
}
return NDS::ARM9IORead16(addr); return NDS::ARM9IORead16(addr);
} }
@ -2335,6 +2341,12 @@ u32 ARM9IORead32(u32 addr)
return DSi_CamModule::Read32(addr); return DSi_CamModule::Read32(addr);
} }
if ((addr & 0xFFFFFF00) == 0x04004300)
{
if (!(SCFG_EXT[0] & (1<<18))) return 0;
return DSi_DSP::Read32(addr);
}
return NDS::ARM9IORead32(addr); return NDS::ARM9IORead32(addr);
} }
@ -2399,10 +2411,10 @@ void ARM9IOWrite8(u32 addr, u8 val)
return DSi_CamModule::Write8(addr, val); return DSi_CamModule::Write8(addr, val);
} }
if (addr >= 0x04004300 && addr <= 0x04004400) if ((addr & 0xFFFFFF00) == 0x04004300)
{ {
DSi_DSP::Write8(addr, val); if (!(SCFG_EXT[0] & (1<<18))) return;
return; return DSi_DSP::Write8(addr, val);
} }
return NDS::ARM9IOWrite8(addr, val); return NDS::ARM9IOWrite8(addr, val);
@ -2459,10 +2471,10 @@ void ARM9IOWrite16(u32 addr, u16 val)
return DSi_CamModule::Write16(addr, val); return DSi_CamModule::Write16(addr, val);
} }
if (addr >= 0x04004300 && addr <= 0x04004400) if ((addr & 0xFFFFFF00) == 0x04004300)
{ {
DSi_DSP::Write16(addr, val); if (!(SCFG_EXT[0] & (1<<18))) return;
return; return DSi_DSP::Write16(addr, val);
} }
return NDS::ARM9IOWrite16(addr, val); return NDS::ARM9IOWrite16(addr, val);
@ -2609,6 +2621,12 @@ void ARM9IOWrite32(u32 addr, u32 val)
return DSi_CamModule::Write32(addr, val); return DSi_CamModule::Write32(addr, val);
} }
if ((addr & 0xFFFFFF00) == 0x04004300)
{
if (!(SCFG_EXT[0] & (1<<18))) return;
return DSi_DSP::Write32(addr, val);
}
return NDS::ARM9IOWrite32(addr, val); return NDS::ARM9IOWrite32(addr, val);
} }

View File

@ -390,9 +390,6 @@ u16 PDataDMAReadMMIO()
u8 Read8(u32 addr) u8 Read8(u32 addr)
{ {
if (!(DSi::SCFG_EXT[0] & (1<<18)))
return 0;
if (!DSPCatchUp()) return 0; if (!DSPCatchUp()) return 0;
addr &= 0x3F; // mirroring wheee addr &= 0x3F; // mirroring wheee
@ -419,9 +416,6 @@ u8 Read8(u32 addr)
} }
u16 Read16(u32 addr) u16 Read16(u32 addr)
{ {
if (!(DSi::SCFG_EXT[0] & (1<<18)))
return 0;
if (!DSPCatchUp()) return 0; if (!DSPCatchUp()) return 0;
addr &= 0x3E; // mirroring wheee addr &= 0x3E; // mirroring wheee
@ -463,8 +457,6 @@ u16 Read16(u32 addr)
} }
u32 Read32(u32 addr) u32 Read32(u32 addr)
{ {
if (!(DSi::SCFG_EXT[0] & (1<<18))) return 0;
addr &= 0x3C; addr &= 0x3C;
return Read16(addr); // *shrug* (doesn't do anything unintended due to the return Read16(addr); // *shrug* (doesn't do anything unintended due to the
// 4byte spacing between regs while they're all 16bit) // 4byte spacing between regs while they're all 16bit)
@ -472,8 +464,6 @@ u32 Read32(u32 addr)
void Write8(u32 addr, u8 val) void Write8(u32 addr, u8 val)
{ {
if (!(DSi::SCFG_EXT[0] & (1<<18))) return;
if (!DSPCatchUp()) return; if (!DSPCatchUp()) return;
addr &= 0x3F; addr &= 0x3F;
@ -494,8 +484,6 @@ void Write8(u32 addr, u8 val)
} }
void Write16(u32 addr, u16 val) void Write16(u32 addr, u16 val)
{ {
if (!(DSi::SCFG_EXT[0] & (1<<18))) return;
if (!DSPCatchUp()) return; if (!DSPCatchUp()) return;
addr &= 0x3E; addr &= 0x3E;
@ -547,8 +535,6 @@ void Write16(u32 addr, u16 val)
void Write32(u32 addr, u32 val) void Write32(u32 addr, u32 val)
{ {
if (!(DSi::SCFG_EXT[0] & (1<<18))) return;
addr &= 0x3C; addr &= 0x3C;
Write16(addr, val & 0xFFFF); Write16(addr, val & 0xFFFF);
} }