Sigma Harmonics Questions (technical, I guess)

Discussion in 'NDS - ROM Hacking and Translations' started by AshenPhoenix, Mar 25, 2009.

  1. AshenPhoenix

    Newcomer AshenPhoenix Member

    Mar 14, 2009

    I've been looking at various games to get to know the different formats and methods used to get what you want from them, and I've been looking at Sigma Harmonics now but I have some questions to people who know more about these things then I do.

    First some info about the layout of the rom:

    The only file of particular interest is the data.cpk file, which is one of Cri Middlewares formats, a compressed filesystem.

    Inside the data.cpk there is ADX files for music, AHX files for voices, NFTR for fonts, RGCN for textures/tiles or what you want to call them, RLCN for palettes and RCSN for maps (NCGR, RLCN, but they are backwards [​IMG] NSRC no idea, not read about it yet. Most magic stamps are jumbled like that, anyone know what it means?) (tile/palette/map seem to be numbered in order, so ex. Id081234.RGCN has id081235.RLCN as palette and id081236.RCSN as map, not 100% sure though).

    Text files doesn't have a magic stamp that I've noticed, but they seem to be quite straight forward starting with a pointer table then after the table there's only text until the end of the file.
    The Text is using UTF-8 encoding (Codepage 65001 for CrystalTile2 users)

    Several 0 size files, no idea what they are for.

    EDIT2: Been looking at the files and how they are organized, here's a list of what I've found, not 100% accurate though since I've skimmed through most of it.

    ~191-346 Credits
    ~350-1133 Text Tiles
    ~1136-2131 Story Tiles (2087 Game Over)
    ~2132-3397 Mix of Text Tiles and Story Tiles
    ~3398-3958 Mix of unknown and 0 size files
    ~3359-4794 Script files. About as many .sigma files as there is script files, guessing the sigma files are pointers. A couple of 0 size files. Some script files only contain one word or sentence.
    ~4795-6827 .eff files. Well, no idea what they are but they all have "eff" in the top. May be animation files? eff = effect
    ~6828-8365 ADX and AHX files.
    ~8366-8389 Text Tiles.
    ~rest is some random story/text

    EDIT1: Forgot to mention that all files are extracted without any file extensions, but most files have their magic stamp (except text files as stated above and the AHX files have AHXE written at the bottom of their files but nothing at the top).

    Here's a screenshot of the text:
    EDIT: Compressed a bit more to save space.


    Now to my question. Although I've managed to find tiles which I know are in-game tiles I can't get them to line up properly so was hoping someone who knows this stuff could give me a pointer.
    Here's an example of how I can get it to look:

    EDIT: Screenshot deleted to not swamp the thread with img links. Problem semi solved anyways, still can't load the palette files.

    The last line in each "grid" is wrong and I don't know how to get it to line up with the rest. I've tried all kinds of widths and heights and offsets (slight exageration xD)

    EDIT: Forgot to mention that I have no idea how to load the palettes for a tile. The above is just a custom palette and not the real one for that tile. I was thinking that maybe I could give the files their proper file extensions, put them back in the data folder unpackaged and then have CrystalTile2 handle open them for me, but that's not really a satisfactory solution. (yes, I know the game wouldn't run, it would just be to get crystaltile2's nds filebrowser to kick in)

    Another question is how it usually works with games that have all their files in a compressed package, does changing something and then adding it back into the package break the game? Would it be possible to put it back in a cpk package but without any compression and turn of the decompress in the arm9?

    Sure I have more questions but this is enough for now. Thanks in advance.
  2. psycoblaster

    Member psycoblaster Divine

    Jan 26, 2008
    Seoul.. (in Korea)
    Korea, South
    try using crystaltile.
    you can press ctrl and the arrow keys (I think) to shift a single byte at a time.
  3. AshenPhoenix

    Newcomer AshenPhoenix Member

    Mar 14, 2009
    Control+shift Up allowed me to line them up properly, had only been trying ctrl OR shift +right or left
  4. AshenPhoenix

    Newcomer AshenPhoenix Member

    Mar 14, 2009
    I've managed to unpack it, change a menu graphic and then repack it and get it to run. Guess I kind of cheated though but the proper solution is way beyond me (turning off decompiling in the arm9).

    Here's a crappy pic of a crappy "hack" running in no$gba (I know DeSmuME can rotate the screen, but couldn't find that option in nocash):


    It's the smiley on the top screen. Erased some text as well.. xD
    I just took the first tile I could find that I knew I could get to early in the game and did something quick to see if I could get it to run.

    The cheat was using the Chinese translations arm9.bin, since they've already turned of decompression. Credits to Joyce and Pluto (Chinese rom hackers) The rest was just trial and error with CPK packing.

    Here's a bit of info about the CPK header, which basically just tells you what settings was used at packaging as well as give sizes, not even near complete or 100% accurate but maybe someone will find it useful. I'm sure there's some detailed description of it somewhere but couldn't find it [​IMG]

    0h Stamp 'CPK'
    4h Mask On/Off 00/FF
    10h Encoding. (Can choose SJIS, EUC, UTF-8)
    b4+c4+cch Different sizes, My guess is, in order, Compressed Size, Original Size, and last one not sure but may be with addition of CPK headers or something?
    d8+d9 Align amount. The align amount used when packing. Not sure what it does but since the size of the package get's smaller as you lower this value I guess it's some sort of padding between files?
    Sigma Harmonics needs to be packed with a 512 align value. Tried a bunch of other settings but the game could only be run when packed with 512. 02 00 = 512 , 00 01 = 1

    Anyways, kind of turning this into a diary kind of thread of my first romhacking attempt [​IMG]

    Next step is trying to change some script text. Just need to find some that's in the beginning of the game. Curious how one would go about doing it. The text goes downwards from right to left. I don't mind reading it that way though but I wonder if it would be possible to get it to display downwards from left to right.

    EDIT: Well, other than the fact that I haven't been able to locate the file with the script from the beginning of the game, I do have some additional things I wonder about.
    Been trying to find info elsewhere but information is in little bits and pieces all over the place, gets a bit difficult to puzzle it all together [​IMG]

    Some questions:

    Text Encoding
    Each char seems to be 3 bytes each, I'm guessing this is a quirk of it being unicode? Is it somehow possible to get the game to use ascii instead so one could fit more text when replacing the japanese with whatever language you would translate into? Of course I realize that the size of the windows is as it is, but having 1 of our letters correspond to the same size of 1 kanji would mean it would be impossible to fit any translation, while fitting 3 characters for each kana/kanji would give more room for translation.

    Font Mayhem
    There is 32 (atleast) font files for this game. Somehow a character must be mapped to a font and I'm curious where this mapping would be usually. (most font files are really small and only include a few letters/numbers)
    If I knew where this "mapping" of characters occured could I then edit the main font file to include A-Z a-z and map them to 1 byte values? (this question seems to tie in with the one above [​IMG] )

    A few scenes has voices without any text /usually nothing important though) and since I'm only looking at this for the experience I'm curious if it would be possible to add subtitles to these sequences. Maybe with some assembly code that hooks into the framebuffer (I think that's the right term here ^^) and inserts texts when X sound file is played or X tile is loaded or something like that?
    No sooner had I posted it than I read what I had written and realized the obvious solution. Put the subtitle graphically on the tile being viewed [​IMG]

    On second thought I think it would be overkill [​IMG] First idea seems too advanced for a small thing, and the second idea has a lot of holes (tiles may be reused and more)

    Well, I don't post much new posts in here but I'm updating my posts now and then, so if there's anything interesting to read here come back and check even if there's no new posts. Would have been more fun with some technical advice/pointers though, at the moment it's just me bouncing my own thoughts against myself [​IMG]

Share This Page