diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index 80ec96a8..f6f7c928 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -1,7 +1,6 @@ #include "cpu_core.h" #include "bus.h" #include "common/align.h" -#include "common/file_system.h" #include "common/state_wrapper.h" #include "cpu_core_private.h" #include "cpu_recompiler_thunks.h" diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index 8cba5984..f7a1136b 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -1,7 +1,5 @@ #include "gpu.h" -#include "common/file_system.h" #include "common/heap_array.h" -#include "common/log.h" #include "common/state_wrapper.h" #include "common/string_util.h" #include "dma.h" @@ -13,7 +11,6 @@ #include "system.h" #include "timers.h" #include -Log_SetChannel(GPU); std::unique_ptr g_gpu; @@ -364,9 +361,10 @@ u32 GPU::ReadRegister(u32 offset) } default: - Log_ErrorPrintf("Unhandled register read: %02X", offset); - return UINT32_C(0xFFFFFFFF); + break; } + + return UINT32_C(0xFFFFFFFF); } void GPU::WriteRegister(u32 offset, u32 value) @@ -384,8 +382,7 @@ void GPU::WriteRegister(u32 offset, u32 value) return; default: - Log_ErrorPrintf("Unhandled register write: %02X <- %08X", offset, value); - return; + break; } } @@ -393,7 +390,6 @@ void GPU::DMARead(u32* words, u32 word_count) { if (m_GPUSTAT.dma_direction != DMADirection::GPUREADtoCPU) { - Log_ErrorPrintf("Invalid DMA direction from GPU DMA read"); std::fill_n(words, word_count, UINT32_C(0xFFFFFFFF)); return; } @@ -836,10 +832,6 @@ void GPU::CRTCTickEvent(TickCount ticks) u32 lines_to_draw = m_crtc_state.current_tick_in_scanline / m_crtc_state.horizontal_total; m_crtc_state.current_tick_in_scanline %= m_crtc_state.horizontal_total; -#if 0 - Log_WarningPrintf("Old line: %u, new line: %u, drawing %u", m_crtc_state.current_scanline, - m_crtc_state.current_scanline + lines_to_draw, lines_to_draw); -#endif const bool old_hblank = m_crtc_state.in_hblank; const bool new_hblank = (m_crtc_state.current_tick_in_scanline >= m_crtc_state.horizontal_sync_start); @@ -873,7 +865,6 @@ void GPU::CRTCTickEvent(TickCount ticks) { if (new_vblank) { - Log_DebugPrintf("Now in v-blank"); g_interrupt_controller.InterruptRequest(InterruptController::IRQ::VBLANK); // flush any pending draws and "scan out" the image @@ -967,16 +958,9 @@ bool GPU::ConvertScreenCoordinatesToBeamTicksAndLines(s32 window_x, s32 window_y display_x = (((scaled_x + 1.0f) * 0.5f) * dw); // -1..1 -> 0..1 } - Log_DebugPrintf("win %d,%d -> disp %.2f,%.2f (size %u,%u frac %f,%f)", window_x, window_y, display_x, display_y, - m_crtc_state.display_width, m_crtc_state.display_height, - display_x / static_cast(m_crtc_state.display_width), - display_y / static_cast(m_crtc_state.display_height)); - if (display_x < 0 || static_cast(display_x) >= m_crtc_state.display_width || display_y < 0 || static_cast(display_y) >= m_crtc_state.display_height) - { return false; - } *out_line = (static_cast(std::round(display_y)) >> BoolToUInt8(m_GPUSTAT.vertical_interlace)) + m_crtc_state.vertical_visible_start; @@ -1005,7 +989,6 @@ u32 GPU::ReadGPUREAD() if (++m_vram_transfer.row == m_vram_transfer.height) { - Log_DebugPrintf("End of VRAM->CPU transfer"); m_vram_transfer = {}; m_blitter_state = BlitterState::Idle; @@ -1029,7 +1012,6 @@ void GPU::WriteGP1(u32 value) { case 0x00: // Reset GPU { - Log_DebugPrintf("GP1 reset GPU"); m_command_tick_event->InvokeEarly(); SynchronizeCRTC(); SoftReset(); @@ -1038,7 +1020,6 @@ void GPU::WriteGP1(u32 value) case 0x01: // Clear FIFO { - Log_DebugPrintf("GP1 clear FIFO"); m_command_tick_event->InvokeEarly(); SynchronizeCRTC(); @@ -1061,7 +1042,6 @@ void GPU::WriteGP1(u32 value) case 0x02: // Acknowledge Interrupt { - Log_DebugPrintf("Acknowledge interrupt"); m_GPUSTAT.interrupt_request = false; } break; @@ -1069,7 +1049,6 @@ void GPU::WriteGP1(u32 value) case 0x03: // Display on/off { const bool disable = ConvertToBoolUnchecked(value & 0x01); - Log_DebugPrintf("Display %s", disable ? "disabled" : "enabled"); SynchronizeCRTC(); if (!m_GPUSTAT.display_disable && disable && m_GPUSTAT.vertical_interlace && !m_force_progressive_scan) @@ -1081,7 +1060,6 @@ void GPU::WriteGP1(u32 value) case 0x04: // DMA Direction { - Log_DebugPrintf("DMA direction <- 0x%02X", static_cast(param)); if (m_GPUSTAT.dma_direction != static_cast(param)) { m_GPUSTAT.dma_direction = static_cast(param); @@ -1093,7 +1071,6 @@ void GPU::WriteGP1(u32 value) case 0x05: // Set display start address { const u32 new_value = param & CRTCState::Regs::DISPLAY_ADDRESS_START_MASK; - Log_DebugPrintf("Display address start <- 0x%08X", new_value); System::IncrementInternalFrameNumber(); if (m_crtc_state.regs.display_address_start != new_value) @@ -1108,7 +1085,6 @@ void GPU::WriteGP1(u32 value) case 0x06: // Set horizontal display range { const u32 new_value = param & CRTCState::Regs::HORIZONTAL_DISPLAY_RANGE_MASK; - Log_DebugPrintf("Horizontal display range <- 0x%08X", new_value); if (m_crtc_state.regs.horizontal_display_range != new_value) { @@ -1122,7 +1098,6 @@ void GPU::WriteGP1(u32 value) case 0x07: // Set vertical display range { const u32 new_value = param & CRTCState::Regs::VERTICAL_DISPLAY_RANGE_MASK; - Log_DebugPrintf("Vertical display range <- 0x%08X", new_value); if (m_crtc_state.regs.vertical_display_range != new_value) { @@ -1157,7 +1132,6 @@ void GPU::WriteGP1(u32 value) new_GPUSTAT.vertical_interlace = dm.vertical_interlace; new_GPUSTAT.horizontal_resolution_2 = dm.horizontal_resolution_2; new_GPUSTAT.reverse_flag = dm.reverse_flag; - Log_DebugPrintf("Set display mode <- 0x%08X", dm.bits); if (!m_GPUSTAT.vertical_interlace && dm.vertical_interlace && !m_force_progressive_scan) { @@ -1180,7 +1154,6 @@ void GPU::WriteGP1(u32 value) case 0x09: // Allow texture disable { m_set_texture_disable_mask = ConvertToBoolUnchecked(param & 0x01); - Log_DebugPrintf("Set texture disable mask <- %s", m_set_texture_disable_mask ? "allowed" : "ignored"); } break; @@ -1206,7 +1179,6 @@ void GPU::WriteGP1(u32 value) break; default: - Log_ErrorPrintf("Unimplemented GP1 command 0x%02X", command); break; } } @@ -1225,14 +1197,12 @@ void GPU::HandleGetGPUInfoCommand(u32 value) case 0x02: // Get Texture Window { - Log_DebugPrintf("Get texture window"); m_GPUREAD_latch = m_draw_mode.texture_window_value; } break; case 0x03: // Get Draw Area Top Left { - Log_DebugPrintf("Get drawing area top left"); m_GPUREAD_latch = ((m_drawing_area.left & UINT32_C(0b1111111111)) | ((m_drawing_area.top & UINT32_C(0b1111111111)) << 10)); } @@ -1240,7 +1210,6 @@ void GPU::HandleGetGPUInfoCommand(u32 value) case 0x04: // Get Draw Area Bottom Right { - Log_DebugPrintf("Get drawing area bottom right"); m_GPUREAD_latch = ((m_drawing_area.right & UINT32_C(0b1111111111)) | ((m_drawing_area.bottom & UINT32_C(0b1111111111)) << 10)); } @@ -1248,14 +1217,12 @@ void GPU::HandleGetGPUInfoCommand(u32 value) case 0x05: // Get Drawing Offset { - Log_DebugPrintf("Get drawing offset"); m_GPUREAD_latch = ((m_drawing_offset.x & INT32_C(0b11111111111)) | ((m_drawing_offset.y & INT32_C(0b11111111111)) << 11)); } break; default: - Log_WarningPrintf("Unhandled GetGPUInfo(0x%02X)", ZeroExtend32(subcommand)); break; } } @@ -1478,7 +1445,6 @@ void GPU::SetTextureWindow(u32 value) const u8 mask_y = Truncate8((value >> 5) & UINT32_C(0x1F)); const u8 offset_x = Truncate8((value >> 10) & UINT32_C(0x1F)); const u8 offset_y = Truncate8((value >> 15) & UINT32_C(0x1F)); - Log_DebugPrintf("Set texture window %02X %02X %02X %02X", mask_x, mask_y, offset_x, offset_y); m_draw_mode.texture_window.and_x = ~(mask_x * 8); m_draw_mode.texture_window.and_y = ~(mask_y * 8); @@ -1487,59 +1453,3 @@ void GPU::SetTextureWindow(u32 value) m_draw_mode.texture_window_value = value; m_draw_mode.texture_window_changed = true; } - -bool GPU::DumpVRAMToFile(const char* filename) -{ - ReadVRAM(0, 0, VRAM_WIDTH, VRAM_HEIGHT); - - const char* extension = std::strrchr(filename, '.'); - if (extension && StringUtil::Strcasecmp(extension, ".png") == 0) - { - return DumpVRAMToFile(filename, VRAM_WIDTH, VRAM_HEIGHT, sizeof(u16) * VRAM_WIDTH, m_vram_ptr, true); - } - else if (extension && StringUtil::Strcasecmp(extension, ".bin") == 0) - { - return FileSystem::WriteBinaryFile(filename, m_vram_ptr, VRAM_WIDTH * VRAM_HEIGHT * sizeof(u16)); - } - else - { - Log_ErrorPrintf("Unknown extension: '%s'", filename); - return false; - } -} - -bool GPU::DumpVRAMToFile(const char* filename, u32 width, u32 height, u32 stride, const void* buffer, bool remove_alpha) -{ - auto fp = FileSystem::OpenManagedCFile(filename, "wb"); - if (!fp) - { - Log_ErrorPrintf("Can't open file '%s'", filename); - return false; - } - - auto rgba8_buf = std::make_unique(width * height); - - const char* ptr_in = static_cast(buffer); - u32* ptr_out = rgba8_buf.get(); - for (u32 row = 0; row < height; row++) - { - const char* row_ptr_in = ptr_in; - - for (u32 col = 0; col < width; col++) - { - u16 src_col; - std::memcpy(&src_col, row_ptr_in, sizeof(u16)); - row_ptr_in += sizeof(u16); - *(ptr_out++) = VRAMRGBA5551ToRGBA8888(remove_alpha ? (src_col | u16(0x8000)) : src_col); - } - - ptr_in += stride; - } - - const auto write_func = [](void* context, void* data, int size) { - std::fwrite(data, 1, size, static_cast(context)); - }; - return (stbi_write_png_to_func(write_func, fp.get(), width, height, 4, rgba8_buf.get(), sizeof(u32) * width) != 0); -} - -void GPU::DrawRendererStats(bool is_idle_frame) {} diff --git a/src/core/gpu.h b/src/core/gpu.h index 2485073f..3eb54b1a 100644 --- a/src/core/gpu.h +++ b/src/core/gpu.h @@ -171,9 +171,6 @@ public: // Returns the video clock frequency. TickCount GetCRTCFrequency() const; - // Dumps raw VRAM to a file. - bool DumpVRAMToFile(const char* filename); - protected: TickCount CRTCTicksToSystemTicks(TickCount crtc_ticks, TickCount fractional_ticks) const; TickCount SystemTicksToCRTCTicks(TickCount sysclk_ticks, TickCount* fractional_ticks) const; @@ -195,9 +192,6 @@ protected: return std::make_tuple(static_cast(rgb24), static_cast(rgb24 >> 8), static_cast(rgb24 >> 16)); } - static bool DumpVRAMToFile(const char* filename, u32 width, u32 height, u32 stride, const void* buffer, - bool remove_alpha); - void SoftReset(); // Sets dots per scanline @@ -276,7 +270,6 @@ protected: virtual void FlushRender(); virtual void ClearDisplay(); virtual void UpdateDisplay(); - virtual void DrawRendererStats(bool is_idle_frame); ALWAYS_INLINE void AddDrawTriangleTicks(s32 x1, s32 y1, s32 x2, s32 y2, s32 x3, s32 y3, bool shaded, bool textured, bool semitransparent) diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index 17a857f2..d116721d 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -1,7 +1,6 @@ #include "gpu_hw.h" #include "common/align.h" #include "common/assert.h" -#include "common/log.h" #include "common/state_wrapper.h" #include "cpu_core.h" #include "gpu_sw_backend.h" @@ -11,7 +10,6 @@ #include #include #include -Log_SetChannel(GPU_HW); template ALWAYS_INLINE static constexpr std::tuple MinMax(T v1, T v2) @@ -209,8 +207,6 @@ u32 GPU_HW::CalculateResolutionScale() const (NTSC_VERTICAL_ACTIVE_END - NTSC_VERTICAL_ACTIVE_START)); const s32 preferred_scale = static_cast(std::ceil(static_cast(m_host_display->GetWindowHeight()) / height)); - Log_InfoPrintf("Height = %d, preferred scale = %d", height, preferred_scale); - scale = static_cast(std::clamp(preferred_scale, 1, m_max_resolution_scale)); } @@ -218,7 +214,6 @@ u32 GPU_HW::CalculateResolutionScale() const !Common::IsPow2(scale)) { const u32 new_scale = Common::PreviousPow2(scale); - Log_InfoPrintf("Resolution scale %ux not supported for adaptive smoothing, using %ux", scale, new_scale); if (g_settings.gpu_resolution_scale != 0) { @@ -620,9 +615,6 @@ void GPU_HW::LoadVertices() if ((max_x - min_x) >= MAX_PRIMITIVE_WIDTH || (max_y - min_y) >= MAX_PRIMITIVE_HEIGHT) { - Log_DebugPrintf("Culling too-large polygon: %d,%d %d,%d %d,%d", native_vertex_positions[0][0], - native_vertex_positions[0][1], native_vertex_positions[1][0], native_vertex_positions[1][1], - native_vertex_positions[2][0], native_vertex_positions[2][1]); } else { @@ -653,9 +645,6 @@ void GPU_HW::LoadVertices() // Cull polygons which are too large. if ((max_x_123 - min_x_123) >= MAX_PRIMITIVE_WIDTH || (max_y_123 - min_y_123) >= MAX_PRIMITIVE_HEIGHT) { - Log_DebugPrintf("Culling too-large polygon (quad second half): %d,%d %d,%d %d,%d", - native_vertex_positions[2][0], native_vertex_positions[2][1], native_vertex_positions[1][0], - native_vertex_positions[1][1], native_vertex_positions[0][0], native_vertex_positions[0][1]); } else { @@ -730,11 +719,7 @@ void GPU_HW::LoadVertices() rectangle_height = static_cast((width_and_height >> 16) & VRAM_HEIGHT_MASK); if (rectangle_width >= MAX_PRIMITIVE_WIDTH || rectangle_height >= MAX_PRIMITIVE_HEIGHT) - { - Log_DebugPrintf("Culling too-large rectangle: %d,%d %dx%d", pos_x, pos_y, rectangle_width, - rectangle_height); return; - } } break; } @@ -839,10 +824,7 @@ void GPU_HW::LoadVertices() const auto [min_x, max_x] = MinMax(start_x, end_x); const auto [min_y, max_y] = MinMax(start_y, end_y); if ((max_x - min_x) >= MAX_PRIMITIVE_WIDTH || (max_y - min_y) >= MAX_PRIMITIVE_HEIGHT) - { - Log_DebugPrintf("Culling too-large line: %d,%d - %d,%d", start_x, start_y, end_x, end_y); return; - } const u32 clip_left = static_cast(std::clamp(min_x, m_drawing_area.left, m_drawing_area.right)); const u32 clip_right = static_cast(std::clamp(max_x, m_drawing_area.left, m_drawing_area.right)) + 1u; @@ -906,7 +888,6 @@ void GPU_HW::LoadVertices() const auto [min_y, max_y] = MinMax(start_y, end_y); if ((max_x - min_x) >= MAX_PRIMITIVE_WIDTH || (max_y - min_y) >= MAX_PRIMITIVE_HEIGHT) { - Log_DebugPrintf("Culling too-large line: %d,%d - %d,%d", start_x, start_y, end_x, end_y); } else { @@ -1243,7 +1224,6 @@ void GPU_HW::DispatchRenderCommand() (m_draw_mode.mode_reg.IsUsingPalette() && m_draw_mode.GetTexturePaletteRectangle().Intersects(m_vram_dirty_rect)))) { - // Log_DevPrintf("Invalidating VRAM read cache due to drawing area overlap"); if (!IsFlushed()) FlushRender(); @@ -1372,15 +1352,6 @@ void GPU_HW::FlushRender() } } -void GPU_HW::DrawRendererStats(bool is_idle_frame) -{ - if (!is_idle_frame) - { - m_last_renderer_stats = m_renderer_stats; - m_renderer_stats = {}; - } -} - GPU_HW::ShaderCompileProgressTracker::ShaderCompileProgressTracker(std::string title, u32 total) : m_title(std::move(title)), m_min_time(Common::Timer::ConvertSecondsToValue(1.0)), m_update_interval(Common::Timer::ConvertSecondsToValue(0.1)), m_start_time(Common::Timer::GetValue()), diff --git a/src/core/gpu_hw.h b/src/core/gpu_hw.h index c6c2d44b..71da95fc 100644 --- a/src/core/gpu_hw.h +++ b/src/core/gpu_hw.h @@ -302,7 +302,6 @@ protected: void CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 width, u32 height) override; void DispatchRenderCommand() override; void FlushRender() override; - void DrawRendererStats(bool is_idle_frame) override; void CalcScissorRect(int* left, int* top, int* right, int* bottom); diff --git a/src/core/host_display.cpp b/src/core/host_display.cpp index 58efbba5..26a9501a 100644 --- a/src/core/host_display.cpp +++ b/src/core/host_display.cpp @@ -1,7 +1,6 @@ #include "host_display.h" #include "common/align.h" #include "common/assert.h" -#include "common/file_system.h" #include "common/log.h" #include "common/string_util.h" #include "common/timer.h" @@ -120,35 +119,6 @@ bool HostDisplay::SetSoftwareCursor(const void* pixels, u32 width, u32 height, u return true; } -bool HostDisplay::SetSoftwareCursor(const char* path, float scale /*= 1.0f*/) -{ - auto fp = FileSystem::OpenManagedCFile(path, "rb"); - if (!fp) - { - return false; - } - - int width, height, file_channels; - u8* pixel_data = stbi_load_from_file(fp.get(), &width, &height, &file_channels, 4); - if (!pixel_data) - { - const char* error_reason = stbi_failure_reason(); - Log_ErrorPrintf("Failed to load image from '%s': %s", path, error_reason ? error_reason : "unknown error"); - return false; - } - - std::unique_ptr tex = - CreateTexture(static_cast(width), static_cast(height), 1, 1, 1, HostDisplayPixelFormat::RGBA8, pixel_data, - sizeof(u32) * static_cast(width), false); - stbi_image_free(pixel_data); - if (!tex) - return false; - - Log_InfoPrintf("Loaded %dx%d image from '%s' for software cursor", width, height, path); - SetSoftwareCursor(std::move(tex), scale); - return true; -} - void HostDisplay::ClearSoftwareCursor() { m_cursor_texture.reset(); diff --git a/src/core/host_display.h b/src/core/host_display.h index 9376c497..7b3c2483 100644 --- a/src/core/host_display.h +++ b/src/core/host_display.h @@ -194,9 +194,6 @@ public: /// Sets the software cursor to the specified image. bool SetSoftwareCursor(const void* pixels, u32 width, u32 height, u32 stride, float scale = 1.0f); - /// Sets the software cursor to the specified path (png image). - bool SetSoftwareCursor(const char* path, float scale = 1.0f); - /// Disables the software cursor. void ClearSoftwareCursor(); diff --git a/src/core/mdec.cpp b/src/core/mdec.cpp index 4df6e857..d1ccfba4 100644 --- a/src/core/mdec.cpp +++ b/src/core/mdec.cpp @@ -1,11 +1,9 @@ #include "mdec.h" -#include "common/log.h" #include "common/state_wrapper.h" #include "cpu_core.h" #include "dma.h" #include "interrupt_controller.h" #include "system.h" -Log_SetChannel(MDEC); MDEC g_mdec; @@ -67,17 +65,12 @@ u32 MDEC::ReadRegister(u32 offset) return ReadDataRegister(); case 4: - { - Log_TracePrintf("MDEC status register -> 0x%08X", m_status.bits); return m_status.bits; - } default: - { - Log_ErrorPrintf("Unknown MDEC register read: 0x%08X", offset); - return UINT32_C(0xFFFFFFFF); - } + break; } + return UINT32_C(0xFFFFFFFF); } void MDEC::WriteRegister(u32 offset, u32 value) @@ -92,8 +85,6 @@ void MDEC::WriteRegister(u32 offset, u32 value) case 4: { - Log_DebugPrintf("MDEC control register <- 0x%08X", value); - const ControlRegister cr{value}; if (cr.reset) SoftReset(); @@ -105,21 +96,12 @@ void MDEC::WriteRegister(u32 offset, u32 value) } default: - { - Log_ErrorPrintf("Unknown MDEC register write: 0x%08X <- 0x%08X", offset, value); - return; - } + break; } } void MDEC::DMARead(u32* words, u32 word_count) { - if (m_data_out_fifo.GetSize() < word_count) - { - Log_WarningPrintf("Insufficient data in output FIFO (requested %u, have %u)", word_count, - m_data_out_fifo.GetSize()); - } - const u32 words_to_read = std::min(word_count, m_data_out_fifo.GetSize()); if (words_to_read > 0) { @@ -128,18 +110,12 @@ void MDEC::DMARead(u32* words, u32 word_count) word_count -= words_to_read; } - Log_DebugPrintf("DMA read complete, %u bytes left", static_cast(m_data_out_fifo.GetSize() * sizeof(u32))); if (m_data_out_fifo.IsEmpty()) Execute(); } void MDEC::DMAWrite(const u32* words, u32 word_count) { - if (m_data_in_fifo.GetSpace() < (word_count * 2)) - { - Log_WarningPrintf("Input FIFO overflow (writing %u, space %u)", word_count * 2, m_data_in_fifo.GetSpace()); - } - const u32 halfwords_to_write = std::min(word_count * 2, m_data_in_fifo.GetSpace() & ~u32(2)); m_data_in_fifo.PushRange(reinterpret_cast(words), halfwords_to_write); Execute(); @@ -198,16 +174,9 @@ u32 MDEC::ReadDataRegister() if (m_data_out_fifo.IsEmpty()) { // Stall the CPU until we're done processing. - if (HasPendingBlockCopyOut()) - { - Log_DevPrint("MDEC data out FIFO empty on read - stalling CPU"); - CPU::AddPendingTicks(m_block_copy_out_event->GetTicksUntilNextExecution()); - } - else - { - Log_WarningPrintf("MDEC data out FIFO empty on read and no data processing"); + if (!HasPendingBlockCopyOut()) return UINT32_C(0xFFFFFFFF); - } + CPU::AddPendingTicks(m_block_copy_out_event->GetTicksUntilNextExecution()); } const u32 value = m_data_out_fifo.Pop(); @@ -221,8 +190,6 @@ u32 MDEC::ReadDataRegister() void MDEC::WriteCommandRegister(u32 value) { - Log_TracePrintf("MDEC command/data register <- 0x%08X", value); - m_data_in_fifo.Push(Truncate16(value)); m_data_in_fifo.Push(Truncate16(value >> 16)); @@ -268,16 +235,11 @@ void MDEC::Execute() break; default: - Log_DevPrintf("Invalid MDEC command 0x%08X", cw.bits); num_words = cw.parameter_word_count.GetValue(); new_state = State::NoCommand; break; } - Log_DebugPrintf("MDEC command: 0x%08X (%u, %u words in parameter, %u expected)", cw.bits, - ZeroExtend32(static_cast(cw.command.GetValue())), - ZeroExtend32(cw.parameter_word_count.GetValue()), num_words); - m_remaining_halfwords = num_words * 2; m_state = new_state; UpdateStatus(); @@ -384,7 +346,6 @@ bool MDEC::DecodeMonoMacroblock() IDCT(m_blocks[0].data()); - Log_DebugPrintf("Decoded mono macroblock, %u words remaining", m_remaining_halfwords / 2); ResetDecoder(); m_state = State::WritingMacroblock; @@ -410,7 +371,6 @@ bool MDEC::DecodeColoredMacroblock() return false; // done decoding - Log_DebugPrintf("Decoded colored macroblock, %u words remaining", m_remaining_halfwords / 2); ResetDecoder(); m_state = State::WritingMacroblock; @@ -427,7 +387,6 @@ bool MDEC::DecodeColoredMacroblock() void MDEC::ScheduleBlockCopyOut(TickCount ticks) { DebugAssert(!HasPendingBlockCopyOut()); - Log_DebugPrintf("Scheduling block copy out in %d ticks", ticks); m_block_copy_out_event->SetIntervalAndSchedule(ticks); } @@ -536,9 +495,6 @@ void MDEC::CopyOutBlock() break; } - Log_DebugPrintf("Block copied out, fifo size = %u (%u bytes)", m_data_out_fifo.GetSize(), - static_cast(m_data_out_fifo.GetSize() * sizeof(u32))); - // if we've copied out all blocks, command is complete m_state = (m_remaining_halfwords == 0) ? State::Idle : State::DecodingMacroblock; Execute(); diff --git a/src/core/pad.cpp b/src/core/pad.cpp index 8f9e0984..2e180642 100644 --- a/src/core/pad.cpp +++ b/src/core/pad.cpp @@ -1,5 +1,4 @@ #include "pad.h" -#include "common/log.h" #include "common/state_wrapper.h" #include "controller.h" #include "host_interface.h" @@ -7,7 +6,6 @@ #include "memory_card.h" #include "multitap.h" #include "system.h" -Log_SetChannel(Pad); Pad g_pad; @@ -80,12 +78,6 @@ bool Pad::DoStateController(StateWrapper& sw, u32 i) Settings::GetControllerTypeName(state_controller_type), i + 1u); } - // dev-friendly untranslated console log. - Log_DevPrintf("Controller type mismatch in slot %u: state=%s(%u) ui=%s(%u) load_from_state=%s", i + 1u, - Settings::GetControllerTypeName(state_controller_type), static_cast(state_controller_type), - Settings::GetControllerTypeName(controller_type), static_cast(controller_type), - g_settings.load_devices_from_save_states ? "yes" : "no"); - if (g_settings.load_devices_from_save_states) { m_controllers[i].reset(); @@ -181,8 +173,6 @@ bool Pad::DoStateMemcard(StateWrapper& sw, u32 i) // until much later). One workaround is to forcibly eject the card for 30+ frames, long enough // for the game to decide it was removed and purge its cache. Once implemented, this could be // described as deferred re-plugging in the log. - - Log_WarningPrintf("Memory card %u data mismatch. Using current data via instant-replugging.", i + 1u); m_memory_cards[i]->Reset(); } } @@ -311,7 +301,6 @@ u32 Pad::ReadRegister(u32 offset) m_transfer_event->InvokeEarly(); const u8 value = m_receive_buffer_full ? m_receive_buffer : 0xFF; - Log_DebugPrintf("JOY_DATA (R) -> 0x%02X%s", ZeroExtend32(value), m_receive_buffer_full ? "" : "(EMPTY)"); m_receive_buffer_full = false; UpdateJoyStat(); @@ -339,9 +328,9 @@ u32 Pad::ReadRegister(u32 offset) return ZeroExtend32(m_JOY_BAUD); default: - Log_ErrorPrintf("Unknown register read: 0x%X", offset); - return UINT32_C(0xFFFFFFFF); + break; } + return UINT32_C(0xFFFFFFFF); } void Pad::WriteRegister(u32 offset, u32 value) @@ -350,11 +339,6 @@ void Pad::WriteRegister(u32 offset, u32 value) { case 0x00: // JOY_DATA { - Log_DebugPrintf("JOY_DATA (W) <- 0x%02X", value); - - if (m_transmit_buffer_full) - Log_WarningPrint("TX FIFO overrun"); - m_transmit_buffer = Truncate8(value); m_transmit_buffer_full = true; @@ -366,8 +350,6 @@ void Pad::WriteRegister(u32 offset, u32 value) case 0x0A: // JOY_CTRL { - Log_DebugPrintf("JOY_CTRL <- 0x%04X", value); - m_JOY_CTRL.bits = Truncate16(value); if (m_JOY_CTRL.RESET) SoftReset(); @@ -398,21 +380,18 @@ void Pad::WriteRegister(u32 offset, u32 value) case 0x08: // JOY_MODE { - Log_DebugPrintf("JOY_MODE <- 0x%08X", value); m_JOY_MODE.bits = Truncate16(value); return; } case 0x0E: { - Log_DebugPrintf("JOY_BAUD <- 0x%08X", value); m_JOY_BAUD = Truncate16(value); return; } default: - Log_ErrorPrintf("Unknown register write: 0x%X <- 0x%08X", offset, value); - return; + break; } } @@ -450,7 +429,6 @@ void Pad::TransferEvent(TickCount ticks_late) void Pad::BeginTransfer() { DebugAssert(m_state == State::Idle && CanTransfer()); - Log_DebugPrintf("Starting transfer"); m_JOY_CTRL.RXEN = true; m_transmit_value = m_transmit_buffer; @@ -477,8 +455,6 @@ void Pad::BeginTransfer() void Pad::DoTransfer(TickCount ticks_late) { - Log_DebugPrintf("Transferring slot %d", m_JOY_CTRL.SLOT.GetValue()); - const u8 device_index = m_multitaps[0].IsEnabled() ? 4u : m_JOY_CTRL.SLOT; Controller* const controller = m_controllers[device_index].get(); MemoryCard* const memory_card = m_memory_cards[device_index].get(); @@ -498,11 +474,7 @@ void Pad::DoTransfer(TickCount ticks_late) if (m_multitaps[m_JOY_CTRL.SLOT].IsEnabled()) { if ((ack = m_multitaps[m_JOY_CTRL.SLOT].Transfer(data_out, &data_in)) == true) - { - Log_TracePrintf("Active device set to tap %d, sent 0x%02X, received 0x%02X", - static_cast(m_JOY_CTRL.SLOT), data_out, data_in); m_active_device = ActiveDevice::Multitap; - } } else { @@ -511,19 +483,16 @@ void Pad::DoTransfer(TickCount ticks_late) if (!memory_card || (ack = memory_card->Transfer(data_out, &data_in)) == false) { // nothing connected to this port - Log_TracePrintf("Nothing connected or ACK'ed"); } else { // memory card responded, make it the active device until non-ack - Log_TracePrintf("Transfer to memory card, data_out=0x%02X, data_in=0x%02X", data_out, data_in); m_active_device = ActiveDevice::MemoryCard; } } else { // controller responded, make it the active device until non-ack - Log_TracePrintf("Transfer to controller, data_out=0x%02X, data_in=0x%02X", data_out, data_in); m_active_device = ActiveDevice::Controller; } } @@ -533,31 +502,21 @@ void Pad::DoTransfer(TickCount ticks_late) case ActiveDevice::Controller: { if (controller) - { ack = controller->Transfer(data_out, &data_in); - Log_TracePrintf("Transfer to controller, data_out=0x%02X, data_in=0x%02X", data_out, data_in); - } } break; case ActiveDevice::MemoryCard: { if (memory_card) - { ack = memory_card->Transfer(data_out, &data_in); - Log_TracePrintf("Transfer to memory card, data_out=0x%02X, data_in=0x%02X", data_out, data_in); - } } break; case ActiveDevice::Multitap: { if (m_multitaps[m_JOY_CTRL.SLOT].IsEnabled()) - { ack = m_multitaps[m_JOY_CTRL.SLOT].Transfer(data_out, &data_in); - Log_TracePrintf("Transfer tap %d, sent 0x%02X, received 0x%02X, acked: %s", static_cast(m_JOY_CTRL.SLOT), - data_out, data_in, ack ? "true" : "false"); - } } break; } @@ -578,7 +537,6 @@ void Pad::DoTransfer(TickCount ticks_late) (m_active_device == ActiveDevice::Multitap && m_multitaps[m_JOY_CTRL.SLOT].IsReadingMemoryCard()); const TickCount ack_timer = GetACKTicks(memcard_transfer); - Log_DebugPrintf("Delaying ACK for %d ticks", ack_timer); m_state = State::WaitingForACK; m_transfer_event->SetPeriodAndSchedule(ack_timer); } @@ -592,7 +550,6 @@ void Pad::DoACK() if (m_JOY_CTRL.ACKINTEN) { - Log_DebugPrintf("Triggering ACK interrupt"); m_JOY_STAT.INTR = true; g_interrupt_controller.InterruptRequest(InterruptController::IRQ::IRQ7); } @@ -607,7 +564,6 @@ void Pad::DoACK() void Pad::EndTransfer() { DebugAssert(m_state == State::Transmitting || m_state == State::WaitingForACK); - Log_DebugPrintf("Ending transfer"); m_state = State::Idle; m_transfer_event->Deactivate(); diff --git a/src/core/spu.cpp b/src/core/spu.cpp index ea9c5f29..660db312 100644 --- a/src/core/spu.cpp +++ b/src/core/spu.cpp @@ -1,7 +1,6 @@ #include "spu.h" #include "cdrom.h" #include "common/audio_stream.h" -#include "common/file_system.h" #include "common/state_wrapper.h" #include "dma.h" #include "host_interface.h" diff --git a/src/libretro/game_settings.cpp b/src/libretro/game_settings.cpp index cbf9fe8d..ccb6fef7 100644 --- a/src/libretro/game_settings.cpp +++ b/src/libretro/game_settings.cpp @@ -1,7 +1,6 @@ #include "game_settings.h" #include "common/assert.h" #include "common/byte_stream.h" -#include "common/file_system.h" #include "common/log.h" #include "common/string.h" #include "common/string_util.h" @@ -1103,56 +1102,6 @@ bool Database::Load(const std::string_view& ini_data) return true; } -void Database::SetEntry(const std::string& code, const std::string& name, const Entry& entry, const char* save_path) -{ - if (save_path) - { - CSimpleIniA ini; - if (FileSystem::FileExists(save_path)) - { - auto fp = FileSystem::OpenManagedCFile(save_path, "rb"); - if (fp) - { - SI_Error err = ini.LoadFile(fp.get()); - if (err != SI_OK) - Log_ErrorPrintf("Failed to parse game settings ini: %d. Contents will be lost.", static_cast(err)); - } - else - { - Log_ErrorPrintf("Failed to open existing settings ini: '%s'", save_path); - } - } - - ini.Delete(code.c_str(), nullptr, false); - ini.SetValue(code.c_str(), nullptr, nullptr, SmallString::FromFormat("# %s (%s)", code.c_str(), name.c_str()), - false); - StoreIniSection(entry, code.c_str(), ini); - - const bool did_exist = FileSystem::FileExists(save_path); - auto fp = FileSystem::OpenManagedCFile(save_path, "wb"); - if (fp) - { - // write file comment so simpleini doesn't get confused - if (!did_exist) - std::fputs("# DuckStation Game Settings\n\n", fp.get()); - - SI_Error err = ini.SaveFile(fp.get()); - if (err != SI_OK) - Log_ErrorPrintf("Failed to save game settings ini: %d", static_cast(err)); - } - else - { - Log_ErrorPrintf("Failed to open settings ini for saving: '%s'", save_path); - } - } - - auto it = m_entries.find(code); - if (it != m_entries.end()) - it->second = entry; - else - m_entries.emplace(code, entry); -} - std::optional Entry::GetValueForKey(const std::string_view& key) const { return GetEntryValueForKey(*this, key); diff --git a/src/libretro/game_settings.h b/src/libretro/game_settings.h index 5319fa1e..38cc4642 100644 --- a/src/libretro/game_settings.h +++ b/src/libretro/game_settings.h @@ -112,7 +112,6 @@ public: ~Database(); const Entry* GetEntry(const std::string& code) const; - void SetEntry(const std::string& code, const std::string& name, const Entry& entry, const char* save_path); bool Load(const std::string_view& ini_data); @@ -120,4 +119,4 @@ private: std::unordered_map m_entries; }; -}; // namespace GameSettings \ No newline at end of file +}; // namespace GameSettings