From 0a522e6ac467b8a1071afdda85d08502f0e4323d Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 27 Nov 2023 14:40:42 -0800 Subject: [PATCH] add support for 12/2000 DC prototype --- notes/dc-proto-connection-addresses.txt | 2 +- src/ReceiveSubcommands.cc | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/notes/dc-proto-connection-addresses.txt b/notes/dc-proto-connection-addresses.txt index 0a4364f7..01d769e2 100644 --- a/notes/dc-proto-connection-addresses.txt +++ b/notes/dc-proto-connection-addresses.txt @@ -1,5 +1,5 @@ DC NTE: pso02.dricas.ne.jp Nov 2000 proto: test1.st-pso.games.sega.net -Dec 2000 proto: sg107634.csrd.sega.co.jp +Dec 2000 proto: sg107634.csrd.sega.co.jp OR master.pso.dream-key.com Jan 2001 proto: master.pso.dream-key.com Aug 2001 proto (v2): ??? diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index 80b2cb73..a4e5e37c 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -62,7 +62,12 @@ static void forward_subcommand( throw runtime_error("Episode 3 command sent by non-Episode 3 client"); } - auto l = c->require_lobby(); + auto l = c->lobby.lock(); + if (!l) { + c->log.warning("Not in any lobby; dropping command"); + return; + } + if (command_is_private(command)) { if (flag >= l->max_clients) { return; @@ -671,11 +676,11 @@ static void on_set_player_visible(shared_ptr c, uint8_t command, uint8_t if (cmd.header.client_id == c->lobby_client_id) { forward_subcommand(c, command, flag, data, size, 0x1F, 0x21); - auto l = c->require_lobby(); - if (!l->is_game() && !is_v1(c->version())) { + auto l = c->lobby.lock(); + if (l && !l->is_game() && !is_v1(c->version())) { send_arrow_update(l); } - if (!l->is_game() && l->check_flag(Lobby::Flag::IS_OVERFLOW)) { + if (l && !l->is_game() && l->check_flag(Lobby::Flag::IS_OVERFLOW)) { send_message_box(c, "$C6All lobbies are full.\n\n$C7You are in a private lobby. You can use the\nteleporter to join other lobbies if there is space\navailable."); send_lobby_message_box(c, ""); } @@ -2970,7 +2975,11 @@ SubcommandDefinition subcommand_definitions[0x100] = { }; static void handle_subcommand_dc_prototypes(shared_ptr c, uint8_t command, uint8_t flag, const void* data, size_t size) { - auto l = c->require_lobby(); + auto l = c->lobby.lock(); + if (!l) { + return; + } + if (l->is_game()) { // DC NTE doesn't send 6F when it's done loading, so treat this command as // 6F instead.