From 4ed641e6f460c8bf89d0a794f6def6bcb5d6e72b Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Tue, 21 Feb 2023 20:24:38 -0800 Subject: [PATCH] refine meet user extension structure --- src/CommandFormats.hh | 9 ++++++--- src/ProxyCommands.cc | 4 ---- src/ReceiveCommands.cc | 20 ++++++++++---------- src/SendCommands.cc | 4 ++-- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/CommandFormats.hh b/src/CommandFormats.hh index 11d06bd9..ae82448b 100644 --- a/src/CommandFormats.hh +++ b/src/CommandFormats.hh @@ -868,9 +868,12 @@ struct C_GuildCardSearch_40 { template struct SC_MeetUserExtension { - le_uint32_t menu_id = 0; - le_uint32_t lobby_id = 0; - parray unknown_a1; + struct LobbyReference { + le_uint32_t menu_id = 0; + le_uint32_t item_id = 0; + } __packed__; + parray lobby_refs; + le_uint32_t unknown_a2 = 0; ptext player_name; } __packed__; diff --git a/src/ProxyCommands.cc b/src/ProxyCommands.cc index ad828b23..5b15a2de 100644 --- a/src/ProxyCommands.cc +++ b/src/ProxyCommands.cc @@ -185,8 +185,6 @@ static HandlerResult S_G_9A(shared_ptr, cmd.name = session.character_name; } cmd.client_config.data = session.remote_client_config_data; - cmd.extension.menu_id = 0; - cmd.extension.lobby_id = 0; // If there's a guild card number, a shorter 9E is sent that ends // right after the client config data @@ -392,8 +390,6 @@ static HandlerResult S_V123P_02_17( cmd.name = session.character_name; } cmd.client_config.data = session.remote_client_config_data; - cmd.extension.menu_id = 0; - cmd.extension.lobby_id = 0; session.server_channel.send(0x9E, 0x01, &cmd, sizeof(C_Login_GC_9E)); return HandlerResult::Type::SUPPRESS; diff --git a/src/ReceiveCommands.cc b/src/ReceiveCommands.cc index 8bb69cc0..b03b972f 100644 --- a/src/ReceiveCommands.cc +++ b/src/ReceiveCommands.cc @@ -401,8 +401,8 @@ static void on_8B_DCNTE(shared_ptr s, shared_ptr c, if (cmd.is_extended) { const auto& ext_cmd = check_size_t(data); - if (ext_cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = ext_cmd.extension.lobby_id; + if (ext_cmd.extension.lobby_refs[0].menu_id == MenuID::LOBBY) { + c->preferred_lobby_id = ext_cmd.extension.lobby_refs[0].item_id; } } @@ -482,8 +482,8 @@ static void on_93_DC(shared_ptr s, shared_ptr c, if (cmd.is_extended) { const auto& ext_cmd = check_size_t(data); - if (ext_cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = ext_cmd.extension.lobby_id; + if (ext_cmd.extension.lobby_refs[0].menu_id == MenuID::LOBBY) { + c->preferred_lobby_id = ext_cmd.extension.lobby_refs[0].item_id; } } @@ -619,13 +619,13 @@ static void on_9D_9E(shared_ptr s, shared_ptr c, if (base_cmd->is_extended) { if (c->version() == GameVersion::PC) { const auto& cmd = check_size_t(data); - if (cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = cmd.extension.lobby_id; + if (cmd.extension.lobby_refs[0].menu_id == MenuID::LOBBY) { + c->preferred_lobby_id = cmd.extension.lobby_refs[0].item_id; } } else { const auto& cmd = check_size_t(data); - if (cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = cmd.extension.lobby_id; + if (cmd.extension.lobby_refs[0].menu_id == MenuID::LOBBY) { + c->preferred_lobby_id = cmd.extension.lobby_refs[0].item_id; } } } @@ -650,8 +650,8 @@ static void on_9D_9E(shared_ptr s, shared_ptr c, base_cmd = &cmd; if (cmd.is_extended) { const auto& cmd = check_size_t(data); - if (cmd.extension.menu_id == MenuID::LOBBY) { - c->preferred_lobby_id = cmd.extension.lobby_id; + if (cmd.extension.lobby_refs[0].menu_id == MenuID::LOBBY) { + c->preferred_lobby_id = cmd.extension.lobby_refs[0].item_id; } } diff --git a/src/SendCommands.cc b/src/SendCommands.cc index 638852ba..1688f64d 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -902,8 +902,8 @@ void send_card_search_result_t( result_lobby->lobby_id, encoded_server_name.c_str()); } cmd.location_string = location_string; - cmd.extension.menu_id = MenuID::LOBBY; - cmd.extension.lobby_id = result->lobby_id; + cmd.extension.lobby_refs[0].menu_id = MenuID::LOBBY; + cmd.extension.lobby_refs[0].item_id = result->lobby_id; cmd.extension.player_name = result->game_data.player()->disp.name; send_command_t(c, 0x41, 0x00, cmd);