| 1 |
#ifndef _FPCRTL_H_ |
| 2 |
#define _FPCRTL_H_ |
| 3 |
|
| 4 |
#include <stdio.h> |
| 5 |
#include <stdlib.h> |
| 6 |
#include <string.h> |
| 7 |
#include <unistd.h> |
| 8 |
#include <math.h> |
| 9 |
|
| 10 |
#include "SysUtils.h" |
| 11 |
#include "system.h" |
| 12 |
#include "misc.h" |
| 13 |
#include "fileio.h" |
| 14 |
#include "pmath.h" |
| 15 |
|
| 16 |
#define fpcrtl_memcpy memcpy |
| 17 |
|
| 18 |
#define luapas_lua_gettop lua_gettop |
| 19 |
#define luapas_lua_close lua_close |
| 20 |
#define luapas_lua_createtable lua_createtable |
| 21 |
#define luapas_lua_error lua_error |
| 22 |
#define luapas_lua_gc lua_gc |
| 23 |
#define luapas_lua_getfield lua_getfield |
| 24 |
#define luapas_lua_objlen lua_objlen |
| 25 |
#define luapas_lua_call lua_call |
| 26 |
#define luapas_lua_pcall lua_pcall |
| 27 |
#define luapas_lua_pushboolean lua_pushboolean |
| 28 |
#define luapas_lua_pushcclosure lua_pushcclosure |
| 29 |
#define luapas_lua_pushinteger lua_pushinteger |
| 30 |
#define luapas_lua_pushnil lua_pushnil |
| 31 |
#define luapas_lua_pushnumber lua_pushnumber |
| 32 |
#define luapas_lua_pushlstring lua_pushlstring |
| 33 |
#define luapas_lua_pushstring lua_pushstring |
| 34 |
#define luapas_lua_pushvalue lua_pushvalue |
| 35 |
#define luapas_lua_rawgeti lua_rawgeti |
| 36 |
#define luapas_lua_setfield lua_setfield |
| 37 |
#define luapas_lua_settop lua_settop |
| 38 |
#define luapas_lua_toboolean lua_toboolean |
| 39 |
#define luapas_lua_tointeger lua_tointeger |
| 40 |
#define luapas_lua_tolstring lua_tolstring |
| 41 |
#define luapas_lua_tonumber lua_tonumber |
| 42 |
#define luapas_lua_type lua_type |
| 43 |
#define luapas_lua_typename lua_typename |
| 44 |
#define luapas_luaL_argerror luaL_argerror |
| 45 |
#define luapas_luaL_checkinteger luaL_checkinteger |
| 46 |
#define luapas_luaL_checklstring luaL_checklstring |
| 47 |
#define luapas_luaL_loadfile luaL_loadfile |
| 48 |
#define luapas_luaL_loadstring luaL_loadstring |
| 49 |
#define luapas_luaL_newstate luaL_newstate |
| 50 |
#define luapas_luaL_optinteger luaL_optinteger |
| 51 |
#define luapas_luaL_optlstring luaL_optlstring |
| 52 |
#define luapas_luaL_prepbuffer luaL_prepbuffer |
| 53 |
#define luapas_luaL_ref luaL_ref |
| 54 |
#define luapas_luaL_unref luaL_unref |
| 55 |
#define luapas_luaopen_base luaopen_base |
| 56 |
#define luapas_luaopen_math luaopen_math |
| 57 |
#define luapas_luaopen_string luaopen_string |
| 58 |
#define luapas_luaopen_table luaopen_table |
| 59 |
#define luapas_lua_load lua_load |
| 60 |
|
| 61 |
#define sdlh_IMG_Load IMG_Load |
| 62 |
#define sdlh_IMG_Load_RW IMG_Load_RW |
| 63 |
|
| 64 |
#ifndef EMSCRIPTEN |
| 65 |
#define sdlh_Mix_AllocateChannels Mix_AllocateChannels |
| 66 |
#define sdlh_Mix_CloseAudio Mix_CloseAudio |
| 67 |
#define sdlh_Mix_FadeInChannelTimed Mix_FadeInChannelTimed |
| 68 |
#define sdlh_Mix_FadeInMusic Mix_FadeInMusic |
| 69 |
#define sdlh_Mix_FadeOutChannel Mix_FadeOutChannel |
| 70 |
#define sdlh_Mix_FreeChunk Mix_FreeChunk |
| 71 |
#define sdlh_Mix_FreeMusic Mix_FreeMusic |
| 72 |
#define sdlh_Mix_HaltChannel Mix_HaltChannel |
| 73 |
#define sdlh_Mix_HaltMusic Mix_HaltMusic |
| 74 |
#define sdlh_Mix_LoadMUS Mix_LoadMUS |
| 75 |
#define sdlh_Mix_LoadMUS_RW Mix_LoadMUS_RW |
| 76 |
#define sdlh_Mix_LoadWAV_RW Mix_LoadWAV_RW |
| 77 |
#define sdlh_Mix_OpenAudio Mix_OpenAudio |
| 78 |
#define sdlh_Mix_PauseMusic Mix_PauseMusic |
| 79 |
#define sdlh_Mix_PlayChannelTimed Mix_PlayChannelTimed |
| 80 |
#define sdlh_Mix_Playing Mix_Playing |
| 81 |
#define sdlh_Mix_ResumeMusic Mix_ResumeMusic |
| 82 |
#define sdlh_Mix_Volume Mix_Volume |
| 83 |
#define sdlh_Mix_VolumeMusic Mix_VolumeMusic |
| 84 |
#else |
| 85 |
#define sdlh_Mix_AllocateChannels stub_Mix_AllocateChannels |
| 86 |
#define sdlh_Mix_CloseAudio stub_Mix_CloseAudio |
| 87 |
#define sdlh_Mix_FadeInChannelTimed stub_Mix_FadeInChannelTimed |
| 88 |
#define sdlh_Mix_FadeInMusic stub_Mix_FadeInMusic |
| 89 |
#define sdlh_Mix_FadeOutChannel stub_Mix_FadeOutChannel |
| 90 |
#define sdlh_Mix_FreeChunk stub_Mix_FreeChunk |
| 91 |
#define sdlh_Mix_FreeMusic stub_Mix_FreeMusic |
| 92 |
#define sdlh_Mix_HaltChannel stub_Mix_HaltChannel |
| 93 |
#define sdlh_Mix_HaltMusic stub_Mix_HaltMusic |
| 94 |
#define sdlh_Mix_LoadMUS stub_Mix_LoadMUS |
| 95 |
#define sdlh_Mix_LoadMUS_RW stub_Mix_LoadMUS_RW |
| 96 |
#define sdlh_Mix_LoadWAV_RW stub_Mix_LoadWAV_RW |
| 97 |
#define sdlh_Mix_OpenAudio stub_Mix_OpenAudio |
| 98 |
#define sdlh_Mix_PauseMusic stub_Mix_PauseMusic |
| 99 |
#define sdlh_Mix_PlayChannelTimed stub_Mix_PlayChannelTimed |
| 100 |
#define sdlh_Mix_Playing stub_Mix_Playing |
| 101 |
#define sdlh_Mix_ResumeMusic stub_Mix_ResumeMusic |
| 102 |
#define sdlh_Mix_Volume stub_Mix_Volume |
| 103 |
#define sdlh_Mix_VolumeMusic stub_Mix_VolumeMusic |
| 104 |
#endif |
| 105 |
|
| 106 |
#define sdlh_SDL_free SDL_free |
| 107 |
#define sdlh_SDL_ConvertSurface SDL_ConvertSurface |
| 108 |
#define sdlh_SDL_CreateRGBSurface SDL_CreateRGBSurface |
| 109 |
#define sdlh_SDL_CreateThread SDL_CreateThread |
| 110 |
#define sdlh_SDL_Delay SDL_Delay |
| 111 |
#define sdlh_SDL_EnableKeyRepeat SDL_EnableKeyRepeat |
| 112 |
#define sdlh_SDL_EnableUNICODE SDL_EnableUNICODE |
| 113 |
#define sdlh_SDL_FillRect SDL_FillRect |
| 114 |
#define sdlh_SDL_FreeSurface SDL_FreeSurface |
| 115 |
#define sdlh_SDL_GetError SDL_GetError |
| 116 |
#define sdlh_SDL_GetKeyName SDL_GetKeyName |
| 117 |
#define sdlh_SDL_GetKeyboardState SDL_GetKeyboardState |
| 118 |
#define sdlh_SDL_GetMouseState SDL_GetMouseState |
| 119 |
#define sdlh_SDL_GetRGBA SDL_GetRGBA |
| 120 |
#define sdlh_SDL_GetTicks SDL_GetTicks |
| 121 |
#define sdlh_SDL_GL_SetAttribute SDL_GL_SetAttribute |
| 122 |
#define sdlh_SDL_GL_SwapBuffers SDL_GL_SwapBuffers |
| 123 |
#define sdlh_SDL_Init SDL_Init |
| 124 |
#define sdlh_SDL_InitSubSystem SDL_InitSubSystem |
| 125 |
#define sdlh_SDL_JoystickClose SDL_JoystickClose |
| 126 |
#define sdlh_SDL_JoystickEventState SDL_JoystickEventState |
| 127 |
#define sdlh_SDL_JoystickName SDL_JoystickName |
| 128 |
#define sdlh_SDL_JoystickNumAxes SDL_JoystickNumAxes |
| 129 |
#define sdlh_SDL_JoystickNumButtons SDL_JoystickNumButtons |
| 130 |
#define sdlh_SDL_JoystickNumHats SDL_JoystickNumHats |
| 131 |
#define sdlh_SDL_JoystickOpen SDL_JoystickOpen |
| 132 |
#define sdlh_SDL_LockSurface SDL_LockSurface |
| 133 |
#define sdlh_SDL_MapRGB SDL_MapRGB |
| 134 |
#define sdlh_SDL_MapRGBA SDL_MapRGBA |
| 135 |
#define sdlh_SDL_NumJoysticks SDL_NumJoysticks |
| 136 |
#define sdlh_SDL_PeepEvents SDL_PeepEvents |
| 137 |
#define sdlh_SDL_PumpEvents SDL_PumpEvents |
| 138 |
#define sdlh_SDL_Quit SDL_Quit |
| 139 |
#define sdlh_SDL_RWFromFile SDL_RWFromFile |
| 140 |
#define sdlh_SDL_SetColorKey SDL_SetColorKey |
| 141 |
#define sdlh_SDL_SetVideoMode SDL_SetVideoMode |
| 142 |
#define sdlh_SDL_WaitThread SDL_WaitThread |
| 143 |
#define sdlh_SDL_CreateMutex SDL_CreateMutex |
| 144 |
#define sdlh_SDL_DestroyMutex SDL_DestroyMutex |
| 145 |
#define sdlh_SDL_LockMutex SDL_LockMutex |
| 146 |
#define sdlh_SDL_UnlockMutex SDL_UnlockMutex |
| 147 |
#ifndef EMSCRIPTEN |
| 148 |
#define sdlh_SDL_ShowCursor SDL_ShowCursor |
| 149 |
#else |
| 150 |
#define sdlh_SDL_ShowCursor SDL_ShowCursor_patch |
| 151 |
#endif |
| 152 |
#define sdlh_SDL_UnlockSurface SDL_UnlockSurface |
| 153 |
#define sdlh_SDL_UpperBlit SDL_UpperBlit |
| 154 |
#define sdlh_SDL_VideoDriverName SDL_VideoDriverName |
| 155 |
#define sdlh_SDL_WarpMouse SDL_WarpMouse |
| 156 |
#define sdlh_SDL_WM_SetCaption SDL_WM_SetCaption |
| 157 |
#define sdlh_SDL_WM_SetIcon SDL_WM_SetIcon |
| 158 |
#define sdlh_SDLNet_AddSocket SDLNet_AddSocket |
| 159 |
#define sdlh_SDLNet_AllocSocketSet SDLNet_AllocSocketSet |
| 160 |
#define sdlh_SDLNet_CheckSockets SDLNet_CheckSockets |
| 161 |
#define sdlh_SDLNet_FreeSocketSet SDLNet_FreeSocketSet |
| 162 |
#define sdlh_SDLNet_Init SDLNet_Init |
| 163 |
#define sdlh_SDLNet_Quit SDLNet_Quit |
| 164 |
#define sdlh_SDLNet_ResolveHost SDLNet_ResolveHost |
| 165 |
#define sdlh_SDLNet_TCP_Close SDLNet_TCP_Close |
| 166 |
#define sdlh_SDLNet_TCP_Open SDLNet_TCP_Open |
| 167 |
#define sdlh_SDLNet_TCP_Recv SDLNet_TCP_Recv |
| 168 |
#define sdlh_SDLNet_TCP_Send SDLNet_TCP_Send |
| 169 |
#define sdlh_TTF_Init TTF_Init |
| 170 |
#define sdlh_TTF_OpenFont TTF_OpenFont |
| 171 |
#define sdlh_TTF_OpenFontRW TTF_OpenFontRW |
| 172 |
#define sdlh_TTF_Quit TTF_Quit |
| 173 |
#define sdlh_TTF_RenderUTF8_Blended TTF_RenderUTF8_Blended |
| 174 |
#define sdlh_TTF_RenderUTF8_Solid TTF_RenderUTF8_Solid |
| 175 |
#define sdlh_TTF_SetFontStyle TTF_SetFontStyle |
| 176 |
#define sdlh_TTF_SizeUTF8 TTF_SizeUTF8 |
| 177 |
|
| 178 |
#define uphysfslayer_physfsReaderSetBuffer physfsReaderSetBuffer |
| 179 |
#define uphysfslayer_physfsReader physfsReader |
| 180 |
#define uphysfslayer_hedgewarsMountPackage hedgewarsMountPackage |
| 181 |
#define uphysfslayer_hedgewarsMountPackages hedgewarsMountPackages |
| 182 |
|
| 183 |
#define uphysfslayer_PHYSFSRWOPS_openRead PHYSFSRWOPS_openRead |
| 184 |
#define uphysfslayer_PHYSFSRWOPS_openWrite PHYSFSRWOPS_openWrite |
| 185 |
|
| 186 |
#define _strconcat fpcrtl_strconcat |
| 187 |
#define _strappend fpcrtl_strappend |
| 188 |
#define _strprepend fpcrtl_strprepend |
| 189 |
#define _strcompare fpcrtl_strcompare |
| 190 |
#define _strncompare fpcrtl_strncompare |
| 191 |
#define _strcomparec fpcrtl_strcomparec |
| 192 |
#define _chrconcat fpcrtl_chrconcat |
| 193 |
#define _pchar fpcrtl_pchar |
| 194 |
#define _strconcatA fpcrtl_strconcatA |
| 195 |
#define _strncompareA fpcrtl_strncompareA |
| 196 |
#define _strappendA fpcrtl_strappendA |
| 197 |
|
| 198 |
// hooks are implemented in javascript |
| 199 |
void start_hook(void); |
| 200 |
void mainloop_hook(void); |
| 201 |
void clear_filelist_hook(void); |
| 202 |
void add_file_hook(const char* ptr); |
| 203 |
void idb_loader_hook(); |
| 204 |
void showcursor_hook(); |
| 205 |
void hidecursor_hook(); |
| 206 |
void drawworld_init_hook(); |
| 207 |
#endif |