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) {
@@ -7,8 +7,8 @@ reloc0:
.offsetof start
start:
.include CallProtectedHandlerXB
.data 0x007237E8
.data 0x002DE000
.data 0x007237E8 # should_allow_protected_commands
.data 0x002DE000 # handle_6x(void* data @ ecx, uint32_t size @ eax)
size:
.data 0x00000000
data:
@@ -0,0 +1,36 @@
.meta hide_from_patches_menu
.meta name="CallProtectedHandler"
.meta description=""
entry_ptr:
reloc0:
.offsetof start
start:
jmp get_data_addr
resume:
xchg ebx, [esp]
mov edx, [ebx]
mov dword [edx], 1
mov edx, [ebx + 4]
push dword [ebx + 8]
lea ecx, [ebx + 0x0C]
push ecx
call edx # RcvPsoData2(data, size)
add esp, 8
mov edx, [ebx]
mov dword [edx], 0
pop ebx
ret
get_data_addr:
call resume
.data 0x00AAECF0 # should_allow_protected_commands
.data 0x00800860 # RcvPsoData2(void* data @ stack, uint32_t size @ stack)
size:
.data 0x00000000
data: