FS2_Open
Open source remastering of the Freespace 2 engine
cmdline.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #include "camera/camera.h" //VIEWER_ZOOM_DEFAULT
13 #include "cmdline/cmdline.h"
14 #include "globalincs/linklist.h"
15 #include "globalincs/pstypes.h"
16 #include "globalincs/systemvars.h"
17 #include "globalincs/version.h"
18 #include "hud/hudconfig.h"
19 #include "network/multi.h"
20 #include "parse/scripting.h"
21 #include "parse/sexp.h"
22 
23 #ifdef _WIN32
24 #include <io.h>
25 #include <direct.h>
26 #elif defined(APPLE_APP)
27 #include <CoreFoundation/CoreFoundation.h>
28 #endif
29 
30 #ifdef SCP_UNIX
31 #include "osapi/osapi.h"
32 #include <dirent.h>
33 #endif
34 
35 #include <string.h>
36 #include <stdlib.h>
37 
39 {
40  AT_NONE =0,
44 };
45 // values and order MUST match cmdline_arg_type
46 const char *cmdline_arg_types[] =
47 {
48  "NONE",
49  "INT",
50  "FLOAT",
51  "STRING",
52 };
53 
54 // variables
55 class cmdline_parm {
56 public:
58  const char *name; // name of parameter, must start with '-' char
59  const char *help; // help text for this parameter
60  const bool stacks; // whether this arg stacks with each use or is replaced by newest use (should only be used for strings!!)
61  char *args; // string value for parameter arguments (NULL if no arguments)
62  int name_found; // true if parameter on command line, otherwise false
63  const int arg_type; // from enum cmdline_arg_type; used for help
64 
65  cmdline_parm(const char *name, const char *help, const int arg_type, const bool stacks = false);
66  ~cmdline_parm();
67  int found();
68  int get_int();
69  float get_float();
70  char *str();
72 };
73 
74 static cmdline_parm Parm_list(NULL, NULL, AT_NONE);
75 static int Parm_list_inited = 0;
76 
77 extern int Show_framerate; // from freespace.cpp
78 
79 enum
80 {
81  // DO NOT CHANGE ANYTHING ABOUT THESE FIRST TWO OR WILL MESS UP THE LAUNCHER
82  EASY_DEFAULT = 1 << 1,
83  EASY_ALL_ON = 1 << 2,
84 
85  EASY_MEM_ON = 1 << 3,
86  EASY_MEM_OFF = 1 << 4,
87 
88  // Add new flags here
89 
90  // Combos
93 };
94 
95 #define BUILD_CAP_OPENAL (1<<0)
96 #define BUILD_CAP_NO_D3D (1<<1)
97 #define BUILD_CAP_NEW_SND (1<<2)
98 
99 #define PARSE_COMMAND_LINE_STRING "-parse_cmdline_only"
100 
101 typedef struct
102 {
103  // DO NOT CHANGE THE SIZE OF THIS AT_STRING!
104  char name[32];
105 
106 } EasyFlag;
107 
109 {
110  { "Custom" },
111  { "Default FS2 (All features off)" },
112  { "All features on" },
113  { "High memory usage features on" },
114  { "High memory usage features off" }
115 };
116 
117 // DO NOT CHANGE **ANYTHING** ABOUT THIS STRUCTURE AND ITS CONTENT
118 typedef struct
119 {
120  char name[20]; // The actual flag
121  char desc[40]; // The text that will appear in the launcher (unless its blank, other name is shown)
122  bool fso_only; // true if this is a fs2_open only feature
123  int on_flags; // Easy flag which will turn this feature on
124  int off_flags; // Easy flag which will turn this feature off
125  char type[16]; // Launcher uses this to put flags under different headings
126  char web_url[256]; // Link to documentation of feature (please use wiki or somewhere constant)
127 
128 } Flag;
129 
130 // Please group them by type, ie graphics, gameplay etc, maximum 20 different types
132 {
133  { "-nospec", "Disable specular", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-spec", },
134  { "-noglow", "Disable glow maps", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-glow", },
135  { "-noenv", "Disable environment maps", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
136  { "-nomotiondebris", "Disable motion debris", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomotiondebris",},
137  { "-noscalevid", "Disable scale-to-window for movies", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noscalevid", },
138  { "-missile_lighting", "Apply lighting to missiles" , true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missile_lighting", },
139  { "-nonormal", "Disable normal maps", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-normal" },
140  { "-noheight", "Disable height/parallax maps", true, EASY_DEFAULT_MEM, EASY_MEM_ALL_ON, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-height" },
141  { "-3dshockwave", "Enable 3D shockwaves", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dshockwave" },
142  { "-post_process", "Enable post processing", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-post_process" },
143  { "-soft_particles", "Enable soft particles", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-soft_particles" },
144  { "-fxaa", "Enable FXAA anti-aliasing", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fxaa" },
145  { "-nolightshafts", "Disable lightshafts", true, EASY_DEFAULT, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-flightshaftsoff"},
146  { "-fb_explosions", "Enable Framebuffer Shockwaves", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fb_explosions", },
147  { "-no_deferred", "Disable Deferred Lighting", true, EASY_DEFAULT_MEM, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_deferred"},
148  { "-enable_shadows", "Enable Shadows", true, EASY_MEM_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_shadows"},
149  { "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
150  { "-cache_bitmaps", "Cache bitmaps between missions", true, 0, EASY_DEFAULT_MEM, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-cache_bitmaps", },
151 
152  { "-dualscanlines", "Add another pair of scanning lines", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dualscanlines", },
153  { "-targetinfo", "Enable info next to target", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-targetinfo", },
154  { "-orbradar", "Enable 3D radar", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-orbradar", },
155  { "-rearm_timer", "Enable rearm/repair completion timer", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-rearm_timer", },
156  { "-ballistic_gauge", "Enable analog ballistic ammo gauge", true, 0, EASY_DEFAULT, "HUD", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ballistic_gauge", },
157 
158  { "-ship_choice_3d", "Use 3D models for ship selection", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ship_choice_3d", },
159  { "-weapon_choice_3d", "Use 3D models for weapon selection", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-weapon_choice_3d", },
160  { "-3dwarp", "Enable 3D warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-3dwarp", },
161  { "-warp_flash", "Enable flash upon warp", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-warp_flash", },
162  { "-no_ap_interrupt", "Disable interrupting autopilot", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_ap_interrupt", },
163  { "-stretch_menu", "Stretch interface to fill screen", true, 0, EASY_DEFAULT, "Gameplay", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stretch_menu", },
164 
165  { "-snd_preload", "Preload mission game sounds", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-snd_preload", },
166  { "-nosound", "Disable all sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nosound", },
167  { "-nomusic", "Disable music", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomusic", },
168  { "-no_enhanced_sound", "Disable enhanced sound", false, 0, EASY_DEFAULT, "Audio", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_enhanced_sound", },
169 
170  { "-standalone", "Run as standalone server", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-standalone", },
171  { "-startgame", "Skip mainhall and start hosting", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-startgame", },
172  { "-closed", "Start hosted server as closed", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-closed", },
173  { "-restricted", "Host confirms join requests", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-restricted", },
174  { "-multilog", "", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-multilog", },
175  { "-clientdamage", "", false, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-clientdamage", },
176  { "-mpnoreturn", "Disable flight deck option", true, 0, EASY_DEFAULT, "Multiplayer", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mpnoreturn", },
177 
178  { "-nohtl", "Software mode (very slow)", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nohtl", },
179  { "-no_set_gamma", "Disable setting of gamma", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_set_gamma", },
180  { "-nomovies", "Disable video playback", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomovies", },
181  { "-noparseerrors", "Disable parsing errors", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noparseerrors", },
182  { "-query_speech", "Check if this build has speech", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-query_speech", },
183  { "-novbo", "Disable OpenGL VBO", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-novbo", },
184  { "-loadallweps", "Load all weapons, even those not used", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-loadallweps", },
185  { "-disable_fbo", "Disable OpenGL RenderTargets", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_fbo", },
186  { "-disable_pbo", "Disable OpenGL Pixel Buffer Objects", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_pbo", },
187  { "-no_glsl", "Disable GLSL (shader) support", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_glsl", },
188  { "-ati_swap", "Fix colour issues on some ATI cards", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ati_swap", },
189  { "-no_3d_sound", "Use only 2D/stereo for sound effects", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_3d_sound", },
190  { "-mipmap", "Enable mipmapping", true, 0, EASY_DEFAULT_MEM, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
191  #ifndef SCP_UNIX
192  { "-disable_di_mouse", "Don't use DirectInput for mouse control", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-disable_di_mouse", },
193  #endif
194  { "-use_gldrawelements","Don't use glDrawRangeElements", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-use_gldrawelements", },
195  { "-old_collision", "Use old collision detection system", true, EASY_DEFAULT, EASY_ALL_ON, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-old_collision", },
196  { "-gl_finish", "Fix input lag on some ATI+Linux systems", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-gl_finish", },
197  { "-no_batching", "Disable batched model rendering", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
198  { "-no_geo_effects", "Disable geometry shader for effects", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
199  { "-set_cpu_affinity", "Sets processor affinity to config value", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
200 #ifdef WIN32
201  { "-fix_registry", "Use a different registry path", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
202 #endif
203 
204  { "-ingame_join", "Allow in-game joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
205  { "-voicer", "Enable voice recognition", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-voicer", },
206  { "-brief_lighting", "Enable lighting on briefing models", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-brief_lighting", },
207 
208  { "-fps", "Show frames per second on HUD", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fps", },
209  { "-pos", "Show position of camera", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pos", },
210  { "-window", "Run in window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-window", },
211  #ifndef SCP_UNIX
212  { "-fullscreen_window", "Run in fullscreen window", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-fullscreen_window", },
213  #endif
214  { "-stats", "Show statistics", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-stats", },
215  { "-coords", "Show coordinates", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-coords", },
216  { "-show_mem_usage", "Show memory usage", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-show_mem_usage", },
217  { "-pofspew", "Generate all ibx files immediately", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-pofspew", },
218  { "-tablecrcs", "Dump table CRCs for multi validation", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-tablecrcs", },
219  { "-missioncrcs", "Dump mission CRCs for multi validation", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missioncrcs", },
220  { "-dis_collisions", "Disable collisions", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dis_collisions", },
221  { "-dis_weapons", "Disable weapon rendering", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-dis_weapons", },
222  { "-output_sexps", "Output SEXPs to sexps.html", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-output_sexps", },
223  { "-output_scripting", "Output scripting to scripting.html", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-output_scripting", },
224  { "-save_render_target", "Save render targets to file", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-save_render_target", },
225  { "-debug_window", "Display debug window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-debug_window", },
226  { "-verify_vps", "Spew VP CRCs to vp_crcs.txt", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-verify_vps", },
227  #ifdef SCP_UNIX
228  { "-nograb", "Don't grab mouse/keyboard in a window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nograb", },
229  #endif
230  { "-reparse_mainhall", "Reparse mainhall.tbl when loading halls", false, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-reparse_mainhall", },
231  { "-profile_frame_time", "Profile engine subsystems", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_frame_timings", },
232  { "-profile_write_file", "Write profiling information to file", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-profile_write_file", },
233  { "-no_unfocused_pause","Don't pause if the window isn't focused", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_unfocused_pause", },
234  { "-benchmark_mode", "Puts the game into benchmark mode", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-benchmark_mode", },
235 };
236 
237 // forward declaration
238 const char * get_param_desc(const char *flag_name);
239 
240 // here are the command line parameters that we will be using for FreeSpace
241 
242 // RETAIL options ----------------------------------------------
243 cmdline_parm connect_arg("-connect", "Automatically connect to multiplayer IP:PORT", AT_STRING); // Cmdline_connect_addr
244 cmdline_parm gamename_arg("-gamename", "Set multiplayer game name", AT_STRING); // Cmdline_game_name
245 cmdline_parm gamepassword_arg("-password", "Set multiplayer game password", AT_STRING); // Cmdline_game_password
246 cmdline_parm allowabove_arg("-allowabove", "Ranks above this can join multi", AT_STRING); // Cmdline_rank_above
247 cmdline_parm allowbelow_arg("-allowbelow", "Ranks below this can join multi", AT_STRING); // Cmdline_rank_below
248 cmdline_parm standalone_arg("-standalone", NULL, AT_NONE);
249 cmdline_parm nosound_arg("-nosound", NULL, AT_NONE); // Cmdline_freespace_no_sound
250 cmdline_parm nomusic_arg("-nomusic", NULL, AT_NONE); // Cmdline_freespace_no_music
251 cmdline_parm noenhancedsound_arg("-no_enhanced_sound", NULL, AT_NONE); // Cmdline_no_enhanced_sound
252 cmdline_parm startgame_arg("-startgame", NULL, AT_NONE); // Cmdline_start_netgame
253 cmdline_parm gameclosed_arg("-closed", NULL, AT_NONE); // Cmdline_closed_game
254 cmdline_parm gamerestricted_arg("-restricted", NULL, AT_NONE); // Cmdline_restricted_game
255 cmdline_parm port_arg("-port", "Multiplayer network port", AT_INT);
256 cmdline_parm multilog_arg("-multilog", NULL, AT_NONE); // Cmdline_multi_log
257 cmdline_parm client_dodamage("-clientdamage", NULL, AT_NONE); // Cmdline_client_dodamage
258 cmdline_parm pof_spew("-pofspew", NULL, AT_NONE); // Cmdline_spew_pof_info
259 cmdline_parm mouse_coords("-coords", NULL, AT_NONE); // Cmdline_mouse_coords
260 cmdline_parm timeout("-timeout", "Multiplayer network timeout (secs)", AT_INT); // Cmdline_timeout
261 cmdline_parm bit32_arg("-32bit", "Deprecated", AT_NONE); // (only here for retail compatibility reasons, doesn't actually do anything)
262 
263 char *Cmdline_connect_addr = NULL;
264 char *Cmdline_game_name = NULL;
266 char *Cmdline_rank_above = NULL;
267 char *Cmdline_rank_below = NULL;
283 
284 
285 // FSO options -------------------------------------------------
286 
287 // Graphics related
288 cmdline_parm fov_arg("-fov", "Vertical field-of-view factor", AT_FLOAT); // Cmdline_fov -- comand line FOV -Bobboau
289 cmdline_parm clip_dist_arg("-clipdist", "Changes the distance from the viewpoint for the near-clipping plane", AT_FLOAT); // Cmdline_clip_dist
290 cmdline_parm spec_exp_arg("-spec_exp", "Adjusts the size of shiny spots on ships", AT_FLOAT);
291 cmdline_parm ogl_spec_arg("-ogl_spec", "Shininess of specular light", AT_FLOAT); // Cmdline_ogl_spec
292 cmdline_parm spec_static_arg("-spec_static", "Adjusts suns contribution to specular highlights", AT_FLOAT);
293 cmdline_parm spec_point_arg("-spec_point", "Adjusts laser weapons contribution to specular highlights", AT_FLOAT);
294 cmdline_parm spec_tube_arg("-spec_tube", "Adjusts beam weapons contribution to specular highlights", AT_FLOAT);
295 cmdline_parm ambient_factor_arg("-ambient_factor", "Adjusts ambient light applied to all parts of a ship", AT_INT); // Cmdline_ambient_factor
296 cmdline_parm missile_lighting_arg("-missile_lighting", NULL, AT_NONE); // Cmdline_missile_lighting
297 cmdline_parm env("-noenv", NULL, AT_NONE); // Cmdline_env
298 cmdline_parm glow_arg("-noglow", NULL, AT_NONE); // Cmdline_glow -- use Bobs glow code
299 cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL, AT_NONE); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
300 cmdline_parm noscalevid_arg("-noscalevid", NULL, AT_NONE); // Cmdline_noscalevid -- disable video scaling that fits to window
301 cmdline_parm spec_arg("-nospec", NULL, AT_NONE); // Cmdline_spec --
302 cmdline_parm noemissive_arg("-no_emissive_light", "Disable emissive light from ships", AT_NONE); // Cmdline_no_emissive -- don't use emissive light in OGL
303 cmdline_parm normal_arg("-nonormal", NULL, AT_NONE); // Cmdline_normal -- disable normal mapping
304 cmdline_parm height_arg("-noheight", NULL, AT_NONE); // Cmdline_height -- enable support for parallax mapping
305 cmdline_parm enable_3d_shockwave_arg("-3dshockwave", NULL, AT_NONE);
306 cmdline_parm softparticles_arg("-soft_particles", NULL, AT_NONE);
307 cmdline_parm postprocess_arg("-post_process", NULL, AT_NONE);
308 cmdline_parm bloom_intensity_arg("-bloom_intensity", "Set bloom intensity, requires -post_process", AT_INT);
309 cmdline_parm fxaa_arg("-fxaa", NULL, AT_NONE);
310 cmdline_parm fxaa_preset_arg("-fxaa_preset", "FXAA quality (0-9), requires -post_process and -fxaa", AT_INT);
311 cmdline_parm fb_explosions_arg("-fb_explosions", NULL, AT_NONE);
312 cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL, AT_NONE);
313 cmdline_parm brieflighting_arg("-brief_lighting", NULL, AT_NONE);
314 cmdline_parm no_batching("-no_batching", NULL, AT_NONE);
315 cmdline_parm shadow_quality_arg("-shadow_quality", NULL, AT_INT);
316 cmdline_parm enable_shadows_arg("-enable_shadows", NULL, AT_NONE);
317 cmdline_parm no_deferred_lighting_arg("-no_deferred", NULL, AT_NONE); // Cmdline_no_deferred
318 
320 float Cmdline_fov = 0.75f;
321 float Cmdline_ogl_spec = 80.0f;
323 int Cmdline_env = 1;
326 int Cmdline_glow = 1;
329 int Cmdline_spec = 1;
337 bool Cmdline_fxaa = false;
339 extern int Fxaa_preset_last_frame;
341 bool Cmdline_no_batching = false;
342 extern bool ls_force_off;
346 
347 // Game Speed related
348 cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL, AT_NONE); // Cmdline_cache_bitmaps
349 cmdline_parm no_fpscap("-no_fps_capping", "Don't limit frames-per-second", AT_NONE); // Cmdline_NoFPSCap
350 cmdline_parm no_vsync_arg("-no_vsync", NULL, AT_NONE); // Cmdline_no_vsync
351 
352 int Cmdline_cache_bitmaps = 0; // caching of bitmaps between missions (faster loads, can hit swap on reload with <512 Meg RAM though) - taylor
353 int Cmdline_NoFPSCap = 0; // Disable FPS capping - kazan
355 
356 // HUD related
357 cmdline_parm ballistic_gauge("-ballistic_gauge", NULL, AT_NONE); // Cmdline_ballistic_gauge
358 cmdline_parm dualscanlines_arg("-dualscanlines", NULL, AT_NONE); // Cmdline_dualscanlines -- Change to phreaks options including new targeting code
359 cmdline_parm orb_radar("-orbradar", NULL, AT_NONE); // Cmdline_orb_radar
360 cmdline_parm rearm_timer_arg("-rearm_timer", NULL, AT_NONE); // Cmdline_rearm_timer
361 cmdline_parm targetinfo_arg("-targetinfo", NULL, AT_NONE); // Cmdline_targetinfo -- Adds ship name/class to right of target box -C
362 
363 int Cmdline_ballistic_gauge = 0; // WMCoolmon's gauge thingy
368 
369 // Gameplay related
370 cmdline_parm use_3dwarp("-3dwarp", NULL, AT_NONE); // Cmdline_3dwarp
371 cmdline_parm ship_choice_3d_arg("-ship_choice_3d", NULL, AT_NONE); // Cmdline_ship_choice_3d
372 cmdline_parm weapon_choice_3d_arg("-weapon_choice_3d", NULL, AT_NONE); // Cmdline_weapon_choice_3d
373 cmdline_parm use_warp_flash("-warp_flash", NULL, AT_NONE); // Cmdline_warp_flash
374 cmdline_parm allow_autpilot_interrupt("-no_ap_interrupt", NULL, AT_NONE);
375 cmdline_parm stretch_menu("-stretch_menu", NULL, AT_NONE); // Cmdline_stretch_menu
376 
383 
384 // Audio related
385 cmdline_parm query_speech_arg("-query_speech", NULL, AT_NONE); // Cmdline_query_speech
386 cmdline_parm snd_preload_arg("-snd_preload", NULL, AT_NONE); // Cmdline_snd_preload
387 cmdline_parm voice_recognition_arg("-voicer", NULL, AT_NONE); // Cmdline_voice_recognition
388 
390 int Cmdline_snd_preload = 0; // preload game sounds during mission load
393 
394 // MOD related
395 cmdline_parm mod_arg("-mod", "List of folders to overwrite/add-to the default data", AT_STRING, true); // Cmdline_mod -- DTP modsupport
396 
397 char *Cmdline_mod = NULL; //DTP for mod argument
398 
399 // Multiplayer/Network related
400 cmdline_parm almission_arg("-almission", "Autoload multiplayer mission", AT_STRING); // Cmdline_almission -- DTP for autoload Multi mission
401 cmdline_parm ingamejoin_arg("-ingame_join", NULL, AT_NONE); // Cmdline_ingamejoin
402 cmdline_parm mpnoreturn_arg("-mpnoreturn", NULL, AT_NONE); // Cmdline_mpnoreturn -- Removes 'Return to Flight Deck' in respawn dialog -C
403 cmdline_parm missioncrcspew_arg("-missioncrcs", NULL, AT_STRING); // Cmdline_spew_mission_crcs
404 cmdline_parm tablecrcspew_arg("-tablecrcs", NULL, AT_STRING); // Cmdline_spew_table_crcs
405 cmdline_parm objupd_arg("-cap_object_update", "Multiplayer object update cap (0-3)", AT_INT);
406 
407 char *Cmdline_almission = NULL; //DTP for autoload multi mission.
412 int Cmdline_objupd = 3; // client object updates on LAN by default
413 
414 // Troubleshooting
415 cmdline_parm loadallweapons_arg("-loadallweps", NULL, AT_NONE); // Cmdline_load_all_weapons
416 cmdline_parm htl_arg("-nohtl", NULL, AT_NONE); // Cmdline_nohtl -- don't use HT&L
417 cmdline_parm nomovies_arg("-nomovies", NULL, AT_NONE); // Cmdline_nomovies -- Allows video streaming
418 cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL, AT_NONE); // Cmdline_no_set_gamma
419 cmdline_parm no_vbo_arg("-novbo", NULL, AT_NONE); // Cmdline_novbo
420 cmdline_parm no_fbo_arg("-disable_fbo", NULL, AT_NONE); // Cmdline_no_fbo
421 cmdline_parm no_pbo_arg("-disable_pbo", NULL, AT_NONE); // Cmdline_no_pbo
422 cmdline_parm noglsl_arg("-no_glsl", NULL, AT_NONE); // Cmdline_noglsl -- disable GLSL support in OpenGL
423 cmdline_parm mipmap_arg("-mipmap", NULL, AT_NONE); // Cmdline_mipmap
424 cmdline_parm atiswap_arg("-ati_swap", NULL, AT_NONE); // Cmdline_atiswap - Fix ATI color swap issue for screenshots.
425 cmdline_parm no3dsound_arg("-no_3d_sound", NULL, AT_NONE); // Cmdline_no_3d_sound - Disable use of full 3D sounds
426 cmdline_parm no_di_mouse_arg("-disable_di_mouse", "Disable DirectInput mouse code (Windows only)", AT_NONE); // Cmdline_no_di_mouse -- Disables directinput use for mouse control
427 cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL, AT_NONE); // Cmdline_drawelements -- Uses glDrawElements instead of glDrawRangeElements
428 cmdline_parm keyboard_layout("-keyboard_layout", "Specify keyboard layout (qwertz or azerty)", AT_STRING);
429 cmdline_parm old_collision_system("-old_collision", NULL, AT_NONE); // Cmdline_old_collision_sys
430 cmdline_parm gl_finish ("-gl_finish", NULL, AT_NONE);
431 cmdline_parm no_geo_sdr_effects("-no_geo_effects", NULL, AT_NONE);
432 cmdline_parm set_cpu_affinity("-set_cpu_affinity", NULL, AT_NONE);
433 #ifdef WIN32
434 cmdline_parm fix_registry("-fix_registry", NULL, AT_NONE);
435 #endif
436 
441 int Cmdline_novbo = 0; // turn off OGL VBO support, troubleshooting
450 bool Cmdline_gl_finish = false;
453 #ifdef WIN32
454 bool Cmdline_alternate_registry_path = false;
455 #endif
456 
457 // Developer/Testing related
458 cmdline_parm start_mission_arg("-start_mission", "Skip mainhall and run this mission", AT_STRING); // Cmdline_start_mission
459 cmdline_parm dis_collisions("-dis_collisions", NULL, AT_NONE); // Cmdline_dis_collisions
460 cmdline_parm dis_weapons("-dis_weapons", NULL, AT_NONE); // Cmdline_dis_weapons
461 cmdline_parm noparseerrors_arg("-noparseerrors", NULL, AT_NONE); // Cmdline_noparseerrors -- turns off parsing errors -C
462 #ifdef Allow_NoWarn
463 cmdline_parm nowarn_arg("-no_warn", "Disable warnings (not recommended)", AT_NONE); // Cmdline_nowarn
464 #endif
465 cmdline_parm extra_warn_arg("-extra_warn", "Enable 'extra' warnings", AT_NONE); // Cmdline_extra_warn
466 cmdline_parm fps_arg("-fps", NULL, AT_NONE); // Cmdline_show_fps
467 cmdline_parm show_mem_usage_arg("-show_mem_usage", NULL, AT_NONE); // Cmdline_show_mem_usage
468 cmdline_parm pos_arg("-pos", NULL, AT_NONE); // Cmdline_show_pos
469 cmdline_parm stats_arg("-stats", NULL, AT_NONE); // Cmdline_show_stats
470 cmdline_parm save_render_targets_arg("-save_render_target", NULL, AT_NONE); // Cmdline_save_render_targets
471 cmdline_parm debug_window_arg("-debug_window", NULL, AT_NONE); // Cmdline_debug_window
472 cmdline_parm window_arg("-window", NULL, AT_NONE); // Cmdline_window
473 cmdline_parm fullscreen_window_arg("-fullscreen_window", "Fullscreen/borderless window (Windows only)", AT_NONE);
474 cmdline_parm res_arg("-res", "Resolution, formatted like 1600x900", AT_STRING);
475 cmdline_parm center_res_arg("-center_res", "Resolution of center monitor, formatted like 1600x900", AT_STRING);
476 cmdline_parm verify_vps_arg("-verify_vps", NULL, AT_NONE); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
477 cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING, "Ignore any cmdline_fso.cfg files", AT_NONE);
478 #ifdef SCP_UNIX
479 cmdline_parm no_grab("-nograb", NULL, AT_NONE); // Cmdline_no_grab
480 #endif
481 cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL, AT_NONE); //Cmdline_reparse_mainhall
482 cmdline_parm frame_profile_arg("-profile_frame_time", NULL, AT_NONE); //Cmdline_frame_profile
483 cmdline_parm frame_profile_write_file("-profile_write_file", NULL, AT_NONE); // Cmdline_profile_write_file
484 cmdline_parm no_unfocused_pause_arg("-no_unfocused_pause", NULL, AT_NONE); //Cmdline_no_unfocus_pause
485 cmdline_parm benchmark_mode_arg("-benchmark_mode", NULL, AT_NONE); //Cmdline_benchmark_mode
486 
487 
493 #ifdef Allow_NoWarn
494 int Cmdline_nowarn = 0; // turn warnings off in FRED
495 #endif
504 char *Cmdline_res = 0;
507 #ifdef SCP_UNIX
508 int Cmdline_no_grab = 0;
509 #endif
515 
516 // Other
517 cmdline_parm get_flags_arg("-get_flags", "Output the launcher flags file", AT_NONE);
518 cmdline_parm output_sexp_arg("-output_sexps", NULL, AT_NONE); //WMC - outputs all SEXPs to sexps.html
519 cmdline_parm output_scripting_arg("-output_scripting", NULL, AT_NONE); //WMC
520 
521 // Deprecated flags - CommanderDJ
522 cmdline_parm deprecated_spec_arg("-spec", "Deprecated", AT_NONE);
523 cmdline_parm deprecated_glow_arg("-glow", "Deprecated", AT_NONE);
524 cmdline_parm deprecated_normal_arg("-normal", "Deprecated", AT_NONE);
525 cmdline_parm deprecated_env_arg("-env", "Deprecated", AT_NONE);
526 cmdline_parm deprecated_tbp_arg("-tbp", "Deprecated", AT_NONE);
527 cmdline_parm deprecated_jpgtga_arg("-jpgtga", "Deprecated", AT_NONE);
528 
535 
536 #ifndef NDEBUG
537 // NOTE: this assumes that os_init() has already been called but isn't a fatal error if it hasn't
539 {
540  cmdline_parm *parmp;
541  int found = 0;
542  mprintf(("Passed cmdline options:"));
543 
544  for (parmp = GET_FIRST(&Parm_list); parmp !=END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp) ) {
545  if ( parmp->name_found ) {
546  if ( parmp->args != NULL ) {
547  mprintf(("\n %s %s", parmp->name, parmp->args));
548  } else {
549  mprintf(("\n %s", parmp->name));
550  }
551  found++;
552  }
553  }
554 
555  if ( !found )
556  mprintf(("\n <none>"));
557 
558  mprintf(("\n"));
559 
560  //Print log messages about any deprecated flags we found - CommanderDJ
561  if(Cmdline_deprecated_spec == 1)
562  {
563  mprintf(("Deprecated flag '-spec' found. Please remove from your cmdline.\n"));
564  }
565 
566  if(Cmdline_deprecated_glow == 1)
567  {
568  mprintf(("Deprecated flag '-glow' found. Please remove from your cmdline.\n"));
569  }
570 
572  {
573  mprintf(("Deprecated flag '-normal' found. Please remove from your cmdline.\n"));
574  }
575 
576  if(Cmdline_deprecated_env == 1)
577  {
578  mprintf(("Deprecated flag '-env' found. Please remove from your cmdline.\n"));
579  }
580 
581  if(Cmdline_deprecated_tbp == 1)
582  {
583  mprintf(("Deprecated flag '-tbp' found. Please remove from your cmdline.\n"));
584  }
585 
587  {
588  mprintf(("Deprecated flag '-jpgtga' found. Please remove from your cmdline.\n"));
589  }
590 }
591 #endif
592 
593 // Return true if this character is an extra char (white space and quotes)
594 int is_extra_space(char ch)
595 {
596  return ((ch == ' ') || (ch == '\t') || (ch == 0x0a) || (ch == '\'') || (ch == '\"'));
597 }
598 
599 
600 // eliminates all leading and trailing extra chars from a string. Returns pointer passed in.
601 char *drop_extra_chars(char *str)
602 {
603  int s, e;
604 
605  s = 0;
606  while (str[s] && is_extra_space(str[s]))
607  s++;
608 
609  e = strlen(str) - 1; // we already account for NULL later on, so the -1 is here to make
610  // sure we do our math without taking it into consideration
611 
612  if (e < 0)
613  e = 0;
614 
615  while (e > s) {
616  if (!is_extra_space(str[e])){
617  break;
618  }
619 
620  e--;
621  }
622 
623  if (e >= s && e !=0 ){
624  memmove(str, str + s, e - s + 1);
625  }
626 
627  str[e - s + 1] = 0;
628  return str;
629 }
630 
631 
632 // internal function - copy the value for a parameter agruement into the cmdline_parm arg field
633 void parm_stuff_args(cmdline_parm *parm, char *cmdline)
634 {
635  char buffer[1024];
636  memset( buffer, 0, sizeof( buffer ) );
637  char *dest = buffer;
638  char *saved_args = NULL;
639 
640  cmdline += strlen(parm->name);
641 
642  while ((*cmdline != '\0') && strncmp(cmdline, " -", 2) && ((size_t)(dest-buffer) < sizeof(buffer))) {
643  *dest++ = *cmdline++;
644  }
645 
646  drop_extra_chars(buffer);
647 
648  // mwa 9/14/98 -- made it so that newer command line arguments found will overwrite the old arguments
649  // taylor 7/25/06 -- made it so that you can stack newer arguments if that option should support stacking
650 
651  if ( parm->args != NULL ) {
652  if (parm->stacks) {
653  saved_args = parm->args;
654  } else {
655  delete[] parm->args;
656  }
657 
658  parm->args = NULL;
659  }
660 
661  int size = strlen(buffer);
662 
663  if (size > 0) {
664  size++; // nul char
665 
666  if (saved_args != NULL) {
667  size += (strlen(saved_args) + 1); // an ',' is used as a separator when combining, so be sure to account for it
668  }
669 
670  parm->args = new char[size];
671  memset(parm->args, 0, size);
672 
673  if (saved_args != NULL) {
674  // saved args go first, then new arg
675  strcpy_s(parm->args, size, saved_args);
676  // add a separator too, so that we can tell the args apart
677  strcat_s(parm->args, size, ",");
678  // now the new arg
679  strcat_s(parm->args, size, buffer);
680 
681  delete [] saved_args;
682  } else {
683  strcpy_s(parm->args, size, buffer);
684  }
685  } else {
686  parm->args = saved_args;
687  }
688 }
689 
690 
691 // internal function - parse the command line, extracting parameter arguments if they exist
692 // cmdline - command line string passed to the application
693 void os_parse_parms(char *cmdline)
694 {
695  // locate command line parameters
696  cmdline_parm *parmp;
697  char *cmdline_offset = NULL;
698  size_t get_new_offset = 0;
699 
700  for (parmp = GET_FIRST(&Parm_list); parmp != END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp)) {
701  // continue processing every option on the line to make sure that we account for every listing of each option
702  do {
703  // while going through the cmdline make sure to grab only the option that we are
704  // looking for, but if one similar then keep searching for the exact match
705  while (true) {
706  cmdline_offset = strstr(cmdline + get_new_offset, parmp->name);
707 
708  if ( !cmdline_offset )
709  break;
710 
711  int parmp_len = strlen(parmp->name);
712 
713  // the new offset should be our currently location + the length of the current option
714  get_new_offset = (strlen(cmdline) - strlen(cmdline_offset) + parmp_len);
715 
716  if ( (*(cmdline_offset + parmp_len)) && !is_extra_space(*(cmdline_offset + parmp_len)) ) {
717  // we found a similar, but not exact, match for this option, continue checking for the correct one
718  } else {
719  // we found what we were looking for so break out and process it
720  break;
721  }
722  }
723 
724  if (cmdline_offset) {
725  parmp->name_found = 1;
726  parm_stuff_args(parmp, cmdline_offset);
727  }
728  } while (cmdline_offset);
729 
730  // reset the offset for the next param that we will look for
731  get_new_offset = 0;
732  cmdline_offset = NULL;
733  }
734 }
735 
736 
737 // validate the command line parameters. Display an error if an unrecognized parameter is located.
738 void os_validate_parms(char *cmdline)
739 {
740  cmdline_parm *parmp;
741  char seps[] = " ,\t\n";
742  char *token;
743  int parm_found;
744 
745  token = strtok(cmdline, seps);
746  while(token != NULL) {
747 
748  if (token[0] == '-') {
749  parm_found = 0;
750  for (parmp = GET_FIRST(&Parm_list); parmp !=END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp) ) {
751  if (!stricmp(parmp->name, token)) {
752  parm_found = 1;
753  break;
754  }
755  }
756 
757  if (parm_found == 0) {
758 #ifdef _WIN32
759  // Changed this to MessageBox, this is a user error not a developer
760  char buffer[128];
761  sprintf(buffer,"Unrecognized command line parameter %s, continue?",token);
762  if( MessageBox(NULL, buffer, "Warning", MB_OKCANCEL | MB_ICONQUESTION) == IDCANCEL)
763  exit(0);
764 #elif defined(APPLE_APP)
765  CFStringRef message;
766  char buffer[128];
767  CFOptionFlags result;
768 
769  snprintf(buffer, 128, "Unrecognized command line parameter, \"%s\", continue?", token);
770  message = CFStringCreateWithCString(NULL, buffer, kCFStringEncodingASCII);
771 
772  if ( CFUserNotificationDisplayAlert(0, kCFUserNotificationPlainAlertLevel, NULL, NULL, NULL, CFSTR("Unknown Command"), message, NULL, CFSTR("Quit"), NULL, &result) ) {
773  CFRelease(message);
774  exit(0);
775  }
776 
777  if (result != kCFUserNotificationDefaultResponse) {
778  CFRelease(message);
779  exit(0);
780  }
781 
782  CFRelease(message);
783 #else
784  // if we got a -help, --help, -h, or -? then show the help text, otherwise show unknown option
785  if ( !stricmp(token, "-help") || !stricmp(token, "--help") || !stricmp(token, "-h") || !stricmp(token, "-?") ) {
786  if (FS_VERSION_REVIS == 0) {
787  printf("FreeSpace 2 Open, version %i.%i.%i\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD);
788  } else {
789  printf("FreeSpace 2 Open, version %i.%i.%i.%i\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD, FS_VERSION_REVIS);
790  }
791  printf("Website: http://scp.indiegames.us\n");
792  printf("Mantis (bug reporting): http://scp.indiegames.us/mantis/\n\n");
793  printf("Usage: fs2_open [options]\n");
794 
795  // not the prettiest thing but the job gets done
796  static const int STR_SIZE = 25; // max len of exe_params.name + 5 spaces
797  const int AT_SIZE = 8; // max len of cmdline_arg_types[] + 2 spaces
798  int sp=0, atp=0;
799  for (parmp = GET_FIRST(&Parm_list); parmp !=END_OF_LIST(&Parm_list); parmp = GET_NEXT(parmp) ) {
800  // don't output deprecated flags
801  if (stricmp("deprecated", parmp->help)) {
802  sp = strlen(parmp->name);
803  if (parmp->arg_type != AT_NONE) {
804  atp = strlen(cmdline_arg_types[parmp->arg_type]);
805  printf(" [ %s ]%*s[ %s ]%*s- %s\n", parmp->name, (STR_SIZE - sp -1), NOX(" "), cmdline_arg_types[parmp->arg_type], AT_SIZE-atp, NOX(" "), parmp->help);
806  } else {
807  printf(" [ %s ]%*s- %s\n", parmp->name, (STR_SIZE - sp -1 +AT_SIZE+4), NOX(" "), parmp->help);
808  }
809  }
810  }
811 
812  printf("\n");
813  exit(0);
814  } else {
815  printf("Unrecognized command line parameter \"%s\". Ignoring...\n", token);
816  }
817 #endif
818  }
819  }
820 
821  token = strtok(NULL, seps);
822  }
823 }
824 
825 
826 // Call once to initialize the command line system
827 //
828 // cmdline - command line string passed to the application
829 void os_init_cmdline(char *cmdline)
830 {
831  FILE *fp;
832 
833  if (strstr(cmdline, PARSE_COMMAND_LINE_STRING) == NULL) {
834 
835  // read the cmdline_fso.cfg file from the data folder, and pass the command line arguments to
836  // the the parse_parms and validate_parms line. Read these first so anything actually on
837  // the command line will take precedence
838 #ifdef _WIN32
839  fp = fopen("data\\cmdline_fso.cfg", "rt");
840 #elif defined(APPLE_APP)
841  char resolved_path[MAX_PATH], data_path[MAX_PATH_LEN];
842 
843  GetCurrentDirectory(MAX_PATH_LEN-1, data_path);
844  snprintf(resolved_path, MAX_PATH, "%s/data/cmdline_fso.cfg", data_path);
845 
846  fp = fopen(resolved_path, "rt");
847 #else
848  fp = fopen("data/cmdline_fso.cfg", "rt");
849 #endif
850 
851  // if the file exists, get a single line, and deal with it
852  if ( fp ) {
853  char *buf, *p;
854 
855  size_t len = filelength( fileno(fp) ) + 2;
856  buf = new char [len];
857 
858  if (fgets(buf, len-1, fp) != nullptr)
859  {
860  // replace the newline character with a NULL
861  if ( (p = strrchr(buf, '\n')) != NULL ) {
862  *p = '\0';
863  }
864 
865 #ifdef SCP_UNIX
866  // append a space for the os_parse_parms() check
867  strcat_s(buf, len, " ");
868 #endif
869 
870  os_parse_parms(buf);
871  os_validate_parms(buf);
872  }
873  delete [] buf;
874  fclose(fp);
875  }
876 
877 #ifdef SCP_UNIX
878  // parse user specific cmdline_fso config file (will supersede options in global file)
879  char cmdname[MAX_PATH];
880 
881  snprintf(cmdname, MAX_PATH, "%s/%s/data/cmdline_fso.cfg", detect_home(), Osreg_user_dir);
882  fp = fopen(cmdname, "rt");
883 
884  if ( !fp ) {
885  // try for non "_fso", for older code versions
886  snprintf(cmdname, MAX_PATH, "%s/%s/data/cmdline.cfg", detect_home(), Osreg_user_dir);
887  fp = fopen(cmdname, "rt");
888  }
889 
890  // if the file exists, get a single line, and deal with it
891  if ( fp ) {
892  char *buf, *p;
893 
894  size_t len = filelength( fileno(fp) ) + 2;
895  buf = new char [len];
896 
897  if (fgets(buf, len-1, fp) != nullptr)
898  {
899  // replace the newline character with a NULL
900  if ( (p = strrchr(buf, '\n')) != NULL ) {
901  *p = '\0';
902  }
903 
904  // append a space for the os_parse_parms() check
905  strcat_s(buf, len, " ");
906 
907  os_parse_parms(buf);
908  os_validate_parms(buf);
909  }
910 
911  delete [] buf;
912  fclose(fp);
913  }
914 #endif
915  } // If cmdline included PARSE_COMMAND_LINE_STRING
916 
917  // By parsing cmdline last, anything actually on the command line will take precedence.
918  os_parse_parms(cmdline);
919  os_validate_parms(cmdline);
920 }
921 
922 
923 /*
924  * arg constructor
925  *
926  * @param name_ name of the parameter, must start with '-' character
927  * @param help_ help text for this parameter
928  * @param arg_type_ parameters arguement type (if any)
929  * @param stacks_ can the parameter be stacked
930  */
931 cmdline_parm::cmdline_parm(const char *name_, const char *help_, const int arg_type_, const bool stacks_):
932  name(name_), help(help_), stacks(stacks_), arg_type(arg_type_)
933 {
934  args = NULL;
935  name_found = 0;
936 
937  if (Parm_list_inited == 0) {
938  Assertion(&Parm_list == this, "Coding error! 1st initialised cmdline_parm must be static Parm_list\n");
939  list_init(this);
940  Parm_list_inited = 1;
941  } else {
942  Assertion(name, "Coding error! cmdline_parm's must have a non-NULL name\n");
943  Assertion(name[0] == '-', "Coding error! cmdline_parm's must start with a '-'\n");
944  // not in the static Parm_list init, so lookup the NULL help args
945  if (help == NULL) {
947  }
948  list_append(&Parm_list, this);
949  }
950 }
951 
952 
953 // destructor - frees any allocated memory
955 {
956 #ifndef FRED
957  if (args) {
958  delete [] args;
959  args = NULL;
960  }
961 #endif
962 }
963 
964 // checks if the objects args variable is valid
965 // returns true if it is, shows an error box and returns false if not valid.
967  if ( args == NULL ) {
968  Error(__FILE__, __LINE__,
969  "Command line flag passed that requires an argument, but the argument is missing!\r\n"
970  "The flag is '%s', make sure that you have an argument that follows it.\r\n"
971  "You may need to close your launcher and remove the flag manually from %s/data/cmdline_fso.cfg\r\n",
972  name, "<Freespace directory>");
973  return false;
974  } else {
975  return true;
976  }
977 }
978 
979 
980 // returns - true if the parameter exists on the command line, otherwise false
982 {
983  return name_found;
984 }
985 
986 // returns - the interger representation for the parameter argument
988 {
989  Assertion(arg_type == AT_INT, "Coding error! Cmdline arg (%s) called cmdline_parm::get_int() with invalid arg_type (%s)", name, cmdline_arg_types[arg_type]);
991 
992  int offset = 0;
993 
994  if (stacks) {
995  // first off, DON'T STACK NON-STRINGS!!
996  Int3();
997 
998  // secondly, we still need to get it right for the user's sake...
999  char *moron = strstr(args, ",");
1000 
1001  if ( moron && ((strlen(moron) + 1) < strlen(args)) ) {
1002  // we get the last arg, since it's the newest one
1003  offset = strlen(args) - strlen(moron) + 1;
1004  }
1005  }
1006 
1007  return atoi(args+offset);
1008 }
1009 
1010 
1011 // returns - the float representation for the parameter argument
1013 {
1014  Assertion(arg_type == AT_FLOAT, "Coding error! Cmdline arg (%s) called cmdline_parm::get_float() with invalid arg_type (%s)", name, cmdline_arg_types[arg_type]);
1016 
1017  int offset = 0;
1018 
1019  if (stacks) {
1020  // first off, DON'T STACK NON-STRINGS!!
1021  Int3();
1022 
1023  // secondly, we still need to get it right for the user's sake
1024  char *moron = strstr(args, ",");
1025 
1026  if ( moron && ((strlen(moron) + 1) < strlen(args)) ) {
1027  // we get the last arg, since it's the newest one
1028  offset = strlen(args) - strlen(moron) + 1;
1029  }
1030  }
1031 
1032  return (float)atof(args+offset);
1033 }
1034 
1035 
1036 // returns - the string value for the parameter argument
1038 {
1039  Assertion(arg_type == AT_STRING, "Coding error! Cmdline arg (%s) called cmdline_parm::str() with invalid arg_type (%s)", name, cmdline_arg_types[arg_type]);
1041 
1042  return args;
1043 }
1044 
1045 #ifdef SCP_UNIX
1046 // Return a vector with all filesystem names of "parent/dir" relative to parent.
1047 // dir must not contain a slash.
1048 static SCP_vector<SCP_string> unix_get_single_dir_names(SCP_string parent, SCP_string dir)
1049 {
1051 
1052  DIR *dp;
1053  if ((dp = opendir(parent.c_str())) == NULL) {
1054  Warning(LOCATION, "Can't open directory '%s' when searching mod paths. Ignoring. errno=%d", parent.c_str(), errno);
1055  return ret;
1056  }
1057 
1058  dirent *dirp;
1059  while ((dirp = readdir(dp)) != NULL) {
1060  if (!stricmp(dirp->d_name, dir.c_str())) {
1061  ret.push_back(dirp->d_name);
1062  }
1063  }
1064  (void)closedir(dp);
1065 
1066  return ret;
1067 }
1068 
1069 // Return a vector with all filesystem names of "parent/dir" relative to parent.
1070 // Recurses to deal with slashes in dir.
1071 static SCP_vector<SCP_string> unix_get_dir_names(SCP_string parent, SCP_string dir)
1072 {
1073  size_t slash = dir.find_first_of("/\\");
1074 
1075  // no subdirectories, no need to recurse
1076  if (slash == std::string::npos) {
1077  return unix_get_single_dir_names(parent, dir);
1078  }
1079 
1080  // get the names of the first component of dir
1081  SCP_vector<SCP_string> this_dir_names = unix_get_single_dir_names(parent, dir.substr(0, slash));
1082 
1083  SCP_string rest = dir.substr(slash + 1);
1084 
1086 
1087  // search for the rest of dir in each of these
1088  SCP_vector<SCP_string>::iterator ii, end = this_dir_names.end();
1089  for (ii = this_dir_names.begin(); ii != end; ++ii) {
1090  SCP_string this_dir_path = parent + "/" + *ii;
1091  SCP_vector<SCP_string> mod_path = unix_get_dir_names(this_dir_path, rest);
1092 
1093  // add all found paths relative to parent
1094  SCP_vector<SCP_string>::iterator ii2, end2 = mod_path.end();
1095  for (ii2 = mod_path.begin(); ii2 != end2; ++ii2) {
1096  ret.push_back(*ii + "/" + *ii2);
1097  }
1098  }
1099 
1100  return ret;
1101 }
1102 
1103 // For case sensitive filesystems (e.g. Linux/BSD) perform case-insensitive dir matches.
1104 static void handle_unix_modlist(char **modlist, int *len)
1105 {
1106  // search filesystem for given paths
1107  SCP_vector<SCP_string> mod_paths;
1108  for (char *cur_mod = strtok(*modlist, ","); cur_mod != NULL; cur_mod = strtok(NULL, ","))
1109  {
1110  SCP_vector<SCP_string> this_mod_paths = unix_get_dir_names(".", cur_mod);
1111  if (this_mod_paths.empty()) {
1112  ReleaseWarning(LOCATION, "Can't find mod '%s'. Ignoring.", cur_mod);
1113  }
1114  mod_paths.insert(mod_paths.end(), this_mod_paths.begin(), this_mod_paths.end());
1115  }
1116 
1117  // create new char[] to replace modlist
1118  size_t total_len = 0;
1119  SCP_vector<SCP_string>::iterator ii, end = mod_paths.end();
1120  for (ii = mod_paths.begin(); ii != end; ++ii) {
1121  total_len += ii->length() + 1;
1122  }
1123 
1124  char *new_modlist = new char[total_len + 1];
1125  memset(new_modlist, 0, total_len + 1);
1126  end = mod_paths.end();
1127  for (ii = mod_paths.begin(); ii != end; ++ii) {
1128  strcat_s(new_modlist, total_len + 1, ii->c_str());
1129  strcat_s(new_modlist, total_len + 1, ","); // replace later with NUL
1130  }
1131 
1132  // make the rest of the modlist manipulation unaware that anything happened here
1133  delete [] *modlist;
1134  *modlist = new_modlist;
1135  *len = total_len;
1136 }
1137 #endif /* SCP_UNIX */
1138 
1139 // external entry point into this modules
1140 
1142 // Sets externed variables used for communication cmdline information
1143 {
1144  //getcwd(FreeSpace_Directory, 256); // set the directory to our fs2 root
1145 
1146  // DO THIS FIRST to avoid unrecognized flag warnings when just getting flag file
1147  if ( get_flags_arg.found() ) {
1148  FILE *fp = fopen("flags.lch","w");
1149 
1150  if (fp == NULL) {
1151  MessageBox(NULL,"Error creating flag list for launcher", "Error", MB_OK);
1152  return false;
1153  }
1154 
1155  int easy_flag_size = sizeof(EasyFlag);
1156  int flag_size = sizeof(Flag);
1157 
1158  int num_easy_flags = sizeof(easy_flags) / easy_flag_size;
1159  int num_flags = sizeof(exe_params) / flag_size;
1160 
1161  // Launcher will check its using structures of the same size
1162  fwrite(&easy_flag_size, sizeof(int), 1, fp);
1163  fwrite(&flag_size, sizeof(int), 1, fp);
1164 
1165  fwrite(&num_easy_flags, sizeof(int), 1, fp);
1166  fwrite(&easy_flags, sizeof(easy_flags), 1, fp);
1167 
1168  fwrite(&num_flags, sizeof(int), 1, fp);
1169  fwrite(&exe_params, sizeof(exe_params), 1, fp);
1170 
1171  {
1172  // cheap and bastardly cap check for builds
1173  // (needs to be compatible with older Launchers, which means having
1174  // this implies an OpenAL build for old Launchers)
1175  ubyte build_caps = 0;
1176 
1177  /* portej05 defined this always */
1178  build_caps |= BUILD_CAP_OPENAL;
1179  build_caps |= BUILD_CAP_NO_D3D;
1180  build_caps |= BUILD_CAP_NEW_SND;
1181 
1182 
1183  fwrite(&build_caps, 1, 1, fp);
1184  }
1185 
1186  fflush(fp);
1187  fclose(fp);
1188 
1189  return false;
1190  }
1191 
1192  if (no_fpscap.found())
1193  {
1194  Cmdline_NoFPSCap = 1;
1195  }
1196 
1198  {
1200  }
1201 
1203  {
1205  }
1206 
1207 #ifdef Allow_NoWarn
1208  if (nowarn_arg.found())
1209  {
1210  Cmdline_nowarn = 1;
1211  }
1212 #endif
1213 
1214  if (extra_warn_arg.found())
1215  {
1216  Cmdline_extra_warn = 1;
1217  }
1218 
1219  if ( missioncrcspew_arg.found() ) {
1221 
1222  // strip off blank space at end if it's there
1223  if ( Cmdline_spew_mission_crcs[strlen(Cmdline_spew_mission_crcs)-1] == ' ' ) {
1225  }
1226  }
1227 
1228  if ( tablecrcspew_arg.found() ) {
1230 
1231  // strip off blank space at end if it's there
1232  if ( Cmdline_spew_table_crcs[strlen(Cmdline_spew_table_crcs)-1] == ' ' ) {
1234  }
1235  }
1236 
1237  if (!Fred_running) { //There is no standalone FRED
1238  // is this a standalone server??
1239  if (standalone_arg.found()) {
1240  Is_standalone = 1;
1241  }
1242  }
1243 
1244  // object update control
1245  if(objupd_arg.found()){
1247  if (Cmdline_objupd < 0)
1248  {
1249  Cmdline_objupd = 0;
1250  }
1251  if (Cmdline_objupd > 3)
1252  {
1253  Cmdline_objupd = 3;
1254  }
1255  }
1256 
1257  if(mpnoreturn_arg.found()) {
1258  Cmdline_mpnoreturn = 1;
1259  }
1260 
1261  // run with no sound
1262  if ( nosound_arg.found() ) {
1264  // and since music is automatically unusable...
1266  }
1267 
1268  // run with no music
1269  if ( nomusic_arg.found() ) {
1271  }
1272 
1273  // Disable enhanced sound
1274  if (noenhancedsound_arg.found()) {
1276  }
1277 
1278  // should we start a network game
1279  if ( startgame_arg.found() ) {
1282  }
1283 
1284  // closed network game
1285  if ( gameclosed_arg.found() ) {
1286  Cmdline_closed_game = 1;
1287  }
1288 
1289  // restircted network game
1290  if ( gamerestricted_arg.found() ) {
1292  }
1293 
1294  // get the name of the network game
1295  if ( gamename_arg.found() ) {
1297 
1298  // be sure that this string fits in our limits
1299  if ( strlen(Cmdline_game_name) > MAX_GAMENAME_LEN ) {
1301  }
1302  }
1303 
1304  // get the password for a pssword game
1305  if ( gamepassword_arg.found() ) {
1307 
1308  // be sure that this string fits in our limits
1309  if ( strlen(Cmdline_game_name) > MAX_PASSWD_LEN ) {
1311  }
1312  }
1313 
1314  // set the rank above/below arguments
1315  if ( allowabove_arg.found() ) {
1317  }
1318  if ( allowbelow_arg.found() ) {
1320  }
1321 
1322  // get the port number for games
1323  if ( port_arg.found() ) {
1325  }
1326 
1327  // the connect argument specifies to join a game at this particular address
1328  if ( connect_arg.found() ) {
1331  }
1332 
1333  // see if the multilog flag was set
1334  if ( multilog_arg.found() ){
1335  Cmdline_multi_log = 1;
1336  }
1337 
1338 
1339  // maybe use old-school client damage
1340  if(client_dodamage.found()){
1342  }
1343 
1344  // spew pof info
1345  if(pof_spew.found()){
1347  }
1348 
1349  // mouse coords
1350  if(mouse_coords.found()){
1352  }
1353 
1354  // net timeout
1355  if(timeout.found()){
1356  Cmdline_timeout = timeout.get_int();
1357  }
1358 
1359  // d3d windowed
1360  if(window_arg.found()){
1361  Cmdline_window = 1;
1362  }
1363 
1364  if ( fullscreen_window_arg.found( ) )
1365  {
1366 #ifdef WIN32
1368  Cmdline_window = 0; /* Make sure no-one sets both */
1369 #endif
1370  }
1371 
1372  if(res_arg.found()){
1373  Cmdline_res = res_arg.str();
1374  }
1375  if(center_res_arg.found()){
1377  }
1378  if(almission_arg.found()){//DTP for autoload mission // developer oritentated
1382  }
1383 
1384  if(dualscanlines_arg.found() ) {
1386  }
1387 
1388  if(targetinfo_arg.found())
1389  {
1390  Cmdline_targetinfo = 1;
1391  }
1392 
1393  if(nomovies_arg.found() ) {
1394  Cmdline_nomovies = 1;
1395  }
1396 
1397  if ( noscalevid_arg.found() ) {
1398  Cmdline_noscalevid = 1;
1399  }
1400 
1401  if(noparseerrors_arg.found()) {
1403  }
1404 
1405 
1406  if(mod_arg.found() ) {
1407  Cmdline_mod = mod_arg.str();
1408 
1409  // strip off blank space it it's there
1410  if ( Cmdline_mod[strlen(Cmdline_mod)-1] == ' ' ) {
1411  Cmdline_mod[strlen(Cmdline_mod)-1] = '\0';
1412  }
1413 
1414  // Ok - mod stacking support
1415  int len = strlen(Cmdline_mod);
1416  char *modlist = new char[len+2];
1417  memset( modlist, 0, len + 2 );
1418  strcpy_s(modlist, len+2, Cmdline_mod);
1419 
1420 #ifdef SCP_UNIX
1421  // handle case-insensitive searching
1422  handle_unix_modlist(&modlist, &len);
1423 #endif
1424 
1425  // null terminate each individual
1426  for (int i = 0; i < len; i++)
1427  {
1428  if (modlist[i] == ',')
1429  modlist[i] = '\0';
1430  }
1431 
1432  //copy over - we don't have to delete[] Cmdline_mod because it's a pointer to an automatic global char*
1433  Cmdline_mod = modlist;
1434  }
1435 
1436 
1437  if (fps_arg.found())
1438  {
1439  Show_framerate = 1;
1440  }
1441 
1442  if(pos_arg.found())
1443  {
1444  Cmdline_show_pos = 1;
1445  }
1446 
1447  if ( nomotiondebris_arg.found() ) {
1449  }
1450 
1451  if( mipmap_arg.found() ) {
1452  Cmdline_mipmap = 1;
1453  }
1454 
1455  if( stats_arg.found() ) {
1456  Cmdline_show_stats = 1;
1457  }
1458 
1459  if ( fov_arg.found() ) {
1461  if (Cmdline_fov > 0.1) {
1463  } else {
1464  VIEWER_ZOOM_DEFAULT = Cmdline_fov = 0.75f;
1465  }
1466  }
1467 
1468  if( clip_dist_arg.found() ) {
1470  }
1471 
1472  if (orb_radar.found())
1473  {
1474  Cmdline_orb_radar = 1;
1475  }
1476 
1477  if ( use_3dwarp.found() ) {
1478  Cmdline_3dwarp = 1;
1479  }
1480 
1481  if ( use_warp_flash.found() ) {
1482  Cmdline_warp_flash = 1;
1483  }
1484 
1485  if ( allow_autpilot_interrupt.found() ) {
1487  }
1488 
1489  if ( stretch_menu.found() ) {
1491  }
1492  // specular comand lines
1493  if ( spec_exp_arg.found() ) {
1495  }
1496 
1497  if ( spec_point_arg.found() ) {
1499  }
1500 
1501  if ( spec_static_arg.found() ) {
1503  }
1504 
1505  if ( spec_tube_arg.found() ) {
1507  }
1508 
1509  if ( spec_arg.found() )
1510  {
1511  Cmdline_spec = 0;
1512  }
1513 
1514  if ( htl_arg.found() )
1515  {
1516  Cmdline_nohtl = 1;
1517  }
1518 
1519  if( no_set_gamma_arg.found() )
1520  {
1522  }
1523 
1524  if(no_vsync_arg.found() )
1525  {
1526  Cmdline_no_vsync = 1;
1527  }
1528 
1529 #ifdef SCP_UNIX
1530  // no key/mouse grab
1531  if(no_grab.found()){
1532  Cmdline_no_grab = 1;
1533  }
1534 #endif
1535 
1536  if ( normal_arg.found() ) {
1537  Cmdline_normal = 0;
1538  }
1539 
1540  if ( height_arg.found() ) {
1541  Cmdline_height = 0;
1542  }
1543 
1544  if ( noglsl_arg.found() ) {
1545  Cmdline_noglsl = 1;
1546  }
1547 
1548  if (fxaa_arg.found() ) {
1549  Cmdline_fxaa = true;
1550 
1551  if (fxaa_preset_arg.found()) {
1553  }
1554 
1556  }
1557 
1558  if (no_di_mouse_arg.found() ) {
1559  Cmdline_no_di_mouse = 1;
1560  }
1561 
1562  if ( glow_arg.found() )
1563  Cmdline_glow = 0;
1564 
1565  if ( query_speech_arg.found() )
1567 
1568  if ( ship_choice_3d_arg.found() )
1570 
1571  if ( weapon_choice_3d_arg.found() )
1573 
1574  if ( show_mem_usage_arg.found() )
1576 
1577  if (ingamejoin_arg.found() )
1578  Cmdline_ingamejoin = 1;
1579 
1580  if ( start_mission_arg.found() ) {
1582  }
1583 
1584  if ( ambient_factor_arg.found() )
1586 
1587  if ( output_scripting_arg.found() )
1588  Output_scripting_meta = true;
1589 
1590  if (output_sexp_arg.found() ) {
1591  output_sexps("sexps.html");
1592  }
1593 
1594  if ( no_vbo_arg.found() )
1595  {
1596  Cmdline_novbo = 1;
1597  }
1598 
1599  if ( no_pbo_arg.found() )
1600  {
1601  Cmdline_no_pbo = 1;
1602  }
1603 
1604  if ( no_drawrangeelements.found() )
1605  {
1607  }
1608 
1609  if( keyboard_layout.found())
1610  {
1612  }
1613 
1614  if (gl_finish.found())
1615  {
1616  Cmdline_gl_finish = true;
1617  }
1618 
1619  if ( no_geo_sdr_effects.found() )
1620  {
1622  }
1623 
1624  if (set_cpu_affinity.found())
1625  {
1626  Cmdline_set_cpu_affinity = true;
1627  }
1628 
1629 #ifdef WIN32
1630  if (fix_registry.found()) {
1631  Cmdline_alternate_registry_path = true;
1632  }
1633 #endif
1634 
1635  if ( snd_preload_arg.found() )
1636  {
1637  Cmdline_snd_preload = 1;
1638  }
1639 
1640  if ( env.found() ) {
1641  Cmdline_env = 0;
1642  }
1643 
1644  if ( ballistic_gauge.found() ) {
1646  }
1647 
1648  if ( cache_bitmaps_arg.found() ) {
1650  }
1651 
1654 
1655  if(dis_collisions.found())
1657 
1658  if(dis_weapons.found())
1659  Cmdline_dis_weapons = 1;
1660 
1661  if ( no_fbo_arg.found() ) {
1662  Cmdline_no_fbo = 1;
1663  }
1664 
1665  if ( noemissive_arg.found() ) {
1666  Cmdline_no_emissive = 1;
1667  }
1668 
1669  if ( ogl_spec_arg.found() ) {
1671 
1672  CLAMP(Cmdline_ogl_spec, 0.0f, 128.0f);
1673  }
1674 
1675  if ( rearm_timer_arg.found() )
1676  Cmdline_rearm_timer = 1;
1677 
1678  if ( missile_lighting_arg.found() )
1680 
1683 
1684  if ( debug_window_arg.found() )
1686 
1687  if ( verify_vps_arg.found() )
1688  Cmdline_verify_vps = 1;
1689 
1690  if ( no3dsound_arg.found() )
1691  Cmdline_no_3d_sound = 1;
1692 
1693  if ( atiswap_arg.found() )
1694  {
1696  }
1697 
1699  {
1701  }
1702 
1703  if ( softparticles_arg.found() )
1704  {
1706  }
1707 
1708  if ( fb_explosions_arg.found() )
1709  {
1711  }
1712 
1713  if ( no_batching.found() )
1714  {
1715  Cmdline_no_batching = true;
1716  }
1717 
1718  if ( brieflighting_arg.found() )
1719  {
1721  }
1722 
1723  if ( postprocess_arg.found() )
1724  {
1725  Cmdline_postprocess = 1;
1726  }
1727 
1728  if ( bloom_intensity_arg.found() )
1729  {
1731  }
1732 
1733  if ( flightshaftsoff_arg.found() )
1734  {
1735  ls_force_off = true;
1736  }
1737 
1738  if( reparse_mainhall_arg.found() )
1739  {
1741  }
1742 
1743  if( enable_shadows_arg.found() )
1744  {
1746  if( shadow_quality_arg.found() )
1747  {
1749  }
1750  }
1751 
1753  {
1755  }
1756 
1757  if (frame_profile_arg.found() )
1758  {
1759  Cmdline_frame_profile = true;
1760  }
1761 
1763  {
1764  Cmdline_frame_profile = true;
1766  }
1767 
1769  {
1770  Cmdline_no_unfocus_pause = true;
1771  }
1772 
1773  if (benchmark_mode_arg.found())
1774  {
1775  Cmdline_benchmark_mode = true;
1776  }
1777 
1778  //Deprecated flags - CommanderDJ
1779  if( deprecated_spec_arg.found() )
1780  {
1782  }
1783 
1784  if( deprecated_glow_arg.found() )
1785  {
1787  }
1788 
1790  {
1792  }
1793 
1794  if( deprecated_env_arg.found() )
1795  {
1797  }
1798 
1799  if( deprecated_tbp_arg.found() )
1800  {
1802  }
1803 
1805  {
1807  }
1808 
1809  return true;
1810 }
1811 
1812 
1813 int fred2_parse_cmdline(int argc, char *argv[])
1814 {
1815  if (argc > 1) {
1816  // kind of silly -- combine arg list into single string for parsing,
1817  // but it fits with the win32-centric existing code.
1818  char *cmdline = NULL;
1819  unsigned int arglen = 0;
1820  int i;
1821  for (i = 1; i < argc; i++)
1822  arglen += strlen(argv[i]);
1823  if (argc > 2)
1824  arglen += argc + 2; // leave room for the separators
1825  cmdline = new char [arglen+1];
1826  i = 1;
1827 
1828  strcpy_s(cmdline, arglen+1, argv[i]);
1829  for (i=2; i < argc; i++) {
1830  strcat_s(cmdline, arglen+1, " ");
1831  strcat_s(cmdline, arglen+1, argv[i]);
1832  }
1833  os_init_cmdline(cmdline);
1834  delete [] cmdline;
1835  } else {
1836  // no cmdline args
1837  os_init_cmdline("");
1838  }
1839 
1840  return SetCmdlineParams();
1841 }
1842 
1843 
1844 int parse_cmdline(char *cmdline)
1845 {
1846 // mprintf(("I got to parse_cmdline()!!\n"));
1847 
1848  os_init_cmdline(cmdline);
1849 
1850  // --------------- Kazan -------------
1851  // If you're looking for the list of if (someparam.found()) { cmdline_someparam = something; } look above at this function
1852  // I did this because of fred2_parse_cmdline()
1853  return SetCmdlineParams();
1854 }
1855 
1856 const char * get_param_desc(const char *flag_name)
1857 {
1858  int i;
1859  int flag_size = sizeof(Flag);
1860  int num_flags = sizeof(exe_params) / flag_size;
1861  for (i = 0; i < num_flags; ++i) {
1862  if (!strcmp(flag_name, exe_params[i].name)) {
1863  return exe_params[i].desc;
1864  }
1865  }
1866  return "UNKNOWN - FIXME!";
1867 }
int filelength(int fd)
char * Cmdline_connect_addr
Definition: cmdline.cpp:263
GLuint64EXT * result
Definition: Glext.h:10775
#define MB_OKCANCEL
Definition: config.h:180
bool Cmdline_brief_lighting
Definition: cmdline.cpp:343
int i
Definition: multi_pxo.cpp:466
const char * name
Definition: cmdline.cpp:58
cmdline_parm no_di_mouse_arg("-disable_di_mouse","Disable DirectInput mouse code (Windows only)", AT_NONE)
cmdline_parm reparse_mainhall_arg("-reparse_mainhall", NULL, AT_NONE)
int is_extra_space(char ch)
Definition: cmdline.cpp:594
cmdline_parm no3dsound_arg("-no_3d_sound", NULL, AT_NONE)
int Cmdline_freespace_no_music
Definition: cmdline.cpp:271
cmdline_parm dualscanlines_arg("-dualscanlines", NULL, AT_NONE)
char * Cmdline_keyboard_layout
Definition: cmdline.cpp:449
EasyFlag easy_flags[]
Definition: cmdline.cpp:108
int Cmdline_3dwarp
Definition: cmdline.cpp:377
cmdline_parm mod_arg("-mod","List of folders to overwrite/add-to the default data", AT_STRING, true)
int Cmdline_dualscanlines
Definition: cmdline.cpp:364
cmdline_parm gamerestricted_arg("-restricted", NULL, AT_NONE)
cmdline_parm extra_warn_arg("-extra_warn","Enable 'extra' warnings", AT_NONE)
bool Cmdline_no_unfocus_pause
Definition: cmdline.cpp:513
cmdline_parm fps_arg("-fps", NULL, AT_NONE)
int Cmdline_noglsl
Definition: cmdline.cpp:444
int Cmdline_old_collision_sys
Definition: cmdline.cpp:489
int Cmdline_deprecated_spec
Definition: cmdline.cpp:529
cmdline_parm allowabove_arg("-allowabove","Ranks above this can join multi", AT_STRING)
cmdline_parm verify_vps_arg("-verify_vps", NULL, AT_NONE)
#define MAX_PATH
cmdline_parm startgame_arg("-startgame", NULL, AT_NONE)
cmdline_parm htl_arg("-nohtl", NULL, AT_NONE)
int Fred_running
Definition: fred.cpp:44
int Cmdline_query_speech
Definition: cmdline.cpp:389
cmdline_parm ballistic_gauge("-ballistic_gauge", NULL, AT_NONE)
cmdline_parm noparseerrors_arg("-noparseerrors", NULL, AT_NONE)
int Cmdline_weapon_choice_3d
Definition: cmdline.cpp:379
int Cmdline_missile_lighting
Definition: cmdline.cpp:325
int Cmdline_no_enhanced_sound
Definition: cmdline.cpp:392
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
int Fxaa_preset_last_frame
int Cmdline_load_all_weapons
Definition: cmdline.cpp:437
char * Cmdline_almission
Definition: cmdline.cpp:407
int Cmdline_noscalevid
Definition: cmdline.cpp:328
#define mprintf(args)
Definition: pstypes.h:238
int Cmdline_cache_bitmaps
Definition: cmdline.cpp:352
cmdline_parm fov_arg("-fov","Vertical field-of-view factor", AT_FLOAT)
int Cmdline_softparticles
Definition: cmdline.cpp:334
cmdline_parm rearm_timer_arg("-rearm_timer", NULL, AT_NONE)
#define BUILD_CAP_NO_D3D
Definition: cmdline.cpp:96
cmdline_parm spec_exp_arg("-spec_exp","Adjusts the size of shiny spots on ships", AT_FLOAT)
int Cmdline_spec
Definition: cmdline.cpp:329
int Cmdline_start_netgame
Definition: cmdline.cpp:280
int Cmdline_deprecated_tbp
Definition: cmdline.cpp:533
int Cmdline_show_stats
Definition: cmdline.cpp:499
bool SetCmdlineParams()
Definition: cmdline.cpp:1141
cmdline_parm pos_arg("-pos", NULL, AT_NONE)
cmdline_parm height_arg("-noheight", NULL, AT_NONE)
#define MB_ICONQUESTION
Definition: config.h:188
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL, AT_NONE)
cmdline_parm fxaa_arg("-fxaa", NULL, AT_NONE)
bool output_sexps(char *filepath)
Definition: sexp.cpp:33901
bool Cmdline_profile_write_file
Definition: cmdline.cpp:512
#define FS_VERSION_MAJOR
Definition: version.h:37
int Cmdline_mpnoreturn
Definition: cmdline.cpp:409
char * Cmdline_game_name
Definition: cmdline.cpp:264
GLclampf f
Definition: Glext.h:7097
int Cmdline_ati_color_swap
Definition: cmdline.cpp:445
const char * Osreg_user_dir
cmdline_parm noglsl_arg("-no_glsl", NULL, AT_NONE)
bool Cmdline_fb_explosions
Definition: cmdline.cpp:340
cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING,"Ignore any cmdline_fso.cfg files", AT_NONE)
#define Assertion(expr, msg,...)
Definition: clang.h:41
cmdline_parm debug_window_arg("-debug_window", NULL, AT_NONE)
cmdline_parm loadallweapons_arg("-loadallweps", NULL, AT_NONE)
bool ls_force_off
cmdline_parm allow_autpilot_interrupt("-no_ap_interrupt", NULL, AT_NONE)
float Cmdline_fov
Definition: cmdline.cpp:320
int Cmdline_no_pbo
Definition: cmdline.cpp:443
int name_found
Definition: cmdline.cpp:62
cmdline_parm noscalevid_arg("-noscalevid", NULL, AT_NONE)
cmdline_arg_type
Definition: cmdline.cpp:38
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: Glext.h:5156
cmdline_parm gameclosed_arg("-closed", NULL, AT_NONE)
cmdline_parm missioncrcspew_arg("-missioncrcs", NULL, AT_STRING)
cmdline_parm missile_lighting_arg("-missile_lighting", NULL, AT_NONE)
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
char desc[40]
Definition: cmdline.cpp:121
int off_flags
Definition: cmdline.cpp:124
const char * detect_home(void)
Definition: osapi.cpp:101
GLsizeiptr size
Definition: Glext.h:5496
#define Int3()
Definition: pstypes.h:292
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL, AT_NONE)
void os_parse_parms(char *cmdline)
Definition: cmdline.cpp:693
bool Cmdline_gl_finish
Definition: cmdline.cpp:450
cmdline_parm deprecated_normal_arg("-normal","Deprecated", AT_NONE)
bool Cmdline_frame_profile
Definition: cmdline.cpp:511
char * Cmdline_spew_mission_crcs
Definition: cmdline.cpp:410
int Cmdline_ambient_factor
Definition: cmdline.cpp:322
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
cmdline_parm postprocess_arg("-post_process", NULL, AT_NONE)
cmdline_parm(const char *name, const char *help, const int arg_type, const bool stacks=false)
Definition: cmdline.cpp:931
cmdline_parm use_3dwarp("-3dwarp", NULL, AT_NONE)
GLenum type
Definition: Gl.h:1492
#define CLAMP(x, min, max)
Definition: pstypes.h:488
int Cmdline_show_mem_usage
Definition: cmdline.cpp:497
double specular_exponent_value
Definition: lighting.cpp:747
cmdline_parm targetinfo_arg("-targetinfo", NULL, AT_NONE)
int Cmdline_env
Definition: cmdline.cpp:323
void parm_stuff_args(cmdline_parm *parm, char *cmdline)
Definition: cmdline.cpp:633
int Cmdline_nomotiondebris
Definition: cmdline.cpp:327
cmdline_parm window_arg("-window", NULL, AT_NONE)
bool Cmdline_no_batching
Definition: cmdline.cpp:341
cmdline_parm no_fpscap("-no_fps_capping","Don't limit frames-per-second", AT_NONE)
cmdline_parm deprecated_env_arg("-env","Deprecated", AT_NONE)
cmdline_parm brieflighting_arg("-brief_lighting", NULL, AT_NONE)
cmdline_parm * prev
Definition: cmdline.cpp:57
const float Default_min_draw_distance
Definition: 2d.cpp:82
int parse_cmdline(char *cmdline)
Definition: cmdline.cpp:1844
int Cmdline_height
Definition: cmdline.cpp:332
char * drop_extra_chars(char *str)
Definition: cmdline.cpp:601
GLintptr offset
Definition: Glext.h:5497
cmdline_parm gl_finish("-gl_finish", NULL, AT_NONE)
int Cmdline_nohtl
Definition: cmdline.cpp:438
int Cmdline_orb_radar
Definition: cmdline.cpp:365
#define BUILD_CAP_OPENAL
Definition: cmdline.cpp:95
int Cmdline_deprecated_normal
Definition: cmdline.cpp:531
char * Cmdline_rank_above
Definition: cmdline.cpp:266
cmdline_parm allowbelow_arg("-allowbelow","Ranks below this can join multi", AT_STRING)
int Cmdline_closed_game
Definition: cmdline.cpp:270
cmdline_parm show_mem_usage_arg("-show_mem_usage", NULL, AT_NONE)
cmdline_parm start_mission_arg("-start_mission","Skip mainhall and run this mission", AT_STRING)
int Cmdline_autopilot_interruptable
Definition: cmdline.cpp:381
int Cmdline_spew_pof_info
Definition: cmdline.cpp:279
cmdline_parm orb_radar("-orbradar", NULL, AT_NONE)
#define PARSE_COMMAND_LINE_STRING
Definition: cmdline.cpp:99
bool fso_only
Definition: cmdline.cpp:122
int Cmdline_normal
Definition: cmdline.cpp:331
int Cmdline_ship_choice_3d
Definition: cmdline.cpp:378
int found()
Definition: cmdline.cpp:981
float static_point_factor
Definition: lighting.cpp:746
const int arg_type
Definition: cmdline.cpp:63
cmdline_parm shadow_quality_arg("-shadow_quality", NULL, AT_INT)
cmdline_parm query_speech_arg("-query_speech", NULL, AT_NONE)
cmdline_parm nomusic_arg("-nomusic", NULL, AT_NONE)
void cmdline_debug_print_cmdline()
Definition: cmdline.cpp:538
cmdline_parm ingamejoin_arg("-ingame_join", NULL, AT_NONE)
cmdline_parm dis_weapons("-dis_weapons", NULL, AT_NONE)
cmdline_parm ship_choice_3d_arg("-ship_choice_3d", NULL, AT_NONE)
int Cmdline_gimme_all_medals
Definition: cmdline.cpp:273
int Cmdline_enable_3d_shockwave
Definition: cmdline.cpp:333
int Cmdline_deprecated_glow
Definition: cmdline.cpp:530
int Cmdline_glow
Definition: cmdline.cpp:326
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
const char * help
Definition: cmdline.cpp:59
cmdline_parm enable_shadows_arg("-enable_shadows", NULL, AT_NONE)
cmdline_parm stretch_menu("-stretch_menu", NULL, AT_NONE)
int Cmdline_mouse_coords
Definition: cmdline.cpp:274
float static_light_factor
Definition: lighting.cpp:744
cmdline_parm mipmap_arg("-mipmap", NULL, AT_NONE)
cmdline_parm bit32_arg("-32bit","Deprecated", AT_NONE)
cmdline_parm mpnoreturn_arg("-mpnoreturn", NULL, AT_NONE)
GLuint buffer
Definition: Glext.h:5492
cmdline_parm ogl_spec_arg("-ogl_spec","Shininess of specular light", AT_FLOAT)
#define MB_OK
Definition: config.h:179
#define FS_VERSION_MINOR
Definition: version.h:38
GLdouble s
Definition: Glext.h:5321
cmdline_parm no_pbo_arg("-disable_pbo", NULL, AT_NONE)
int Cmdline_mipmap
Definition: cmdline.cpp:324
int Cmdline_deprecated_env
Definition: cmdline.cpp:532
#define BUILD_CAP_NEW_SND
Definition: cmdline.cpp:97
int Cmdline_objupd
Definition: cmdline.cpp:412
int Cmdline_network_port
Definition: cmdline.cpp:277
int Cmdline_nomovies
Definition: cmdline.cpp:439
cfbp fp
Definition: cfile.cpp:1065
cmdline_parm standalone_arg("-standalone", NULL, AT_NONE)
int Cmdline_window
Definition: cmdline.cpp:502
cmdline_parm spec_static_arg("-spec_static","Adjusts suns contribution to specular highlights", AT_FLOAT)
cmdline_parm noenhancedsound_arg("-no_enhanced_sound", NULL, AT_NONE)
int Cmdline_bloom_intensity
Definition: cmdline.cpp:336
int Cmdline_restricted_game
Definition: cmdline.cpp:278
cmdline_parm frame_profile_write_file("-profile_write_file", NULL, AT_NONE)
char * Cmdline_rank_below
Definition: cmdline.cpp:267
char * Cmdline_center_res
Definition: cmdline.cpp:505
int Cmdline_ingamejoin
Definition: cmdline.cpp:408
int Cmdline_shadow_quality
Definition: cmdline.cpp:344
int Cmdline_no_deferred_lighting
Definition: cmdline.cpp:345
cmdline_parm normal_arg("-nonormal", NULL, AT_NONE)
cmdline_parm frame_profile_arg("-profile_frame_time", NULL, AT_NONE)
unsigned char ubyte
Definition: pstypes.h:62
int Cmdline_no_di_mouse
Definition: cmdline.cpp:447
GLbitfield GLuint64 timeout
Definition: Glext.h:6725
cmdline_parm dis_collisions("-dis_collisions", NULL, AT_NONE)
int Cmdline_fullscreen_window
Definition: cmdline.cpp:503
cmdline_parm noemissive_arg("-no_emissive_light","Disable emissive light from ships", AT_NONE)
cmdline_parm benchmark_mode_arg("-benchmark_mode", NULL, AT_NONE)
cmdline_parm gamepassword_arg("-password","Set multiplayer game password", AT_STRING)
#define NOX(s)
Definition: pstypes.h:473
cmdline_parm no_fbo_arg("-disable_fbo", NULL, AT_NONE)
const char * get_param_desc(const char *flag_name)
Definition: cmdline.cpp:1856
cmdline_parm voice_recognition_arg("-voicer", NULL, AT_NONE)
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
int Cmdline_voice_recognition
Definition: cmdline.cpp:391
cmdline_parm multilog_arg("-multilog", NULL, AT_NONE)
cmdline_parm no_vsync_arg("-no_vsync", NULL, AT_NONE)
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
int on_flags
Definition: cmdline.cpp:123
cmdline_parm deprecated_jpgtga_arg("-jpgtga","Deprecated", AT_NONE)
int Cmdline_no_vsync
Definition: cmdline.cpp:354
GLuint const GLchar * name
Definition: Glext.h:5608
cmdline_parm set_cpu_affinity("-set_cpu_affinity", NULL, AT_NONE)
cmdline_parm output_scripting_arg("-output_scripting", NULL, AT_NONE)
cmdline_parm no_vbo_arg("-novbo", NULL, AT_NONE)
Flag exe_params[]
Definition: cmdline.cpp:131
#define MAX_PATH_LEN
Definition: pstypes.h:325
cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL, AT_NONE)
int Cmdline_debug_window
Definition: cmdline.cpp:501
cmdline_parm port_arg("-port","Multiplayer network port", AT_INT)
int Cmdline_no_emissive
Definition: cmdline.cpp:330
int Cmdline_snd_preload
Definition: cmdline.cpp:390
cmdline_parm clip_dist_arg("-clipdist","Changes the distance from the viewpoint for the near-clipping plane", AT_FLOAT)
#define GetCurrentDirectory(i, s)
Definition: config.h:224
int Cmdline_no_set_gamma
Definition: cmdline.cpp:440
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL, AT_NONE)
int Cmdline_deprecated_jpgtga
Definition: cmdline.cpp:534
int Cmdline_drawelements
Definition: cmdline.cpp:448
#define MAX_PASSWD_LEN
Definition: multi.h:90
int Cmdline_cd_check
Definition: cmdline.cpp:268
#define strcat_s(...)
Definition: safe_strings.h:68
#define FS_VERSION_REVIS
Definition: version.h:40
float Cmdline_clip_dist
Definition: cmdline.cpp:319
int Cmdline_freespace_no_sound
Definition: cmdline.cpp:272
int Cmdline_dis_weapons
Definition: cmdline.cpp:491
float get_float()
Definition: cmdline.cpp:1012
int Cmdline_NoFPSCap
Definition: cmdline.cpp:353
int Cmdline_dis_collisions
Definition: cmdline.cpp:490
int Cmdline_multi_log
Definition: cmdline.cpp:275
cmdline_parm client_dodamage("-clientdamage", NULL, AT_NONE)
char * Cmdline_start_mission
Definition: cmdline.cpp:488
cmdline_parm deprecated_spec_arg("-spec","Deprecated", AT_NONE)
cmdline_parm enable_3d_shockwave_arg("-3dshockwave", NULL, AT_NONE)
cmdline_parm stats_arg("-stats", NULL, AT_NONE)
int fred2_parse_cmdline(int argc, char *argv[])
Definition: cmdline.cpp:1813
int get_int()
Definition: cmdline.cpp:987
float Min_draw_distance
Definition: 2d.cpp:84
char * str()
Definition: cmdline.cpp:1037
void help()
cmdline_parm pof_spew("-pofspew", NULL, AT_NONE)
cmdline_parm keyboard_layout("-keyboard_layout","Specify keyboard layout (qwertz or azerty)", AT_STRING)
cmdline_parm fxaa_preset_arg("-fxaa_preset","FXAA quality (0-9), requires -post_process and -fxaa", AT_INT)
void os_validate_parms(char *cmdline)
Definition: cmdline.cpp:738
void os_init_cmdline(char *cmdline)
Definition: cmdline.cpp:829
#define MAX_GAMENAME_LEN
Definition: multi.h:88
float static_tube_factor
Definition: lighting.cpp:745
cmdline_parm mouse_coords("-coords", NULL, AT_NONE)
cmdline_parm weapon_choice_3d_arg("-weapon_choice_3d", NULL, AT_NONE)
GLfloat GLfloat p
Definition: Glext.h:8373
cmdline_parm ambient_factor_arg("-ambient_factor","Adjusts ambient light applied to all parts of a ship", AT_INT)
#define LOCATION
Definition: pstypes.h:245
int Cmdline_client_dodamage
Definition: cmdline.cpp:269
bool Output_scripting_meta
Definition: scripting.cpp:21
int MessageBox(HWND h, const char *s1, const char *s2, int i)
cmdline_parm res_arg("-res","Resolution, formatted like 1600x900", AT_STRING)
char * Cmdline_spew_table_crcs
Definition: cmdline.cpp:411
int Show_framerate
Definition: fredstubs.cpp:215
cmdline_parm no_unfocused_pause_arg("-no_unfocused_pause", NULL, AT_NONE)
bool Cmdline_set_cpu_affinity
Definition: cmdline.cpp:452
char * Cmdline_res
Definition: cmdline.cpp:504
float Cmdline_ogl_spec
Definition: cmdline.cpp:321
const bool stacks
Definition: cmdline.cpp:60
int Cmdline_fxaa_preset
Definition: cmdline.cpp:338
cmdline_parm glow_arg("-noglow", NULL, AT_NONE)
int Cmdline_verify_vps
Definition: cmdline.cpp:506
cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL, AT_NONE)
int Cmdline_rearm_timer
Definition: cmdline.cpp:366
cmdline_parm objupd_arg("-cap_object_update","Multiplayer object update cap (0-3)", AT_INT)
int Cmdline_show_pos
Definition: cmdline.cpp:498
int Cmdline_no_fbo
Definition: cmdline.cpp:442
cmdline_parm use_warp_flash("-warp_flash", NULL, AT_NONE)
GLenum GLsizei len
Definition: Glext.h:6283
#define FS_VERSION_BUILD
Definition: version.h:39
void _cdecl void void _cdecl void _cdecl void _cdecl void _cdecl ReleaseWarning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
cmdline_parm save_render_targets_arg("-save_render_target", NULL, AT_NONE)
int Cmdline_targetinfo
Definition: cmdline.cpp:367
int Cmdline_postprocess
Definition: cmdline.cpp:335
cmdline_parm connect_arg("-connect","Automatically connect to multiplayer IP:PORT", AT_STRING)
cmdline_parm env("-noenv", NULL, AT_NONE)
bool Cmdline_no_geo_sdr_effects
Definition: cmdline.cpp:451
cmdline_parm nomovies_arg("-nomovies", NULL, AT_NONE)
int Cmdline_novbo
Definition: cmdline.cpp:441
cmdline_parm deprecated_glow_arg("-glow","Deprecated", AT_NONE)
cmdline_parm atiswap_arg("-ati_swap", NULL, AT_NONE)
int Cmdline_use_last_pilot
Definition: cmdline.cpp:282
int Cmdline_timeout
Definition: cmdline.cpp:281
cmdline_parm spec_point_arg("-spec_point","Adjusts laser weapons contribution to specular highlights", AT_FLOAT)
char * args
Definition: cmdline.cpp:61
cmdline_parm bloom_intensity_arg("-bloom_intensity","Set bloom intensity, requires -post_process", AT_INT)
int Cmdline_no_3d_sound
Definition: cmdline.cpp:446
char * Cmdline_mod
Definition: cmdline.cpp:397
int Cmdline_noparseerrors
Definition: cmdline.cpp:492
cmdline_parm fullscreen_window_arg("-fullscreen_window","Fullscreen/borderless window (Windows only)", AT_NONE)
int Cmdline_save_render_targets
Definition: cmdline.cpp:500
cmdline_parm tablecrcspew_arg("-tablecrcs", NULL, AT_STRING)
char * Cmdline_game_password
Definition: cmdline.cpp:265
cmdline_parm get_flags_arg("-get_flags","Output the launcher flags file", AT_NONE)
const char * cmdline_arg_types[]
Definition: cmdline.cpp:46
cmdline_parm deprecated_tbp_arg("-tbp","Deprecated", AT_NONE)
bool Cmdline_fxaa
Definition: cmdline.cpp:337
cmdline_parm center_res_arg("-center_res","Resolution of center monitor, formatted like 1600x900", AT_STRING)
cmdline_parm almission_arg("-almission","Autoload multiplayer mission", AT_STRING)
int Cmdline_stretch_menu
Definition: cmdline.cpp:382
int Cmdline_reparse_mainhall
Definition: cmdline.cpp:510
int Cmdline_multi_stream_chat_to_file
Definition: cmdline.cpp:276
#define stricmp(s1, s2)
Definition: config.h:271
cmdline_parm fb_explosions_arg("-fb_explosions", NULL, AT_NONE)
int Cmdline_extra_warn
Definition: cmdline.cpp:496
cmdline_parm timeout("-timeout","Multiplayer network timeout (secs)", AT_INT)
int Cmdline_ballistic_gauge
Definition: cmdline.cpp:363
cmdline_parm snd_preload_arg("-snd_preload", NULL, AT_NONE)
cmdline_parm old_collision_system("-old_collision", NULL, AT_NONE)
cmdline_parm softparticles_arg("-soft_particles", NULL, AT_NONE)
cmdline_parm no_batching("-no_batching", NULL, AT_NONE)
float VIEWER_ZOOM_DEFAULT
Definition: camera.cpp:15
GLuint GLuint end
Definition: Gl.h:1502
bool Cmdline_benchmark_mode
Definition: cmdline.cpp:514
cmdline_parm nosound_arg("-nosound", NULL, AT_NONE)
cmdline_parm * next
Definition: cmdline.cpp:57
cmdline_parm output_sexp_arg("-output_sexps", NULL, AT_NONE)
cmdline_parm spec_tube_arg("-spec_tube","Adjusts beam weapons contribution to specular highlights", AT_FLOAT)
#define strcpy_s(...)
Definition: safe_strings.h:67
int Is_standalone
Definition: systemvars.cpp:59
cmdline_parm no_deferred_lighting_arg("-no_deferred", NULL, AT_NONE)
cmdline_parm spec_arg("-nospec", NULL, AT_NONE)
int Cmdline_warp_flash
Definition: cmdline.cpp:380
bool check_if_args_is_valid()
Definition: cmdline.cpp:966
cmdline_parm gamename_arg("-gamename","Set multiplayer game name", AT_STRING)
cmdline_parm no_geo_sdr_effects("-no_geo_effects", NULL, AT_NONE)