launcher preparation

This commit is contained in:
Ondřej Novák 2025-07-14 17:14:41 +02:00
parent d3bbe7b935
commit 86d0919905
3 changed files with 12 additions and 2 deletions

View file

@ -15,6 +15,7 @@ typedef struct {
const char *patch_file; const char *patch_file;
const char *sse_hostport; const char *sse_hostport;
char launcher; //<run launcher
} SKELDAL_CONFIG; } SKELDAL_CONFIG;

View file

@ -22,6 +22,7 @@ void show_help(const char *arg0) {
"-l <lang> set language (cz|en)\n" "-l <lang> set language (cz|en)\n"
"-s <directory> generate string-tables (for localization) and exit\n" "-s <directory> generate string-tables (for localization) and exit\n"
"-c <host:port> connect to host:port for remote control (mapedit)\n" "-c <host:port> connect to host:port for remote control (mapedit)\n"
"-L run launcher - select workshop adventure\n"
"-h this help\n"); "-h this help\n");
exit(1); exit(1);
} }
@ -38,13 +39,15 @@ int main(int argc, char **argv) {
std::string patch; std::string patch;
std::string lang; std::string lang;
std::string sse_hostport; std::string sse_hostport;
for (int optchr = -1; (optchr = getopt(argc, argv, "hf:a:s:l:p:c:")) != -1; ) { bool launcher = false;
for (int optchr = -1; (optchr = getopt(argc, argv, "hLf:a:s:l:p:c:")) != -1; ) {
switch (optchr) { switch (optchr) {
case 'f': config_name = optarg;break; case 'f': config_name = optarg;break;
case 'a': adv_config_file = optarg;break; case 'a': adv_config_file = optarg;break;
case 'h': show_help(argv[0]);break; case 'h': show_help(argv[0]);break;
case 'p': patch = optarg; break; case 'p': patch = optarg; break;
case 'l': lang = optarg;break; case 'l': lang = optarg;break;
case 'L': launcher = true;break;
case 's': gen_stringtable_path = optarg;break; case 's': gen_stringtable_path = optarg;break;
case 'c': sse_hostport = optarg;break; case 'c': sse_hostport = optarg;break;
default: show_help_short(); default: show_help_short();
@ -62,6 +65,7 @@ int main(int argc, char **argv) {
cfg.lang_path = lang.empty()?NULL:lang.c_str(); cfg.lang_path = lang.empty()?NULL:lang.c_str();
cfg.patch_file = patch.empty()?NULL:patch.c_str(); cfg.patch_file = patch.empty()?NULL:patch.c_str();
cfg.sse_hostport = sse_hostport.empty()?NULL:sse_hostport.c_str(); cfg.sse_hostport = sse_hostport.empty()?NULL:sse_hostport.c_str();
cfg.launcher = launcher?1:0;
try { try {
if (!gen_stringtable_path.empty()) { if (!gen_stringtable_path.empty()) {

View file

@ -25,6 +25,7 @@ void show_help(std::ostream &out, const char *arg0) {
"-l <lang> set language (cz|en)\n" "-l <lang> set language (cz|en)\n"
"-s <directory> generate string-tables (for localization) and exit\n" "-s <directory> generate string-tables (for localization) and exit\n"
"-c <host:port> connect to host:port for remote control (mapedit)\n" "-c <host:port> connect to host:port for remote control (mapedit)\n"
"-L run launcher - select workshop adventure\n"
"-h this help\n"; "-h this help\n";
} }
@ -40,14 +41,17 @@ int main(int argc, char **argv) {
std::string lang; std::string lang;
std::string patch; std::string patch;
std::string sse_hostport; std::string sse_hostport;
bool launcher = false;
std::ostringstream console; std::ostringstream console;
for (int optchr = -1; (optchr = getopt(argc, argv, "hf:a:s:l:c:p:")) != -1; ) { for (int optchr = -1; (optchr = getopt(argc, argv, "hLf:a:s:l:c:p:")) != -1; ) {
switch (optchr) { switch (optchr) {
case 'f': config_name = optarg;break; case 'f': config_name = optarg;break;
case 'a': adv_config_file = optarg;break; case 'a': adv_config_file = optarg;break;
case 'h': show_help(console, argv[0]);break; case 'h': show_help(console, argv[0]);break;
case 'p': patch = optarg; break; case 'p': patch = optarg; break;
case 'l': lang = optarg;break; case 'l': lang = optarg;break;
case 'L': launcher = true;break;
case 's': gen_stringtable_path = optarg;break; case 's': gen_stringtable_path = optarg;break;
case 'c': sse_hostport = optarg;break; case 'c': sse_hostport = optarg;break;
default: show_help_short(console);break; default: show_help_short(console);break;
@ -72,6 +76,7 @@ int main(int argc, char **argv) {
cfg.lang_path = lang.empty()?NULL:lang.c_str(); cfg.lang_path = lang.empty()?NULL:lang.c_str();
cfg.patch_file = patch.empty()?NULL:patch.c_str(); cfg.patch_file = patch.empty()?NULL:patch.c_str();
cfg.sse_hostport = sse_hostport.empty()?NULL:sse_hostport.c_str(); cfg.sse_hostport = sse_hostport.empty()?NULL:sse_hostport.c_str();
cfg.launcher = launcher?1:0;
{ {
std::string msg = console.str(); std::string msg = console.str();