..................... -Increment Player ID/CPU Stat View Toggle (801A3CE8)-
lis r12,0x8042
ori r12,r12,0x7940 # 80427940
lbz r10,0(r12) # loads player ID to display stuff for
addi r10,r10,1 # increment it
cmpwi r10,5
blt+ 0x8
li r10,0 # reset ID to 0 if above 4
stb r10,0(r12) # update player ID
blt+ END # skip disabling display if simply incrementing player ID
DISABLE:
lis r12,0x8016 # stuff to run if cycled beyond player 4 and disabling CPU Stat display
ori r12,r12,0x4BC0 # 80164BC0
mtlr r12
blrl
li r0,0
stw r0,-20344(r13) # clear pointer
END:
----------
801A3CEC: 38000000 li r0,0 -> nop
801A3CF0: 900DB088 stw r0,-20344(r13) -> nop
..................... -Load Player ID Instead of Frame Count (801A3E70)-
801A3E70: 3C608047 lis r3,-32697 -> lis r3,0x8042
801A3E74: 38637D90 addi r3,r3,32144 -> addi r3,r3,0x7940 # 80427940
801A3E78: 80630008 lwz r3,8(r3) -> lwz r3,4(r3) # loads player ID * 11111 (for readability)
..................... -Load Display Setting on Float Pair Change (Advance Right) (80224D70)-
cmpwi r0,1 # r0 is new pokemon setting (controls floats slot if 1-3)
blt+ END
cmpwi r0,3
bgt+ END
lis r10,0x8042
ori r10,r10,0x7947 # 80427947. settings address -0x1
lbzx r9,r10,r0 # loads floats setting for the slot
stw r9,0x60(r31) # store it into item setting so the float description text updates
END:
stw r0,0(r4) # entry point (80224D70). update pokemon setting after advancing Right
..................... -Load Display Setting on Float Pair Change (Advance Left) (80224DA8)-
cmpwi r0,1 # r0 is new pokemon setting (controls floats slot if 1-3)
blt+ END
cmpwi r0,3
bgt+ END
lis r10,0x8042
ori r10,r10,0x7947 # 80427947. settings address -0x1
lbzx r9,r10,r0 # loads floats setting for the slot
stw r9,0x60(r31) # store it into item setting so the float description text updates
END:
stw r0,0(r4) # entry point (80224DA8). update pokemon setting after advancing Left
..................... -Load Custom CPU Stat Floats (80390D68)-
stwu r1,-56(r1) # make space for 12 registers
stmw r20,8(r1) # push r20-r31 onto the stack
lis r31,0x8042
ori r31,r31,0x7940 # 80427940
lbz r30,0(r31) # loads player ID to display stuff for
cmpwi r30,1
blt- RESET_ID
cmpwi r30,4
ble+ SCALE_ID
RESET_ID:
li r30,1 # set player ID to 1 if not 1-4
SCALE_ID:
stb r30,0(r31) # store player ID
mulli r20,r30,11111 # scale up player id by 11111 (for on-screen readability)
stw r20,4(r31) # update player ID to display
DEFAULT_SETTINGS:
lwz r20,8(r31) # loads settings for displayed stuff
cmpwi r20,0 # 0 if no settings defined yet
bne+ DEFAULT_COLORS
lis r20,0x1419
ori r20,r20,0x1D00 # 14191D00. TopN, Char Velocity, Directional Input (System)
stw r20,8(r31) # default settings for displayed stuff
DEFAULT_COLORS:
li r20,0x3030 # 00003030 (- - 0 0)
li r21,0x6666 # 00006666 (- - f f)
lis r22,0x6666
ori r22,r22,0x3030 # 66663030 (f f 0 0)
lis r29,0x8040
ori r29,r29,0x84DE # 804084DE. Font color data address -0x1C
sth r21,0x1C(r29) # f f @804084FA (float 1 Red)
sth r21,0x20(r29) # f f @804084FE (float 1 Blue)
sth r21,0x2E(r29) # f f @8040850C (float 2 Blue)
sth r20,0x38(r29) # 0 0 @80408516 (float 3 Red)
stw r22,0x3A(r29) # f f 0 0 @80408518 (float 3 Green/Blue)
sth r20,0x46(r29) # 0 0 @80408524 (float 4 Red)
stw r22,0x48(r29) # f f 0 0 @80408526 (float 4 Green/Blue)
stw r22,0x54(r29) # f f 0 0 @80408532 (float 5 Red/Green)
sth r21,0x58(r29) # f f @80408536 (float 5 Blue)
stw r22,0x62(r29) # f f 0 0 @80408540 (float 6 Red/Green)
sth r21,0x66(r29) # f f @80408544 (float 6 Blue)
UPDATE_SETTING:
addi r31,r31,7 # 80427947. settings address -0x1
lis r28,0x8049
ori r28,r28,0xD978 # 8049D978. Address of Debug Item/Pokemon Settings
lwz r27,0x4(r28) # loads Pokemon Setting
cmpwi r27,1
blt+ FLOAT_PREP
cmpwi r27,3
bgt+ FLOAT_PREP # no float font highlight or updating floats setting if not slots 1-3
lwz r24,0x0(r28) # loads Item Setting
stbx r24,r31,r27 # stores item setting as floats setting for the slot
HIGHLIGHT:
mulli r23,r27,0x1C # float pairs' color data 0x1C apart. 1st float in pair offset
addi r24,r23,0xE # 2nd float in pair offset
sthx r21,r29,r23 # 1st float Red = f f
sthx r21,r29,r24 # 2nd float Red = f f
addi r23,r23,2 # moves 1st float offset to Green/Blue
addi r24,r24,2 # moves 2nd float offset to Green/Blue
stwx r22,r29,r23 # 1st float Green/Blue = f f 0 0
stwx r22,r29,r24 # 2nd float Green/Blue = f f 0 0
FLOAT_PREP:
li r20,0
stw r20,0x18(r2) # stores 0 for when loading null floats
mr r26,r2 # initialize address to store floats during code's loop
li r25,1 # initialize current float pair being worked on
GET_MAIN_INDEX:
lis r29,0x804D
ori r29,r29,0x56A8 # 804D56A8. Address for player pointers (P1) +0x4
mulli r21,r30,-0x4 # player ID * -4. pointers are 4 bytes apart and in reverse order
lwzx r29,r29,r21
lwz r29,0x20(r29) # loads Main Index for player being displayed
ori r20,r20,0xFFFF # 0000FFFF. for empty player slot check
LOOP_START:
lhz r21,0x6(r29) # FFFF if empty player slot
cmpw r21,r20
beq- NULL_FLOATS # go to use 0 for both floats in this pair if empty player slot
lbzx r24,r31,r25 # loads setting for float pair being worked on
lwz r23,0x70(r29) # loads current action
cmpwi r24,0x14 # 0x14 = TopN
beq- TOPN
blt- NULL_FLOATS # load null floats if invalid setting on this float pair
cmpwi r24,0x18
ble- SCD # 0x15 - 0x18 = SCD Top/Bottom/Right/Left
cmpwi r24,0x1C
ble- VELOCITIES # 0x19 - 0x1C = Forces|Velocities
cmpwi r24,0x1F
ble- LIVE_INPUTS # 0x1D - 0x1F = Live Controller Port Inputs
cmpwi r24,0x22
ble- CHAR_INPUTS # 0x20 - 0x22 = Inputs Applied to Character
cmpwi r24,0x2E
ble- BUTTON_TIMERS # 0x2B - 0x2E = Button Timers
cmpwi r24,0xD0 # 0xD0 = Total Damage|Hitlag
beq- DAMAGE_HITLAG
cmpwi r24,0xD1 # 0xD1 = Hitstun|Grab Hold Time
beq- HITSTUN_GRABTIME
cmpwi r24,0xD2 # 0xD2 = Shield Stun (Actual|Calculated)
beq- SHIELDSTUN
cmpwi r24,0xD3 # 0xD3 = Shield Health|Size
beq- SHIELD_HPSIZE
cmpwi r24,0xD4 # 0xD4 = Timed Intangibility/Invincibility
beq- TIMED_INTINV
cmpwi r24,0xDC # 0xD5 - 0xDC = Hitbox X/Y|Hitbox Z/Size
ble- HITBOX
b NULL_FLOATS # load null floats if invalid setting on this float pair
TOPN:
cmpw r25,r27
bne+ TOPN_ADDRESS # skip input checks for TopN modification if TopN float pair not highlighted
TOPN_MODIFY:
subi r21,r28,0xC2 # 8049D8B6. Controller port 1 debug held inputs -0x14
subi r24,r28,0x72 # port 4's address for end of loop
TOPN_LOOP:
lhzu r22,0x14(r21) # loads next port's held inputs
li r23,0x0104 # A and dpad-down buttons
andc. r23,r22,r23
bne- TOPN_LOOP_CHK # skip if inputting anything besides A or dpad-down
lhz r23,0x8(r21) # loads press inputs
rlwinm. r23,r23,0,29,29 # check if dpad-down press
beq+ TOPN_LOOP_CHK # skip if no dpad-down press
lfs f1,0x18(r2) # 0 for TopN X
lfs f2,0x18(r2) # 0 for TopN Y
rlwinm. r23,r22,0,23,23 # check if A button held
beq+ 0x8
lfs f2,-32344(r2) # loads 100 for TopN Y if holding A
stfs f1,0x110(r29) # update TopN X
stfs f2,0x114(r29) # update TopN Y
TOPN_LOOP_CHK:
cmpw r21,r24
blt+ TOPN_LOOP # loop if not finished checking all controller ports
TOPN_ADDRESS:
addi r22,r29,0x110 # Main Index + 0x110 = TopN X
b COMMON_PAIR_4
SCD:
addi r22,r29,0x7D4 # Main Index + 0x7D4 = SCD Top X
subi r21,r24,0x15
b COMMON_GROUP_8 # Top/Bottom/Right/Left are 0x8 bytes apart, and pairs 4 apart
VELOCITIES:
addi r22,r29,0xE0 # Main Index + 0xE0 = F1 Char Velocity X
beq- NET_VELOCITY # 0x1C = Net Velocity
subi r21,r24,0x19
mulli r21,r21,0xC # F1/F2/F3 forces float groups are 0xC bytes apart, and pairs 4 apart
b COMMON_GROUP
NET_VELOCITY:
lfs f1,0x0(r22) # F1 Char Velocity X
lfs f2,0x4(r22) # F1 Char Velocity Y
lfs f3,0xC(r22) # F2 KB Velocity X
lfs f4,0x10(r22) # F2 KB Velocity Y
lfs f5,0x18(r22) # F3 Atk-Shd KB Velocity X
lfs f6,0x1C(r22) # F3 Atk-Shd KB Velocity Y
fadds f1,f1,f3
fadds f1,f1,f5 # total force X
fadds f2,f2,f4
fadds f2,f2,f6 # total force Y
b LOOP_END
LIVE_INPUTS:
lis r22,0x804B
ori r22,r22,0xFE08 # 804BFE08. Controller port 1 inputs -0x44
mulli r21,r30,0x44 # player ID * 0x44 (ports 0x44 apart)
add r22,r22,r21
lbz r21,0x21(r22) # FF if empty controller port
cmpwi r21,0xFF
beq- NULL_FLOATS # null floats if no controller plugged into port showing floats for
subi r21,r24,0x1D
b COMMON_GROUP_8 # Directional/C-Stick/LR inputs are 0x8 bytes apart, and pairs 4 apart
CHAR_INPUTS:
addi r22,r29,0x680 # Main Index + 0x680 = Current Dir Input X
bne+ 0x8 # skip if not 0x22 Curr/Prev Shield Input
addi r22,r22,0x20 # shield input is 0x20 later than the usual 0x8 between groups
subi r21,r24,0x20
b COMMON_GROUP_8 # CurrDir/PrevDir/Shield inputs are 0x8 bytes apart, and pairs 4 apart
BUTTON_TIMERS:
subi r21,r24,0x2B
add r21,r29,r21 # Main Index + group offset
li r22,0x6E3 # offset from main index 1st timer + 0x4 (0x2C timers are 4 apart)
cmpwi r24,0x2C
ble- LOAD_TIMERS
addi r21,r21,0x4 # 2D-2E are 4 bytes after calculated group offset
li r22,0x6E4 # offset from main index 1st timer + 0x5 (0x2D-2E timers are 5 apart)
LOAD_TIMERS:
lbzx r23,r21,r22 # loads 2nd timer
lbz r22,0x6DF(r21) # loads 1st timer
bge+ 0x8 # skip if 2C-2E
li r23,0 # 2B has no 2nd timer. null
b INT_TO_FLOAT # convert the int timers into floats so they can be used
DAMAGE_HITLAG:
lfs f1,0x1890(r29) # loads Total Damage as 1st float
lfs f2,0x19BC(r29) # loads Hitlag as 2nd float
b LOOP_END
HITSTUN_GRABTIME:
lfs f1,0x18(r2) # loads 0 for 1st float by default
lwz r22,0x227C(r29) # loads flags for things like hitstun
rlwinm. r21,r22,0,6,6 # check flag for in hitstun (-2------)
beq+ GRAB_TIME # keep as 0 if not in hitstun
lfs f1,0x23A0(r29) # loads variable(?) that contains hitstun duration while in hitstun
GRAB_TIME:
lfs f2,0x1AAC(r29) # loads Grab Hold Time as 2nd float
b LOOP_END
SHIELDSTUN:
cmpwi r23,0xB5 # 0xB5 = GuardDamage
bne+ NULL_FLOATS # null floats if not shield damage action
lfs f1,0x8F4(r29) # loads current animation frame
lfs f2,0x8FC(r29) # loads animation speed
lfs f3,-28872(r2) # 804D6798. loads 20 (41A00000). GuardDamage animation length for all characters
lfs f4,-29808(r2) # 804D63F0. loads 0.1 (3DCCCCCD). added to animation length for FSM calculations
fsubs f1,f3,f1 # 20 - Current Frame = Animation Length Remaining
fdivs f1,f1,f2 # (20 - Current Frame) / Speed = Actual Stun Time Remaining
fadds f3,f3,f4 # 20 + 0.1
fdivs f2,f3,f2 # (20 + 0.1) / Speed = Originally Calculated Stun Time
b LOOP_END
SHIELD_HPSIZE:
lfs f1,0x19F8(r29) # loads Shield Health as 1st float
cmpwi r23,0xB2 # 0xB2 = GuardOn
blt+ NULL_SECOND # load 0 for 2nd float if not shield action
cmpwi r23,0xB6 # 0xB6 = GuardReflect
bgt- NULL_SECOND # load 0 for 2nd float if not shield action
lwz r21,0x1A20(r29)
lfs f2,0x58(r21) # loads Shield Collision Size as 2nd float
b LOOP_END
TIMED_INTINV:
lwz r22,0x19F0(r29) # loads timed Intangibility
lwz r23,0x19F4(r29) # loads timed Invincibility
b INT_TO_FLOAT # convert the int timers into floats so they can be used
HITBOX:
addi r22,r29,0x9C0 # Main Index + 0x9C0 = Hitbox-0 X
subi r24,r24,0xD5 # setting remainder for hitbox setting group 0xD5 - 0xDC
li r23,2
divw r21,r24,r23 # each hitbox has 2 float pair settings associated with it
mulli r21,r21,0x138 # hitboxes are 0x138 apart
add r22,r22,r21 # address of X Offset of Hitbox being looked at
lwz r21,-0x4C(r22) # 0 = inactive hitbox ID, 2 = active no interp, 3 = active interp
cmpwi r21,0
beq+ NULL_FLOATS # null floats if hitbox ID not active
addi r23,r22,0x4 # 2nd float is 4 bytes after 1st on Even hitbox settings
rlwinm. r21,r24,0,31,31 # check if Odd hitbox setting
beq+ COMMON_LOAD # skip and load floats if Even hitbox setting
addi r22,r22,0x8
subi r23,r22,0x38 # Size (2nd float) is -0x38 from Z (1st), not +0x4
b COMMON_LOAD # load hitbox floats
COMMON_GROUP_8:
mulli r21,r21,0x8 # groups of floats are 8 bytes apart
COMMON_GROUP:
add r22,r22,r21 # adds group offset
COMMON_PAIR_4:
addi r23,r22,0x4 # 2nd float 4 bytes after 1st
COMMON_LOAD:
lfs f1,0x0(r22)
lfs f2,0x0(r23)
b LOOP_END
INT_TO_FLOAT:
lfd f3,-29960(r2) # loads magic double for int to float conversion
stfd f3,0x20(r2)
stfd f3,0x28(r2)
sth r22,0x26(r2) # 0x43300000800000xx. put 1st int at end of magic double
sth r23,0x2E(r2) # 2nd int
lfd f1,0x20(r2)
lfd f2,0x28(r2)
fsubs f1,f1,f3 # subtract 0x4330000080000000 for converted int 1
fsubs f2,f2,f3 # subtract 0x4330000080000000 for converted int 2
b LOOP_END
NULL_FLOATS:
lfs f1,0x18(r2) # loads 0 for 1st float
NULL_SECOND:
lfs f2,0x18(r2) # loads 0 for 2nd float
LOOP_END:
stfs f1,0x0(r26) # store 1st float in pair at current pair's loading address
stfs f2,0x4(r26) # 2nd float
addi r25,r25,1 # increment current float pair
addi r26,r26,8 # update float storage address to next float pair slot
cmpwi r25,3
ble+ LOOP_START # loop for next float pair until all 3 are done
LOAD_FLOATS:
lfs f1,0x0(r2) # loads setting 1, float 1
lfs f2,0x4(r2) # loads setting 1, float 2
lfs f3,0x8(r2) # loads setting 2, float 1
lfs f4,0xC(r2) # loads setting 2, float 2
lfs f5,0x10(r2) # loads setting 3, float 1
lfs f6,0x14(r2) # loads setting 3, float 2
END:
lmw r20,8(r1) # pop r20-r31 off the stack
addi r1,r1,56 # release the space
r20 = Temp Stuff | 0000FFFF
r21 = Temp Stuff
r22 = Temp Stuff | Common Load 1, Int to Float 1
r23 = Temp Stuff | Current Action | Common Load 2, Int to Float 2
r24 = Temp Stuff | Current Floats Setting for Functions
r25 = Current Floats Pair
r26 = Current Float Storage Address
r27 = Pokemon Setting
r28 = Address of Debug Item/Pokemon Settings and Debug Inputs
r29 = Font Color Data Address | Main Index for Player
r30 = Player ID
r31 = Display Settings Address | Display Settings Address + 0x7 (for indexed loading of settings)