• 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: [FR] Better TM/HM expansion

BZL

Japanese Rom Hacker
5
Posts
5
Years
TM/HM Expansion

I'm a Japanese hacker. Because English is very bad, so it may be difficult to read sentences.

Last update: 30/9/2019
When I ported the code from BPRJ, deleted TM check by mistake, so I corrected it.



There are several threads and posts related to the TM/HM expansion in this forum, but there are some flaws and it will not behave exactly like the vanilla FR's TM. (Disk image and animation of TM after 51st are wrong)
In addition, as a specification from vanilla FR, the item ID used for TM/HM had to be continuous.

So, I changed the TM/HM related routines considerably, I worked like a vanilla FR and created an expanded TM/HM that can freely assign item IDs.
Because many routines have changed, code cant be written directly to threads because of readability issues, but the source code is included in the attachment.

cDZzxpL.png


This thread explains how to expand TM/HM using the attached patch.
I'm quoting part of the thread of ghoulslash's.


Step 1 : Patch "TM.ips" to Fire Red

Download the attached file, decompress it, patch the included "TM.ips" to Fire Red.
This patch doesn't use free space.


Step 2 : Create a table for linking the TM/HM index and item ID

Please create a table in free space, Put the pointer at 0x114100.
The attached "Table_example.bin" is the same setting as that of vanilla FR.

Table structure
Code:
[TM and HM threshold (2bytes)][Item ID (2bytes)] ~ [Item ID (2bytes)] FF FF

Table example
Code:
32 00 21 01 22 01 23 01 24 01 25 01 26 01 27 01
28 01 29 01 2A 01 2B 01 2C 01 2D 01 2E 01 2F 01
30 01 31 01 32 01 33 01 34 01 35 01 36 01 37 01
38 01 39 01 3A 01 3B 01 3C 01 3D 01 3E 01 3F 01
40 01 41 01 42 01 43 01 44 01 45 01 46 01 47 01
48 01 49 01 4A 01 4B 01 4C 01 4D 01 4E 01 4F 01
50 01 51 01 52 01 53 01 54 01 55 01 56 01 57 01
58 01 59 01 5A 01 FF FF


Step 3 : TM/HM compatibility and move table

For expanded TM, the new comparability requires 0x10 bytes per entry.
Please create a new comparability table in free space of (Pokemon number * 0x10) bytes.

You also need to extend the move ID table.(In vanilla FR, the table is at 0x45a80c.)
Create a table in free space of (Total number of TM/HM * 2) bytes.


Step 4 : Bag expansion

If you are already expanding the bag, this step is not necessary.

Assemble this code and insert it into 0x99e44.
Code:
.text
.align 2
.thumb
.thumb_func
.global pocket_size_limiters

.equ freeRAM, 0x0203cXXX
.equ NumMainPocketItems, XX
.equ NumKeyItems, XX
.equ NumPokeballs, XX
.equ NumTMs, XX
.equ NumBerries, XX

Main:
	ldr r1, =0x0203988c
	ldr r0, =freeRAM
	ldr r2, =Numlist+0x08099e44

Loop:
	ldrb r3, [r2]
	cmp r3, #0x0
	beq End
	str r0, [r1]
	strb r3, [r1, #0x4]
	add r1, #0x8
	add r2, #0x1
	lsl r3, #0x2
	add r0, r3
	b Loop
	
End:
	bx lr
	
.ltorg
.align 2

Numlist:
.byte NumMainPocketItems, NumKeyItems, NumPokeballs, NumTMs, NumBerries
.byte 0x00

Rewrite the values of the following addresses.
Code:
0x108420: (NumMainPocketItems + 1) * 8
0x108428: (NumMainPocketItems + 1) * 19


Credits

usigusom - Information related to TM related routines
() - Information related to Bag related routines
 

Attachments

  • TM expansion.zip
    21.3 KB · Views: 54
Last edited:
232
Posts
12
Years
  • Seen Sep 10, 2019
is the table from step 2 only for the new TMs/HMs? Or is it supposed to include the originals also? Where do we put the pointer to the new compatibility table?
 
Last edited:

BZL

Japanese Rom Hacker
5
Posts
5
Years
is the table from step 2 only for the new TMs/HMs? Or is it supposed to include the originals also?

Include the original TM.
This hack does not distinguish between the original TM and the new TM.

Where do we put the pointer to the new compatibility table?

Probably, the compatibility table pointer will be at 0x43c5c.
 
81
Posts
7
Years
  • Age 30
  • Seen yesterday
where did this repoint?

Step 3 : TM/HM compatibility and move table

For expanded TM, the new comparability requires 0x10 bytes per entry.
Please create a new comparability table in free space of (Pokemon number * 0x10) bytes.

You also need to extend the move ID table.(In vanilla FR, the table is at 0x45a80c.)
Create a table in free space of (Total number of TM/HM * 2) bytes.
 

BZL

Japanese Rom Hacker
5
Posts
5
Years
where did this repoint?

Step 3 : TM/HM compatibility and move table

For expanded TM, the new comparability requires 0x10 bytes per entry.
Please create a new comparability table in free space of (Pokemon number * 0x10) bytes.

You also need to extend the move ID table.(In vanilla FR, the table is at 0x45a80c.)
Create a table in free space of (Total number of TM/HM * 2) bytes.

The pointer of the compatibility table is 0x43C5C, and the pointer of the TM move ID table is 0x125A88.
 

Dr. Seuss

Will finish GS Chronicles, I swear!
523
Posts
10
Years
I'm not sure if this issue only happens to me. When I do all the steps for expanding TM I'm gettings errors with the items lying in the ground. The items with the MSG_FIND commands instead of saying "player found POTION" it actually says "player found POTION It contains " like if I was picking a TM. Additional to this all the TM/HM are not showing their names when opening TM Case, it only shows the TM number but blank names.

In addition, I would like to know exactly what every routine is supposed to do. The ASM codes are labeled by their address, but I have no idea exactly what those routines are changing since there is no even comments about these modifications.
 

BZL

Japanese Rom Hacker
5
Posts
5
Years
idk it is related to the crash, but I found a mistake and fix it.
 
Last edited:
Back
Top