更新模拟器适配

This commit is contained in:
MistEO
2021-07-25 14:41:45 +08:00
parent 415946d8b7
commit 43787aa6d3
5 changed files with 62 additions and 41 deletions

View File

@@ -27,8 +27,8 @@ namespace asst {
Configer& operator=(const Configer& rhs);
Configer& operator=(Configer&& rhs) noexcept;
constexpr static int DefaultWindowWidth = 1271;
constexpr static int DefaultWindowHeight = 716;
constexpr static int DefaultWindowWidth = 1280;
constexpr static int DefaultWindowHeight = 720;
constexpr static double DefaultThreshold = 0.9;
constexpr static double DefaultCacheThreshold = 0.9;

View File

@@ -177,7 +177,7 @@ void Assistance::working_proc(Assistance* pThis)
pThis->stop(false);
continue;
}
if (cur_image.rows < 100) {
if (cur_image.cols < 100) {
DebugTraceInfo("Window Could not be minimized!!!");
pThis->m_pWindow->showWindow();
pThis->m_condvar.wait_for(lock,
@@ -298,7 +298,7 @@ void Assistance::working_proc(Assistance* pThis)
// 单纯为了打印日志。。感觉可以优化下
std::string nexts_str;
for (auto&& name : pThis->m_next_tasks) {
nexts_str += name + ",";
nexts_str += name + " ,";
}
if (nexts_str.back() == ',') {
nexts_str.pop_back();
@@ -319,9 +319,9 @@ void Assistance::working_proc(Assistance* pThis)
std::pair<double, cv::Mat> asst::Assistance::get_format_image()
{
auto && cur_image = m_pView->getImage(m_pView->getWindowRect());
if (cur_image.empty() || cur_image.rows < 100) {
if (cur_image.empty() || cur_image.cols < m_configer.DefaultWindowWidth) {
DebugTraceError("Window image error");
return { 0, cur_image };
return { 0, std::move(cur_image) };
}
// 把模拟器边框的一圈裁剪掉
auto&& window_info = m_pView->getEmulatorInfo();
@@ -332,11 +332,22 @@ std::pair<double, cv::Mat> asst::Assistance::get_format_image()
cv::Mat cropped(cur_image, cv::Rect(x_offset, y_offset, width, height));
// 调整尺寸,与资源中截图的标准尺寸一致
cv::Mat dst;
cv::resize(cropped, dst, cv::Size(m_configer.DefaultWindowWidth, m_configer.DefaultWindowHeight));
#ifdef _DEBUG
cv::imwrite("test.bmp", cur_image);
#endif // _DEBUG
double scale = static_cast<double>(width) / m_configer.DefaultWindowWidth;
//// 调整尺寸,与资源中截图的标准尺寸一致
//cv::Mat dst;
//cv::resize(cropped, dst, cv::Size(m_configer.DefaultWindowWidth, m_configer.DefaultWindowHeight));
double scale_width = static_cast<double>(width) / m_configer.DefaultWindowWidth;
double scale_height = static_cast<double>(height) / m_configer.DefaultWindowHeight;
// 有些模拟器有可收缩的侧边,会增加宽度。
// config.json中设置的是侧边展开后的offset
// 如果用户把侧边收起来了,则有侧边的那头会额外裁剪掉一些,长度偏小
// 所以按这里面长、宽里大的那个算,大的那边没侧边
double scale = std::max(scale_width, scale_height);
return { scale, dst };
return { scale, std::move(cropped) };
}

View File

@@ -313,7 +313,7 @@ bool WinMacro::click(const Rect& rect)
void asst::WinMacro::setControlScale(double scale)
{
if (m_is_adb) {
m_control_scale = scale * scale * Configer::DefaultWindowWidth / m_emulator_info.adb.display_width;
m_control_scale = scale * scale * m_emulator_info.adb.display_width / Configer::DefaultWindowWidth;
}
else {
m_control_scale = scale;

View File

@@ -31,30 +31,33 @@ A game assistance for Arknights
完美兼容,作者绝大部分测试均在蓝叠上进行,稳定性最能保障
#### MuMu模拟器
完美兼容专门单独做了一套基于adb的控制逻辑
#### MuMu手游助手星云引擎
不兼容MuMu不响应SendMessage鼠标消息而且这个版本不支持adb控制正在想办法……
#### 逍遥模拟器
完美兼容
兼容,需要收起右侧侧边栏后使用,未多做测试
#### 雷电模拟器
完美兼容,需要收起右侧侧边栏后使用
兼容,需要收起右侧侧边栏后使用,未多做测试
#### 夜神模拟器
兼容,辅助开始后不可操作模拟器窗口
兼容,效果不太好,且辅助开始后不可移动模拟器窗口,不推荐使用
#### 腾讯手游助手
理论上完美兼容,未多做测试
不兼容,腾讯不支持句柄的窗口尺寸调节
#### MuMu模拟器
#### 其他
MuMu是个奇葩它的所有的窗口句柄均不响应SendMessage鼠标消息
- MuMu模拟器
完美兼容专门单独做了一套基于Adb的控制逻辑
- MuMu手游助手星云引擎
不兼容,正在想办法……
若需要使用其他模拟器、或上述不兼容的模拟器。欢迎给我提[ISSUE](https://github.com/MistEO/MeoAssistance/issues),会根据情况尽量适配~
## 使用说明
@@ -62,14 +65,14 @@ MuMu是个奇葩它的所有的窗口句柄均不响应SendMessage鼠标消
1. 使用支持的模拟器打开明日方舟
2. 解压压缩包,**使用管理员权限**,打开"MeoAsstGui.exe"
3. 注意:运行期间,模拟器窗口可以被遮挡,全屏玩游戏、看视频等,完全不影响,但是模拟器不能最小化
3. 注意:运行期间,模拟器窗口可以被遮挡,全屏玩游戏、看视频等,完全不影响,但是模拟器不能最小化
### 刷理智
1. 明日方舟打开**蓝色开始按钮**的界面
1. 根据你的需要勾选"吃理智药"和"吃石头"
2. 点击"开始刷理智"
3. 刷完了会自动停止的
2. 根据你的需要勾选"吃理智药"和"吃石头"
3. 点击"开始刷理智",开始后上面的选项也可以随时修改
4. 刷完了会自动停止的
### 访问好友基建

View File

@@ -44,8 +44,8 @@
"window": "BlueStacks Android PluginAndroid"
}
],
"width": 1294,
"height": 773,
"width": 1302,
"height": 776,
"xOffset": 11,
"yOffset": 46,
"rightOffset": 11,
@@ -70,10 +70,13 @@
"window": "夜神模拟器"
}
],
"width": 1298,
"height": 754,
"xOffset": 0,
"yOffset": 32
"width": 1321,
"height": 768,
"xOffset": 2,
"yOffset": 39,
"rightOffset": 39,
"bottomOffset": 9
},
"LDPlayer": {
"window": [
@@ -98,8 +101,8 @@
"window": "TheRender"
}
],
"width": 1304,
"height": 756,
"width": 1280,
"height": 755,
"xOffset": 0,
"yOffset": 35
},
@@ -128,8 +131,10 @@
],
"width": 1282,
"height": 769,
"xOffset": 0,
"yOffset": 47
"xOffset": 1,
"yOffset": 48,
"rightOffset": 1,
"bottomOffset": 1
},
"Tencent": {
"window": [
@@ -156,7 +161,7 @@
],
"width": 1282,
"height": 769,
"xOffset": 0,
"xOffset": 1,
"yOffset": 42
},
"MuMuAsst": {
@@ -178,10 +183,12 @@
"window": "明日方舟 - 星云引擎"
}
],
"adbControl": {
"adb": {
"path": "[EmulatorPath]..\\vmonitor\\bin\\adb_server.exe",
"connect": " connect 127.0.0.1:7555",
"click": " shell input tap [x] [y]"
"click": " shell input tap [x] [y]",
"display": " shell dumpsys window displays | grep init= | awk ' { print $3 } '",
"displayRegex": "cur=%dx%d"
},
"width": 1280,
"height": 809,
@@ -218,7 +225,7 @@
"height": 809,
"xOffset": 0,
"yOffset": 36,
"rightBottom": 0,
"rightOffset": 0,
"bottomOffset": 53
}
},