refine it some more

This commit is contained in:
Arisotura 2023-10-30 18:09:26 +01:00
parent 86b9c23136
commit d5fd040e30
3 changed files with 26 additions and 9 deletions

View File

@ -1096,6 +1096,24 @@ void FinishFrame(u32 lines)
} }
} }
void BlankFrame()
{
int backbuf = FrontBuffer ? 0 : 1;
int fbsize;
if (GPU3D::CurrentRenderer->Accelerated)
fbsize = (256*3 + 1) * 192;
else
fbsize = 256 * 192;
memset(Framebuffer[backbuf][0], 0, fbsize*4);
memset(Framebuffer[backbuf][1], 0, fbsize*4);
FrontBuffer = backbuf;
AssignFramebuffers();
TotalScanlines = 263;
}
void StartScanline(u32 line) void StartScanline(u32 line)
{ {
if (line == 0) if (line == 0)

View File

@ -607,6 +607,7 @@ void SetPowerCnt(u32 val);
void StartFrame(); void StartFrame();
void FinishFrame(u32 lines); void FinishFrame(u32 lines);
void BlankFrame();
void StartScanline(u32 line); void StartScanline(u32 line);
void StartHBlank(u32 line); void StartHBlank(u32 line);

View File

@ -1128,6 +1128,8 @@ u32 RunFrame()
{ {
FrameStartTimestamp = SysTimestamp; FrameStartTimestamp = SysTimestamp;
GPU::TotalScanlines = 0;
LagFrameFlag = true; LagFrameFlag = true;
bool runFrame = Running && !(CPUStop & CPUStop_Sleep); bool runFrame = Running && !(CPUStop & CPUStop_Sleep);
while (Running) while (Running)
@ -1158,7 +1160,7 @@ u32 RunFrame()
} }
if (SysTimestamp >= frametarget) if (SysTimestamp >= frametarget)
GPU::TotalScanlines = 263; GPU::BlankFrame();
} }
else else
{ {
@ -1194,11 +1196,11 @@ u32 RunFrame()
} }
else else
{ {
#ifdef JIT_ENABLED #ifdef JIT_ENABLED
if (EnableJIT) if (EnableJIT)
ARM9->ExecuteJIT(); ARM9->ExecuteJIT();
else else
#endif #endif
ARM9->Execute(); ARM9->Execute();
} }
@ -1222,11 +1224,11 @@ u32 RunFrame()
} }
else else
{ {
#ifdef JIT_ENABLED #ifdef JIT_ENABLED
if (EnableJIT) if (EnableJIT)
ARM7->ExecuteJIT(); ARM7->ExecuteJIT();
else else
#endif #endif
ARM7->Execute(); ARM7->Execute();
} }
@ -1237,9 +1239,6 @@ u32 RunFrame()
if (CPUStop & CPUStop_Sleep) if (CPUStop & CPUStop_Sleep)
{ {
// checkme: when is sleep mode effective?
//CancelEvent(Event_LCD);
//GPU::TotalScanlines = 263;
break; break;
} }
} }
@ -1259,7 +1258,6 @@ u32 RunFrame()
break; break;
} }
printf("FRAME %08X %d %016llX\n", CPUStop, GPU::TotalScanlines, SysTimestamp-FrameStartTimestamp);
// In the context of TASes, frame count is traditionally the primary measure of emulated time, // In the context of TASes, frame count is traditionally the primary measure of emulated time,
// so it needs to be tracked even if NDS is powered off. // so it needs to be tracked even if NDS is powered off.
NumFrames++; NumFrames++;