Skip to content

Commit

Permalink
Merge pull request #1471 from RachelBryk/reset-record
Browse files Browse the repository at this point in the history
Allow hard resets to be recorded in movies.
  • Loading branch information
skidau committed Nov 4, 2014
2 parents 80d60c8 + f9495a4 commit dc63f8f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
18 changes: 12 additions & 6 deletions Source/Core/Core/Movie.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
Expand Down Expand Up @@ -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);
}

Expand All @@ -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;
Expand Down Expand Up @@ -1110,6 +1113,9 @@ void PlayController(GCPadStatus* PadStatus, int controllerID)
}
}

if (s_padState.reset)
ProcessorInterface::ResetButton_Tap();

SetInputDisplayString(s_padState, controllerID);
CheckInputEnd();
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Core/Core/Movie.h
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/DolphinWX/FrameTools.cpp
Expand Up @@ -1306,6 +1306,8 @@ void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))

void CFrame::OnReset(wxCommandEvent& WXUNUSED (event))
{
if (Movie::IsRecordingInput())
Movie::g_bReset = true;
ProcessorInterface::ResetButton_Tap();
}

Expand Down

0 comments on commit dc63f8f

Please sign in to comment.