I need help in the tools i need to be able to translate an n64 game

Started by amback, December 28, 2015, 08:01:01 AM

Previous topic - Next topic

amback

hello everyone am in a journey of translating a game called "SD Hiryu No Ken Densetsu"/ the sequel to n64 game flying dragon which was only release in japan. and need help with the tools required to extract the ROM informations and hopefully be able to modified it and patch it.

my end goal is to translate the entire game text minus the audio, i loved the first game so that's part of the reason why i want to be able to translate this game into English/Spanish

any help would be appreciated thank you.

FAST6191

Do you mean you want something like http://www.romhacking.net/utilities/296/ but for this game or do you mean you just want some general tools for hacking, albeit ones that work with the quirks of the N64, and some N64 specific tools?

For the former that is actually a big ask, for the latter then I guess I/we/someone can help you put together a basic toolkit. N64 text is not that different to other consoles though so things you have there will likely carry over to here. Not sure what the kids are using as a N64 debugger these days (project64 and mupen64plus (the one used in retroarch) are the emulators of choice it seems, debuggers seem to come and go from them and get added back in all sorts of custom versions) and I think we are suggesting http://www.romhacking.net/forum/index.php/topic,18868.0 for an assembler these days.

Would you view yourself as more of a translator then?

amback

Quote from: FAST6191 on December 28, 2015, 10:59:02 AM
Do you mean you want something like http://www.romhacking.net/utilities/296/ but for this game or do you mean you just want some general tools for hacking, albeit ones that work with the quirks of the N64, and some N64 specific tools?

For the former that is actually a big ask, for the latter then I guess I/we/someone can help you put together a basic toolkit. N64 text is not that different to other consoles though so things you have there will likely carry over to here. Not sure what the kids are using as a N64 debugger these days (project64 and mupen64plus (the one used in retroarch) are the emulators of choice it seems, debuggers seem to come and go from them and get added back in all sorts of custom versions) and I think we are suggesting http://www.romhacking.net/forum/index.php/topic,18868.0 for an assembler these days.

Would you view yourself as more of a translator then?

Yes i would view myself more as a translator although i have some moderate knowledge when it comes to python programming. Anyways thank you for linking me to the tool, to my understanding some games are encrypted. can this be used regardedless? Am refering to the assembler

Zoinkity

http://pastebin.com/V7Ffq6p9
Filetable for the game; files labeled "nindec" use a type of compression found in all of Culture Brain's N64 titles.  The decompression algo works like so:

def decompressCB(data):
    out = bytearray()
    out_sz = int.from_bytes(data[0:4], 'little')
    src = iter(data[4:])
    cmd = 0x10000

    while len(out)<out_sz:
        if cmd>0xFFFF:
            cmd = 0x100 | next(src)
        if cmd & 0x80:
            p = next(src)
            if p&0x80:
                l = (p>>4)&7
                l+=1
                p<<=8
                p|= next(src)
                p&=0xFFF
            else:
                l = 2
            p+=1
            for i in range(l):
                out.append(out[-p])
        else:
            out.append(next(src))
        cmd<<=1
    # Amusingly, they overshoot sizes and cut at the final size.
    # Simply allowing the decompression and resizing should be okay though.
    return bytes(out[:out_sz])

Dont' have a compressor handy but this is pretty simple LZ; it shouldn't be terribly difficult to do yourself.

Seriously hope you don't need to move anything around, because if you do it will present a bit of a nightmare tracking all the instances in both the tables and ASM.

Non-graphical text appears to use a sort of scripting, not unlike Super Robot Taisen 64.  Pain in the butt; usually N64 games are nice enough to use a standard codepage like shiftJIS or EUC JP but a couple companies were obnoxious and simply put chars in the order they appeared in the font. 

As far as debuggers there's Nemu64 and MAME.  Nemu isn't as accurate as MAME is but runs much, much faster and has a more intuitive UI for the debugger.  For most basic usage Nemu + glide64 should be more than sufficient.
To debug with MAME you'll need to use the command line to start the game:
mame n64 -debug -cart [filename]
It starts paused; there should be a reference someplace on how to use it.  My PC is unable to run MAME so can't offer much help.
Just fair warning there is no 100% accurate emulator. 

Most complete checksum calculator is implemented here:
http://www.mediafire.com/view/wwy88kc9h1d8dew/N64.py
-though since the game is a 6102 title any checksum calculator can be used.  If you change anything falling between 0x1000 and 0x101000 you will need to recalculate the checksum.

For some background on the system:
http://n64dev.org/
In particular, the CPU manual has a complete opcode and COP0/COP1 register reference.