Preserve live reconnect endpoints and execute QA commands between frames

This commit is contained in:
shen
2026-10-18 16:43:51 -07:00
parent 95f1c30be2
commit ab516feb7b
14 changed files with 175 additions and 6 deletions
@@ -0,0 +1,33 @@
// PORT: keep the explicitly selected live endpoint when the original login UI reopens.
static const char c_szLiveEndpointScript[] = R"PY(
import game,introLogin,networkModule,mt_channel
_set=networkModule.MainStream.SetConnectInfo
_login=introLogin.LoginWindow.Open
_game=game.GameWindow.Open
def Configure(stream,host,port,account_host,account_port):
stream._portLiveEndpoint=(host,port,account_host,account_port)
_set(stream,host,port,account_host,account_port)
def SetConnectInfo(self,host,port,account_host=0,account_port=0):
saved=getattr(self,'_portLiveEndpoint',None)
if saved and getattr(self,'_portRestoreLiveEndpoint',False):host,port,account_host,account_port=saved
return _set(self,host,port,account_host,account_port)
def LoginOpen(self):
stream=self.stream
# An explicit channel change owns its new target; ordinary logout retains the last successful endpoint.
stream._portRestoreLiveEndpoint=not mt_channel.g_switcher.Busy()
try:return _login(self)
finally:stream._portRestoreLiveEndpoint=False
def GameOpen(self):
result=_game(self)
stream=self.stream
stream._portLiveEndpoint=(stream.addr,stream.port,stream.account_addr,stream.account_port)
return result
networkModule.MainStream.SetConnectInfo=SetConnectInfo
introLogin.LoginWindow.Open=LoginOpen
game.GameWindow.Open=GameOpen
)PY";
+2
View File
@@ -1042,6 +1042,7 @@ namespace PythonBoot
#include "RingsScript.inc"
#include "ItemActionsScript.inc"
#include "AttrLockScript.inc"
#include "LiveEndpointScript.inc"
#include "MinimapOuterRingScript.inc"
#ifdef MT_HAS_MESHPORT
#include "MeshPortScript.inc"
@@ -1146,6 +1147,7 @@ bool RunMainScript(const char* lpCmdLine, std::string* error)
install_script_module("mt_rings", c_szRingsScript);
install_script_module("mt_item_actions", c_szItemActionsScript);
install_script_module("mt_attr_lock", c_szAttrLockScript);
install_script_module("mt_live_endpoint", c_szLiveEndpointScript);
install_script_module("mt_minimap_buttons", c_szMinimapOuterRingScript);
if (g_touch_input)
install_script_module("mt_mobile_hud", c_szMobileHUDScript);