OpenRCT2/src/addresses.h

109 lines
4.5 KiB
C
Raw Normal View History

/*****************************************************************************
* Copyright (c) 2014 Ted John
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#ifndef _ADDRESSES_H_
#define _ADDRESSES_H_
#pragma warning(disable : 4731)
#define RCT2_ADDRESS(address, type) ((type*)address)
#define RCT2_GLOBAL(address, type) (*((type*)address))
#define RCT2_CALLPROC(address) (((void(*)())address)())
#define RCT2_CALLFUNC(address, returnType) (((returnType(*)())address)())
2014-04-02 17:46:58 +02:00
#define RCT2_CALLFUNC_1(address, returnType, a1, v1) (((returnType(*)(a1))address)(v1))
#define RCT2_CALLFUNC_2(address, returnType, a1, a2, v1, v2) (((returnType(*)(a1, a2))address)(v1, v2))
#define RCT2_CALLFUNC_3(address, returnType, a1, a2, a3, v1, v2, v3) (((returnType(*)(a1, a2, a3))address)(v1, v2, v3))
#define RCT2_CALLFUNC_4(address, returnType, a1, a2, a3, a4, v1, v2, v3, v4) (((returnType(*)(a1, a2, a3, a4))address)(v1, v2, v3, v4))
#define RCT2_CALLFUNC_5(address, returnType, a1, a2, a3, a4, a5, v1, v2, v3, v4, v5) (((returnType(*)(a1, a2, a3, a4, a5))address)(v1, v2, v3, v4, v5))
#define RCT2_CALLPROC_1(address, a1, v1) RCT2_CALLFUNC_1(address, void, a1, v1)
#define RCT2_CALLPROC_2(address, a1, a2, v1, v2) RCT2_CALLFUNC_2(address, void, a1, a2, v1, v2)
#define RCT2_CALLPROC_3(address, a1, a2, a3, v1, v2, v3) RCT2_CALLFUNC_3(address, void, a1, a2, a3, v1, v2, v3)
#define RCT2_CALLPROC_4(address, a1, a2, a3, a4, v1, v2, v3, v4) RCT2_CALLFUNC_4(address, void, a1, a2, a3, a4, v1, v2, v3, v4)
#define RCT2_CALLPROC_5(address, a1, a2, a3, a4, a5, v1, v2, v3, v4, v5) RCT2_CALLFUNC_4(address, void, a1, a2, a3, a4, a5, v1, v2, v3, v4, v5)
#define RCT2_ADDRESS_CMDLINE 0x009E2D98
#define RCT2_ADDRESS_APP_PATH 0x009AA214
#define RCT2_ADDRESS_APP_PATH_SLASH 0x009AB4D9
#define RCT2_ADDRESS_SAVED_GAMES_PATH 0x009AB5DA
#define RCT2_ADDRESS_SCENARIOS_PATH 0x009AB6E9
#define RCT2_ADDRESS_LANDSCAPES_PATH 0x009AB7FB
#define RCT2_ADDRESS_OBJECT_DATA_PATH 0x009AB90E
#define RCT2_ADDRESS_TRACKS_PATH 0x009ABA1E
#define RCT2_ADDRESS_SAVED_GAMES_PATH_2 0x009ABB37
#define RCT2_ADDRESS_SCREEN_DPI 0x009ABDC8
#define RCT2_ADDRESS_SCREEN_WIDTH 0x009ABDD8
#define RCT2_ADDRESS_SCREEN_HEIGHT 0x009ABDDA
#define RCT2_ADDRESS_RUN_INTRO_TICK_PART 0x009AC319
#define RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS 0x009DE533
#define RCT2_ADDRESS_TOOLTIP_WINDOW_NUMBER 0x009DE534
#define RCT2_ADDRESS_TOOLTIP_WIDGET_INDEX 0x009DE536
#define RCT2_ADDRESS_TOOLTIP_CURSOR_X 0x009DE538
#define RCT2_ADDRESS_TOOLTIP_CURSOR_Y 0x009DE53A
#define RCT2_ADDRESS_TOOLTIP_TIMEOUT 0x009DE53C
#define RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS 0x009DE53E
#define RCT2_ADDRESS_SCREEN_FLAGS 0x009DEA68
#define RCT2_ADDRESS_PLACE_OBJECT_MODIFIER 0x009DEA70
#define RCT2_ADDRESS_ON_TUTORIAL 0x009DEA71
2014-04-03 01:22:33 +02:00
#define RCT2_ADDRESS_SPRITE_LIST 0x010E63BC
#define RCT2_ADDRESS_SPRITES_NEXT_INDEX 0x013573BC
#define RCT2_ADDRESS_SPRITES_START_VEHICLE 0x013573BE
#define RCT2_ADDRESS_SPRITES_START_PEEP 0x013573C0
#define RCT2_ADDRESS_SPRITES_START_TEXTFX 0x013573C2
#define RCT2_ADDRESS_SPRITES_START_LITTER 0x013573C4
#define RCT2_ADDRESS_WINDOW_LIST 0x01420078
#define RCT2_ADDRESS_NEW_WINDOW_PTR 0x014234B8
#define RCT2_ADDRESS_VIEWPORT_LIST 0x014234BC
#define RCT2_ADDRESS_NEW_VIEWPORT_PTR 0x01423570
#define RCT2_ADDRESS_OS_TOTALPHYS 0x01423B5C
static void RCT2_CALLPROC_EBPSAFE(int address)
{
__asm push ebp
__asm call address
__asm pop ebp
}
static void RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx, int _esi, int _edi, int _ebp)
{
__asm {
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
}
}
#endif