DEADSOFTWARE

Sound: Initial OpenAL driver impl
[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 SDL2 in '../lib/sdl2/sdl2.pas',
52 {$IFDEF USE_SDLMIXER}
53 SDL2_mixer in '../lib/sdl2/SDL2_mixer.pas',
54 {$ENDIF}
55 {$IFDEF USE_OPENAL}
56 AL in '../lib/openal/al.pas',
57 e_soundfile in '../engine/e_soundfile.pas',
58 e_soundfile_wav in '../engine/e_soundfile_wav.pas',
59 {$ENDIF}
60 ENet in '../lib/enet/enet.pp',
61 e_graphics in '../engine/e_graphics.pas',
62 e_input in '../engine/e_input.pas',
63 e_log in '../engine/e_log.pas',
64 e_sound in '../engine/e_sound.pas',
65 e_texture in '../engine/e_texture.pas',
66 e_msg in '../engine/e_msg.pas',
67 utils in '../shared/utils.pas',
68 xstreams in '../shared/xstreams.pas',
69 sfs in '../sfs/sfs.pas',
70 sfsPlainFS in '../sfs/sfsPlainFS.pas',
71 sfsZipFS in '../sfs/sfsZipFS.pas',
72 wadreader in '../shared/wadreader.pas',
73 MAPDEF in '../shared/MAPDEF.pas',
74 CONFIG in '../shared/CONFIG.pas',
75 g_basic in 'g_basic.pas',
76 g_console in 'g_console.pas',
77 g_net in 'g_net.pas',
78 g_netmsg in 'g_netmsg.pas',
79 g_nethandler in 'g_nethandler.pas',
80 g_netmaster in 'g_netmaster.pas',
81 g_res_downloader in 'g_res_downloader.pas',
82 g_grid in 'g_grid.pas',
83 g_game in 'g_game.pas',
84 g_gfx in 'g_gfx.pas',
85 g_gui in 'g_gui.pas',
86 g_items in 'g_items.pas',
87 g_main in 'g_main.pas',
88 g_map in 'g_map.pas',
89 g_menu in 'g_menu.pas',
90 g_monsters in 'g_monsters.pas',
91 g_options in 'g_options.pas',
92 g_phys in 'g_phys.pas',
93 g_player in 'g_player.pas',
94 g_playermodel in 'g_playermodel.pas',
95 g_saveload in 'g_saveload.pas',
96 g_sound in 'g_sound.pas',
97 g_textures in 'g_textures.pas',
98 g_triggers in 'g_triggers.pas',
99 g_weapons in 'g_weapons.pas',
100 g_window in 'g_window.pas',
101 SysUtils,
102 {$IFDEF USE_FMOD}
103 fmod in '../lib/FMOD/fmod.pas',
104 fmoderrors in '../lib/FMOD/fmoderrors.pas',
105 fmodpresets in '../lib/FMOD/fmodpresets.pas',
106 fmodtypes in '../lib/FMOD/fmodtypes.pas',
107 {$ENDIF}
108 xprofiler in '../shared/xprofiler.pas',
109 binheap in '../shared/binheap.pas',
110 hashtable in '../shared/hashtable.pas',
111 idpool in '../shared/idpool.pas',
112 xparser in '../shared/xparser.pas',
113 xdynrec in '../shared/xdynrec.pas',
114 exoma in '../shared/exoma.pas',
115 envvars in '../shared/envvars.pas',
116 g_panel in 'g_panel.pas',
117 g_language in 'g_language.pas',
119 {$IFDEF ENABLE_HOLMES}
120 g_holmes in 'g_holmes.pas',
122 sdlcarcass in '../flexui/sdlcarcass.pas',
123 //sdlstandalone in '../flexui/sdlstandalone.pas',
125 fui_wadread in '../flexui/fui_wadread.pas',
126 fui_common in '../flexui/fui_common.pas',
127 fui_gfx_gl in '../flexui/fui_gfx_gl.pas',
128 fui_events in '../flexui/fui_events.pas',
129 fui_style in '../flexui/fui_style.pas',
130 fui_flexlay in '../flexui/fui_flexlay.pas',
131 fui_ctls in '../flexui/fui_ctls.pas',
132 {$ENDIF}
134 ImagingTypes,
135 Imaging,
136 ImagingUtility;
138 {$IFDEF WINDOWS}
139 {$R *.res}
140 {$ENDIF}
142 {$IFDEF ANDROID}
143 function SDL_main(argc: CInt; argv: PPChar): CInt; cdecl;
144 {$ENDIF ANDROID}
146 var
147 f: Integer;
148 noct: Boolean = false;
149 {$IFDEF ANDROID}
150 storage: String;
151 {$ENDIF}
152 //tfo: Text;
153 begin
154 SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); //k8: fuck off, that's why
156 {$IFDEF ANDROID}
157 {$I-}
158 e_SetSafeSlowLog(true);
159 if SDL_AndroidGetExternalStorageState() <> 0 then
160 begin
161 storage := SDL_AndroidGetExternalStoragePath();
162 Chdir(storage);
163 e_WriteLog('Use external storage: ' + storage, TMsgType.Notify)
164 end
165 else
166 begin
167 storage := SDL_AndroidGetInternalStoragePath();
168 Chdir(storage);
169 e_WriteLog('Use internal storage: ' + storage, TMsgType.Notify)
170 end;
171 if IOresult <> 0 then
172 begin
173 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, PChar('Invalid path'), PChar('Can''t chdir to ' + storage), nil);
174 result := 1;
175 exit
176 end;
177 SetEnvVar('TIMIDITY_CFG', 'timidity.cfg');
178 {$ENDIF ANDROID}
180 f := 1;
181 while f <= ParamCount do
182 begin
183 case ParamStr(f) of
184 '--gdb': noct := true;
185 '--log': conbufDumpToStdOut := true;
186 '--safe-log': e_SetSafeSlowLog(true);
187 '--log-file':
188 if f + 1 <= ParamCount then
189 begin
190 Inc(f);
191 LogFileName := ParamStr(f)
192 end;
193 end;
194 Inc(f)
195 end;
197 if LogFileName = '' then
198 begin
199 {$IFDEF HEADLESS}
200 LogFileName := 'Doom2DF_H.log';
201 {$ELSE}
202 LogFileName := 'Doom2DF.log';
203 {$ENDIF}
204 end;
206 if noct then
207 begin
208 Main()
209 end
210 else
211 begin
212 try
213 Main();
214 e_WriteLog('Shutdown with no errors.', TMsgType.Notify);
215 except
216 on e: Exception do
217 begin
218 e_WriteStackTrace(e.message);
219 //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_MSG], [E.Message]), MSG_FATALERROR);
220 (*
221 AssignFile(tfo, GameDir+'/trace.log');
222 {$I-}
223 Append(tfo);
224 if (IOResult <> 0) then Rewrite(tfo);
225 if (IOResult = 0) then begin writeln(tfo, '====================='); DumpExceptionBackTrace(tfo); CloseFile(tfo); end;
226 *)
227 end
228 else
229 begin
230 //e_WriteLog(Format(_lc[I_SYSTEM_ERROR_UNKNOWN], [NativeUInt(ExceptAddr())]), MSG_FATALERROR);
231 e_WriteStackTrace('FATAL ERROR');
232 end;
233 end;
234 end;
235 e_DeinitLog();
237 {$IFDEF ANDROID}
238 result := 0;
239 end; // SDL_main
240 exports SDL_main;
241 {$ENDIF ANDROID}
242 end.