1. FAST6191

    FAST6191 Techromancer
    Reporter

    Joined:
    Nov 21, 2005
    Messages:
    31,719
    Country:
    United Kingdom
    no$gba is the suggested one at this point in time. vba-sdl-h is still workable and gets things done but no$gba has always been good.

    That is why you have breakpoints.
    Watch a jump a few times to see what happens to the audio registers/channels. Hopefully there is something unique to latch onto there (maybe it uses a channel the baseline music does not), but if not then hopefully the music playing will be obvious and you can press return to the game until the next music fiddling.


    You can set it to respond to the key press as well*. I presume various things will happen as a result of the key press but an audio sting is one of them.
    Most code is then going to be described as functions that it does a bunch of them in succession. Ignore the ones fiddling with graphics (they will typically start and end with a branch so you can hopefully scan quickly) and other non audio stuff in favour of whatever the stuff touching the audio is (anything between 4000060h and 40000A6h, indeed you might even add a breakpoint there after it pauses for the button thing (if you do it normally then you will probably be stopping all the time for the background music, though that might still do samples at some level).

    *the keys are located http://problemkaputt.de/gbatek.htm#gbakeypadinput though some games will copy that state every frame and operate from that (switches are not magically on and off and when you press they can vary from one millisecond to the next, copying and using that eliminates this issue. If you have ever had a computer mouse start to die and double click all the time when you only single clicked then much the same mechanism/failure mode). Easy enough to find where it is copied to and do the same thing again.
     
  2. biolizardshadow

    OP biolizardshadow Advanced Member
    Newcomer

    Joined:
    May 4, 2020
    Messages:
    59
    Country:
    United States
    What about the bytes that look like offsets. Now I'm not sure if this is related to sound but when the title screen theme plays the CPU reads from offset 03000000 and when the music ends it unloads that from ram and just reads directly from the rom. Do the arrows represent directions on the D-Pad I see them fairly often and this whole not being able to read the data in real time with the emulation is really annoying so how do you set it up so it will set a break point whenever you press a certain button?


    When I press a button should I be looking at what the registers are doing or should I look toward the left of the screen where all of the action is. Looking at the I/O map doesn't help since the sound section just shows channels 1 through 4 and the DMA section is moving so fast I can't see what's being loaded or what's even going on.
     
    Last edited by biolizardshadow, Sep 18, 2020
  3. FAST6191

    FAST6191 Techromancer
    Reporter

    Joined:
    Nov 21, 2005
    Messages:
    31,719
    Country:
    United Kingdom
    Joy it is one of those... I had hoped we might be spared that for now. Oh well not the end of the world.

    The GBA features a small 32 KBytes section at the 03000000 range that can be used by the game.
    http://problemkaputt.de/gbatek.htm#gbamemorymap
    It is a super fast section of RAM that some games will copy a small bit of code to first and operate from to get a small speed boost in certain types of memory operation.
    For the purposes of tracing files it is then an extra step to handle (still the same idea though, no great difference to something needing to be decompressed first) but it is all still the same instructions, same memory layout and all the rest.

    Buttons wise.
    http://problemkaputt.de/gbatek.htm#gbakeypadinput
    Start with whatever reads 4000130h (break on read for that, though might want to set it when you are getting ready to go).
    It might be one of those games that debounces it (copies it) to normal memory once a frame but that will soon become apparent. If it does then repeat it for the debounced section.
    From here you can press your jump button or whatever and you will then find something reads it, checks to see if it is pressed (might instead be an interrupt as checking every frame is pointless and devs on systems far older than the GBA realised having a "wake me up when this happens" is better than checking all the time).

    At this point you are back to what I covered before as you figure out what from the newly called routine ultimately twiddles with the music.

    If breakpoints popping up every frame is tedious (if it happens from the start of the game, if you are in the game and idling whilst looking for a button to press then deal with it).

    Alternatively a jump will presumably change either the camera (usually a BG location) or the location of a sprite on screen (the object area memory aka OAM being responsible for that -- set it to real time update and jump to see what changes). Whatever twiddles the OAM will either go on to fiddle with the audio section or already fiddled with the audio section so work forwards or backwards from there (when a breakpoint happens it will tell you the last however many instructions that happened leading up to that, go back to that and repeat until you get somewhere good).
     
  4. biolizardshadow

    OP biolizardshadow Advanced Member
    Newcomer

    Joined:
    May 4, 2020
    Messages:
    59
    Country:
    United States
    How do you define a breakpoint condition? I would like to be able to have it stop when I press the jump button but I'm not sure how to tell it that.
     
  5. FAST6191

    FAST6191 Techromancer
    Reporter

    Joined:
    Nov 21, 2005
    Messages:
    31,719
    Country:
    United Kingdom
    I would still say it is not ideal to go from a key press, even if you imagine it might do you well (it could still be several instructions later before anything particularly gets done) and you don't have the game playing debounce. Better to find something that happens as a result that is easily visible in memory and readily reproduced (best if it is happens every time but reliably is good enough) and follow it forwards or backwards to get to the part that deals with your point of interest.

    Still
    http://problemkaputt.de/gbahlp.htm covers usage of the debugger.
    The 4000130h range includes keys. In this case bit 0 corresponds to the A key, not sure what the unused bits will be offhand but masks will probably be the order of the day rather than exact to account for different directions or multiple buttons being held. If it happens that it is debounced then you will have it one step removed and still be the same idea. The game's code itself, regardless of whether it debounces, will likely be a mask type deal (presumably some boolean followed by a compare) as defining IF conditions for every button combo is a nightmare and waste of resources, and not being able to do multiple things at once... most devs probably learned that lesson 30 years before the GBA was a twinkle in Nintendo's eye.
     
  6. biolizardshadow

    OP biolizardshadow Advanced Member
    Newcomer

    Joined:
    May 4, 2020
    Messages:
    59
    Country:
    United States
    Is their a limit to how many samples the GBA can play before things like slow down occur?
     
  7. FAST6191

    FAST6191 Techromancer
    Reporter

    Joined:
    Nov 21, 2005
    Messages:
    31,719
    Country:
    United Kingdom
    I don't know if anybody has really considered such a thing or has likely brushed up against a limit here, or done like I see some NES stuff do and start to lean heavily on the CPU to expand abilities. Closest I have is on the DS then Castlevania Portrait of Ruin was badly coded so knocking out its music stopped crashes on slower flash carts but the DS is a rather different beast to the GBA in both the audio hardware and getting stuff onto the cart (the DS slot is in many ways slower than the GBA slot, one of the reasons we never saw a good GBA emulator for it using the DS hardware).
    There are games where more sprites on screen sees slowdown of a sort but audio stuff is usually fairly separate.
    To that end I imagine it is going to depend more upon the game in question, what else it is doing (if the DMA is tasked with grabbing all the samples all the time then there will be no DMA for grabbing graphics, and if the devs also didn't do priorities or messed them up then something fun might happen) and what CPU driven post processing might also be going on (likely minimal and most of what is there is more pointing it at the next note or telling things to turn on or off).
     
  8. biolizardshadow

    OP biolizardshadow Advanced Member
    Newcomer

    Joined:
    May 4, 2020
    Messages:
    59
    Country:
    United States
    Do you know what commands are sound related? It's hard to tell what all of the instructions are doing.
     
  9. FAST6191

    FAST6191 Techromancer
    Reporter

    Joined:
    Nov 21, 2005
    Messages:
    31,719
    Country:
    United Kingdom
    I would usually go by destination and then look at what is used to get the command ready to go there, or that have commands that reach out and touch them.
    You then have a list of all (or more likely the specific ones you care about) which you watch for.

    http://problemkaputt.de/gbatek.htm#gbasoundcontroller then having such a list.

    You can set a range with breakpoints and most of the sound stuff is one after the other so should not take too many separate ones.
     
  10. biolizardshadow

    OP biolizardshadow Advanced Member
    Newcomer

    Joined:
    May 4, 2020
    Messages:
    59
    Country:
    United States
    It looks like sound controller stuff ends with a 04 since all of the sounds are mapped to that memory address, but I've never seen it go to that area of ram before (or maybe I'm not fast enough when it comes to clicking off of the main emulator window to pause the emulation)

    It also mentions that wave channel ram has been doubled but I haven't noticed any change in how long the wave channel waveforms can be?
     
    Last edited by biolizardshadow, Sep 24, 2020
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - samples, limit,