add GetExtendedPlayerInfo for xbox

This commit is contained in:
Martin Michelsen
2024-05-04 11:17:44 -07:00
parent ca6605877a
commit a35753fdf1
10 changed files with 203 additions and 1 deletions
+1 -1
View File
@@ -440,7 +440,7 @@ public:
} else if (tokens[0] == "match") {
this->find_all_matches(
stoul(tokens.at(1), nullptr, 16),
tokens.size() >= 2 ? stoul(tokens.at(2), nullptr, 16) : 0);
tokens.size() >= 3 ? stoul(tokens[2], nullptr, 16) : 0);
} else if (tokens[0] == "find-ppc-globals") {
this->find_ppc_rtoc_global_regs();
} else if (!tokens[0].empty()) {
@@ -0,0 +1,16 @@
.meta hide_from_patches_menu
.meta name="GetExtendedPlayerInfo"
.meta description=""
entry_ptr:
reloc0:
.offsetof start
start:
.include GetExtendedPlayerInfoXB
data:
.data 0x002FE5A0 # malloc9(uint32_t size @ stack)
.data 0x00632E04 # char_file_part1
.data 0x00632EA8 # char_file_part2
.data 0x0072459C # root_protocol
.data 0x002FE650 # free9(void* ptr @ stack)
.data 0x002AD870 # TProtocol::wait_send_drain(TProtocol* this @ esi)
@@ -0,0 +1,16 @@
.meta hide_from_patches_menu
.meta name="GetExtendedPlayerInfo"
.meta description=""
entry_ptr:
reloc0:
.offsetof start
start:
.include GetExtendedPlayerInfoXB
data:
.data 0x002FE700 # malloc9(uint32_t size @ stack)
.data 0x0063269C # char_file_part1
.data 0x00632740 # char_file_part2
.data 0x00723E20 # root_protocol
.data 0x002FE7B0 # free9(void* ptr @ stack)
.data 0x002ADA50 # TProtocol::wait_send_drain(TProtocol* this @ esi)
@@ -0,0 +1,16 @@
.meta hide_from_patches_menu
.meta name="GetExtendedPlayerInfo"
.meta description=""
entry_ptr:
reloc0:
.offsetof start
start:
.include GetExtendedPlayerInfoXB
data:
.data 0x002FC5C0 # malloc9(uint32_t size @ stack)
.data 0x0062D844 # char_file_part1
.data 0x0062D8E8 # char_file_part2
.data 0x0071EEFC # root_protocol
.data 0x002FC670 # free9(void* ptr @ stack)
.data 0x002ABE30 # TProtocol::wait_send_drain(TProtocol* this @ esi)
@@ -0,0 +1,16 @@
.meta hide_from_patches_menu
.meta name="GetExtendedPlayerInfo"
.meta description=""
entry_ptr:
reloc0:
.offsetof start
start:
.include GetExtendedPlayerInfoXB
data:
.data 0x002FD110 # malloc9(uint32_t size @ stack)
.data 0x0062DDE4 # char_file_part1
.data 0x0062DE88 # char_file_part2
.data 0x0071F55C # root_protocol
.data 0x002FD1C0 # free9(void* ptr @ stack)
.data 0x002AC910 # TProtocol::wait_send_drain(TProtocol* this @ esi)
@@ -0,0 +1,16 @@
.meta hide_from_patches_menu
.meta name="GetExtendedPlayerInfo"
.meta description=""
entry_ptr:
reloc0:
.offsetof start
start:
.include GetExtendedPlayerInfoXB
data:
.data 0x002FE700 # malloc9(uint32_t size @ stack)
.data 0x0063591C # char_file_part1
.data 0x006359C0 # char_file_part2
.data 0x007270A0 # root_protocol
.data 0x002FE7B0 # free9(void* ptr @ stack)
.data 0x002ADDE0 # TProtocol::wait_send_drain(TProtocol* this @ esi)
@@ -0,0 +1,16 @@
.meta hide_from_patches_menu
.meta name="GetExtendedPlayerInfo"
.meta description=""
entry_ptr:
reloc0:
.offsetof start
start:
.include GetExtendedPlayerInfoXB
data:
.data 0x002FE5D0 # malloc9(uint32_t size @ stack)
.data 0x00632E04 # char_file_part1
.data 0x00632EA8 # char_file_part2
.data 0x0072459C # root_protocol
.data 0x002FE680 # free9(void* ptr @ stack)
.data 0x002AD890 # TProtocol::wait_send_drain(TProtocol* this @ esi)
@@ -0,0 +1,16 @@
.meta hide_from_patches_menu
.meta name="GetExtendedPlayerInfo"
.meta description=""
entry_ptr:
reloc0:
.offsetof start
start:
.include GetExtendedPlayerInfoXB
data:
.data 0x002FE770 # malloc9(uint32_t size @ stack)
.data 0x0063319C # char_file_part1
.data 0x00633240 # char_file_part2
.data 0x00724920 # root_protocol
.data 0x002FE820 # free9(void* ptr @ stack)
.data 0x002ADB10 # TProtocol::wait_send_drain(TProtocol* this @ esi)
@@ -0,0 +1,76 @@
# esp = 0xd0031ce0
push ebx
push edi
push esi
jmp get_data_ptr
get_data_ptr_ret:
pop ebx
push 0x28CC
call [ebx] # malloc9(0x28CC)
add esp, 4
test eax, eax
jz malloc9_failed
mov edi, eax
mov dword [edi], 0x28CC0030 # header = 30 00 CC 28
lea eax, [edi + 0x0004]
mov edx, [ebx + 0x04]
mov edx, [edx]
mov ecx, 0x41C
call memcpy # memcpy(data + 4, char_file_part1, sizeof(char_file_part1))
lea eax, [edi + 0x0420]
mov edx, [ebx + 0x08]
mov edx, [edx]
mov ecx, 0x24AC
call memcpy # memcpy(data + 4 + sizeof(char_file_part1), char_file_part2, sizeof(char_file_part2))
push 0x28CC # remaining_bytes = 0x28CC
push edi # orig_send_ptr
mov esi, [ebx + 0x0C]
mov esi, [esi] # root_protocol
send_again: # while (remaining_bytes != 0)
call [ebx + 0x14] # root_protocol->wait_send_drain()
test eax, eax
jnz drain_failed
mov eax, [esi] # eax = root_protocol->vtable
mov ecx, 0x550
mov edx, [esp + 4]
cmp edx, ecx
cmovg edx, ecx # this_chunk_size = min<uint32_t>(remaining_bytes, 0x550)
push edx # this_chunk_size (for after return)
push edx
push edi
mov ecx, esi
call [eax + 0x20] # root_protocol->send(send_ptr, this_chunk_size)
pop edx
add edi, edx # send_ptr += this_chunk_size
sub [esp + 4], edx # remaining_bytes -= this_chunk_size
cmp dword [esp + 4], 0
jne send_again
drain_failed:
# orig_send_ptr is still on the stack from before the above loop
call [ebx + 0x10] # free9(orig_send_ptr)
add esp, 8 # orig_send_ptr, remaining_bytes
mov eax, 1
malloc9_failed:
pop esi
pop edi
pop ebx
ret
memcpy:
.include CopyData
ret
get_data_ptr:
call get_data_ptr_ret
@@ -0,0 +1,14 @@
# eax = dest ptr
# edx = src ptr
# ecx = size
# Clobbers eax, ecx, edx
push ebx
again:
test ecx, ecx
jz done
dec ecx
mov bl, [edx + ecx]
mov [eax + ecx], bl
jmp again
done:
pop ebx