• 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!

Official DAT Texture Wizard (current version: 6.1.4)

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Is it possible to combine 2 dat files of the same name together? Im installing character mods from magic scrumpy yt channel and twitter. Thanks!
Not really sure what this means.

If you mean you want a character to have some textures from two different files/sources, then what you would want to do is export the textures you want from the source files (i.e., open the .dat file, select the textures you want, right-click, click export), then open your character file that you want to put them into, and import the textures you took out of the source files over the existing images in your file.

Do you know the color pallet codes for individual colors?
Yes...? Not sure if you're asking for the hex format that's used in the game's files, or a different format, like RGBA. If the former, use the palette tab and look at the offsets shown there. "Data Offset" is the start of the palette data in the DAT file. Colors are stored in the order that you see on the canvas on the left in the tab, two bytes each (so the first color is the first two bytes, or first 4 characters/nibbles, at that offset, second color is the 3rd and 4th byte, etc). The values in the canvas (shown below, circled) are simply more offsets, to help you more easily locate specific colors, so you don't have to count through the entire block of colors and hex.

upload_2016-8-24_9-38-9.png

If you want the color in RGBA format, you could export the image, and open it in a program like GIMP, look at the palette (should be in the ColorMap tab in one of the dockable windows), and pick out the color you're interested in to see its colors. This method won't preserve the alpha channel though, as for some reason most programs don't properly support the alpha channel on paletted PNGs (even though PNG images do actually support it). An alternate method would be to convert the color format that you found in the file to RGBA using the explanations on the format found here.

I've thought about adding a feature for this, so you could maybe convert colors, or click on palette entries to view/change them, but I'm not sure anyone has really requested this, so it's just kinda sat in the todo list in the shadow of other higher priority features.
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
DRGN DRGN Z zankyou

Image Structure:
0x0C unsigned word Mipmap Bool (1 = Enable Mipmaps)
0x10 float MinLOD (minimum level of detail)
0x14 float MaxLOD (maximum level of detail)
0x18 unsigned word Mipmap bit flags (??)
(00000001) = ??
(00000002) = harsh transitions
(00000004) = smooth transitions

MaxLOD is how many images are supplied (0-indexed, with 0 being the largest image).

Setting no transition flag seems to be equivalent to disabling the mipmap levels (no transition to a lower res texture occurs).

Untitled-2.png


We've known this part of the struct related to mipmap stuff for some time, but I was looking at the GameCube SDK Game Engine Programming PDF which tipped me off to some things.

Capture.PNG


Is the (00000004) "smooth transitions" flag just "edgeLOD"? I'm not sure what edge LOD is.
 
Last edited:

zankyou

Smash Lord
Joined
Sep 12, 2014
Messages
1,055
I really need to take a harder look into the sdk. Not even sure where it is on my hdd. I wonder if this will solve some of the lag on stages.
 

Stache

Smash Cadet
Joined
Oct 17, 2014
Messages
38
I was trying to edit a CSP that I already once edited using a PNG of the same dimensions, but when I try to save it, I get the error on the top left. Dolphin is closed as well.

Will you help me on how to resolve this issue?

 
Last edited:

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
I was trying to edit a CSP that I already once edited using a PNG of the same dimensions, but when I try to save it, I get the error on the top left. Dolphin is closed as well.

Will you help me on how to resolve this issue?

Sure. Can you post the texture you're trying to import?
 

zankyou

Smash Lord
Joined
Sep 12, 2014
Messages
1,055
DRGN DRGN Ive started using this and its really amazing. But there are a few things its missing which makes me still have to use GCR. Do you think it would be possible to make it so that if the file size is smaller than the current one it doesnt rebuild. Or has a setting to rebuild or not in these cases. And if possible if the filesize is just a little over. Im not sure how GCR does this but being able to a file thats 10 bytes larger without rebuilding is convenient for editing the string table.
 

zankyou

Smash Lord
Joined
Sep 12, 2014
Messages
1,055
DRGN DRGN Z zankyou

Image Structure:
0x0C unsigned word Mipmap Bool (1 = Enable Mipmaps)
0x10 float MinLOD (minimum level of detail)
0x14 float MaxLOD (maximum level of detail)
0x18 unsigned word Mipmap bit flags (??)
(00000001) = ??
(00000002) = harsh transitions
(00000004) = smooth transitions

MaxLOD is how many images are supplied (0-indexed, with 0 being the largest image).

Setting no transition flag seems to be equivalent to disabling the mipmap levels (no transition to a lower res texture occurs).

View attachment 116644

We've known this part of the struct related to mipmap stuff for some time, but I was looking at the GameCube SDK Game Engine Programming PDF which tipped me off to some things.

View attachment 116645

Is the (00000004) "smooth transitions" flag just "edgeLOD"? I'm not sure what edge LOD is.
Do you know how the game finds mipmaps. Do they work like brawl where its just a smaller texture after each other or are the smaller images in a different location.
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
I think the problem is within your MnSlChr file. Can you post that too? I should be able to fix it. I think I know what's happening here, and if so I've seen it before. Top thing for me to fix in the program for the next update.

DRGN DRGN Ive started using this and its really amazing. But there are a few things its missing which makes me still have to use GCR. Do you think it would be possible to make it so that if the file size is smaller than the current one it doesnt rebuild. Or has a setting to rebuild or not in these cases. And if possible if the filesize is just a little over. Im not sure how GCR does this but being able to a file thats 10 bytes larger without rebuilding is convenient for editing the string table.
Yeah, I can do that.

Often there's a little padding or unused hex between files, which is what GCR must take advantage of when it imports a slightly larger file.

Do you know how the game finds mipmaps. Do they work like brawl where its just a smaller texture after each other or are the smaller images in a different location.
They're stored directly after one another from the point where the image data starts, from largest resolution to smallest. I've known how to read them for a while, and I even have in mind how I'd do the GUI in DTW to work with them. I just haven't had enough opportunity to work on it yet. It's the next important feature I've wanted to add to DTW though.
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
DRGN DRGN Z zankyou

Image Structure:
0x0C unsigned word Mipmap Bool (1 = Enable Mipmaps)
0x10 float MinLOD (minimum level of detail)
0x14 float MaxLOD (maximum level of detail)
0x18 unsigned word Mipmap bit flags (??)
(00000001) = ??
(00000002) = harsh transitions
(00000004) = smooth transitions

MaxLOD is how many images are supplied (0-indexed, with 0 being the largest image).

Setting no transition flag seems to be equivalent to disabling the mipmap levels (no transition to a lower res texture occurs).

View attachment 116644

We've known this part of the struct related to mipmap stuff for some time, but I was looking at the GameCube SDK Game Engine Programming PDF which tipped me off to some things.

View attachment 116645

Is the (00000004) "smooth transitions" flag just "edgeLOD"? I'm not sure what edge LOD is.
I'm not sure the image header structure includes the value at 0x18, 'mipmap flags'. I think that might be the start of another structure. With that texture you were working with on Yoshi's Story, a pointer points to that value in the texture structure (comes right after the palette header pointer).
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
I'm not sure the image header structure includes the value at 0x18, 'mipmap flags'. I think that might be the start of another structure. With that texture you were working with on Yoshi's Story, a pointer points to that value in the texture structure (comes right after the palette header pointer).
Good catch. We'll need to look into that.
Just comparing headers with the tex0 file. Since they are so close, wouldnt 0xc instead of being a bool be the number of images. Im looking at a tex0 that has 0x4 in that spot and Id be surprised if it were different.
http://wiki.tockdom.com/wiki/TEX0_(File_Format)
Can't be.

For that Yoshi's Story texture,
Capture.PNG


Using the TEX0 definitions, the number of images would be N=1, followed by N-1 = 1 - 1 = 0 mipmap images, which certainly isn't the case.
 
Last edited:

zankyou

Smash Lord
Joined
Sep 12, 2014
Messages
1,055
Good catch. We'll need to look into that.

Can't be.

For that Yoshi's Story texture,
View attachment 117124

Using the TEX0 definitions, the number of images would be N=1, followed by N-1 = 1 - 1 = 0 mipmap images, which certainly isn't the case.
Yeah I was just kicking myself for not realizing that in melee that value is usually 0 and in the tex0 its usually 1
 

italiarlz135

Smash Rookie
Joined
Nov 25, 2015
Messages
7
not sure if this is the place for this but I've been trying to make a Boo skin for Jigglypuff and want to have the big Boo smile, which it looks like I would have to edit the size and shape of the mouth to do. How would I go about doing that?

Pic attached, the skin as it stands lol

 
Last edited:

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
DRGN sorry for the late response. Here's my .usd file. It's for 20xx btw

https://puu.sh/qZe45/f345005f6c.usd
Np. So I tried the import, and it wasn't the problem I was suspecting. In fact, I didn't find any problem! It just worked (the file with your new texture is attached to this post). So it seems that your ISO really was open in another program, or being locked by a program that didn't close it properly. If you didn't even have other programs open that had done anything with the ISO, it may have been that exporer or Windows was having a problem. So if you closed everything and were still getting the error, restarting your computer would probably free up the file.

not sure if this is the place for this but I've been trying to make a Boo skin for Jigglypuff and want to have the big Boo smile, which it looks like I would have to edit the size and shape of the mouth to do. How would I go about doing that?

Pic attached, the skin as it stands lol

Z zankyou would be the man to ask. I'm not sure if you'd need to modify individual vertices, or if there would be a 'scale' value for the whole object. (Best place for this would be the model hacking sub-forum.) There aren't any programs for model hacking yet, so any hacking of this sort has to be done "manually", which is editing hex in the file directly via a hex editor. I like the idea though, so hopefully you can figure it out. Also I should let you know that there has been a Boo Puff costume made (should be able to find it in the Official Melee Texture Hacking Thread by searching for latest posts with "boo" or "jigglypuff" in them). Might be helpful for some ideas? That costume makes Jiggs appear as partially transparent too, which is pretty cool. So that is an option/possibility for yours as well.
 

Attachments

Last edited:

italiarlz135

Smash Rookie
Joined
Nov 25, 2015
Messages
7
Z zankyou would be the man to ask. I'm not sure if you'd need to modify individual vertices, or if there would be a 'scale' value for the whole object. (Best place for this would be the model hacking sub-forum.) There aren't any programs for model hacking yet, so any hacking of this sort has to be done "manually", which is editing hex in the file directly via a hex editor. I like the idea though, so hopefully you can figure it out. Also I should let you know that there has been a Boo Puff costume made (should be able to find it in the Official Melee Texture Hacking Thread by searching for latest posts with "boo" or "jigglypuff" in them). Might be helpful for some ideas? That costume makes Jiggs appear as partially transparent too, which is pretty cool. So that is an option/possibility for yours as well.
oh awesome thanks so much! I'm just getting started in this so I doubt ill be able to figure out the model stuff but I'll definitely check it out. and thanks again for mentioning the other puff, now I can learn how they did the transparency too.
 

zankyou

Smash Lord
Joined
Sep 12, 2014
Messages
1,055
Im not sure how the final result will look because of the mouth animations. If you really want to try to edit the vertices though I could give you a vert cloud to edit and Im pretty sure one of the programs I have should be able to put them back in order.
Though itd just be easier for me if you did this with a brawl model since thats already in place for me.
 

Stache

Smash Cadet
Joined
Oct 17, 2014
Messages
38
DRGN DRGN Thanks for your help, especially with the fixed usd, but sadly I can't seem to isolate what could possibly be using my irrelevant ISO. I tried exporting the .usd and importing the image to that, but I got another error and the .usd file got wiped. Is that the bug you were talking about earlier?

https://gfycat.com/CloseFloweryBlackcrappie
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
DRGN DRGN Thanks for your help, especially with the fixed usd, but sadly I can't seem to isolate what could possibly be using my irrelevant ISO. I tried exporting the .usd and importing the image to that, but I got another error and the .usd file got wiped. Is that the bug you were talking about earlier?

https://gfycat.com/CloseFloweryBlackcrappie
Long story short, the problem in the gif is actually the file name of the texture. The program has an intentional feature that was triggered unintentionally. Basically, the name was so short and simple AND happened to be one of a few particular characters that it slipped by a bunch of checks. I've added a safeguard against this sort of thing for the next version though.

As for your ISO. Did you try restarting and the file was still locked? If so, I have no idea what's going on there.
 
Last edited:

Stache

Smash Cadet
Joined
Oct 17, 2014
Messages
38
Wow DRGN. I guess the name of the image was the issue the whole time. I'll try my iso again when I can. Thanks for everything
 

Krusteaz

Smash Apprentice
Joined
Dec 2, 2015
Messages
79
Location
Yoshi's Story
Is it possible to edit the .bnr with this? I've been trying to just convert a .jpg to .bnr and I can't even figure that out. Am I wasting my time or is there someway I can import my own
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Is it possible to edit the .bnr with this? I've been trying to just convert a .jpg to .bnr and I can't even figure that out. Am I wasting my time or is there someway I can import my own
I don't know what you're trying for conversion, but I don't know of any way to do it directly.

Have you tried GCR? It can do it I'm pretty sure (though I've run into problems before using it).

Alternatively, you could convert a JPG to PNG, and then use my batch file, "PNG to-from TPL.bat" (which comes with DTW) to convert your PNG to TPL. Then you would need to copy/paste the data from that file using a hex editor (copying just the image data portion) into in your .BNR file at 0x20. The PNG's file name needs to end in the image type for BNR files, which I think is _5. So you'll want to do something like "filename_5.png". Make sure your image is 96x32, and the data itself (as you copy it from the TPL file) should be 0x1800 bytes in length.

Adding functionality specifically for this and the various titles/descriptions in an ISO is on my todo list for DTW and I'd still like to get to it at some point.
 
Last edited:

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
I don't know what you're trying for conversion, but I don't know of any way to do it directly.

Have you tried GCR? It can do it I'm pretty sure (though I've run into problems before using it).

Alternatively, you could convert a JPG to PNG, and then use my batch file, "PNG to-from TPL.bat" (which comes with DTW) to convert your PNG to TPL. Then you would need to copy/paste the data from that file using a hex editor (copying just the image data portion) into in your .BNR file at 0x20. The PNG's file name needs to end in the image type for BNR files, which I think is _5. So you'll want to do something like "filename_5.png". Make sure your image is 96x32, and the data itself (as you copy it from the TPL file) should be 0x1800 bytes in length.

Adding functionality specifically for this and the various titles/descriptions in an ISO is on my todo list for DTW and I'd still like to get to it at some point.
You probably already know this, but:

Capture.PNG
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
You probably already know this, but:

View attachment 117795
Oh, I actually didn't. But I haven't really done much searching either.

I wrote my own codec for DTW (not related to the PNG to-from TPL.bat script, which uses wimgt) for all but CMPR, in python. So I plan to use that if I add a feature for the banner, which would be more efficient & convenient than IPC to command line. I was thinking maybe a "Disc Basics" tab or something in DTW, where you could change the banner and all of the game's description and title texts, like those shown above. (Of course when I code that, it'd be easier to just edit those directly too.) That's still a good find until I add a feature for this. Is that what you use?

Z zankyou , I'm guessing Brawl's mdl0 files use TPLs too, right? I was just wondering what you use to convert textures if you needed to, and point out that you (or anyone) could use my codec if you need it for a program or something.
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
Oh, I actually didn't. But I haven't really done much searching either.

I wrote my own codec for DTW (not related to the PNG to-from TPL.bat script, which uses wimgt) for all but CMPR, in python. So I plan to use that if I add a feature for the banner, which would be more efficient & convenient than IPC to command line. I was thinking maybe a "Disc Basics" tab or something in DTW, where you could change the banner and all of the game's description and title texts, like those shown above. (Of course when I code that, it'd be easier to just edit those directly too.) That's still a good find until I add a feature for this. Is that what you use?

Z zankyou , I'm guessing Brawl's mdl0 files use TPLs too, right? I was just wondering what you use to convert textures if you needed to, and point out that you (or anyone) could use my codec if you need it for a program or something.
I wasn't really talking about the "makebanner" program itself, moreso just the table shown about byte limits for the text fields. But yeah, makebanner.exe is included in the GameCube SDK files. Just found it. Never used it.

I always use PNG-to-from-TPL to convert images if I need to. BrawlBox calls the mdl0 textures NW4R textures (.tex0), which I've never looked into specifically, but if you just export it as raw data it seems to be the same basic thing as a TPL.
 

zankyou

Smash Lord
Joined
Sep 12, 2014
Messages
1,055
Oh, I actually didn't. But I haven't really done much searching either.

I wrote my own codec for DTW (not related to the PNG to-from TPL.bat script, which uses wimgt) for all but CMPR, in python. So I plan to use that if I add a feature for the banner, which would be more efficient & convenient than IPC to command line. I was thinking maybe a "Disc Basics" tab or something in DTW, where you could change the banner and all of the game's description and title texts, like those shown above. (Of course when I code that, it'd be easier to just edit those directly too.) That's still a good find until I add a feature for this. Is that what you use?

Z zankyou , I'm guessing Brawl's mdl0 files use TPLs too, right? I was just wondering what you use to convert textures if you needed to, and point out that you (or anyone) could use my codec if you need it for a program or something.
It uses tpls. I think you and I figured out how to calculate the length of the image data around the same time. Ive been using a script I made at the time.
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Guys, sorry to bother you again, but I really need help with CSPs. I made an entire pack of textures for Melee (.pngs) which were basically wireframes of different colours. However, when I used the wizard to mass import them I got this (they're using mostly the colours for the white wireframe, with some specs of the other colours thrown in).

Please, I would greatly appreciate any and all help (I have a few days to finish this hack). All 118 filenames end with a .png and have transparency.

EDIT: Could it be the amount of different transparencies I use? The wireframes are all semi transparent.

This CSP set you were working on before should work now, I believe. Before when you were working on it, DTW used wimgt to convert textures to TPL format, which didn't properly handle alpha with many texture types. As I mentioned a few posts above (which reminded me of this), DTW now uses my own codec for texture conversion, which solved a lot of problems, including those concerning the alpha channel, which you were running into (and why replacement colors are no longer a thing). Let me know if it works! I'm sure a lot of people would like that set.

I wasn't really talking about the "makebanner" program itself, moreso just the table shown about byte limits for the text fields. But yeah, makebanner.exe is included in the GameCube SDK files. Just found it. Never used it.

I always use PNG-to-from-TPL to convert images if I need to. BrawlBox calls the mdl0 textures NW4R textures (.tex0), which I've never looked into specifically, but if you just export it as raw data it seems to be the same basic thing as a TPL.
Ah, yes; those byte limits are useful indeed. Thanks.
 
Last edited:

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
Bug in DTW 4.3
- Root/Reference Node offsets become incorrect if reference nodes are not located at the end of the string data.

Take Yoshi's Story for instance. When I click on the (1) reference node, I get this:
Capture.PNG


Which is incorrect. The correct reference node string is "GrdStoryHeiho_TopN_shapeanim_joint".

The reason this bug exists is due to an assumption in code that reference node strings are located in the string data (in order) after the root node strings. In this case, "GrdStoryHeiho..." is kind of just thrown in the middle of all the strings.

This is what I did to fix the problem - in my program, but I got the initial code from you :)

Capture.PNG
 
Last edited:

EastBoy

Smash Rookie
Joined
Aug 20, 2016
Messages
6
Okay sorry if this is a very noob thing to ask but how do I use hex? I do as it says but I can't figure out how to open it
 

Ed94

Smash Apprentice
Joined
Apr 2, 2015
Messages
164
Would it be possible to add the feature of exporting selected textures or dats from the game using the naming system used for dolphin's texture dumping? Or be able to give the file name that would be for the specific texture? Right now the only way to correlate textures I've extracted and modified using DAT is by identification by eye. While this gets me pretty far, its pretty tedious and can get close to impossible when dealing with the smaller stuff. Like Jigg's one pixel texture the game uses on over half of its body.

The reason being is that I wanted to make a package of the textures I made for use with dolphin's texture override on a vanilla iso of the game so that it could work fine with netplay. Trying to dump textures from a modified iso just leads to textures with differing names so the vanilla iso will never use those in the "Load" folder.
 
Last edited:

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Would it be possible to add the feature of exporting selected textures or dats from the game using the naming system used for dolphin's texture dumping? Or be able to give the file name that would be for the specific texture? Right now the only way to correlate textures I've extracted and modified using DAT is by identification by eye. While this gets me pretty far, its pretty tedious and can get close to impossible when dealing with the smaller stuff. Like Jigg's one pixel texture the game uses on over half of its body.

The reason being is that I wanted to make a package of the textures I made for use with dolphin's texture override on a vanilla iso of the game so that it could work fine with netplay. Trying to dump textures from a modified iso just leads to textures with differing names so the vanilla iso will never use those in the "Load" folder.
Maybe. But I have no idea what kind of hash algorithm Dolphin uses to generate its IDs. I know it's all open source though, so that information has got to exist somewhere....

DRGN DRGN Ive started using this and its really amazing. But there are a few things its missing which makes me still have to use GCR. Do you think it would be possible to make it so that if the file size is smaller than the current one it doesnt rebuild. Or has a setting to rebuild or not in these cases. And if possible if the filesize is just a little over. Im not sure how GCR does this but being able to a file thats 10 bytes larger without rebuilding is convenient for editing the string table.
Working on this for the next version btw. Might also create an option to build a disc from a root folder of files.
 
Last edited:

Ed94

Smash Apprentice
Joined
Apr 2, 2015
Messages
164
If you decide to check it out here is the info. In the end all I really need to do is figure out if I can figure it out manually, I'll ask the dolphin forums for that.

Dolphin Custom Texture Info (Thread on Dolphin Forums) This has information on the latest format they use.

Build 4.0-5234 info Is the build where the latest commit on the texture format was used.

Looking at the commit info the following locations of the github source code handle the loading and dumping of custom textures:
Source/Core/Common/Hash.h Link
Source/Core/VideoCommon/HiresTextures.cpp Link
Source/Core/VideoCommon/HiresTextures.h Link
Source/Core/VideoCommon/TextureCacheBase.cpp Link Seems to be here...
Source/Core/VideoCommon/VideoConfig.cpp Link
Source/Core/VideoCommon/VideoConfig.h Link
^^ These have quick links to commit change info. ^^ Links to current source files.

Anything else may be in the VideoCommon directory or Hash.cpp. I wish I knew more coding (I only know beginner stuff right now...)
 
Last edited:

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Parsing the Root / Reference Node Tables and String Table

Bug in DTW 4.3
- Root/Reference Node offsets become incorrect if reference nodes are not located at the end of the string data.

Take Yoshi's Story for instance. When I click on the (1) reference node, I get this:
View attachment 117869

Which is incorrect. The correct reference node string is "GrdStoryHeiho_TopN_shapeanim_joint".

The reason this bug exists is due to an assumption in code that reference node strings are located in the string data (in order) after the root node strings. In this case, "GrdStoryHeiho..." is kind of just thrown in the middle of all the strings.

This is what I did to fix the problem - in my program, but I got the initial code from you :)

View attachment 117871
I wanted to look up a root node offset, so instead of doing it manually which would have taken WAY LESS time, I finally tackled this (aren't tangents fun?). Also, I was going to PM you, but decided to put this here instead in case there are others who want to parse these tables.

Your code changes helped me to more quickly understand what I did wrong, but I came up with a different solution:

upload_2016-10-7_13-37-34.png


The lists of tuples should be pretty easy to work with from there, or it could just as easily be modified to add to orderedDicts instead. They'll be sorted in order that the nodes appear in the file (or in the order that the entries appear in the node tables if you remove the two sort lines).

So that's fixed in DTW now. It's carried over to the Structural Analysis tab too (which now also shows the structures in the order they appear in their file).

I also have them display in much more useful message windows (on the DAT Texture Tree tab):
upload_2016-10-7_13-52-25.png
 

HoDANG

Smash Rookie
Joined
Jan 3, 2016
Messages
24
Would it be possible to add the feature of exporting selected textures or dats from the game using the naming system used for dolphin's texture dumping? Or be able to give the file name that would be for the specific texture? Right now the only way to correlate textures I've extracted and modified using DAT is by identification by eye. While this gets me pretty far, its pretty tedious and can get close to impossible when dealing with the smaller stuff. Like Jigg's one pixel texture the game uses on over half of its body.

The reason being is that I wanted to make a package of the textures I made for use with dolphin's texture override on a vanilla iso of the game so that it could work fine with netplay. Trying to dump textures from a modified iso just leads to textures with differing names so the vanilla iso will never use those in the "Load" folder.
Maybe. But I have no idea what kind of hash algorithm Dolphin uses to generate its IDs. I know it's all open source though, so that information has got to exist somewhere....


Working on this for the next version btw. Might also create an option to build a disc from a root folder of files.
If you decide to check it out here is the info. In the end all I really need to do is figure out if I can figure it out the names manually, I'll ask the dolphin forums for that.

Dolphin Custom Texture Info (Thread on Dolphin Forums) This has information on the latest format they use.

Build 4.0-5234 info Is the build where the latest commit on the texture format was used.

Looking at the commit info the following locations of the github source code handle the loading and dumping of custom textures:
Source/Core/Common/Hash.h Link
Source/Core/VideoCommon/HiresTextures.cpp Link
Source/Core/VideoCommon/HiresTextures.h Link
Source/Core/VideoCommon/TextureCacheBase.cpp Link Seems to be here...
Source/Core/VideoCommon/VideoConfig.cpp Link
Source/Core/VideoCommon/VideoConfig.h Link
^^ These have quick links to commit change info. ^^ Links to current source files.

Anything else may be in the VideoCommon directory or Hash.cpp. I wish I knew more coding (I only know beginner stuff right now...)

DRGN DRGN I think the code for the hashing is in the Hash.cpp file, linked here, starting with a comment on line 265 and ending on line 314 .
This is what it looks like :



Code:
/*
* NOTE: This hash function is used for custom texture loading/dumping, so
* it should not be changed, which would require all custom textures to be
* recalculated for their new hash values. If the hashing function is
* changed, make sure this one is still used when the legacy parameter is
* true.
*/
u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
{
    const u64 m = 0xc6a4a7935bd1e995;
    u64 h = len * m;
    const int r = 47;
    u32 Step = (len / 8);
    const u64 *data = (const u64 *)src;
    const u64 *end = data + Step;
    if (samples == 0) samples = std::max(Step, 1u);
    Step = Step / samples;
    if (Step < 1) Step = 1;
    while (data < end)
    {
        u64 k = data[0];
        data+=Step;
        k *= m;
        k ^= k >> r;
        k *= m;
        h ^= k;
        h *= m;
    }

    const u8 * data2 = (const u8*)end;

    switch (len & 7)
    {
    case 7: h ^= u64(data2[6]) << 48;
    case 6: h ^= u64(data2[5]) << 40;
    case 5: h ^= u64(data2[4]) << 32;
    case 4: h ^= u64(data2[3]) << 24;
    case 3: h ^= u64(data2[2]) << 16;
    case 2: h ^= u64(data2[1]) << 8;
    case 1: h ^= u64(data2[0]);
            h *= m;
    };

    h ^= h >> r;
    h *= m;
    h ^= h >> r;

    return h;
}
#else

I think the code for the file name of the dumped texture is in the HiresTextures.cpp file, linked here, starting on line 159 and ending on line 162.
This is what it looks like :



Code:
        std::string basename = s_format_prefix + StringFromFormat("%dx%d%s_%016" PRIx64, width, height, has_mipmaps ? "_m" : "", tex_hash);
        std::string tlutname = tlut_size ? StringFromFormat("_%016" PRIx64, tlut_hash) : "";
        std::string formatname = StringFromFormat("_%d", format);
        std::string fullname = basename + tlutname + formatname;

I think lines 159, 160, and 161 each assign a portion of the file name as noted in Ed94 Ed94 's first Link. Then, I think line 162 smushes the three parts together and assigns it to the string variable fullname (which should be the filename of the dumped texture).

Note: I can only half-understand what the code is doing, but I'm pretty sure this is all correct.
 

SpaceFalcon

Smash Lord
Joined
Oct 3, 2007
Messages
1,714
Location
604
Would it be possible to add the feature of exporting selected textures or dats from the game using the naming system used for dolphin's texture dumping? Or be able to give the file name that would be for the specific texture? Right now the only way to correlate textures I've extracted and modified using DAT is by identification by eye. While this gets me pretty far, its pretty tedious and can get close to impossible when dealing with the smaller stuff. Like Jigg's one pixel texture the game uses on over half of its body.

The reason being is that I wanted to make a package of the textures I made for use with dolphin's texture override on a vanilla iso of the game so that it could work fine with netplay. Trying to dump textures from a modified iso just leads to textures with differing names so the vanilla iso will never use those in the "Load" folder.
I'd like to see this added as well
 

StagesWhenPls

Smash Cadet
Joined
Jul 11, 2016
Messages
49
I had a previous Dreamland texture with green greens background, but I lost it. I was gonna just re-create it by extracting green greens background with DTW, but it's not showing up as one texture like it did previously, and like how Dreamland's background shows up as one texture in DTW. Anyone know what's goin on?
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
I had a previous Dreamland texture with green greens background, but I lost it. I was gonna just re-create it by extracting green greens background with DTW, but it's not showing up as one texture like it did previously, and like how Dreamland's background shows up as one texture in DTW. Anyone know what's goin on?
Boot up Melee and go play on Green Greens. The background consists of 3D objects, not a flat 2D image like Dream Land.
 

StagesWhenPls

Smash Cadet
Joined
Jul 11, 2016
Messages
49
Boot up Melee and go play on Green Greens. The background consists of 3D objects, not a flat 2D image like Dream Land.
You're right. I found where I messed up, the background I was using was actually from the hacked Dreamland in 20XX (the one without Whispy). It has The green greens background as a 2d image in DTW. Looks super nice as the Dreamland background for anyone reading this!
 

Imbaked

Smash Rookie
Joined
Dec 22, 2016
Messages
4
Scrub question. Anyway to use this to combine 2 different of the same name as long as they don't have effects at the same time? I want the Green Marth slash (I'll change the color later) and the Purple smoke down smash. both files are PIMs.dat
 
Last edited:
Top Bottom