Texture and Model Data Hacking

Discussion in 'NDS - ROM Hacking and Translations' started by Blazer, Aug 17, 2011.

Aug 17, 2011

Texture and Model Data Hacking by Blazer at 5:11 PM (1,926 Views / 0 Likes) 12 replies

  1. Blazer
    OP

    Member Blazer GBAtemp Regular

    Joined:
    Aug 10, 2008
    Messages:
    280
    Country:
    United States
    So while translating a game I've hacked almost every graphic except for some animated graphics of sorts, specifically text that fades in/out during the opening scene, and the title logo with the name of the game.

    Here are screenshots of what I mean:

    [​IMG]
    [​IMG]

    The file types in question are .ca, .ma, and supposedly most importantly, .md. These are also known as BMD files. .ca is model animation data I think and .md is model data (has graphics in it, and a palette, but I can't get the palette working at all).

    I've tried various things and looked up documentation such as this one but to no avail. For example, when I tried to rip the graphics, I got this:

    [​IMG]

    So... I really need some help. Even any leads or tips or suggestions. That kind of graphic data is not something I nor our graphic artist can work with. I checked the RAM and it doesn't seem to contain the palette data for the image, even. It doesn't contain still graphics either, just data that looks like a texture that has to somehow be manipulated into the final form that I showed in the earlier screenshot. I don't really have much of an idea how this works, GBA graphics don't have this stuff at all from what I've ever seen >_>.

    I've attached the files for the title logo (since that's our priority) below:

    http://dl.dropbox.com/u/8875056/hacking/title_logo.ca
    http://dl.dropbox.com/u/8875056/hacking/title_logo.ma
    http://dl.dropbox.com/u/8875056/hacking/title_logo.md

    Ripped directly from the game using DSLazy and whatnot.

    I'll try and give any more information as I remember it, I feel like I'm forgetting something but that's about all I got. Any help would be greatly appreciated. Thanks for your time.

    ~ Blazer

    EDIT: I've now tried

    - ConsoleTool, does not support any relevant files
    - Tinke, does not support this game
    - SMB64DS Editor, it looks like it support the files but of course, it doesn't support the game
    - searching on google
    - searching on this forum
    - searching on RHDN.net

    Still looking for help...
     
  2. jjjewel

    Member jjjewel GBAtemp Maniac

    Joined:
    Dec 17, 2009
    Messages:
    1,004
    Country:
    United States
    CrystalTile2 can view the image, but I can't locate the palette either.
    This is what I got from title_logo.md in CrystalTile2. (First, you need to decompress the file with any program that support LZ compression type 11. There are a few posted in the forum. And CrystalTile2 didn't automatically load the image though. You'll have to adjust the offset and image width/height yourself.)

    Warning: Spoilers inside!

    So I think locating the correct palette would be the problem now.

    What I'd suggest you to try is to switch your .ma and .ca file with .ma /.ca from other files. Just try switching one file at a time and check your game to see what has changed. (Hopefully, the game won't crash. In this case, if the colors change, you can narrow down which file your palettes are stored. In case the game crash, just try to change some bytes in the .ca/.ma files to see what has changed after that.)

    I'm not sure if the Chinese has already hacked this game. But if they did and if they modified the logo, you can try to compare what they've changed.

    Or if you really can't locate the palette, you might just try to use any palette that look close to the real one and edit the pictures as is. Sometimes, it works.

    P.S. I don't have the game rom, so this info is based on the 3 files you posted the links. [​IMG]

    Edited: Oops, I forgot about other text and stuff. It might be possible to view them on CrystalTile2 as well, but I'm not sure about that.
     
  3. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    go from 4bpp to gba8bpp and change the width height a bit... Its somehting I had to do with the moving letters in itadaki street ds. my files though are nsmbd so not really that hard for me to figure out. but the point being that I can see them in gba 4bpp but gba8bpp is the one that shows them just perfect.
    form the screenshots though I am almost sure that the moving fading letters are not in that file or are further down in the file.

    second point Don't worry about the pallette sure it might come in handy but you can still edit the image without it.
     
  4. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,711
    Country:
    United Kingdom
    Starting with 11 points at type 11 LZ compression which their relative inability to be compressed would seem to back up and DSDecmp makes short work of that.

    Somewhat surprised to see what might be 3d in a title screen but title screens do have a history of very odd things vs the rest of the game.
    The old nsbmd.exe opens the decompressed title_logo.md but spits a single 2d square- chances are the texture is mapped to this. Again a very odd way of doing things but hey.
    Some output from the tool
    CODEDEBUG: file size = 0001dfa8 (122792)
    =================================
    reading 'MDL0'...
    No. of Model = 01
    DEBUG: texnum = 15
    tex (matid=4): 'bg'
    tex (matid=8): 'copylight'
    tex (matid=2): 'fiireemblem'
    tex (matid=3): 'fiireemblem_s'
    tex (matid=5): 'fireemblem_ef'
    tex (matid=12): 'lensf'
    tex (matid=21): 'orb'
    tex (matid=0): 'r'
    tex (matid=26): 'shield'
    tex (matid=7): 'shield_ef'
    tex (matid=9): 'shield_sdw'
    tex (matid=1): 'silhouette'
    tex (matid=11): 'silhouette_ef'
    tex (matid=6): 'subtitle'
    tex (matid=10): 'subtitle_ef'
    DEBUG: palnum = 15
    pal (matid=4): 'bg_pl'
    pal (matid=8): 'copylight_pl'
    pal (matid=2): 'fiireemblem_pl'
    pal (matid=3): 'fiireemblem_s_pl'
    pal (matid=5): 'fireemblem_ef_pl'
    pal (matid=12): 'lensf_pl'
    pal (matid=21): 'orb_pl'
    pal (matid=0): 'r_pl'
    pal (matid=7): 'shield_ef_pl'
    pal (matid=26): 'shield_pl'
    pal (matid=9): 'shield_sdw_pl'
    pal (matid=11): 'silhouette_ef_pl'
    pal (matid=1): 'silhouette_pl'
    pal (matid=10): 'subtitle_ef_pl'
    pal (matid=6): 'subtitle_pl'
    DEBUG: matid = 0, texname: r, palname: r_pl
    DEBUG: matid = 1, texname: silhouette, palname: silhouette_pl
    DEBUG: matid = 2, texname: fiireemblem, palname: fiireemblem_pl
    DEBUG: matid = 3, texname: fiireemblem_s, palname: fiireemblem_s_pl
    DEBUG: matid = 4, texname: bg, palname: bg_pl
    DEBUG: matid = 5, texname: fireemblem_ef, palname: fireemblem_ef_pl
    DEBUG: matid = 6, texname: subtitle, palname: subtitle_pl
    DEBUG: matid = 7, texname: shield_ef, palname: shield_ef_pl
    DEBUG: matid = 8, texname: copylight, palname: copylight_pl
    DEBUG: matid = 9, texname: shield_sdw, palname: shield_sdw_pl
    DEBUG: matid = 10, texname: subtitle_ef, palname: subtitle_ef_pl
    DEBUG: matid = 11, texname: silhouette_ef, palname: silhouette_ef_pl
    DEBUG: matid = 12, texname: lensf, palname: lensf_pl
    DEBUG: matid = 13, texname: , palname:
    DEBUG: matid = 14, texname: , palname:
    DEBUG: polynum = 27
    DEBUG: codeoffset = 000007d4
    =================================
    reading 'TEX0'...
    DEBUG: blockoffset = 00001e30, blocksize = 0001c178
    texnum = 15, palnum = 15
    tex 0 'bg ': offset = 00010e98 size = 00004000 [W,H] = [256,256]
    tex 1 'copylight ': offset = 00014e98 size = 00000200 [W,H] = [128,16]
    tex 2 'fiireemblem ': offset = 00002198 size = 00002000 [W,H] = [256,64]
    tex 3 'fiireemblem_s ': offset = 00015098 size = 00000200 [W,H] = [128,16]
    tex 4 'fireemblem_ef ': offset = 00004198 size = 00001000 [W,H] = [128,32]
    tex 5 'lensf ': offset = 00005198 size = 00001000 [W,H] = [64,64]
    tex 6 'orb ': offset = 00006198 size = 00000400 [W,H] = [32,32]
    tex 7 'r ': offset = 00006598 size = 00000100 [W,H] = [16,16]
    tex 8 'shield ': offset = 00015298 size = 00001000 [W,H] = [128,128]
    tex 9 'shield_ef ': offset = 00006698 size = 00004000 [W,H] = [128,128]
    tex 10 'shield_sdw ': offset = 0000a698 size = 00004000 [W,H] = [128,128]
    tex 11 'silhouette ': offset = 00016298 size = 00002000 [W,H] = [256,128]
    tex 12 'silhouette_ef ': offset = 0000e698 size = 00002000 [W,H] = [128,64]
    tex 13 'subtitle ': offset = 00018298 size = 00000800 [W,H] = [256,32]
    tex 14 'subtitle_ef ': offset = 00010698 size = 00000800 [W,H] = [64,32]
    pal 'bg_pl' size = 2528
    pal 'copylight_pl' size = 16
    pal 'fiireemblem_pl' size = 32
    pal 'fiireemblem_s_pl' size = 272
    pal 'fireemblem_ef_pl' size = 16
    pal 'lensf_pl' size = -16
    pal 'orb_pl' size = 32
    pal 'r_pl' size = 16
    pal 'shield_ef_pl' size = 16
    pal 'shield_pl' size = -48
    pal 'shield_sdw_pl' size = -16
    pal 'silhouette_ef_pl' size = 1696
    pal 'silhouette_pl' size = -1696
    pal 'subtitle_ef_pl' size = 2144
    DEBUG: 4x4-texel spdataoffset = 00018a98, spdatasize = 00002000
    DEBUG: 4x4-texel spdataoffset = 0001aa98, spdatasize = 00000100
    DEBUG: 4x4-texel spdataoffset = 0001ab98, spdatasize = 00000100
    DEBUG: 4x4-texel spdataoffset = 0001ac98, spdatasize = 00000800
    DEBUG: 4x4-texel spdataoffset = 0001b498, spdatasize = 00001000
    DEBUG: 4x4-texel spdataoffset = 0001c498, spdatasize = 00000400
    DEBUG: converting pal 'bg_pl', palentry = 1264
    DEBUG: converting pal 'copylight_pl', palentry = 8
    DEBUG: co


    Still looking at title_logo.md once decompressed in a tile editor in 8bpp GBA mode with tile width set to various ones mentioned in there seems to spit out the images appropriately for each of the possibilities (seems to be getting more common to use large/wide tiles).

    http://llref.emutalk.net/docs/?file=xml/bmd0.xml#xml-doc as you linked.
    http://kiwi.ds.googlepages.com/nsbmd.html (old but has some good stuff).

    JNT0 featured in the .ca file (joint- part of animation) files. I am guessing this

    It looks like you might have a fairly standard 3d affair just without the usual extensions (the chosen extensions corresponding to their "normal" files though).
    Indeed http://www.propl.nl/random/NSBTXExtractor.zip (thanks Barbuary for that one) kicked a bunch of files (the text output was not very interesting) out some of which I pasted into
    [​IMG]
     
  5. Blazer
    OP

    Member Blazer GBAtemp Regular

    Joined:
    Aug 10, 2008
    Messages:
    280
    Country:
    United States
    @jjjewel if you take a look at the first post, I pretty much did what you did except I didn't use CrystalTile and I didn't zoom in or load a palette (I used greyscale). I found what *looked* like a palette but I couldn't actually load it properly and get it looking right. :\

    The other files are not graphic files, I don't think. My reasoning behind this is that 1) I couldn't view any sort of graphics on them using various different image formats (4bpp, 8bpp, indexed bitmap, etc.) and 2) they are way too small to be graphics, at least not the same graphics, I think. :\

    So yeah, you pretty much just found what I found, unfortunately... [​IMG]

    @text I tried 8bpp, I couldn't get it working. Depending on what the posts below you say (I saw some stuff but I haven't actually read it) I may try again, though it really didn't work for me, and when I viewed the data in the OAM editor it showed pretty much exactly what my screenshot rip looked like to me, meaning I think it's 4bpp after all... :\

    Though I think you mentioning moving text is on the right track, these file formats are only used for 'animated' graphics, if that makes sense (but it's more like "graphics that have animated effects on them" than just "animated graphics").

    I thought something like this, FE12 seems to be missing the longer extension names that many other games have (mainly the 'nitro' stuff) and also has some other interesting extensions, though in any case, relevant to this, I think that the .nsbmd or whatever file type is parallel to the .bmd file type. Though I'm not well-versed in texture hacking (obviously, or I wouldn't be making this post) so it was all hypothesizing.

    By the way I also saw kiwi's page that you linked, that had some general information on the format but nothing I could make use of, again, since I'm not an expert hacker like some of these people. Though I'm probably better than your average Fire Emblem or Pokemon hacker in terms of figuring things out on your own, so I guess it's all relative, compared to real hackers I'm shit, compared to noobs I am THE shit, if you catch my drift

    In any case the graphic rips you posted are really nice but it's no use if I can't rip and insert them myself >_> With that being said I'm going to take a peak at the program you mentioned and try loading 8bpp graphics again to see what I get, because I might have overlooked something really noobish in which case I am going to be really upset with myself since I spent a lot of time raging at this XD


    -----------------------------


    EDIT: I tried my preferred graphic program again but to no avail, so I instead tried Crystal Tile 2, which I've heard so much about. After a hard long fight to find a download link and get it in English, I loaded the file, figured out how to get it into 8bpp graphics with a palette that would at least let me recognize what's what, then played around with the width until I got 128-32, and chugged in the offset of 2198 (thanks for the debug, Fast, that helped with the offset [​IMG]).

    This, of course, can only mean 1 thing: the program I was using has a flawed system for viewing 8bpp graphics that somehow screwed with this. Or I'm an idiot at using it. I'd tell you guys the name of the program but you'd likely laugh or mock me and I don't feel like explaining myself...

    With that being said I

    1) don't know where the other text in the screenshots that says "Heroes of Shadow and Light" is and while viewing the map, tiles, and OAM in Desmume, could not find anything that looked like text (I might have missed it but after 3 tries of looking for it I've kind of lost hope)

    2) don't know how to load palettes in Crystal Tile 2, which is a problem because... wait, actually, since you gave me a clean rip of the image, I might be able to get away with using that as a basis for the hacked image, and then just inserting an edited palette since the palette for the Japanese "Fire Emblem" text doesn't seem to depend on anything else. though this is all theory so it'd be nice to know if I can load palettes in CT2 and if so, how XP

    In any case I'd like to say thanks for everyone who posted so far as I was about ready to tell my team I failed them as a hacker and couldn't hack the title screen. At least now there's some kind of hope, although feint and nebulous. ._. If this goes through you will have done everyone who plays the game an epic service (mainly you FAST, since you helped the most, and I even remember you helping me with sound hacking once [​IMG])
     
  6. jjjewel

    Member jjjewel GBAtemp Maniac

    Joined:
    Dec 17, 2009
    Messages:
    1,004
    Country:
    United States
    @Blazer, here's the palette file for the title logo.
    http://www.mediafire.com/file/bca36k3t78n7...eEmblemLogo.pal

    This example might give you some idea how to import palette file.
    https://sites.google.com/site/otomegameguid...ndividual-files

    It's located at 0x1D228 in your .md file. I just played around with it and spotted the colors. So I don't know how you can locate other pictures' palette. Anyway, the CT2's Data-->Palette might help. (There's a palette tab in CT2 where you can view the palette.)

    Here's a tutorial that includes the Data-->Palette function
    https://sites.google.com/site/otomegameguid...als/txr-and-tpl

    Good luck for the project then. [​IMG]
     
  7. Blazer
    OP

    Member Blazer GBAtemp Regular

    Joined:
    Aug 10, 2008
    Messages:
    280
    Country:
    United States
    So I don't have a chance to look at things in depth ATM but from my understanding I have to do something like find the data in a hex editor, convert it to a .pal file, and then import that?

    If so, that's pretty lame, there should just be a feature to load the palette directly from the file at an offset -_- but I suppose it's something I'll have to work around, thanks for the links
     
  8. jjjewel

    Member jjjewel GBAtemp Maniac

    Joined:
    Dec 17, 2009
    Messages:
    1,004
    Country:
    United States
    Did you try FAST's program that he posted? From the screen shot, it might work the way you wanted.

    Anyway, I don't know any better technique to hack graphics other than the manual way. It needs lots of patience and luck. [​IMG]

    You might wait a bit to see if others have any suggestions.
     
  9. Blazer
    OP

    Member Blazer GBAtemp Regular

    Joined:
    Aug 10, 2008
    Messages:
    280
    Country:
    United States
    I think now that CrystalTile2 can actually view the graphics in 8bpp form I should be able to do the FE logo at some point, though this leaves the issue of the other text in the logo which I can't find, though it's also kind of a separate issue

    I just don't understand where it could be. Even if it were like... textual text, like ASCII text, that still doesn't compute, the graphics for the text should be SOMEWHERE in the RAM, but I can't find it.

    I'm missing something obvious again and it's bugging me since it's kind of important. -_-

    Oh and that program he pointed out is nice and works for rips, if only it could insert things the same way, it'd be perfect... alas, it's just an extractor, not an importer (importing is harder anyhow, so I'll just take what I can get...)
     
  10. rastsan

    Member rastsan 8 baller, Death Wizard

    Joined:
    May 28, 2008
    Messages:
    963
    Location:
    toronto
    Country:
    Canada
    Crystaltile2 does load pallete from offset. Just move your cursor to the suspected point in the hex view then do the way jjjewel told you. you can also export import that for later other use. but I think you knew that part.
     
  11. Blazer
    OP

    Member Blazer GBAtemp Regular

    Joined:
    Aug 10, 2008
    Messages:
    280
    Country:
    United States
    Okay, I'll try what you said.

    Anyone have an idea about the other text in the logo while I'm at it? ._.
     
  12. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,711
    Country:
    United Kingdom
    Yeah sorry for not explaining much of anything there or linking things properly.
    nsbmd.exe is kiwi.DS' original nsbmd viewing tool. Random sendspace link I just found for it http://www.sendspace.com/file/8oa4zv
    It falls flat on a lot of things but it is useful to have to hand.

    All the nitroSDK stuff I have ever seen is export plugins for the likes of maya and 3ds Max with a rough overview of what goes in DS 3d rather than anything of great use to hackers (assuming you are not wishing to generate files or reverse engineer the plugins).

    Crystaltile2- we usually keep a working copy up on filetrip http://filetrip.net/f23649-CrystalTile2-2010-09-06.html

    "I was using has a flawed system for viewing 8bpp graphics"
    Not really- most GBA and DS 8bpp stuff was smaller power of 2 tiles and left it at that. This custom tile size and large tile stuff is not new but only recently becoming something that you would not need to raise an eyebrow for.

    Re ignore the palette. Depending on what goes I normally do but it can get tricky playing on the high concept stuff, others already took how to grab a palette from a given position but in the event that does not work out as long as you are sticking with colours can you not just snatch it from the ram (3d images are taken care of in the 3d hardware but they are kicked into background (BG) 2d memory when it comes time to display- http://nocash.emubase.de/gbatek.htm#dsvideo (general video but scroll down a bit for the 3d stuff).


    Re the other text, if you mean the first images you linked up (red background with a blue character) I did not see anything in the files you linked but the second image everything I see there (plus the textures used when animating it) were all available in that md file according to that little texture program. I was just not inclined to fight gimp windows and ultramon last night.

    Also I got bored (the lens flare effect looks quite amusing on that).
    [​IMG]

     
  13. Blazer
    OP

    Member Blazer GBAtemp Regular

    Joined:
    Aug 10, 2008
    Messages:
    280
    Country:
    United States
    ^Wow, that's quite awesome. I suppose that proves I can edit those graphics now. I think I should be able to find a way to get the palette working as well, but in the rare case that I can't, you'll see me back in this thread >_>

    I couldn't find the text below the "Fire Emblem" text (the one that says "Heroes of Light and Shadow" in the tannish box, but in Japanese, of course).

    The text in the first screenshot in the first post also uses .md file format but since I've gotten an understanding of how to view and edit those graphics from the title logo, it shouldn't be a problem applying that knowledge to the text. (Though palettes are going to make this challenging still, I think I can find a workaround to getting it working...)

    I think I covered and responded to everything but there's been so much going through my mind (especially about these graphics) that I might have missed something... XP
     

Share This Page