SaveState: Add configurable compression type and level

This commit is contained in:
KamFretoZ 2024-09-25 23:10:02 +07:00 committed by Ty
parent a694c1bd26
commit 60e21e2530
7 changed files with 264 additions and 46 deletions

View File

@ -56,6 +56,15 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget*
SettingWidgetBinder::BindWidgetToFloatSetting(sif, m_ui.ntscFrameRate, "EmuCore/GS", "FramerateNTSC", 59.94f);
SettingWidgetBinder::BindWidgetToFloatSetting(sif, m_ui.palFrameRate, "EmuCore/GS", "FrameratePAL", 50.00f);
SettingWidgetBinder::BindWidgetToIntSetting(
sif, m_ui.savestateCompressionMethod, "EmuCore", "SavestateCompressionType", static_cast<int>(SavestateCompressionMethod::Zstandard));
SettingWidgetBinder::BindWidgetToIntSetting(
sif, m_ui.savestateCompressionLevel, "EmuCore", "SavestateCompressionRatio", static_cast<int>(SavestateCompressionLevel::Medium));
connect(m_ui.savestateCompressionMethod, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
&AdvancedSettingsWidget::onSavestateCompressionTypeChanged);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.pineEnable, "EmuCore", "EnablePINE", false);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.pineSlot, "EmuCore", "PINESlot", 28011);
@ -123,6 +132,12 @@ AdvancedSettingsWidget::AdvancedSettingsWidget(SettingsWindow* dialog, QWidget*
dialog->registerWidgetHelp(m_ui.patches, tr("Enable Compatibility Patches"), tr("Checked"),
tr("Automatically loads and applies compatibility patches to known problematic games."));
dialog->registerWidgetHelp(m_ui.savestateCompressionMethod, tr("Savestate Compression Method"), tr("Zstandard"),
tr("Determines the algorithm to be used when compressing savestates."));
dialog->registerWidgetHelp(m_ui.savestateCompressionLevel, tr("Savestate Compression Level"), tr("Medium"),
tr("Determines the level to be used when compressing savestates."));
}
AdvancedSettingsWidget::~AdvancedSettingsWidget() = default;
@ -189,3 +204,10 @@ void AdvancedSettingsWidget::setClampingMode(int vunum, int index)
m_dialog->setBoolSettingValue(
"EmuCore/CPU/Recompiler", (vunum >= 0 ? ((vunum == 0) ? "vu0Overflow" : "vu1Overflow") : "fpuOverflow"), first);
}
void AdvancedSettingsWidget::onSavestateCompressionTypeChanged()
{
const bool uncompressed = (m_dialog->getEffectiveIntValue("EmuCore", "SavestateCompressionType", static_cast<int>(SavestateCompressionMethod::Zstandard)) ==
static_cast<int>(SavestateCompressionMethod::Uncompressed));
m_ui.savestateCompressionLevel->setDisabled(uncompressed);
}

View File

@ -21,8 +21,8 @@ private:
int getGlobalClampingModeIndex(int vunum) const;
int getClampingModeIndex(int vunum) const;
void setClampingMode(int vunum, int index);
void onSavestateCompressionTypeChanged();
SettingsWindow* m_dialog;
Ui::AdvancedSystemSettingsWidget m_ui;
};

View File

@ -32,9 +32,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<y>-272</y>
<width>790</width>
<height>765</height>
<height>997</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -48,7 +48,7 @@
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="disclaimerLabel">
<property name="text">
<string>Changing these options may cause games to become non-functional. Modify at your own risk, the PCSX2 team will not provide support for configurations with these settings changed.</string>
</property>
@ -58,13 +58,13 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QGroupBox" name="eeSettings">
<property name="title">
<string extracomment="Emotion Engine = Commercial name of one of PS2's processors. Leave as-is unless there's an official name (like for Japanese).">EmotionEngine (MIPS-IV)</string>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QLabel" name="label_11">
<widget class="QLabel" name="eeRoundingLabel">
<property name="text">
<string extracomment="Rounding refers here to the mathematical term.">Rounding Mode:</string>
</property>
@ -95,7 +95,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<widget class="QLabel" name="eeDivRoundingLabel">
<property name="text">
<string extracomment="Rounding refers here to the mathematical term.">Division Rounding Mode:</string>
</property>
@ -126,7 +126,7 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<widget class="QLabel" name="eeClampLabel">
<property name="text">
<string extracomment="Clamping: Forcing out of bounds things in bounds by changing them to the closest possible value. In this case, this refers to clamping large PS2 floating point values (which map to infinity or NaN in PCs' IEEE754 floats) to non-infinite ones.">Clamping Mode:</string>
</property>
@ -157,7 +157,7 @@
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_4">
<layout class="QGridLayout" name="eeSettingsMisc">
<item row="1" column="0">
<widget class="QCheckBox" name="eeWaitLoopDetection">
<property name="text">
@ -213,13 +213,13 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="vuSettings">
<property name="title">
<string extracomment="Vector Unit/VU: refers to two of PS2's processors. Do not translate the full text or do so as a comment. Leave the acronym as-is.">Vector Units (VU)</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="vu1RoundingLabel">
<property name="text">
<string>VU1 Rounding Mode:</string>
</property>
@ -250,7 +250,7 @@
</widget>
</item>
<item row="4" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_6">
<layout class="QGridLayout" name="vuSettingsLayout">
<item row="1" column="0">
<widget class="QCheckBox" name="vuFlagHack">
<property name="text">
@ -306,21 +306,21 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="vu0ClampLabel">
<property name="text">
<string>VU0 Clamping Mode:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="vu0RoundingLabel">
<property name="text">
<string>VU0 Rounding Mode:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="vu1ClampLabel">
<property name="text">
<string>VU1 Clamping Mode:</string>
</property>
@ -378,7 +378,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<widget class="QGroupBox" name="iopSettings">
<property name="title">
<string>I/O Processor (IOP, MIPS-I)</string>
</property>
@ -394,7 +394,7 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<widget class="QGroupBox" name="gameSettings">
<property name="title">
<string>Game Settings</string>
</property>
@ -417,24 +417,24 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="basicGroupBox">
<widget class="QGroupBox" name="framerateControlSettings">
<property name="title">
<string>Frame Rate Control</string>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<layout class="QGridLayout" name="framerateControlLayout">
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="palFrameRate">
<property name="suffix">
<string extracomment="hz=Hertz, as in the measuring unit. Shown after the corresponding number. Those languages who'd need to remove the space or do something in between should do so."> hz</string>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="minimum">
<double>10.0</double>
<double>10.000000000000000</double>
</property>
<property name="maximum">
<double>300.0</double>
<double>300.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
@ -443,26 +443,26 @@
<property name="suffix">
<string> hz</string>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="minimum">
<double>10.0</double>
<double>10.000000000000000</double>
</property>
<property name="maximum">
<double>300.0</double>
<double>300.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="palLabel">
<property name="text">
<string>PAL Frame Rate:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="ntscLabel">
<property name="text">
<string>NTSC Frame Rate:</string>
</property>
@ -472,11 +472,82 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<widget class="QGroupBox" name="savestateSettings">
<property name="title">
<string>Savestate Settings</string>
</property>
<layout class="QGridLayout" name="savestateSettingsLayout">
<item row="1" column="0">
<widget class="QLabel" name="savestateCompressionMethodLabel">
<property name="text">
<string>Compression Level:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="savestateCompressionLabel">
<property name="text">
<string>Compression Method:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="savestateCompressionMethod">
<item>
<property name="text">
<string>Uncompressed</string>
</property>
</item>
<item>
<property name="text">
<string>Deflate64</string>
</property>
</item>
<item>
<property name="text">
<string>Zstandard</string>
</property>
</item>
<item>
<property name="text">
<string>LZMA2</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="savestateCompressionLevel">
<item>
<property name="text">
<string>Low (Fast)</string>
</property>
</item>
<item>
<property name="text">
<string>Medium (Recommended)</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
<item>
<property name="text">
<string>Very High (Slow, Not Recommended)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="pineSettings">
<property name="title">
<string>PINE Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<layout class="QGridLayout" name="pineSettingsLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="pineSlot">
<property name="sizePolicy">
@ -488,7 +559,7 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="pineSlotLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -511,7 +582,7 @@
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<spacer name="verticalSpacerBottom">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>

View File

@ -342,6 +342,22 @@ enum class GSDumpCompressionMethod : u8
Zstandard,
};
enum class SavestateCompressionMethod : u8
{
Uncompressed = 0,
Deflate64 = 1,
Zstandard = 2,
LZMA2 = 3
};
enum class SavestateCompressionLevel : u8
{
Low = 0,
Medium = 1,
High = 2,
VeryHigh = 3,
};
enum class GSHardwareDownloadMode : u8
{
Enabled,
@ -1129,6 +1145,18 @@ struct Pcsx2Config
bool operator!=(const AchievementsOptions& right) const;
};
struct SavestateOptions
{
SavestateOptions();
void LoadSave(SettingsWrapper& wrap);
SavestateCompressionMethod CompressionType = SavestateCompressionMethod::Zstandard;
SavestateCompressionLevel CompressionRatio = SavestateCompressionLevel::Medium;
bool operator==(const SavestateOptions& right) const;
bool operator!=(const SavestateOptions& right) const;
};
// ------------------------------------------------------------------------
BITFIELD32()
@ -1151,7 +1179,6 @@ struct Pcsx2Config
EnableDiscordPresence : 1, // enables discord rich presence integration
InhibitScreensaver : 1,
BackupSavestate : 1,
SavestateZstdCompression : 1,
McdFolderAutoManage : 1,
HostFs : 1,
@ -1166,6 +1193,7 @@ struct Pcsx2Config
ProfilerOptions Profiler;
DebugOptions Debugger;
EmulationSpeedOptions EmulationSpeed;
SavestateOptions Savestate;
SPU2Options SPU2;
DEV9Options DEV9;
USBOptions USB;

View File

@ -3938,7 +3938,11 @@ void FullscreenUI::DrawGraphicsSettingsPage(SettingsInterface* bsi, bool show_ad
s_tv_shaders, std::size(s_tv_shaders), true);
}
static constexpr const char* s_gsdump_compression[] = {FSUI_NSTR("Uncompressed"), FSUI_NSTR("LZMA (xz)"), FSUI_NSTR("Zstandard (zst)")};
static constexpr const char* s_gsdump_compression[] = {
FSUI_NSTR("Uncompressed"),
FSUI_NSTR("LZMA (xz)"),
FSUI_NSTR("Zstandard (zst)")
};
if (show_advanced_settings)
{
@ -4723,6 +4727,20 @@ void FullscreenUI::DrawAdvancedSettingsPage()
bsi, FSUI_ICONSTR(ICON_FA_COMPACT_DISC, "CDVD Verbose Reads"), FSUI_CSTR("Logs disc reads from games."), "EmuCore", "CdvdVerboseReads", false);
}
static constexpr const char* s_savestate_compression_type[] = {
FSUI_NSTR("Uncompressed"),
FSUI_NSTR("Deflate64"),
FSUI_NSTR("Zstandard"),
FSUI_NSTR("LZMA2")
};
static constexpr const char* s_savestate_compression_ratio[] = {
FSUI_NSTR("Low (Fast)"),
FSUI_NSTR("Medium (Recommended)"),
FSUI_NSTR("High"),
FSUI_NSTR("Very High (Slow, Not Recommended)")
};
if (show_advanced_settings)
{
MenuHeading(FSUI_CSTR("Emotion Engine"));
@ -4781,6 +4799,12 @@ void FullscreenUI::DrawAdvancedSettingsPage()
FSUI_CSTR("Performs just-in-time binary translation of 32-bit MIPS-I machine code to native code."), "EmuCore/CPU/Recompiler",
"EnableIOP", true);
MenuHeading(FSUI_CSTR("Savestate"));
DrawIntListSetting(bsi, FSUI_CSTR("Compression Method"), FSUI_CSTR("Sets the compression algorithm for savestate."), "EmuCore",
"SavestateCompressionType", static_cast<int>(SavestateCompressionMethod::Zstandard), s_savestate_compression_type, std::size(s_savestate_compression_type), true);
DrawIntListSetting(bsi, FSUI_CSTR("Compression Level"), FSUI_CSTR("Sets the compression level for savestate."), "EmuCore",
"SavestateCompressionRatio", static_cast<int>(SavestateCompressionLevel::Medium), s_savestate_compression_ratio, std::size(s_savestate_compression_ratio), true);
MenuHeading(FSUI_CSTR("Graphics"));
DrawToggleSetting(bsi, FSUI_CSTR("Use Debug Device"), FSUI_CSTR("Enables API-level validation of graphics commands."), "EmuCore/GS",
"UseDebugDevice", false);
@ -6854,7 +6878,6 @@ TRANSLATE_NOOP("FullscreenUI", "Game region copied to clipboard.");
TRANSLATE_NOOP("FullscreenUI", "Game compatibility copied to clipboard.");
TRANSLATE_NOOP("FullscreenUI", "Game path copied to clipboard.");
TRANSLATE_NOOP("FullscreenUI", "Automatic");
TRANSLATE_NOOP("FullscreenUI", "Per-game controller configuration initialized with global settings.");
TRANSLATE_NOOP("FullscreenUI", "Controller settings reset to default.");
TRANSLATE_NOOP("FullscreenUI", "No input profiles available.");
TRANSLATE_NOOP("FullscreenUI", "Create New...");
@ -7024,8 +7047,6 @@ TRANSLATE_NOOP("FullscreenUI", "Dithering");
TRANSLATE_NOOP("FullscreenUI", "Selects the type of dithering applies when the game requests it.");
TRANSLATE_NOOP("FullscreenUI", "Blending Accuracy");
TRANSLATE_NOOP("FullscreenUI", "Determines the level of accuracy when emulating blend modes not supported by the host graphics API.");
TRANSLATE_NOOP("FullscreenUI", "Texture Preloading");
TRANSLATE_NOOP("FullscreenUI", "Uploads full textures to the GPU on use, rather than only the utilized regions. Can improve performance in some games.");
TRANSLATE_NOOP("FullscreenUI", "Mipmapping");
TRANSLATE_NOOP("FullscreenUI", "Enables emulation of the GS's texture mipmapping.");
TRANSLATE_NOOP("FullscreenUI", "Software Rendering Threads");
@ -7142,6 +7163,8 @@ TRANSLATE_NOOP("FullscreenUI", "Disable Shader Cache");
TRANSLATE_NOOP("FullscreenUI", "Prevents the loading and saving of shaders/pipelines to disk.");
TRANSLATE_NOOP("FullscreenUI", "Disable Vertex Shader Expand");
TRANSLATE_NOOP("FullscreenUI", "Falls back to the CPU for expanding sprites/lines.");
TRANSLATE_NOOP("FullscreenUI", "Texture Preloading");
TRANSLATE_NOOP("FullscreenUI", "Uploads full textures to the GPU on use, rather than only the utilized regions. Can improve performance in some games.");
TRANSLATE_NOOP("FullscreenUI", "Audio Control");
TRANSLATE_NOOP("FullscreenUI", "Controls the volume of the audio played on the host.");
TRANSLATE_NOOP("FullscreenUI", "Controls the volume of the audio played on the host when fast forwarding.");
@ -7222,6 +7245,11 @@ TRANSLATE_NOOP("FullscreenUI", "Runs VU1 instantly. Provides a modest speed impr
TRANSLATE_NOOP("FullscreenUI", "I/O Processor");
TRANSLATE_NOOP("FullscreenUI", "Enable IOP Recompiler");
TRANSLATE_NOOP("FullscreenUI", "Performs just-in-time binary translation of 32-bit MIPS-I machine code to native code.");
TRANSLATE_NOOP("FullscreenUI", "Savestate");
TRANSLATE_NOOP("FullscreenUI", "Compression Method");
TRANSLATE_NOOP("FullscreenUI", "Sets the compression algorithm for savestate.");
TRANSLATE_NOOP("FullscreenUI", "Compression Level");
TRANSLATE_NOOP("FullscreenUI", "Sets the compression level for savestate.");
TRANSLATE_NOOP("FullscreenUI", "Graphics");
TRANSLATE_NOOP("FullscreenUI", "Use Debug Device");
TRANSLATE_NOOP("FullscreenUI", "Enables API-level validation of graphics commands.");
@ -7517,6 +7545,12 @@ TRANSLATE_NOOP("FullscreenUI", "PS1");
TRANSLATE_NOOP("FullscreenUI", "Negative");
TRANSLATE_NOOP("FullscreenUI", "Positive");
TRANSLATE_NOOP("FullscreenUI", "Chop/Zero (Default)");
TRANSLATE_NOOP("FullscreenUI", "Deflate64");
TRANSLATE_NOOP("FullscreenUI", "Zstandard");
TRANSLATE_NOOP("FullscreenUI", "LZMA2");
TRANSLATE_NOOP("FullscreenUI", "Low (Fast)");
TRANSLATE_NOOP("FullscreenUI", "Medium (Recommended)");
TRANSLATE_NOOP("FullscreenUI", "Very High (Slow, Not Recommended)");
TRANSLATE_NOOP("FullscreenUI", "Game Grid");
TRANSLATE_NOOP("FullscreenUI", "Type");
TRANSLATE_NOOP("FullscreenUI", "Serial");

View File

@ -1460,6 +1460,28 @@ bool Pcsx2Config::DebugOptions::operator==(const DebugOptions& right) const
return OpEqu(bitset) && OpEqu(FontWidth) && OpEqu(FontHeight) && OpEqu(WindowWidth) && OpEqu(WindowHeight) && OpEqu(MemoryViewBytesPerRow);
}
Pcsx2Config::SavestateOptions::SavestateOptions()
{
}
void Pcsx2Config::SavestateOptions::LoadSave(SettingsWrapper& wrap)
{
SettingsWrapSection("EmuCore");
SettingsWrapIntEnumEx(CompressionType, "SavestateCompressionType");
SettingsWrapIntEnumEx(CompressionRatio, "SavestateCompressionRatio");
}
bool Pcsx2Config::SavestateOptions::operator!=(const SavestateOptions& right) const
{
return !this->operator==(right);
}
bool Pcsx2Config::SavestateOptions::operator==(const SavestateOptions& right) const
{
return OpEqu(CompressionType) && OpEqu(CompressionRatio);
};
Pcsx2Config::FilenameOptions::FilenameOptions()
{
}
@ -1702,7 +1724,6 @@ Pcsx2Config::Pcsx2Config()
EnableGameFixes = true;
InhibitScreensaver = true;
BackupSavestate = true;
SavestateZstdCompression = true;
WarnAboutUnsafeSettings = true;
// To be moved to FileMemoryCard pluign (someday)
@ -1741,7 +1762,6 @@ void Pcsx2Config::LoadSaveCore(SettingsWrapper& wrap)
SettingsWrapBitBool(HostFs);
SettingsWrapBitBool(BackupSavestate);
SettingsWrapBitBool(SavestateZstdCompression);
SettingsWrapBitBool(McdFolderAutoManage);
SettingsWrapBitBool(WarnAboutUnsafeSettings);
@ -1755,6 +1775,7 @@ void Pcsx2Config::LoadSaveCore(SettingsWrapper& wrap)
DEV9.LoadSave(wrap);
Gamefixes.LoadSave(wrap);
Profiler.LoadSave(wrap);
Savestate.LoadSave(wrap);
Debugger.LoadSave(wrap);
Trace.LoadSave(wrap);

View File

@ -914,9 +914,51 @@ static bool SaveState_ReadScreenshot(zip_t* zf, u32* out_width, u32* out_height,
// --------------------------------------------------------------------------------------
static bool SaveState_AddToZip(zip_t* zf, ArchiveEntryList* srclist, SaveStateScreenshotData* screenshot)
{
// use zstd compression, it can be 10x+ faster for saving.
const u32 compression = EmuConfig.SavestateZstdCompression ? ZIP_CM_ZSTD : ZIP_CM_DEFLATE;
const u32 compression_level = 0;
u32 compression;
u32 compression_level;
if (EmuConfig.Savestate.CompressionType == SavestateCompressionMethod::Zstandard)
{
compression = ZIP_CM_ZSTD;
if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::Low)
compression_level = 1;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::Medium)
compression_level = 3;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::High)
compression_level = 10;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::VeryHigh)
compression_level = 22;
}
else if (EmuConfig.Savestate.CompressionType == SavestateCompressionMethod::Deflate64)
{
compression = ZIP_CM_DEFLATE64;
if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::Low)
compression_level = 1;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::Medium)
compression_level = 3;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::High)
compression_level = 7;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::VeryHigh)
compression_level = 9;
}
else if (EmuConfig.Savestate.CompressionType == SavestateCompressionMethod::LZMA2)
{
compression = ZIP_CM_LZMA2;
if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::Low)
compression_level = 1;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::Medium)
compression_level = 3;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::High)
compression_level = 7;
else if (EmuConfig.Savestate.CompressionRatio == SavestateCompressionLevel::VeryHigh)
compression_level = 9;
}
else if (EmuConfig.Savestate.CompressionType == SavestateCompressionMethod::Uncompressed)
{
compression = ZIP_CM_STORE;
compression_level = 0;
}
// version indicator
{
@ -949,7 +991,7 @@ static bool SaveState_AddToZip(zip_t* zf, ArchiveEntryList* srclist, SaveStateSc
return false;
}
zip_set_file_compression(zf, fi, ZIP_CM_STORE, 0);
zip_set_file_compression(zf, fi, compression, compression_level);
}
const uint listlen = srclist->GetLength();