From 4fa1628fb6119da94fbb0726a2df6c6fe3c76b13 Mon Sep 17 00:00:00 2001 From: Valentin Vanelslande Date: Sat, 31 Mar 2018 00:24:21 -0600 Subject: [PATCH] movie: migrate logging macros --- src/core/movie.cpp | 62 +++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/core/movie.cpp b/src/core/movie.cpp index 87271f73f..92a65c197 100644 --- a/src/core/movie.cpp +++ b/src/core/movie.cpp @@ -127,7 +127,7 @@ bool Movie::IsRecordingInput() { void Movie::CheckInputEnd() { if (current_byte + sizeof(ControllerState) > recorded_input.size()) { - LOG_INFO(Movie, "Playback finished"); + NGLOG_INFO(Movie, "Playback finished"); play_mode = PlayMode::None; } } @@ -138,9 +138,9 @@ void Movie::Play(Service::HID::PadState& pad_state, s16& circle_pad_x, s16& circ current_byte += sizeof(ControllerState); if (s.type != ControllerStateType::PadAndCircle) { - LOG_ERROR(Movie, - "Expected to read type %d, but found %d. Your playback will be out of sync", - ControllerStateType::PadAndCircle, s.type); + NGLOG_ERROR(Movie, + "Expected to read type {}, but found {}. Your playback will be out of sync", + static_cast(ControllerStateType::PadAndCircle), static_cast(s.type)); return; } @@ -167,9 +167,9 @@ void Movie::Play(Service::HID::TouchDataEntry& touch_data) { current_byte += sizeof(ControllerState); if (s.type != ControllerStateType::Touch) { - LOG_ERROR(Movie, - "Expected to read type %d, but found %d. Your playback will be out of sync", - ControllerStateType::Touch, s.type); + NGLOG_ERROR(Movie, + "Expected to read type {}, but found {}. Your playback will be out of sync", + static_cast(ControllerStateType::Touch), static_cast(s.type)); return; } @@ -184,9 +184,9 @@ void Movie::Play(Service::HID::AccelerometerDataEntry& accelerometer_data) { current_byte += sizeof(ControllerState); if (s.type != ControllerStateType::Accelerometer) { - LOG_ERROR(Movie, - "Expected to read type %d, but found %d. Your playback will be out of sync", - ControllerStateType::Accelerometer, s.type); + NGLOG_ERROR(Movie, + "Expected to read type {}, but found {}. Your playback will be out of sync", + static_cast(ControllerStateType::Accelerometer), static_cast(s.type)); return; } @@ -201,9 +201,9 @@ void Movie::Play(Service::HID::GyroscopeDataEntry& gyroscope_data) { current_byte += sizeof(ControllerState); if (s.type != ControllerStateType::Gyroscope) { - LOG_ERROR(Movie, - "Expected to read type %d, but found %d. Your playback will be out of sync", - ControllerStateType::Gyroscope, s.type); + NGLOG_ERROR(Movie, + "Expected to read type {}, but found {}. Your playback will be out of sync", + static_cast(ControllerStateType::Gyroscope), static_cast(s.type)); return; } @@ -218,9 +218,9 @@ void Movie::Play(Service::IR::PadState& pad_state, s16& c_stick_x, s16& c_stick_ current_byte += sizeof(ControllerState); if (s.type != ControllerStateType::IrRst) { - LOG_ERROR(Movie, - "Expected to read type %d, but found %d. Your playback will be out of sync", - ControllerStateType::IrRst, s.type); + NGLOG_ERROR(Movie, + "Expected to read type {}, but found {}. Your playback will be out of sync", + static_cast(ControllerStateType::IrRst), static_cast(s.type)); return; } @@ -236,9 +236,9 @@ void Movie::Play(Service::IR::ExtraHIDResponse& extra_hid_response) { current_byte += sizeof(ControllerState); if (s.type != ControllerStateType::ExtraHidResponse) { - LOG_ERROR(Movie, - "Expected to read type %d, but found %d. Your playback will be out of sync", - ControllerStateType::ExtraHidResponse, s.type); + NGLOG_ERROR( + Movie, "Expected to read type {}, but found {}. Your playback will be out of sync", + static_cast(ControllerStateType::ExtraHidResponse), static_cast(s.type)); return; } @@ -342,7 +342,7 @@ void Movie::Record(const Service::IR::ExtraHIDResponse& extra_hid_response) { bool Movie::ValidateHeader(const CTMHeader& header) { if (header_magic_bytes != header.filetype) { - LOG_ERROR(Movie, "Playback file does not have valid header"); + NGLOG_ERROR(Movie, "Playback file does not have valid header"); return false; } @@ -351,25 +351,25 @@ bool Movie::ValidateHeader(const CTMHeader& header) { revision = Common::ToLower(revision); if (revision != Common::g_scm_rev) { - LOG_WARNING(Movie, - "This movie was created on a different version of Citra, playback may desync"); + NGLOG_WARNING( + Movie, "This movie was created on a different version of Citra, playback may desync"); } u64 program_id; Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id); if (program_id != header.program_id) { - LOG_WARNING(Movie, "This movie was recorded using a ROM with a different program id"); + NGLOG_WARNING(Movie, "This movie was recorded using a ROM with a different program id"); } return true; } void Movie::SaveMovie() { - LOG_INFO(Movie, "Saving movie"); + NGLOG_INFO(Movie, "Saving movie"); FileUtil::IOFile save_record(Settings::values.movie_record, "wb"); if (!save_record.IsGood()) { - LOG_ERROR(Movie, "Unable to open file to save movie"); + NGLOG_ERROR(Movie, "Unable to open file to save movie"); return; } @@ -387,13 +387,13 @@ void Movie::SaveMovie() { save_record.WriteBytes(recorded_input.data(), recorded_input.size()); if (!save_record.IsGood()) { - LOG_ERROR(Movie, "Error saving movie"); + NGLOG_ERROR(Movie, "Error saving movie"); } } void Movie::Init() { if (!Settings::values.movie_play.empty()) { - LOG_INFO(Movie, "Loading Movie for playback"); + NGLOG_INFO(Movie, "Loading Movie for playback"); FileUtil::IOFile save_record(Settings::values.movie_play, "rb"); u64 size = save_record.GetSize(); @@ -407,13 +407,13 @@ void Movie::Init() { current_byte = 0; } } else { - LOG_ERROR(Movie, "Failed to playback movie: Unable to open '%s'", - Settings::values.movie_play.c_str()); + NGLOG_ERROR(Movie, "Failed to playback movie: Unable to open '{}'", + Settings::values.movie_play); } } if (!Settings::values.movie_record.empty()) { - LOG_INFO(Movie, "Enabling Movie recording"); + NGLOG_INFO(Movie, "Enabling Movie recording"); play_mode = PlayMode::Recording; } } @@ -463,4 +463,4 @@ void Movie::HandleIrRst(Service::IR::PadState& pad_state, s16& c_stick_x, s16& c void Movie::HandleExtraHidResponse(Service::IR::ExtraHIDResponse& extra_hid_response) { Handle(extra_hid_response); } -}; // namespace Core +} // namespace Core