mirror of
https://github.com/azahar-emu/azahar
synced 2025-11-14 19:09:57 +01:00
room: Replaced references to games with applications. Includes options!
Changed options: `--preferred-game` --> `--preferred-app` `-g` --> `-s` (short for "software") `--preferred-game-id` --> `--preferred-app-id` Warnings have been left behind for the old options to inform potentially unaware users of the change
This commit is contained in:
parent
11b312e764
commit
06f92aeccf
@ -49,8 +49,8 @@ static void PrintHelp(const char* argv0) {
|
|||||||
"--port The port used for the room\n"
|
"--port The port used for the room\n"
|
||||||
"--max_members The maximum number of players for this room\n"
|
"--max_members The maximum number of players for this room\n"
|
||||||
"--password The password for the room\n"
|
"--password The password for the room\n"
|
||||||
"--preferred-game The preferred game for this room\n"
|
"--preferred-app The preferred application for this room\n"
|
||||||
"--preferred-game-id The preferred game-id for this room\n"
|
"--preferred-app-id The preferred application ID for this room\n"
|
||||||
"--username The username used for announce\n"
|
"--username The username used for announce\n"
|
||||||
"--token The token used for announce\n"
|
"--token The token used for announce\n"
|
||||||
"--web-api-url Citra Web API url\n"
|
"--web-api-url Citra Web API url\n"
|
||||||
@ -66,6 +66,11 @@ static void PrintVersion() {
|
|||||||
<< " Libnetwork: " << Network::network_version << std::endl;
|
<< " Libnetwork: " << Network::network_version << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PrintRemovedOptionWarning(const char* argv0, const char* option) {
|
||||||
|
std::cout << "The " << option << " option has been renamed or removed.\n"
|
||||||
|
<< "Please run " << argv0 << " -h for a list of valid options.\n";
|
||||||
|
}
|
||||||
|
|
||||||
/// The magic text at the beginning of a citra-room ban list file.
|
/// The magic text at the beginning of a citra-room ban list file.
|
||||||
static constexpr char BanListMagic[] = "CitraRoom-BanList-1";
|
static constexpr char BanListMagic[] = "CitraRoom-BanList-1";
|
||||||
|
|
||||||
@ -181,8 +186,8 @@ int main(int argc, char** argv) {
|
|||||||
{"port", required_argument, 0, 'p'},
|
{"port", required_argument, 0, 'p'},
|
||||||
{"max_members", required_argument, 0, 'm'},
|
{"max_members", required_argument, 0, 'm'},
|
||||||
{"password", required_argument, 0, 'w'},
|
{"password", required_argument, 0, 'w'},
|
||||||
{"preferred-game", required_argument, 0, 'g'},
|
{"preferred-app", required_argument, 0, 's'},
|
||||||
{"preferred-game-id", required_argument, 0, 'i'},
|
{"preferred-app-id", required_argument, 0, 'i'},
|
||||||
{"username", optional_argument, 0, 'u'},
|
{"username", optional_argument, 0, 'u'},
|
||||||
{"token", required_argument, 0, 't'},
|
{"token", required_argument, 0, 't'},
|
||||||
{"web-api-url", required_argument, 0, 'a'},
|
{"web-api-url", required_argument, 0, 'a'},
|
||||||
@ -191,11 +196,15 @@ int main(int argc, char** argv) {
|
|||||||
{"enable-citra-mods", no_argument, 0, 'e'},
|
{"enable-citra-mods", no_argument, 0, 'e'},
|
||||||
{"help", no_argument, 0, 'h'},
|
{"help", no_argument, 0, 'h'},
|
||||||
{"version", no_argument, 0, 'v'},
|
{"version", no_argument, 0, 'v'},
|
||||||
|
// Removed options
|
||||||
|
{"preferred-game", optional_argument, 0, 'g'},
|
||||||
|
{"preferred-game-id", optional_argument, 0, 0},
|
||||||
|
|
||||||
{0, 0, 0, 0},
|
{0, 0, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
while (optind < argc) {
|
while (optind < argc) {
|
||||||
int arg = getopt_long(argc, argv, "n:d:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index);
|
int arg = getopt_long(argc, argv, "n:d:p:m:w:s:u:t:a:i:l:hvg", long_options, &option_index);
|
||||||
if (arg != -1) {
|
if (arg != -1) {
|
||||||
switch (static_cast<char>(arg)) {
|
switch (static_cast<char>(arg)) {
|
||||||
case 'n':
|
case 'n':
|
||||||
@ -213,7 +222,7 @@ int main(int argc, char** argv) {
|
|||||||
case 'w':
|
case 'w':
|
||||||
password.assign(optarg);
|
password.assign(optarg);
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 's':
|
||||||
preferred_game.assign(optarg);
|
preferred_game.assign(optarg);
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
@ -243,6 +252,14 @@ int main(int argc, char** argv) {
|
|||||||
case 'v':
|
case 'v':
|
||||||
PrintVersion();
|
PrintVersion();
|
||||||
return 0;
|
return 0;
|
||||||
|
case 'g':
|
||||||
|
PrintRemovedOptionWarning(argv[0], "--preferred-game/-g");
|
||||||
|
return 255;
|
||||||
|
case 0:
|
||||||
|
if (strcmp(long_options[option_index].name, "preferred-game-id") == 0) {
|
||||||
|
PrintRemovedOptionWarning(argv[0], "--preferred-game-id");
|
||||||
|
return 255;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,13 +270,14 @@ int main(int argc, char** argv) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (preferred_game.empty()) {
|
if (preferred_game.empty()) {
|
||||||
std::cout << "preferred game is empty!\n\n";
|
std::cout << "preferred application is empty!\n\n";
|
||||||
PrintHelp(argv[0]);
|
PrintHelp(argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (preferred_game_id == 0) {
|
if (preferred_game_id == 0) {
|
||||||
std::cout << "preferred-game-id not set!\nThis should get set to allow users to find your "
|
std::cout
|
||||||
"room.\nSet with --preferred-game-id id\n\n";
|
<< "preferred application id not set!\nThis should get set to allow users to find your "
|
||||||
|
"room.\nSet with --preferred-app-id id\n\n";
|
||||||
}
|
}
|
||||||
if (max_members > Network::MaxConcurrentConnections || max_members < 2) {
|
if (max_members > Network::MaxConcurrentConnections || max_members < 2) {
|
||||||
std::cout << "max_members needs to be in the range 2 - "
|
std::cout << "max_members needs to be in the range 2 - "
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user