• 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
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
Introducing DAT Texture Wizard, a program designed to encompass, simplify, and speed up the entire Melee texture hacking process. It allows you to view, extract, and import textures from and to any file in the game! It also allows you to export/import/add/remove files or folders from your disc, or rebuild it. You can even import files larger than the originals, and perform many other disc operations not available in GCRebuilder. Advanced structural analysis of most files is also available.

- ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ -

Download:
DAT Texture Wizard - v6.1.4 (64-bit)

- ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ - ~ -


If you'd like to give back:

Or you can follow me on Patreon.


DTW v5.2 demo.gif


Note: My PNG to-from TPL batch script also comes in the download with DTW (this script uses wimgt for image conversions, so it may produce slightly different results during conversion than DTW). You may or may not need this anymore, but basically, it's a powerful, independent TPL texture converter, which utilizes drag-and-drop, so you don't even need to open a cmd window. If you'd like to know more about it you can look in the 'Old post content' below.

Note 2: The "Manual Placements" tab is basically just the incorporation of earlier versions of this program (still useful in a few cases). An explanation of its usage can be found in the mostly-but-not-entirely-outdated guide, How to Hack Any Texture. Or, the "User Guide & Info.txt" file from DTW v2.x.

I've written my own codec for converting most TPL formats to and from PNG. If you'd like to use this in your own projects, shoot me a PM and I'll share the source code.


Thanks go out to those who led to the golden YaGCD, and all others who have researched, discovered, and documented their findings and reverse engineering.

I also want to give a special shout-out and thanks to Achilles1515 Achilles1515 , @Michael Ashby, and Claire Miri for supporting me on Patreon! You guys are awesome. :)


For versions beyond the latest shown here, please see the github changelist: https://github.com/DRGN-DRC/DAT-Texture-Wizard/releases

To v6.1.2 (64-bit: GitHub Release | MediaFire Mirror):
- Fixed some textures not showing up in v6.1.1
- Fixed an error that could occur when attempting to rebuild a previously rebuilt disc
- Fixed a bug preventing some textures from fully populating their Properties tab
- Flag Decoder windows now automatically update flag entry fields in Properties tab

To v6.1.1 (64-bit: GitHub Release | MediaFire Mirror):
- Fixed a small bug that could prevent saving a disc when a rebuilt file already exists
- Small speed-up to texture identification
- "ReadMe.txt" file renamed to "Program Usage.txt"
- Refactoring and code clean-up for GitHub repo creation

To v6.1 (64-bit):
- Now recognizes stage particle effect textures
- Now able to import textures with corrupted color profiles (from GIMP's 'Save color profile' option)
- Added a 'Save Disc As...' option
- Multiple structures of the same kind (particularly, sibling structures) in SA tab now show counts
- Added numbering to Structural Analysis property display of table/array structures
- Added a requested feature to export all textures across multiple files/folders in the Disc File Tree
- Improved sub-directory creation logic when exporting multiple files
- Fixed texture decoding for types 0 & 8 which have odd widths (broken just recently in v6.0)
- Fixed import for the memory card icon texture (broken just recently in v6.0)
- Fixed disc file name rebuild version incrementation for rebuilt disc back-ups
- Fixed the 'Now Scanning...' program status not going away if no textures were found in a file
- Master/Crazy Hand no longer shows the option to 'Generate CSP Trim Colors' (not supported in 20XX)
- Made changing Wrap Mode on the Properties tab more user-friendly (dropdowns instead of hex entry)
- Small fix to 'Collapse Data Space' feature (could erroneously claim 'amount' was larger than struct)
- Fixed a bug in updating single-byte hex/values in DAT files, such as a texture's 'Repeat Mode'

To v6.0 (64-bit):
- Improved texture recognition (recognizes more textures, with less false positives)
- Rewrote palette searching (also fixes replacing a paletted texture with an image of smaller size)
- Expanded support for Ef__Data.dat files (character graphical effects; ice/hit/sparks GFX, etc.)
- Improved texture decoding & file loading performance (over 40% faster!)
- Structural Analysis tab and its functionality completely rewritten:
- Now displays ALL structures within most DAT files (including stages, menu files, etc.)
- Shows known structures and attempts to identify and map unknown structures
- More info displayed per-struct, such as parents/siblings/children, struct length, etc.
- Shows basic file stats such as file size, total pointers, total structs, etc.
- Deep Dive function to show an in-depth analysis of total file composition
- Added a Structure Search feature (click on magnifing glass in the lower left or press CTRL-F)
- Added an 'Analyze Structure' button to the Disc File Tree tab for convenience
- Improved support for stage names/descriptions in 20XXHP, for versions 4.06 and up:
- Names for each set of 15 random neutrals are now dynamically determined from the disc
- New 'Rename Random Neutral Nickname' feature added to rename random neutral stage names
- More convenience folders added (i.e. folders not actually in the disc's file system)
- Added names/descriptions for more stages
- New 'Model' and 'Properties' tabs, with a few basic tools for working with models & textures
- Textures loaded in the DAT Texture Tree are now ordered by file offset by default
- Trailing black/null palette entries removed from palette data and DAT Texture Tree Palette tab
- Loading external banner files no longer unloads previously loaded DAT files and vice verca
- Added a 'Save Banner As' File option since banners are now handled separately from DATs
- The 'dumpPNGs' setting now works with all decoding pipelines (all texture/export types)
- Drastically improved speed of folder-opening functions; e.g. 'Open Last Used Directory'
- Moved the 'Adjust Texture Filters' menu selection to the top of its menu
- "Auto-Update Headers" option now applies to palette data types as well as image data types
- Root/Reference Node & RT info moved from the DAT Texture Tree tab to the Structural Analysis tab
- Fixed Dolphin file name hash generation for certain kinds of type 8, 9, and 10 (paletted) textures
- 'Copy Dolphin Hash to Clipboard' now works even if 'Export using Dolphin Naming Convention' is off
- Features to 'copy offsets to clipboard' now return all offsets when selecting multiple items
- Added another disc shortcut link, "System" (loads last disc, and goes to the System files folder)
- Palette generation upgraded (speed/performance improved); pngquant updated from v2.5.2 to v2.12.0
- Disc File Tree context menu item "View Hex" keyboard/menu shortcut changed from V to H
- Disc File Tree context menu options are now context-sensitive to the currently selected item(s)
- Added a basic renderer/viewer for collision data (Right-click on coll_data -> Render)
- Renamed the DAT Texture Tree's "Display" tab to "Image"
- When using the 'Run in Emulator' feature, Dolphin will now shut down when you close the game
- Fixed the 'Support DTW' window (forgot to include its background image with the compiled build >.<)
- Heavy refactoring (please let me know if you find any bugs!)

To 5.5 (64-bit):
- Support added for SdMenu.dat/.usd, which contain much of Melee's Kanji (Japanese alphabet) textures
- Expanded support for banner file (opening.bnr) decoding/encoding, which:
- Added support for Japanese characters (Hiragana/Katakana) in disc details
- Fixes discs that have Japanese in their disc details not loading all files in the Disc File Tree
- Fixed disc root building/rebuilding for Japanese discs
- Added an encoding selector switch on the Disc Details tab *
- Small general improvements to how the disc details texts are loaded/edited/saved
- Shift+Enter can now be used on the Disc Details tab for "Image Name" to enter line breaks
- Support added for Melee's LbMcGame/LbMcSnap files, which contain memory card save file banners & icons
- Fixed the issue of double-clicking on files/folders in the Disc File Tree's "File" column not detected

* When a disc is loaded, the encoding will be automatically detected. However, since there's no indicator of a specific country/region/encoding in the opening.bnr files themselves, if you open one of those as a standalone file (one not in a disc), then you may need to toggle the encoding manually. "English/EU" is selected by default.

To 5.4 (64-bit | 32-bit):

- Fixed erroneous file-mismatch detection messages (broke in 5.2/5.3)
- Fixed an obscure bug affecting Pokemon Stadium and a few other stage imports
- Fixed saving of higher mipmap levels when using 'Cascade Mipmap Changes'
- Added support for Dolphin 5+ to the "Run in Emulator" feature
- Added palette entry highlighting when selecting/modifying colors
- Offers to skip CSP Trim Color generation if importing many applicable files
- 'Convenience folders' (those not actually in the disc) now included when exporting
- Image Data Length Calculator updated:
- Output now shows in both hex and decimal
- Result Multiplier added; useful to get the total length of multiple textures

To 5.3 (64-bit | 32-bit):
- Larger or smaller DOLs can now be imported. (Disc auto-rebuilds upon saving)

To 5.2 (64-bit | 32-bit):
- '20XX Version' detection support added for the latest 20XXHP
- Automatic Trim Color Generation support added for the latest 20XXHP
- Slight change to how 'Disc Versions' are determined and displayed
- File replacement warning suppressed for files without string tables
- Fixed Dolphin texture hashes not working with some paletted textures
- Feature added to put a texture's Dolphin Hash file name into the clipboard
- Image dimensions validation added for imported GameCube disc banners
- Some improvements to the CCC for Yoshi
- CCC modified to skip palette headers if the texture/palette wasn't copied
- Fixed CCC when used directly from/to discs (as opposed to standalone files)
- Added alternate font color option to settings file for high-contrast themes*
*Details on these settings can be found in the ReadMe.

To v5.1 (64-bit | 32-bit):
- Full support added for Mipmap textures!
- New setting: Export textures using Dolphin's file naming convention!
- Fixed _9 imports with palettes (broke in v5.0/5.0.1 only)
- Fixed a bug relating to adding new file(s) to a disc (not replacing)
- Fixed imports via Disc Import Method (broke in v5.0/5.0.1)
- Big performance increase to CMPR (type _14) texture loading
- Small performance improvement on all other texture loading
- No longer auto-switches to Disc tab when saving to disc
- Fixed CCC support for Y.Link's eyes
- All opened Root folders now add to "Open Recent" menu
- Disc Shortcuts w/ a root folder no longer animates banner twice
- Added support to the Trim Color Generator for:
Falcon's Red alts
Male/Female Wireframes
Giga Bowser
- Fixed "Auto-Generate CSP Trim Colors" setting always detected as "on"
- Improved performance (speed) of CSP Trim Color Generator
- Trim Color Generator now unbiased by "blanked" textures
- Fixed importing of files lacking string tables (broke in v5.0/5.0.1)
- Files with recently saved changes now highlight in green
- Small improvement to texture recognition
- The "Blank Texture" feature now zeros out palettes as well
- Fixed a bug in submitting individually-changed palette entries
- Support for multiple monitors added to tooltips
- Warnings for "Invalid Textures" disabled*
- Fixed alignment issue with some rebuilds using 'auto' inter-file padding
- Errors are now output to "Error Log.txt"
- Default format for texture exports can now be set in the settings.ini file
* "Invalid" textures being those with a width/height > 1024, or not a multiple of 2. A warning for the former case will probably be added later for imports. The latter case turns out to not actually be a problem for the game.

To v5.0.1 (64-bit | 32-bit):
- Default CSP Trim accent color fixed (was defaulting to the wrong color)
- CSP Trim Color Generation properly clears old data for subsequent runs*
- DOL texture imports fixed (previously broken in just v5.0)
- The Disc Import Method for importing textures now supports DOL textures
- DOL Texture offsets corrected (previously accounting for a file header)
- Warning added for unsaved palette color changes if unloading DAT
- Fixed an obscure bug that could occur if using multiple import methods
*This was only an issue if you edited the same costume manually multiple times in one session. Didn't affect the automatic import mode.

To v5.0 (64-bit | 32-bit):
Rewrote all disc rebuilding functionality, which now allows you to:
- Import (replace) multiple files at once. Even larger ones.
- [Optionally] Avoid rebuilding when importing smaller files
- [Optionally] Avoid rebuilding when importing some larger files
- Add new files or directories to an existing disc image
- Rename files or directories in an existing disc image
- Remove files or directories from an existing disc image
- Open a folder of files (a "Root") to build a new disc
- Specify how much padding should be between files
- Only save/rebuild a disc when you hit save (rather than on-import)
- See what is queued to save, via red highlighted files
New tab, "Disc Details"! Which includes:
- Feature to export/import game banners (from disc or standalone file)
- Features to view/modify disc titles and other disc info/descriptions
- Explanations of the various titles/descriptions and their usage
20XX CSS trim* color generation! (+'Auto-Generate Trim Colors' option)
New Tools menu, with a Color Converter and Image Data Length Calculator
Color swatches show next to certain structure values to show their color!
Color Picker tool for hex color entries! (for Ambience, Diffusion, etc.)
Color Picker also available for live editing of palette entries
Warning added in case you might be importing a file over the wrong one
When saving, warns if an ISO is too large for certain loaders
Disc [Texture] Importing Method is now much more efficient
Better Disc [Texture] Import Method error handling (no repeat messages)
Light-red highlighting for textures with nonstandard** dimensions
Added a warning for textures imported that have nonstandard** dimensions
Previews & thumbnails for imported textures now based on the DAT***
Fixed issue where some root/reference node offsets were incorrect
Root/Reference nodes now displayed in a much friendlier message window
Root/Reference nodes in SA tab now displayed in order of file structure
Some offset representations corrected to account for file headers
Improved file name parsing for image type changes on texture imports
Aspect ratio texture filter will now be preserved as originally entered
Changed CCC behavior for Kirby
Eliminated erroneous texture identifications in MnSlChr (CSS file)
Reduced erroneous texture identifications in all other files
Some program initialization optimization
Fixed the issue of ISO File Tree folders inexplicably opening/closing
New convenience feature, "Run In Emulator", to open the ISO in Dolphin
Improved palette recognition & parsing (fixes old custom costume files)
Added "Open Converted File" button to CCC tab
Option added to toggle on/off the disc convenience folders
Many structure properties updated/added or corrected
Structural Analysis tab improvements:
- DAT structural analysis now takes place before texture processing
- Some structures for matAnim_joint root nodes added
- Sibling Texture Structs added
- (^ Makes available more textures via 'Show in Structural Analysis Tab')
- "Pixel Processor Struct" added (part of Material Object structs)
- Vertex Attribute Data Structs added (part of Mesh Structs)
- LOD Struct added (part of Texture Structures)
- Lance Color Struct renamed/rebuilt as 'Texture Environment Struct'
No longer deletes hex temp files if your hex editor is still open

*The character port background colors when switching to an alt costume. Can be set manually or automatically on import.
**i.e. those with a width/height > 1024, or not a multiple of 2
***i.e. based on the converted color data. This means that you'll instantly see how the texture actually renders without having to reload the file.

Changelist (from v4.2 (x64 | x86) to 4.3 (x64 | x86)):

- Fixed alignment issue occurring with some files during ISO rebuild
- Support for number, letter, & symbol textures in the DOL
- Behavior improvements to the DAT Texture Tree's Properties tab
- Removed cases of false color structs appearing in Properties tab
- Now asks to remove 'Recent Files' from the list if they cannot be found
- Fixed issue of new Metroid Labs stage not opening (and similar cases)
- Fixed SA's "Expand All" (some specific structures wouldn't expand)
- Context Menu features added: 'Copy Offset(s) to Clipboard'
- Improved some back-end stuff for temp files & the View Hex feature
Download Mirrors:
x86 (32-bit): Google Drive Mirror

Changelist (from v4.1.1 (x64 | x86)):
- Support for 20XX 4.05 added (plus better 20XX stage file name descriptions)
- Structural Analysis (SA) tab improvements:
- Now shows all sibling Mesh Structures
- Completed proper hierarchical attachments of Child Bones
- Fixed issue of properties not refreshing in GUI with modified values
- Mipmap info added to Image Data Header structures
- Numbering added to Objects
- "Show in DAT Texture Tree" now works for all structs under 'Object'
- Partial stage file support
- Replaced 'Hide...' feature with 'Highlight...' feature in context menu
- 'View Hex' feature added to Disc File Tree (very useful for quick checks)
- Improved texture recognition (eliminates rendering of most of those non-textures)
- Mipmap identification added! (light blue highlighting on mipmapped textures)
Changelist (from v4.1):
- Fixed an obscure bug where files opened via right-click context menu or
drag-and-drop onto the exe file would have problems importing a _8, _9,
or _10 texture that doesn't have a palette
- Fixed properties saving for Lance Color Struct (LCS) on the Properties tab
- Fixed LCS offset display on Properties tab (was displaying color struct offset)
- Fixed GUI updating for texture width/height in the DAT Texture Tree

Changelist (from v4.0):
- Fixed issue causing incorrect Color Struct offset/data on the Properties tab
- Added the Lance Color Struct offset/data to the Properties tab
- Added 'Child Bones' to the Structural Analysis tab

Changelist (from v3.1):
- Now allows file imports of larger sizes! (rebuilds ISO automatically for you)
- Rewrote the core of the Disc File Tree generation (which now loads instantly)
- Sort feature added to Disc File Tree (click on File header to sort by offset)
- Modified how disc system files are displayed (now renamed and ordered by offset)
- Fixed extraction -and the GUI's file size reporting- of the FST (Game.toc)
- Wrote brand new image encoding/decoding to mostly replace wimgt*, which:
- Completely preserves palettes on export and import (no re-creation)
- Offers superior palette generation for non-paletted textures that need one
- Fixed alpha channel rendering of _2 type textures
- Fixed alpha channel rendering of _3 type textures
- Loads images faster
- More intelligently determines palette encoding
- Added Palette tab background color toggle (to better see partial transparencies)
- Moved the palette header & data offset displays to the Palette tab
- Added 'Trails Image Data?' info to palette tab**
- Palette types can now be changed in DAT files to allow/disallow transparency***
- Re-enabled a check to warn you if a texture's palette is too big
- Added the 'Structural Analysis' tab (experimental) to view/edit structures
- Renamed 'Texture Structure' tab to 'Properties' and added color struct editing
- Fixed an issue where it would incorrectly think an image data header was changed
- Menu option 'Save to New DAT/USD File' renamed to 'Save As....'
- After using 'Save As...', filepath changed to new file for subsequent changes
- Fixed a bug that caused incorrect display of RGB5A3 palette colors with alpha
- Fixed a bug where the palette type for imported TPLs wasn't read properly
- Added 'Disc Shortcuts' on the Disc File Tree tab for quicker access to things
- Fixed instances where the 'Open Last Used Directory' feature would fail
- Font size now adapts to user's system's font size setting (tested on Win7)
- Increasing/decreasing font size is now an option in the settings file
- Added keyboard navigation to the menus (used via ALT key)
- Added the Disc Operations menu, so those commands are available via keyboard
- Added 'CTRL-S' keyboard shortcut for saving changes
- Fixed cases where the Character Color Converter would fail with Falcon & Ganon
- Fixed "PNG to-from TPL.bat" (had a broken link in the last version)
- Reduced the program by ~23 MB (it's about half its old size)
- Other smaller stuff that would just make this list too long....
* wimgt still used for _14 (CMPR) type textures
** describes whether the palette data directly follows the image data in the file
*** the gain for disallowing transparency is better texture colors

Changelist (from v3.0):

- Character Color Converter added!
- Column sorting for DAT Texture Tree tab (click on column headers to sort)
- ISO File Tree support for 20XX 4.0 Beta
- Character files in the ISO File Tree organized into individual folders
- "Structure Offsets" tab renamed to "Texture Structure"
- Scrollbar for Texture Structure tab (appears when needed. yes, like Batman)
- Now shows Texture and Material structure offsets in Texture Structure tab
- Texture properties are now shown and editable in the Texture Structure tab
- Added framework for adding other structures & properties in the future
- Program now moves to the front when you've dragged something onto it
- Improved other drag-'n'-drop handling (mostly backend stuff)
- Fixed an issue that prevented PAL ISOs from being opened
- File naming for exported audio files has been changed slightly*
- Text entries (e.g. for image data headers) turn red when changed
- Fixed the counter incrementing of 'Processing File __....' for bulk imports
*Previously, certain files in the "audio" folder would have "(jp)" added to their name upon exporting, in order to differentiate them from files of the same name within the "us" subfolder. Now, instead, files within the "us" folder have "(us)" added to their name upon exporting. The same is done for the other language folders in the PAL version.

From 2.x to 3+:
- Too many to count from DTW 1|2. 3+ is essentially a rebuild, besides core functionality
- 3.0 is the first version to actually display the textures contained within files within the program
- You can find the changelog for everything prior to version 3 in the "The Old Tools" spoiler below
This is completely optional but can be very useful if you work with the TPL format directly.

Context menu example.png


This functionality demoed above for the converter script can also be used with DTW; so you can right-click on a file, 'Send-to DTW', and the program will open, and then it will open the file you sent to it. This can be a handy alternative to drag-and-dropping a file onto the program or script icons.

To do this, simply download and extract the zip to wherever you'd like to keep these. Then open up the "Installers" folder found inside, and double-click on the script titled "Add 'PNG to-from TPL' to the context menu.bat" or "Add 'DAT Texture Wizard' to the context menu.bat" to run them. The option to send files to DTW or the converter should now be in your context menu. If you move where you keep the program or the converter script, then the links in the context menu will break. To fix them, just re-run the installer. You can also remove the converter from the context menu by running the uninstaller, which is also found in the Installers folder.
Hi! I'd like to share with you how you can speed up and automate some of the processes for texture hacking and working with TPLs. Because of the uncommon image format (being exclusive to Nintendo), the original method of texture hacking Melee (using TexConv.exe, TCS files, and a hex editor) is a bit involved. And although not super difficult or complex, it can still be really tedious, and certainly confusing to newcomers. So I came up with a few methods that are better. Not only that, but now we have a way to work with PNGs directly (which is my format of choice).

[Disclaimer: I realize this may still be a little confusing to those who haven’t gotten into texture hacking too much yet. You can find a full guide on how to use these programs in the thread How to Hack Any Texture.]

I have two things for you guys:

1] A script to convert any number of PNGs to TPL format, and vice-versa.
2] A program to take any number of TPLs or PNGs, and overwrite them into any DAT file.

And both of these provide drag-and-drop functionality, so they’re pretty much amazing.

1] PNG to-from TPL.bat - v2.2 (Google download | MediaFire mirror)


This is a script I wrote around something I found within a set of utilities called Wimm's SZS Tools. Originally, Wimm's tool is used via manual entry into the command line for a single image (including requiring input for the file, file format and image type options). My script uses this tool, but gives you the ability to simply select the files you want to convert, and drag-and-drop them all onto the script at once (or even better, just right click on the files, and send them to the converter, as seen in the installer spoiler below). For each file, it will look at the file format and image type from the file to determine what to do with it. If it’s a TPL, the script converts it to a PNG, and if it’s a PNG, it will convert it to a TPL, while choosing the correct encoding based on the image type*. For the whole process, an interface doesn’t even open; instead, a few moments later you’ll simply have your converted files in the same folder as the originals.

*It determines the image type (and therefore what encoding to use) by looking at the file name. So it will work fine as long as you kept the standard naming convention. e.g. “txt_0038_14.tga” or “GALE01_d7f59321_0.png”. Although you don’t need the entire default filename; all you really need to keep is the last underscore and number at the end, before the file extension.

Your images and the script don’t need to be in the same folder like with TexConv; they can be anywhere, even on different drives. In fact, you can even use it from Window's right-click context menu (as seen in the "Installing to your context menu's 'Send to' submenu" spoiler), making it easier than ever to convert your images!


Version 2.2:
- Made the output more readable, for those that set it to not exit upon completion]
- Removed the unnecessary files from the Wiimms Files folder (now named "wiimms")​
- Dropped the download/program size from 14.4 MB down to 4.2 MB​
- Most of Wiimms Tools are no longer included (all but wimgt) or installable, but are no longer needed​

Version 2.1:
- Added support for paletted textures (_8, _9, _10/_a). (All types now supported.)
- Auto-detects whether Wiimms Tools are installed​
- Added installer to the Windows right-click context menu​
Version 1.1:
- Fixed support for _14 (a.k.a. _e) textures
- Added an error message for cases where an image type is not found
Version 1.0:
- First public release


2] DAT Texture Wizard.exe - v2.2 (download)

This is a program I wrote that allows you to quickly overwrite any number of PNG or TPL files into any DAT, all at once. No more opening each file into a hex editor, seeking offsets, and manually copying binary.

screenie2.0.png


If you are unsure how to use this: usage instructions are included in the download, and again, a full guide, covering the whole texture hacking process (using these tools), is available here.

- Added a "Placements files" folder for auto-loading Placements files & offsets
- Button to automatically create a placements file based on what's currently given to the program​
- Warnings and other help/notice messages now clear upon selecting new files.​
- Added a more specific warning if a file is missing its image type​
- Added red line highlighting in cases where an image has the wrong formatting​
- "Scan folder structure" will now work with folder names that contain only numbers​
- Small updates to the user guide​
- Pro-tips always show (originally intentionally only showed when you didn't load files via drag-and-drop)​

Version 2.1:
- Fixed a bug relating to replacing the transparency and shadow colors for some CSP palettes
- Added a few more Pro-tips
Version 2.0:
  • Changed the name of the program from TPL Overwriter to DAT Texture Wizard
  • Added support for textures with palettes (all types now supported)
  • Can select PNG images as well as TPLs for overwrites (includes automatic conversion)
  • Automatically hexes magenta and lime green palette colors to transparent and 'shadow', respectively
  • Line highlighting for successful/failed overwrites
  • Ability to scan for offsets at any time, including AFTER all files have already been selected
  • Remembers last used search directory (per session)
  • Drag-and-drop file opening feature now sets the default search directory
  • Ability to overwrite a texture into multiple locations (e.g. '..._3.png --> 123ab, 456df')
  • Added true support for .usd files
  • Now will only keep a backup of the dat/usd file if a change is actually made from the original
  • Will accept filepaths in double quotes, and offsets may optionally include the preceding "0x"
  • Can now also be installed to the Windows right-click context menu (super handy)
  • Removed the 'Clear' button (since you can easily do the same thing with 'Ctrl + A, Delete' anyway)
  • Bunch of code optimization
  • Added an improved user guide in the download, in the 'User Guide & Info.txt' file
  • PNG to-from TPL.bat now included in the download (since it's only a 6 KB addition)

Version 1.0:
- First public release

Feedback is appreciated (as well as any bug reports). There are still a LOT of features that could be added. I'll add new functionality based on what you guys would like to see as well as how long it would take to add. Even if you see that someone else is asking for functionality that you'd like, feel free to post anyway so that I know how much demand there is for it.

That's all for now. Enjoy! ^_^
 

Attachments

Last edited:

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
I'll have to try this out, but it sounds pretty awesome. Being able to use PNGs is a godsend, like with the ToolKit. This is the key to making texture hacking widely acceptable.

I think I may have a good use for the TPL to PNG...

Hopefully more stage textures and non-ToolKit compatible DATs will start to be worked on with these new tools.

Adding compatibility with paletted textures will be godly.

Amazing stuff, DRGN. Highly impressive work - thank you.
 

Goxplex

Smash Apprentice
Joined
May 16, 2013
Messages
139
Location
Panamá
Every tool that makes Melee hacking more user friendly is good for the Melee hacking community. Thank you DRGN!

Could you guys give some examples of what textures we can edit whith these tools?
 
Last edited:

Cyjorg

tiny.cc/19XXTE
Joined
Nov 18, 2013
Messages
686
Location
Purdue University
Not yet. CSPs have palettes.
It's possible to change the CSPs to load as CMPR textures to avoid dealing with palettes. You lose transparent colors (ie shadows will be completely black) but you save a lot of time and (possibly) make it easier for less experienced hackers to experiment.
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
If anyone would be interested in helping me include support for paletted images (_8, _9, _a/_10), please have a look at my posts in this thread. I talk about where I'm at with them.

Every tool that makes Melee hacking more user friendly is good for the Melee hacking community. Thank you DRGN!

Could you guys give some examples of what textures we can edit whith these tools?
Are you already familiar with what the image types are? Basically, this can work with any texture whose filename doesn't end in _8, _9, _a, or _10 (right before the file extension). Those are images that use palettes. From what I've seen so far, most images don't have these, so you should be able to use these tools for most textures. And when I say work with, I don't mean editing the image to change what it looks like; you should still be using something like photoshop or Gimp to do that. Beyond the image type caveat, these tools don't have any limits on what DAT files they'll work with or on what the images are for (e.g. characters, effects, stages, menus stuff, even fonts, since they're actually images in many places).


I should also point out that things may be easier if you have Dolphin dump your textures as PNGs, by setting its graphics to use Direct3D11. Just click on the graphics button in Dolphin and you'll see the option right away at the top. If you're going to be opening up the image in an editor to modify it anyway, it won't always matter, because you can then just save it as a PNG when you're done so you can then use it with these tools. However getting them initially as PNG can still be helpful, because if you have the original image as a PNG, then you can quickly convert it using the conversion tool, and then you'll have an original TPL version, which you can use to find the offset in the DAT if you don't already have it.
 

Brandondorf9999

Smash Cadet
Joined
Mar 6, 2012
Messages
71
I cannot convert the captain falcon's punch bird effect to a format and I really need this converted to tpl. My dumped file for that texture is "GALE01_22e96852_14.png". Could you make that png to tpl file actually convert it because the version I'm using won't do it except for the 2 other ones that have succeeded on processing the format and give us the offsets to EffCaData.dat and many other character effects as well as all the other menus such as the Game Over menu which is "GmGover.dat".
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
@ B Brandondorf9999
Thanks for pointing out the bug. I've fixed it and uploaded an updated version.
(Also added an error message in case it can't find an image type for a given file.)

I don't know what the offsets are for the textures in EfCaData.dat (I have them for EfCoData.dat though), but I can tell you how to find them for images that don't have palettes (I.e. doesn't end in _8, _9, _10, or _a):

1) dump the texture as PNG using Dolphin
2) convert unmodified PNGs to TPL using the PNG to-from TPL script. So you'll
essentially have the "original" TPL data.
3) open the TPL in a hex editor, such as HxD
4) starting at offset 0x40, copy the contents of the file (so you'll be copying all but the first few lines) to your clipboard
5) open up an unmodified version of the .dat file that the texture should be in (open it also in the hex editor)
6) run a search (ctrl + F) in the .dat, using the data you copied from the .tpl
(If you're using HxD, you'll need to change the datatype for the search to "Hex-values".)

(As I mentioned, this method doesn't work for images with palettes. Reason being can be found here.)

If you get a match, you should be able to see where the match starts, which is the offset you need.
If you don't get a match, your princess image might be in another castle file.
 
Last edited:

Brandondorf9999

Smash Cadet
Joined
Mar 6, 2012
Messages
71
What program do I use to get tpls from the dat file?

EDIT: There are a few offsets I know are from the EfCaData.dat are 12D00-134FF, 13500-136FF and 13700-146FF, but the others such as the Raptor Boost and Falcon Kick textures need to be found. You will have to look for them and tell me the offsets to them?
 
Last edited:

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
Sorry, I forgot a step in my haste yesterday. XD After you dump your textures in step 1, if you're trying to get the offset, you need to then convert them to tpl, and then use those to proceed on to the next step. If you don't modify them before converting, then basically you'll have "original" TPLs, in other words, the same data (minus the header portion of the file) as what appears in the dat file. I'll fix my post to include the conversion step.

So after dumping the PNGs you'll probably want to copy them to a new folder, so you'll have one copy to edit for whatever hack you're working on, and one unmodified copy you can use to turn into your "original" tpls.

What are the offsets for that you listed?

I'm on my phone right now, so I can't look for any myself right now. Hopefully this helps and you can figure out those steps I posted before.
 
Last edited:

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
How to Replace the CSS Closed Port Texture

1) Modify this image:

GALE01_624092e7_3.png


*Anything in the transparent area will not show up correctly on the CSS and the image will be displayed as black and white (so make your image in grayscale).


2) Use the PNG to-from TPL tool to create a TPL of your modified image.
  • This image is a "_3" type.

3) Use the TPL Overwriter to insert the image into the MnSlChr.usd file.
  • Placement is 0x2F760.
  • Alternatively to using the program, open the TPL in a hex editor and copy from 0x40 onward and paste at the above address in MnSlChr.usd.

EDIT: How to Edit Both Sides of the Closed Texture Port - DRGN
 
Last edited:

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
To select a .usd in TPL Overwriter, you need to rename the file to have a .dat extension. Being able to select them directly is in my to-do list to fix for the next version (I think that's all the file types that have textures, right?). An alternative to renaming the file would be to select a different file that's in the same folder, which you'll see show up in the "DAT Destination" field. Then, just remove the file part at the end and replace it with MnSlChr.usd (or the name of your file).

Btw, I've already added several features which will be in the new version. If you guys can think of anything that would make things easier, let me know and I'll see if I can incorporate it.
 
Last edited:

Goxplex

Smash Apprentice
Joined
May 16, 2013
Messages
139
Location
Panamá
To select a .usd in TPL Overwriter, you need to rename the file to have a .dat extension. Being able to select them directly is in my to-do list to fix for the next version (I think that's all the file types that have textures, right?). An alternative to renaming the file would be to select a different file that's in the same folder, which you'll see show up in the "DAT Destination" field. Then, just remove the file part at the end and replace it with MnSlChr.usd (or the name of your file).

Btw, I've already added several features which will be in the new version. If you guys can think of anything that would make things easier, let me know and I'll see if I can incorporate it.
This works too:
- Press "Select DAT"
- Navigate to the folder where the file is located.
- Write the file name in the 'filename search bar' and a dropdown list will appear with the .usd file. (no need to change the file extension to .dat)
 
Last edited:

CeLL

Smash Lord
Joined
Jan 26, 2014
Messages
1,026
Location
Washington
I edited the image Achilles posted, converted it to a TPL, and overwrote it into MnSlChr.usd. When I play the game, the part that I edited works great :D But the other half (the bottom left part) of the closed port is just black.
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
That image type is supposed to be grayscale, with transparency. Did you try to add color to it? It might help if you upload your edited tpl file so I can see it. Or copy/paste the hex code to here (if you do that though, just do it in [spoiler][/spoiler] tags so it's not a massive post).
 
Last edited:

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
I edited the image Achilles posted, converted it to a TPL, and overwrote it into MnSlChr.usd. When I play the game, the part that I edited works great :D But the other half (the bottom left part) of the closed port is just black.
Make sure the image you are actually converting to a tpl is transparent in the bottom left and not black.
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
I don't think I've ever seen hacks done on the other panel. Have they not been done before? If not, I understand why now. haha

Anyway, I've done this:



I can explain this and the fix to CeLL's problem tomorrow. But right now it's past 5 AM where I am, so please excuse me while I go get some sleep. lol :p
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
I don't think I've ever seen hacks done on the other panel. Have they not been done before? If not, I understand why now. haha

Anyway, I've done this:



I can explain this and the fix to CeLL's problem tomorrow. But right now it's past 5 AM where I am, so please excuse me while I go get some sleep. lol :p
They have not been done before. I'm looking forward to hearing the explanation!
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
I edited the image Achilles posted, converted it to a TPL, and overwrote it into MnSlChr.usd. When I play the game, the part that I edited works great :D But the other half (the bottom left part) of the closed port is just black.
Ok, so obviously I've looked into this, and here's the deal: As some of you may have noticed, Dolphin doesn't dump another panel texture for the other half. That's because the color data for that second half is actually in the same texture as the first half. It's just transparent. Apparently, what the game does is adjust the transparency of both halves when it wants to display one or the other (the designers were basically using the alpha channel as a layer mask). After I realized this, I actually did a proof of concept by simply doing a 'replace all' for all 00 and 80 values in the original tpl texture (for full transparency, and a majority of the partial transparency in the middle, respectively), and replaced them with FF, which, after converting back to png, reveals the whole image!:


I tested the image converter, and was able to see that it indeed preserves the color values of transparent pixels. So, CeLL, the cause of your problem is the image editor that you're using to save your new texture. By chance were you using GIMP? I tested in that because it's my standard editor. I found that after making edits and then saving the image, it removed any pixel's color data that had an alpha transparency of 0. By "remove", I mean changed the values to 0. So it makes sense that once the game gives the pixels back an alpha of anything, they're read as black.

There's an option in GIMP when you're exporting to 'Save color values from transparent pixels', which should do exactly what we need, and which I was hopeful for, but it doesn't seem to work (at least, not without some prior setup). I thought that was really weird, so I googled it, and yeah, it's a known issue with GIMP to still lose the color data. -_- Specifically, this only applies to projects with layers, because, since PNGs don't support layers, any time you need to export to PNG, GIMP first automatically merges the layers, and the merge function is the culprit here (therefore it won't do any good trying to merge the layers and then export).

The solution? Well, it might be easier to try a different image editor. Or, here's how you can do it in GIMP:

1) Open the original image that achilles posted in GIMP.
2) Right-click the layer and go to 'Alpha to Selection'
3) Create a new layer (with transparent fill type). I'll refer to this as the "Alpha Values" or "AV" Layer.
4) The AV Layer should be selected by default. Go to 'Edit' -> 'Fill with FG color'.
5) Deselect all parts of any layers that are selected (Ctrl + Shift + A).
6) So, this AV Layer will be where we'll temporarily save the transparency values for later. You can hide the layer for now.
7) Left-click on the layer for the closed texture port so that it is selected.
8) Open the Channels dialog to view the Red, Green, Blue, and Alpha channels (Windows -> Dockable Dialogs -> Channels)
9) Select so that ONLY the Alpha channel is selected, and then go again to 'Edit' -> 'Fill with FG color'. (blue = selected)
10) You should now be able to see the entire image! Edit it however you want.
11) Once you're completely done editing, merge all of your layers, except for the AV Layer, into one.
12) Right-click on the AV Layer, and go to 'Alpha to Selection'.
13) Left-click on your edited texture layer so it's selected.
14) Go back to the Channels dialog and make sure that once again ONLY the Alpha channel is selected.
15) Invert your selection (Ctrl + i).
16) Go to 'Selection' -> 'Grow', and grow the selection by 1px. (This is an optional substitute to using the alignment fix.)*
17) Hit delete, which will set the transparency levels in the Alpha channel to what they are in the AV layer.
18) Now, go back to the layers tab, and delete the AV layer, so you only have your texture layer remaining.
19) Go to Export in the File menu and save it as a PNG. When the prompt comes up to set additional options, then only thing you need to select is 'Save color values from transparent pixels'.

*The purpose of step 16 is to slightly try to hide a visible fault in the alignment of the two panels, present in the original game. If you look closely to a vanilla CSS, at the closed character ports, you'll see that on the bottom right the panels don't line up perfectly, and you can see a little crack between them. You might also notice that parts of the panels don't line up perfectly horizontally or vertically. Step 16 removes this crack, but doesn't fix the alignment issue.. However, if you apply the alignment fix, either manually yourself, or by using a file that already has it, you don't need to do step 16. I definitely recommend using the alignment fix instead, as it produces much better results in many cases.


And that should be it! The purpose of all of this is to have the transparency values saved elsewhere whenever you perform the merge function in GIMP. Which is why giving the transparency back to the Alpha channel and then saving with only one layer are the last steps.

A note on image types, file names, and DTW: An image type -i.e. a number to ID a specific format for storing intensity/color/transparency data- may be specified in the file name of textures, indicated by an underscore followed by a number. If the filename specifies a certain format, then when you import the texture using DTW, the program will override the format that is currently set in the file you're importing the texture into (so that the game knows what it is and can decode it). If your file's name doesn't end in some image format (for example, "something.png"), then the program will default to use whatever format is currently set for that texture in the file you're importing the texture into. If the image you're importing specifies an image type that doesn't support color, such as _3 (the default for the closed port door texture in vanilla Melee), then when it's imported, that type defined in the file you're importing to will also be changed to match it, and the texture will lose its color if it had any.

If you want to use a different image type, like _5 or 6 (the latter is default in 20XXHP), there are a few ways to do it, but by far the easiest way is to use one of the pre-made files, such as the one linked to in the spoiler above (this), or this one (which also allows for different images per player port).


Convert that to a tpl, insert it into the .dat, put the .dat into your .iso, and it'll work!

I was going to write directions on how to do this in Photoshop too, but for some crazy reason Photoshop doesn't seem to give the option of working with an Alpha channel! (I'm using version 7.) If you save, it will save the transparent pixels, even if you merge layers. But without being able to show the transparent pixels, you'll only be able to work with the one panel in Photoshop. Unless you also load up a copy of the texture with both panels visible to work with. If you guys really want, I could write steps for what I mean, but otherwise for now, I would suggest to just use GIMP, which [if you don't already know] is a free program which I find to be more useful than Photoshop for some things.
 
Last edited:

CeLL

Smash Lord
Joined
Jan 26, 2014
Messages
1,026
Location
Washington
Ok, so obviously I've looked into this, and here's the deal: As some of you may have noticed, Dolphin doesn't dump another panel texture for the other half. That's because the color data for that second half is actually in the same texture as the first half. It's just transparent. Apparently, what the game does is adjust the transparency of both halves when it wants to display one or the other (the designers were basically using the alpha channel as a layer mask). After I realized this, I actually did a proof of concept by simply doing a 'replace all' for all 00 and 80 values in the original tpl texture (for full transparency, and a majority of the partial transparency in the middle, respectively), and replaced them with FF, which, after converting back to png, reveals the whole image!:


I tested the image converter, and was able to see that it indeed preserves the color values of transparent pixels. So, CeLL, the cause of your problem is the image editor that you're using to save your new texture. By chance were you using GIMP? I tested in that because it's my standard editor. I found that after making edits and then saving the image, it removed any pixel's color data that had an alpha transparency of 0. By "remove", I mean changed the values to 0. So it makes sense that once the game gives the pixels back an alpha of anything, they're read as black.

There's an option in GIMP when you're exporting to 'Save color values from transparent pixels', which should do exactly what we need, and which I was hopeful for, but it doesn't seem to work (at least, not without some prior setup). I thought that was really weird, so I googled it, and yeah, it's a known issue with GIMP to still lose the color data. -_- Specifically, this only applies to projects with layers, because, since PNGs don't support layers, any time you need to export to PNG, GIMP first automatically merges the layers, and the merge function is the culprit here (therefore it won't do any good trying to merge the layers and then export).

The solution? Well, it might be easier to try a different image editor. Or, here's how you can do it in GIMP:

1) Open the original image that achilles posted in GIMP.
2) Right-click the layer and go to 'Alpha to Selection'
3) Create a new layer (with transparent fill type). I'll refer to this as the "Alpha Values" or "AV" Layer.
4) The AV Layer should be selected by default. Go to 'Edit' -> 'Fill with FG color'.
5) Deselect all parts of any layers that are selected (Ctrl + Shift + A).
5) So, this AV Layer will be where we'll temporarily save the transparency values for later. You can hide the layer for now.
6) Open the Channels dialog to view the Red, Green, Blue, and Alpha channels (Windows -> Dockable Dialogs -> Channels)
7) Select so that ONLY the Alpha channel is selected, and then go again to 'Edit' -> 'Fill with FG color'. (blue = selected)
8) You should now be able to see the entire image! Edit it however you want.
9) Once you're completely done editing, merge all of your layers, except for the AV Layer, into one.
10) Right-click on the AV Layer, and go to 'Alpha to Selection'.
11) Left-click on your edited texture layer so it's selected.
12) Go back to the Channels dialog and make sure that once again ONLY the Alpha channel is selected.
13) Invert your selection (Ctrl + i).
14) Go to 'Selection' -> 'Grow', and grow the selection by 1px. (This is optional, but I think looks better in the finished result.)*
15) Hit delete, which will set the transparency levels in the Alpha channel to what they are in the AV layer.
16) Now, go back to the layers tab, and delete the AV layer, so you only have your texture layer remaining.
17) Go to Export in the File menu and save it as a PNG. When the prompt comes up to set additional options, then only thing you need to select is 'Save color values from transparent pixels'.

*The purpose of step 14 is to hide a visible fault in the alignment of the two panels, present in the original game. If you look closely to a vanilla CSS, at the closed character ports, you'll see that on the bottom right the panels don't line up perfectly, and you can see a little crack between them. (I believe the images are actually very slightly rotated.) Step 14 removes this crack.

And that should be it! The purpose of all of this is to have the transparency values saved elsewhere whenever you perform the merge function in GIMP. Which is why giving the transparency back to the Alpha channel and then saving with only one layer are the last steps.


Convert that to a tpl, insert it into the .dat, put the .dat into your .iso, and it'll work!

I was going to write directions on how to do this in Photoshop too, but for some crazy reason Photoshop doesn't seem to give the option of working with an Alpha channel (I'm using v7)! If you save, it will save the transparent pixels, even if you merge layers. But without being able to show the transparent pixels, you'll only be able to work with the one panel in Photoshop. So for now, I would just use GIMP, which [if you don't already know] is a free program which I find to be more useful than Photoshop for some things.
Thanks, that makes sense. Also it's cool that we can edit both sides now :D
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
Update!

On the converter script, PNG to-from TPL:
- Added support for paletted textures (_8, _9, _10/_a). Now supports all types
- Auto-detects whether Wiimms Tools are installed
- Added installer to the Windows right-click context menu (as seen below)​

upload_2018-4-18_13-9-4.png


The installer for that is in the Wiimms Files folder (the "Context menu 'Send To' Installation.bat" file). I'm tempted to say, "I don't see how converting images could ever get simpler than this," but I actually do. But that's for another future update. ^_^


However, two big notes:
1) wimgt and TexConv work differently in how they create palettes. It's not really a bad thing, it just means that you need to know how to select the correct ranges when you go to copy the hex data in the .tpl file (using the same standard shown in guides won't always work for these). If you know the basics of how a TPL file is laid out, you should be able to see what exactly to copy once you open up the file. Otherwise, I wrote a short guide for this here.

2) If the PNG you're converting doesn't already have a palette in it, one will be created for it when it's converted to TPL. However, the resulting image quality will be better if you simply save your PNG with a palette after you're done working with it. In other words, generate the palette in your image editor instead of leaving it up to the converter. Check out this post if you're not sure how to do that.
 
Last edited:

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
Update!

On the converter script, PNG to-from TPL:
- Added support for paletted textures (_8, _9, _10/_a). Now supports all types
- Auto-detects whether Wiimms Tools are installed
- Added installer to the Windows right-click context menu (as seen below)​



The installer for that is in the Wiimms Files folder (the "Context menu 'Send To' Installation.bat" file). I would almost say "I don't see how converting images could ever get simpler than this," but I actually do. But that's for another future update. ^_^


However, two big notes:
1) wimgt and TexConv work differently in how they create palettes. It's not really a bad thing, it just means that you need to select slightly different ranges when you go to copy the hex data in the .tpl file. You experienced texture hackers should be able to see what exactly once you open up the file. For you others, I'll create an explanation soon. (Or, if some gracious community member wants to create one, I'll just copy/paste that into the OP or link to it.)

2) If the PNG you're converting doesn't already have a palette in it, one will be created for it when it's converted to TPL. However, the resulting image quality will be better if you simply save your PNG with a palette after you're done working with it. Use 256 colors max, or if you're doing CSPs, 254 colors, so you can add magenta and lime green after the program has generated a palette for the rest of the image. (In GIMP or Photoshop you can generate a palette for the image by using the menus at the top and going to Image -> Mode -> Indexed.) A few rare textures need smaller palettes (which are noted in Steelia's texture packs, if you're using those, and also IE's Melee Toolkit I believe). Also, I recommend using dithering, which should help it look a bit better.
DRGN, this is such an amazing tool for texture hacking. Thank you so much for adding support for palette images – this is definitely no easy task and it makes the tool so much more complete. Really impressive work.

You mentioned that some textures need smaller palettes but don’t mention anything about how your program deals with this. I know that working with TPLs of this form requires subtracting hex values from the pixel information and stuff (based on the guide in this forum). Does your program automatically do this/are smaller palette images fully supported as well?

Thanks for being such a large contributor to the small Melee Hack Scene.
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
Setting the number of colors in a palette is something you would only need to deal with in GIMP/Photoshop (or whatever image editor you're using); you don't need to do anything special with the script. So it should be the same as before when working with those images. Sorry, my other post may have been a bit confusing. I should probably edit that. It might be a good idea to make a whole new guide on all this (one to cover all of texture hacking).

But basically, for textures with small sizes, just refer to this post here for now. Scroll down a bit in it and look for (or ctrl+f for) "Less Than 32 Lines ( _8 )". Long story short, if you're planning on hacking a paletted texture, you should know the size (number of colors) of the palette you're working with, and set that when you're creating your new texture and palette in your image editor. If you don't know the size, you can try following the guide I just linked to, or look at the .dat file that you're putting the texture into if you know how, or you could even look into Steelia's texture packs, since he has listed in his 'placements' text files the sizes for various textures with palettes that are below 256.

And thanks for the thanks. :) Feedback and seeing that people like/use this stuff motivates me to continue.
 
Last edited:

Goxplex

Smash Apprentice
Joined
May 16, 2013
Messages
139
Location
Panamá
What texture type should I use with CSPs? I tried with _9 (In steelia's pack these are named tex#00_09+2.tga) and the CSP was really weird in the CSS haha
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
What texture type should I use with CSPs? I tried with _9 (In steelia's pack these are named tex#00_09+2.tga) and the CSP was really weird in the CSS haha
The _9 in the file name is correct. Did you rename the file to have just have _9.png at the end of the filename? (Which is how you'd see it if it were dumped from Dolphin.)

You might want to double-check that you're copying the correct hex ranges in the TPL. Do you know how to recognize where palette data and image data starts/ends? How many colors are in the palette?
 

Goxplex

Smash Apprentice
Joined
May 16, 2013
Messages
139
Location
Panamá
The _9 in the file name is correct. Did you rename the file to have just have _9.png at the end of the filename? (Which is how you'd see it if it were dumped from Dolphin.)

You might want to double-check that you're copying the correct hex ranges in the TPL. Do you know how to recognize where palette data and image data starts/ends? How many colors are in the palette?
I did the exact same I do with the old method. I used a 255 colors palette. I don't know how to recognize where the palettes are, I just copied the same offsets that Veggies explains in his tutorial (first from 260 to the end, then from 20 to 210).
 

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
You could upload your image so I could take a look if you want.

Here's my attempt at making a clear and simple breakdown on TPL files with palettes:

There are essentially 4 main parts to a paletted (a.k.a. indexed) TPL file: The initial headers (descriptions of the file), then the palette, followed by an image header (description of the image), and finally the image data. Which looks something like this when opening it up to read in a hex editor:


(Disclaimer: I combined the file header, palette header, and image offset table together in this to help with clarity, since it's not important for them to be considered separately here.)

To copy this texture and put it into your .dat or .dol file, you need to copy out the image data, and then the palette data. Which means you need to find the start and end of both of these, which is actually easier than it sounds. You can easily find the offsets for the start and end of the palette data by looking at the top right of everything, in the section marked File and Palette Headers, as you can see below:


These are all hex offsets, relative to the start of the file.

Note that the byte at offset 168 is the start of the image header, and not actually a part of the palette. Meaning that the last byte that you would select to copy for the palette would be 167 (the F0).

Most of the image header is filled with zeros, so it usually makes for a pretty visible divider between the palette and the image data. You can also confirm the start of the image data by looking for the offset itself. You'll notice that appearing early in the image header is an offset that matches the address that comes just after all the zeros end. You can see an example of this with the green arrow above. (The reason I don't give an exact offset to copy from is because the palette for your texture may be longer or shorter than the one shown here, resulting in a different offset for the image data.) The end of the image data is the end of the file. After you click to set your cursor at the start of the image data, you can press 'CTRL + SHIFT + End', which will select from that point onward, to the end of the file.

Palette start: Go to offset 0x1C. This is a 4 byte value that contains the start offset.
Palette end: Go to offset 0x0C (4 byte value). Take the offset found here and subtract 0x1.
Image start: Go to offset 0x1C (4 byte value). Take the offset found here and add 0x8. Go to the result of this and you'll find the 4 byte offset value that is the start of the image data.
Image end: The end of the file.

And that's how you get your data from your TPLs. Hopefully you already know what to do with it.

Let me know if this helps or if it needs more clarification somewhere.
 
Last edited:

Ohsm

Smash Apprentice
Joined
Jul 26, 2011
Messages
175
Location
Germany
Ok, so obviously I've looked into this, and here's the deal: As some of you may have noticed, Dolphin doesn't dump another panel texture for the other half. That's because the color data for that second half is actually in the same texture as the first half. It's just transparent. Apparently, what the game does is adjust the transparency of both halves when it wants to display one or the other (the designers were basically using the alpha channel as a layer mask). After I realized this, I actually did a proof of concept by simply doing a 'replace all' for all 00 and 80 values in the original tpl texture (for full transparency, and a majority of the partial transparency in the middle, respectively), and replaced them with FF, which, after converting back to png, reveals the whole image!:


I tested the image converter, and was able to see that it indeed preserves the color values of transparent pixels. So, CeLL, the cause of your problem is the image editor that you're using to save your new texture. By chance were you using GIMP? I tested in that because it's my standard editor. I found that after making edits and then saving the image, it removed any pixel's color data that had an alpha transparency of 0. By "remove", I mean changed the values to 0. So it makes sense that once the game gives the pixels back an alpha of anything, they're read as black.

There's an option in GIMP when you're exporting to 'Save color values from transparent pixels', which should do exactly what we need, and which I was hopeful for, but it doesn't seem to work (at least, not without some prior setup). I thought that was really weird, so I googled it, and yeah, it's a known issue with GIMP to still lose the color data. -_- Specifically, this only applies to projects with layers, because, since PNGs don't support layers, any time you need to export to PNG, GIMP first automatically merges the layers, and the merge function is the culprit here (therefore it won't do any good trying to merge the layers and then export).

The solution? Well, it might be easier to try a different image editor. Or, here's how you can do it in GIMP:

1) Open the original image that achilles posted in GIMP.
2) Right-click the layer and go to 'Alpha to Selection'
3) Create a new layer (with transparent fill type). I'll refer to this as the "Alpha Values" or "AV" Layer.
4) The AV Layer should be selected by default. Go to 'Edit' -> 'Fill with FG color'.
5) Deselect all parts of any layers that are selected (Ctrl + Shift + A).
5) So, this AV Layer will be where we'll temporarily save the transparency values for later. You can hide the layer for now.
6) Open the Channels dialog to view the Red, Green, Blue, and Alpha channels (Windows -> Dockable Dialogs -> Channels)
7) Select so that ONLY the Alpha channel is selected, and then go again to 'Edit' -> 'Fill with FG color'. (blue = selected)
8) You should now be able to see the entire image! Edit it however you want.
9) Once you're completely done editing, merge all of your layers, except for the AV Layer, into one.
10) Right-click on the AV Layer, and go to 'Alpha to Selection'.
11) Left-click on your edited texture layer so it's selected.
12) Go back to the Channels dialog and make sure that once again ONLY the Alpha channel is selected.
13) Invert your selection (Ctrl + i).
14) Go to 'Selection' -> 'Grow', and grow the selection by 1px. (This is optional, but I think looks better in the finished result.)*
15) Hit delete, which will set the transparency levels in the Alpha channel to what they are in the AV layer.
16) Now, go back to the layers tab, and delete the AV layer, so you only have your texture layer remaining.
17) Go to Export in the File menu and save it as a PNG. When the prompt comes up to set additional options, then only thing you need to select is 'Save color values from transparent pixels'.

*The purpose of step 14 is to hide a visible fault in the alignment of the two panels, present in the original game. If you look closely to a vanilla CSS, at the closed character ports, you'll see that on the bottom right the panels don't line up perfectly, and you can see a little crack between them. (I believe the images are actually very slightly rotated.) Step 14 removes this crack.

And that should be it! The purpose of all of this is to have the transparency values saved elsewhere whenever you perform the merge function in GIMP. Which is why giving the transparency back to the Alpha channel and then saving with only one layer are the last steps.


Convert that to a tpl, insert it into the .dat, put the .dat into your .iso, and it'll work!

I was going to write directions on how to do this in Photoshop too, but for some crazy reason Photoshop doesn't seem to give the option of working with an Alpha channel! (I'm using version 7.) If you save, it will save the transparent pixels, even if you merge layers. But without being able to show the transparent pixels, you'll only be able to work with the one panel in Photoshop. Unless you also load up a copy of the texture with both panels visible to work with. If you guys really want, I could write steps for what I mean, but otherwise for now, I would suggest to just use GIMP, which [if you don't already know] is a free program which I find to be more useful than Photoshop for some things.
thanks for the awesome summary DRGN.

Love the idea to change the closed port texture.

I tried to add in your phoenix tribal but couldn't make it work :(
I double checked ever step from your instruction but couldn't find my mistake.

Here is the whole texture

Here is the halfed part of it with the transparent pixels

And that's what my dolphin spits out

thanks in advance!
 
Last edited:

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
The halfed image you posted doesn't have any color data in the transparent areas.

What image editor are you using? When I talked about the merge function in GIMP being a culprit of removing color data, I wasn't necessarily talking about an action that you select in the program to use. It is also used in the coding back-end of the program, which may be called upon during other operations as well. For example in saving an image that has layers as a PNG (because pngs don't support layers). Therefore the order of operations for editing is really important, especially towards the end. So you might want to double check my explanation in the spoiler labeled 'Creating CSS panels in GIMP'.
 

Ohsm

Smash Apprentice
Joined
Jul 26, 2011
Messages
175
Location
Germany
Thanks for the hint with the merge problem in GIMP.
Found the solution.
When I edited the vanilla texture I just dropped the phoenix render over it, moved it a bit so that the two layers aren't aligned anymore and just merged both.

I'm not sure why but after merging the unaligned layers, GIMP didn't saved the transparent pixel values anymore.
If that makes any sense.

Anyway, after I fixed the alignement it worked like a charm.

Keep the good work up DRGN, these scripts make the editing a lot less stressful <3
 
Last edited:

DRGN

Technowizard
Moderator
Premium
Joined
Aug 20, 2005
Messages
2,175
Location
Sacramento, CA
Wow, that's pretty weird. I don't recognize that problem, so it's hard to say what it is without knowing your steps or seeing the actual texture. You're using GIMP? It looks like there was a problem with copying the transparency to-from the AV layer, for one thing (steps 4-6 and 11-16).

Did the filename end with _3.png before you converted it?
 

Starreaver1

Smash Apprentice
Joined
Oct 12, 2013
Messages
132
Location
Minneapolis, MN/Princeton, NJ
I'll check if I messed up a step later when I have the time. But for now, yes I used GIMP following (or attempting to follow lol) your instructions, and I used your tools to convert, and it did have the _3.png suffix. Is there something else that needs to be done with the tpl? I just copy pasted the TPL into the appropriate offset.
I'll get back to you after I try the GIMP editing again.
 
Top Bottom