add CallProtectedHandler on BB

This commit is contained in:
Martin Michelsen
2024-05-11 22:31:09 -07:00
parent 251a9ecd0a
commit 2ed97974e0
4 changed files with 45 additions and 17 deletions
+4 -11
View File
@@ -1422,17 +1422,10 @@ static void on_player_revivable(shared_ptr<Client> c, uint8_t command, uint8_t f
const void* c_data = (!is_v1_or_v2(c->version()) || (c->version() == Version::GC_NTE))
? static_cast<const void*>(&v3_cmd)
: static_cast<const void*>(&v2_cmd);
if (send_protected_command(c, c_data, sizeof(v3_cmd), false)) {
for (auto lc : l->clients) {
if (!lc || (lc == c)) {
continue;
}
const void* lc_data = (!is_v1_or_v2(lc->version()) || (lc->version() == Version::GC_NTE))
? static_cast<const void*>(&v3_cmd)
: static_cast<const void*>(&v2_cmd);
send_command(lc, 0x60, 0x00, lc_data, sizeof(v3_cmd));
}
}
// TODO: We might need to send different versions of the command here to
// different clients in certain crossplay scenarios, so just using
// echo_to_lobby would not suffice. Figure out a way to handle this.
send_protected_command(c, c_data, sizeof(v3_cmd), true);
}
}
+3 -4
View File
@@ -508,7 +508,8 @@ bool send_protected_command(std::shared_ptr<Client> c, const void* data, size_t
case Version::GC_V3:
case Version::XB_V3:
case Version::GC_EP3_NTE:
case Version::GC_EP3: {
case Version::GC_EP3:
case Version::BB_V4: {
auto s = c->require_server_state();
if (!s->enable_v3_v4_protected_subcommands ||
c->config.check_flag(Client::Flag::NO_SEND_FUNCTION_CALL) ||
@@ -2489,9 +2490,7 @@ void send_remove_conditions(shared_ptr<Client> c) {
cmd.unknown_a1 = z;
cmd.unknown_a2 = 0;
}
if (send_protected_command(c, &cmds, sizeof(cmds), true)) {
send_command_excluding_client(c->require_lobby(), c, 0x60, 0x00, &cmds, sizeof(cmds));
}
send_protected_command(c, &cmds, sizeof(cmds), true);
}
void send_remove_conditions(Channel& ch, uint16_t client_id) {