summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dedicated_room/yuzu_room.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/dedicated_room/yuzu_room.cpp b/src/dedicated_room/yuzu_room.cpp
index 359891883..e1cf8a76d 100644
--- a/src/dedicated_room/yuzu_room.cpp
+++ b/src/dedicated_room/yuzu_room.cpp
@@ -49,6 +49,7 @@ static void PrintHelp(const char* argv0) {
49 " [options] <filename>\n" 49 " [options] <filename>\n"
50 "--room-name The name of the room\n" 50 "--room-name The name of the room\n"
51 "--room-description The room description\n" 51 "--room-description The room description\n"
52 "--bind-address The bind address for the room\n"
52 "--port The port used for the room\n" 53 "--port The port used for the room\n"
53 "--max_members The maximum number of players for this room\n" 54 "--max_members The maximum number of players for this room\n"
54 "--password The password for the room\n" 55 "--password The password for the room\n"
@@ -195,6 +196,7 @@ int main(int argc, char** argv) {
195 std::string web_api_url; 196 std::string web_api_url;
196 std::string ban_list_file; 197 std::string ban_list_file;
197 std::string log_file = "yuzu-room.log"; 198 std::string log_file = "yuzu-room.log";
199 std::string bind_address;
198 u64 preferred_game_id = 0; 200 u64 preferred_game_id = 0;
199 u32 port = Network::DefaultRoomPort; 201 u32 port = Network::DefaultRoomPort;
200 u32 max_members = 16; 202 u32 max_members = 16;
@@ -203,6 +205,7 @@ int main(int argc, char** argv) {
203 static struct option long_options[] = { 205 static struct option long_options[] = {
204 {"room-name", required_argument, 0, 'n'}, 206 {"room-name", required_argument, 0, 'n'},
205 {"room-description", required_argument, 0, 'd'}, 207 {"room-description", required_argument, 0, 'd'},
208 {"bind-address", required_argument, 0, 's'},
206 {"port", required_argument, 0, 'p'}, 209 {"port", required_argument, 0, 'p'},
207 {"max_members", required_argument, 0, 'm'}, 210 {"max_members", required_argument, 0, 'm'},
208 {"password", required_argument, 0, 'w'}, 211 {"password", required_argument, 0, 'w'},
@@ -222,7 +225,7 @@ int main(int argc, char** argv) {
222 InitializeLogging(log_file); 225 InitializeLogging(log_file);
223 226
224 while (optind < argc) { 227 while (optind < argc) {
225 int arg = getopt_long(argc, argv, "n:d:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index); 228 int arg = getopt_long(argc, argv, "n:d:s:p:m:w:g:u:t:a:i:l:hv", long_options, &option_index);
226 if (arg != -1) { 229 if (arg != -1) {
227 switch (static_cast<char>(arg)) { 230 switch (static_cast<char>(arg)) {
228 case 'n': 231 case 'n':
@@ -231,6 +234,9 @@ int main(int argc, char** argv) {
231 case 'd': 234 case 'd':
232 room_description.assign(optarg); 235 room_description.assign(optarg);
233 break; 236 break;
237 case 's':
238 bind_address.assign(optarg);
239 break;
234 case 'p': 240 case 'p':
235 port = strtoul(optarg, &endarg, 0); 241 port = strtoul(optarg, &endarg, 0);
236 break; 242 break;
@@ -295,6 +301,9 @@ int main(int argc, char** argv) {
295 PrintHelp(argv[0]); 301 PrintHelp(argv[0]);
296 return -1; 302 return -1;
297 } 303 }
304 if (bind_address.empty()) {
305 LOG_INFO(Network, "Bind address is empty: defaulting to 0.0.0.0");
306 }
298 if (port > UINT16_MAX) { 307 if (port > UINT16_MAX) {
299 LOG_ERROR(Network, "Port needs to be in the range 0 - 65535!"); 308 LOG_ERROR(Network, "Port needs to be in the range 0 - 65535!");
300 PrintHelp(argv[0]); 309 PrintHelp(argv[0]);
@@ -358,7 +367,7 @@ int main(int argc, char** argv) {
358 if (auto room = network.GetRoom().lock()) { 367 if (auto room = network.GetRoom().lock()) {
359 AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game, 368 AnnounceMultiplayerRoom::GameInfo preferred_game_info{.name = preferred_game,
360 .id = preferred_game_id}; 369 .id = preferred_game_id};
361 if (!room->Create(room_name, room_description, "", port, password, max_members, username, 370 if (!room->Create(room_name, room_description, bind_address, port, password, max_members, username,
362 preferred_game_info, std::move(verify_backend), ban_list, 371 preferred_game_info, std::move(verify_backend), ban_list,
363 enable_yuzu_mods)) { 372 enable_yuzu_mods)) {
364 LOG_INFO(Network, "Failed to create room: "); 373 LOG_INFO(Network, "Failed to create room: ");