diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj
index d9ce0fc178..cf4947f50c 100644
--- a/Source/Core/Core/Core.vcproj
+++ b/Source/Core/Core/Core.vcproj
@@ -2244,6 +2244,14 @@
RelativePath=".\Src\CoreTiming.h"
>
+
+
+
+
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index ccb5599746..9124d9e881 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -56,6 +56,7 @@
#include "LogManager.h"
#include "State.h"
+#include "Frame.h"
#ifndef _WIN32
#define WINAPI
@@ -592,9 +593,8 @@ void Callback_VideoLog(const TCHAR *_szMessage, int _bDoBreak)
// We do not write to anything outside this function here
void Callback_VideoCopiedToXFB(bool video_update)
{
- #ifdef RERECORDING
- FrameUpdate();
- #endif
+ if(!video_update)
+ Frame::FrameUpdate();
SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
diff --git a/Source/Core/Core/Src/Frame.cpp b/Source/Core/Core/Src/Frame.cpp
new file mode 100644
index 0000000000..0cb636cf2c
--- /dev/null
+++ b/Source/Core/Core/Src/Frame.cpp
@@ -0,0 +1,93 @@
+// Copyright (C) 2003 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#include "Core.h"
+#include "PluginManager.h"
+
+namespace Frame {
+
+bool g_bFrameStep = false;
+bool g_bAutoFire = false;
+u32 g_autoFirstKey = 0, g_autoSecondKey = 0;
+bool g_bFirstKey = true;
+
+void FrameUpdate() {
+ if(g_bFrameStep)
+ Core::SetState(Core::CORE_PAUSE);
+
+ if(g_bAutoFire)
+ g_bFirstKey = !g_bFirstKey;
+}
+
+void SetAutoHold(bool bEnabled, u32 keyToHold) {
+ g_bAutoFire = bEnabled;
+ if(bEnabled)
+ g_autoFirstKey = g_autoSecondKey = keyToHold;
+ else
+ g_autoFirstKey = g_autoSecondKey = 0;
+}
+
+void SetAutoFire(bool bEnabled, u32 keyOne, u32 keyTwo) {
+ g_bAutoFire = bEnabled;
+ if(bEnabled) {
+ g_autoFirstKey = keyOne;
+ g_autoSecondKey = keyTwo;
+ } else
+ g_autoFirstKey = g_autoSecondKey = 0;
+
+ g_bFirstKey = true;
+}
+
+bool IsAutoFiring() {
+ return g_bAutoFire;
+}
+
+void SetFrameStepping(bool bEnabled) {
+ g_bFrameStep = bEnabled;
+}
+
+
+void ModifyController(SPADStatus *PadStatus) {
+ u32 keyToPress = (g_bFirstKey) ? g_autoFirstKey : g_autoSecondKey;
+
+ if(!keyToPress)
+ return;
+
+ PadStatus->button |= keyToPress;
+
+ switch(keyToPress) {
+ default:
+ return;
+
+ case PAD_BUTTON_A:
+ PadStatus->analogA = 255;
+ break;
+ case PAD_BUTTON_B:
+ PadStatus->analogB = 255;
+ break;
+
+ case PAD_TRIGGER_L:
+ PadStatus->triggerLeft = 255;
+ break;
+ case PAD_TRIGGER_R:
+ PadStatus->triggerRight = 255;
+ break;
+ }
+
+}
+
+};
diff --git a/Source/Core/Core/Src/Frame.h b/Source/Core/Core/Src/Frame.h
new file mode 100644
index 0000000000..e60e806c8d
--- /dev/null
+++ b/Source/Core/Core/Src/Frame.h
@@ -0,0 +1,38 @@
+// Copyright (C) 2003 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef __FRAME_H
+#define __FRAME_H
+
+// Per-(video )Frame actions
+
+namespace Frame {
+
+void FrameUpdate();
+
+bool IsAutoFiring();
+
+void SetAutoHold(bool bEnabled, u32 keyToHold = 0);
+void SetAutoFire(bool bEnabled, u32 keyOne = 0, u32 keyTwo = 0);
+
+void SetFrameStepping(bool bEnabled);
+
+void ModifyController(SPADStatus *PadStatus);
+
+};
+
+#endif // __FRAME_H
diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp
index 89214b6755..0afc84b7db 100644
--- a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp
+++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp
@@ -25,6 +25,8 @@
#include "EXI_Device.h"
#include "EXI_DeviceMic.h"
+#include "../Frame.h"
+
//////////////////////////////////////////////////////////////////////////
// --- standard gamecube controller ---
//////////////////////////////////////////////////////////////////////////
@@ -146,6 +148,9 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
}
#endif
+ if(Frame::IsAutoFiring())
+ Frame::ModifyController(&PadStatus);
+
// Thankfully changing mode does not change the high bits ;)
_Hi = (u32)((u8)PadStatus.stickY);
_Hi |= (u32)((u8)PadStatus.stickX << 8);
diff --git a/Source/Core/Core/Src/SConscript b/Source/Core/Core/Src/SConscript
index edd5049634..26bc7a4887 100644
--- a/Source/Core/Core/Src/SConscript
+++ b/Source/Core/Core/Src/SConscript
@@ -11,6 +11,7 @@ files = ["ActionReplay.cpp",
"CoreParameter.cpp",
"CoreRerecording.cpp",
"CoreTiming.cpp",
+ "Frame.cpp",
"Host.cpp",
"MemTools.cpp",
"PatchEngine.cpp",