mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 01:59:33 +08:00
Merge branch 'master' of https://github.com/MistEO/MeoAssistance-Arknights
This commit is contained in:
@@ -196,6 +196,39 @@ bool Controller::try_capture(const EmulatorInfo& info, bool without_handle)
|
||||
m_emulator_info = info;
|
||||
adb_dir = '"' + utils::string_replace_all(m_emulator_info.adb.path, "[ExecDir]", utils::get_cur_dir()) + '"';
|
||||
}
|
||||
|
||||
// 针对雷电模拟器连接问题的专用补丁
|
||||
if (m_emulator_info.handle.class_name == "LDPlayerMainFrame") {
|
||||
log.trace("LDPlayer Connection Patch Activated.");
|
||||
std::string connect_cmd = utils::string_replace_all("[Adb] devices", "[Adb]", adb_dir);
|
||||
auto devices_result = call_command(connect_cmd);
|
||||
std::string devices_list(
|
||||
std::make_move_iterator(devices_result.begin()),
|
||||
std::make_move_iterator(devices_result.end()));
|
||||
// 查找连接的所有设备
|
||||
std::string device = {};
|
||||
|
||||
if (devices_list.find("emulator") != devices_list.npos) {
|
||||
device = devices_list.substr(devices_list.find("emulator"), 13);
|
||||
m_emulator_info.adb.connect = "";
|
||||
}
|
||||
else if (devices_list.find("127") != devices_list.npos) {
|
||||
device = devices_list.substr(devices_list.find("127"), 14);
|
||||
}
|
||||
|
||||
if (device.empty()) {
|
||||
log.trace("no device detected.");
|
||||
return false;
|
||||
}
|
||||
|
||||
log.trace("device detected: ", device);
|
||||
|
||||
m_emulator_info.adb.connect = utils::string_replace_all(m_emulator_info.adb.connect, "127.0.0.1:5555", device);
|
||||
m_emulator_info.adb.click = utils::string_replace_all(m_emulator_info.adb.click, "-e", "-s " + device);
|
||||
m_emulator_info.adb.swipe = utils::string_replace_all(m_emulator_info.adb.swipe, "-e", "-s " + device);
|
||||
m_emulator_info.adb.display = utils::string_replace_all(m_emulator_info.adb.display, "-e", "-s " + device);
|
||||
m_emulator_info.adb.screencap = utils::string_replace_all(m_emulator_info.adb.screencap, "-e", "-s " + device);
|
||||
}
|
||||
|
||||
// TODO,检查连接是否成功
|
||||
std::string connect_cmd = utils::string_replace_all(m_emulator_info.adb.connect, "[Adb]", adb_dir);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
namespace asst {
|
||||
constexpr static const char* Version = "v1.2-beta";
|
||||
constexpr static const char* Version = "v1.2-beta.2";
|
||||
}
|
||||
@@ -9,7 +9,7 @@ namespace MeoAsstGui
|
||||
public class ViewStatusStorage
|
||||
{
|
||||
private static string _configFilename = System.Environment.CurrentDirectory + "\\gui.json";
|
||||
private static JObject _viewStatus;
|
||||
private static JObject _viewStatus = new JObject();
|
||||
|
||||
public static string Get(string key, string defalut_value)
|
||||
{
|
||||
@@ -36,6 +36,11 @@ namespace MeoAsstGui
|
||||
{
|
||||
string jsonStr = sr.ReadToEnd();
|
||||
_viewStatus = (JObject)JsonConvert.DeserializeObject(jsonStr);
|
||||
// 文件存在但为空,会读出来一个null,感觉c#这库有bug
|
||||
if (_viewStatus == null)
|
||||
{
|
||||
_viewStatus = new JObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
Reference in New Issue
Block a user