• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

In Progress Collision Ghosts

Punkline

Dr. Frankenstack
Joined
May 15, 2015
Messages
423
This is a simple experiment meant to test the PDT Stacks Module.

Hitbox collisions will copy a record of the hitbox and JObj instance data involved with the offending hitbox, and display it at its collision site.


Get the code here:
Code:
  -==-

Example PDT Code - Collision Ghosts
- Requires PDT Stacks Module
Hitbox collisions will copy a record of the hitbox and JObj instance data involved with the offending hitbox, and display it at its collision site.
[Punkline]
1.02 ----- 0x8007740c --- 3bc00001 -> branch
7F43D378 3C80DFD0
38A000FC
bl <pdtSafeSeekPush>
7C7E1B79 41820030
807E0000 60630003
907E0000 387E0008
7F64DB78 38A00070
bl 0x800031f4
80830048 38630070
38A00084
bl 0x800031f4
3BC00001 00000000

1.02 ----- 0x800810e4 --- 801e05c8 -> Branch
7FC3F378 3C80DFD0
38A000FC
bl <pdtSafeSeekPush>
2C030000 41820048
80830000 2C040000
4182003C 2C1D0000
41820024 88BE2219
70A50005 41A2000C
2C040003 41820010
5484003C 90830000
48000014 C03E0038
38630008 38800002
bl     0x80009f54
801E05C8 00000000
Code:
  -==-

Example PDT Code - Collision Ghosts
- Requires PDT Stacks Module
Hitbox collisions will copy a record of the hitbox and JObj instance data involved with the offending hitbox, and display it at its collision site.
[Punkline]
1.02 ----- 0x8007740c --- 3bc00001 -> branch
# 8007740c : li    r30, 1
# On hitbox collision,
# r26 = player data start address
# r27 = hitbox data start address
# r3 and f1 are both about to be clobbered
# r30 is free to use until end of injection
# volatile GPRs are fresh from call and safe to use

_pdt_interface:
mr   r3, r26          # r3 = player data start address
lis  r4, 0xDFD0       # r4 = 32-bit identifier 'tag'
li   r5, 0xFC         # r5 = size of data allocation
bl <pdtSafeSeekPush>
mr. r30, r3            # if r3 return is 0
beq- _return           # then don't run code
# r3 will be 0 if there is a conflict, or other error

_boldness_activation_flags:
lwz  r3, 0x0(r30) # load header word from alloc
ori  r3, r3, 0x3  # flags 02 HITLAG + 01 ACTIVE
stw  r3, 0x0(r30) # store flags

_copy_hitbox:
addi r3, r30, 8   # r3 = address copying TO   (returned)
mr   r4, r27      # r4 = address copying FROM (returned)
li   r5, 0x70     # r5 = hitbox instance is ~0x70 bytes
bl 0x800031f4     # call system func: memcpy

_copy_HSD_JObj_Instance:
lwz  r4, 0x48(r3) # r4 = JObj instance from hitbox
addi r3, r3, 0x70 # r3 = increment destination address
li   r5, 0x84     # r5 = JObj instance is 0x84 bytes
bl 0x800031f4

_return:
li r30, 1  # original instruction
.long 0

1.02 ----- 0x800810e4 --- 801e05c8 -> Branch
# 800810e4 : lwz    r0, 0x05C8 (r30)
# zIteration in loop for player display states
# vanilla display layers z0, z1, and z2 will be on top
# of custom display layers z0, z1, and z2
# r30 = player data start address
# r29 = Z Loop Iteration

_pdt_interface:
mr    r3, r30          # r3 = player data start address
lis   r4, 0xDFD0       # r4 = 32-bit identifier 'tag'
li    r5, 0xFC         # r5 = size of data allocation
bl <pdtSafeSeekPush>
cmpwi r3, 0            # if r3 return is 0
beq- _return           # then don't run code
# r3 will be 0 if there is a conflict, or other error

_draw_conditions:
lwz    r4, 0(r3)
cmpwi  r4, 0
beq-   _return # don't display until a collision occurs
cmpwi  r29, 0
beq-   _draw   # else, always draw when on bottom z layer
lbz    r5, 0x2219(r30)
andi.  r5, r5, 0x05  # check for hitlag flags
beq+   _unflag       # unflag boldness flag if no hitlag
cmpwi  r4, 0x3       # else check for boldness:
beq-   _draw   # and draw on all 3 z layers if bold flag
_unflag:
rlwinm r4, r4, 0, 0, 30  # mask out init flag
stw    r4, 0(r3) # now only new hits create boldness flag
b      _return

_draw:
lfs    f1, 0x38(r30)
addi   r3, r3, 8
li     r4, 2
bl     0x80009f54

_return:
lwz    r0, 0x05C8 (r30)
.long  0

Make sure you install the prerequisite modules, like so:


This code serves as a simple example of how the PDT interface may be used to connect to the modular padding added to the end of player data tables.

The PDT interface looks like this highlighted section in each of the injection codes:

https://i.imgur.com/nYZAW0S.png

@UnclePunch
 
Top Bottom