Found out more about f0.
Added `f1`.
This commit is contained in:
parent
0d7b4dc4cc
commit
1ea022c780
@ -3365,22 +3365,8 @@ start:
|
||||
.L800134a0: lw $s0, 16($sp)
|
||||
.L800134a4: jr $ra
|
||||
.L800134a8: addiu $sp, 32
|
||||
.L800134ac: move_ $v1, $zr
|
||||
.L800134b0: lui $v0, 0x8004
|
||||
.L800134b4: addiu $a1, $v0, -4260
|
||||
.L800134b8: lhu $v0, 0($a1)
|
||||
.L800134bc: nop
|
||||
.L800134c0: beq $v0, $a0, .L800134e0
|
||||
.L800134c4: move_ $v0, $v1
|
||||
.L800134c8: addiu $v1, 1
|
||||
.L800134cc: slti $v0, $v1, 52
|
||||
.L800134d0: bnez $v0, .L800134b8
|
||||
.L800134d4: addiu $a1, 88
|
||||
.L800134d8: jr $ra
|
||||
.L800134dc: li $v0, -1
|
||||
.L800134e0: jr $ra
|
||||
.L800134e4: nop
|
||||
|
||||
.include "SLES_039.36/f1.s"
|
||||
.include "SLES_039.36/f0.s"
|
||||
|
||||
.L80013534: li $v1, 7
|
||||
@ -47370,6 +47356,7 @@ start:
|
||||
|
||||
# Kotemon
|
||||
#
|
||||
digimon_stats:
|
||||
.L8003ef5c: .word 0x0030017f
|
||||
.L8003ef60: .word 0x0029002c
|
||||
.L8003ef64: .word 0x00210022
|
||||
@ -48612,6 +48599,7 @@ start:
|
||||
.L80040238: .word 0x01010101
|
||||
.L8004023c: .word 0x00000000
|
||||
.L80040240: .word 0x00013700
|
||||
digimon_stats_end:
|
||||
|
||||
# ???
|
||||
#
|
||||
@ -77995,7 +77983,7 @@ start:
|
||||
.L8005cc94: .word 0x00000004
|
||||
.L8005cc98: .word 0x00000004
|
||||
.L8005cc9c: .word 0x00000004
|
||||
.L8005cca0: .word .L800134e8
|
||||
.L8005cca0: .word f0
|
||||
.L8005cca4: .word 0x0000094e
|
||||
.L8005cca8: .word 0x00000002
|
||||
.L8005ccac: .word 0x00000000
|
||||
|
||||
@ -1,19 +1,28 @@
|
||||
# Loads the digimon stats
|
||||
.L800134e8: addiu $sp, -24
|
||||
.L800134ec: sw $ra, 16($sp)
|
||||
.L800134f0: jal .L800134ac
|
||||
.L800134f4: nop
|
||||
.L800134f8: move_ $v1, $v0
|
||||
.L800134fc: bltz $v1, .L80013524
|
||||
.L80013500: move_ $v0, $zr
|
||||
.L80013504: sll $v0, $v1, 0x1
|
||||
.L80013508: addu $v0, $v1
|
||||
.L8001350c: sll $v0, 0x2
|
||||
.L80013510: subu $v0, $v1
|
||||
.L80013514: sll $v0, 0x3
|
||||
.L80013518: la_ $v1, .L8003ef5c # Digimon stats
|
||||
.L80013520: addu $v0, $v1
|
||||
.L80013524: lw $ra, 16($sp)
|
||||
.L80013528: nop
|
||||
.L8001352c: jr $ra
|
||||
.L80013530: addiu $sp, 24
|
||||
# Returns the pointer to the current digimon stat
|
||||
# `fn f0(u32 value) -> *u32`
|
||||
f0:
|
||||
addiu $sp, -24
|
||||
sw $ra, 16($sp)
|
||||
|
||||
# If the return from `u32 idx = f1()` is negative, return 0
|
||||
jal f1
|
||||
nop
|
||||
move_ $v1, $v0
|
||||
bltz $v1, .Lexit$
|
||||
move_ $v0, $zr
|
||||
|
||||
# Else return `digimon_stats + idx * 0x58`, the `idx`th digimon stat pointer
|
||||
sll $v0, $v1, 0x1
|
||||
addu $v0, $v1
|
||||
sll $v0, 0x2
|
||||
subu $v0, $v1
|
||||
sll $v0, 0x3
|
||||
la_ $v1, digimon_stats # Digimon stats
|
||||
addu $v0, $v1
|
||||
|
||||
.Lexit$:
|
||||
lw $ra, 16($sp)
|
||||
nop
|
||||
jr $ra
|
||||
addiu $sp, 24
|
||||
f0_end:
|
||||
|
||||
37
dw2003/SLES_039.36/f1.s
Normal file
37
dw2003/SLES_039.36/f1.s
Normal file
@ -0,0 +1,37 @@
|
||||
# Returns the digimon stat index of the first digimon with `value0 = value`
|
||||
# `fn f1(u32 value) -> u32`
|
||||
f1:
|
||||
cur_idx=$v1
|
||||
digimon_stats_ptr=$a1
|
||||
|
||||
# Setup the digimon stats pointer and the current index
|
||||
move_ cur_idx, $zr
|
||||
lui $v0, %hi(digimon_stats)
|
||||
addiu digimon_stats_ptr, $v0, %lo(digimon_stats)
|
||||
|
||||
# Then loop through all stats
|
||||
.Lloop$:
|
||||
# If `digimon_stats[cur_idx].value0 == value`, return the digimon index (`cur_idx`)
|
||||
lhu $v0, (digimon_stats_ptr)
|
||||
nop
|
||||
beq $v0, $a0, .Lfound$
|
||||
move_ $v0, cur_idx
|
||||
|
||||
# Else try the next one
|
||||
addiu cur_idx, 1
|
||||
slti $v0, cur_idx, 52
|
||||
bnez $v0, .Lloop$
|
||||
addiu digimon_stats_ptr, 88
|
||||
|
||||
# Return -1 if we didn't find it
|
||||
.Lnot_found$:
|
||||
jr $ra
|
||||
li $v0, -1
|
||||
|
||||
.Lfound$:
|
||||
jr $ra
|
||||
nop
|
||||
|
||||
cur_idx=$
|
||||
digimon_stats_ptr=$
|
||||
f1_end:
|
||||
Loading…
x
Reference in New Issue
Block a user