Misc: Loading old save state versions is unlikely
This commit is contained in:
parent
c4bf5b4f2c
commit
723af4de3a
|
@ -390,7 +390,7 @@ bool Bus::DoState(StateWrapper& sw)
|
|||
sw.Do(&g_spu_access_time);
|
||||
sw.DoBytes(g_ram, g_ram_size);
|
||||
|
||||
if (sw.GetVersion() < 58)
|
||||
if (sw.GetVersion() < 58) [[unlikely]]
|
||||
{
|
||||
WARNING_LOG("Overwriting loaded BIOS with old save state.");
|
||||
sw.DoBytes(g_bios, BIOS_SIZE);
|
||||
|
|
|
@ -240,7 +240,7 @@ bool CPU::DoState(StateWrapper& sw)
|
|||
sw.Do(&g_state.branch_was_taken);
|
||||
sw.Do(&g_state.exception_raised);
|
||||
sw.DoEx(&g_state.bus_error, 61, false);
|
||||
if (sw.GetVersion() < 59)
|
||||
if (sw.GetVersion() < 59) [[unlikely]]
|
||||
{
|
||||
bool interrupt_delay;
|
||||
sw.Do(&interrupt_delay);
|
||||
|
@ -251,7 +251,7 @@ bool CPU::DoState(StateWrapper& sw)
|
|||
sw.Do(&g_state.next_load_delay_value);
|
||||
|
||||
// Compatibility with old states.
|
||||
if (sw.GetVersion() < 59)
|
||||
if (sw.GetVersion() < 59) [[unlikely]]
|
||||
{
|
||||
g_state.load_delay_reg =
|
||||
static_cast<Reg>(std::min(static_cast<u8>(g_state.load_delay_reg), static_cast<u8>(Reg::count)));
|
||||
|
@ -262,10 +262,10 @@ bool CPU::DoState(StateWrapper& sw)
|
|||
sw.Do(&g_state.cache_control.bits);
|
||||
sw.DoBytes(g_state.scratchpad.data(), g_state.scratchpad.size());
|
||||
|
||||
if (!GTE::DoState(sw))
|
||||
if (!GTE::DoState(sw)) [[unlikely]]
|
||||
return false;
|
||||
|
||||
if (sw.GetVersion() < 48)
|
||||
if (sw.GetVersion() < 48) [[unlikely]]
|
||||
{
|
||||
DebugAssert(sw.IsReading());
|
||||
ClearICache();
|
||||
|
|
|
@ -252,7 +252,7 @@ bool GPU::DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_displ
|
|||
sw.Do(&m_draw_mode.palette_reg.bits);
|
||||
sw.Do(&m_draw_mode.texture_window_value);
|
||||
|
||||
if (sw.GetVersion() < 62)
|
||||
if (sw.GetVersion() < 62) [[unlikely]]
|
||||
{
|
||||
// texture_page_x, texture_page_y, texture_palette_x, texture_palette_y
|
||||
DebugAssert(sw.IsReading());
|
||||
|
|
|
@ -487,7 +487,7 @@ bool Pad::DoState(StateWrapper& sw, bool is_memory_state)
|
|||
{
|
||||
for (u32 i = 0; i < NUM_CONTROLLER_AND_CARD_PORTS; i++)
|
||||
{
|
||||
if ((sw.GetVersion() < 50) && (i >= 2))
|
||||
if ((sw.GetVersion() < 50) && (i >= 2)) [[unlikely]]
|
||||
{
|
||||
// loading from old savestate which only had max 2 controllers.
|
||||
// honoring load_devices_from_save_states in this case seems debatable, but might as well...
|
||||
|
@ -519,7 +519,7 @@ bool Pad::DoState(StateWrapper& sw, bool is_memory_state)
|
|||
}
|
||||
}
|
||||
|
||||
if (sw.GetVersion() >= 50)
|
||||
if (sw.GetVersion() >= 50) [[unlikely]]
|
||||
{
|
||||
for (u32 i = 0; i < NUM_MULTITAPS; i++)
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ bool PlayStationMouse::DoState(StateWrapper& sw, bool apply_input_state)
|
|||
float delta_x = m_delta_x;
|
||||
float delta_y = m_delta_y;
|
||||
sw.Do(&button_state);
|
||||
if (sw.GetVersion() >= 60)
|
||||
if (sw.GetVersion() >= 60) [[unlikely]]
|
||||
{
|
||||
sw.Do(&delta_x);
|
||||
sw.Do(&delta_y);
|
||||
|
|
|
@ -2400,7 +2400,7 @@ bool System::DoState(StateWrapper& sw, GPUTexture** host_texture, bool update_di
|
|||
|
||||
if (!is_memory_state)
|
||||
{
|
||||
if (sw.GetVersion() >= 56)
|
||||
if (sw.GetVersion() >= 56) [[unlikely]]
|
||||
{
|
||||
if (!sw.DoMarker("Cheevos"))
|
||||
return false;
|
||||
|
|
|
@ -385,7 +385,7 @@ bool DoState(StateWrapper& sw)
|
|||
event->m_interval = interval;
|
||||
}
|
||||
|
||||
if (sw.GetVersion() < 43)
|
||||
if (sw.GetVersion() < 43) [[unlikely]]
|
||||
{
|
||||
u32 last_event_run_time = 0;
|
||||
sw.Do(&last_event_run_time);
|
||||
|
|
|
@ -183,7 +183,7 @@ public:
|
|||
template<typename T>
|
||||
void DoEx(T* data, u32 version_introduced, T default_value)
|
||||
{
|
||||
if (m_mode == Mode::Read && m_version < version_introduced)
|
||||
if (m_mode == Mode::Read && m_version < version_introduced) [[unlikely]]
|
||||
{
|
||||
*data = std::move(default_value);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue