-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
168 lines (137 loc) · 5.06 KB
/
main.cpp
File metadata and controls
168 lines (137 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#include <global.hpp>
#include <emulator.hpp>
#include <App.PCR.hpp>
using namespace std;
void init() {
//system("cls");
//system("chcp 65001");
RECT rect;
GetWindowRect(GetDesktopWindow(), &rect);
ui_width = (rect.right - rect.left);
ui_height = (rect.bottom - rect.top);
SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
dv_width = GetDeviceCaps(GetDC(nullptr), DESKTOPHORZRES);
dv_height = GetDeviceCaps(GetDC(nullptr), DESKTOPVERTRES);
ui_scale = (float) dv_width / (float) ui_width;
system_dpi = GetDpiForSystem();
Logger.info("初始化 版本 1.0.3");
Logger.info(fformat(
"分辨率 逻辑[{0}x{1}] 物理[{2}x{3}] 缩放[{4:d}%] DPI感知[{5}:{6}]",
ui_width, ui_height,
dv_width, dv_height,
(uint8_t) (ui_scale * 100),
system_dpi, (system_dpi > 96 ? "HIDPI" : "NORMAL")
));
platform::InitFliter();
}
int main(int argc, char *argv[]) {
init();
Logger.trace(fformat("main start"));
platform::MuList.update();
// platform::MuList.print();
cv_width = 1280;
cv_height = 720;
vm_width = 1920;
vm_height = 1080;
cv_scale = (f32) vm_height / (f32) cv_height;
AppPCR::MAIN(argc, argv);
// platform::TypeMEMU memu("127.0.0.1:21503", "VM", "/dev/input/event6", {1278, 718});
// chrono::time_point<chrono::steady_clock> start;
// const templ::TL A("PCR1280720", "00登录01点击屏幕.png", "登录:点击屏幕",
// ROI_FULL, FB_NONE);
//
// const templ::TL B("PCR1280720", "11战斗01下一关.png", "战斗:下一关",
// {200, 200, 400, 300, ROI_FULL_BIT}, FB_SELF);
//
// const templ::TL C("PCR1280720", "04导航01主页.png", "导航:主页",
// {11, 22, 33, 44, ROI_FULL_BIT}, templ::FBfrom(fromBR, -100, -100, 20, 20));
// const templ::TL D("PCR1280720", "05商店10批量选框.png", "商店:批量选框",
// ROI_FULL, FB_SELF);
//
//memu.SetWindow();
//memu.InputClick({100, 100}, 1000);
// for (int i = 0; i < 5; i++) {
// memu.CaptureRender();
// basic::click(memu, {D}, 0.9,
// {1, true, 1, 10, 50});
// }
//
// while (false) {
// auto a = memu.CaptureRender();
// cv::imshow("memu", a);
// cv::waitKey(1);
// //match::mask(vm, B, 0.95, MT_RET_XYCENTER | MT_DEBUG_SHOWPT);
// //match::rect_multi(vm, D, 0.85, MT_RET_XYCENTER | MT_DEBUG_SHOWPT);
// //basic::disappear(memu, {D}, 0.9, 5000);
// //basic::visible(memu, {D}, 0.9, 5000);
// //basic::exist(memu, {D}, 0.9);
// //break;
// }
// const templ::TL *E;
// map<string, const templ::TL *> pcr;
//
// E = new templ::TL("PCR1280720", "05商店10批量选框.png", "DBG:DEBUG0", ROI_FULL, FB_SELF);
// pcr.insert(pair<string, const templ::TL *>(E->text, E));
// E = new templ::TL("PCR1280720", "04导航01主页.png", "DBG:DEBUG1", ROI_FULL, FB_SELF);
// pcr.insert(pair<string, const templ::TL *>(E->text, E));
// E = new templ::TL("PCR1280720", "00登录01点击屏幕.png", "DBG:DEBUG2", ROI_FULL, FB_SELF);
// pcr.insert(pair<string, const templ::TL *>(E->text, E));
// E = new templ::TL("PCR1280720", "11战斗01下一关.png", "DBG:DEBUG3", ROI_FULL, FB_SELF);
// pcr.insert(pair<string, const templ::TL *>(E->text, E));
// const flag::FLAG F0(1, 16, "AppPCR");
// const flag::FLAG F1(2, 16, "登录");
// const flag::FLAG F2(3, 16, "主界面");
//
// auto t = templ::GetFBrect({100,100,200,200});
// if(t.isNull()){
// cout << fformat("{0} empty",t) <<endl;
// }else{
// cout << fformat("{0}",t) <<endl;
// }
// memu.InputClick(100,100,utime::ms,500);
// sleep_ms(50);
// memu.InputSlide(500, 500, 100, 100, 200);
// while(true){
// start = clock_now;
// cv::Mat a = memu.CaptureRender();
// cv::imshow("aaaa",a);
// //Logger.trace(fformat("CaptureRender finish {0} ms",difftime_ms(clock_now - start).count()));
// cv::waitKey(1);
// }
// vector<float> zero{0, 0, 0, 0, 0, 0, 0, 0, 0};
// vector<float> temp{0, 0, 0, 0, 0, 0, 0, 0, 0};
// for (int i = 0; i < 1000; i++) {
// float f = random::int_cauchy(0, 0);
// if (f >= 0 && f <= 0.1) temp[0] += 1;
// else if (f > 0.1 && f <= 0.2) temp[1] += 1;
// else if (f > 0.2 && f <= 0.3) temp[2] += 1;
// else if (f > 0.3 && f <= 0.5) temp[3] += 1;
// else if (f > 0.5 && f <= 0.6) temp[4] += 1;
// else if (f > 0.6 && f <= 0.7) temp[5] += 1;
// else if (f > 0.7 && f <= 0.8) temp[6] += 1;
// else if (f > 0.8 && f <= 0.9) temp[7] += 1;
// else if (f > 0.9 && f <= 1.0) temp[8] += 1;
//
// else if (f < 0.0 && f >= -0.1) zero[8] += 1;
// else if (f < -0.1 && f >= -0.2) zero[7] += 1;
// else if (f < -0.2 && f >= -0.3) zero[6] += 1;
// else if (f < -0.3 && f >= -0.5) zero[5] += 1;
// else if (f < -0.5 && f >= -0.6) zero[4] += 1;
// else if (f < -0.6 && f >= -0.7) zero[3] += 1;
// else if (f < -0.7 && f >= -0.8) zero[2] += 1;
// else if (f < -0.8 && f >= -0.9) zero[1] += 1;
// else if (f < -0.9 && f >= -1.0) zero[0] += 1;
// }
// cout << fformat("{1} {0}", temp, zero) << endl;
Logger.trace(fformat("main return"));
// Logger.debug(fformat("{0} -> {1}", "日志等级", "debug"));
//
// Logger.info("info 信息");
// Logger.warn("warn 信息");
// Logger.error("error 信息");
// Logger.critical("critical 信息");
// Logger.fatal("fatal 信息");
// while(true);
return 0;
}