News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: [GBA] Kirby & The Amazing Mirror - Cannot find timers?  (Read 2655 times)

PRIZZA

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
    • Aeon Rivals
[GBA] Kirby & The Amazing Mirror - Cannot find timers?
« on: January 13, 2014, 05:40:22 pm »
Howdy,

I've been messing with ASM hacking Kirby & The Amazing Mirror (U) and have been having a hell of a time finding any values related to timers. Granted I'm new to hacking GBA games but I've been finding other values easily.

For example, the "Bomb" ability lets you pull out bombs to throw at enemies. When you pull a bomb out, a timer starts and if you don't throw the bomb fast enough it explodes in your hands and injures you. I CANNOT find the timer for a bomb that is pulled out.

I try taking a bomb out and searching for values that decrease, values that increase, etc... and just can't locate the correct address. I've tired searching 8bit, 16bit, and even 32bits searches for values and nothing.

If you want to try using the Bomb ability, change address 02020fe3 (Kirby's ability) to hex 09.

Thanks to anyone that can point me in the right direction.


FAST6191

  • Hero Member
  • *****
  • Posts: 2623
    • View Profile
Re: [GBA] Kirby & The Amazing Mirror - Cannot find timers?
« Reply #1 on: January 13, 2014, 06:27:28 pm »
I lack the time to go through the game properly right now but are you sure the value does not live in a register or the stack? I have seen far more long lived variables be stored in such places on other games, a cursory scan did not reveal anything here but it could still be the case..

Also when you say "searches for values" it sounds like you mean you have done "anything that decreases" and "anything that increases" type searches rather than hard numbers (in VBA this would be an old value search rather than a specific value search)

PRIZZA

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
    • Aeon Rivals
Re: [GBA] Kirby & The Amazing Mirror - Cannot find timers?
« Reply #2 on: January 13, 2014, 06:45:06 pm »
I am not entirely sure about if the registers or the stack stores the number. How would I go about figuring out that sort of thing?

And yes, I have been searching increasing a decreasing values rather than hard numbers only because I have no clue as to what the value could be. Is there a way to guess as to what the value could be so that I can find the address?

Thanks by the way!

Jorpho

  • Hero Member
  • *****
  • Posts: 4194
  • The cat screams with the voice of a man.
    • View Profile
Re: [GBA] Kirby & The Amazing Mirror - Cannot find timers?
« Reply #3 on: January 14, 2014, 01:22:27 am »
Advance the emulator frame-by-frame (it can do that, right?) and count the number of frames it takes for the bomb to explode?
This signature is an illusion and is a trap devised by Satan. Go ahead dauntlessly! Make rapid progres!

PRIZZA

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
    • Aeon Rivals
Re: [GBA] Kirby & The Amazing Mirror - Cannot find timers?
« Reply #4 on: January 14, 2014, 02:21:11 am »
As far as I can tell, I don't think I can do frame by frame with either debugging emulator. :(

FAST6191

  • Hero Member
  • *****
  • Posts: 2623
    • View Profile
Re: [GBA] Kirby & The Amazing Mirror - Cannot find timers?
« Reply #5 on: January 14, 2014, 07:31:49 am »
When it comes to timers unless you have an exact value displayed on the screen then it tends to be better if you go fuzzier to find it in the first place. Even if there is a number on the screen it is common enough for it to be entirely different to the number that actually governs the timer, or more fun is when the timer value that governs the text on the screen is derived from some other number somewhere else. http://www.coranac.com/tonc/text/timers.htm has some good stuff. If you are still getting to grips with the assembly I like http://www.coranac.com/tonc/text/asm.htm

Frame by frame advancement is possible, I am not aware of any easy modes/commands to do it in VBA-SDL-h, Boycott Advance or no$gba like might be in some other emulators but it should only be slightly abstract (the idea of a frame in the GBA's world can is not quite as simple as some older systems when viewed from an interrupt/code perspective http://www.coranac.com/tonc/text/video.htm#sec-blanks ). For most purposes it would otherwise be known as advance to next vblank which is good as the timer is in all probability calculated/modified during it, here you might want to tap the DISPSTAT register ( http://nocash.emubase.de/gbatek.htm#lcdiointerruptsandstatus ).

Alternatively you can execute the next so many instructions (the full VDraw+Vblank cycle is not as huge a number as it might me when we play in the gigahertz world).