• 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: Porting TM/HM expansion to Emerald UPDATED!!!

Starfall321

OnePunchStarfall
36
Posts
7
Years
  • Age 28
  • Seen Aug 3, 2016
Before anyone asking about doing this Kanto , pls take a look on this post

Although he don't really give us much explanation, his post definitely useful for further development.

The purpose of this thread is to port and fix the routine to Emerald. I cant do this alone, so any help is appreciated.

Let this picture speak everything
giphy.gif


Done
In progress/Need help!!!

Things we need to do:
0. Expand the TM/HM move table
Spoiler:


1.Expand the item number.(alternative)


2.Expand the pocket slot.
Spoiler:


2.5.Fix Bag maximum size
Spoiler:


3.Fix TM/HM index routine.
Spoiler:


4.Fix No.? thing
Spoiler:


4.5.Fix 3 digit number not showing properly
Spoiler:


5.Fix HM icon thing
Spoiler:


6.Fix TM/HM compatibility table
Spoiler:


7. Fix "Booted up an HM."
Spoiler:

I move the bunch of TM item data to expanded slot and move HM data backward so I could have extra 78 TM between them.
You can actually use alternative way to do this(without moving original item data), but you need to modify the routines above and the item arrangement routine yourself, so I suggest to use my way.
 
Last edited:
417
Posts
9
Years
  • Age 33
  • Seen Nov 20, 2016
My blind guesses based on the FR expansion.

2. I suspect that since there is no TM Case, you're running into this problem: http://www.pokecommunity.com/showpost.php?p=9090677&postcount=820
The malloc size is a specific hard coded number, rather than a multiple of the quantity of items. Look for the equivalent Emerald routine and fix it to the new max TM + HM quantity. If you want to go beyond 0x7F items in a single pocket, there's the further annoyance of the bag slot items being programmed as signed bytes for who knows what reason. Not a big problem - just another tiny thing to account for.

5. You already know how FireRed does this, so I don't really know, and don't feel like looking at Emerald :D good luck?

6. I can't imagine this one being too difficult. Just look for pointers to the current table, and you'll find the routine you need to change. FireRed example and routine location: http://www.pokecommunity.com/showpost.php?p=9165280&postcount=5
 

Starfall321

OnePunchStarfall
36
Posts
7
Years
  • Age 28
  • Seen Aug 3, 2016
My blind guesses based on the FR expansion.

2. I suspect that since there is no TM Case, you're running into this problem: http://www.pokecommunity.com/showpost.php?p=9090677&postcount=820
The malloc size is a specific hard coded number, rather than a multiple of the quantity of items. Look for the equivalent Emerald routine and fix it to the new max TM + HM quantity. If you want to go beyond 0x7F items in a single pocket, there's the further annoyance of the bag slot items being programmed as signed bytes for who knows what reason. Not a big problem - just another tiny thing to account for.

5. You already know how FireRed does this, so I don't really know, and don't feel like looking at Emerald :D good luck?

6. I can't imagine this one being too difficult. Just look for pointers to the current table, and you'll find the routine you need to change. FireRed example and routine location: http://www.pokecommunity.com/showpost.php?p=9165280&postcount=5

2. I will probably take some time on this, right now my new pc has very limited resource to do this.

6. Actually I complete the routine but I mess up my record, I will post it later.

Interesting fact, indeed Emerald without any change has 64 slots, but you have only 58 TM/HM atm in Emerald.
080D6624 2040 mov r0,#0x40
080D6626 7508 strb r0,[r1,#0x14]
Maybe the Emerald was originally designed to have more TM.
 
417
Posts
9
Years
  • Age 33
  • Seen Nov 20, 2016
2. I will probably take some time on this, right now my new pc has very limited resource to do this.

6. Actually I complete the routine but I mess up my record, I will post it later.

Interesting fact, indeed Emerald without any change has 64 slots, but you have only 58 TM/HM atm in Emerald.
080D6624 2040 mov r0,#0x40
080D6626 7508 strb r0,[r1,#0x14]
Maybe the Emerald was originally designed to have more TM.
Can't you just use a debugger? Set a breakpoint on malloc, then open that bag. That's all I did to find the fix for FireRed.
 

Starfall321

OnePunchStarfall
36
Posts
7
Years
  • Age 28
  • Seen Aug 3, 2016
Can't you just use a debugger? Set a breakpoint on malloc, then open that bag. That's all I did to find the fix for FireRed.

Yeah, I am actually a newbie in Emerald hacking, so I never know where the malloc is until I found this thread half an hour ago.
http://pokemonhackersonline.com/archive/index.php/t-13724.html

Thx azurile again,now I manage to do this with some byte change, I will update the op ASAP after I complete the routine. Updated!!
emer_01.png

The routine is located at 0x81AB218
1 step more to succeed.
 
Last edited:

Starfall321

OnePunchStarfall
36
Posts
7
Years
  • Age 28
  • Seen Aug 3, 2016
I found something interesting while hacking daycare.
080705C2 seems to be the routine of TM move passing down to child.
Change the byte at 0x706C8 here to your new TM01 ID.
 
794
Posts
10
Years
Always wanted to do it, but lacked the motivation. Anyway, good job on the progress.
I've a question tho. Where are you going to put new TMs data? Bag size is limited and can only hold 64 TMs/HMs. What I'm asking is where you store the new items data.
 

Starfall321

OnePunchStarfall
36
Posts
7
Years
  • Age 28
  • Seen Aug 3, 2016
Always wanted to do it, but lacked the motivation. Anyway, good job on the progress.
I've a question tho. Where are you going to put new TMs data? Bag size is limited and can only hold 64 TMs/HMs. What I'm asking is where you store the new items data.

I update the stuff, bag size was fixed so it suppose could have a maximum of 128 item inside one pocket (check step 2.5)
Not sure what you are asking, I store the TM/HM slotsitem somewhere on the extended saveblock.
.align 2

main:
ldr r0, ram
str r0, [r1, #0x10]
mov r0, #0x80 @128 slot
strb r0, [r1, #0x14]
ldr r0, return
bx r0

.align
[S-HIGHLIGHT]ram: .word 0x0203d900 @you will need 4x128= 512bytes[/S-HIGHLIGHT]
return: .word 0x080D6628+1

@Goto 0xD6620 :00 48 00 47 [reverse routine pointer+1]
 
794
Posts
10
Years
I update the stuff, bag size was fixed so it suppose could have a maximum of 128 item inside one pocket (check step 2.5)
Not sure what you are asking, I store the TM/HM slotsitem somewhere on the extended saveblock.
.align 2

main:
ldr r0, ram
str r0, [r1, #0x10]
mov r0, #0x80 @128 slot
strb r0, [r1, #0x14]
ldr r0, return
bx r0

.align
[S-HIGHLIGHT]ram: .word 0x0203d900 @you will need 4x128= 512bytes[/S-HIGHLIGHT]
return: .word 0x080D6628+1

@Goto 0xD6620 :00 48 00 47 [reverse routine pointer+1]

Ah you extend saveblock, alright.
 

LCCoolJ95

Limited Capacity
638
Posts
14
Years
Hey, this may be off-topic, but I noticed that you expanded the pocket size for TMs. Is there a way to expand the pocket size for Items pocket? And if so, could you show me what I should do?
 

Starfall321

OnePunchStarfall
36
Posts
7
Years
  • Age 28
  • Seen Aug 3, 2016
Hey, this may be off-topic, but I noticed that you expanded the pocket size for TMs. Is there a way to expand the pocket size for Items pocket? And if so, could you show me what I should do?

Yes, the bag routine is located at 080D65F0.
You can rewrite the routine or branch somewhere to change the value and pointer to be store to 0x2039DD8 region.
 

LCCoolJ95

Limited Capacity
638
Posts
14
Years
Yes, the bag routine is located at 080D65F0.
You can rewrite the routine or branch somewhere to change the value and pointer to be store to 0x2039DD8 region.
Is the above routines only meant for the TM pocket, or is it meant for any of the pockets? If so, how would I rewrite the routine to have it expand the Items pocket?
 

Starfall321

OnePunchStarfall
36
Posts
7
Years
  • Age 28
  • Seen Aug 3, 2016
Is the above routines only meant for the TM pocket, or is it meant for any of the pockets? If so, how would I rewrite the routine to have it expand the Items pocket?

Any of the pockets.
Check my step 2, your routine will be something similar like that.
 

Starfall321

OnePunchStarfall
36
Posts
7
Years
  • Age 28
  • Seen Aug 3, 2016
After some break for my exam nightmare , I decide come back and finish this thing in my holiday.

The road so far,
I wrote the routines into a piece using kleenexfeu's trick(So you can compile everything in one step and make a patch)
I also done TM/HM Compatibility of ORAS TM/HM set for all 0-774(Missing No. to Volcanion) pokemon and I will include it in next update.
I also fix HM icon thing with some byte change:
Pokemon_Emerald_01.png

Another tricky thing is when you try to use newly created TM, it will come out a string "Booted up an HM." instead of "Booted up an TM."
I also fix this with some byte change:
Pokemon_Emerald_01.png

As you can see I almost done, I will update the thread soon.

Btw I found my step 6 "Fix TM/HM compatibility table" routine at op is not working at all,
suprisingly nobody tell me about this about a month so I assume only quite a little number of you concern about this feature.

Here is the fix
Spoiler:
 
Last edited:
457
Posts
10
Years
  • Age 28
  • Seen Apr 9, 2024
I've tested it and it works. But, what about for editing TM/HM compatibility? That's the only problem left for me. I tried tools to edit compatibility but gives an error. Do you have guides for that?
 

BluRose

blu rass
811
Posts
9
Years
You are just wasting your time doing binary hacking in Ruby, switch to Decomps. This thing would be a lot easier instead of finding appropriate routines and ram address.
while you aren't entirely wrong, there's no such "waste of time" thing involved anywhere
hack what you're comfortable with, there's no "correct" way; people still binary hack crystal
 
Back
Top