add frame advance (#549)

This commit is contained in:
Logan McNaughton 2025-08-18 10:42:29 +02:00 committed by GitHub
parent 8037fb426e
commit 4476d476de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View File

@ -207,6 +207,9 @@ bool sdl_event_filter(void *userdata, SDL_Event *event)
case SDL_SCANCODE_RIGHTBRACKET:
callback.raise_volume = true;
break;
case SDL_SCANCODE_SLASH:
callback.frame_advance = true;
break;
case SDL_SCANCODE_0:
case SDL_SCANCODE_1:
case SDL_SCANCODE_2:
@ -536,6 +539,7 @@ CALL_BACK rdp_check_callback()
callback.load_state = false;
callback.lower_volume = false;
callback.raise_volume = false;
callback.frame_advance = false;
return return_value;
}

View File

@ -34,6 +34,7 @@ extern "C"
bool lower_volume;
bool raise_volume;
bool paused;
bool frame_advance;
uint32_t save_state_slot;
} CALL_BACK;

View File

@ -144,7 +144,7 @@ pub fn check_callback(device: &mut device::Device) -> bool {
speed_limiter_toggled = true;
device.vi.enable_speed_limiter = callback.enable_speedlimiter;
}
while callback.paused {
while callback.paused && !callback.frame_advance {
std::thread::sleep(std::time::Duration::from_secs_f64(1.0 / 60.0));
unsafe { sdl3_sys::events::SDL_PumpEvents() };
callback = unsafe { rdp_check_callback() };