DEADSOFTWARE

added libsocket and updated watt32, but network still not work
[d2df-sdl.git] / src / game / Doom2DF.lpr
1 (* Copyright (C) Doom 2D: Forever Developers
2 *
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, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *)
16 {$INCLUDE ../shared/a_modes.inc}
17 {$IFDEF ANDROID}library{$ELSE}program{$ENDIF} Doom2DF;
18 {$IFNDEF HEADLESS}
19 {$IFDEF WINDOWS}
20 {$APPTYPE GUI}
21 {$ENDIF}
22 {$ENDIF}
23 {$HINTS OFF}
25 {$IFDEF USE_SDLMIXER}
26 {$IFDEF USE_FMOD}
27 {$ERROR define only one of USE_SDLMIXER or USE_FMOD}
28 {$ENDIF}
29 {$ELSE}
30 {$UNDEF USE_SDLMIXER}
31 {$DEFINE USE_FMOD}
32 {$ENDIF}
34 uses
35 {$IFDEF ANDROID}
36 ctypes,
37 {$ENDIF}
38 {$IFDEF UNIX}
39 cthreads,
40 {$ENDIF}
41 mempool in '../shared/mempool.pas',
42 conbuf in '../shared/conbuf.pas',
43 geom in '../shared/geom.pas',
44 math,
46 {$INCLUDE ../nogl/noGLuses.inc}
48 {$IFDEF USE_MINIUPNPC}
49 miniupnpc in '../lib/miniupnpc/miniupnpc.pas',
50 {$ENDIF}
51 {$IF DEFINED(USE_SDL2STUB) OR DEFINED(USE_SDL2ALLEGRO)}
52 SDL2 in '../wrappers/sdl2/sdl2.pas',
53 {$IFDEF USE_SDLMIXER}
54 SDL2_mixer in '../wrappers/sdl2/SDL2_mixer.pas',
55 {$ENDIF}
56 {$ELSE}
57 SDL2 in '../lib/sdl2/sdl2.pas',
58 {$IFDEF USE_SDLMIXER}
59 SDL2_mixer in '../lib/sdl2/SDL2_mixer.pas',
60 {$ENDIF}
61 {$ENDIF}
62 {$IFDEF USE_ENETWRAP}
63 ENet in '../wrappers/enet/enet.pas',
64 {$ELSE}
65 ENet in '../lib/enet/enet.pp',
66 {$IFDEF USE_WATT32}
67 Watt32 in '../lib/watt32/watt32.pp',
68 {$ENDIF}
69 {$IFDEF USE_LIBSOCKET}
70 Socket in '../lib/socket/socket.pas',
71 {$ENDIF}
72 {$ENDIF}
73 {$IFDEF USE_SDL2ALLEGRO}
74 Allegro in '../lib/allegro4/allegro.pas',
75 {$ENDIF}
76 e_graphics in '../engine/e_graphics.pas',
77 e_input in '../engine/e_input.pas',
78 e_log in '../engine/e_log.pas',
79 e_sound in '../engine/e_sound.pas',
80 e_texture in '../engine/e_texture.pas',
81 e_msg in '../engine/e_msg.pas',
82 utils in '../shared/utils.pas',
83 xstreams in '../shared/xstreams.pas',
84 sfs in '../sfs/sfs.pas',
85 sfsPlainFS in '../sfs/sfsPlainFS.pas',
86 sfsZipFS in '../sfs/sfsZipFS.pas',
87 wadreader in '../shared/wadreader.pas',
88 MAPDEF in '../shared/MAPDEF.pas',
89 CONFIG in '../shared/CONFIG.pas',
90 g_basic in 'g_basic.pas',
91 g_console in 'g_console.pas',
92 g_net in 'g_net.pas',
93 g_netmsg in 'g_netmsg.pas',
94 g_nethandler in 'g_nethandler.pas',
95 g_netmaster in 'g_netmaster.pas',
96 g_res_downloader in 'g_res_downloader.pas',
97 g_grid in 'g_grid.pas',
98 g_game in 'g_game.pas',
99 g_gfx in 'g_gfx.pas',
100 g_gui in 'g_gui.pas',
101 g_items in 'g_items.pas',
102 g_main in 'g_main.pas',
103 g_map in 'g_map.pas',
104 g_menu in 'g_menu.pas',
105 g_monsters in 'g_monsters.pas',
106 g_options in 'g_options.pas',
107 g_phys in 'g_phys.pas',
108 g_player in 'g_player.pas',
109 g_playermodel in 'g_playermodel.pas',
110 g_saveload in 'g_saveload.pas',
111 g_sound in 'g_sound.pas',
112 g_textures in 'g_textures.pas',
113 g_triggers in 'g_triggers.pas',
114 g_weapons in 'g_weapons.pas',
115 g_window in 'g_window.pas',
116 SysUtils,
117 {$IFDEF USE_FMOD}
118 fmod in '../lib/FMOD/fmod.pas',
119 fmoderrors in '../lib/FMOD/fmoderrors.pas',
120 fmodpresets in '../lib/FMOD/fmodpresets.pas',
121 fmodtypes in '../lib/FMOD/fmodtypes.pas',
122 {$ENDIF}
123 xprofiler in '../shared/xprofiler.pas',
124 binheap in '../shared/binheap.pas',
125 hashtable in '../shared/hashtable.pas',
126 idpool in '../shared/idpool.pas',
127 xparser in '../shared/xparser.pas',
128 xdynrec in '../shared/xdynrec.pas',
129 exoma in '../shared/exoma.pas',
130 envvars in '../shared/envvars.pas',
131 g_panel in 'g_panel.pas',
132 g_language in 'g_language.pas',
134 {$IFDEF ENABLE_HOLMES}
135 g_holmes in 'g_holmes.pas',
137 sdlcarcass in '../flexui/sdlcarcass.pas',
138 //sdlstandalone in '../flexui/sdlstandalone.pas',
140 fui_wadread in '../flexui/fui_wadread.pas',
141 fui_common in '../flexui/fui_common.pas',
142 fui_gfx_gl in '../flexui/fui_gfx_gl.pas',
143 fui_events in '../flexui/fui_events.pas',
144 fui_style in '../flexui/fui_style.pas',
145 fui_flexlay in '../flexui/fui_flexlay.pas',
146 fui_ctls in '../flexui/fui_ctls.pas',
147 {$ENDIF}
149 ImagingTypes,
150 Imaging,
151 ImagingUtility;
153 {$IFDEF WINDOWS}
154 {$R *.res}
155 {$ENDIF}
157 {$IFDEF ANDROID}
158 function SDL_main(argc: CInt; argv: PPChar): CInt; cdecl;
159 {$ENDIF ANDROID}
161 var
162 f: Integer;
163 noct: Boolean = false;
164 {$IFDEF ANDROID}
165 storage: String;
166 {$ENDIF}
167 //tfo: Text;
168 begin
169 SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); //k8: fuck off, that's why
171 {$IFDEF ANDROID}
172 {$I-}
173 e_SetSafeSlowLog(true);
174 if SDL_AndroidGetExternalStorageState() <> 0 then
175 begin
176 storage := SDL_AndroidGetExternalStoragePath();
177 Chdir(storage);
178 e_WriteLog('Use external storage: ' + storage, TMsgType.Notify)
179 end
180 else
181 begin
182 storage := SDL_AndroidGetInternalStoragePath();
183 Chdir(storage);
184 e_WriteLog('Use internal storage: ' + storage, TMsgType.Notify)
185 end;
186 if IOresult <> 0 then
187 begin
188 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, PChar('Invalid path'), PChar('Can''t chdir to ' + storage), nil);
189 result := 1;
190 exit
191 end;
192 SetEnvVar('TIMIDITY_CFG', 'timidity.cfg');
193 {$ENDIF ANDROID}
195 for f := 1 to ParamCount do
196 begin
197 if ParamStr(f) = '--gdb' then noct := true
198 else if ParamStr(f) = '--log' then conbufDumpToStdOut := true
199 else if ParamStr(f) = '--safe-log' then e_SetSafeSlowLog(true);
200 end;
202 if noct then
203 begin
204 Main()
205 end
206 else
207 begin
208 try
209 Main();
210 e_WriteLog('Shutdown with no errors.', TMsgType.Notify);
211 except
212 on e: Exception do
213 begin
214 e_WriteStackTrace(e.message);
215 //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_MSG], [E.Message]), MSG_FATALERROR);
216 (*
217 AssignFile(tfo, GameDir+'/trace.log');
218 {$I-}
219 Append(tfo);
220 if (IOResult <> 0) then Rewrite(tfo);
221 if (IOResult = 0) then begin writeln(tfo, '====================='); DumpExceptionBackTrace(tfo); CloseFile(tfo); end;
222 *)
223 end
224 else
225 begin
226 //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_UNKNOWN], [NativeUInt(ExceptAddr())]), MSG_FATALERROR);
227 e_WriteStackTrace('FATAL ERROR');
228 end;
229 end;
230 end;
231 e_DeinitLog();
233 {$IFDEF ANDROID}
234 result := 0;
235 end; // SDL_main
236 exports SDL_main;
237 {$ENDIF ANDROID}
238 end.