diff --git a/src/device.rs b/src/device.rs index 34ba6e5..4290f56 100644 --- a/src/device.rs +++ b/src/device.rs @@ -322,6 +322,7 @@ impl Device { pif: pif::Pif { rom: [0; 1984], ram: [0; 64], + input_gathered: false, channels: [pif::PifChannel { tx: None, tx_buf: None, diff --git a/src/device/pif.rs b/src/device/pif.rs index 2881b57..b24711c 100644 --- a/src/device/pif.rs +++ b/src/device/pif.rs @@ -8,6 +8,7 @@ pub struct Pif { #[serde(with = "serde_big_array::BigArray")] pub ram: [u8; 64], pub channels: [PifChannel; 5], + pub input_gathered: bool, } #[derive(Copy, Clone, serde::Serialize, serde::Deserialize)] @@ -95,6 +96,9 @@ fn process_channel(device: &mut device::Device, channel: usize) -> usize { } pub fn update_pif_ram(device: &mut device::Device) -> u64 { + unsafe { sdl3_sys::events::SDL_PumpEvents() }; + device.pif.input_gathered = true; + let mut active_channels = 0; for k in 0..PIF_CHANNELS_COUNT { active_channels += process_channel(device, k) diff --git a/src/device/vi.rs b/src/device/vi.rs index 392b600..8110118 100644 --- a/src/device/vi.rs +++ b/src/device/vi.rs @@ -159,6 +159,10 @@ pub fn vertical_interrupt_event(device: &mut device::Device) { if device.netplay.is_none() && paused { ui::video::pause_loop(); + } else if !device.pif.input_gathered { + unsafe { sdl3_sys::events::SDL_PumpEvents() }; // in case the game isn't prompting for input + } else { + device.pif.input_gathered = false; } /* diff --git a/src/ui/input.rs b/src/ui/input.rs index 53c8175..957a687 100644 --- a/src/ui/input.rs +++ b/src/ui/input.rs @@ -385,8 +385,6 @@ pub fn get_controller_paths(game_ui: &ui::Ui) -> Vec> { } pub fn get(ui: &ui::Ui, channel: usize) -> InputData { - unsafe { sdl3_sys::events::SDL_PumpEvents() }; - let profile_name = ui.config.input.input_profile_binding[channel].clone(); let profile = ui.config.input.input_profiles.get(&profile_name).unwrap(); let mut keys = 0;