Author
|
Topic: Tile Molester and DS palettes (Read 2 times)
|
Kitsune Sniper
Guest
|
|
« on: October 21, 2008, 02:10:13 pm » |
|
I'm doing some graphics work for DarknessSavior's Ys DS project but I need some help. I'm trying to see if there's a way to load palette data from a No$GBA savestate (which don't really work with DS games but whatever) into Tile Molester - I figure maybe the savestate contains some palette data or something. I'm a total moron when it comes to Tile Molester, and my usual tools can't load the graphic data from Ys DS' files, so... yeah. Any help? I'm guessing the palettes may be stored in each graphic file, but I'm too stupid to understand this stuff.
|
|
|
|
Ryusui
Guest
|
|
« Reply #1 on: October 21, 2008, 04:03:55 pm » |
|
I'm guessing the palettes may be stored in each graphic file, but I'm too stupid to understand this stuff.
You'd be right, if Death Note: The Kira Game is anything to go by. Open 'er up in WindHex and look near the end of the file. You should be able to find the palette data there. It's also worth noting that DS games store their graphics in GBA 4BPP format ("4BPP linear, reverse-order") or 8BPP (can't remember if it's linear or planar), and that Death Note stores a lot of its graphics as textures, which means you'll need to enable 2-dimensional mode and change the canvas size to match the image dimensions (just take the width and height and divide each by 8). Another caveat: for some dumbass reason, Tile Molester reads the palette offset in decimal. So you'll have to use Calculator to take whatever offset you find and convert it. The number of colors in the palette is in hex, though; just figure out how many bytes the palette is comprised of (should be easy to tell where the palette ends) and divide by two. If you need more help finding the palette, look in CGRAM ($5000000, IIRC) and see if you can't find the actual palette values to look for.
|
|
|
|
Kitsune Sniper
Guest
|
|
« Reply #2 on: October 21, 2008, 04:59:54 pm » |
|
I'm guessing the palettes may be stored in each graphic file, but I'm too stupid to understand this stuff.
You'd be right, if Death Note: The Kira Game is anything to go by. Open 'er up in WindHex and look near the end of the file. You should be able to find the palette data there. It's also worth noting that DS games store their graphics in GBA 4BPP format ("4BPP linear, reverse-order") or 8BPP (can't remember if it's linear or planar), and that Death Note stores a lot of its graphics as textures, which means you'll need to enable 2-dimensional mode and change the canvas size to match the image dimensions (just take the width and height and divide each by . Another caveat: for some dumbass reason, Tile Molester reads the palette offset in decimal. So you'll have to use Calculator to take whatever offset you find and convert it. The number of colors in the palette is in hex, though; just figure out how many bytes the palette is comprised of (should be easy to tell where the palette ends) and divide by two. If you need more help finding the palette, look in CGRAM ($5000000, IIRC) and see if you can't find the actual palette values to look for. Most of the graphics are stored in 8bpp Linear format. I can see them just fine, I just need the palette to edit the graphics properly. And something tells me the palette is actually at the start of the file... because there's a corrupt block before the actual data begins. I haven't tinkered with things enough just yet. The data is 54 bytes large in one block, and 64 in another. I wish we had something better than Tile Molester...
|
|
|
|
Neil
Guest
|
|
« Reply #3 on: October 21, 2008, 05:23:23 pm » |
|
If more people documented what they discovered, you'd probably find more utility authors supporting more formats.
|
|
|
|
Ryusui
Guest
|
|
« Reply #4 on: October 21, 2008, 07:16:30 pm » |
|
And something tells me the palette is actually at the start of the file... because there's a corrupt block before the actual data begins. I haven't tinkered with things enough just yet. The data is 54 bytes large in one block, and 64 in another.
Like I said: crack it open in WindHex and take a look at the suspect areas. It might be palette data, or it might even be sprite/tilemap data ( very useful to have).
|
|
|
|
Kitsune Sniper
Guest
|
|
« Reply #5 on: October 21, 2008, 07:24:13 pm » |
|
And something tells me the palette is actually at the start of the file... because there's a corrupt block before the actual data begins. I haven't tinkered with things enough just yet. The data is 54 bytes large in one block, and 64 in another.
Like I said: crack it open in WindHex and take a look at the suspect areas. It might be palette data, or it might even be sprite/tilemap data ( very useful to have). I'd like to point you to the part where I said "I'm too stupid to understand this stuff." Read it again. All I see are random numbers. There's a pattern but I have no idea what it means, and TileMolester doesn't understand the data when I tell it to load a palette.
|
|
|
|
Neil
Guest
|
|
« Reply #6 on: October 21, 2008, 07:59:30 pm » |
|
I'd like to point you to the part where I said "I'm too stupid to understand this stuff."
I'd like to point you to the part where I said "you should write documentation," but I can't because I didn't write it. (This would constitute a flame were I not a long lost brother of the Sniper, separated at birth.) Just say'n 'sall. You are not the first person to work on a GBA game. Someone, at some point, has probably figured it out and just never bothered to share.
|
|
|
|
Kitsune Sniper
Guest
|
|
« Reply #7 on: October 21, 2008, 08:04:19 pm » |
|
I'd like to point you to the part where I said "I'm too stupid to understand this stuff."
I'd like to point you to the part where I said "you should write documentation," but I can't because I didn't write it. (This would constitute a flame were I not a long lost brother of the Sniper, separated at birth.) Just say'n 'sall. You are not the first person to work on a GBA game. Someone, at some point, has probably figured it out and just never bothered to share. Oh! Um. I wasn't sure what you meant when you said that, sorry.
|
|
|
|
Neil
Guest
|
|
« Reply #8 on: October 21, 2008, 08:11:44 pm » |
|
I probably should have been slightly less vague in my post. So, my bad. It was a ever so slightly off topic musing, hoping someone like kaioshin shows up and says "oh yeah, I figured this out a while ago when working on caravan. here's a quick format guide."
But seriously. If you ever figure something out of even moderate useage, why the hell can't you take 10 minutes to toss it in a text file and share?
|
|
|
|
Kitsune Sniper
Guest
|
|
« Reply #9 on: October 21, 2008, 08:33:51 pm » |
|
You mean like that Mode 7 editing guide I wrote ages ago? Edit: And I -have- figured stuff out in several games. I don't usually make notes, though, so that sucks.
|
|
|
|
KaioShin
Guest
|
|
« Reply #10 on: October 22, 2008, 05:59:42 am » |
|
I'm not at home right now, but I'll check for you later when I am. I haven't worked with the DS yet, so it's possible that I might not have an answer for you. If it's like GBA though (and most of the system is) then I can tell you were in a savestate you'll find the palette RAM. You can use that directly, or search for the corresponding data in the ROM directly then.
Edit: Here we go.
Make sure in the options of no$GBA that Snapshots are saved raw and not compressed. I'm not sure if the freeware even has this option... if not try to edit the ini file. The option and setting should be "SAV/SNA File Format == Uncompressed"
Then just open up the savestate in a hex editor and search for the ASCII string VPAL. That's where Palette RAM (05000000-050007FF) is stored. In my file is was offset a bit, 8 Byte after the label the actual palette data started. Every 32 Bytes are one palette, there are 32 palettes in total. Just dump them, or point Tilemolester to it, I'm not sure how you want to progress form there. I hope Tilemolester isn't expecting RGB values, since it's stored in color intensity stuff instead.
By the way - this only works when the DS is using the 2D graphics engine (= pretty much the old one). I have no idea how to get to texture data for 3D stuff.
Hope this helped you somewhat.
|
|
« Last Edit: October 22, 2008, 03:46:20 pm by KaioShin »
|
|
|
|
Neil
Guest
|
|
« Reply #11 on: October 22, 2008, 04:41:50 pm » |
|
Ladies and Gentlemen, a true Hero Member, just like the profile title says.
|
|
|
|
Kitsune Sniper
Guest
|
|
« Reply #12 on: October 22, 2008, 05:13:40 pm » |
|
The data in the file headers I was looking at is definitely not palette-related. Who knows what it was supposed to be. Anyway, I appreciate this info, even if I don't need it anymore thanks to Atlus taking the games and selling them here.
|
|
|
|
RadioShadow
Guest
|
|
« Reply #13 on: October 23, 2008, 07:14:16 am » |
|
It's also worth noting that DS games store their graphics in GBA 4BPP format ("4BPP linear, reverse-order") or 8BPP (can't remember if it's linear or planar), and that Death Note stores a lot of its graphics as textures, which means you'll need to enable 2-dimensional mode and change the canvas size to match the image dimensions (just take the width and height and divide each by . Another caveat: for some dumbass reason, Tile Molester reads the palette offset in decimal. So you'll have to use Calculator to take whatever offset you find and convert it. The number of colors in the palette is in hex, though; just figure out how many bytes the palette is comprised of (should be easy to tell where the palette ends) and divide by two. If you need more help finding the palette, look in CGRAM ($5000000, IIRC) and see if you can't find the actual palette values to look for. 8bpp DS graphics use linear. Make sure in the options of no$GBA that Snapshots are saved raw and not compressed. I'm not sure if the freeware even has this option... if not try to edit the ini file. The option and setting should be "SAV/SNA File Format == Uncompressed"
Then just open up the savestate in a hex editor and search for the ASCII string VPAL. That's where Palette RAM (05000000-050007FF) is stored. In my file is was offset a bit, 8 Byte after the label the actual palette data started. Every 32 Bytes are one palette, there are 32 palettes in total. Just dump them, or point Tilemolester to it, I'm not sure how you want to progress form there. I hope Tilemolester isn't expecting RGB values, since it's stored in color intensity stuff instead.
That's a clever way to find the palette data. *tries*
|
|
|
|
Solid One
Guest
|
|
« Reply #14 on: November 02, 2008, 06:38:14 pm » |
|
Interesting. Good way to find palette info.
Based in that, I think there's a even better way to load palettes from No$GBA uncompressed save states. If you go to Tile Molester's directory and insert some info to a file called TMSPEC.XML, you can add support to many things. Per example:
1. Open TMSPEC.XML file with any text editor 2. Search for "<palettefilters>" 3. There's an area delimited by two strings: <palettefilters> and </palettefilters>. Here, there's a lot of savestate palette info, from various emulators. You can even add more palette save state info between those two commands. 4. Try adding something like that:
<palettefilter extensions="sna" colorformat="CF01" size="2048" offset="4196476" endianness="big"> <description>No$GBA Uncompressed Save States (*.sna)</description> </palettefilter>
Doing that, you'll probably be able to import palettes directly from No$GBA savestates.
After taking a lot of save states from some DS games, I noticed a pattern: that in all of 'em (or at least in most of them), VPAL string is located exactly in the offset 0x00400870. So, if you go 8 bytes after the VPAL string just as KaioShin said, you'll get to offset 0x0040087C. Convert it to decimal and you'll get "4196476". And, 2048 bytes after the VPAL string, there's another string called VRAM. So, I think that the palette size is "2048" (no need to put it in hex, I think).
But I dunno about the other info "colorformat" and "endianness". And the palettes weren't perfect, but at least it's better than default ones.
Anyone have suggestions?
|
|
|
|
|