diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 25b8f54018..5eb9b32a10 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -79,9 +79,16 @@ namespace Movie using namespace WiimoteCommon; using namespace WiimoteEmu; +enum class PlayMode +{ + None = 0, + Recording, + Playing, +}; + static bool s_bReadOnly = true; static u32 s_rerecords = 0; -static PlayMode s_playMode = MODE_NONE; +static PlayMode s_playMode = PlayMode::None; static std::array s_controllers{}; static std::array s_wiimotes{}; @@ -308,7 +315,7 @@ void SetReadOnly(bool bEnabled) bool IsRecordingInput() { - return (s_playMode == MODE_RECORDING); + return (s_playMode == PlayMode::Recording); } bool IsRecordingInputFromSaveState() @@ -328,12 +335,12 @@ bool IsJustStartingPlayingInputFromSaveState() bool IsPlayingInput() { - return (s_playMode == MODE_PLAYING); + return (s_playMode == PlayMode::Playing); } bool IsMovieActive() { - return s_playMode != MODE_NONE; + return s_playMode != PlayMode::None; } bool IsReadOnly() @@ -528,7 +535,7 @@ void ChangeWiiPads(bool instantly) bool BeginRecordingInput(const ControllerTypeArray& controllers, const WiimoteEnabledArray& wiimotes) { - if (s_playMode != MODE_NONE || + if (s_playMode != PlayMode::None || (controllers == ControllerTypeArray{} && wiimotes == WiimoteEnabledArray{})) return false; @@ -585,7 +592,7 @@ bool BeginRecordingInput(const ControllerTypeArray& controllers, Wiimote::ResetAllWiimotes(); } - s_playMode = MODE_RECORDING; + s_playMode = PlayMode::Recording; s_author = Config::Get(Config::MAIN_MOVIE_MOVIE_AUTHOR); s_temp_input.clear(); @@ -937,7 +944,7 @@ void ReadHeader() // NOTE: Host Thread bool PlayInput(const std::string& movie_path, std::optional* savestate_path) { - if (s_playMode != MODE_NONE) + if (s_playMode != PlayMode::None) return false; File::IOFile recording_file(movie_path, "rb"); @@ -959,7 +966,7 @@ bool PlayInput(const std::string& movie_path, std::optional* savest s_currentLagCount = 0; s_currentInputCount = 0; - s_playMode = MODE_PLAYING; + s_playMode = PlayMode::Playing; // Wiimotes cause desync issues if they're not reset before launching the game Wiimote::ResetAllWiimotes(); @@ -1139,18 +1146,18 @@ void LoadInput(const std::string& movie_path) { if (s_bReadOnly) { - if (s_playMode != MODE_PLAYING) + if (s_playMode != PlayMode::Playing) { - s_playMode = MODE_PLAYING; + s_playMode = PlayMode::Playing; Core::UpdateWantDeterminism(); Core::DisplayMessage("Switched to playback", 2000); } } else { - if (s_playMode != MODE_RECORDING) + if (s_playMode != PlayMode::Recording) { - s_playMode = MODE_RECORDING; + s_playMode = PlayMode::Recording; Core::UpdateWantDeterminism(); Core::DisplayMessage("Switched to recording", 2000); } @@ -1317,10 +1324,10 @@ void EndPlayInput(bool cont) // If !IsMovieActive(), changing s_playMode requires calling UpdateWantDeterminism ASSERT(IsMovieActive()); - s_playMode = MODE_RECORDING; + s_playMode = PlayMode::Recording; Core::DisplayMessage("Reached movie end. Resuming recording.", 2000); } - else if (s_playMode != MODE_NONE) + else if (s_playMode != PlayMode::None) { // We can be called by EmuThread during boot (CPU::State::PowerDown) bool was_running = Core::IsRunningAndStarted() && !CPU::IsStepping(); @@ -1328,7 +1335,7 @@ void EndPlayInput(bool cont) CPU::Break(); s_rerecords = 0; s_currentByte = 0; - s_playMode = MODE_NONE; + s_playMode = PlayMode::None; Core::DisplayMessage("Movie End.", 2000); s_bRecordingFromSaveState = false; // we don't clear these things because otherwise we can't resume playback if we load a movie diff --git a/Source/Core/Core/Movie.h b/Source/Core/Core/Movie.h index a774f7ad4e..25747cd8a2 100644 --- a/Source/Core/Core/Movie.h +++ b/Source/Core/Core/Movie.h @@ -37,13 +37,6 @@ class EncryptionKey; namespace Movie { // Enumerations and structs -enum PlayMode -{ - MODE_NONE = 0, - MODE_RECORDING, - MODE_PLAYING -}; - enum class ControllerType { None = 0,