TMX file format help

Get your graphics formats figures out here! Got details for others? Post here!
Crypton
advanced
Posts: 60
Joined: Sat Aug 09, 2008 11:19 am
Has thanked: 2 times
Been thanked: 21 times

Re: TMX file format help

Post by Crypton » Mon Aug 11, 2008 9:27 am

Darkfox wrote:Ah yes! That looks far more accurate, possibly right on the nose there! :)
Thats good to know ;) But I'm still not sure if there is correct... I need one original image (non converted) or screenshot from game :(

Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: TMX file format help

Post by Darkfox » Tue Aug 12, 2008 4:00 am

You can find several on the Gamespot page here: Persona 3 Screenshots

Crypton
advanced
Posts: 60
Joined: Sat Aug 09, 2008 11:19 am
Has thanked: 2 times
Been thanked: 21 times

Re: TMX file format help

Post by Crypton » Wed Aug 13, 2008 11:03 am

Darkfox wrote:You can find several on the Gamespot page here: Persona 3 Screenshots
From this screenshot...
http://image.com.com/gamespot/images/20 ... een019.jpg

I guess that image posted in post above is decompressed correctly :)

Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: TMX file format help

Post by Darkfox » Wed Aug 13, 2008 8:14 pm

Hm? I did see that one among the decompressed graphics and it did look right, albeit upside down but that's no biggie. The colors though of the Orpheus were a bit off. I could POSSIBLY get more screenshots by using PCSX2 by transferring over my savegames to it which has most of the Persona in the game. Including the unicorn.

Crypton
advanced
Posts: 60
Joined: Sat Aug 09, 2008 11:19 am
Has thanked: 2 times
Been thanked: 21 times

Re: TMX file format help

Post by Crypton » Wed Aug 13, 2008 8:22 pm

Darkfox wrote:Hm? I did see that one among the decompressed graphics and it did look right, albeit upside down but that's no biggie. The colors though of the Orpheus were a bit off. I could POSSIBLY get more screenshots by using PCSX2 by transferring over my savegames to it which has most of the Persona in the game. Including the unicorn.

I was thinking that its decompressed correctly previously,but if colors are not same as in game then something is really wrong... In header there is value 19,I think it means 19 bits per sample,or 19 bits per index,or its includes flags...

Any another screenshots will be really helpful...

Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: TMX file format help

Post by Darkfox » Wed Aug 13, 2008 9:14 pm

Ok, emulation is a bit shaky in the 3D department but I did get Unicorn:

Unicorn screenshot

Koromaru (the dog)

Koromaru!
Last edited by Darkfox on Wed Aug 13, 2008 9:33 pm, edited 1 time in total.

Crypton
advanced
Posts: 60
Joined: Sat Aug 09, 2008 11:19 am
Has thanked: 2 times
Been thanked: 21 times

Re: TMX file format help

Post by Crypton » Wed Aug 13, 2008 9:23 pm

Darkfox wrote:Ok, emulation is a bit shaky in the 3D department but I did get Unicorn:

Unicorn screenshot
Thank you:)

But I dont see any color difference between this picture:
http://img230.imageshack.us/img230/6824/2pst014vt7.png
and that yours posted above ;)

Maybe I'm blind :P

Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: TMX file format help

Post by Darkfox » Wed Aug 13, 2008 10:03 pm

This may help:

Comparison

Your conversion is sooooo much like it, the colors look so accurate but if you look there is a smoother shading/lighting it seems on my screenshot. A thought did come to mind that Persona 3 smooths out the graphics but I'm not entirely sure.

Is that possible? That Persona 3 ingame smooths them out? This seems a bit odd to me... but... dunno.
Last edited by Darkfox on Wed Aug 13, 2008 10:37 pm, edited 1 time in total.

Crypton
advanced
Posts: 60
Joined: Sat Aug 09, 2008 11:19 am
Has thanked: 2 times
Been thanked: 21 times

Re: TMX file format help

Post by Crypton » Wed Aug 13, 2008 10:37 pm

Darkfox wrote:This may help:

Comparison

Your conversion is sooooo much like it, the colors look so accurate but if you look there is a smoother shading/lighting it seems on my screenshot. A thought did come to mind that Persona 3 smooths out the graphics but I'm not entirely sure.

hmm really strange :) I found out what you meant,there are some areas where color is darker or lighter,and on some areas are some noise pixels.

That dog image is completely out,there are many errors in my decompressed dog image,so decompressor needs to be fixed,I must find out whats "wrong" in tmx format :)

Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: TMX file format help

Post by Darkfox » Thu Aug 14, 2008 9:49 am

It is pretty close though, and in such a short time, a little more tweaking and it might be cracked yet.

Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: TMX file format help

Post by Darkfox » Sun Aug 24, 2008 9:09 pm

Noticed it has been pretty quiet here, any updates or anything on the status of the TMX format?

Barubary
ultra-n00b
Posts: 9
Joined: Mon Jun 15, 2009 12:21 pm
Has thanked: 1 time
Been thanked: 7 times

Re: TMX file format help

Post by Barubary » Thu Jun 18, 2009 6:13 pm

Although I am not keen on replying in a topic that is almost a year old, I figured I might be of service to some if I replied.

The reason the images above look odd, is because the order of colours in the palette is wrong. (obviously, actually)
The colours are stored in a way similar to tiled graphics; the first 8 colours are fine, but the second 8 colours are actually the third 8 colours. The third 8 colours are actually the second 8 colours, and the fourth set of 8 colours are fine again. The same behaviour would happen in tiled graphics when the tile size is 8x2. Example:
Image
The palette on the left is the original, the one on the right is the same palette, but displayed using 8x2 tiles.

To make this post more helpful, a tool I made supports those type of palettes (albeit only recently); TiledGGD. (a tutorial can also be found behind this link)
It is a derivative of the obscure program GGD, which I think some of you will have worked with at least once or twice if you're into ripping graphics from files. One of its shortcomings was that it could not handle tiled graphics, so I decided to make my own version, which could handle tiled graphics, and more. I have recently added support for tiled palettes as well.
It also has a plug-in feature, so that when you want/need to rip from a lot of very similar files (eg: 251 TMX files ;]), you can make a Lua-plugin so that only the relevant data is displayed, and the proper settings are applied. That way, you only have to open each file, and do not need to scroll down to the desired offset to see the data you want to see.

User avatar
Mr.Mouse
Site Admin
Posts: 4051
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 421 times
Been thanked: 575 times
Contact:

Re: TMX file format help

Post by Mr.Mouse » Thu Jun 18, 2009 7:59 pm

Nice! Never mind the age of the thread. Nice work!

Darkfox
VVIP member
VVIP member
Posts: 688
Joined: Fri Jul 04, 2003 6:11 pm
Has thanked: 33 times
Been thanked: 16 times

Re: TMX file format help

Post by Darkfox » Fri Jun 19, 2009 9:47 pm

I like this GGD's interface much better. Thanks for the tool, I'll check if it displays a TMX correctly.

bbrcher
beginner
Posts: 22
Joined: Mon Sep 07, 2009 7:27 pm
Has thanked: 4 times
Been thanked: 9 times

Re: TMX file format help

Post by bbrcher » Tue Sep 08, 2009 12:04 am

I played with TiledGGD this weekend, and it's awesome.

I did find a bug though: the 4bbp palette retrieved the bytes in a weird order so you never get a good picture (alpha is always replaced with blue or whatever).

Until I get off my butt and make a proper patch for Barubary I hope you don't mind my long post with some code.

If you download his code and recompile it with this region in PaletteData.cs changed (just replace the region with this one), it'll be correct:

Code: Select all

                #region case 4BPP
                case PaletteFormat.FORMAT_4BPP:
                    for (palNo = 0; palNo < 256 && !atEnd; palNo++)
                    {
                        if (IsBigEndian)
                        {
                            fst = Next(out atEnd);
                            if (atEnd) break;
                            scn = Next(out atEnd);
                            thd = Next(out atEnd);
                            a = Next(out atEnd);
                        }
                        else
                        {
                            a = Next(out atEnd);
                            if (atEnd) break;
                            thd = Next(out atEnd);
                            scn = Next(out atEnd);
                            fst = Next(out atEnd);
                        }
                        switch (AlphaSettings.Location)
                        {
                            case AlphaLocation.START:
                                //a = Data[currIdx++]; fst = Data[currIdx++]; scn = Data[currIdx++]; thd = Data[currIdx++];
                                parsePalOrder(ref scn, ref thd, ref a, ref fst, out fullpal[palNo]);
                                break;
                            case AlphaLocation.END:
                                //fst = Data[currIdx++]; scn = Data[currIdx++]; thd = Data[currIdx++]; a = Data[currIdx++];
                                parsePalOrder(ref fst, ref scn, ref thd, ref a, out fullpal[palNo]);
                                break;
                            default: throw new Exception("Unkown exception: invalid AlphaLocation " + AlphaSettings.Location.ToString());
                        }
                        
                        //parsePalOrder(ref fst, ref scn, ref thd, ref a, out fullpal[palNo]);
                    }
                    break;
                #endregion
Also, here are the plugin files for easy drag/drop of the TMX files:

Code: Select all

--Name this Graphics_TMX.lua
if readDWORD(0x8) == 811093332 then
	if readWORD(0x16) == 0x14 then
		format = 3; --graphics is 4 bit
		graphicsOffset = 0x80;
	else
		format = 4;
		graphicsOffset = 0x440;
	end
	
	width = readWORD(0x12);
	height = readWORD(0x14);
	bigendian = true;
	setData2(graphicsOffset,height*width/(5-format));
else
	warning = 'File is not TMX: '..readDWORD(0x8)
end

Code: Select all

--Name this Palette_TMX.lua
if readDWORD(0x8) == 811093332 then
	if readWORD(0x16) == 0x14 then
		format = 7; --graphics is 4 bit
		palSize = 16;
		tiled = false;
	else
		format = 7;
		palSize = 256;
		tiled = true;
	end
	
	paletteOffset = 0x40;   
	order = 'RGB';
	bigendian = true;
	alphaAtStart = false;
	ignoreAlpha = true;
	enableAlphaStrech = true;
	alphaStretch = {};
	alphaStretch[0] = 0;
	alphaStretch[1] = 128;
	tilesize = {};
	tilesize[0] = 8;
	tilesize[1] = 2;
	setData2(paletteOffset,palSize*4);
else
	warning = 'File is not TMX: '..readDWORD(0x8)
end
Finally, add these lines to the bindings.xml file:

Code: Select all

  <Binding type="GRAPHICS">
    <Name>Atlus File (TMX)</Name>
    <FilterSet method="AND">
      <Filter type="FILENAME">TMX</Filter>
    </FilterSet>
    <Target type="LUA">Graphics_TMX.lua</Target>
  </Binding>
  <Binding type="PALETTE">
    <Name>Atlus File (TMX)</Name>
    <FilterSet method="AND">
      <Filter type="FILENAME">TMX</Filter>
    </FilterSet>
    <Target type="LUA">Palette_TMX.lua</Target>
  </Binding>
With all of that, you can get some nice pictures. The files are RGBA, and without the code change it'll read it as RGAB, so you might be able to get by with just flipping the Blue channel with the Alpha in Gimp/Photoshop.

On an added note, the SPR files are very similar and have multiple TMX files inside with non-uniform sizes. And on top of that, the BIN files have all sorts of files in them including TMX and SPR files. And, both files are just files stacked on top of each other with a small header section--very easy to separate.

I'll end my first post with a converted TMX from Persona 3 which was looked at previously.
You do not have the required permissions to view the files attached to this post.

Post Reply