fix: solve MuMuPlayer12 failing to launch when starting multiple instances concurrently

This commit is contained in:
2026-07-06 22:41:04 +08:00
parent ad186c5d34
commit 292d1d1e3a
+12 -6
View File
@@ -96,11 +96,14 @@ class PlatformWindows(PlatformBase, EmulatorManager):
# NemuPlayer.exe -m nemu-12.0-x64-default # NemuPlayer.exe -m nemu-12.0-x64-default
self.execute(f'"{exe}" -m {instance.name}') self.execute(f'"{exe}" -m {instance.name}')
elif instance == Emulator.MuMuPlayer12: elif instance == Emulator.MuMuPlayer12:
# MuMuPlayer.exe -v 0 # MuMuManager.exe api -v 0 launch_player
# MuMuNxMain.exe -v 0 # Launch via MuMuManager instead of MuMuPlayer.exe/MuMuNxMain.exe.
# MuMuNxMain.exe is a GUI singleton, if two instances get launched at the same time,
# the second launch request is handed over to a MuMuNxMain.exe that is still initializing
# and gets silently dropped, while MuMuManager queues requests in backend service.
if instance.MuMuPlayer12_id is None: if instance.MuMuPlayer12_id is None:
logger.warning(f'Cannot get MuMu instance index from name {instance.name}') logger.warning(f'Cannot get MuMu instance index from name {instance.name}')
self.execute(f'"{exe}" -v {instance.MuMuPlayer12_id}') self.execute(f'"{Emulator.single_to_console(exe)}" api -v {instance.MuMuPlayer12_id} launch_player')
elif instance == Emulator.LDPlayerFamily: elif instance == Emulator.LDPlayerFamily:
# ldconsole.exe launch --index 0 # ldconsole.exe launch --index 0
self.execute(f'"{Emulator.single_to_console(exe)}" launch --index {instance.LDPlayer_id}') self.execute(f'"{Emulator.single_to_console(exe)}" launch --index {instance.LDPlayer_id}')
@@ -318,9 +321,12 @@ class PlatformWindows(PlatformBase, EmulatorManager):
return False return False
# Start # Start
if self._emulator_function_wrapper(self._emulator_start): if self._emulator_function_wrapper(self._emulator_start):
# Success if self.emulator_start_watch():
self.emulator_start_watch() # Success
return True return True
else:
# Start command was sent but emulator didn't come online, stop and start again
continue
else: else:
# Failed to start, stop and start again # Failed to start, stop and start again
if self._emulator_function_wrapper(self._emulator_stop): if self._emulator_function_wrapper(self._emulator_stop):