fix timing issue with ARM7 DMA (occasionally crapoed the 'Nintendo DS' sound when booting the firmware)

This commit is contained in:
StapleButter 2017-06-12 19:00:32 +02:00
parent bdb7edab51
commit cb65536c22
1 changed files with 11 additions and 10 deletions

View File

@ -393,7 +393,6 @@ u32 RunFrame()
{ {
if (!Running) return 263; // dorp if (!Running) return 263; // dorp
GPU::StartFrame(); GPU::StartFrame();
while (Running && GPU::TotalScanlines==0) while (Running && GPU::TotalScanlines==0)
@ -426,7 +425,7 @@ u32 RunFrame()
if (cycles > 0) cycles = DMAs[5]->Run(cycles); if (cycles > 0) cycles = DMAs[5]->Run(cycles);
if (cycles > 0) cycles = DMAs[6]->Run(cycles); if (cycles > 0) cycles = DMAs[6]->Run(cycles);
if (cycles > 0) cycles = DMAs[7]->Run(cycles); if (cycles > 0) cycles = DMAs[7]->Run(cycles);
ARM7Offset = cycles; ARM7Offset = -cycles;
} }
else else
{ {
@ -835,15 +834,13 @@ void debug(u32 param)
//for (int i = 0; i < 9; i++) //for (int i = 0; i < 9; i++)
// printf("VRAM %c: %02X\n", 'A'+i, GPU::VRAMCNT[i]); // printf("VRAM %c: %02X\n", 'A'+i, GPU::VRAMCNT[i]);
/*FILE* shit = fopen("debug/poke7.bin", "wb"); /*FILE*
for (u32 i = 0x02000000; i < 0x03810000; i+=4) shit = fopen("debug/pictochat.bin", "wb");
for (u32 i = 0x02000000; i < 0x02400000; i+=4)
{ {
u32 val = ARM7Read32(i); u32 val = ARM7Read32(i);
fwrite(&val, 4, 1, shit); fwrite(&val, 4, 1, shit);
} }
fclose(shit);*/
/*FILE*
shit = fopen("debug/pictochat7.bin", "wb");
for (u32 i = 0x037F0000; i < 0x03810000; i+=4) for (u32 i = 0x037F0000; i < 0x03810000; i+=4)
{ {
u32 val = ARM7Read32(i); u32 val = ARM7Read32(i);
@ -1249,7 +1246,11 @@ void ARM7Write8(u32 addr, u8 val)
} }
void ARM7Write16(u32 addr, u16 val) void ARM7Write16(u32 addr, u16 val)
{ {//if (addr==(ARM7Read32(0x380FFF4)+0x4A0)) printf("%08X set client bitmap %04X %08X\n", ARM7->R[15], val, addr);
//if (addr==0x0230F89C) printf("[%08X] set pkt type %04X %08X\n", ARM7->R[15], val, addr);
/*if (addr==0x03807D2C) printf("[%08X] SET SOME STATUS %04X %08X\n", ARM7->R[15], val, addr);
if (addr==0x0230E310) printf("[%08X] SET YET ANOTHER DUMB LAYER OF STATUS %04X %08X\n", ARM7->R[15], val, addr);*/
//if (addr==0x0230E310 && val==0x15) val = 0xC;
switch (addr & 0xFF800000) switch (addr & 0xFF800000)
{ {
case 0x02000000: case 0x02000000:
@ -1859,7 +1860,7 @@ void ARM9IOWrite32(u32 addr, u32 val)
case 0x04000188: case 0x04000188:
if (IPCFIFOCnt9 & 0x8000) if (IPCFIFOCnt9 & 0x8000)
{ {if((val&0x1F)==0xA)printf("ARM9->ARM7: %08X --- %08X -- %04X\n", val, val>>6, ARM7Read16(val>>6));
if (IPCFIFO9->IsFull()) if (IPCFIFO9->IsFull())
IPCFIFOCnt9 |= 0x4000; IPCFIFOCnt9 |= 0x4000;
else else
@ -2389,7 +2390,7 @@ void ARM7IOWrite32(u32 addr, u32 val)
case 0x04000188: case 0x04000188:
if (IPCFIFOCnt7 & 0x8000) if (IPCFIFOCnt7 & 0x8000)
{ {if((val&0x1F)==0xA)printf("ARM7->ARM9: %08X --- %08X -- %04X\n", val, val>>6, ARM7Read16(val>>6));
if (IPCFIFO7->IsFull()) if (IPCFIFO7->IsFull())
IPCFIFOCnt7 |= 0x4000; IPCFIFOCnt7 |= 0x4000;
else else