Completed Unobscured Hitbox Display

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
292
#1
Stop the display of GFX and textures when hitbox display is toggled on.

Update 1.2: Fixed a bug where item entities would trigger the new hook and confuse the hitbox display check logic.

Update 1.1: Rewrote code to use more inclusive hook provided by Achilles~



$UnobscuredHitboxDisplay1.2 (Melee 1.02) [Punkline, Achilles]
C205FDDC 00000008
2C040000 41820034
A1640000 2C0B0006
8164002C 40820014
816B0518 2C0B0000
41820018 816B002C
896B21FC 2C0B0001
41A20008 4E800020
7C0802A6 00000000



The injection mod contains ports for 1.00, 1.01, and PAL:

Code:
    -==-


Unobscured Hitbox Display 1.2
Prevent GFX from spawning during hitbox display.
[Punkline, Achilles]
Version -- DOL Offset ------ Hex to Replace ---------- ASM Code
PAL ------- 0x5D080 ---- 7C0802A6 -> Branch

2C040000 41820034
A1640000 2C0B0006
8164002C 40820014
816B0518 2C0B0000
41820018 816B002C
896B21FC 2C0B0001
41A20008 4E800020
7C0802A6 00000000

1.01 ------ 0x5C9A8 ---- 7C0802A6 -> Branch

2C040000 41820034
A1640000 2C0B0006
8164002C 40820014
816B0518 2C0B0000
41820018 816B002C
896B21FC 2C0B0001
41A20008 4E800020
7C0802A6 00000000

1.02 ------ 0x5C9BC ---- 7C0802A6 -> Branch

2C040000 41820034
A1640000 2C0B0006
8164002C 40820014
816B0518 2C0B0000
41820018 816B002C
896B21FC 2C0B0001
41A20008 4E800020
7C0802A6 00000000

1.00 ------ 0x5C898 ---- 7C0802A6 -> Branch

2C040000 41820034
A1640000 2C0B0006
8164002C 40820014
816B0518 2C0B0000
41820018 816B002C
896B21FC 2C0B0001
41A20008 4E800020
7C0802A6 00000000
Code:
#unobscuredHitboxDisplay [Punkline, Achilles]
#@ 8005fddc : mflr r0    (beginning of prolog)
#lr is fresh from the caller, r11 appears to be safe
#r4 == external entity data pointer, if GFX comes from a player

cmpwi r4, 0
beq return
lhz r11, 0(r4)
cmpwi r11, 6            #item entities have 6 here, where player entities have a 4
lwz r11, 0x2C(r4)
bne player
item:
lwz r11, 0x518(r11)          #if it's an item, we want to check the "owner"
cmpwi r11, 0
beq return
lwz r11, 0x2C(r11)              #use "owner" pointer for player hitbox display check
player:
lbz r11, 0x21FC(r11)        #internal player data offset 0x21FC is the 8-bit hitbox display state
cmpwi r11, 1            #1 is the default state (no display)
beq+ return
blr                #return immediately from GFX func if displaying hitboxes

return:
mflr r0

---

Kou Kou requested a code that got rid of graphic effects during hitbox display, and I figured I’d give it a shot. It turned out to be a bit more complicated than I thought, but I came up with something that might still do the job.

I thought it’d be as simple as skipping just GFX (like the calls made in subaction parsing functions,) but that only removes regular particle effects.

I learned that many of the more obscuring effects (like fox’s fire effect) are textures (formed over meshes?) and are separate from normal GFX. A function (8005be88) that calls a symbol Achilles had mapped as “TextureInitialization” in the community symbol map appears to be responsible for constructing these.


This code stops character-specific GFX and character "textures" from being called when hitboxes are displayed. The injection mod contains ports for 1.00, 1.01, and PAL:

$UnobscuredHitboxDisplay (Melee 1.02) [Punkline]
C20676F0 00000003
8803225C 2C000001
41A20008 4E800020
7C0802A6 00000000
C205C038 00000005
807E0008 8863225C
2C030001 41A20014
3C608005 6063C050
7C6803A6 4E800020
3C808039 00000000



Code:
-==-


Unobscured Hitbox Display
Prevent GFX from spawning during hitbox display.
[Punkline]
Version -- DOL Offset ------ Hex to Replace ---------- ASM Code
1.02 ----- 0x800676f0 --- 7C0802A6 -> Branch

8803225C 2C000001
41A20008 4E800020
7C0802A6 00000000

1.02 ----- 0x8005c038 --- 3C808039 -> Branch

807E0008 8863225C
2C030001 41A20014
3C608005 6063C050
7C6803A6 4E800020
3C808039 00000000

1.01 ----- 0x800676DC --- 7C0802A6 -> Branch

8803225C 2C000001
41A20008 4E800020
7C0802A6 00000000

1.01 ----- 0x8005C024 --- 3C808039 -> Branch

807E0008 8863225C
2C030001 41A20014
3C608005 6063C03C
7C6803A6 4E800020
3C808039 00000000

1.00 ----- 0x800675CC --- 7C0802A6 -> Branch

8803225C 2C000001
41A20008 4E800020
7C0802A6 00000000

1.00 ----- 0x8005BF14 --- 3C808039 -> Branch

807E0008 8863225C
2C030001 41A20014
3C608005 6063BF2C
7C6803A6 4E800020
3C808039 00000000

PAL ------ 0x80067DB4 --- 7C0802A6 -> Branch

8803225C 2C000001
41A20008 4E800020
7C0802A6 00000000

PAL ------ 0x8005C6FC --- 3C808039 -> Branch

807E0008 8863225C
2C030001 41A20014
3C608005 6063C714
7C6803A6 4E800020
3C808039 00000000


    -==-

Code:
#unobscuredHitboxDisplay [Punkline]
#@800676f0: mflr r0    (beginning of prolog for main GFX spawn function)
#context:
#lr is fresh from the caller
#cr1 appears to hold an important comparison. cr0 appears to be safe?
#r3 == passed player data offset

    lbz r0, 0x225C(r3)        #player.0x225C is the 8-bit hitbox display state
    cmpwi r0, 1            #1 is the default state (no display)
    beq+ return
    blr                #return immediately from GFX func if displaying hitboxes

return: mflr r0

#@8005c038: lis r4, 0x8039    (start setting up function call for texture init)
#this function calls player texture inits mid-match
#context:
#r3-6 are about to be clobbered (safe)
#cr0 appears safe
#lr is safe
#r30 = data pointer? 0x8 holds pointer to player
    lwz r3, 0x8(r30)
    lbz r3, 0x225C(r3)
    cmpwi r3, 1
    beq+ return
    lis r3, 0x8005
    ori r3, r3, 0xc050        #branching here skips the call
    mtlr r3
    blr

return: lis r4, 0x8039
 
Last edited:

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,011
Location
Sacramento, CA
#2
Awesome! I was also working on something like this. I went about it by blanking the texture data itself. So they were called, but totally transparent. DAT Texture Wizard also has a feature for this, called "Erase (Zero-out)".

But it looks like what you have probably gets rid of more, considering the addition of the non-texture graphics calls code.

Good documentation too.

Out of curiosity, was there something in particular you guys were planning to use this for?
 

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
292
#3
Hey DRGN DRGN !

I don’t have any plans for this, but Kou might as he’s the one who requested it. I made this just because I was curious, as there didn’t appear to be any subaction events responsible for the obstruction like normal particles. (I’d thought for sure it’d be as simple as moving the event pointer.)

It’s good to know that there are multiple ways of doing this. I’m only really familiar with what I’ve been working on in code, so all the other stuff still basically flies past my head. I still need to read up on the basics of .dat files and such. I should take a full tour of that massive portal thread you started about all this stuff. (The front page of which--btw--is how I found Dan’s tutorial. And, well, this whole forum! Thanks for that.)

(And the code manager! It was so easy to port this code <3)
 
Joined
Dec 20, 2015
Messages
44
#4
This code would be absolutely godlike for the SmashWiki. A lot of their hitbox pages have gfx that cover the hitboxes, especially Warlock Punch and Falcon Kick. A lot of their gifs can be remade with this code and get much clearer renders of the hitbox.

ASM code writing sounds fun. i should really learn how to do this...
 
Last edited:

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
292
#5
omegagmaster omegagmaster Sweet! That’s awesome, I was hoping it'd be good for something like that. I'm glad it’ll be useful.

---

Also, if you’re even slightly serious, I’d recommend giving it a shot!

In this context especially, writing ASM can be a lot of fun. It’s perpetually motivating, too--if you’re curious and have a goal in mind. Everything you learn about kind of gives you more power to do something else.

The guides/resources thread has a link to a tutorial that's really well done and had me walk away knowing how to use dolphin's debug features and write C2 codes. It's a pretty gentle guide, and everything you learn from it can be used with the various utilities provided by DRGN's code manager.

If you plan on exploring a bit, these assets will let you fly:
 

Sycorax

Smash Ace
Joined
Jul 7, 2014
Messages
501
Location
Atlanta, GA
#12
Excuse me if this is already known or obvious (I'm rather new to this modding stuff), but this mod doesn't seem to work on console. It works in Dolphin though. This is my experience in trying to implement it.
 

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
292
#13
Excuse me if this is already known or obvious (I'm rather new to this modding stuff), but this mod doesn't seem to work on console. It works in Dolphin though. This is my experience in trying to implement it.
I don't have a console environment to test this on, so thank you for mentioning this.

Achilles1515 Achilles1515 Oh. Doi. I was sort of AWOL when you posted this 04 code, and wasn't able to test it out. Looking at it now, I'm finally noticing that it's a more inclusive effect, so I reworked my code to use your method for the display toggle. Thanks for this optimization!

Sycorax Sycorax I've edited my original post with an updated code. Does this new version work for you on console? Also, have you been able to get any other codes to work on console?
 
Last edited:

oscat

Smash Journeyman
Joined
Apr 29, 2014
Messages
227
Location
So Cal
3DS FC
0318-9801-6641
NNID
drlnklngmars
#14
Found a bug when used with 20XX 4.05. When non-debug young link drops a bomb, the explosion isn't there. Tested on console, gecko method.
 
Last edited:

Punkline

Dr. Frankenstack
Premium
Joined
May 15, 2015
Messages
292
#15
Found a bug when used with 20XX 4.05. When non-debug young link drops a bomb, the explosion isn't there. Tested on console, gecko method.
Thanks oscat. The new hook appears to include calls from player items, which I hadn't considered. The problem you mentioned could be seen from Link bombs, Samus bombs, and Yoshi egg throws; which all create GFX.

I updated the code to use the "item owner" pointer held in the item data when the code recognizes an item entity, which should correct the logic. Let me know if you have any issues.
 
Last edited:
Top