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