mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-24 02:44:17 +00:00
Small fixes to Quick Menu
This commit is contained in:
parent
e4e2de0a79
commit
6976c53172
5 changed files with 15 additions and 14 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -1,15 +1,5 @@
|
|||
**/target
|
||||
**/*.py
|
||||
**/*.pyc
|
||||
Cargo.lock
|
||||
|
||||
.idea/
|
||||
|
||||
*.ovl
|
||||
|
||||
*.elf
|
||||
|
||||
*.nacp
|
||||
|
||||
*.nro
|
||||
release/
|
BIN
libtraining_modpack_menu.nro
Normal file
BIN
libtraining_modpack_menu.nro
Normal file
Binary file not shown.
|
@ -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",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue