mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2025-01-19 17:00:15 +00:00
Fix issue with not being able to reopen menu after fighter reset/reentry into training
This commit is contained in:
parent
17f2b05940
commit
88abeadfdd
2 changed files with 620 additions and 613 deletions
|
@ -403,12 +403,12 @@ pub unsafe fn quick_menu_loop() {
|
||||||
static mut WEB_MENU_ACTIVE: bool = false;
|
static mut WEB_MENU_ACTIVE: bool = false;
|
||||||
|
|
||||||
pub unsafe fn web_session_loop() {
|
pub unsafe fn web_session_loop() {
|
||||||
// Don't query the fightermanager too early otherwise it will crash...
|
// Don't query the FighterManager too early otherwise it will crash...
|
||||||
std::thread::sleep(std::time::Duration::new(30, 0)); // sleep for 30 secs on bootup
|
std::thread::sleep(std::time::Duration::new(30, 0)); // sleep for 30 secs on bootup
|
||||||
let mut web_session: Option<WebSession> = None;
|
let mut web_session: Option<WebSession> = None;
|
||||||
loop {
|
loop {
|
||||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||||
if is_ready_go() & is_training_mode() {
|
if (is_ready_go() || entry_count() > 0) && is_training_mode() {
|
||||||
if web_session.is_some() {
|
if web_session.is_some() {
|
||||||
if WEB_MENU_ACTIVE {
|
if WEB_MENU_ACTIVE {
|
||||||
println!("[Training Modpack] Opening menu session...");
|
println!("[Training Modpack] Opening menu session...");
|
||||||
|
@ -454,9 +454,10 @@ pub unsafe fn web_session_loop() {
|
||||||
// No longer in training mode, tear down the session.
|
// No longer in training mode, tear down the session.
|
||||||
// This will avoid conflicts with other web plugins, and helps with stability.
|
// This will avoid conflicts with other web plugins, and helps with stability.
|
||||||
// Having the session open too long, especially if the switch has been put to sleep, can cause freezes
|
// Having the session open too long, especially if the switch has been put to sleep, can cause freezes
|
||||||
if web_session.is_some() {
|
if let Some(web_session_to_kill) = web_session {
|
||||||
println!("[Training Modpack] Tearing down Training Modpack menu session");
|
println!("[Training Modpack] Tearing down Training Modpack menu session");
|
||||||
web_session.unwrap().exit();
|
web_session_to_kill.exit();
|
||||||
|
web_session_to_kill.wait_for_exit();
|
||||||
}
|
}
|
||||||
web_session = None;
|
web_session = None;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,3 +147,9 @@ pub unsafe fn is_ready_go() -> bool {
|
||||||
let fighter_manager = *(FIGHTER_MANAGER_ADDR as *mut *mut app::FighterManager);
|
let fighter_manager = *(FIGHTER_MANAGER_ADDR as *mut *mut app::FighterManager);
|
||||||
FighterManager::is_ready_go(fighter_manager)
|
FighterManager::is_ready_go(fighter_manager)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if a match is currently active
|
||||||
|
pub unsafe fn entry_count() -> i32 {
|
||||||
|
let fighter_manager = *(FIGHTER_MANAGER_ADDR as *mut *mut app::FighterManager);
|
||||||
|
FighterManager::entry_count(fighter_manager)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue