diff --git a/src/main.rs b/src/main.rs index 03294af1..4cd11942 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,6 +121,9 @@ async fn main() -> std::io::Result<()> { std::fs::create_dir_all(dirs.cache_dir)?; std::fs::create_dir_all(dirs.data_dir.join("saves"))?; std::fs::create_dir_all(dirs.data_dir.join("states"))?; + + ui::sdl_hints(); + let args = Args::parse(); if let Some(game) = args.game { let file_path = std::path::Path::new(&game); diff --git a/src/ui.rs b/src/ui.rs index 6df498e7..4d8992a2 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -83,6 +83,16 @@ pub struct Ui { pub usb: Usb, } +pub fn sdl_hints() { + unsafe { + let hint = std::ffi::CString::new("1").unwrap(); + sdl3_sys::everything::SDL_SetHint( + sdl3_sys::everything::SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + hint.as_ptr(), + ); + } +} + pub fn sdl_init(flag: sdl3_sys::init::SDL_InitFlags) { unsafe { if sdl3_sys::init::SDL_WasInit(flag) == 0 && !sdl3_sys::init::SDL_InitSubSystem(flag) { diff --git a/src/ui/video.rs b/src/ui/video.rs index 0769deda..e5838abb 100644 --- a/src/ui/video.rs +++ b/src/ui/video.rs @@ -97,11 +97,6 @@ pub fn init(device: &mut device::Device) { } unsafe { sdl3_sys::everything::SDL_HideCursor(); - let hint = std::ffi::CString::new("1").unwrap(); - sdl3_sys::everything::SDL_SetHint( - sdl3_sys::everything::SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, - hint.as_ptr(), - ); } let gfx_info = build_gfx_info(device);