mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 04:53:12 +01:00
Add structs/addresses for mouse buffer functions
This commit is contained in:
27
src/input.c
27
src/input.c
@@ -43,7 +43,7 @@ static void input_mouseover_widget_flatbutton_invalidate();
|
||||
void process_mouse_over(int x, int y);
|
||||
void sub_6ED801(int x, int y);
|
||||
void invalidate_scroll();
|
||||
static void* sub_407074();
|
||||
static openrct2_mouse_data* get_mouse_input();
|
||||
|
||||
#pragma region Scroll bar input
|
||||
|
||||
@@ -1558,7 +1558,7 @@ void game_handle_input()
|
||||
*/
|
||||
static void game_get_next_input(int *x, int *y, int *state)
|
||||
{
|
||||
void* eax = sub_407074(); //RCT2_CALLFUNC_X(0x00407074, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
openrct2_mouse_data* eax = get_mouse_input();
|
||||
if (eax == NULL) {
|
||||
*x = gCursorState.x;
|
||||
*y = gCursorState.y;
|
||||
@@ -1566,9 +1566,9 @@ static void game_get_next_input(int *x, int *y, int *state)
|
||||
return;
|
||||
}
|
||||
|
||||
*x = RCT2_GLOBAL(eax + 0, sint32);
|
||||
*y = RCT2_GLOBAL(eax + 4, sint32);
|
||||
*state = RCT2_GLOBAL(eax + 8, sint32);
|
||||
*x = eax->x;
|
||||
*y = eax->y;
|
||||
*state = eax->state;
|
||||
|
||||
//int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
//RCT2_CALLFUNC_X(0x006E83C7, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
@@ -1764,16 +1764,15 @@ void invalidate_scroll()
|
||||
window_invalidate_by_id(RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, uint8), RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, uint16));
|
||||
}
|
||||
|
||||
static void* sub_407074()
|
||||
/**
|
||||
* rct2: 0x00407074
|
||||
*/
|
||||
static openrct2_mouse_data* get_mouse_input()
|
||||
{
|
||||
int ecx = RCT2_GLOBAL(0x009E2DE8, uint32);
|
||||
if (ecx != RCT2_GLOBAL(0x009E2DE4, uint32)) {
|
||||
int eax = ecx + ecx*2;
|
||||
ecx++;
|
||||
ecx &= 0x3F;
|
||||
eax = 0x1424340 + eax*4;
|
||||
RCT2_GLOBAL(0x009E2DE8, uint32) = ecx;
|
||||
return (void*)eax;
|
||||
int read_index = RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_READ_INDEX, uint32);
|
||||
if (read_index != RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_WRITE_INDEX, uint32)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_READ_INDEX, uint32) = (read_index + 1) & 0x3F;
|
||||
return &mouse_buffer[read_index];
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user