1 (* Copyright (C) Doom 2D: Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, version 3 of the License ONLY.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 {$INCLUDE ../shared/a_modes.inc}
16 {$IFDEF ANDROID}library{$ELSE}program{$ENDIF} Doom2DF;
32 mempool in '../shared/mempool.pas',
33 conbuf in '../shared/conbuf.pas',
34 geom in '../shared/geom.pas',
37 {$INCLUDE ../nogl/noGLuses.inc}
39 {$IFDEF USE_MINIUPNPC}
40 miniupnpc in '../lib/miniupnpc/miniupnpc.pas',
47 SDL2 in '../lib/sdl2/sdl2.pas',
49 SDL2_mixer in '../lib/sdl2/SDL2_mixer.pas',
54 AL in '../lib/openal/al.pas',
55 e_soundfile in '../engine/e_soundfile.pas',
56 {$IF DEFINED(USE_SDL) OR DEFINED(USE_SDL2)}
57 e_soundfile_wav in '../engine/e_soundfile_wav.pas',
60 vorbis in '../lib/vorbis/vorbis.pas',
61 e_soundfile_vorbis in '../engine/e_soundfile_vorbis.pas',
63 {$IFDEF USE_FLUIDSYNTH}
64 fluidsynth in '../lib/fluidsynth/fluidsynth.pas',
65 e_soundfile_fluid in '../engine/e_soundfile_fluid.pas',
68 modplug in '../lib/modplug/modplug.pas',
69 e_soundfile_modplug in '../engine/e_soundfile_modplug.pas',
72 xmp in '../lib/xmp/xmp.pas',
73 e_soundfile_xmp in '../engine/e_soundfile_xmp.pas',
76 mpg123 in '../lib/mpg123/mpg123.pas',
77 e_soundfile_mp3 in '../engine/e_soundfile_mp3.pas',
80 opus in '../lib/opus/opus.pas',
81 e_soundfile_opus in '../engine/e_soundfile_opus.pas',
83 {$IF DEFINED(USE_VORBIS) OR DEFINED(USE_OPUS)}
84 ogg in '../lib/vorbis/ogg.pas', // this has to come last because link order
88 ENet in '../lib/enet/enet.pp',
89 e_graphics in '../engine/e_graphics.pas',
90 e_input in '../engine/e_input.pas',
91 e_log in '../engine/e_log.pas',
92 e_sound in '../engine/e_sound.pas',
93 e_texture in '../engine/e_texture.pas',
94 e_msg in '../engine/e_msg.pas',
95 utils in '../shared/utils.pas',
96 xstreams in '../shared/xstreams.pas',
97 sfs in '../sfs/sfs.pas',
98 sfsPlainFS in '../sfs/sfsPlainFS.pas',
99 sfsZipFS in '../sfs/sfsZipFS.pas',
100 wadreader in '../shared/wadreader.pas',
101 MAPDEF in '../shared/MAPDEF.pas',
102 CONFIG in '../shared/CONFIG.pas',
103 g_basic in 'g_basic.pas',
104 g_console in 'g_console.pas',
105 g_net in 'g_net.pas',
106 g_netmsg in 'g_netmsg.pas',
107 g_nethandler in 'g_nethandler.pas',
108 g_netmaster in 'g_netmaster.pas',
109 g_res_downloader in 'g_res_downloader.pas',
110 g_grid in 'g_grid.pas',
111 g_game in 'g_game.pas',
112 g_gfx in 'g_gfx.pas',
113 g_gui in 'g_gui.pas',
114 g_items in 'g_items.pas',
115 g_main in 'g_main.pas',
116 g_map in 'g_map.pas',
117 g_menu in 'g_menu.pas',
118 g_monsters in 'g_monsters.pas',
119 g_options in 'g_options.pas',
120 g_phys in 'g_phys.pas',
121 g_player in 'g_player.pas',
122 g_playermodel in 'g_playermodel.pas',
123 g_saveload in 'g_saveload.pas',
124 g_sound in 'g_sound.pas',
125 g_textures in 'g_textures.pas',
126 g_triggers in 'g_triggers.pas',
127 g_weapons in 'g_weapons.pas',
128 g_window in 'g_window.pas',
130 g_system in 'stub/g_system.pas',
131 g_touch in 'stub/g_touch.pas',
134 g_system in 'sdl/g_system.pas',
135 g_touch in 'sdl/g_touch.pas',
138 g_system in 'sdl2/g_system.pas',
139 g_touch in 'sdl2/g_touch.pas',
144 fmod in '../lib/FMOD/fmod.pas',
145 fmoderrors in '../lib/FMOD/fmoderrors.pas',
146 fmodpresets in '../lib/FMOD/fmodpresets.pas',
147 fmodtypes in '../lib/FMOD/fmodtypes.pas',
149 xprofiler in '../shared/xprofiler.pas',
150 binheap in '../shared/binheap.pas',
151 hashtable in '../shared/hashtable.pas',
152 fhashdb in '../shared/fhashdb.pas',
153 idpool in '../shared/idpool.pas',
154 xparser in '../shared/xparser.pas',
155 xdynrec in '../shared/xdynrec.pas',
156 exoma in '../shared/exoma.pas',
157 envvars in '../shared/envvars.pas',
158 g_panel in 'g_panel.pas',
159 g_language in 'g_language.pas',
161 {$IFDEF ENABLE_HOLMES}
162 g_holmes in 'g_holmes.pas',
164 sdlcarcass in '../flexui/sdlcarcass.pas',
165 //sdlstandalone in '../flexui/sdlstandalone.pas',
167 fui_wadread in '../flexui/fui_wadread.pas',
168 fui_common in '../flexui/fui_common.pas',
169 fui_gfx_gl in '../flexui/fui_gfx_gl.pas',
170 fui_events in '../flexui/fui_events.pas',
171 fui_style in '../flexui/fui_style.pas',
172 fui_flexlay in '../flexui/fui_flexlay.pas',
173 fui_ctls in '../flexui/fui_ctls.pas',
185 function SDL_main(argc: CInt; argv: PPChar): CInt; cdecl;
190 noct: Boolean = false;
196 SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); //k8: fuck off, that's why
200 e_SetSafeSlowLog(true);
201 if SDL_AndroidGetExternalStorageState() <> 0 then
203 storage := SDL_AndroidGetExternalStoragePath();
205 e_WriteLog('Use external storage: ' + storage, TMsgType.Notify)
209 storage := SDL_AndroidGetInternalStoragePath();
211 e_WriteLog('Use internal storage: ' + storage, TMsgType.Notify)
213 if IOresult <> 0 then
215 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, PChar('Invalid path'), PChar('Can''t chdir to ' + storage), nil);
219 SetEnvVar('TIMIDITY_CFG', 'timidity.cfg');
223 while f <= ParamCount do
226 '--gdb': noct := true;
227 '--log': conbufDumpToStdOut := true;
228 '--safe-log': e_SetSafeSlowLog(true);
230 if f + 1 <= ParamCount then
233 LogFileName := ParamStr(f)
239 if LogFileName = '' then
242 LogFileName := 'Doom2DF_H.log';
244 LogFileName := 'Doom2DF.log';
256 e_WriteLog('Shutdown with no errors.', TMsgType.Notify);
260 e_WriteStackTrace(e.message);
261 //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_MSG], [E.Message]), MSG_FATALERROR);
263 AssignFile(tfo, GameDir+'/trace.log');
266 if (IOResult <> 0) then Rewrite(tfo);
267 if (IOResult = 0) then begin writeln(tfo, '====================='); DumpExceptionBackTrace(tfo); CloseFile(tfo); end;
272 //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_UNKNOWN], [NativeUInt(ExceptAddr())]), MSG_FATALERROR);
273 e_WriteStackTrace('FATAL ERROR');