diff --git a/.gitignore b/.gitignore index ab16836..3adca01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,5 @@ **/target -**/*.py -**/*.pyc Cargo.lock .idea/ - -*.ovl - -*.elf - -*.nacp - -*.nro release/ \ No newline at end of file diff --git a/libtraining_modpack_menu.nro b/libtraining_modpack_menu.nro new file mode 100644 index 0000000..e744cbc Binary files /dev/null and b/libtraining_modpack_menu.nro differ diff --git a/src/common/menu.rs b/src/common/menu.rs index 2418f1d..a8bc246 100644 --- a/src/common/menu.rs +++ b/src/common/menu.rs @@ -73,12 +73,11 @@ pub fn set_menu_from_url(orig_last_url: &str) { MENU = get_menu_from_url(MENU, last_url); if MENU.quick_menu == OnOff::Off { - let is_emulator = skyline::hooks::getRegionAddress(skyline::hooks::Region::Text) as u64 == 0x8004000; - if is_emulator { + if is_emulator() { skyline::error::show_error( 0x69, - "Cannot use web menu on emulator.\n", - "Only the quick menu is runnable via emulator currently.", + "Cannot use web menu on emulator.\n\0", + "Only the quick menu is runnable via emulator currently.\n\0", ); } diff --git a/src/common/mod.rs b/src/common/mod.rs index 41040f6..4067eaf 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -29,6 +29,11 @@ pub fn get_category(module_accessor: &mut app::BattleObjectModuleAccessor) -> i3 (module_accessor.info >> 28) as u8 as i32 } +pub fn is_emulator() -> bool { + unsafe { skyline::hooks::getRegionAddress(skyline::hooks::Region::Text) as u64 == 0x8004000 } +} + + pub fn get_module_accessor(fighter_id: FighterId) -> *mut app::BattleObjectModuleAccessor { let entry_id_int = fighter_id as i32; let entry_id = app::FighterEntryID(entry_id_int); diff --git a/src/lib.rs b/src/lib.rs index 45b79d2..67526e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -27,6 +27,7 @@ use skyline::nro::{self, NroInfo}; use std::fs; use owo_colors::OwoColorize; +use training_mod_consts::OnOff; fn nro_main(nro: &NroInfo<'_>) { if nro.module.isLoaded { @@ -104,6 +105,9 @@ pub fn main() { log!("Previous menu found, loading from training_modpack_menu.conf"); unsafe { MENU = get_menu_from_url(MENU, std::str::from_utf8(&menu_conf).unwrap()); + if is_emulator() { + MENU.quick_menu = OnOff::On; + } } } else { log!("Previous menu found but is invalid."); @@ -123,6 +127,9 @@ pub fn main() { DEFAULT_MENU, std::str::from_utf8(&menu_defaults_conf).unwrap(), ); + if is_emulator() { + DEFAULT_MENU.quick_menu = OnOff::On; + } crate::menu::write_menu(); } } else {