System: Remove BIOS from save state
Makes the states smaller, as well as not creating potential piracy issues when sending across the wire.
This commit is contained in:
parent
1fcf16fc81
commit
33f5d9cb9c
|
@ -211,7 +211,13 @@ bool DoState(StateWrapper& sw)
|
|||
sw.Do(&m_cdrom_access_time);
|
||||
sw.Do(&m_spu_access_time);
|
||||
sw.DoBytes(g_ram, g_ram_size);
|
||||
sw.DoBytes(g_bios, BIOS_SIZE);
|
||||
|
||||
if (sw.GetVersion() < 58)
|
||||
{
|
||||
Log_WarningPrint("Overwriting loaded BIOS with old save state.");
|
||||
sw.DoBytes(g_bios, BIOS_SIZE);
|
||||
}
|
||||
|
||||
sw.DoArray(m_MEMCTRL.regs, countof(m_MEMCTRL.regs));
|
||||
sw.Do(&m_ram_size_reg);
|
||||
sw.Do(&m_tty_line_buffer);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "types.h"
|
||||
|
||||
static constexpr u32 SAVE_STATE_MAGIC = 0x43435544;
|
||||
static constexpr u32 SAVE_STATE_VERSION = 57;
|
||||
static constexpr u32 SAVE_STATE_VERSION = 58;
|
||||
static constexpr u32 SAVE_STATE_MINIMUM_VERSION = 42;
|
||||
|
||||
static_assert(SAVE_STATE_VERSION >= SAVE_STATE_MINIMUM_VERSION);
|
||||
|
|
|
@ -1661,6 +1661,23 @@ bool System::DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_di
|
|||
sw.Do(&s_frame_number);
|
||||
sw.Do(&s_internal_frame_number);
|
||||
|
||||
// Don't bother checking this at all for memory states, since they won't have a different BIOS...
|
||||
if (!is_memory_state)
|
||||
{
|
||||
BIOS::Hash bios_hash = s_bios_hash;
|
||||
sw.DoBytesEx(bios_hash.bytes, sizeof(bios_hash.bytes), 58, s_bios_hash.bytes);
|
||||
if (bios_hash != s_bios_hash)
|
||||
{
|
||||
Log_WarningPrintf("BIOS hash mismatch: System: %s | State: %s", s_bios_hash.ToString().c_str(),
|
||||
bios_hash.ToString().c_str());
|
||||
Host::AddKeyedOSDMessage(
|
||||
"StateBIOSMismatch",
|
||||
Host::TranslateStdString("OSDMessage", "This save state was created with a different BIOS version or patch "
|
||||
"options. This may cause stability issues."),
|
||||
10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!sw.DoMarker("CPU") || !CPU::DoState(sw))
|
||||
return false;
|
||||
|
||||
|
|
|
@ -29,6 +29,17 @@ void StateWrapper::DoBytes(void* data, size_t length)
|
|||
}
|
||||
}
|
||||
|
||||
void StateWrapper::DoBytesEx(void* data, size_t length, u32 version_introduced, const void* default_value)
|
||||
{
|
||||
if (m_mode == Mode::Read && m_version < version_introduced)
|
||||
{
|
||||
std::memcpy(data, default_value, length);
|
||||
return;
|
||||
}
|
||||
|
||||
DoBytes(data, length);
|
||||
}
|
||||
|
||||
void StateWrapper::Do(bool* value_ptr)
|
||||
{
|
||||
if (m_mode == Mode::Read)
|
||||
|
|
|
@ -104,6 +104,7 @@ public:
|
|||
}
|
||||
|
||||
void DoBytes(void* data, size_t length);
|
||||
void DoBytesEx(void* data, size_t length, u32 version_introduced, const void* default_value);
|
||||
|
||||
void Do(bool* value_ptr);
|
||||
void Do(std::string* value_ptr);
|
||||
|
@ -182,7 +183,7 @@ public:
|
|||
template<typename T>
|
||||
void DoEx(T* data, u32 version_introduced, T default_value)
|
||||
{
|
||||
if (m_version < version_introduced)
|
||||
if (m_mode == Mode::Read && m_version < version_introduced)
|
||||
{
|
||||
*data = std::move(default_value);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue