Locating a DS Palette for a 8bpp linear

Discussion in 'NDS - ROM Hacking and Translations' started by RadioShadow, Oct 21, 2008.

Oct 21, 2008
  1. RadioShadow
    OP

    Member RadioShadow GBAtemp Advanced Fan

    Joined:
    Aug 30, 2007
    Messages:
    525
    Location:
    UK
    Country:
    United Kingdom
    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. [​IMG] 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):

    [​IMG] [​IMG]


    I know the Wallpapers are stored as 8bpp linear:

    [​IMG]
    No luck lining the tiles up. [​IMG]

    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:

    [​IMG]


    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. [​IMG]
     
  2. psycoblaster

    Member psycoblaster Divine

    Joined:
    Jan 26, 2008
    Messages:
    2,132
    Location:
    Seoul.. (in Korea)
    Country:
    Korea, South
    press the > looking button once
    that black square in the front is not part of the graphics
    press the button looking like |||< few times
     
  3. RadioShadow
    OP

    Member RadioShadow GBAtemp Advanced Fan

    Joined:
    Aug 30, 2007
    Messages:
    525
    Location:
    UK
    Country:
    United Kingdom
    ^ 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. [​IMG]
     
  4. HernanZh

    Member HernanZh GBAtemp Regular

    Joined:
    Apr 6, 2008
    Messages:
    178
    Location:
    The Netherlands
    Country:
    Netherlands
    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.
     
  5. RadioShadow
    OP

    Member RadioShadow GBAtemp Advanced Fan

    Joined:
    Aug 30, 2007
    Messages:
    525
    Location:
    UK
    Country:
    United Kingdom
    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).
     
  6. HernanZh

    Member HernanZh GBAtemp Regular

    Joined:
    Apr 6, 2008
    Messages:
    178
    Location:
    The Netherlands
    Country:
    Netherlands
    So much for that theory then. Then I really have no clue why it would crash when you switch files. [​IMG]
     
  7. psycoblaster

    Member psycoblaster Divine

    Joined:
    Jan 26, 2008
    Messages:
    2,132
    Location:
    Seoul.. (in Korea)
    Country:
    Korea, South
    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?
     
  8. HernanZh

    Member HernanZh GBAtemp Regular

    Joined:
    Apr 6, 2008
    Messages:
    178
    Location:
    The Netherlands
    Country:
    Netherlands
    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...
     
  9. RadioShadow
    OP

    Member RadioShadow GBAtemp Advanced Fan

    Joined:
    Aug 30, 2007
    Messages:
    525
    Location:
    UK
    Country:
    United Kingdom
    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.
     

Share This Page