From e1cc30b9dbf0f138b976fc5e89cfc6ac8d3e6977 Mon Sep 17 00:00:00 2001 From: uye <99072975+ABA2396@users.noreply.github.com> Date: Tue, 12 Aug 2025 21:53:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20mumu=205555=20?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E4=BD=BF=E7=94=A8=E6=8E=A7=E5=88=B6=E5=8F=B0?= =?UTF-8?q?=E9=80=80=E5=87=BA=E4=B8=8E=E6=88=AA=E5=9B=BE=E5=A2=9E=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Controller/AdbController.cpp | 7 ++++++- src/MaaWpfGui/Helper/EmulatorHelper.cs | 13 ++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/MaaCore/Controller/AdbController.cpp b/src/MaaCore/Controller/AdbController.cpp index dcbd9b236d..df130c0633 100644 --- a/src/MaaCore/Controller/AdbController.cpp +++ b/src/MaaCore/Controller/AdbController.cpp @@ -211,7 +211,12 @@ int asst::AdbController::get_mumu_index(const std::string& address) return 0; } int port = std::stoi(port_str); - int mumu_index = (port - 16384) / 32; // must be int + int mumu_index = 0; + if (port >= 16384) { + mumu_index = (port - 16384) / 32; + } else if (port >= 5555) { + mumu_index = (port - 5555) / 2; + } LogInfo << VAR(port_str) << VAR(port) << VAR(mumu_index); return mumu_index; } diff --git a/src/MaaWpfGui/Helper/EmulatorHelper.cs b/src/MaaWpfGui/Helper/EmulatorHelper.cs index 0ed7593e31..db534b88d6 100644 --- a/src/MaaWpfGui/Helper/EmulatorHelper.cs +++ b/src/MaaWpfGui/Helper/EmulatorHelper.cs @@ -81,7 +81,18 @@ public class EmulatorHelper string portStr = address.Split(':')[1]; if (int.TryParse(portStr, out int port)) { - emuIndex = (port - 16384) / 32; + switch (port) + { + case >= 16384: + emuIndex = (port - 16384) / 32; + break; + case >= 5555: + emuIndex = (port - 5555) / 2; + break; + default: + _logger.Error("Port {Port} is not valid for MuMuEmulator12", port); + return false; + } } else {