Browse Source

engine: add new pretty --help output

pull/2/head
Alibek Omarov 2 years ago
parent
commit
710b234493
  1. 140
      engine/common/host.c

140
engine/common/host.c

@ -66,102 +66,102 @@ convar_t *build, *ver;
void Sys_PrintUsage( void ) void Sys_PrintUsage( void )
{ {
string version_str;
const char *usage_str; const char *usage_str;
#define O(x,y) " "x" "y"\n" Q_snprintf( version_str, sizeof( version_str ),
XASH_ENGINE_NAME " %i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
usage_str = "" #if XASH_WIN32
#if XASH_MESSAGEBOX == MSGBOX_STDERR #define XASH_EXE "(xash).exe"
"\n" // dirty hack to not have Xash Error: Usage: on same line #else
#endif // XASH_MESSAGEBOX == MSGBOX_STDERR #define XASH_EXE "(xash)"
S_USAGE "\n" #endif
#if !XASH_MOBILE_PLATFORM
#if XASH_WIN32
O("<xash>.exe [options] [+command1] [+command2 arg]","")
#else // XASH_WIN32
O("<xash> [options] [+command1] [+command2 arg]","")
#endif // !XASH_WIN32
#endif // !XASH_MOBILE_PLATFORM
"Options:\n"
O("-dev [level] ","set log verbosity 0-2")
O("-log ","write log to \"engine.log\"")
O("-nowriteconfig ","disable config save")
#if !XASH_WIN32 #define O( x, y ) " "x" "y"\n"
O("-casesensitive ","disable case-insensitive FS emulation")
#endif // !XASH_WIN32
#if !XASH_MOBILE_PLATFORM usage_str = S_USAGE XASH_EXE " [options] [+command] [+command2 arg] ...\n"
O("-daemonize ","run engine in background, dedicated only")
#endif // !XASH_MOBILE_PLATFORM
"\nCommon options:\n"
O("-dev [level] ", "set log verbosity 0-2")
O("-log ", "write log to \"engine.log\"")
O("-nowriteconfig ", "disable config save")
O("-noch ", "disable crashhandler")
#if XASH_WIN32 // !!!!
O("-minidumps ", "enable writing minidumps when game is crashed")
#endif
O("-rodir <path> ", "set read-only base directory")
O("-bugcomp ", "enable precise bug compatibility. Will break games that don't require it")
O(" ", "Refer to engine documentation for more info")
O("-disablehelp ", "disable this message")
#if !XASH_DEDICATED #if !XASH_DEDICATED
O("-toconsole ","run engine witn console open") O("-dedicated ", "run engine in dedicated mode")
O("-width <n> ","set window width") #endif
O("-height <n> ","set window height")
O("-oldfont ","enable unused Quake font in Half-Life")
#if !XASH_MOBILE_PLATFORM "\nNetworking options:\n"
O("-fullscreen ","run engine in fullscreen mode") O("-noip ", "disable IPv4")
O("-windowed ","run engine in windowed mode") O("-ip <ip> ", "set IPv4 address")
O("-dedicated ","run engine in dedicated server mode") O("-port <port> ", "set IPv4 port")
#endif // XASH_MOBILE_PLATFORM O("-noip6 ", "disable IPv6")
O("-ip6 <ip> ", "set IPv6 address")
O("-port6 <port> ", "set IPv6 port")
O("-clockwindow <cw>", "adjust clockwindow used to ignore client commands to prevent speed hacks")
"\nGame options:\n"
O("-dll <path> ", "override server DLL path")
#if !XASH_DEDICATED
O("-clientlib <path>", "override client DLL path")
O("-console ", "run engine with console enabled")
O("-toconsole ", "run engine witn console open")
O("-oldfont ", "enable unused Quake font in Half-Life")
O("-width <n> ", "set window width")
O("-height <n> ", "set window height")
O("-fullscreen ", "run engine in fullscreen mode")
O("-windowed ", "run engine in windowed mode")
O("-ref <name> ", "use selected renderer dll")
O("-gldebug ", "enable OpenGL debug log")
#if XASH_WIN32
O("-noavi ", "disable AVI support")
O("-nointro ", "disable intro video")
#endif
O("-noenginejoy ", "disable engine builtin joystick support")
O("-noenginemouse ", "disable engine builtin mouse support")
O("-nosound ", "disable sound output")
#endif
"\nPlatform-specific options:\n"
#if !XASH_MOBILE_PLATFORM
O("-daemonize ", "run engine as a daemon")
#endif
#if XASH_SDL == 2
O("-sdl_joy_old_api ","use SDL legacy joystick API")
O("-sdl_renderer <n>","use alternative SDL_Renderer for software")
#endif // XASH_SDL
#if XASH_ANDROID #if XASH_ANDROID
O("-nativeegl ","use native egl implementation. Use if screen does not update or black") O("-nativeegl ","use native egl implementation. Use if screen does not update or black")
#endif // XASH_ANDROID #endif // XASH_ANDROID
#if XASH_WIN32
O("-noavi ","disable AVI support")
O("-nointro ","disable intro video")
O("-minidumps ","enable writing minidumps when game crashed")
#endif // XASH_WIN32
#if XASH_DOS #if XASH_DOS
O("-novesa ","disable vesa") O("-novesa ","disable vesa")
#endif // XASH_DOS #endif // XASH_DOS
#if XASH_VIDEO == VIDEO_FBDEV #if XASH_VIDEO == VIDEO_FBDEV
O("-fbdev <path> ","open selected framebuffer") O("-fbdev <path> ","open selected framebuffer")
O("-ttygfx ","set graphics mode in tty") O("-ttygfx ","set graphics mode in tty")
O("-doublebuffer ","enable doublebuffering") O("-doublebuffer ","enable doublebuffering")
#endif // XASH_VIDEO == VIDEO_FBDEV #endif // XASH_VIDEO == VIDEO_FBDEV
#if XASH_SOUND == SOUND_ALSA #if XASH_SOUND == SOUND_ALSA
O("-alsadev <dev> ","open selected ALSA device") O("-alsadev <dev> ","open selected ALSA device")
#endif // XASH_SOUND == SOUND_ALSA #endif // XASH_SOUND == SOUND_ALSA
O("-nojoy ","disable joystick support")
#ifdef XASH_SDL
O("-sdl_joy_old_api ","use SDL legacy joystick API")
O("-sdl_renderer <n>","use alternative SDL_Renderer for software")
#endif // XASH_SDL
O("-nosound ","disable sound")
O("-noenginemouse ","disable mouse completely")
O("-ref <name> ","use selected renderer dll")
O("-gldebug ","enable OpenGL debug log")
#endif // XASH_DEDICATED
O("-noip ","disable TCP/IP")
O("-noch ","disable crashhandler")
O("-disablehelp ","disable this message")
O("-dll <path> ","override server DLL path")
#if !XASH_DEDICATED
O("-clientlib <path>","override client DLL path")
#endif
O("-rodir <path> ","set read-only base directory, experimental")
O("-bugcomp ","enable precise bug compatibility. Will break games that don't require it")
O(" ","Refer to engine documentation for more info")
O("-ip <ip> ","set custom ip")
O("-port <port> ","set custom host port")
O("-clockwindow <cw>","adjust clockwindow")
; ;
#undef O #undef O
Sys_Error( "%s", usage_str ); // HACKHACK: pretty output in dedicated
#if XASH_MESSAGEBOX != MSGBOX_STDERR
Platform_MessageBox( version_str, usage_str, false );
#else
fprintf( stderr, "%s\n%s", version_str, usage_str );
#endif
Sys_Quit();
} }
int Host_CompareFileTime( int ft1, int ft2 ) int Host_CompareFileTime( int ft1, int ft2 )

Loading…
Cancel
Save