implement screen swap.

silence some logging for 3D GPU writes.
This commit is contained in:
StapleButter 2017-02-01 21:57:25 +01:00
parent 282dcdece3
commit c19056a564
4 changed files with 41 additions and 8 deletions

19
GPU.cpp
View File

@ -108,8 +108,8 @@ void Reset()
GPU2D_A->Reset();
GPU2D_B->Reset();
GPU2D_A->SetFramebuffer(&Framebuffer[256*0]);
GPU2D_B->SetFramebuffer(&Framebuffer[256*192]);
GPU2D_A->SetFramebuffer(&Framebuffer[256*192]);
GPU2D_B->SetFramebuffer(&Framebuffer[256*0]);
}
@ -720,6 +720,21 @@ void MapVRAM_I(u32 bank, u8 cnt)
}
void DisplaySwap(u32 val)
{
if (val)
{
GPU2D_A->SetFramebuffer(&Framebuffer[256*0]);
GPU2D_B->SetFramebuffer(&Framebuffer[256*192]);
}
else
{
GPU2D_A->SetFramebuffer(&Framebuffer[256*192]);
GPU2D_B->SetFramebuffer(&Framebuffer[256*0]);
}
}
void StartFrame()
{
StartScanline(0);

2
GPU.h
View File

@ -58,6 +58,8 @@ void MapVRAM_FG(u32 bank, u8 cnt);
void MapVRAM_H(u32 bank, u8 cnt);
void MapVRAM_I(u32 bank, u8 cnt);
void DisplaySwap(u32 val);
void StartFrame();
void StartScanline(u32 line);

20
NDS.cpp
View File

@ -178,6 +178,9 @@ void SetupDirectBoot()
ARM9->JumpTo(bootparams[1]);
ARM7->JumpTo(bootparams[5]);
PowerControl9 = 0x820F;
GPU::DisplaySwap(PowerControl9);
}
void Reset()
@ -271,7 +274,7 @@ void Reset()
// test
//LoadROM();
//LoadFirmware();
NDSCart::LoadROM("rom/mkds.nds");
NDSCart::LoadROM("rom/sm64ds.nds");
Running = true; // hax
}
@ -1412,6 +1415,11 @@ u32 ARM9IORead32(u32 addr)
{
return GPU::GPU2D_B->Read32(addr);
}
if (addr >= 0x04000320 && addr < 0x040006A4)
{
// 3D GPU
return 0;
}
printf("unknown ARM9 IO read32 %08X\n", addr);
return 0;
@ -1576,7 +1584,10 @@ void ARM9IOWrite16(u32 addr, u16 val)
PostFlag9 = val & 0x03;
return;
case 0x04000304: PowerControl9 = val; return;
case 0x04000304:
PowerControl9 = val;
GPU::DisplaySwap(PowerControl9>>15);
return;
}
if (addr >= 0x04000000 && addr < 0x04000060)
@ -1589,6 +1600,11 @@ void ARM9IOWrite16(u32 addr, u16 val)
GPU::GPU2D_B->Write16(addr, val);
return;
}
if (addr >= 0x04000320 && addr < 0x040006A4)
{
// 3D GPU
return;
}
printf("unknown ARM9 IO write16 %08X %04X\n", addr, val);
}

View File

@ -10,7 +10,7 @@
1481161027 c:\documents\sources\melonds\types.h
1485981206 source:c:\documents\sources\melonds\nds.cpp
1485982397 source:c:\documents\sources\melonds\nds.cpp
<stdio.h>
<string.h>
"NDS.h"
@ -24,7 +24,7 @@
"RTC.h"
"Wifi.h"
1485979545 source:c:\documents\sources\melonds\arm.cpp
1485981252 source:c:\documents\sources\melonds\arm.cpp
<stdio.h>
"NDS.h"
"ARM.h"
@ -117,13 +117,13 @@
1484698068 c:\documents\sources\melonds\dma.h
"types.h"
1485964826 source:c:\documents\sources\melonds\gpu.cpp
1485982457 source:c:\documents\sources\melonds\gpu.cpp
<stdio.h>
<string.h>
"NDS.h"
"GPU.h"
1484709419 c:\documents\sources\melonds\gpu.h
1485982310 c:\documents\sources\melonds\gpu.h
"GPU2D.h"
1484848282 c:\documents\sources\melonds\rtc.h