Merge pull request #3393 from rabbott99/desync-fix

Movie: Reset wiimotes at at start of recording/playback to fix desync issues
This commit is contained in:
skidau 2015-12-29 11:58:03 +11:00
commit c16c2d9356
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;