game wars advance 1+2 question

Discussion in 'GBA - Game Development, ROM Hacks and Translations' started by Gilberd, May 23, 2011.

May 23, 2011
  1. Gilberd
    OP

    Member Gilberd GBAtemp Regular

    Joined:
    Jan 29, 2010
    Messages:
    157
    Country:
    Taiwan
    is there a way to take the data from gbwa and gbwa2 and make them into seperate roms?
    OR
    is there a way to make a code to auto boot gbwa 1 or 2 when the game starts without going through the title select screen?
     
  2. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,743
    Country:
    United Kingdom
    Splitting a rom- I have not looked at it in a while but probably not very effectively-
    GBA carts are visible directly in memory* and it probably was compiled with the memory values hardcoded all over the place- best case scenario the first rom in the cart (I am not sure what that would be) could be made standalone and if you wanted you probably could blank out the first with 00's and leave the second.
    This also of course assumes they have no shared assets in which case all bets are off.

    *if you are having trouble conceptualising it think what happens to page values when you paste one book following another. You might be able to do some form of automated replacement but it is still a lot of effort.

    When the games actually exist as standalone entities and the whole 1+2 thing is only 128Mbit it sounds like a lot of effort for no gain- if you want it for the GBA linking function I do not think it does anything they can not do by themselves and even then in this case you just need the header visible (Advance wars DS does not do anything with saves or the actual rom as far as I know).

    As for autoboot that is likely to be decidedly easier- the selection screen is probably just a jump to the rom in memory so find the jump destination(s) and hook in whenever you can.
    For instance if say gameboy wars advance 2 was started by a jump to 08400000 you would look through the menu code and jump to 08400000 at the first available opportunity

    I am not sure what level of initialisation will happen at the menu and then again at the actual game (have a read of http://gbatemp.net/index.php?showtopic=39979&hl= as it has an example of how GBA roms boot up) or if the rom will effectively soft reboot (set new stack pointers and what have you effectively ignoring the menu ever existed) or indeed if something more complex (memory cleared, a switch to THUMB mode or ARM mode if originally in THUMB) but that is probably getting ahead of myself and if it is complex all you need to do then is find the menu routine that happens when it does and jump to that instead rather than letting a button press trigger it.

    It is not that hard a hack but I will ask why the effort when the roms exist as standalone roms (not to mention most hacks, although I have not seen many for the Japanese region ones, exist for the standalone games).
    Along with that link from a paragraph or two above http://www.romhacking.net/docs/361/ should cover more or less what goes.
     
  3. Gilberd
    OP

    Member Gilberd GBAtemp Regular

    Joined:
    Jan 29, 2010
    Messages:
    157
    Country:
    Taiwan
    i just want to do the splitting because i play my gba games on my ds using the 3in1 pack
    so 16MB games start up much slower
    unlike vba where all games start up immediately

    also i don't need to set new stack pointers since when you load one of the wars games
    soft reset resets back to the title of the game you are playing not the selection screen
     
  4. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,743
    Country:
    United Kingdom
    Ah sorry for some reason I thought there were Japanese releases of the single games not just the double pack.

    Good news that you do not have to do proper initialisation but the latter rom whichever it ends up being will still have all the pointers shifted to another part of the rom (assuming it holds from US sizes AW1 was 32Mbit and AW2 was 64Mbit).

    Guess you will have to find a way to use the NOR if boot times bother you.
     
  5. Gilberd
    OP

    Member Gilberd GBAtemp Regular

    Joined:
    Jan 29, 2010
    Messages:
    157
    Country:
    Taiwan
    what tools would i have to use to auto boot
    and could you give me some steps?
    also maybe some steps on the roms splitting thing still want to give it a shot
     
  6. FAST6191

    Reporter FAST6191 Techromancer

    pip
    Joined:
    Nov 21, 2005
    Messages:
    21,743
    Country:
    United Kingdom
    http://gbatemp.net/index.php?showtopic=39979&hl= has some on the boot procedure of the GBA although that is not quite what is happening here for the endgame although you will still need to know it for this.
    You would then have to watch what happens as you select a game- I imagine it would just involve clearing the memory and jumping to the game of your choosing. What you then get to do is find a suitable point after the initialisation of the menu (you could wait until you got to the menu if you liked but I would look for earlier myself) and then replicate the launch or jump to the launch routine.

    I did however just try it- reset might be one thing but pressing back on the menu eventually brings me right back to the press start screen (prior even to the selection box) at least for the second game which might complicate things in as much as it might not like it if you hacked the menu in some way but cross that bridge when you come to it although I suppose normal use will not come to that.
    At the same time I had a very cursory scan of the memory to see if something changed when I hovered over a different selection but if it was there I missed it and equally I am not inclined to blindly speculate on how the devs might have done for this.

    Still how I would have done it/what I have seen and speculation based on it

    Initialise rom as per usual
    Launch into menu code
    [press start] (not what I would have done but it is there)
    Secondary selection menu- idle here (scrolling text and audio in this case)
    On key press of up or down move to the corresponding menu (it looks like it holds rather than scrolling back around as well) (this means some OAM stuff and other boring things but should mean a value somewhere else is changed (I doubt they would have hooked into the OAM)- you probably want to find this although you might be able to get away with it.
    On key press of A or possibly start (I did not check this) check currently selected value (presumably against the mystery value I mentioned above) and jump (branch) to either load routine or the game itself. The fact I could go back possibly throws a wrench in proceedings (or at least my reset and load hypothesis) or it might just be that it is true example of what C code is usually about (a whole series of routines branching at will).

    Tools for the job

    VBA-SDL-h or another high end debugger ( Boycot Advance or NO$GBA debug version being the main two other than this). You could do this straight in a disassembly but why make things difficult. http://www.romhacking.net/docs/361/ is a nice guide and the docs of VBA-sdl-h http://labmaster.bios.net.nz/vba-sdl-h/
    I imagine this will boil down to but one or two instructions in a destructive capacity (overwriting existing code) which I would consider encoding by hand ( http://nocash.emubase.de/gbatek.htm#thumbinstructionsummary has encodings for THUMB and ARM elsewhere on the page). Still an assembler will be nice if your disassembly tool does not hold up.


    Splitting roms- if it is how I imagine it the rom is something like the following

    rom
    Header as per usual GBA roms
    Micro menu
    Full GBA rom A) (or near enough)
    Full GBA rom B) (or near enough)
    Usual padding to "power of 2" Mbit size.

    There might have been shared data but I doubt the devs would have bothered as it would not have made much difference to the size. Looking at what I found out above if they have interleaved it (kicked all audio for both games into one block or something) I would give up as it it too much hassle beyond maybe shaving a few extra kilobytes off is the secondary game's data is at the end of the rom.

    Assuming it is not interleaved you should then be able to blank out and ultimately trim the secondary rom whatever it ends up being without too much trouble. You could blank the first as well but it would be kind of pointless unless you programmed your expansion pack loader to skip 00's and jump to anther section or something.
    The reason you can not just shift the secondary rom forwards is because a lot of things point to a certain place in the rom itself (which as mentioned is viewable entirely in memory) rather than the memory (thinking systems where the code loads entirely into memory) or kicking it to a read command/list loaded at the start of the game like the DS and most other file system based things (the exception here being things like some PS2 games with LBA reads rather than normal file system stuff ostensibly as a small measure of protection).
    There are three addresses for the GBA rom and while you probably could do an automated change of most of them and maybe even DMA transfers you also get to deal with compression (easy enough) or obfuscation (not so easy but still workable) as well as hoping the devs did not do something like generate an address with a command the results of which are not obvious unless you run the game (see the halting problem or maybe some of the stuff done in cheats where values are held on a stack or located by pointers as it is a similar logic).
    Basically you are up against the GBA memory layout (a feature hackers but love and have immense frustration caused by)- it makes it nice to hack in as much as you are rarely more than two steps (usually just one) from a location in the rom for the data you want but at the same time almost guarantees you get to fiddle with pointers with formats that are either bare metal type formats or wound tight into the GBA rom.
     
  7. Gilberd
    OP

    Member Gilberd GBAtemp Regular

    Joined:
    Jan 29, 2010
    Messages:
    157
    Country:
    Taiwan
    thanks for taking the time to write all these explanations
     

Share This Page