diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index 5cce28f41..0b8c36a0c 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -882,7 +882,13 @@ void NDS_Reset() if(movieMode != MOVIEMODE_INACTIVE && !_HACK_DONT_STOPMOVIE) movie_reset_command = true; - if(movieMode == MOVIEMODE_INACTIVE) currFrameCounter = 0; + if(movieMode == MOVIEMODE_INACTIVE) { + currFrameCounter = 0; + lagframecounter = 0; + LagFrameFlag = 0; + lastLag = 0; + TotalLagFrames = 0; + } MMU_clearMem(); MMU_new.backupDevice.reset(); diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index 52b5b0372..2ef95b513 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -184,6 +184,12 @@ void HK_ToggleFrame(int) {frameCounterDisplay ^= true;} void HK_ToggleFPS(int) {FpsDisplay ^= true;} void HK_ToggleInput(int) {ShowInputDisplay ^= true;} void HK_ToggleLag(int) {ShowLagFrameCounter ^= true;} +void HK_ResetLagCounter(int) { + lagframecounter=0; + LagFrameFlag=0; + lastLag=0; + TotalLagFrames=0; +} void HK_ToggleReadOnly(int) { movie_readonly ^= true; if(movie_readonly) @@ -421,6 +427,12 @@ void InitCustomKeys (SCustomKeys *keys) keys->ToggleLag.page = HOTKEY_PAGE_MAIN; keys->ToggleLag.key = NULL; + keys->ResetLagCounter.handleKeyDown = HK_ResetLagCounter; + keys->ResetLagCounter.code = "ResetLagCounter"; + keys->ResetLagCounter.name = L"Reset Lag Counter"; + keys->ResetLagCounter.page = HOTKEY_PAGE_MAIN; + keys->ResetLagCounter.key = NULL; + keys->ToggleReadOnly.handleKeyDown = HK_ToggleReadOnly; keys->ToggleReadOnly.code = "ToggleReadOnly"; keys->ToggleReadOnly.name = L"Toggle Read Only"; diff --git a/desmume/src/windows/hotkey.h b/desmume/src/windows/hotkey.h index 9951d38ca..1b4a836fc 100644 --- a/desmume/src/windows/hotkey.h +++ b/desmume/src/windows/hotkey.h @@ -84,6 +84,7 @@ struct SCustomKeys SCustomKey ToggleFPS; SCustomKey ToggleInput; SCustomKey ToggleLag; + SCustomKey ResetLagCounter; SCustomKey LastItem; // dummy, must be last //--methods-- diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index fe1831979..5497ced87 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1145,6 +1145,8 @@ DWORD WINAPI run() else osd->addFixed(Hud.FrameCounter.x, Hud.FrameCounter.y, "%d (no movie)",currFrameCounter); } + if (ShowLagFrameCounter) osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames); + if (ShowMicrophone) osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay); if(!AVI_IsRecording()) osd->update(); Display(); @@ -1266,8 +1268,6 @@ DWORD WINAPI run() emu_halt(); SPU_Pause(1); } - if (ShowLagFrameCounter) osd->addFixed(Hud.LagFrameCounter.x, Hud.LagFrameCounter.y, "%d",TotalLagFrames); - if (ShowMicrophone) osd->addFixed(Hud.Microphone.x, Hud.Microphone.y, "%d",MicDisplay); // DisplayMessage(); CheckMessages();