Movie: Reset wiimotes at at start of recording/playback,

to prevent desync issues which occur when the a game has been opened beforehand
This commit is contained in:
rabbott99 2015-12-22 23:26:18 -05:00
parent 1b69743ba1
commit 9e54cf80c2
4 changed files with 19 additions and 2 deletions

View File

@ -51,6 +51,12 @@ void Initialize(void* const hwnd, bool wait)
Movie::ChangeWiiPads();
}
void ResetAllWiimotes()
{
for (int i = WIIMOTE_CHAN_0; i < MAX_BBMOTES; ++i)
static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(i))->Reset();
}
void LoadConfig()
{
s_config.LoadConfig(false);

View File

@ -37,6 +37,7 @@ namespace Wiimote
void Shutdown();
void Initialize(void* const hwnd, bool wait = false);
void ResetAllWiimotes();
void LoadConfig();
void Resume();
void Pause();

View File

@ -115,6 +115,7 @@ public:
void InterruptChannel(const u16 _channelID, const void* _pData, u32 _Size);
void ControlChannel(const u16 _channelID, const void* _pData, u32 _Size);
void ConnectOnInput();
void Reset();
void DoState(PointerWrap& p);
void RealState();
@ -145,8 +146,6 @@ private:
u8* data;
};
void Reset();
void ReportMode(const wm_report_mode* const dr);
void SendAck(const u8 _reportID);
void RequestStatus(const wm_request_status* const rs = nullptr);

View File

@ -500,6 +500,14 @@ bool BeginRecordingInput(int controllers)
md5thread.detach();
GetSettings();
}
// Wiimotes cause desync issues if they're not reset before launching the game
if (!Core::IsRunningAndStarted())
{
// This will also reset the wiimotes for gamecube games, but that shouldn't do anything
Wiimote::ResetAllWiimotes();
}
s_playMode = MODE_RECORDING;
s_author = SConfig::GetInstance().m_strMovieAuthor;
EnsureTmpInputSize(1);
@ -854,6 +862,9 @@ bool PlayInput(const std::string& filename)
s_playMode = MODE_PLAYING;
// Wiimotes cause desync issues if they're not reset before launching the game
Wiimote::ResetAllWiimotes();
Core::UpdateWantDeterminism();
s_totalBytes = g_recordfd.GetSize() - 256;