diff --git a/src/addresses.h b/src/addresses.h index c33db9330d..6c614b7070 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -500,21 +500,6 @@ #pragma endregion -static void RCT2_CALLPROC_EBPSAFE(int address) -{ - #ifdef _MSC_VER - __asm push ebp - __asm call address - __asm pop ebp - #else - __asm__ ( "\ - push ebp \n\ - call %[address] \n\ - pop ebp \n\ - " : [address] "+m" (address) ); - #endif -} - /* Returns the flags register * *Flags register is as follows: @@ -569,45 +554,9 @@ static int RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx, #endif } -static void RCT2_CALLPROC_X_EBPSAFE(int address, int _eax, int _ebx, int _ecx, int _edx, int _esi, int _edi, int _ebp) +static int RCT2_CALLPROC_EBPSAFE(int address) { - #ifdef _MSC_VER - __asm { - push ebp - push address - mov eax, _eax - mov ebx, _ebx - mov ecx, _ecx - mov edx, _edx - mov esi, _esi - mov edi, _edi - mov ebp, _ebp - call[esp] - add esp, 4 - pop ebp - } - #else - __asm__ ( "\ - \n\ - push ebx \n\ - push ebp \n\ - push %[address] \n\ - mov eax, %[_eax] \n\ - mov ebx, %[_ebx] \n\ - mov ecx, %[_ecx] \n\ - mov edx, %[_edx] \n\ - mov esi, %[_esi] \n\ - mov edi, %[_edi] \n\ - mov ebp, %[_ebp] \n\ - call [esp] \n\ - add esp, 4 \n\ - pop ebp \n\ - pop ebx \n\ - " : [address] "+m" (address), [_eax] "+m" (_eax), [_ebx] "+m" (_ebx), [_ecx] "+m" (_ecx), [_edx] "+m" (_edx), [_esi] "+m" (_esi), [_edi] "+m" (_edi), [_ebp] "+m" (_ebp) - : - : "eax","ecx","edx","esi","edi" - ); - #endif + return RCT2_CALLPROC_X(address, 0xBBBBBBBB, 0xBBBBBBBB, 0xBBBBBBBB, 0xBBBBBBBB, 0xBBBBBBBB, 0xBBBBBBBB, 0xBBBBBBBB); } /* Returns the flags register diff --git a/src/ride/track.c b/src/ride/track.c index 7124bb6f9a..cc25c648a7 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -412,7 +412,7 @@ rct_track_design *track_get_info(int index, uint8** preview) trackDesign = &RCT2_GLOBAL(0x00F44105, rct_track_design*)[i]; memcpy(trackDesign, (void*)0x009D8178, 163); - RCT2_CALLPROC_EBPSAFE(0x006D1EF0); + RCT2_CALLPROC_X(0x006D1EF0, 0, 0, 0, 0, 0, (int)trackDesign + 163, 0); trackDesign->cost = RCT2_GLOBAL(0x00F4411D, money32); trackDesign->var_06 = RCT2_GLOBAL(0x00F44151, uint8) & 7; diff --git a/src/windows/editor_bottom_toolbar.c b/src/windows/editor_bottom_toolbar.c index 71033da7db..58911a4a1b 100644 --- a/src/windows/editor_bottom_toolbar.c +++ b/src/windows/editor_bottom_toolbar.c @@ -166,8 +166,8 @@ void window_editor_bottom_toolbar_jump_back_to_object_selection() { */ void window_editor_bottom_toolbar_jump_back_to_landscape_editor() { window_close_all(); - RCT2_CALLPROC(0x006DFED0); - RCT2_CALLPROC(0x006DFEE4); + RCT2_CALLPROC_EBPSAFE(0x006DFED0); + RCT2_CALLPROC_EBPSAFE(0x006DFEE4); g_editor_step = EDITOR_STEP_LANDSCAPE_EDITOR; window_map_open(); gfx_invalidate_screen(); diff --git a/src/windows/editor_top_toolbar.c b/src/windows/editor_top_toolbar.c index 936e532458..f525b6a8e2 100644 --- a/src/windows/editor_top_toolbar.c +++ b/src/windows/editor_top_toolbar.c @@ -296,7 +296,7 @@ void window_editor_top_toolbar_dropdown() { if (dropdownIndex == DDIDX_SE_LOAD_LANDSCAPE) { game_do_command(0, 1, 0, 0, GAME_COMMAND_LOAD_OR_QUIT, 0, 0); } else if (dropdownIndex == DDIDX_SE_SAVE_LANDSCAPE) { - RCT2_CALLPROC(0x0066FE2A); + RCT2_CALLPROC_EBPSAFE(0x0066FE2A); } else if (dropdownIndex == DDIDX_SE_ABOUT) { window_about_open(); } else if (dropdownIndex == DDIDX_SE_OPTIONS) { diff --git a/src/windows/guest.c b/src/windows/guest.c index 584f5e87b9..3b082eb783 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -568,7 +568,7 @@ void window_guest_overview_resize(){ window_get_register(w); window_guest_disable_widgets(w); - RCT2_CALLPROC_EBPSAFE(w->event_handlers[WE_INVALIDATE]); + RCT2_CALLPROC_X(w->event_handlers[WE_INVALIDATE], 0, 0, 0, 0, (int)w, 0, 0); widget_invalidate(w, WIDX_MARQUEE); diff --git a/src/windows/track_list.c b/src/windows/track_list.c index 555a263d3d..bc98c2d33e 100644 --- a/src/windows/track_list.c +++ b/src/windows/track_list.c @@ -398,7 +398,7 @@ static void window_track_list_paint() rct_window *w; rct_drawpixelinfo *dpi; rct_widget *widget; - rct_track_design *trackDesign; + rct_track_design *trackDesign = NULL; uint8 *image, *trackDesignList = (uint8*)0x00F441EC; uint16 holes, speed, drops, dropHeight, inversions; fixed32_2dp rating;