write xb decoction patch

This commit is contained in:
Martin Michelsen
2024-02-27 23:07:35 -08:00
parent af1c0a548d
commit 72794ad50e
10 changed files with 210 additions and 10 deletions
@@ -12,22 +12,22 @@ start:
# region @ 80351638 (152 bytes)
.data 0x80351638 # address
.data 0x00000098 # size
.data 0x880300EE # 80351638 => lbz r0, [r3 + 0x00EE]
.data 0x880300EE # 80351638 => lbz r0, [r3 + 0x00EE] # data1_2
.data 0x2800000B # 8035163C => cmplwi r0, 11
.data 0x40820144 # 80351640 => bne +0x00000144 /* 80351784 */
.data 0x83E300F0 # 80351644 => lwz r31, [r3 + 0x00F0]
.data 0x83E300F0 # 80351644 => lwz r31, [r3 + 0x00F0] # r31 = owner_player
.data 0x38000000 # 80351648 => li r0, 0x0000
.data 0x60000000 # 8035164C => nop
.data 0x38800374 # 80351650 => li r4, 0x0374
.data 0x38A00D38 # 80351654 => li r5, 0x0D38
.data 0x38800374 # 80351650 => li r4, 0x0374 # material_usage
.data 0x38A00D38 # 80351654 => li r5, 0x0D38 # stats.char_stats.atp
.data 0x48000059 # 80351658 => bl +0x00000058 /* 803516B0 */
.data 0x38A00D3A # 8035165C => li r5, 0x0D3A
.data 0x38A00D3A # 8035165C => li r5, 0x0D3A # stats.char_stats.mst
.data 0x48000051 # 80351660 => bl +0x00000050 /* 803516B0 */
.data 0x38A00D3C # 80351664 => li r5, 0x0D3C
.data 0x38A00D3C # 80351664 => li r5, 0x0D3C # stats.char_stats.evp
.data 0x48000049 # 80351668 => bl +0x00000048 /* 803516B0 */
.data 0x38A00D40 # 8035166C => li r5, 0x0D40
.data 0x38A00D40 # 8035166C => li r5, 0x0D40 # stats.char_stats.dfp
.data 0x48000041 # 80351670 => bl +0x00000040 /* 803516B0 */
.data 0x38A00D44 # 80351674 => li r5, 0x0D44
.data 0x38A00D44 # 80351674 => li r5, 0x0D44 # stats.char_stats.lck
.data 0x48000039 # 80351678 => bl +0x00000038 /* 803516B0 */
.data 0x7FE3FB78 # 8035167C => mr r3, r31
.data 0x4BE64B95 # 80351680 => bl -0x0019B46C /* 801B6214 */
@@ -0,0 +1,22 @@
.meta name="Decoction"
.meta description="Make the Decoction\nitem reset your\nmaterial usage"
# Original code by Ralf @ GC-Forever and Aleron Ives
# https://www.gc-forever.com/forums/viewtopic.php?t=2050
# https://www.gc-forever.com/forums/viewtopic.php?t=2049
# Xbox port by fuzziqersoftware
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
.data 0x00184340
.deltaof code_start, code_end
code_start:
.include DecoctionXB
code_end:
.data 0x00184341
.data 0x00000004
.data 0x001FD5E0
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,22 @@
.meta name="Decoction"
.meta description="Make the Decoction\nitem reset your\nmaterial usage"
# Original code by Ralf @ GC-Forever and Aleron Ives
# https://www.gc-forever.com/forums/viewtopic.php?t=2050
# https://www.gc-forever.com/forums/viewtopic.php?t=2049
# Xbox port by fuzziqersoftware
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
.data 0x00184310
.deltaof code_start, code_end
code_start:
.include DecoctionXB
code_end:
.data 0x00184311
.data 0x00000004
.data 0x001FD5E0
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,22 @@
.meta name="Decoction"
.meta description="Make the Decoction\nitem reset your\nmaterial usage"
# Original code by Ralf @ GC-Forever and Aleron Ives
# https://www.gc-forever.com/forums/viewtopic.php?t=2050
# https://www.gc-forever.com/forums/viewtopic.php?t=2049
# Xbox port by fuzziqersoftware
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
.data 0x00184160
.deltaof code_start, code_end
code_start:
.include DecoctionXB
code_end:
.data 0x00184161
.data 0x00000004
.data 0x001FD3D0
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,22 @@
.meta name="Decoction"
.meta description="Make the Decoction\nitem reset your\nmaterial usage"
# Original code by Ralf @ GC-Forever and Aleron Ives
# https://www.gc-forever.com/forums/viewtopic.php?t=2050
# https://www.gc-forever.com/forums/viewtopic.php?t=2049
# Xbox port by fuzziqersoftware
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
.data 0x00184350
.deltaof code_start, code_end
code_start:
.include DecoctionXB
code_end:
.data 0x00184351
.data 0x00000004
.data 0x001FD530
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,22 @@
.meta name="Decoction"
.meta description="Make the Decoction\nitem reset your\nmaterial usage"
# Original code by Ralf @ GC-Forever and Aleron Ives
# https://www.gc-forever.com/forums/viewtopic.php?t=2050
# https://www.gc-forever.com/forums/viewtopic.php?t=2049
# Xbox port by fuzziqersoftware
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
.data 0x00184400
.deltaof code_start, code_end
code_start:
.include DecoctionXB
code_end:
.data 0x00184401
.data 0x00000004
.data 0x001FD7B0
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,22 @@
.meta name="Decoction"
.meta description="Make the Decoction\nitem reset your\nmaterial usage"
# Original code by Ralf @ GC-Forever and Aleron Ives
# https://www.gc-forever.com/forums/viewtopic.php?t=2050
# https://www.gc-forever.com/forums/viewtopic.php?t=2049
# Xbox port by fuzziqersoftware
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
.data 0x00184360
.deltaof code_start, code_end
code_start:
.include DecoctionXB
code_end:
.data 0x00184361
.data 0x00000004
.data 0x001FD600
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,22 @@
.meta name="Decoction"
.meta description="Make the Decoction\nitem reset your\nmaterial usage"
# Original code by Ralf @ GC-Forever and Aleron Ives
# https://www.gc-forever.com/forums/viewtopic.php?t=2050
# https://www.gc-forever.com/forums/viewtopic.php?t=2049
# Xbox port by fuzziqersoftware
entry_ptr:
reloc0:
.offsetof start
start:
.include WriteCodeBlocksXB
.data 0x001842D0
.deltaof code_start, code_end
code_start:
.include DecoctionXB
code_end:
.data 0x001842D1
.data 0x00000004
.data 0x001FD670
.data 0x00000000
.data 0x00000000
@@ -0,0 +1,46 @@
start:
mov eax, 0x88888888 # eax = &player_compute_implied_stats
lea edx, [ecx + 0x78]
cmp byte [edx + 0x76], 11 # this->data1[2] (item+0xEE) ?= 0x0B
jne skip_all
push esi
push ebx
mov ebx, [edx + 0x78] # ebx = item->owner_player (item+0xF0)
lea esi, [ebx + 0x037C] # esi = &ebx->material_usage
lea edx, [ebx + 0x0D48] # edx = &ebx->stats.char_stats.atp
push 0
push 4
push 4
push 2
push 2
next_stat:
xor ecx, ecx
xchg cl, byte [esi] # ecx = material count; material count = 0
shl ecx, 1 # ecx = material count * 2
sub [edx], cx # stat -= cx
inc esi
pop ecx
add edx, ecx
test ecx, ecx
jne next_stat
mov ecx, ebx
call eax # player_compute_implied_stats
lea ecx, [ebx + 0x0330]
mov eax, [ecx - 0x74] # ax = max_hp (player+0x2BC) and eax high = max_tp (player+0x2BE)
mov edx, [ecx] # dx = current_hp (player+0x330) and edx high = current_tp (player+0x332)
cmp dx, ax # current_hp vs. max_hp
cmovg dx, ax # if current_hp above max_hp, current_hp = max_hp
mov ax, dx # max_hp = current_hp (space optimization so we can use 32-bit opcodes below)
cmp edx, eax # current_tp vs. max_tp
cmovg edx, eax # if current_tp above max_tp, current_tp = max_tp (low 16 bits of both regs are always equal at this point)
mov [ecx], edx # write current_hp and current_tp
pop ebx
pop esi
skip_all:
ret
+2 -2
View File
@@ -28,12 +28,12 @@ process_stick_value:
cmova ecx, eax # if X2 out of deadzone range, use eax
mov edx, eax
bswap edx # dh = Y2
lea edx, [edx + 0x2800] # dh = Y2 + 0x28
add dh, 0x28 # dh = Y2 + 0x28
cmp dh, 0x50
cmova ecx, eax # if Y2 out of deadzone range, use eax
mov [esi + 0x18], ecx # set processed stick values
ret
.zero 0x53
.zero 0x56
end: