|
|
|
@ -2,23 +2,19 @@ import os
|
|
|
|
from pymxs import runtime as rt
|
|
|
|
from pymxs import runtime as rt
|
|
|
|
|
|
|
|
|
|
|
|
def carregar_menu_mnx():
|
|
|
|
def carregar_menu_mnx():
|
|
|
|
rt.clearListener()
|
|
|
|
|
|
|
|
print("\n" + "="*50)
|
|
|
|
print("\n" + "="*50)
|
|
|
|
print("LOG DE INSTALAÇÃO DE INTERFACE - VR4LIFE")
|
|
|
|
print("AGENDANDO CARREGAMENTO DE INTERFACE - VR4LIFE")
|
|
|
|
print("="*50)
|
|
|
|
print("="*50)
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# 1. Definir caminhos (Usando barras normais / para evitar conflitos)
|
|
|
|
# 1. Definir caminhos
|
|
|
|
pasta_macros = rt.getDir(rt.name("userMacros"))
|
|
|
|
pasta_macros = rt.getDir(rt.name("userMacros"))
|
|
|
|
pasta_enu = os.path.dirname(pasta_macros)
|
|
|
|
pasta_enu = os.path.dirname(pasta_macros)
|
|
|
|
caminho_mnx = os.path.join(pasta_enu, "en-US", "UI", "vr4life.mnx").replace("\\", "/")
|
|
|
|
caminho_mnx = os.path.join(pasta_enu, "en-US", "UI", "vr4life.mnx").replace("\\", "/")
|
|
|
|
plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
|
|
|
|
plugin_dir = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
|
|
|
|
run_script = f"{plugin_dir}/run_vr4life.py"
|
|
|
|
run_script = f"{plugin_dir}/run_vr4life.py"
|
|
|
|
|
|
|
|
|
|
|
|
print(f"[*] Pasta do Plugin: {plugin_dir}")
|
|
|
|
# 2. Registrar MacroScript (Isso pode ser feito agora, não depende de UI)
|
|
|
|
print(f"[*] Caminho do MNX: {caminho_mnx}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 2. Registrar MacroScript
|
|
|
|
|
|
|
|
macro_cmd = (
|
|
|
|
macro_cmd = (
|
|
|
|
'macroScript VR4Life_Launcher\n'
|
|
|
|
'macroScript VR4Life_Launcher\n'
|
|
|
|
'category:"Immerse Games"\n'
|
|
|
|
'category:"Immerse Games"\n'
|
|
|
|
@ -29,30 +25,41 @@ def carregar_menu_mnx():
|
|
|
|
)
|
|
|
|
)
|
|
|
|
rt.execute(macro_cmd)
|
|
|
|
rt.execute(macro_cmd)
|
|
|
|
|
|
|
|
|
|
|
|
# 3. Carregar MNX (Corrigido para evitar o erro de sintaxe @C)
|
|
|
|
# 3. AGENDAMENTO (O Timer de 2 segundos)
|
|
|
|
if os.path.exists(caminho_mnx):
|
|
|
|
# Criamos um timer que espera o menuMan acordar para carregar o seu MNX
|
|
|
|
print(f"[!] Arquivo MNX encontrado. Solicitando carregamento...")
|
|
|
|
timer_cmd = f"""
|
|
|
|
|
|
|
|
(
|
|
|
|
# Aqui usamos aspas duplas e formatamos o caminho para o MaxScript
|
|
|
|
fn tryLoadVRMenu = (
|
|
|
|
cmd_load = (
|
|
|
|
if menuMan != undefined then (
|
|
|
|
'(\n'
|
|
|
|
menuMan.loadMenuFile "{caminho_mnx}"
|
|
|
|
' if menuMan != undefined then (\n'
|
|
|
|
menuMan.updateMenuBar()
|
|
|
|
f' local result = menuMan.loadMenuFile "{caminho_mnx}"\n'
|
|
|
|
format ">> VR4Life: Menu carregado via Timer com sucesso.\\n"
|
|
|
|
' menuMan.updateMenuBar()\n'
|
|
|
|
return true
|
|
|
|
' format ">> MaxScript: loadMenuFile result: %\\n" result\n'
|
|
|
|
) else (
|
|
|
|
' ) else (\n'
|
|
|
|
format ">> VR4Life: Aguardando interface...\\n"
|
|
|
|
' format ">> MaxScript Erro: menuMan ainda e undefined\\n"\n'
|
|
|
|
return false
|
|
|
|
' )\n'
|
|
|
|
)
|
|
|
|
')'
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
rt.execute(cmd_load)
|
|
|
|
|
|
|
|
else:
|
|
|
|
-- Cria um timer de 2000ms (2 segundos)
|
|
|
|
print(f"[X] ERRO: Arquivo {caminho_mnx} NAO existe no disco.")
|
|
|
|
local theTimer = dotNetObject "System.Windows.Forms.Timer"
|
|
|
|
|
|
|
|
theTimer.interval = 2000
|
|
|
|
print("="*50)
|
|
|
|
|
|
|
|
|
|
|
|
dotNet.addEventHandler theTimer "Tick" (fn onTick s e = (
|
|
|
|
|
|
|
|
if (tryLoadVRMenu()) do (
|
|
|
|
|
|
|
|
s.stop()
|
|
|
|
|
|
|
|
s.dispose()
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
theTimer.start()
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
rt.execute(timer_cmd)
|
|
|
|
|
|
|
|
print("[*] Timer iniciado. O menu aparecera em 2 segundos.")
|
|
|
|
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
except Exception as e:
|
|
|
|
print(f"\n[EXCEPTION] Falha grave:\n{str(e)}")
|
|
|
|
print(f"\n[EXCEPTION] Falha no agendamento:\n{str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
carregar_menu_mnx()
|
|
|
|
carregar_menu_mnx()
|