From 693b190274442dc6dff0088e4e9f4d6271063de9 Mon Sep 17 00:00:00 2001 From: Daniel Lim Wee Soong Date: Sat, 24 Mar 2018 21:35:44 +0800 Subject: [PATCH 1/4] audio_core: Migrate logging macros Follow-up of #3533 Replace prefix of all logging macros from LOG to NGLOG --- src/audio_core/hle/hle.cpp | 32 +++++++-------- src/audio_core/hle/mixers.cpp | 20 ++++----- src/audio_core/hle/source.cpp | 72 ++++++++++++++++----------------- src/audio_core/sdl2_sink.cpp | 6 +-- src/audio_core/sink_details.cpp | 2 +- src/audio_core/time_stretch.cpp | 2 +- 6 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/audio_core/hle/hle.cpp b/src/audio_core/hle/hle.cpp index b13b53ee2..16f6b2004 100644 --- a/src/audio_core/hle/hle.cpp +++ b/src/audio_core/hle/hle.cpp @@ -84,21 +84,21 @@ std::vector DspHle::Impl::PipeRead(DspPipe pipe_number, u32 length) { const size_t pipe_index = static_cast(pipe_number); if (pipe_index >= num_dsp_pipe) { - LOG_ERROR(Audio_DSP, "pipe_number = %zu invalid", pipe_index); + NGLOG_ERROR(Audio_DSP, "pipe_number = {} invalid", pipe_index); return {}; } if (length > UINT16_MAX) { // Can only read at most UINT16_MAX from the pipe - LOG_ERROR(Audio_DSP, "length of %u greater than max of %u", length, UINT16_MAX); + NGLOG_ERROR(Audio_DSP, "length of {} greater than max of {}", length, UINT16_MAX); return {}; } std::vector& data = pipe_data[pipe_index]; if (length > data.size()) { - LOG_WARNING( + NGLOG_WARNING( Audio_DSP, - "pipe_number = %zu is out of data, application requested read of %u but %zu remain", + "pipe_number = {} is out of data, application requested read of {} but {} remain", pipe_index, length, data.size()); length = static_cast(data.size()); } @@ -115,7 +115,7 @@ size_t DspHle::Impl::GetPipeReadableSize(DspPipe pipe_number) const { const size_t pipe_index = static_cast(pipe_number); if (pipe_index >= num_dsp_pipe) { - LOG_ERROR(Audio_DSP, "pipe_number = %zu invalid", pipe_index); + NGLOG_ERROR(Audio_DSP, "pipe_number = {} invalid", pipe_index); return 0; } @@ -126,8 +126,8 @@ void DspHle::Impl::PipeWrite(DspPipe pipe_number, const std::vector& buffer) switch (pipe_number) { case DspPipe::Audio: { if (buffer.size() != 4) { - LOG_ERROR(Audio_DSP, "DspPipe::Audio: Unexpected buffer length %zu was written", - buffer.size()); + NGLOG_ERROR(Audio_DSP, "DspPipe::Audio: Unexpected buffer length {} was written", + buffer.size()); return; } @@ -146,30 +146,30 @@ void DspHle::Impl::PipeWrite(DspPipe pipe_number, const std::vector& buffer) switch (static_cast(buffer[0])) { case StateChange::Initialize: - LOG_INFO(Audio_DSP, "Application has requested initialization of DSP hardware"); + NGLOG_INFO(Audio_DSP, "Application has requested initialization of DSP hardware"); ResetPipes(); AudioPipeWriteStructAddresses(); dsp_state = DspState::On; break; case StateChange::Shutdown: - LOG_INFO(Audio_DSP, "Application has requested shutdown of DSP hardware"); + NGLOG_INFO(Audio_DSP, "Application has requested shutdown of DSP hardware"); dsp_state = DspState::Off; break; case StateChange::Wakeup: - LOG_INFO(Audio_DSP, "Application has requested wakeup of DSP hardware"); + NGLOG_INFO(Audio_DSP, "Application has requested wakeup of DSP hardware"); ResetPipes(); AudioPipeWriteStructAddresses(); dsp_state = DspState::On; break; case StateChange::Sleep: - LOG_INFO(Audio_DSP, "Application has requested sleep of DSP hardware"); + NGLOG_INFO(Audio_DSP, "Application has requested sleep of DSP hardware"); UNIMPLEMENTED(); dsp_state = DspState::Sleeping; break; default: - LOG_ERROR(Audio_DSP, - "Application has requested unknown state transition of DSP hardware %hhu", - buffer[0]); + NGLOG_ERROR(Audio_DSP, + "Application has requested unknown state transition of DSP hardware {}", + buffer[0]); dsp_state = DspState::Off; break; } @@ -177,8 +177,8 @@ void DspHle::Impl::PipeWrite(DspPipe pipe_number, const std::vector& buffer) return; } default: - LOG_CRITICAL(Audio_DSP, "pipe_number = %zu unimplemented", - static_cast(pipe_number)); + NGLOG_CRITICAL(Audio_DSP, "pipe_number = {} unimplemented", + static_cast(pipe_number)); UNIMPLEMENTED(); return; } diff --git a/src/audio_core/hle/mixers.cpp b/src/audio_core/hle/mixers.cpp index 533df2be2..ba986e1ae 100644 --- a/src/audio_core/hle/mixers.cpp +++ b/src/audio_core/hle/mixers.cpp @@ -38,49 +38,49 @@ void Mixers::ParseConfig(DspConfiguration& config) { if (config.mixer1_enabled_dirty) { config.mixer1_enabled_dirty.Assign(0); state.mixer1_enabled = config.mixer1_enabled != 0; - LOG_TRACE(Audio_DSP, "mixers mixer1_enabled = %hu", config.mixer1_enabled); + NGLOG_TRACE(Audio_DSP, "mixers mixer1_enabled = {}", config.mixer1_enabled); } if (config.mixer2_enabled_dirty) { config.mixer2_enabled_dirty.Assign(0); state.mixer2_enabled = config.mixer2_enabled != 0; - LOG_TRACE(Audio_DSP, "mixers mixer2_enabled = %hu", config.mixer2_enabled); + NGLOG_TRACE(Audio_DSP, "mixers mixer2_enabled = {}", config.mixer2_enabled); } if (config.volume_0_dirty) { config.volume_0_dirty.Assign(0); state.intermediate_mixer_volume[0] = config.volume[0]; - LOG_TRACE(Audio_DSP, "mixers volume[0] = %f", config.volume[0]); + NGLOG_TRACE(Audio_DSP, "mixers volume[0] = {}", config.volume[0]); } if (config.volume_1_dirty) { config.volume_1_dirty.Assign(0); state.intermediate_mixer_volume[1] = config.volume[1]; - LOG_TRACE(Audio_DSP, "mixers volume[1] = %f", config.volume[1]); + NGLOG_TRACE(Audio_DSP, "mixers volume[1] = {}", config.volume[1]); } if (config.volume_2_dirty) { config.volume_2_dirty.Assign(0); state.intermediate_mixer_volume[2] = config.volume[2]; - LOG_TRACE(Audio_DSP, "mixers volume[2] = %f", config.volume[2]); + NGLOG_TRACE(Audio_DSP, "mixers volume[2] = {}", config.volume[2]); } if (config.output_format_dirty) { config.output_format_dirty.Assign(0); state.output_format = config.output_format; - LOG_TRACE(Audio_DSP, "mixers output_format = %zu", - static_cast(config.output_format)); + NGLOG_TRACE(Audio_DSP, "mixers output_format = {}", + static_cast(config.output_format)); } if (config.headphones_connected_dirty) { config.headphones_connected_dirty.Assign(0); // Do nothing. (Note: Whether headphones are connected does affect coefficients used for // surround sound.) - LOG_TRACE(Audio_DSP, "mixers headphones_connected=%hu", config.headphones_connected); + NGLOG_TRACE(Audio_DSP, "mixers headphones_connected={}", config.headphones_connected); } if (config.dirty_raw) { - LOG_DEBUG(Audio_DSP, "mixers remaining_dirty=%x", config.dirty_raw); + NGLOG_DEBUG(Audio_DSP, "mixers remaining_dirty={}", config.dirty_raw); } config.dirty_raw = 0; @@ -132,7 +132,7 @@ void Mixers::DownmixAndMixIntoCurrentFrame(float gain, const QuadFrame32& sample return; } - UNREACHABLE_MSG("Invalid output_format %zu", static_cast(state.output_format)); + UNREACHABLE_MSG("Invalid output_format {}", static_cast(state.output_format)); } void Mixers::AuxReturn(const IntermediateMixSamples& read_samples) { diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp index 41fd876b5..7d6fca7f6 100644 --- a/src/audio_core/hle/source.cpp +++ b/src/audio_core/hle/source.cpp @@ -54,35 +54,35 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, if (config.reset_flag) { config.reset_flag.Assign(0); Reset(); - LOG_TRACE(Audio_DSP, "source_id=%zu reset", source_id); + NGLOG_TRACE(Audio_DSP, "source_id={} reset", source_id); } if (config.partial_reset_flag) { config.partial_reset_flag.Assign(0); state.input_queue = std::priority_queue, BufferOrder>{}; - LOG_TRACE(Audio_DSP, "source_id=%zu partial_reset", source_id); + NGLOG_TRACE(Audio_DSP, "source_id={} partial_reset", source_id); } if (config.enable_dirty) { config.enable_dirty.Assign(0); state.enabled = config.enable != 0; - LOG_TRACE(Audio_DSP, "source_id=%zu enable=%d", source_id, state.enabled); + NGLOG_TRACE(Audio_DSP, "source_id={} enable={}", source_id, state.enabled); } if (config.sync_dirty) { config.sync_dirty.Assign(0); state.sync = config.sync; - LOG_TRACE(Audio_DSP, "source_id=%zu sync=%u", source_id, state.sync); + NGLOG_TRACE(Audio_DSP, "source_id={} sync={}", source_id, state.sync); } if (config.rate_multiplier_dirty) { config.rate_multiplier_dirty.Assign(0); state.rate_multiplier = config.rate_multiplier; - LOG_TRACE(Audio_DSP, "source_id=%zu rate=%f", source_id, state.rate_multiplier); + NGLOG_TRACE(Audio_DSP, "source_id={} rate={}", source_id, state.rate_multiplier); if (state.rate_multiplier <= 0) { - LOG_ERROR(Audio_DSP, "Was given an invalid rate multiplier: source_id=%zu rate=%f", - source_id, state.rate_multiplier); + NGLOG_ERROR(Audio_DSP, "Was given an invalid rate multiplier: source_id={} rate={}", + source_id, state.rate_multiplier); state.rate_multiplier = 1.0f; // Note: Actual firmware starts producing garbage if this occurs. } @@ -93,69 +93,69 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, std::transform(adpcm_coeffs, adpcm_coeffs + state.adpcm_coeffs.size(), state.adpcm_coeffs.begin(), [](const auto& coeff) { return static_cast(coeff); }); - LOG_TRACE(Audio_DSP, "source_id=%zu adpcm update", source_id); + NGLOG_TRACE(Audio_DSP, "source_id={} adpcm update", source_id); } if (config.gain_0_dirty) { config.gain_0_dirty.Assign(0); std::transform(config.gain[0], config.gain[0] + state.gain[0].size(), state.gain[0].begin(), [](const auto& coeff) { return static_cast(coeff); }); - LOG_TRACE(Audio_DSP, "source_id=%zu gain 0 update", source_id); + NGLOG_TRACE(Audio_DSP, "source_id={} gain 0 update", source_id); } if (config.gain_1_dirty) { config.gain_1_dirty.Assign(0); std::transform(config.gain[1], config.gain[1] + state.gain[1].size(), state.gain[1].begin(), [](const auto& coeff) { return static_cast(coeff); }); - LOG_TRACE(Audio_DSP, "source_id=%zu gain 1 update", source_id); + NGLOG_TRACE(Audio_DSP, "source_id={} gain 1 update", source_id); } if (config.gain_2_dirty) { config.gain_2_dirty.Assign(0); std::transform(config.gain[2], config.gain[2] + state.gain[2].size(), state.gain[2].begin(), [](const auto& coeff) { return static_cast(coeff); }); - LOG_TRACE(Audio_DSP, "source_id=%zu gain 2 update", source_id); + NGLOG_TRACE(Audio_DSP, "source_id={} gain 2 update", source_id); } if (config.filters_enabled_dirty) { config.filters_enabled_dirty.Assign(0); state.filters.Enable(config.simple_filter_enabled.ToBool(), config.biquad_filter_enabled.ToBool()); - LOG_TRACE(Audio_DSP, "source_id=%zu enable_simple=%hu enable_biquad=%hu", source_id, - config.simple_filter_enabled.Value(), config.biquad_filter_enabled.Value()); + NGLOG_TRACE(Audio_DSP, "source_id={} enable_simple={} enable_biquad={}", source_id, + config.simple_filter_enabled.Value(), config.biquad_filter_enabled.Value()); } if (config.simple_filter_dirty) { config.simple_filter_dirty.Assign(0); state.filters.Configure(config.simple_filter); - LOG_TRACE(Audio_DSP, "source_id=%zu simple filter update", source_id); + NGLOG_TRACE(Audio_DSP, "source_id={} simple filter update", source_id); } if (config.biquad_filter_dirty) { config.biquad_filter_dirty.Assign(0); state.filters.Configure(config.biquad_filter); - LOG_TRACE(Audio_DSP, "source_id=%zu biquad filter update", source_id); + NGLOG_TRACE(Audio_DSP, "source_id={} biquad filter update", source_id); } if (config.interpolation_dirty) { config.interpolation_dirty.Assign(0); state.interpolation_mode = config.interpolation_mode; - LOG_TRACE(Audio_DSP, "source_id=%zu interpolation_mode=%zu", source_id, - static_cast(state.interpolation_mode)); + NGLOG_TRACE(Audio_DSP, "source_id={} interpolation_mode={}", source_id, + static_cast(state.interpolation_mode)); } if (config.format_dirty || config.embedded_buffer_dirty) { config.format_dirty.Assign(0); state.format = config.format; - LOG_TRACE(Audio_DSP, "source_id=%zu format=%zu", source_id, - static_cast(state.format)); + NGLOG_TRACE(Audio_DSP, "source_id={} format={}", source_id, + static_cast(state.format)); } if (config.mono_or_stereo_dirty || config.embedded_buffer_dirty) { config.mono_or_stereo_dirty.Assign(0); state.mono_or_stereo = config.mono_or_stereo; - LOG_TRACE(Audio_DSP, "source_id=%zu mono_or_stereo=%zu", source_id, - static_cast(state.mono_or_stereo)); + NGLOG_TRACE(Audio_DSP, "source_id={} mono_or_stereo={}", source_id, + static_cast(state.mono_or_stereo)); } u32_dsp play_position = {}; @@ -182,15 +182,15 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, play_position, false, }); - LOG_TRACE(Audio_DSP, "enqueuing embedded addr=0x%08x len=%u id=%hu start=%u", - config.physical_address, config.length, config.buffer_id, - static_cast(config.play_position)); + NGLOG_TRACE(Audio_DSP, "enqueuing embedded addr={0:#010x} len={} id={} start={}", + config.physical_address, config.length, config.buffer_id, + static_cast(config.play_position)); } if (config.loop_related_dirty && config.loop_related != 0) { config.loop_related_dirty.Assign(0); - LOG_WARNING(Audio_DSP, "Unhandled complex loop with loop_related=0x%08x", - static_cast(config.loop_related)); + NGLOG_WARNING(Audio_DSP, "Unhandled complex loop with loop_related={0:#010x}", + static_cast(config.loop_related)); } if (config.buffer_queue_dirty) { @@ -212,15 +212,15 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, {}, // 0 in u32_dsp false, }); - LOG_TRACE(Audio_DSP, "enqueuing queued %zu addr=0x%08x len=%u id=%hu", i, - b.physical_address, b.length, b.buffer_id); + NGLOG_TRACE(Audio_DSP, "enqueuing queued {} addr={0:#010x} len={} id={}", i, + b.physical_address, b.length, b.buffer_id); } } config.buffers_dirty = 0; } if (config.dirty_raw) { - LOG_DEBUG(Audio_DSP, "source_id=%zu remaining_dirty=%x", source_id, config.dirty_raw); + NGLOG_DEBUG(Audio_DSP, "source_id={} remaining_dirty={}", source_id, config.dirty_raw); } config.dirty_raw = 0; @@ -255,7 +255,7 @@ void Source::GenerateFrame() { break; case InterpolationMode::Polyphase: // TODO(merry): Implement polyphase interpolation - LOG_DEBUG(Audio_DSP, "Polyphase interpolation unimplemented; falling back to linear"); + NGLOG_DEBUG(Audio_DSP, "Polyphase interpolation unimplemented; falling back to linear"); AudioInterp::Linear(state.interp_state, state.current_buffer, state.rate_multiplier, current_frame, frame_position); break; @@ -304,9 +304,9 @@ bool Source::DequeueBuffer() { break; } } else { - LOG_WARNING(Audio_DSP, - "source_id=%zu buffer_id=%hu length=%u: Invalid physical address 0x%08X", - source_id, buf.buffer_id, buf.length, buf.physical_address); + NGLOG_WARNING(Audio_DSP, + "source_id={} buffer_id={} length={}: Invalid physical address {0:#010x}", + source_id, buf.buffer_id, buf.length, buf.physical_address); state.current_buffer.clear(); return true; } @@ -322,9 +322,9 @@ bool Source::DequeueBuffer() { state.input_queue.push(buf); } - LOG_TRACE(Audio_DSP, "source_id=%zu buffer_id=%hu from_queue=%s current_buffer.size()=%zu", - source_id, buf.buffer_id, buf.from_queue ? "true" : "false", - state.current_buffer.size()); + NGLOG_TRACE(Audio_DSP, "source_id={} buffer_id={} from_queue={} current_buffer.size()={}", + source_id, buf.buffer_id, buf.from_queue ? "true" : "false", + state.current_buffer.size()); return true; } diff --git a/src/audio_core/sdl2_sink.cpp b/src/audio_core/sdl2_sink.cpp index 219152ab1..a03da5bed 100644 --- a/src/audio_core/sdl2_sink.cpp +++ b/src/audio_core/sdl2_sink.cpp @@ -25,7 +25,7 @@ struct SDL2Sink::Impl { SDL2Sink::SDL2Sink() : impl(std::make_unique()) { if (SDL_Init(SDL_INIT_AUDIO) < 0) { - LOG_CRITICAL(Audio_Sink, "SDL_Init(SDL_INIT_AUDIO) failed with: %s", SDL_GetError()); + NGLOG_CRITICAL(Audio_Sink, "SDL_Init(SDL_INIT_AUDIO) failed with: {}", SDL_GetError()); impl->audio_device_id = 0; return; } @@ -58,8 +58,8 @@ SDL2Sink::SDL2Sink() : impl(std::make_unique()) { impl->audio_device_id = SDL_OpenAudioDevice( device, false, &desired_audiospec, &obtained_audiospec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); if (impl->audio_device_id <= 0) { - LOG_CRITICAL(Audio_Sink, "SDL_OpenAudioDevice failed with code %d for device \"%s\"", - impl->audio_device_id, Settings::values.audio_device_id.c_str()); + NGLOG_CRITICAL(Audio_Sink, "SDL_OpenAudioDevice failed with code {} for device \"{}\"", + impl->audio_device_id, Settings::values.audio_device_id.c_str()); return; } diff --git a/src/audio_core/sink_details.cpp b/src/audio_core/sink_details.cpp index 2e30d94a9..4b30c5b3b 100644 --- a/src/audio_core/sink_details.cpp +++ b/src/audio_core/sink_details.cpp @@ -30,7 +30,7 @@ const SinkDetails& GetSinkDetails(std::string sink_id) { if (sink_id == "auto" || iter == g_sink_details.end()) { if (sink_id != "auto") { - LOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id %s", sink_id.c_str()); + NGLOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id {}", sink_id.c_str()); } // Auto-select. // g_sink_details is ordered in terms of desirability, with the best choice at the front. diff --git a/src/audio_core/time_stretch.cpp b/src/audio_core/time_stretch.cpp index e21bd932a..6ed538351 100644 --- a/src/audio_core/time_stretch.cpp +++ b/src/audio_core/time_stretch.cpp @@ -55,7 +55,7 @@ std::vector TimeStretcher::Process(size_t samples_in_queue) { std::vector samples = GetSamples(); if (samples_in_queue >= DROP_FRAMES_SAMPLE_DELAY) { samples.clear(); - LOG_DEBUG(Audio, "Dropping frames!"); + NGLOG_DEBUG(Audio, "Dropping frames!"); } return samples; } From df816b5eaf73980647cff51c94acaa3000b4749c Mon Sep 17 00:00:00 2001 From: Daniel Lim Wee Soong Date: Sat, 24 Mar 2018 22:25:50 +0800 Subject: [PATCH 2/4] Address review comments * Convert %x to {:x} * Convert {0:#010x} to {:#010x} * Remove `? true : false` statement * Remove `.c_str()` for strings --- src/audio_core/hle/mixers.cpp | 2 +- src/audio_core/hle/source.cpp | 12 ++++++------ src/audio_core/sdl2_sink.cpp | 2 +- src/audio_core/sink_details.cpp | 2 +- .../debugger/graphics/graphics_vertex_shader.cpp | 10 +++++----- src/common/string_util.cpp | 2 +- src/core/hle/kernel/svc.cpp | 2 +- src/core/hle/service/ldr_ro/ldr_ro.cpp | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/audio_core/hle/mixers.cpp b/src/audio_core/hle/mixers.cpp index ba986e1ae..f665ee586 100644 --- a/src/audio_core/hle/mixers.cpp +++ b/src/audio_core/hle/mixers.cpp @@ -80,7 +80,7 @@ void Mixers::ParseConfig(DspConfiguration& config) { } if (config.dirty_raw) { - NGLOG_DEBUG(Audio_DSP, "mixers remaining_dirty={}", config.dirty_raw); + NGLOG_DEBUG(Audio_DSP, "mixers remaining_dirty={:x}", config.dirty_raw); } config.dirty_raw = 0; diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp index 7d6fca7f6..f2ac73cb5 100644 --- a/src/audio_core/hle/source.cpp +++ b/src/audio_core/hle/source.cpp @@ -182,14 +182,14 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, play_position, false, }); - NGLOG_TRACE(Audio_DSP, "enqueuing embedded addr={0:#010x} len={} id={} start={}", + NGLOG_TRACE(Audio_DSP, "enqueuing embedded addr={:#010x} len={} id={} start={}", config.physical_address, config.length, config.buffer_id, static_cast(config.play_position)); } if (config.loop_related_dirty && config.loop_related != 0) { config.loop_related_dirty.Assign(0); - NGLOG_WARNING(Audio_DSP, "Unhandled complex loop with loop_related={0:#010x}", + NGLOG_WARNING(Audio_DSP, "Unhandled complex loop with loop_related={:#010x}", static_cast(config.loop_related)); } @@ -212,7 +212,7 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, {}, // 0 in u32_dsp false, }); - NGLOG_TRACE(Audio_DSP, "enqueuing queued {} addr={0:#010x} len={} id={}", i, + NGLOG_TRACE(Audio_DSP, "enqueuing queued {} addr={:#010x} len={} id={}", i, b.physical_address, b.length, b.buffer_id); } } @@ -220,7 +220,7 @@ void Source::ParseConfig(SourceConfiguration::Configuration& config, } if (config.dirty_raw) { - NGLOG_DEBUG(Audio_DSP, "source_id={} remaining_dirty={}", source_id, config.dirty_raw); + NGLOG_DEBUG(Audio_DSP, "source_id={} remaining_dirty={:x}", source_id, config.dirty_raw); } config.dirty_raw = 0; @@ -305,7 +305,7 @@ bool Source::DequeueBuffer() { } } else { NGLOG_WARNING(Audio_DSP, - "source_id={} buffer_id={} length={}: Invalid physical address {0:#010x}", + "source_id={} buffer_id={} length={}: Invalid physical address {:#010x}", source_id, buf.buffer_id, buf.length, buf.physical_address); state.current_buffer.clear(); return true; @@ -323,7 +323,7 @@ bool Source::DequeueBuffer() { } NGLOG_TRACE(Audio_DSP, "source_id={} buffer_id={} from_queue={} current_buffer.size()={}", - source_id, buf.buffer_id, buf.from_queue ? "true" : "false", + source_id, buf.buffer_id, buf.from_queue, state.current_buffer.size()); return true; } diff --git a/src/audio_core/sdl2_sink.cpp b/src/audio_core/sdl2_sink.cpp index a03da5bed..61face0da 100644 --- a/src/audio_core/sdl2_sink.cpp +++ b/src/audio_core/sdl2_sink.cpp @@ -59,7 +59,7 @@ SDL2Sink::SDL2Sink() : impl(std::make_unique()) { device, false, &desired_audiospec, &obtained_audiospec, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); if (impl->audio_device_id <= 0) { NGLOG_CRITICAL(Audio_Sink, "SDL_OpenAudioDevice failed with code {} for device \"{}\"", - impl->audio_device_id, Settings::values.audio_device_id.c_str()); + impl->audio_device_id, Settings::values.audio_device_id); return; } diff --git a/src/audio_core/sink_details.cpp b/src/audio_core/sink_details.cpp index 4b30c5b3b..167b32b64 100644 --- a/src/audio_core/sink_details.cpp +++ b/src/audio_core/sink_details.cpp @@ -30,7 +30,7 @@ const SinkDetails& GetSinkDetails(std::string sink_id) { if (sink_id == "auto" || iter == g_sink_details.end()) { if (sink_id != "auto") { - NGLOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id {}", sink_id.c_str()); + NGLOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id {}", sink_id); } // Auto-select. // g_sink_details is ordered in terms of desirability, with the best choice at the front. diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp index 017bc20e5..d5fff857c 100644 --- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp @@ -591,15 +591,15 @@ void GraphicsVertexShaderWidget::OnCycleIndexChanged(int index) { .arg(record.address_registers[1]); if (record.mask & Pica::Shader::DebugDataRecord::CMP_RESULT) text += tr("Compare Result: %1, %2\n") - .arg(record.conditional_code[0] ? "true" : "false") - .arg(record.conditional_code[1] ? "true" : "false"); + .arg(record.conditional_code[0]) + .arg(record.conditional_code[1]); if (record.mask & Pica::Shader::DebugDataRecord::COND_BOOL_IN) - text += tr("Static Condition: %1\n").arg(record.cond_bool ? "true" : "false"); + text += tr("Static Condition: %1\n").arg(record.cond_bool); if (record.mask & Pica::Shader::DebugDataRecord::COND_CMP_IN) text += tr("Dynamic Conditions: %1, %2\n") - .arg(record.cond_cmp[0] ? "true" : "false") - .arg(record.cond_cmp[1] ? "true" : "false"); + .arg(record.cond_cmp[0]) + .arg(record.cond_cmp[1]); if (record.mask & Pica::Shader::DebugDataRecord::LOOP_INT_IN) text += tr("Loop Parameters: %1 (repeats), %2 (initializer), %3 (increment), %4\n") .arg(record.loop_int.x) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 124a8937f..a7eccd689 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -189,7 +189,7 @@ bool TryParse(const std::string& str, bool* const output) { } std::string StringFromBool(bool value) { - return value ? "True" : "False"; + return value; } bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index fc645cede..60cd3a41b 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -827,7 +827,7 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) { CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(mutex))); LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X", - initial_locked ? "true" : "false", *out_handle); + initial_locked, *out_handle); return RESULT_SUCCESS; } diff --git a/src/core/hle/service/ldr_ro/ldr_ro.cpp b/src/core/hle/service/ldr_ro/ldr_ro.cpp index c73292087..5ac9a37c7 100644 --- a/src/core/hle/service/ldr_ro/ldr_ro.cpp +++ b/src/core/hle/service/ldr_ro/ldr_ro.cpp @@ -202,7 +202,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) { "fix_level=%d, crr_address=0x%08X", link_on_load_bug_fix ? "new" : "old", cro_buffer_ptr, cro_address, cro_size, data_segment_address, zero, data_segment_size, bss_segment_address, bss_segment_size, - auto_link ? "true" : "false", fix_level, crr_address); + auto_link, fix_level, crr_address); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); From 38e2b6c8d82a4212cf865d61cbb84450e3fb939c Mon Sep 17 00:00:00 2001 From: Daniel Lim Wee Soong Date: Sun, 25 Mar 2018 00:54:40 +0800 Subject: [PATCH 3/4] Undo changes to unrelated files and fix formatting --- src/audio_core/hle/source.cpp | 3 +-- src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp | 8 +++----- src/common/string_util.cpp | 2 +- src/core/hle/kernel/svc.cpp | 2 +- src/core/hle/service/ldr_ro/ldr_ro.cpp | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/audio_core/hle/source.cpp b/src/audio_core/hle/source.cpp index f2ac73cb5..e8435acd8 100644 --- a/src/audio_core/hle/source.cpp +++ b/src/audio_core/hle/source.cpp @@ -323,8 +323,7 @@ bool Source::DequeueBuffer() { } NGLOG_TRACE(Audio_DSP, "source_id={} buffer_id={} from_queue={} current_buffer.size()={}", - source_id, buf.buffer_id, buf.from_queue, - state.current_buffer.size()); + source_id, buf.buffer_id, buf.from_queue, state.current_buffer.size()); return true; } diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp index d5fff857c..b02cdfe2b 100644 --- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp @@ -591,15 +591,13 @@ void GraphicsVertexShaderWidget::OnCycleIndexChanged(int index) { .arg(record.address_registers[1]); if (record.mask & Pica::Shader::DebugDataRecord::CMP_RESULT) text += tr("Compare Result: %1, %2\n") - .arg(record.conditional_code[0]) - .arg(record.conditional_code[1]); + .arg(record.conditional_code[0] ? "true" : "false") + .arg(record.conditional_code[1] ? "true" : "false"); if (record.mask & Pica::Shader::DebugDataRecord::COND_BOOL_IN) text += tr("Static Condition: %1\n").arg(record.cond_bool); if (record.mask & Pica::Shader::DebugDataRecord::COND_CMP_IN) - text += tr("Dynamic Conditions: %1, %2\n") - .arg(record.cond_cmp[0]) - .arg(record.cond_cmp[1]); + text += tr("Dynamic Conditions: %1, %2\n").arg(record.cond_cmp[0]).arg(record.cond_cmp[1]); if (record.mask & Pica::Shader::DebugDataRecord::LOOP_INT_IN) text += tr("Loop Parameters: %1 (repeats), %2 (initializer), %3 (increment), %4\n") .arg(record.loop_int.x) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index a7eccd689..124a8937f 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -189,7 +189,7 @@ bool TryParse(const std::string& str, bool* const output) { } std::string StringFromBool(bool value) { - return value; + return value ? "True" : "False"; } bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 60cd3a41b..fc645cede 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -827,7 +827,7 @@ static ResultCode CreateMutex(Handle* out_handle, u32 initial_locked) { CASCADE_RESULT(*out_handle, g_handle_table.Create(std::move(mutex))); LOG_TRACE(Kernel_SVC, "called initial_locked=%s : created handle=0x%08X", - initial_locked, *out_handle); + initial_locked ? "true" : "false", *out_handle); return RESULT_SUCCESS; } diff --git a/src/core/hle/service/ldr_ro/ldr_ro.cpp b/src/core/hle/service/ldr_ro/ldr_ro.cpp index 5ac9a37c7..c73292087 100644 --- a/src/core/hle/service/ldr_ro/ldr_ro.cpp +++ b/src/core/hle/service/ldr_ro/ldr_ro.cpp @@ -202,7 +202,7 @@ void RO::LoadCRO(Kernel::HLERequestContext& ctx, bool link_on_load_bug_fix) { "fix_level=%d, crr_address=0x%08X", link_on_load_bug_fix ? "new" : "old", cro_buffer_ptr, cro_address, cro_size, data_segment_address, zero, data_segment_size, bss_segment_address, bss_segment_size, - auto_link, fix_level, crr_address); + auto_link ? "true" : "false", fix_level, crr_address); IPC::RequestBuilder rb = rp.MakeBuilder(2, 0); From 301ca0a0a3eb70430fd89eef72c2b501f6355d71 Mon Sep 17 00:00:00 2001 From: Daniel Lim Wee Soong Date: Mon, 26 Mar 2018 21:03:10 +0800 Subject: [PATCH 4/4] Undo unrelated true false ternary statement removal --- src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp index b02cdfe2b..017bc20e5 100644 --- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp @@ -595,9 +595,11 @@ void GraphicsVertexShaderWidget::OnCycleIndexChanged(int index) { .arg(record.conditional_code[1] ? "true" : "false"); if (record.mask & Pica::Shader::DebugDataRecord::COND_BOOL_IN) - text += tr("Static Condition: %1\n").arg(record.cond_bool); + text += tr("Static Condition: %1\n").arg(record.cond_bool ? "true" : "false"); if (record.mask & Pica::Shader::DebugDataRecord::COND_CMP_IN) - text += tr("Dynamic Conditions: %1, %2\n").arg(record.cond_cmp[0]).arg(record.cond_cmp[1]); + text += tr("Dynamic Conditions: %1, %2\n") + .arg(record.cond_cmp[0] ? "true" : "false") + .arg(record.cond_cmp[1] ? "true" : "false"); if (record.mask & Pica::Shader::DebugDataRecord::LOOP_INT_IN) text += tr("Loop Parameters: %1 (repeats), %2 (initializer), %3 (increment), %4\n") .arg(record.loop_int.x)