parent
4a63f469bf
commit
db21800d9f
@ -314,7 +314,6 @@ impl Device {
|
||||
savestate: savestates::Savestate {
|
||||
save_state: false,
|
||||
load_state: false,
|
||||
save_rewind: false,
|
||||
load_rewind: false,
|
||||
last_rewind_saved: 0.0,
|
||||
rewind_pool: std::sync::Arc::new(std::sync::Mutex::new(
|
||||
|
||||
@ -160,14 +160,6 @@ pub fn vertical_interrupt_event(device: &mut device::Device) {
|
||||
|
||||
retroachievements::do_frame();
|
||||
|
||||
if device.netplay.is_none()
|
||||
&& device.ui.config.emulation.rewind
|
||||
&& device.vi.elapsed_time - device.savestate.last_rewind_saved > 1.0
|
||||
{
|
||||
device.savestate.save_rewind = true;
|
||||
device.savestate.last_rewind_saved = device.vi.elapsed_time;
|
||||
}
|
||||
|
||||
/* toggle vi field if in interlaced mode */
|
||||
device.vi.field ^= (device.vi.regs[VI_STATUS_REG] >> 6) & 0x1;
|
||||
|
||||
|
||||
@ -74,7 +74,6 @@ where
|
||||
pub struct Savestate {
|
||||
pub save_state: bool,
|
||||
pub load_state: bool,
|
||||
pub save_rewind: bool,
|
||||
pub load_rewind: bool,
|
||||
pub last_rewind_saved: f64,
|
||||
#[serde(skip)]
|
||||
@ -96,18 +95,23 @@ static SAVES_CLONE: std::sync::LazyLock<std::sync::Mutex<ui::storage::Saves>> =
|
||||
std::sync::LazyLock::new(|| std::sync::Mutex::new(ui::storage::Saves::default()));
|
||||
|
||||
pub fn process_savestates(device: &mut device::Device) {
|
||||
if device.savestate.save_state || device.savestate.save_rewind {
|
||||
let rewind = device.savestate.save_rewind && !device.savestate.save_state;
|
||||
if rewind {
|
||||
device.savestate.save_rewind = false;
|
||||
}
|
||||
let save_rewind = if device.netplay.is_none()
|
||||
&& device.ui.config.emulation.rewind
|
||||
&& device.vi.elapsed_time - device.savestate.last_rewind_saved > 1.0
|
||||
{
|
||||
device.savestate.last_rewind_saved = device.vi.elapsed_time;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
if device.savestate.save_state || save_rewind {
|
||||
create_savestate(device, !device.savestate.save_state, None);
|
||||
device.savestate.save_state = false;
|
||||
create_savestate(device, rewind, None);
|
||||
} else if device.savestate.load_state || device.savestate.load_rewind {
|
||||
load_savestate(device, device.savestate.load_rewind, None);
|
||||
device.savestate.load_state = false;
|
||||
let rewind = device.savestate.load_rewind;
|
||||
device.savestate.load_rewind = false;
|
||||
load_savestate(device, rewind, None);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user