Doq
Smash Lord
Doq, have you gone mad?
Yes... yes I have. I am attempting to manipulate a texture entirely in code.
The finished product will use the L button (which standalone will be incompatible with 20XX HP, unless achilles implements it into 4.0... nudge nudge wink wink) to scroll through colors. I'll likely include only 7 or so, but it can be expanded however far the memory goes.
But first, a comparison of textures:
Recompiled Blue Bow Texture using Melee Toolkit
00 1F 00 00 00 00 00 00 00 00 FF FF FF FF FF FF
00 00 FF FF FF FF FF FF 00 00 FF FF FF FF FF FF
9C F3 31 86 5A FA E0 E0 AD 75 31 A6 D5 F5 2F 09
9D 14 10 82 E0 FA 57 55 84 30 08 41 03 AD F5 D5
Red Bow from the Purin Bow Pack Redux, same offset
F8 02 00 00 00 00 00 00 00 00 FF FF FF FF FF FF
00 00 FF FF FF FF FF FF 00 00 FF FF FF FF FF FF
9C F3 31 86 5A FA E0 E0 AD 75 31 A6 D5 F5 2F 09
9D 14 10 82 E0 FA 57 55 84 30 08 41 03 AD F5 D5
Green Bow from the Purin Bow Pack Redux, same offset
07 C1 00 00 00 00 00 00 00 00 FF FF FF FF FF FF
00 00 FF FF FF FF FF FF 00 00 FF FF FF FF FF FF
9C F3 31 86 5A FA E0 E0 AD 75 31 A6 D5 F5 2F 09
9D 14 10 82 E0 FA 57 55 84 30 08 41 03 AD F5 D5
Look at the above results. Only the first two bytes are different, the other 62 bytes are exactly the same, which means that I only need to change two bytes to change the bow color now! BREAKTHROUGHS! Below here is a list of hex values for the colors in the Purin Bow Pack Redux:
vMelee Blue: 00 1F
Lime Green: A7 C0
Indigo: 38 1F
Hot Pink: F8 11
Green: 07 C1
Green Yellow: DF C0
Green Blue: 07 D6
Gold: FC E0
Dark Orange: F9 40
Redux Blue: 05 DF
Black: FF FF* / 00 00
Yellow: FE C0
White: FF FF
Violet: 70 1F
Sky Green Blue **** (that is the name in the pack, yes): 07 D7
Red: F8 02
Purple: A8 1F
Pink: F8 18
Orange: FB 00
Light Green: 6F C0
Light Blue: 07 DE
Or make your own color: http://reactiveraven.github.io/565/
* Black has a non-unique code because bytes 0x4-0x7 are 55 55 55 55. Setting the code to 00 00 in memory is also black.
It's basically your average 16 bit color.
So, depending on the compiler, the output is different. Except for the TPL outputs (96 bytes), the textures are 64 bytes in size.
> I do not know why the TPL outputs are 96 bytes large, likely for headers/footers, etc.
Now how to implement this into code...
I apologize beforehand if this looks more like an infodump than a code, it'll get better as I progress.
Well let's take a look at this guide written by _glook.
Ohph, it's only documented the PSA files. TODO: FIND PLACE IN RAM WHERE THE MODELS ARE
How the end result should look
Should probably store a color values in RAM somewhere, or in the DOL for loading later, or better: in PlPrBu.dat.
> Actually if the color information is stored in PlPrBu.dat, then it would be simply easier to make a fancy PlPrBu.dat with the other colors appended to the end, and change the texture pointer to the specified color pointer.
Code outline (I'm not entirely sure how the current alternate costume engine is laid out, and it's likely cleaner/different from this outlike)
CSS:
It'll likely be similar to the Alternate Costume engine, but instead of loading a different file name, it'll store a color value at a spot in RAM.
INIT:
Check for game load code (Injection point)
Check for players' characters selection (all of them)
Save pointer in r31 to RAM (Will need to find a good address) [Alternately, find where these pointers are in RAM already]
Check RAM pointer
This is all I know until I get the above TODO offset.
TO THE LAB
Yes... yes I have. I am attempting to manipulate a texture entirely in code.
The finished product will use the L button (which standalone will be incompatible with 20XX HP, unless achilles implements it into 4.0... nudge nudge wink wink) to scroll through colors. I'll likely include only 7 or so, but it can be expanded however far the memory goes.
But first, a comparison of textures:
Recompiled Blue Bow Texture using Melee Toolkit
00 1F 00 00 00 00 00 00 00 00 FF FF FF FF FF FF
00 00 FF FF FF FF FF FF 00 00 FF FF FF FF FF FF
9C F3 31 86 5A FA E0 E0 AD 75 31 A6 D5 F5 2F 09
9D 14 10 82 E0 FA 57 55 84 30 08 41 03 AD F5 D5
Red Bow from the Purin Bow Pack Redux, same offset
F8 02 00 00 00 00 00 00 00 00 FF FF FF FF FF FF
00 00 FF FF FF FF FF FF 00 00 FF FF FF FF FF FF
9C F3 31 86 5A FA E0 E0 AD 75 31 A6 D5 F5 2F 09
9D 14 10 82 E0 FA 57 55 84 30 08 41 03 AD F5 D5
Green Bow from the Purin Bow Pack Redux, same offset
07 C1 00 00 00 00 00 00 00 00 FF FF FF FF FF FF
00 00 FF FF FF FF FF FF 00 00 FF FF FF FF FF FF
9C F3 31 86 5A FA E0 E0 AD 75 31 A6 D5 F5 2F 09
9D 14 10 82 E0 FA 57 55 84 30 08 41 03 AD F5 D5
Look at the above results. Only the first two bytes are different, the other 62 bytes are exactly the same, which means that I only need to change two bytes to change the bow color now! BREAKTHROUGHS! Below here is a list of hex values for the colors in the Purin Bow Pack Redux:
vMelee Blue: 00 1F
Lime Green: A7 C0
Indigo: 38 1F
Hot Pink: F8 11
Green: 07 C1
Green Yellow: DF C0
Green Blue: 07 D6
Gold: FC E0
Dark Orange: F9 40
Redux Blue: 05 DF
Black: FF FF* / 00 00
Yellow: FE C0
White: FF FF
Violet: 70 1F
Sky Green Blue **** (that is the name in the pack, yes): 07 D7
Red: F8 02
Purple: A8 1F
Pink: F8 18
Orange: FB 00
Light Green: 6F C0
Light Blue: 07 DE
Or make your own color: http://reactiveraven.github.io/565/
* Black has a non-unique code because bytes 0x4-0x7 are 55 55 55 55. Setting the code to 00 00 in memory is also black.
It's basically your average 16 bit color.
Original Blue Bow, found at the offset 0x0003e2e0 in PlPrBu.dat
00 1F 08 1F 00 00 00 00 09 02 78 00 5F E0 4A C5
09 02 78 00 5F E0 4A C5 00 6D 27 A0 45 55 56 EA
9C F3 31 86 5A FA E0 E0 AD 75 31 A6 D5 F5 2F 09
9D 14 10 82 E0 FA 57 55 84 30 08 41 03 AD F5 D5
Recompiled Blue Bow Texture using DRGN's PNG to TPL (Texture ripped using Melee Toolkit)
00 20 AF 30 00 00 00 01 00 00 00 0C 00 00 00 14
00 00 00 00 00 04 00 04 00 00 00 0E 00 00 00 40
00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 1F 00 1E 55 55 55 55 00 1F 00 1E 55 55 55 55
00 1F 00 1E 55 55 55 55 00 1F 00 1E 55 55 55 55
Recompiled Blue Bow Texture using DRGN's PNG to TPL (Texture converted to PNG from Steelia's PrBu.rar)
00 20 AF 30 00 00 00 01 00 00 00 0C 00 00 00 14
00 00 00 00 00 04 00 04 00 00 00 0E 00 00 00 40
00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 1F 00 1E 00 00 00 00 00 1F 00 1E 00 00 00 00
00 1F 00 1E 00 00 00 00 00 1F 00 1E 00 00 00 00
00 1F 08 1F 00 00 00 00 09 02 78 00 5F E0 4A C5
09 02 78 00 5F E0 4A C5 00 6D 27 A0 45 55 56 EA
9C F3 31 86 5A FA E0 E0 AD 75 31 A6 D5 F5 2F 09
9D 14 10 82 E0 FA 57 55 84 30 08 41 03 AD F5 D5
Recompiled Blue Bow Texture using DRGN's PNG to TPL (Texture ripped using Melee Toolkit)
00 20 AF 30 00 00 00 01 00 00 00 0C 00 00 00 14
00 00 00 00 00 04 00 04 00 00 00 0E 00 00 00 40
00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 1F 00 1E 55 55 55 55 00 1F 00 1E 55 55 55 55
00 1F 00 1E 55 55 55 55 00 1F 00 1E 55 55 55 55
Recompiled Blue Bow Texture using DRGN's PNG to TPL (Texture converted to PNG from Steelia's PrBu.rar)
00 20 AF 30 00 00 00 01 00 00 00 0C 00 00 00 14
00 00 00 00 00 04 00 04 00 00 00 0E 00 00 00 40
00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 01
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 1F 00 1E 00 00 00 00 00 1F 00 1E 00 00 00 00
00 1F 00 1E 00 00 00 00 00 1F 00 1E 00 00 00 00
> I do not know why the TPL outputs are 96 bytes large, likely for headers/footers, etc.
Now how to implement this into code...
I apologize beforehand if this looks more like an infodump than a code, it'll get better as I progress.
Well let's take a look at this guide written by _glook.
Ohph, it's only documented the PSA files. TODO: FIND PLACE IN RAM WHERE THE MODELS ARE
How the end result should look
Should probably store a color values in RAM somewhere, or in the DOL for loading later, or better: in PlPrBu.dat.
> Actually if the color information is stored in PlPrBu.dat, then it would be simply easier to make a fancy PlPrBu.dat with the other colors appended to the end, and change the texture pointer to the specified color pointer.
Code outline (I'm not entirely sure how the current alternate costume engine is laid out, and it's likely cleaner/different from this outlike)
CSS:
It'll likely be similar to the Alternate Costume engine, but instead of loading a different file name, it'll store a color value at a spot in RAM.
INIT:
Check for game load code (Injection point)
Check for players' characters selection (all of them)
if any player is loading PlPrBu.dat
LOAD:run offset load code
else endSave pointer in r31 to RAM (Will need to find a good address) [Alternately, find where these pointers are in RAM already]
Check RAM pointer
If word at +0x3e2e0 from pointer is 001F0000
Check CSS selection choice
Inject new RAM value at pointer
run load code normally
elseInject new RAM value at pointer
run load code normally
run load code normally
Check for player character selection
Check for loading cycle outlined in _glook's guide
* I am p sure I can meld these two ifs by simply putting "if player X is loading plprbu.dat"
if player X is purin
endif costume is blue
elseallow color scroll using R
elsedon't do anything
don't do anything
Check for loading cycle outlined in _glook's guide
if player X is purin
endif costume is blue
elsecheck current color value
modify texture pointer for that color
elsemodify texture pointer for that color
don't do anything
don't do anything
* I am p sure I can meld these two ifs by simply putting "if player X is loading plprbu.dat"
This is all I know until I get the above TODO offset.
TO THE LAB
Last edited: