mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
Added the per-frame action manager. Implemented all TAS features: Auto Firing/Holding, Frame Advance. They all work perfectly (test it yourselves by changing the globals), they just need some GUI.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3947 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
270825cf71
commit
9cbfadb885
@ -2244,6 +2244,14 @@
|
|||||||
RelativePath=".\Src\CoreTiming.h"
|
RelativePath=".\Src\CoreTiming.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\Frame.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\Src\Frame.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\Src\Host.h"
|
RelativePath=".\Src\Host.h"
|
||||||
>
|
>
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
#include "LogManager.h"
|
#include "LogManager.h"
|
||||||
|
|
||||||
#include "State.h"
|
#include "State.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#define WINAPI
|
#define WINAPI
|
||||||
@ -592,9 +593,8 @@ void Callback_VideoLog(const TCHAR *_szMessage, int _bDoBreak)
|
|||||||
// We do not write to anything outside this function here
|
// We do not write to anything outside this function here
|
||||||
void Callback_VideoCopiedToXFB(bool video_update)
|
void Callback_VideoCopiedToXFB(bool video_update)
|
||||||
{
|
{
|
||||||
#ifdef RERECORDING
|
if(!video_update)
|
||||||
FrameUpdate();
|
Frame::FrameUpdate();
|
||||||
#endif
|
|
||||||
|
|
||||||
SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
SCoreStartupParameter& _CoreParameter = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||||
|
|
||||||
|
93
Source/Core/Core/Src/Frame.cpp
Normal file
93
Source/Core/Core/Src/Frame.cpp
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
38
Source/Core/Core/Src/Frame.h
Normal file
38
Source/Core/Core/Src/Frame.h
Normal file
@ -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
|
@ -25,6 +25,8 @@
|
|||||||
#include "EXI_Device.h"
|
#include "EXI_Device.h"
|
||||||
#include "EXI_DeviceMic.h"
|
#include "EXI_DeviceMic.h"
|
||||||
|
|
||||||
|
#include "../Frame.h"
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// --- standard gamecube controller ---
|
// --- standard gamecube controller ---
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -146,6 +148,9 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if(Frame::IsAutoFiring())
|
||||||
|
Frame::ModifyController(&PadStatus);
|
||||||
|
|
||||||
// Thankfully changing mode does not change the high bits ;)
|
// Thankfully changing mode does not change the high bits ;)
|
||||||
_Hi = (u32)((u8)PadStatus.stickY);
|
_Hi = (u32)((u8)PadStatus.stickY);
|
||||||
_Hi |= (u32)((u8)PadStatus.stickX << 8);
|
_Hi |= (u32)((u8)PadStatus.stickX << 8);
|
||||||
|
@ -11,6 +11,7 @@ files = ["ActionReplay.cpp",
|
|||||||
"CoreParameter.cpp",
|
"CoreParameter.cpp",
|
||||||
"CoreRerecording.cpp",
|
"CoreRerecording.cpp",
|
||||||
"CoreTiming.cpp",
|
"CoreTiming.cpp",
|
||||||
|
"Frame.cpp",
|
||||||
"Host.cpp",
|
"Host.cpp",
|
||||||
"MemTools.cpp",
|
"MemTools.cpp",
|
||||||
"PatchEngine.cpp",
|
"PatchEngine.cpp",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user