diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 8be464eb13..3b6a227802 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -24,6 +24,7 @@ #include "Program/GLSLCommon.h" #include "Utilities/date_time.h" #include "Utilities/StrUtil.h" +#include "Crypto/unzip.h" #include "util/serialization.hpp" #include "util/asm.hpp" @@ -3588,14 +3589,23 @@ namespace rsx { capture_current_frame = false; - const std::string file_path = fs::get_config_dir() + "captures/" + Emu.GetTitleID() + "_" + date_time::current_time_narrow() + "_capture.rrc"; + std::string file_path = fs::get_config_dir() + "captures/" + Emu.GetTitleID() + "_" + date_time::current_time_narrow() + "_capture.rrc"; - // todo: may want to compress this data? utils::serial save_manager; save_manager.reserve(0x800'0000); // 128MB save_manager(frame_capture); + if (std::vector zipped = zip(save_manager.data); !zipped.empty()) + { + file_path += ".gz"; + save_manager.data = std::move(zipped); + } + else + { + rsx_log.error("Failed to compress capture"); + } + fs::pending_file temp(file_path); if (temp.file && (temp.file.write(save_manager.data), temp.commit(false))) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 760e9d7ccb..7ff37d1920 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -38,6 +38,7 @@ #include "Utilities/StrUtil.h" #include "../Crypto/unself.h" +#include "../Crypto/unzip.h" #include "util/logs.hpp" #include "util/serialization.hpp" #include "savestate_utils.hpp" @@ -717,6 +718,16 @@ bool Emulator::BootRsxCapture(const std::string& path) load.m_file_handler = make_uncompressed_serialization_file_handler(std::move(in_file)); load.set_reading_state(); + if (fmt::to_lower(path).ends_with(".gz")) + { + load.data = unzip(load.data); + if (load.data.empty()) + { + sys_log.error("Failed to unzip rsx capture file!"); + return false; + } + } + load(*frame); in_file.close(); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 46ec02a37d..ccfec22609 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -654,7 +654,7 @@ void main_window::BootRsxCapture(std::string path) is_stopped = true; } - const QString file_path = QFileDialog::getOpenFileName(this, tr("Select RSX Capture"), qstr(fs::get_config_dir() + "captures/"), tr("RRC files (*.rrc *.RRC);;All files (*.*)")); + const QString file_path = QFileDialog::getOpenFileName(this, tr("Select RSX Capture"), qstr(fs::get_config_dir() + "captures/"), tr("RRC files (*.rrc *.RRC *.rrc.gz *.RRC.GZ);;All files (*.*)")); if (file_path.isEmpty()) { @@ -3553,7 +3553,7 @@ main_window::drop_type main_window::IsValidFile(const QMimeData& md, QStringList } else if (m_drop_file_url_list.size() == 1) { - if (suffix_lo == "rrc") + if (suffix_lo == "rrc" || path.toLower().endsWith(".rrc.gz")) { type = drop_type::drop_rrc; }