• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Development: Gen V TM routine in Gen III games

30
Posts
18
Years
  • Seen May 26, 2022
Gen 5 TM routine in Gen 3 games

As anyone who's played Black/White knows, TMs now act like HMs in that they are now infinite use. I was wondering if such is possible in the Gen III games. Because the items use a routine that defines how many to remove after consumption, the amount must be defined somewhere in the ROM for the TMs. Anyone have any ideas about this?

EDIT: In Fire Red, after disassembling the routine at 809a1f8, it seems that the value of 1 is subtracted from the item amount in r0. Changing this to 0 will cause the TM to not be consumed, but it will do the same for all items as well. Perhaps if the routine were copied and modified as I described, or if a similar routine that is used by the HMs were called in the TM routine, we could generate TMs that act like they do in Gen 5? The only issue I'm having is trying to find the TM/HM routine used by the game.
 
Last edited:

looper

German Hacker
53
Posts
13
Years
Can't we just change a TM to a HM? Or is there any difference between TMs and HMs, except that your loose TMs?
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
I've actually achieved this on the 649 Patch. The only discernable difference between TMs and HMs is built into the code. It reads the item ID and any item ID above a certain value is treated as a HM. How I did it was that I simply removed this check and made it always use the HM routine.

Sadly, I don't have anything noted down, so I can't help there, but it's not exactly that difficult to achieve once you find the relevant checks. :) Good Luck!
 

sonic1

ASM is my life now...
77
Posts
15
Years
EDIT: In Fire Red, after disassembling the routine at 809a1f8, it seems that the value of 1 is subtracted from the item amount in r0. Changing this to 0 will cause the TM to not be consumed, but it will do the same for all items as well...

Well, to put it blunt, item index is passed through r4. Make a branch at that offset you mentioned and check if r4 is between tm01 and tm50 item values:
Code:
0x121≤[B]r4[/B]≤0x152
If yes, then don't subtract anything. If not, subtract 1 like normal items.

~Sonic1
 
30
Posts
18
Years
  • Seen May 26, 2022
I've actually achieved this on the 649 Patch. The only discernable difference between TMs and HMs is built into the code. It reads the item ID and any item ID above a certain value is treated as a HM. How I did it was that I simply removed this check and made it always use the HM routine.

Sadly, I don't have anything noted down, so I can't help there, but it's not exactly that difficult to achieve once you find the relevant checks. :) Good Luck!

Based on what you said, I tried to swap to item IDs for HM 1 (Cut) and TM 50 (Overheat) just to see if it worked. It didn't.

However, I then looked at the disassembled code. For 809a1f1 there was some byteshifting involved. Changing the value (from 0x18 to 0x14) seemed to do the trick at first; the TMs were acting like the HMs, and the other use items were being consumed on use. The only drawback to this was that this would also affect the items in the Balls pocket (essentially giving infinite Masterballs if one had it).

Sorry for sounding noobish, I only started looking into ASM hacking. Also I did notice a routine at 0809a202 (specifically, add r0, r0, r1) which seems to add the contents on r1 into r0. If I'm reading the routine correctly, there was a previous check at 0809a1f8 which subtracts 1 from register r0 (which is whats defining how many items to consume). There are a few calls there in between which become confusing to me (such as the ldr instruction at 0809a1fe).

Also, though unrelated, there also seems to be a check against the item ID against a value 0x176 (which appears to be the maximum item index) and setting this value any lower will cause any item with an ID over that value to become unknown items (name changes to ??????????). I thought this was the value I was looking for at first until I realized that HMs started at ID of 0x153.
 
Back
Top