GPUDump: Support XZ compression
This commit is contained in:
parent
3a76485e4b
commit
485f81a02f
|
@ -111,6 +111,16 @@ bool GPUDump::Recorder::Compress(const std::string& source_path, GPUDumpCompress
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mode >= GPUDumpCompressionMode::XZLow && mode <= GPUDumpCompressionMode::XZHigh)
|
||||||
|
{
|
||||||
|
const int clevel =
|
||||||
|
((mode == GPUDumpCompressionMode::XZLow) ? 3 : ((mode == GPUDumpCompressionMode::ZstHigh) ? 9 : 5));
|
||||||
|
if (!CompressHelpers::CompressToFile(fmt::format("{}.xz", source_path).c_str(), std::move(data.value()), clevel,
|
||||||
|
true, error))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error::SetStringView(error, "Unknown compression mode.");
|
Error::SetStringView(error, "Unknown compression mode.");
|
||||||
|
@ -313,7 +323,7 @@ std::unique_ptr<GPUDump::Player> GPUDump::Player::Open(std::string path, Error*
|
||||||
Common::Timer timer;
|
Common::Timer timer;
|
||||||
|
|
||||||
std::optional<DynamicHeapArray<u8>> data;
|
std::optional<DynamicHeapArray<u8>> data;
|
||||||
if (StringUtil::EndsWithNoCase(path, ".psxgpu.zst"))
|
if (StringUtil::EndsWithNoCase(path, ".psxgpu.zst") || StringUtil::EndsWithNoCase(path, ".psxgpu.xz"))
|
||||||
data = CompressHelpers::DecompressFile(path.c_str(), std::nullopt, error);
|
data = CompressHelpers::DecompressFile(path.c_str(), std::nullopt, error);
|
||||||
else
|
else
|
||||||
data = FileSystem::ReadBinaryFile(path.c_str(), error);
|
data = FileSystem::ReadBinaryFile(path.c_str(), error);
|
||||||
|
|
|
@ -1522,12 +1522,16 @@ const char* Settings::GetGPUWireframeModeDisplayName(GPUWireframeMode mode)
|
||||||
"GPUWireframeMode");
|
"GPUWireframeMode");
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr const std::array s_gpu_dump_compression_mode_names = {"Disabled", "ZstLow", "ZstDefault", "ZstHigh"};
|
static constexpr const std::array s_gpu_dump_compression_mode_names = {"Disabled", "ZstLow", "ZstDefault", "ZstHigh",
|
||||||
|
"XZLow", "XZDefault", "XZHigh"};
|
||||||
static constexpr const std::array s_gpu_dump_compression_mode_display_names = {
|
static constexpr const std::array s_gpu_dump_compression_mode_display_names = {
|
||||||
TRANSLATE_DISAMBIG_NOOP("Settings", "Disabled", "GPUDumpCompressionMode"),
|
TRANSLATE_DISAMBIG_NOOP("Settings", "Disabled", "GPUDumpCompressionMode"),
|
||||||
TRANSLATE_DISAMBIG_NOOP("Settings", "Zstandard (Low)", "GPUDumpCompressionMode"),
|
TRANSLATE_DISAMBIG_NOOP("Settings", "Zstandard (Low)", "GPUDumpCompressionMode"),
|
||||||
TRANSLATE_DISAMBIG_NOOP("Settings", "Zstandard (Default)", "GPUDumpCompressionMode"),
|
TRANSLATE_DISAMBIG_NOOP("Settings", "Zstandard (Default)", "GPUDumpCompressionMode"),
|
||||||
TRANSLATE_DISAMBIG_NOOP("Settings", "Zstandard (High)", "GPUDumpCompressionMode"),
|
TRANSLATE_DISAMBIG_NOOP("Settings", "Zstandard (High)", "GPUDumpCompressionMode"),
|
||||||
|
TRANSLATE_DISAMBIG_NOOP("Settings", "XZ (Low)", "GPUDumpCompressionMode"),
|
||||||
|
TRANSLATE_DISAMBIG_NOOP("Settings", "XZ (Default)", "GPUDumpCompressionMode"),
|
||||||
|
TRANSLATE_DISAMBIG_NOOP("Settings", "XZ (High)", "GPUDumpCompressionMode"),
|
||||||
};
|
};
|
||||||
static_assert(s_gpu_dump_compression_mode_names.size() == static_cast<size_t>(GPUDumpCompressionMode::MaxCount));
|
static_assert(s_gpu_dump_compression_mode_names.size() == static_cast<size_t>(GPUDumpCompressionMode::MaxCount));
|
||||||
static_assert(s_gpu_dump_compression_mode_display_names.size() ==
|
static_assert(s_gpu_dump_compression_mode_display_names.size() ==
|
||||||
|
|
|
@ -869,17 +869,18 @@ bool System::IsPsfPath(std::string_view path)
|
||||||
|
|
||||||
bool System::IsGPUDumpPath(std::string_view path)
|
bool System::IsGPUDumpPath(std::string_view path)
|
||||||
{
|
{
|
||||||
return (StringUtil::EndsWithNoCase(path, ".psxgpu") || StringUtil::EndsWithNoCase(path, ".psxgpu.zst"));
|
return (StringUtil::EndsWithNoCase(path, ".psxgpu") || StringUtil::EndsWithNoCase(path, ".psxgpu.zst") ||
|
||||||
|
StringUtil::EndsWithNoCase(path, ".psxgpu.xz"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool System::IsLoadablePath(std::string_view path)
|
bool System::IsLoadablePath(std::string_view path)
|
||||||
{
|
{
|
||||||
static constexpr const std::array extensions = {
|
static constexpr const std::array extensions = {
|
||||||
".bin", ".cue", ".img", ".iso", ".chd", ".ecm", ".mds", // discs
|
".bin", ".cue", ".img", ".iso", ".chd", ".ecm", ".mds", // discs
|
||||||
".exe", ".psexe", ".ps-exe", ".psx", // exes
|
".exe", ".psexe", ".ps-exe", ".psx", // exes
|
||||||
".psf", ".minipsf", // psf
|
".psf", ".minipsf", // psf
|
||||||
".psxgpu", ".psxgpu.zst", // gpu dump
|
".psxgpu", ".psxgpu.zst", ".psxgpu.xz", // gpu dump
|
||||||
".m3u", // playlists
|
".m3u", // playlists
|
||||||
".pbp",
|
".pbp",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,9 @@ enum class GPUDumpCompressionMode : u8
|
||||||
ZstLow,
|
ZstLow,
|
||||||
ZstDefault,
|
ZstDefault,
|
||||||
ZstHigh,
|
ZstHigh,
|
||||||
// TODO: XZ
|
XZLow,
|
||||||
|
XZDefault,
|
||||||
|
XZHigh,
|
||||||
MaxCount
|
MaxCount
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue