diff --git a/Source/Core/Core/Src/OnFrame.cpp b/Source/Core/Core/Src/OnFrame.cpp index a6a39aaba4..701a30ac7d 100644 --- a/Source/Core/Core/Src/OnFrame.cpp +++ b/Source/Core/Core/Src/OnFrame.cpp @@ -64,13 +64,8 @@ void FrameUpdate() { fread(g_padStates, sizeof(ControllerState), g_numPads, g_recordfd); // End of recording - if(feof(g_recordfd)) { - fclose(g_recordfd); - g_recordfd = NULL; - g_numPads = 0; - delete[] g_padStates; - g_playMode = MODE_NONE; - } + if(feof(g_recordfd)) + EndPlayInput(); } } @@ -269,6 +264,8 @@ void RecordInput(SPADStatus *PadStatus, int controllerID) g_padStates[controllerID].CStickX = PadStatus->substickX; g_padStates[controllerID].CStickY = PadStatus->substickY; + + PlayController(PadStatus, controllerID); } bool PlayInput(const char *filename) @@ -367,4 +364,12 @@ void PlayController(SPADStatus *PadStatus, int controllerID) PadStatus->substickY = g_padStates[controllerID].CStickY; } +void EndPlayInput() { + fclose(g_recordfd); + g_recordfd = NULL; + g_numPads = 0; + delete[] g_padStates; + g_playMode = MODE_NONE; +} + }; diff --git a/Source/Core/Core/Src/OnFrame.h b/Source/Core/Core/Src/OnFrame.h index f2bd9eac53..9b1773840a 100644 --- a/Source/Core/Core/Src/OnFrame.h +++ b/Source/Core/Core/Src/OnFrame.h @@ -92,6 +92,7 @@ void EndRecordingInput(); bool PlayInput(const char *filename); void PlayController(SPADStatus *PadStatus, int controllerID); +void EndPlayInput(); }; diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 7533b5a11b..4cb798ddf4 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -584,6 +584,8 @@ void CFrame::DoStop() // TODO: Show the author/description dialog here if(Frame::IsRecordingInput()) Frame::EndRecordingInput(); + if(Frame::IsPlayingInput()) + Frame::EndPlayInput(); Core::Stop(); UpdateGUI();