diff --git a/src/core/system.cpp b/src/core/system.cpp index 040b31d1b..3d27b7b5a 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -473,7 +473,7 @@ bool System::DoLoadState(ByteStream* state, bool init_components) return DoState(sw); } -bool System::SaveState(ByteStream* state) +bool System::SaveState(ByteStream* state, u32 screenshot_size /* = 128 */) { SAVE_STATE_HEADER header = {}; @@ -494,20 +494,18 @@ bool System::SaveState(ByteStream* state) return false; // save screenshot + if (screenshot_size > 0) { - const u32 screenshot_width = 128; - const u32 screenshot_height = 128; - std::vector screenshot_buffer; m_gpu->ResetGraphicsAPIState(); const bool screenshot_saved = - m_host_interface->GetDisplay()->WriteDisplayTextureToBuffer(&screenshot_buffer, screenshot_width, screenshot_height); + m_host_interface->GetDisplay()->WriteDisplayTextureToBuffer(&screenshot_buffer, screenshot_size, screenshot_size); m_gpu->RestoreGraphicsAPIState(); if (screenshot_saved && !screenshot_buffer.empty()) { header.offset_to_screenshot = static_cast(state->GetPosition()); - header.screenshot_width = screenshot_width; - header.screenshot_height = screenshot_height; + header.screenshot_width = screenshot_size; + header.screenshot_height = screenshot_size; header.screenshot_size = static_cast(screenshot_buffer.size() * sizeof(u32)); if (!state->Write2(screenshot_buffer.data(), header.screenshot_size)) return false; diff --git a/src/core/system.h b/src/core/system.h index bddd24192..f316c602d 100644 --- a/src/core/system.h +++ b/src/core/system.h @@ -96,7 +96,7 @@ public: void Reset(); bool LoadState(ByteStream* state); - bool SaveState(ByteStream* state); + bool SaveState(ByteStream* state, u32 screenshot_size = 128); /// Recreates the GPU component, saving/loading the state so it is preserved. Call when the GPU renderer changes. bool RecreateGPU(GPURenderer renderer);