movie: migrate logging macros

This commit is contained in:
Valentin Vanelslande 2018-03-31 00:24:21 -06:00 committed by GitHub
parent 11b9d303da
commit 4fa1628fb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,7 +127,7 @@ bool Movie::IsRecordingInput() {
void Movie::CheckInputEnd() { void Movie::CheckInputEnd() {
if (current_byte + sizeof(ControllerState) > recorded_input.size()) { if (current_byte + sizeof(ControllerState) > recorded_input.size()) {
LOG_INFO(Movie, "Playback finished"); NGLOG_INFO(Movie, "Playback finished");
play_mode = PlayMode::None; 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); current_byte += sizeof(ControllerState);
if (s.type != ControllerStateType::PadAndCircle) { if (s.type != ControllerStateType::PadAndCircle) {
LOG_ERROR(Movie, NGLOG_ERROR(Movie,
"Expected to read type %d, but found %d. Your playback will be out of sync", "Expected to read type {}, but found {}. Your playback will be out of sync",
ControllerStateType::PadAndCircle, s.type); static_cast<int>(ControllerStateType::PadAndCircle), static_cast<int>(s.type));
return; return;
} }
@ -167,9 +167,9 @@ void Movie::Play(Service::HID::TouchDataEntry& touch_data) {
current_byte += sizeof(ControllerState); current_byte += sizeof(ControllerState);
if (s.type != ControllerStateType::Touch) { if (s.type != ControllerStateType::Touch) {
LOG_ERROR(Movie, NGLOG_ERROR(Movie,
"Expected to read type %d, but found %d. Your playback will be out of sync", "Expected to read type {}, but found {}. Your playback will be out of sync",
ControllerStateType::Touch, s.type); static_cast<int>(ControllerStateType::Touch), static_cast<int>(s.type));
return; return;
} }
@ -184,9 +184,9 @@ void Movie::Play(Service::HID::AccelerometerDataEntry& accelerometer_data) {
current_byte += sizeof(ControllerState); current_byte += sizeof(ControllerState);
if (s.type != ControllerStateType::Accelerometer) { if (s.type != ControllerStateType::Accelerometer) {
LOG_ERROR(Movie, NGLOG_ERROR(Movie,
"Expected to read type %d, but found %d. Your playback will be out of sync", "Expected to read type {}, but found {}. Your playback will be out of sync",
ControllerStateType::Accelerometer, s.type); static_cast<int>(ControllerStateType::Accelerometer), static_cast<int>(s.type));
return; return;
} }
@ -201,9 +201,9 @@ void Movie::Play(Service::HID::GyroscopeDataEntry& gyroscope_data) {
current_byte += sizeof(ControllerState); current_byte += sizeof(ControllerState);
if (s.type != ControllerStateType::Gyroscope) { if (s.type != ControllerStateType::Gyroscope) {
LOG_ERROR(Movie, NGLOG_ERROR(Movie,
"Expected to read type %d, but found %d. Your playback will be out of sync", "Expected to read type {}, but found {}. Your playback will be out of sync",
ControllerStateType::Gyroscope, s.type); static_cast<int>(ControllerStateType::Gyroscope), static_cast<int>(s.type));
return; return;
} }
@ -218,9 +218,9 @@ void Movie::Play(Service::IR::PadState& pad_state, s16& c_stick_x, s16& c_stick_
current_byte += sizeof(ControllerState); current_byte += sizeof(ControllerState);
if (s.type != ControllerStateType::IrRst) { if (s.type != ControllerStateType::IrRst) {
LOG_ERROR(Movie, NGLOG_ERROR(Movie,
"Expected to read type %d, but found %d. Your playback will be out of sync", "Expected to read type {}, but found {}. Your playback will be out of sync",
ControllerStateType::IrRst, s.type); static_cast<int>(ControllerStateType::IrRst), static_cast<int>(s.type));
return; return;
} }
@ -236,9 +236,9 @@ void Movie::Play(Service::IR::ExtraHIDResponse& extra_hid_response) {
current_byte += sizeof(ControllerState); current_byte += sizeof(ControllerState);
if (s.type != ControllerStateType::ExtraHidResponse) { if (s.type != ControllerStateType::ExtraHidResponse) {
LOG_ERROR(Movie, NGLOG_ERROR(
"Expected to read type %d, but found %d. Your playback will be out of sync", Movie, "Expected to read type {}, but found {}. Your playback will be out of sync",
ControllerStateType::ExtraHidResponse, s.type); static_cast<int>(ControllerStateType::ExtraHidResponse), static_cast<int>(s.type));
return; return;
} }
@ -342,7 +342,7 @@ void Movie::Record(const Service::IR::ExtraHIDResponse& extra_hid_response) {
bool Movie::ValidateHeader(const CTMHeader& header) { bool Movie::ValidateHeader(const CTMHeader& header) {
if (header_magic_bytes != header.filetype) { 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; return false;
} }
@ -351,25 +351,25 @@ bool Movie::ValidateHeader(const CTMHeader& header) {
revision = Common::ToLower(revision); revision = Common::ToLower(revision);
if (revision != Common::g_scm_rev) { if (revision != Common::g_scm_rev) {
LOG_WARNING(Movie, NGLOG_WARNING(
"This movie was created on a different version of Citra, playback may desync"); Movie, "This movie was created on a different version of Citra, playback may desync");
} }
u64 program_id; u64 program_id;
Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id); Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id);
if (program_id != header.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; return true;
} }
void Movie::SaveMovie() { void Movie::SaveMovie() {
LOG_INFO(Movie, "Saving movie"); NGLOG_INFO(Movie, "Saving movie");
FileUtil::IOFile save_record(Settings::values.movie_record, "wb"); FileUtil::IOFile save_record(Settings::values.movie_record, "wb");
if (!save_record.IsGood()) { 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; return;
} }
@ -387,13 +387,13 @@ void Movie::SaveMovie() {
save_record.WriteBytes(recorded_input.data(), recorded_input.size()); save_record.WriteBytes(recorded_input.data(), recorded_input.size());
if (!save_record.IsGood()) { if (!save_record.IsGood()) {
LOG_ERROR(Movie, "Error saving movie"); NGLOG_ERROR(Movie, "Error saving movie");
} }
} }
void Movie::Init() { void Movie::Init() {
if (!Settings::values.movie_play.empty()) { 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"); FileUtil::IOFile save_record(Settings::values.movie_play, "rb");
u64 size = save_record.GetSize(); u64 size = save_record.GetSize();
@ -407,13 +407,13 @@ void Movie::Init() {
current_byte = 0; current_byte = 0;
} }
} else { } else {
LOG_ERROR(Movie, "Failed to playback movie: Unable to open '%s'", NGLOG_ERROR(Movie, "Failed to playback movie: Unable to open '{}'",
Settings::values.movie_play.c_str()); Settings::values.movie_play);
} }
} }
if (!Settings::values.movie_record.empty()) { if (!Settings::values.movie_record.empty()) {
LOG_INFO(Movie, "Enabling Movie recording"); NGLOG_INFO(Movie, "Enabling Movie recording");
play_mode = PlayMode::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) { void Movie::HandleExtraHidResponse(Service::IR::ExtraHIDResponse& extra_hid_response) {
Handle(extra_hid_response); Handle(extra_hid_response);
} }
}; // namespace Core } // namespace Core