37 std::printf(
"xoreos - A reimplementation of BioWare's Aurora engine\n");
38 std::printf(
"Usage: %s [options] [target]\n\n", name.
c_str());
39 std::printf(
" --help Display this text and exit.\n");
40 std::printf(
" --version Display version information and exit.\n");
41 std::printf(
" -cFILE --config=FILE Load the config from file FILE.\n");
42 std::printf(
" -pDIR --path=DIR Override the game path with DIR.\n");
43 std::printf(
" -wSIZE --width=SIZE Set the window's width to SIZE.\n");
44 std::printf(
" -hSIZE --height=SIZE Set the window's height to SIZE.\n");
45 std::printf(
" -fBOOL --fullscreen=BOOL Switch fullscreen on/off.\n");
46 std::printf(
" -kBOOL --skipvideos=BOOL Disable videos on/off.\n");
47 std::printf(
" -vVOL --volume=VOL Set global volume to VOL.\n");
48 std::printf(
" -mVOL --volume_music=VOL Set music volume to VOL.\n");
49 std::printf(
" -sVOL --volume_sfx=VOL Set SFX volume to VOL.\n");
50 std::printf(
" -oVOL --volume_voice=VOL Set voice volume to VOL.\n");
51 std::printf(
" -iVOL --volume_video=VOL Set video volume to VOL.\n");
52 std::printf(
" -qLANG --lang=LANG Set the game's language.\n");
53 std::printf(
" --langtext=LANG Set the game's text language.\n");
54 std::printf(
" --langvoice=LANG Set the game's voice language.\n");
55 std::printf(
" -dDLVL --debug=DLVL Set the debug channel verbosities.\n");
56 std::printf(
" --debuggl=BOOL Create OpenGL debug context.\n");
57 std::printf(
" --listdebug List all available debug channels.\n");
58 std::printf(
" --listlangs List all available languages for this target.\n");
59 std::printf(
" --saveconf=BOOL If false, never write to the config file.\n");
60 std::printf(
" --logfile=FILE Write all debug output into this file too.\n");
61 std::printf(
" --nologfile=BOOL Don't write a log file.\n");
62 std::printf(
" --consolelog=FILE Write all debug console output into this file too.\n");
63 std::printf(
" --noconsolelog=BOOL Don't write a debug console log file.\n");
65 std::printf(
"FILE: Absolute or relative path to a file.\n");
66 std::printf(
"DIR: Absolute or relative path to a directory.\n");
67 std::printf(
"SIZE: A positive integer.\n");
68 std::printf(
"BOOL: \"true\", \"yes\", \"y\", \"on\" and \"1\" are true, everything else is false.\n");
69 std::printf(
"VOL: A double ranging from 0.0 (min) - 1.0 (max).\n");
70 std::printf(
"LANG: A language identifier. Full name, ISO 639-1 or ISO 639-2 language code;\n");
71 std::printf(
" or IETF language tag with ISO 639-1 and ISO 3166-1 country code.\n");
72 std::printf(
" Examples: en, de_de, hun, Czech, zh-tw, zh_cn, zh-cht, zh-chs.\n");
73 std::printf(
"DLVL: A comma-separated list of a debug channel name, a colon and the desired\n");
74 std::printf(
" verbosity level. For example: GGraphics:4,GVideo:1,EEvents:9\n");
75 std::printf(
" Use \"All\" to refer to all debug channels. OpenGL debug channels\n");
76 std::printf(
" need the debuggl option to be enabled and require OpenGL driver support\n");
77 std::printf(
" of the GL_ARB_debug_output extension.\n");
79 std::printf(
"Examples:\n");
80 std::printf(
"%s -p/path/to/nwn/\n", name.
c_str());
81 std::printf(
" xoreos will start the game in /path/to/nwn/. Should a target with this\n");
82 std::printf(
" path not yet exist in the config file, xoreos will create one named \"nwn\".\n");
83 std::printf(
"%s -p/path/to/nwn/ foobar\n", name.
c_str());
84 std::printf(
" xoreos will start the game in /path/to/nwn/. If a target \"foobar\"\n");
85 std::printf(
" does not yet exist in the config file, xoreos will create it.\n");
86 std::printf(
"%s nwn\n", name.
c_str());
87 std::printf(
" xoreos will start the game specified by target \"nwn\", which must exit\n");
88 std::printf(
" in the config file already.\n");
92 std::printf(
"Configuration file: %s\n",
ConfigMan.getConfigFile().c_str());
105 static const char *
const kOptions[] = {
121 for (
size_t i = 0; i < (
ARRAYSIZE(kOptions) / 2); i++)
122 if (((
uint32) kOptions[2 * i + 0][0]) == shortOption)
123 return kOptions[2 * i + 1];
147 if (arg.
size() < 2) {
148 warning(
"Unrecognized command line argument \"%s\"", arg.
c_str());
162 if (e != arg.
end()) {
163 key = arg.
substr(start, e++);
176 warning(
"Unrecognized command line argument \"%s\"", arg.
c_str());
194 bool stopMark =
false;
195 for (
size_t i = 1; i < argv.size(); i++) {
207 if (!stopMark && argv[i].beginsWith(
"-")) {
208 if (argv[i] ==
"--") {
213 if (argv[i] ==
"--help") {
219 if (argv[i] ==
"--version") {
230 if (key ==
"listdebug") {
235 if (key ==
"listlangs") {
243 if (!target.
empty()) {
244 warning(
"Found multiple target (\"%s\" and \"%s\")", target.
c_str(), argv[i].c_str());
bool parseCommandline(const std::vector< Common::UString > &argv, Common::UString &target, int &code)
A class holding an UTF-8 string.
The global config manager.
static void displayVersion()
bool equalsIgnoreCase(const UString &str) const
#define ARRAYSIZE(x)
Macro which determines the number of entries in a fixed size array.
Command line arguments parser.
static bool setOption(Common::UString &key, const Common::UString &value)
iterator findFirst(uint32 c) const
UString substr(iterator from, iterator to) const
utf8::iterator< std::string::const_iterator > iterator
const char * c_str() const
Return the (utf8 encoded) string data.
#define ConfigMan
Shortcut for accessing the config manager.
Utility templates and functions.
Basic xoreos version information.
static void displayUsage(const Common::UString &name)
const char * getProjectAuthors()
bool empty() const
Is the string empty?
void warning(const char *s,...)
const char * getProjectURL()
const char * getProjectNameVersionFull()
size_t size() const
Return the size of the string, in characters.
static bool parseOption(const Common::UString &arg, Common::UString &key)
static Common::UString convertShortToLongOption(uint32 shortOption)
void clear()
Clear the string's contents.