26 #elif defined(APPLE_APP)
27 #include <CoreFoundation/CoreFoundation.h>
65 cmdline_parm(
const char *name,
const char *help,
const int arg_type,
const bool stacks =
false);
75 static int Parm_list_inited = 0;
95 #define BUILD_CAP_OPENAL (1<<0)
96 #define BUILD_CAP_NO_D3D (1<<1)
97 #define BUILD_CAP_NEW_SND (1<<2)
99 #define PARSE_COMMAND_LINE_STRING "-parse_cmdline_only"
111 {
"Default FS2 (All features off)" },
112 {
"All features on" },
113 {
"High memory usage features on" },
114 {
"High memory usage features off" }
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", },
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", },
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", },
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", },
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", },
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", },
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", },
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",
"", },
201 {
"-fix_registry",
"Use a different registry path",
true, 0,
EASY_DEFAULT,
"Troubleshoot",
"", },
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", },
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", },
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", },
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", },
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", },
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", },
454 bool Cmdline_alternate_registry_path =
false;
494 int Cmdline_nowarn = 0;
508 int Cmdline_no_grab = 0;
542 mprintf((
"Passed cmdline options:"));
546 if ( parmp->
args != NULL ) {
563 mprintf((
"Deprecated flag '-spec' found. Please remove from your cmdline.\n"));
568 mprintf((
"Deprecated flag '-glow' found. Please remove from your cmdline.\n"));
573 mprintf((
"Deprecated flag '-normal' found. Please remove from your cmdline.\n"));
578 mprintf((
"Deprecated flag '-env' found. Please remove from your cmdline.\n"));
583 mprintf((
"Deprecated flag '-tbp' found. Please remove from your cmdline.\n"));
588 mprintf((
"Deprecated flag '-jpgtga' found. Please remove from your cmdline.\n"));
596 return ((ch ==
' ') || (ch ==
'\t') || (ch == 0x0a) || (ch ==
'\'') || (ch ==
'\"'));
623 if (e >= s && e !=0 ){
624 memmove(str, str + s, e - s + 1);
636 memset( buffer, 0,
sizeof( buffer ) );
638 char *saved_args = NULL;
640 cmdline += strlen(parm->
name);
642 while ((*cmdline !=
'\0') && strncmp(cmdline,
" -", 2) && ((
size_t)(dest-buffer) <
sizeof(buffer))) {
643 *dest++ = *cmdline++;
651 if ( parm->
args != NULL ) {
653 saved_args = parm->
args;
661 int size = strlen(buffer);
666 if (saved_args != NULL) {
667 size += (strlen(saved_args) + 1);
671 memset(parm->
args, 0, size);
673 if (saved_args != NULL) {
681 delete [] saved_args;
686 parm->
args = saved_args;
697 char *cmdline_offset = NULL;
698 size_t get_new_offset = 0;
706 cmdline_offset = strstr(cmdline + get_new_offset, parmp->
name);
708 if ( !cmdline_offset )
711 int parmp_len = strlen(parmp->
name);
714 get_new_offset = (strlen(cmdline) - strlen(cmdline_offset) + parmp_len);
716 if ( (*(cmdline_offset + parmp_len)) && !
is_extra_space(*(cmdline_offset + parmp_len)) ) {
724 if (cmdline_offset) {
728 }
while (cmdline_offset);
732 cmdline_offset = NULL;
741 char seps[] =
" ,\t\n";
745 token = strtok(cmdline, seps);
746 while(token != NULL) {
748 if (token[0] ==
'-') {
757 if (parm_found == 0) {
761 sprintf(buffer,
"Unrecognized command line parameter %s, continue?",token);
764 #elif defined(APPLE_APP)
769 snprintf(buffer, 128,
"Unrecognized command line parameter, \"%s\", continue?", token);
770 message = CFStringCreateWithCString(NULL, buffer, kCFStringEncodingASCII);
772 if ( CFUserNotificationDisplayAlert(0, kCFUserNotificationPlainAlertLevel, NULL, NULL, NULL, CFSTR(
"Unknown Command"), message, NULL, CFSTR(
"Quit"), NULL, &result) ) {
777 if (result != kCFUserNotificationDefaultResponse) {
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");
796 static const int STR_SIZE = 25;
797 const int AT_SIZE = 8;
802 sp = strlen(parmp->
name);
807 printf(
" [ %s ]%*s- %s\n", parmp->
name, (STR_SIZE - sp -1 +AT_SIZE+4),
NOX(
" "), parmp->
help);
815 printf(
"Unrecognized command line parameter \"%s\". Ignoring...\n", token);
821 token = strtok(NULL, seps);
839 fp = fopen(
"data\\cmdline_fso.cfg",
"rt");
840 #elif defined(APPLE_APP)
844 snprintf(resolved_path,
MAX_PATH,
"%s/data/cmdline_fso.cfg", data_path);
846 fp = fopen(resolved_path,
"rt");
848 fp = fopen(
"data/cmdline_fso.cfg",
"rt");
856 buf =
new char [
len];
858 if (fgets(buf, len-1, fp) !=
nullptr)
861 if ( (p = strrchr(buf,
'\n')) != NULL ) {
882 fp = fopen(cmdname,
"rt");
887 fp = fopen(cmdname,
"rt");
895 buf =
new char [
len];
897 if (fgets(buf, len-1, fp) !=
nullptr)
900 if ( (p = strrchr(buf,
'\n')) != NULL ) {
932 name(name_),
help(help_), stacks(stacks_), arg_type(arg_type_)
937 if (Parm_list_inited == 0) {
938 Assertion(&Parm_list ==
this,
"Coding error! 1st initialised cmdline_parm must be static Parm_list\n");
940 Parm_list_inited = 1;
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");
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>");
999 char *moron = strstr(
args,
",");
1001 if ( moron && ((strlen(moron) + 1) < strlen(
args)) ) {
1003 offset = strlen(
args) - strlen(moron) + 1;
1007 return atoi(
args+offset);
1024 char *moron = strstr(
args,
",");
1026 if ( moron && ((strlen(moron) + 1) < strlen(
args)) ) {
1028 offset = strlen(
args) - strlen(moron) + 1;
1032 return (
float)atof(
args+offset);
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);
1059 while ((dirp = readdir(dp)) != NULL) {
1060 if (!
stricmp(dirp->d_name, dir.c_str())) {
1061 ret.push_back(dirp->d_name);
1073 size_t slash = dir.find_first_of(
"/\\");
1076 if (slash == std::string::npos) {
1077 return unix_get_single_dir_names(parent, dir);
1089 for (ii = this_dir_names.begin(); ii !=
end; ++ii) {
1090 SCP_string this_dir_path = parent +
"/" + *ii;
1095 for (ii2 = mod_path.begin(); ii2 != end2; ++ii2) {
1096 ret.push_back(*ii +
"/" + *ii2);
1104 static void handle_unix_modlist(
char **modlist,
int *
len)
1108 for (
char *cur_mod = strtok(*modlist,
","); cur_mod != NULL; cur_mod = strtok(NULL,
","))
1111 if (this_mod_paths.empty()) {
1114 mod_paths.insert(mod_paths.end(), this_mod_paths.begin(), this_mod_paths.end());
1118 size_t total_len = 0;
1120 for (ii = mod_paths.begin(); ii !=
end; ++ii) {
1121 total_len += ii->length() + 1;
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,
",");
1134 *modlist = new_modlist;
1148 FILE *
fp = fopen(
"flags.lch",
"w");
1151 MessageBox(NULL,
"Error creating flag list for launcher",
"Error",
MB_OK);
1155 int easy_flag_size =
sizeof(
EasyFlag);
1156 int flag_size =
sizeof(
Flag);
1158 int num_easy_flags =
sizeof(
easy_flags) / easy_flag_size;
1159 int num_flags =
sizeof(
exe_params) / flag_size;
1162 fwrite(&easy_flag_size,
sizeof(
int), 1, fp);
1163 fwrite(&flag_size,
sizeof(
int), 1, fp);
1165 fwrite(&num_easy_flags,
sizeof(
int), 1, fp);
1166 fwrite(&easy_flags,
sizeof(easy_flags), 1, fp);
1168 fwrite(&num_flags,
sizeof(
int), 1, fp);
1169 fwrite(&exe_params,
sizeof(exe_params), 1, fp);
1175 ubyte build_caps = 0;
1183 fwrite(&build_caps, 1, 1, fp);
1208 if (nowarn_arg.found())
1416 char *modlist =
new char[len+2];
1417 memset( modlist, 0, len + 2 );
1422 handle_unix_modlist(&modlist, &len);
1426 for (
int i = 0;
i <
len;
i++)
1428 if (modlist[
i] ==
',')
1531 if(no_grab.found()){
1532 Cmdline_no_grab = 1;
1630 if (fix_registry.found()) {
1631 Cmdline_alternate_registry_path =
true;
1818 char *cmdline = NULL;
1819 unsigned int arglen = 0;
1821 for (i = 1; i < argc; i++)
1822 arglen += strlen(argv[i]);
1825 cmdline =
new char [arglen+1];
1828 strcpy_s(cmdline, arglen+1, argv[i]);
1829 for (i=2; i < argc; i++) {
1831 strcat_s(cmdline, arglen+1, argv[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;
1866 return "UNKNOWN - FIXME!";
char * Cmdline_connect_addr
bool Cmdline_brief_lighting
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)
cmdline_parm no3dsound_arg("-no_3d_sound", NULL, AT_NONE)
int Cmdline_freespace_no_music
cmdline_parm dualscanlines_arg("-dualscanlines", NULL, AT_NONE)
char * Cmdline_keyboard_layout
cmdline_parm mod_arg("-mod","List of folders to overwrite/add-to the default data", AT_STRING, true)
int Cmdline_dualscanlines
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
cmdline_parm fps_arg("-fps", NULL, AT_NONE)
int Cmdline_old_collision_sys
int Cmdline_deprecated_spec
cmdline_parm allowabove_arg("-allowabove","Ranks above this can join multi", AT_STRING)
cmdline_parm verify_vps_arg("-verify_vps", NULL, AT_NONE)
cmdline_parm startgame_arg("-startgame", NULL, AT_NONE)
cmdline_parm htl_arg("-nohtl", NULL, AT_NONE)
cmdline_parm ballistic_gauge("-ballistic_gauge", NULL, AT_NONE)
cmdline_parm noparseerrors_arg("-noparseerrors", NULL, AT_NONE)
int Cmdline_weapon_choice_3d
int Cmdline_missile_lighting
int Cmdline_no_enhanced_sound
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
int Cmdline_cache_bitmaps
cmdline_parm fov_arg("-fov","Vertical field-of-view factor", AT_FLOAT)
int Cmdline_softparticles
#define list_append(head, elem)
cmdline_parm rearm_timer_arg("-rearm_timer", NULL, AT_NONE)
cmdline_parm spec_exp_arg("-spec_exp","Adjusts the size of shiny spots on ships", AT_FLOAT)
int Cmdline_start_netgame
int Cmdline_deprecated_tbp
cmdline_parm pos_arg("-pos", NULL, AT_NONE)
cmdline_parm height_arg("-noheight", NULL, AT_NONE)
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL, AT_NONE)
cmdline_parm fxaa_arg("-fxaa", NULL, AT_NONE)
bool output_sexps(char *filepath)
bool Cmdline_profile_write_file
int Cmdline_ati_color_swap
const char * Osreg_user_dir
cmdline_parm noglsl_arg("-no_glsl", NULL, AT_NONE)
bool Cmdline_fb_explosions
cmdline_parm parse_cmdline_only(PARSE_COMMAND_LINE_STRING,"Ignore any cmdline_fso.cfg files", AT_NONE)
#define Assertion(expr, msg,...)
cmdline_parm debug_window_arg("-debug_window", NULL, AT_NONE)
cmdline_parm loadallweapons_arg("-loadallweps", NULL, AT_NONE)
#define END_OF_LIST(head)
cmdline_parm allow_autpilot_interrupt("-no_ap_interrupt", NULL, AT_NONE)
cmdline_parm noscalevid_arg("-noscalevid", NULL, AT_NONE)
GLenum GLuint GLenum GLsizei const GLchar * message
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
const char * detect_home(void)
cmdline_parm flightshaftsoff_arg("-nolightshafts", NULL, AT_NONE)
void os_parse_parms(char *cmdline)
cmdline_parm deprecated_normal_arg("-normal","Deprecated", AT_NONE)
bool Cmdline_frame_profile
char * Cmdline_spew_mission_crcs
int Cmdline_ambient_factor
GLenum GLuint GLenum GLsizei const GLchar * buf
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)
cmdline_parm use_3dwarp("-3dwarp", NULL, AT_NONE)
#define CLAMP(x, min, max)
int Cmdline_show_mem_usage
double specular_exponent_value
cmdline_parm targetinfo_arg("-targetinfo", NULL, AT_NONE)
void parm_stuff_args(cmdline_parm *parm, char *cmdline)
int Cmdline_nomotiondebris
cmdline_parm window_arg("-window", NULL, AT_NONE)
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)
const float Default_min_draw_distance
int parse_cmdline(char *cmdline)
char * drop_extra_chars(char *str)
cmdline_parm gl_finish("-gl_finish", NULL, AT_NONE)
int Cmdline_deprecated_normal
char * Cmdline_rank_above
cmdline_parm allowbelow_arg("-allowbelow","Ranks below this can join multi", AT_STRING)
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
int Cmdline_spew_pof_info
cmdline_parm orb_radar("-orbradar", NULL, AT_NONE)
#define PARSE_COMMAND_LINE_STRING
int Cmdline_ship_choice_3d
float static_point_factor
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()
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
int Cmdline_enable_3d_shockwave
int Cmdline_deprecated_glow
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
cmdline_parm enable_shadows_arg("-enable_shadows", NULL, AT_NONE)
cmdline_parm stretch_menu("-stretch_menu", NULL, AT_NONE)
float static_light_factor
cmdline_parm mipmap_arg("-mipmap", NULL, AT_NONE)
cmdline_parm bit32_arg("-32bit","Deprecated", AT_NONE)
cmdline_parm mpnoreturn_arg("-mpnoreturn", NULL, AT_NONE)
cmdline_parm ogl_spec_arg("-ogl_spec","Shininess of specular light", AT_FLOAT)
cmdline_parm no_pbo_arg("-disable_pbo", NULL, AT_NONE)
int Cmdline_deprecated_env
#define BUILD_CAP_NEW_SND
cmdline_parm standalone_arg("-standalone", NULL, AT_NONE)
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
int Cmdline_restricted_game
cmdline_parm frame_profile_write_file("-profile_write_file", NULL, AT_NONE)
char * Cmdline_rank_below
char * Cmdline_center_res
int Cmdline_shadow_quality
int Cmdline_no_deferred_lighting
cmdline_parm normal_arg("-nonormal", NULL, AT_NONE)
cmdline_parm frame_profile_arg("-profile_frame_time", NULL, AT_NONE)
GLbitfield GLuint64 timeout
cmdline_parm dis_collisions("-dis_collisions", NULL, AT_NONE)
int Cmdline_fullscreen_window
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)
cmdline_parm no_fbo_arg("-disable_fbo", NULL, AT_NONE)
const char * get_param_desc(const char *flag_name)
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
cmdline_parm multilog_arg("-multilog", NULL, AT_NONE)
cmdline_parm no_vsync_arg("-no_vsync", NULL, AT_NONE)
typedef void(APIENTRY *PFNGLARRAYELEMENTEXTPROC)(GLint i)
cmdline_parm deprecated_jpgtga_arg("-jpgtga","Deprecated", AT_NONE)
GLuint const GLchar * name
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)
cmdline_parm no_drawrangeelements("-use_gldrawelements", NULL, AT_NONE)
cmdline_parm port_arg("-port","Multiplayer network port", AT_INT)
cmdline_parm clip_dist_arg("-clipdist","Changes the distance from the viewpoint for the near-clipping plane", AT_FLOAT)
#define GetCurrentDirectory(i, s)
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL, AT_NONE)
int Cmdline_deprecated_jpgtga
int Cmdline_freespace_no_sound
int Cmdline_dis_collisions
cmdline_parm client_dodamage("-clientdamage", NULL, AT_NONE)
char * Cmdline_start_mission
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[])
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)
void os_init_cmdline(char *cmdline)
cmdline_parm mouse_coords("-coords", NULL, AT_NONE)
cmdline_parm weapon_choice_3d_arg("-weapon_choice_3d", NULL, AT_NONE)
cmdline_parm ambient_factor_arg("-ambient_factor","Adjusts ambient light applied to all parts of a ship", AT_INT)
int Cmdline_client_dodamage
bool Output_scripting_meta
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
cmdline_parm no_unfocused_pause_arg("-no_unfocused_pause", NULL, AT_NONE)
bool Cmdline_set_cpu_affinity
cmdline_parm glow_arg("-noglow", NULL, AT_NONE)
cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL, AT_NONE)
cmdline_parm objupd_arg("-cap_object_update","Multiplayer object update cap (0-3)", AT_INT)
cmdline_parm use_warp_flash("-warp_flash", NULL, AT_NONE)
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)
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
cmdline_parm nomovies_arg("-nomovies", NULL, AT_NONE)
cmdline_parm deprecated_glow_arg("-glow","Deprecated", AT_NONE)
cmdline_parm atiswap_arg("-ati_swap", NULL, AT_NONE)
int Cmdline_use_last_pilot
cmdline_parm spec_point_arg("-spec_point","Adjusts laser weapons contribution to specular highlights", AT_FLOAT)
cmdline_parm bloom_intensity_arg("-bloom_intensity","Set bloom intensity, requires -post_process", AT_INT)
int Cmdline_noparseerrors
cmdline_parm fullscreen_window_arg("-fullscreen_window","Fullscreen/borderless window (Windows only)", AT_NONE)
int Cmdline_save_render_targets
cmdline_parm tablecrcspew_arg("-tablecrcs", NULL, AT_STRING)
char * Cmdline_game_password
cmdline_parm get_flags_arg("-get_flags","Output the launcher flags file", AT_NONE)
const char * cmdline_arg_types[]
cmdline_parm deprecated_tbp_arg("-tbp","Deprecated", AT_NONE)
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_reparse_mainhall
int Cmdline_multi_stream_chat_to_file
cmdline_parm fb_explosions_arg("-fb_explosions", NULL, AT_NONE)
cmdline_parm timeout("-timeout","Multiplayer network timeout (secs)", AT_INT)
int Cmdline_ballistic_gauge
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
bool Cmdline_benchmark_mode
cmdline_parm nosound_arg("-nosound", NULL, AT_NONE)
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)
cmdline_parm no_deferred_lighting_arg("-no_deferred", NULL, AT_NONE)
cmdline_parm spec_arg("-nospec", NULL, AT_NONE)
bool check_if_args_is_valid()
cmdline_parm gamename_arg("-gamename","Set multiplayer game name", AT_STRING)
cmdline_parm no_geo_sdr_effects("-no_geo_effects", NULL, AT_NONE)