diff --git a/kubi/src/init.rs b/kubi/src/init.rs index 06484c3..56fcbf0 100644 --- a/kubi/src/init.rs +++ b/kubi/src/init.rs @@ -12,7 +12,12 @@ pub fn initialize_from_args( // If an address is provided, we're in multiplayer mode (the first argument is the address) // Otherwise, we're in singleplayer mode and working with local stuff let args: Vec = env::args().collect(); - if args.get(1) == Some(&"play".into()) { + if cfg!(target_os = "android") || (args.get(1) == Some(&"android".into())) { + // TODO REMOVE: temporarily bypass menu on Android as hUI (0.1.0-alpha.5) doesnt play well with touchscreens (yet? :3) + // TODO REMOVE: disable save files on Android as they're stored in relative path rn + all_storages.add_unique(GameType::Singleplayer); + all_storages.borrow::>().unwrap().0 = Some(GameState::LoadingWorld); + } else if args.get(1) == Some(&"play".into()) { // Open the local save file let save_file = open_local_save_file(Path::new("./world.kubi")).expect("failed to open save file"); all_storages.add_unique(IOThreadManager::new(save_file)); diff --git a/kubi/src/ui/shutdown_screen.rs b/kubi/src/ui/shutdown_screen.rs index 5fb6f0c..5e07030 100644 --- a/kubi/src/ui/shutdown_screen.rs +++ b/kubi/src/ui/shutdown_screen.rs @@ -18,7 +18,12 @@ fn intercept_exit( mut state: UniqueViewMut, cur_state: UniqueView, termination_state: Option>, + iota: Option>, ) { + // If iota is missing, don't bother with shutdown state (likely running without a save file) + if iota.is_none() { + return; + } if exit.0 { if *cur_state == GameState::ShuttingDown { // If we're already shutting down, check if we're done diff --git a/kubi/src/world/loading.rs b/kubi/src/world/loading.rs index 5963be1..88b2d33 100644 --- a/kubi/src/world/loading.rs +++ b/kubi/src/world/loading.rs @@ -507,9 +507,13 @@ fn process_completed_tasks( /// Save all modified chunks to the disk pub fn save_on_exit( - io: UniqueView, + io: Option>, world: UniqueView, ) { + let Some(io) = io else { + log::warn!("no IO thread manager, skipping save on exit"); + return + }; for (&position, chunk) in &world.chunks { if let Some(block_data) = &chunk.block_data { if chunk.data_modified {