Added variable framerate code to sync GBA mode and LCD framerate.

This commit is contained in:
profi200 2020-05-03 22:43:19 +02:00
parent bdcd068856
commit 7aeb539266
No known key found for this signature in database
GPG Key ID: 17B42AE5911139F3
2 changed files with 8 additions and 31 deletions

View File

@ -34,6 +34,14 @@ static void lgyFbDmaIrqHandler(UNUSED u32 intSource)
{
DMA330_ackIrq(0);
DMA330_run(0, program);
// If the top LCD ran >=20% ahead of LgyFb, slow it down.
// Check V-position.
u32 vtotal;
if(*((vu32*)0x10400454) > 83) vtotal = 415;
else vtotal = 413;
*((vu32*)0x10400424) = vtotal;
atomic_store_explicit(&flag, true, memory_order_relaxed);
}

View File

@ -77,34 +77,3 @@ int main(void)
return 0;
}
/*u32 vblankTest(void);
int main(void)
{
GFX_init(GFX_RGB5A1, GFX_RGB565);
GFX_setBrightness(0x30, 0x30);
consoleInit(SCREEN_BOT, NULL, false);
do
{
const u32 cycles = vblankTest();
ee_printf("\r%lu %lu %lu %lu", 268111856u / 2 / cycles, cycles, *((vu32*)0x10400424), *((vu32*)0x10400400));
updateScreens();
hidScanInput();
const u32 kDown = hidKeysDown();
if(kDown & KEY_DUP) *((vu32*)0x10400424) += 1; // 494 = 50.040660858 Hz
if(kDown & KEY_DDOWN) *((vu32*)0x10400424) -= 1;
if(kDown & KEY_DRIGHT) *((vu32*)0x10400400) += 1;
if(kDown & KEY_DLEFT) *((vu32*)0x10400400) -= 1;
if(hidGetExtraKeys(KEY_POWER) & KEY_POWER) break;
} while(1);
GFX_deinit();
power_off();
return 0;
}*/