Exporting spritesheets from data files

Discussion in 'NDS - ROM Hacking and Translations' started by xTsukihime, Sep 8, 2011.

Sep 8, 2011
  1. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    I recently unpacked the code geass DS game and have used glycernMapViewer to export the images that use the nclr/ncer/ncgr format.

    Unfortunately, when I got to the spritesheets, they have the ncer and ncgr files, but instead of an nclr they have a pal file (which is the palette I guess). I had to first extract the files from an lz77-compressed narc, but that probably isn't too relevant.

    So now the mapViewer won't load the image cause I don't have an nclr file to provide, and all I have is the pal file that contains the color information.

    How can I export the image with these files? I assume it is not uncommon to store spritesheets this way since not much detail is necessary.

    Here is a sample: http://www.mediafire.com/?tf091tgxccrscgd
     


  2. andibad

    Member andibad Soon™

    Joined:
    Sep 14, 2009
    Messages:
    699
    Location:
    hospital
    Country:
    Indonesia
    used combination MKDS (for pallete file - any-, with some trick(i no share it XD is my private)), TINKE, crystalltile, is was enough for sprite editing.
     
  3. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    Can you spend some time to load up the samples I posted so I can verify that there is some way to get the original image?
     
  4. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    crystal tile 2 has a data to palette function. you look at the file in hex mode and with trial and error (from clicking on some spot in the palette in hex mode) then clicking data to palette (under edit) to find the just right palette. I have to do this for 4 different games and once you find the right offset for where it is in the palette file your good to go for the rest of them.
    this also works for importing palettes from another file as there also is a palette to data function (but you gotta be careful with this as you do no want to overwrite other files' stuff).

    now the flip side and more involved way to do this is to use an emulator and screen shot a part in the game that has the image in question and import the palette from that image in crystaltile2.

    I've tried tinkes open as palette but it needs an offset function added to that. (not a complaint).

    As to the mkds the palette function in it takes a bit of getting used to. (Not a complaint either, far from it).

    I prefer ct2's straight forward approach instead of r g b scale you can literally pick the color off of a windows like palette square. Even then if you know where the palette is and you have to have the image a certain way importing the palette directly from the edited image is so much nicer.
    It leaves me with that just perfect feeling.


    I'll check your image in a minute....
    edit:
    you just have to go to an offset of 8. ct 2 can view the image just fine (with a little size changing 32by48). load the palette by itself (or whatever) view it in hex mode go to offset 8 and hit edit - data to palette....
    then your good to go. (who is that lady? Is she supposed to have green hair?)
     
  5. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    Ya, she has green hair.
    This is her sprite in-game that I got during a cut-scene (though I don't know how that palette importing works)

    [​IMG]

    I'll try the crystal tile.

    First I opened the ncgr and set some options randomly and got this (well, you said offset 8 but it looked kind of distorted so I tried different offsets and came out with this:

    [​IMG]

    How the map is laid out is kind of odd but ok, at least it looks like a proper sprite rather than a bunch of pixels splashed randomly on a sheet. Though even if I got it colored correctly I'd probably still have issues trying to arrange it nicely.

    And then I opened the pal file in hex mode, couldn't change the offset to 8, hit data --> Palette, and wasn't sure what happened.

    Maybe I'm missing a step.
     
  6. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    When I do i the pink is lighter.
    hmm... no change the offset to 8 in the pal file...
    Or simpler in the pal file, the first FD in hex, that is where the palette starts. just click on the F and then go to edit. then down to data to palette.
    Remember where the fd is in the pal file, as that is where all the other pal files will have there palettes start also.

    oh 32 by 48... just try it... they will all line up.
     
  7. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    Alright this time I moved the offset to the start of the FD byte and converted it to palette.
    Then I exported it to a pal file, switched to the window with the image, and then imported the palette.

    I looked went through each row but none of them matched. The closest one I got was this one, but that's it.

    I changed the offset of the image to 30 and everything was centered with the dimensions you specified (positioning looks fine, so I can work with it)

    [​IMG]

    Colors are still off though, hmm
    Could it be the tile form? Or the image pattern? Or some other option maybe?

    As mentioned previously, I do have an image of the sprite in-game and I have seen a palette viewer on desmume, but I don't seem to be able to export it from the emulator.

    [​IMG]

    Hopefully playing around with the provided pal file would lead to good results, as having to play the game is quite tedious lol
     
  8. pleonex

    Member pleonex GBAtemp Regular

    Joined:
    Jan 16, 2009
    Messages:
    197
    Location:
    South of Spain
    Country:
    Spain
    Using Tinke you can view the NCGR file correctly:
    [​IMG]

    You just need to put the value 4 in "Start byte" viewing the pallete and then select the NCGR file with a width of 32.
    About the NCER file it'is not displayed correctly but I'm trying to fix it (there are some errors if you try to view the last cells). By the way you can use this fixed version of Tinke:
    http://dl.dropbox.com/u/3981393/Tinke/Tinke%20rev90-1.zip
     
  9. jjjewel

    Member jjjewel GBAtemp Maniac

    Joined:
    Dec 17, 2009
    Messages:
    1,004
    Country:
    United States
    You need to shift 4 bytes for the palette. (Open your .pal file in CT2, move your mouse to the first row, under column with label 04 and right-click, data-->palette. Then export that palette and use it.)

    The NCGR settings are:
    offset 30
    width 32
    height 48
    tile GBA 4 bpp
    image ObjH-1234

    See pic in the spoiler. [​IMG]

    Warning: Spoilers inside!

    Whoa, pleonex. We posted at the same time. (You probably beat me by seconds. [​IMG])
     
  10. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    Oh, that was the issue. It wasn't being highlighted (so the offset probably didn't change as I had previous assumed)

    Nice, two different approaches with results.
    I wonder which one is easier to work with (and more accurate with large amounts of files)

    This doesn't seem too complicated lol
    I'll try it with tinke.

    EDIT: It was not intuitive that the palette viewer with modified values for tinke had to be open while I am opening the ncgr

    Now, crystal tile only shows 4 tiles per row for me. How can I make it so it displays everything?
     
  11. jjjewel

    Member jjjewel GBAtemp Maniac

    Joined:
    Dec 17, 2009
    Messages:
    1,004
    Country:
    United States
    View-->Fit Window To Tile.

    Or use Shift and arrow buttons to change the window's width/height.

    CT2 will probably need more manual operation compared to Tinke. (I think Tinke can automatically export images, when you have to manually export them in CT2. I haven't tried this new Tinke, though.)

    Edited: Just checked the whole image. You won't be able to export everything with the above settings of CT2. There's a part at the very end of the image that the tile sizes change. After the part with the legs where the character's lying on the floor (dead?), the tile size will be width 16 and height 32. You'll need NCER and NANR file to output this part of the image correctly. Tinke might work better in this case.
     
  12. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    If the tile is 16x32 I could always just export it as two separate images and then build a spritesheet (which would happen anyways).
    That might be easier..unless working with the the ncer and nanr (animations is necessary also?) is easy.

    EDIT: actually, it seems that I can fill up a row with unscaled tiles, but it doesn't want to fill up the rest of the rows, so ya with tinke it can display everything just be specifying larger height.

    Here's another one I decided to look at.
    Looks like the format of the palette is the first 4 bytes are just some ID or maybe type, followed by the data, so the same procedure got the right colors out.

    But the the dimensions aren't the same (is this common? o.O)

    http://www.mediafire.com/?cbxkk12xh8u2d7c

    Warning: Spoilers inside!

    Are there any common values that one should be aware of?
     
  13. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    yes this is common. change the width height a bit and you will come across the right match.
    though tinke will let you view it the right way...
     
  14. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    Even with tinke it still comes out odd, unless I'm misinterpreting what you meant by "right way"
    For example I double click each of the files, then view the NCER. Sometimes it looks ok, other times it's still a mess.

    Although I would assume it's possible to figure out the dimensions and offsets based on the NCER?

    Is there a systematic way to go about doing this? Right now I'm just randomly hitting the up button and watching the tile go from bad distortion to even worse distortion. In crystal it's even more amusing cause I can control the height width and offset with nice shortcuts =/

    I can't seem to pick up any clues whether I should be changing the dimension or changing the offset
     
  15. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    its as combination of both.
    Which comes from experience.


    Its expected that you will have to fiddle around.
     
  16. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    Are there any things to look out for that would indicate whether I need to adjust the dimensions or the offset?
     
  17. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    thought I would replay directly to this one... answering the other one also.
    double or half the width.

    sometimes working with the animation files is easier. but only if they have the right dimensions. which thankfully (I think you can change them in Tinke).
    get used to changing the dimensions... good news is it gets easier.

    things to look for... well for the offset...
    take the width of the tile 8 you have 4 rows of 8 2 rows is 16 wich is 10, 4 rows is 32 which is 20, so you need to move away to so the offset would have to add 20 in hex (in decimal it doesn't matter...). So you are going to need to start thinking in hex numbers 16 instead of 10.
    for the width height, uh, well that is just something you get with experience.

    If you want to get used to it quicker take a few font files and fiddle with the dimensions until you get it right. With the fonts you will know for sure when you get it right. from my personal experience I recommend the non nftr fonts, 7th dragon, itadaki street ds. they both have non nftr fonts. 7th for sure as that has some images where the there is 8bpp and 4bpp and the width and offset change (but in a pattern). Now that I think of it so does inazuma eleven 2 4bpp and 8bpp, the width height and offset all change. as the files are packed in files....

    Of course you could always ask for help here.
     
  18. xTsukihime
    OP

    Newcomer xTsukihime Newbie

    Joined:
    Sep 8, 2011
    Messages:
    9
    Country:
    United States
    I opened up the second sample I posted up in Tinke and viewed the NCER file.
    The first cell looks fine, but then the next 4 are wrong, but then the one after looks fine again.

    This pattern repeats itself until I hit an exception (no more cells I guess).
    What could this mean? And where would I make changes so that they are reflected in the NCER? It doesn't seem like I can do anything much in that view.

    I checked the NANR file to see if there was any difference but it was the same pattern.
     
  19. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    that is a question for pleonex. it is also a good reason why I use crystal tile2. It has the tile composition tool. drag the tiles over to and puzzle the images together then edit it en masse.
     
  20. jjjewel

    Member jjjewel GBAtemp Maniac

    Joined:
    Dec 17, 2009
    Messages:
    1,004
    Country:
    United States
    You can try Console Tool from Romhacking.net forum too. (But in Console Tool, you'll have to right-click the picture to copy it and paste it to some graphic program you have.)

    Anyway, Console Tool might not support this game's palette file. You might trick it by creating a fake .NCLR file from your palette. (Find some other game's .NCLR file and copy your palette file to it. You can use CT2's hex editor. You can copy from byte 4 to the end of file for your palette and then paste it to byte 28 (hex 28) in the NCLR file and test it.) Let me know if you have problem with this method. I tried and it worked but I'm on super slow internet now, I can't post picture. [​IMG]

    You might try to ask pleonex for some adaptation of the Tinke program too. That'd be more convenient.
     

Share This Page