@@ -21,7 +21,8 @@ namespace args_info {
21
21
HWND ghost_hwnd=NULL ;
22
22
wstring command;
23
23
wstring sakurascript;
24
- }
24
+ } // namespace args_info
25
+ wstring ghost_uid;
25
26
26
27
wstring&do_transfer (wstring &a) {
27
28
replace_all (a, L" \\ n" , L" \n " );
@@ -64,15 +65,21 @@ void terminal_login(){
64
65
else if (!ghost_link_to.empty ()) {
65
66
for (auto & i : fmobj.info_map ) {
66
67
HWND tmp_hwnd = (HWND)wcstoll (i.second [L" hwnd" ].c_str (), nullptr , 10 );
67
- if (i.second [L" name" ] == ghost_link_to || i.second [L" fullname" ] == ghost_link_to)
68
+ if (i.second [L" name" ] == ghost_link_to || i.second [L" fullname" ] == ghost_link_to) {
68
69
ghost_hwnd = tmp_hwnd;
70
+ ghost_uid = i.first ;
71
+ break ;
72
+ }
69
73
else {
70
74
linker.link_to_ghost (tmp_hwnd);
71
75
auto names = linker.NOTYFY ({ { L" Event" , L" ShioriEcho.GetName" },
72
76
{ L" Reference0" , to_wstring (GT_VAR) } });
73
77
74
- if (names[L" GhostName" ] == ghost_link_to)
78
+ if (names[L" GhostName" ] == ghost_link_to) {
75
79
ghost_hwnd = tmp_hwnd;
80
+ ghost_uid = i.first ;
81
+ break ;
82
+ }
76
83
else
77
84
linker.link_to_ghost (NULL );
78
85
}
@@ -144,6 +151,15 @@ void terminal_login(){
144
151
exit (1 );
145
152
}
146
153
}
154
+ if (ghost_uid.empty ()) {
155
+ for (auto & i: fmobj.info_map ) {
156
+ HWND tmp_hwnd = (HWND)wcstoll (i.second [L" hwnd" ].c_str (), nullptr , 10 );
157
+ if (ghost_hwnd == tmp_hwnd) {
158
+ ghost_uid = i.first ;
159
+ break ;
160
+ }
161
+ }
162
+ }
147
163
}
148
164
else {
149
165
wcerr << " Can\' t read FMO info, trying to use socket...\n " ;
@@ -170,7 +186,7 @@ void terminal_login(){
170
186
need_end = 1 ;
171
187
}
172
188
if (!sakurascript.empty ()){
173
- linker.SEND ({ { L" Script" ,sakurascript } });
189
+ linker.SEND ({{ L" ID " , ghost_uid}, { L" Script" , sakurascript} });
174
190
need_end = 1 ;
175
191
}
176
192
0 commit comments