Re-fixed commit e62b5c0 (correct variant)

This commit is contained in:
NovaRain
2019-11-26 07:49:31 +08:00
parent e01569637d
commit 29f0affd72
3 changed files with 19 additions and 11 deletions
+15
View File
@@ -881,6 +881,21 @@ long GetScriptLocalVars(long sid) {
return (script) ? script->num_local_vars : 0;
}
// Returns window ID by x/y coordinate (hidden windows are ignored)
long __fastcall GetTopWindowID(long xPos, long yPos) {
WINinfo* win = nullptr;
long countWin = *(DWORD*)_num_windows - 1;
for (int n = countWin; n >= 0; n--) {
win = (WINinfo*)ptr_window[n];
if (xPos >= win->wRect.left && xPos <= win->wRect.right && yPos >= win->wRect.top && yPos <= win->wRect.bottom) {
if (!(win->flags & WIN_Hidden)) {
break;
}
}
}
return win->wID;
}
void __fastcall RegisterObjectCall(long* target, long* source, void* func, long delay) {
__asm {
mov eax, ecx;
+2
View File
@@ -1045,6 +1045,8 @@ long __stdcall ScrPtr(long scriptId, TScript** scriptPtr);
// Returns the number of local variables of the object script
long GetScriptLocalVars(long sid);
long __fastcall GetTopWindowID(long xPos, long yPos);
void __fastcall RegisterObjectCall(long* target, long* source, void* func, long delay);
long __fastcall ScrGetLocalVar(long sid, long varId, long* value);
+2 -11
View File
@@ -228,17 +228,8 @@ static long __stdcall gmouse_handle_event_hook() {
static void __declspec(naked) gmouse_bk_process_hook() {
__asm {
call win_get_top_win_;
cmp eax, ds:[_display_win];
jnz checkFlag;
retn;
checkFlag:
call GNW_find_;
test [eax + 4], WIN_Hidden; // window flags
jz skip;
mov eax, ds:[_display_win]; // window is hidden, so return the number of the display_win
skip:
retn;
mov ecx, eax;
jmp GetTopWindowID;
}
}