Allow hard resets to be recorded in movies.

This commit is contained in:
Rachel Bryk 2014-11-02 01:58:59 -05:00
parent 9daaf94f3c
commit f9495a484c
3 changed files with 18 additions and 10 deletions

View File

@ -21,6 +21,7 @@
#include "Core/DSP/DSPCore.h"
#include "Core/HW/DVDInterface.h"
#include "Core/HW/EXI_Device.h"
#include "Core/HW/ProcessorInterface.h"
#include "Core/HW/SI.h"
#include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
@ -65,6 +66,7 @@ static std::string s_videoBackend = "unknown";
static int s_iCPUCore = 1;
bool g_bClearSave = false;
bool g_bDiscChange = false;
bool g_bReset = false;
static std::string s_author = "";
std::string g_discChange = "";
u64 g_titleID = 0;
@ -576,6 +578,8 @@ static void SetInputDisplayString(ControllerState padState, int controllerID)
s_InputDisplay[controllerID].append(" LEFT");
if (padState.DPadRight)
s_InputDisplay[controllerID].append(" RIGHT");
if (padState.reset)
s_InputDisplay[controllerID].append(" RESET");
s_InputDisplay[controllerID].append(Analog1DToString(padState.TriggerL, " L"));
s_InputDisplay[controllerID].append(Analog1DToString(padState.TriggerR, " R"));
@ -726,6 +730,11 @@ void CheckPadStatus(GCPadStatus* PadStatus, int controllerID)
s_padState.CStickX = PadStatus->substickX;
s_padState.CStickY = PadStatus->substickY;
s_padState.disc = g_bDiscChange;
g_bDiscChange = false;
s_padState.reset = g_bReset;
g_bReset = false;
SetInputDisplayString(s_padState, controllerID);
}
@ -736,12 +745,6 @@ void RecordInput(GCPadStatus* PadStatus, int controllerID)
CheckPadStatus(PadStatus, controllerID);
if (g_bDiscChange)
{
s_padState.disc = g_bDiscChange;
g_bDiscChange = false;
}
EnsureTmpInputSize((size_t)(s_currentByte + 8));
memcpy(&(tmpInput[s_currentByte]), &s_padState, 8);
s_currentByte += 8;
@ -1111,6 +1114,9 @@ void PlayController(GCPadStatus* PadStatus, int controllerID)
}
}
if (s_padState.reset)
ProcessorInterface::ResetButton_Tap();
SetInputDisplayString(s_padState, controllerID);
CheckInputEnd();
}

View File

@ -39,18 +39,18 @@ struct ControllerState
DPadLeft:1, DPadRight:1;
bool L:1, R:1; // Binary triggers, 2 bits
bool disc:1; // Checks for disc being changed
bool reserved:3; // Reserved bits used for padding, 4 bits
bool reset:1; // Console reset button
bool reserved:2; // Reserved bits used for padding, 2 bits
u8 TriggerL, TriggerR; // Triggers, 16 bits
u8 AnalogStickX, AnalogStickY; // Main Stick, 16 bits
u8 CStickX, CStickY; // Sub-Stick, 16 bits
}; // Total: 60 + 4 = 64 bits per frame
};
static_assert(sizeof(ControllerState) == 8, "ControllerState should be 8 bytes");
#pragma pack(pop)
// Global declarations
extern bool g_bDiscChange, g_bClearSave;
extern bool g_bDiscChange, g_bClearSave, g_bReset;
extern u64 g_titleID;
extern u64 g_currentFrame, g_totalFrames;

View File

@ -1307,6 +1307,8 @@ void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
void CFrame::OnReset(wxCommandEvent& WXUNUSED (event))
{
if (Movie::IsRecordingInput())
Movie::g_bReset = true;
ProcessorInterface::ResetButton_Tap();
}