Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsx: fix reading zipped captures #14811

Merged
merged 2 commits into from Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions rpcs3/Emu/System.cpp
Expand Up @@ -715,21 +715,25 @@ bool Emulator::BootRsxCapture(const std::string& path)

std::unique_ptr<rsx::frame_capture_data> frame = std::make_unique<rsx::frame_capture_data>();
utils::serial load;
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);
load.data = unzip(in_file.to_vector<u8>());
in_file.close();

if (load.data.empty())
{
sys_log.error("Failed to unzip rsx capture file!");
return false;
}
}
else
{
load.m_file_handler = make_uncompressed_serialization_file_handler(std::move(in_file));
}

load(*frame);
in_file.close();

if (frame->magic != rsx::c_fc_magic)
{
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/savestate_utils.cpp
Expand Up @@ -108,7 +108,7 @@ std::vector<std::pair<u16, u16>> get_savestate_versioning_data(fs::file&& file)
u64 offs = 0;
file.read(offs);

const usz fsize = file.size();
const usz fsize = file.size();

if (!offs || fsize <= offs)
{
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/util/serialization.hpp
Expand Up @@ -453,7 +453,7 @@ namespace utils

const usz end_pos = pos + sizeof(T);
const usz size = get_size(end_pos);
using type = std::remove_const_t<T>;
using type = std::remove_const_t<T>;

if (size >= end_pos)
{
Expand Down