Codes
WiiRd forum
March 28, 2024, 09:46:39 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome on the new server

Update 4.3 - do NOT update!
Gecko 1.9.3.1
Should I get a USB Gecko, I wanna hack?
How do I use my USB Gecko
Where can I get WiiRd?
 
   Home   CODE DATABASE GAMEHACKING Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to find files insideof .tpl files in the RAM?  (Read 1998 times)
CosmoCortney
Hacker
Jr. Member
*****

Karma: 8
Posts: 85

Mensch-Maschine, halb Wesen & halb Ding


WWW
« on: November 16, 2013, 06:31:57 AM »

Hi,
the FST Tab of gecko dnet can be used to find values of any file and its address easily.
but there are files inside of archives like .tpl or .gma, as well.
I extracted a .tpl file and found textures in .png format named like: 0.png, 12.png and so on.
I would like to swap these files when the game is opening an archive, to swap textures. (this .tpl format cannot be opened using c-tools. it works with gxgma only and it's not able to repack files).
in the memory viewer I typed "1.png" in the search textbox and selected Ansii as search method. but no results.
how could I find any useful data to swap these files?
Logged

megazig
Hacker
Full Member
*****

Karma: 4
Posts: 127


« Reply #1 on: November 17, 2013, 05:29:09 AM »

.tpl is a texture palette. the files inside aren't .png
to replace them you can use something like zetsoubu which can unpack/pack .tpl files
Logged
CosmoCortney
Hacker
Jr. Member
*****

Karma: 8
Posts: 85

Mensch-Maschine, halb Wesen & halb Ding


WWW
« Reply #2 on: November 17, 2013, 07:13:45 AM »

there are .png files in it. I extracted it using gxgma. These .tpl files can be found in f-zero gx/ax and super monkey ball 2.
the tpl editor gives me following error message: Load Error. Invalid file found during decode (Load Error. Ungültige Datei beim Decodieren gefunden).
here you can find one .tpl from f-zero gx: http://datei.to/?6Hz0yrpxv2

Unfortunately gxgma is unable to repack/edit files (extracting only). so i'd like to swap textures by cheat/code instead. same problem with .gma files.
Logged

dcx2
Computer Engineer
Moderator
Legendary Member
*****

Karma: 165
Posts: 3468


WWW
« Reply #3 on: November 20, 2013, 04:51:33 AM »

Ah, I remember doing something with TPL files, a long time ago...recolored some character's hair in-game.  Even did it with riivolution's wifi on-the-fly patching.  I remember it being fun, but I don't remember what I did.  There was a fellow on this forum by the name of frubam, he was particularly excellent at texture stuff.  EDIT: here's frubam with some epic details.  http://wiird.l0nk.org/forum/index.php/topic,2530.msg69821.html#msg69821

---

In general, if one disagrees with megazig, one should seriously reconsider their position...

It is my experience that TPL files do not contain PNG files.  Rather, the tools that allow you to work with TPL files first convert them to some other intermediate format, like PNG or BMP.  Then you operate on this intermediate, and at the end the PNG files get converted into a TPL file.

TPL has a lot of different formats (RGBA8, RGB565, IA8, CI4, some others) and sometimes a palette too.

---

You shouldn't need too much trickery if you just want to swap files.  I think Gecko.NET can automatically generate those codes.
« Last Edit: November 20, 2013, 05:08:26 AM by dcx2 » Logged

CosmoCortney
Hacker
Jr. Member
*****

Karma: 8
Posts: 85

Mensch-Maschine, halb Wesen & halb Ding


WWW
« Reply #4 on: November 28, 2013, 05:03:28 AM »

Ohh. I really thought there are .pngs in it, because this was the result after extracting:



a mass of .png files.

so these files just have been converted to .png while extracting, right?

EDIT: I wanted to swap 12.png with 30.png using gecko codes (30.png is a beta texture and does not appear), because the program I used to extract f-zero gx's .tpl and .gma files is unable to repack files. and I don't have enough knowledge in c++ to work with the source code attached by the program Sad
« Last Edit: November 28, 2013, 05:07:45 AM by CosmoCortney » Logged

dcx2
Computer Engineer
Moderator
Legendary Member
*****

Karma: 165
Posts: 3468


WWW
« Reply #5 on: November 30, 2013, 09:18:28 PM »

You could try this tool based on LibWiiSharp.  It's a modification of the base TPL converter example that can operate on a TPL that contains multiple images.  It helped me when I recolored Marta's hair in DotNW.  Zip has source plus binary.

http://www.mediafire.com/download/5ukv25ebkdamr0m/libWiiSharpTPLConv.zip

The TPL to Image tab will show you all the textures that are inside the TPL (scroll through with the Texture dropdown).  It will let you pull them out as various image types (I usually choose PNG, you could use any lossless format, so don't use JPG).  It will also tell you about the individual textures as well, such as their size, Format, and Palette.  This info is needed when re-packing the TPL.

On Image to TPL, it's less intuitive.  I suggest ignoring the Convert button - it works, but it can be confusing.  Instead, favor the Add button.  The number in parentheses beside the Add button is the index in the TPL where the new input image will go; so Add (1) means that the input image will be the first texture in the TPL; in other words, the TPL has zero textures.

Every time the output TPL file is changed, Add (n) will update to reflect where the input image will go.  This allows you to not just replace, but add images to a TPL.  Load a TPL with 4 images, it will say Add (5), select an Input Image and click Add and it will now say Add (6) and your TPL will be automatically saved with the new fifth texture added to it.

Oh yeah.  With all of this, make sure you have a few extra copies of your images.  Do all of your work on this application with copies and keep the originals somewhere safe.  There aren't a whole lot of safety checks or confirmations in this app.

When you select an input file, it will try to guess what a good output file will be.  If this output file already exists, you will be appending to it, not over-writing it.  So delete this output file (you are working on copies, right?) or give it a different name.  While the Input Image textbox only shows one file, behind the scenes the textbox's tag will keep track of multiple files that were selected.  So you could select all four PNGs at once and make them into a TPL.  If you do this, make sure you click the LAST FILE FIRST, and then hold shift and click the FIRST FILE LAST.  In the Open File Dialog it should then list the files in the correct order (1,2,3,4); if you do this wrong and click the first file first, it will look like (4,1,2,3) instead, so cancel and try again.

After you select your input images, and output TPL file name, set the Format and Palette to match the original (which you got off the TPL to Image tab, right?).  Then IGNORE the Convert button, and instead click Add (1) (if the output TPL has no textures in it).  It will automatically create/append to the Output TPL file, and Add (n) will reflect where the next Input Image would go (so if you add 4 PNGs to a TPL, it will say Add (1) before and Add (5) after you click the Add button).

If you want to "clear" any setting, you should just quit and re-open the file.  Make sure to delete any previously existing output files if your intent is to create a new TPL, because this tool always adds images to an existing output file.

EDIT:

Any time you create a TPL, load that TPL back into the TPL to Image tab and make sure that the textures look right.  Be careful not to hit Convert on the TPL to Image tab or you could overwrite your Input Images (which wouldn't be so bad because you're working on copies, right?)

EDIT2:

@megazig, you mentioned "Zetsubou"?  I googled, can't find any source or binaries, the github is dead.  It also says it can't handle CI formats.  The LibWiiSharp converter example I posted to mediafire can handle CI.
« Last Edit: November 30, 2013, 09:30:38 PM by dcx2 » Logged

megazig
Hacker
Full Member
*****

Karma: 4
Posts: 127


« Reply #6 on: December 02, 2013, 02:42:58 AM »

the github repo was stupidly taken down. it does handle CI as it's the basis for libwiisharp too.  I'll look to find if I have a copy of it. otherwise the other converter would be fine to use
Logged
CosmoCortney
Hacker
Jr. Member
*****

Karma: 8
Posts: 85

Mensch-Maschine, halb Wesen & halb Ding


WWW
« Reply #7 on: December 02, 2014, 10:33:38 PM »

Got it!
The model information contains a lot of stuff about the texturing. There are addresses stored that point to the location of the loaded texture. modifying it allows me to load different textures Smiley
The problem is that I can't load the beta-texture.. all others are accessible..
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!