From e87c73c1b7bfda5dbade80e306bf0d14a27b9c55 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Tue, 17 May 2022 23:27:52 -0700 Subject: [PATCH] add subcommand B4 --- src/ReceiveSubcommands.cc | 12 +++++++++++- src/SendCommands.cc | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index f1820aff..450c4516 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -1003,6 +1003,16 @@ static void process_subcommand_forward_check_size_ep3_lobby(shared_ptr, + shared_ptr l, shared_ptr c, uint8_t command, uint8_t flag, + const string& data) { + check_size_sc(data, sizeof(PSOSubcommand), 0xFFFF); + if (!l->is_game() || !(l->flags & Lobby::Flag::EPISODE_3_ONLY)) { + return; + } + forward_subcommand(l, c, command, flag, data); +} + static void process_subcommand_invalid(shared_ptr, shared_ptr, shared_ptr, uint8_t command, uint8_t flag, const string& data) { @@ -1215,7 +1225,7 @@ subcommand_handler_t subcommand_handlers[0x100] = { /* B1 */ process_subcommand_unimplemented, /* B2 */ process_subcommand_unimplemented, /* B3 */ process_subcommand_unimplemented, - /* B4 */ process_subcommand_unimplemented, + /* B4 */ process_subcommand_forward_check_size_ep3_game, /* B5 */ process_subcommand_open_shop_bb_or_unknown_ep3, // BB shop request /* B6 */ process_subcommand_unimplemented, // BB shop contents (server->client only) /* B7 */ process_subcommand_unimplemented, // TODO: BB buy shop item diff --git a/src/SendCommands.cc b/src/SendCommands.cc index 263d2129..d7326c6a 100644 --- a/src/SendCommands.cc +++ b/src/SendCommands.cc @@ -1317,7 +1317,7 @@ void send_ep3_map_list(shared_ptr l) { string data(16, '\0'); PSOSubcommand* subs = reinterpret_cast(data.data()); subs[0].dword = 0x000000B6; - subs[1].dword = (23 + file_data->size()) & 0xFFFFFFFC; + subs[1].dword = (file_data->size() + 0x14 + 3) & 0xFFFFFFFC; subs[2].dword = 0x00000040; subs[3].dword = file_data->size(); data += *file_data;