1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

Reworked EBPSAFE. Removed EBPSAFE_X. Fixed track list bug #606.

This commit is contained in:
Duncan Frost
2015-01-22 21:01:57 +00:00
parent fddeda3021
commit a57bf368bb
6 changed files with 8 additions and 59 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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;