From be9ba1366efd8a45e6e8b3f3a3ddc997242bdfe8 Mon Sep 17 00:00:00 2001 From: Logan McNaughton <848146+loganmc10@users.noreply.github.com> Date: Tue, 19 May 2026 14:10:25 +0200 Subject: [PATCH] move some android guards (#917) * move some android guards * more --- src/ui/gui.rs | 5 +---- src/ui/input.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ui/gui.rs b/src/ui/gui.rs index 4751bd63..f521507c 100644 --- a/src/ui/gui.rs +++ b/src/ui/gui.rs @@ -139,7 +139,6 @@ fn local_game_window(app: &AppWindow, config: &ui::config::Config) { file_dropped(app); } -#[cfg(not(target_os = "android"))] fn input_profiles(config: &ui::config::Config) -> Vec { let mut profiles = vec![]; for key in config.input.input_profiles.keys() { @@ -178,7 +177,6 @@ fn settings_window(app: &AppWindow, config: &ui::config::Config) { } } -#[cfg(not(target_os = "android"))] fn update_input_profiles(weak: &slint::Weak, config: &ui::config::Config) { let profiles = input_profiles(config); let config_bindings = config.input.input_profile_binding.clone(); @@ -224,8 +222,8 @@ fn clear_gb_paths(weak: &slint::Weak, player: i32) { .unwrap(); } -#[cfg(not(target_os = "android"))] fn controller_window(app: &AppWindow, config: &ui::config::Config) { + #[cfg(not(target_os = "android"))] ui::sdl_init(sdl3_sys::init::SDL_INIT_GAMEPAD); app.set_emulate_vru(config.input.emulate_vru); @@ -510,7 +508,6 @@ pub fn app_window() { { let config = ui::config::Config::new(); settings_window(&app, &config); - #[cfg(not(target_os = "android"))] controller_window(&app, &config); local_game_window(&app, &config); } diff --git a/src/ui/input.rs b/src/ui/input.rs index 327034e2..937e73f9 100644 --- a/src/ui/input.rs +++ b/src/ui/input.rs @@ -343,6 +343,7 @@ fn hotkey_pressed( pressed } +#[cfg(not(target_os = "android"))] pub fn get_controller_names() -> Vec { let mut controllers: Vec = vec![]; @@ -359,6 +360,11 @@ pub fn get_controller_names() -> Vec { controllers } +#[cfg(target_os = "android")] +pub fn get_controller_names() -> Vec { + vec!["None".into()] +} + #[cfg(not(target_os = "android"))] #[cfg(feature = "gui")] pub fn get_controller_paths() -> Vec { @@ -377,6 +383,12 @@ pub fn get_controller_paths() -> Vec { controller_paths } +#[cfg(target_os = "android")] +#[cfg(feature = "gui")] +pub fn get_controller_paths() -> Vec { + vec![String::new()] +} + fn handle_joystick_events(ui: &mut ui::Ui) { let joystick_event = unsafe { ui::video::get_joystick_event() }; if joystick_event.joystick_id != 0 {