ROM Hack Locating a DS Palette for a 8bpp linear

RadioShadow

Well-Known Member
OP
Member
Joined
Aug 30, 2007
Messages
550
Trophies
1
Age
35
Location
UK
XP
624
Country
I'm working on a hack which restores three of the COs graphics that got changed in the US version. Similar to what I did with the Advance Wars 1.

Now the Commanding Offices are stored as GBA sprites (just larger) and I know where they are stored. All the necessary compressed LZ77 GBA CO graphics are stored in the 'rikiishi' folder so all I require to do is a folder swap with the Japanese version.

The palettes are stored in arm9.bin file (see this topic) as GBA palettes along with 4 uncompressed graphics for each CO (that irritated me when I discovered they were stored in there).


Now the only thing I need help editing is the CO Wall Papers. Now I know they are located in the 'rikiishi' folder and are compressed using LZ77 GBA.

I was thinking this would be a simple swap and just require a simple edit but it's not that easy.
frown.gif
So you get what I'm trying to edit, below are Sonja's (Asuka's) Wallpaper from the JP and US version (ripped using a DS Emualtors Tile Viewer):

asuka-1.gif
sonja-1.gif



I know the Wallpapers are stored as 8bpp linear:

sonjapix.jpg

No luck lining the tiles up.
frown.gif


But I've no idea where to find the palette. Any ideas on how they are stored in a DS rom? I can't find any palette data in the 'Data' folder and I think they're stored in the 'arm9.bin' file. If it helps, below is a palette for one of the Wallpapers:

Untitled-8.png



I did try and swap the Sonja Wallpaper from the JP version into the US but the game freezes when it loads the data. I guess the palette information has to match?

Any help would be appreciated.
smile.gif
 

RadioShadow

Well-Known Member
OP
Member
Joined
Aug 30, 2007
Messages
550
Trophies
1
Age
35
Location
UK
XP
624
Country
^ That's not going to work because it seems not all the tiles are in the image. I just looked at Kanbei's (similar style to Sonja's) wallpaper and it contains less 8 x 8 tiles. Also looking at the Sonja data, shouldn't there be more 1 colour (in this yellow) 8 x 8 tiles?

Looks like Nintendo have just have just placed the necessary tiles in a file and the Nintendo DS puts the tile IDs together.

The JP Sonja Data uses less than the US Sonja Data. Now if I make the JP Data the same size as the US data, it should prevent the the freezing, but means I got to find the tile layout data as well as the palette.
frown.gif
 

HernanZh

Well-Known Member
Member
Joined
Apr 6, 2008
Messages
178
Trophies
0
Age
36
Location
The Netherlands
Website
www.heigames.com
XP
165
Country
Netherlands
QUOTE said:
^ That's not going to work because it seems not all the tiles are in the image. I just looked at Kanbei's (similar style to Sonja's) wallpaper and it contains less 8 x 8 tiles. Also looking at the Sonja data, shouldn't there be more 1 colour (in this yellow) 8 x 8 tiles?

Looks like Nintendo have just have just placed the necessary tiles in a file and the Nintendo DS puts the tile IDs together.

The JP Sonja Data uses less than the US Sonja Data. Now if I make the JP Data the same size as the US data, it should prevent the the freezing, but means I got to find the tile layout data as well as the palette. frown.gif
That's exactly what I think. There should be map files that contain the information how the tiles are displayed. If the original has less tiles that the US one, the game might try to look for the tile at an address beyond the file length, causing the crash. Did you confirm that resizing the US one avoids the crash?
I would expect the map file to be stored somewhere at the same place you found the wallpapers. But then again, I would also expect them to store the palette somewhere there too.

Palette entries are stored in 2 bytes. First 5 bits are used for red, the next 5 for green and another 5 bits for blue. (with 'first' i mean least significant)
I don't think the 16th bit is used. Try to recalculate one of the used colors and run a search.
 

RadioShadow

Well-Known Member
OP
Member
Joined
Aug 30, 2007
Messages
550
Trophies
1
Age
35
Location
UK
XP
624
Country
So the palettes are stored the same way as for 4bpp reverse graphics?

So for example:

R = 100
G = 200
B = 50

# = 64C832
GBA = 2C1B


Also Advance Wars DS is one of the complicated ds roms where the packing isn't very organised. The palette files are nowhere to be seen in the 'data' folder (besides the one for the BIOS icon). It's mainly compressed graphics (and other stuff like sound.dat). No map layout for the graphics in there.

I found the 16 coloured palettes in the arm9.bin file so the others are most likely in there. Or it's stored in one of the overlay_xxx.bin files but it seems odd to store it in there.

And the file still crashed when I inserted extra tiles into the JP file (both files were in fact were the same size, just the JP version had more '00' at the end of the file).
 

HernanZh

Well-Known Member
Member
Joined
Apr 6, 2008
Messages
178
Trophies
0
Age
36
Location
The Netherlands
Website
www.heigames.com
XP
165
Country
Netherlands
RadioShadow said:
So the palettes are stored the same way as for 4bpp reverse graphics?Yup.

QUOTE said:
Also Advance Wars DS is one of the complicated ds roms where the packing isn't very organised. The palette files are nowhere to be seen in the 'data' folder (besides the one for the BIOS icon). It's mainly compressed graphics (and other stuff like sound.dat). No map layout for the graphics in there.I've seen worse, Puyo Puyo didn't even have filenames. But at least it always had the map and palette files in the same folder. :/

QUOTE
I found the 16 coloured palettes in the arm9.bin file so the others are most likely in there. Or it's stored in one of the overlay_xxx.bin files but it seems odd to store it in there.

And the file still crashed when I inserted extra tiles into the JP file (both files were in fact were the same size, just the JP version had more '00' at the end of the file).
So much for that theory then. Then I really have no clue why it would crash when you switch files.
frown.gif
 

psycoblaster

Divine
Member
Joined
Jan 26, 2008
Messages
2,131
Trophies
0
Age
33
Location
Seoul.. (in Korea)
Website
Visit site
XP
211
Country
QUOTE said:
And the file still crashed when I inserted extra tiles into the JP file (both files were in fact were the same size, just the JP version had more '00' at the end of the file).
Can you exactly explain what you did for this?
And how does the graphics of the JP/US versions compare?
can you post a pic of both on a tile editor, just like the screen on your first post?
 

HernanZh

Well-Known Member
Member
Joined
Apr 6, 2008
Messages
178
Trophies
0
Age
36
Location
The Netherlands
Website
www.heigames.com
XP
165
Country
Netherlands
psycoblaster said:
QUOTE said:
And the file still crashed when I inserted extra tiles into the JP file (both files were in fact were the same size, just the JP version had more '00' at the end of the file).
Can you exactly explain what you did for this?
And how does the graphics of the JP/US versions compare?
can you post a pic of both on a tile editor, just like the screen on your first post?
Well it's like this: the game reads a map file, which tells what tiles to place where. So it's like tile#1 tile#1 tile#1 tile#2 tile#3 tile#3 tile#1 etc. (there's more data than just tiles in map files, but let's leave that aside) So that's why the image itself doesn't contains so many of the same tiles and that's why it will never align in a tile editor. The problem is when it says for example: ... tile#100 tile#101 ... etc. while there are only 100 tiles in the original image. The game tries to read the tile, but reaches the end of the file instead-> resulting in crash. That's why radioshadow tried to add '00's to pretend that there are extra tiles. But the game still crashes, so there must be more going on...
 

RadioShadow

Well-Known Member
OP
Member
Joined
Aug 30, 2007
Messages
550
Trophies
1
Age
35
Location
UK
XP
624
Country
I think I found where the Map Tile Data gets stored in the DS:

06010000 - This is where the tile data gets stored, after being uncompressed.

0600F000 - This is the data for what tiles to display.


It's a start anyway. Just got to get a complete save working on IdeaS.


As for the palette, I have a feeling it's compressed. But I'm not 100% sure on that.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: It's mostly the ones that are just pictures and no instructions at all