From d577713243eae403675b77063f58d78208252e8b Mon Sep 17 00:00:00 2001 From: henrique Date: Mon, 23 Feb 2026 22:04:08 -0300 Subject: [PATCH] adw --- install_vr4life.py | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/install_vr4life.py b/install_vr4life.py index 441dd70..1f3e7bd 100644 --- a/install_vr4life.py +++ b/install_vr4life.py @@ -3,7 +3,7 @@ from pymxs import runtime as rt def carregar_menu_mnx(): print("\n" + "="*50) - print("AGENDANDO CARREGAMENTO DE INTERFACE - VR4LIFE") + print("AGENDANDO CARREGAMENTO - VR4LIFE (MODO SEGURO)") print("="*50) try: @@ -14,7 +14,7 @@ def carregar_menu_mnx(): plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/") run_script = f"{plugin_dir}/run_vr4life.py" - # 2. Registrar MacroScript (Isso pode ser feito agora, não depende de UI) + # 2. Registrar MacroScript macro_cmd = ( 'macroScript VR4Life_Launcher\n' 'category:"Immerse Games"\n' @@ -25,38 +25,31 @@ def carregar_menu_mnx(): ) rt.execute(macro_cmd) - # 3. AGENDAMENTO (O Timer de 2 segundos) - # Criamos um timer que espera o menuMan acordar para carregar o seu MNX + # 3. TIMER COM EXECUÇÃO TARDIA (Late Bound) + # Usamos execute dentro do timer para o compilador não travar no 'menuMan' agora timer_cmd = f""" ( - fn tryLoadVRMenu = ( - if menuMan != undefined then ( - menuMan.loadMenuFile "{caminho_mnx}" - menuMan.updateMenuBar() - format ">> VR4Life: Menu carregado via Timer com sucesso.\\n" - return true - ) else ( - format ">> VR4Life: Aguardando interface...\\n" - return false - ) - ) + global _vr4life_timer = dotNetObject "System.Windows.Forms.Timer" + _vr4life_timer.interval = 3000 -- 3 segundos para garantir - -- Cria um timer de 2000ms (2 segundos) - local theTimer = dotNetObject "System.Windows.Forms.Timer" - theTimer.interval = 2000 - - dotNet.addEventHandler theTimer "Tick" (fn onTick s e = ( - if (tryLoadVRMenu()) do ( + dotNet.addEventHandler _vr4life_timer "Tick" (fn onTick s e = ( + -- Só tentamos acessar o menuMan aqui dentro, após o tempo passar + if (execute "menuMan") != undefined then ( + execute "menuMan.loadMenuFile \\"{caminho_mnx}\\"" + execute "menuMan.updateMenuBar()" + format ">> VR4Life: Menu carregado com sucesso apos espera.\\n" s.stop() s.dispose() + ) else ( + format ">> VR4Life: Interface ainda carregando...\\n" ) )) - theTimer.start() + _vr4life_timer.start() + format "[*] Aguardando 3 segundos para injetar o menu...\\n" ) """ rt.execute(timer_cmd) - print("[*] Timer iniciado. O menu aparecera em 2 segundos.") except Exception as e: print(f"\n[EXCEPTION] Falha no agendamento:\n{str(e)}")