• 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.

Research: Exploring Ruby and Emerald

89
Posts
10
Years
Please use more diplomatic language in the future. However, I agree that the type table is corrupted, but I copied the old type table over from a backup, and it works like a charm. Despite that, the battle system seems to work perfectly.
More importantly, there seems to be an error with the animation system in my game. I suspect it has something to do with the mass decapitalisation of Anti-Exploud, because it was already present before applying the Physical/Special split, Fairy-type and Pokédex Expansion. That said, I won't rule out one of those as a potential cause.
The glitch happens when Pokémon are switched out, then Peck is used. The Pokémon does not have to be specific. Then, the Pokémon that used Peck will start stretching on horizontally.
Here is a GIF (I changed the animation to that of Peck's):
DhFTOt8.gif

Sorry about the quality, I had to shrink it so it could be uploaded.
However, this glitch, while minor, seems to be related to another similar bug in which, if a Pokémon uses any move that includes the Pokémon sprite moving forward, the sprite expands a few times, but is cut off beyond its 64x64 size. Entering the Bag and exiting seems to clear the issue.
Can someone help me research into this? I'm not good at ASM...
 

Le pug

Creator of Pokémon: Discovery / Fat Kid
870
Posts
10
Years
Please use more diplomatic language in the future. However, I agree that the type table is corrupted, but I copied the old type table over from a backup, and it works like a charm. Despite that, the battle system seems to work perfectly.
More importantly, there seems to be an error with the animation system in my game. I suspect it has something to do with the mass decapitalisation of Anti-Exploud, because it was already present before applying the Physical/Special split, Fairy-type and Pokédex Expansion. That said, I won't rule out one of those as a potential cause.
The glitch happens when Pokémon are switched out, then Peck is used. The Pokémon does not have to be specific. Then, the Pokémon that used Peck will start stretching on horizontally.
Here is a GIF (I changed the animation to that of Peck's):
DhFTOt8.gif

Sorry about the quality, I had to shrink it so it could be uploaded.
However, this glitch, while minor, seems to be related to another similar bug in which, if a Pokémon uses any move that includes the Pokémon sprite moving forward, the sprite expands a few times, but is cut off beyond its 64x64 size. Entering the Bag and exiting seems to clear the issue.
Can someone help me research into this? I'm not good at ASM...

Not only that ...
"I also changed the type picture sprite as well."

I applied this patch to an untouched rom and it doesn't update the type picture at all lol. This patch needs all sorts of lovin' or at least, he needs to rewrite what features are apart of it until he fixes it.
 
89
Posts
10
Years
I think you must have used an older version. Either that, or Advance Map may have repointed a map or Tileset and overwritten a part of the patch.
Examples:
kegOQ9Q.png

aP5rl14.png

By the way, I've been working on an Emerald remake/expansion, and it seems that either there is something wrong with my Map editor, or it's an inherent bug in the game-Route 111 reverts to the original tile map after a battle or exiting a house on Route 111. Going into the PokéCenter and exiting seems to fix it.
 
199
Posts
12
Years
  • Seen Jul 18, 2016
Had this in my notes and forgot about it :\
At offset 0x329D48 in Emerald is Deoxys Speed forme stats in the usual HP/ATK/DEF/SPD/SPATK/SPDEF format.
Editing HP here doesn't seem to affect anything, but editing its Normal forme stats in G3HS/YAPE allows it to change.
 

Danny0317

Fluorite's back, brah
1,067
Posts
10
Years
  • Age 24
  • Seen Nov 19, 2023
Okay guys, does anyone know the proper way of using hidebox2 in emerald? It seems like a fairly useful command, I got it to do this once:
9yI60.jpg


but that ended up hiding the msgbox as well.
 
89
Posts
10
Years
What is the table in Emerald that is used to decide how the frames are flopped between each other? I changed Pidgey's sprite to the HGSS one so I want to change the rapid Frame 0/Frame 1 alternation of default Pidgey
 
89
Posts
10
Years
By the way, the offset for the move effects table is 0x2D86A8. Just plug this in instead of 0x1D65A8 in Itman's Creating new Move Effects tutorial. And Shiny Quagsire or maybe Chaos Rush, could you please post the offset of the table that decides how Pokemon's frames are interchanged in Emerald?
 

AtecainCorp.

Rejishan awake...
1,377
Posts
15
Years
Someone can help me with my problem? I have strange failure with Type Chart. I remade ??? To Fairy. And I have some trouble with it becouse when I use Fairy Type Move it allways afect as 1 point of damage <Even when supereffective> Someone know how to fix it?
 

Jambo51

Glory To Arstotzka
736
Posts
14
Years
  • Seen Jan 28, 2018
Someone can help me with my problem? I have strange failure with Type Chart. I remade ??? To Fairy. And I have some trouble with it becouse when I use Fairy Type Move it allways afect as 1 point of damage <Even when supereffective> Someone know how to fix it?

That's because the ASM code behind the damage calculator doesn't know whether to categorise moves of that type as physical or special, and so does neither - simply returning 1 as the final damage.

It's fairly easy to fix with a little ASM knowledge, but fundamentally the change you're making is a hex edit.

I can't tell you where the byte(s) you'd need to change are as I never hacked Ruby or Emerald, so you'll need to find someone who either knows where the byte(s) are, or find them yourself using ASM research techniques.
 
457
Posts
10
Years
  • Age 29
  • Seen Apr 9, 2024
So since this is the "Exploring R/S/E" thread, I think this might be a good place to re-post my reply to Artemis64 in the battle backgrounds tutorial. Hopefully someone can make heads and tails of what I've looked into. (I can't really hack as of now)

This is already posted in Inserting Battle Backgrounds thread but I decided to post it in this thread as well.

Emerald Battle Backgrounds
Alright! This is the Battle Backgrounds table for Emerald. The table has the same concept for each background as FireRed has. I dunno if anyone already posted this kind of research but let's just say that I made fine research. LOL Having this format of having five pointers for each background:

Code:
VV VV VV 08  WW WW WW 08  XX XX XX 08  YY YY YY 08  ZZ ZZ ZZ 08
 
VV = Image Offset
WW = TileMap Offset
XX = Entry Image 
(Ex. The Grass that moves in front of the screen at the beginning of a grass battle.)
YY = Entry Image Tilemap
ZZ = Palette

The difference between FireRed and Emerald is that the Emerald's table only covers 10 backgrounds which are in this list:

  • Grass 1 (Normal Grass)
  • Grass 2 (Tall Grass)
  • Sand
  • Dive
  • Sea
  • Pond
  • Craggy
  • Cave
  • Trainer Battles (Indoor)
  • Trainer Battles (Outdoor) "can be called as the outdoor FIELD"

The table begins at 31ABA8 and ends at 31AC6F. The table hasn't the background for Gym Leader battles, Hideout battles, Pokemon League battles, Battle Frontier battles (doesn't count the Smeargle cave underneath Battle Frontier), and the backgrounds for the Weather Trio battles isn't in the table too. I'm pretty sure that the table is somewhere else but they are located separatedly. Here is the documentation of each background and their offsets and pointers in the original table:

Code:
- Grass 1 (Normal Grass)
--- D77D68 (image) - pointer 68 7D D7 08 at 31ABA8
--- D75008 (image tilemap) - pointer 08 50 D7 08 at 31ABAC
--- D7E280 (entry image) - pointer 80 E2 D7 08 at 31ABB0
--- D7E808 (entry image tilemap) - pointer 08 E8 D7 08 at 31ABB4
--- D78318 (image palette) - pointer 18 83 D7 08 at 31ABB8

- Grass 2 (Tall Grass)
--- D78600 (image) - pointer 00 86 D7 08 at 31ABBC
--- D78CB8 (image tilemap) - pointer B8 8C D7 08 at 31ABC0
--- D7E9C4 (entry image) - pointer C4 E9 D7 08 at 31ABC4
--- D7F0D4 (entry image tilemap) - pointer D4 F0 D7 08 at 31ABC8
--- D78C78 (image palette) - pointer 78 8C D7 08 at 31ABCC

- Sand
--- D78F68 (image) - pointer 68 8F D7 08 at 31ABD0
--- D795A8 (image tilemap) - pointer A8 95 D7 08 at 31ABD4
--- D7F3C0 (entry image) - pointer C0 F3 D7 08 at 31ABD8
--- D7F850 (entry image tilemap) - pointer 50 F8 D7 08 at 31ABDC
--- D79560 (image palette) - pointer 60 95 D7 08 at 31ABE0

- Dive
--- D79858 (image) - pointer 58 98 D7 08 at 31ABE4
--- D79E58 (image tilemap) - pointer 58 9E D7 08 at 31ABE8
--- D7F9F8 (entry image) - pointer F8 F9 D7 08 at 31ABEC
--- D7FEC4 (entry image tilemap) - pointer C4 FE D7 08 at 31ABF0
--- D79E10 (image palette) - pointer 10 9E D7 08 at 31ABF4

- Sea
--- D7A108 (image) - pointer 08 A1 D7 08 at 31ABF8
--- D7A720 (image tilemap) - pointer 20 A7 D7 08 at 31ABFC
--- D80054 (entry image) - pointer 54 00 D8 08 at 31AC00
--- D80660 (entry image tilemap) - pointer 60 06 D8 08 at 31AC04
--- D7A6DC (image palette) - pointer DC A6 D7 08 at 31AC08

- Pond
--- D7A9D0 (image) - pointer D0 A9 D7 08 at 31AC0C
--- D7AFB8 (image tilemap) - pointer B8 AF D7 08 at 31AC10
--- D80804 (entry image) - pointer 04 08 D8 08 at 31AC14
--- D80D50 (entry image tilemap) - pointer 50 0D D8 08 at 31AC18
--- D7AF78 (image palette) - pointer 78 AF D7 08 at 31AC1C

- Craggy
--- D7B268 (image) - pointer 68 B2 D7 08 at 31AC20
--- D7B864 (image tilemap) - pointer 64 B8 D7 08 at 31AC24
--- D80E9C (entry image) - pointer 9C 0E D8 08 at 31AC28
--- D8147C (entry image tilemap) - pointer 7C 14 D8 08 at 31AC2C
--- D7B828 (image palette) - pointer 28 B8 D7 08 at 31AC30

- Cave
--- D7BB14 (image) - pointer 14 BB D7 08 at 31AC34
--- D7C154 (image tilemap) - pointer 54 C1 D7 08 at 31AC38
--- D81610 (entry image) - pointer 10 16 D8 08 at 31AC3C
--- D81E2C (entry image tilemap) - pointer 2C 1E D8 08 at 31AC40
--- D7C10C (image palette) - pointer 0C C1 D7 08 at 31AC44

- Trainer Battles (Indoor)
--- D7C440 (image) - pointer 40 C4 D7 08 at 31AC48
--- D7CA28 (image tilemap) - pointer 28 CA D7 08 at 31AC4C
--- D820D4 (entry image) - pointer D4 20 D8 08 at 31AC50
--- D824E4 (entry image tilemap) - pointer E4 24 D8 08 at 31AC54
--- D7DEB4 (image palette) - pointer B4 DE D7 08 at 31AC58
* Noted that the Trainer Battles for Indoor and Outdoor are sharing the same except for the image palette. Trainer Battles for Indoors contains white-ish and dark-brown-ish palette while Trainer Battles for Outdoors contains yellow-green-ish and light-brown-ish palette.

- Trainer Battles (Outdoor) "almost going to be called as the outdoor field"
--- D7C440 (image) - pointer 40 C4 D7 08 at 31AC5C
--- D7CA28 (image tilemap) - pointer 28 CA D7 08 at 31AC60
--- D820D4 (entry image) - pointer D4 20 D8 08 at 31AC64
--- D824E4 (entry image tilemap) - pointer E4 24 D8 08 at 31AC68
--- D7C404 (image palette) - pointer 04 C4 D7 08 at 31AC6C
* Noted that the Trainer Battles for Indoor and Outdoor are sharing the same except for the image palette. Trainer Battles for Indoors contains white-ish and dark-brown-ish palette while Trainer Battles for Outdoors contains yellow-green-ish and light-brown-ish palette.

For Gym Leader and Battle Frontier battles, they have separated backgrounds. Now, here is the documentation on other special backgrounds and I just give the location of their pointers:

Code:
BATTLE FRONTIER image pointer @ 03579C
BATTLE FRONTIER image tilemap pointer @ 0357A4
BATTLE FRONTIER image palette pointer @ 0357AC

GROUDON image pointer @ 0357D0
GROUDON image tilemap pointer @ 0357D8
GROUDON image palette pointer @ 0357E0

KYOGRE image pointer @ 035804
KYOGRE image tilemap pointer @ 03580C
KYOGRE image palette pointer @ 035814

RAYQUAZA image pointer @ 035838
RAYQUAZA image tilemap pointer @ 035840
RAYQUAZA image palette pointer @ 035848

GYM LEADER image pointer @ 035884
GYM LEADER image tilemap pointer @ 03588C
GYM LEADER image palette pointer @ 035894

CHAMPION image pointer @ 0358B0
CHAMPION image tilemap pointer @ 0358B8
CHAMPION image palette pointer @ 0358C0

"Gym Style (AM)" image pointer @ 035964
"Gym Style (AM)" image tilemap pointer @ 03596C
"Gym Style (AM)" image palette pointer @ 035974
* (AM) - Advance Map

MAGMA HIDEOUT "Team Rocket Style (AM)" image pointer @ 03598C
MAGMA HIDEOUT "Team Rocket Style (AM)" image tilemap pointer @ 035994
MAGMA HIDEOUT "Team Rocket Style (AM)" image palette pointer @ 03599C
* (AM) - Advance Map
* Although that the Ruby's Magma Hideout isn't used in the normal gameplay of Emerald, it exists in Emerald just for a standard "Team Rocket Style" and for FireRed, it is used in Pokemon Tower.

AQUA HIDEOUT "03 (AM)" image pointer @ 0359B4
AQUA HIDEOUT "03 (AM)" image tilemap pointer @ 0359BC
AQUA HIDEOUT "03 (AM)" image palette pointer @ 0359C4
* (AM) - Advance Map
* In Emerald, the "03 ???" from the Fight Type, it is the Aqua Hideout. Although that in FireRed, it appears to be for Rocket Hideout.

ELITE FOUR 1 image pointer @ 0359DC
ELITE FOUR 1 image tilemap pointer @ 0359E4
ELITE FOUR 1 image palette pointer @ 0359EC

ELITE FOUR 2 image pointer @ 035A04
ELITE FOUR 2 image tilemap pointer @ 035A0C
ELITE FOUR 2 image palette pointer @ 035A14

ELITE FOUR 3 image pointer @ 035A2C
ELITE FOUR 3 image tilemap pointer @ 035A34
ELITE FOUR 3 image palette pointer @ 035A3C

ELITE FOUR 4 image pointer @ 035A5C
ELITE FOUR 4 image tilemap pointer @ 035A64
ELITE FOUR 4 image palette pointer @ 035A6C

"Big Red Pokeball (AM)" image pointer @ 035A90
"Big Red Pokeball (AM)" image tilemap pointer @ 035A98
"Big Red Pokeball (AM)" image palette pointer @ 035AA0
* (AM) - Advance Map

So far, that's only the separated backgrounds I've found in Emerald. Some of the images are aligned with the first ten backgrounds or the other backgrounds so be careful while repointing. Example: You have a background for the Elite Four and Champion but it relates with the Team Rocket Style background. I suggest that if you have good instincts, insert the image without repointing and just edit the pointers manually by using a HEX editor. I just gave all the information I have found so you won't be having problems dealing with Emerald background. I hope this help you a lot. Good luck!

----

I did some research into TM extension in Emerald. It seems that the TMs are located at 616040. When I looked at the data, they were two bytes long each. It was a move IDs, in hex, FLIPPED. I used a Pokémon Ruby Gameshark Codes listing to prove it (Here's the link: http://www.ign.com/faqs/2004/pokemon-battle-e-gameshark-sp-codes-list-541208). For example, the move ID for Focus Punch, or or Fighting Punch as the rough Japanese to English translation, in hex would be 108. However, within the TM Data,
it is actually 08 01. It just flipped the first number, 01, with the two other numbers, 08.

The TMs in hex are:
Spoiler:


But what about the HMs? They follow right after:
Spoiler:


I asked someone about this, and they stated that, no matter what, if the move IDs (in hex) are added BEFORE the HM data, this would be the beginning of the expansion of TMs in the game. HMs, however, will always be the last 8 move IDs (in hex).

Here, I just did an example of doing this process, using an expanded moves table:
Spoiler:


If you compare it to the original, there are an extra 50 TMs added. Now, I just need to know how to make the legitimate TM item work. If someone were to look into that, that would be awesome.

I think you should expand the items too. If the list of items ISN'T somewhat "DMA protected", that would be possible. I like the idea of expanding TMs but the items should too (in case you don't want replacing ????????????-s at all). Even with the INFINITE USAGE, how does the no-sell and no-buy-it-again will work on Gen III? And even with the expanded TMs (example 100 for now), I think expanding TM/HM compatibility table should be expanded too.
 
Last edited:

AtecainCorp.

Rejishan awake...
1,377
Posts
15
Years
That's because the ASM code behind the damage calculator doesn't know whether to categorise moves of that type as physical or special, and so does neither - simply returning 1 as the final damage.

It's fairly easy to fix with a little ASM knowledge, but fundamentally the change you're making is a hex edit.

I can't tell you where the byte(s) you'd need to change are as I never hacked Ruby or Emerald, so you'll need to find someone who either knows where the byte(s) are, or find them yourself using ASM research techniques.

Ok. Thank you. Meybe still I do not known the pointer of bytes which I must change. But now I know what I must do.
 
180
Posts
10
Years
  • Age 34
  • Seen Jan 10, 2017
I feel that translating this to Emerald would open up a huge door as many moves and held items need this hack. While the regular ROM offsets are easy to translate (I'll post them when I have access to my HEX-editor), I can't seem to find the corresponding RAM-locations in Emerald.

How would I go about finding them? 0x0202298C and 0x0203C020. I've searched for pointers in the ROM without luck.

Spoiler:
 
252
Posts
10
Years
  • Age 27
  • Seen Jul 6, 2019
I feel that translating this to Emerald would open up a huge door as many moves and held items need this hack. While the regular ROM offsets are easy to translate (I'll post them when I have access to my HEX-editor), I can't seem to find the corresponding RAM-locations in Emerald.

How would I go about finding them? 0x0202298C and 0x0203C020. I've searched for pointers in the ROM without luck.

Spoiler:
The otherramloc seems to be 0x02022E2C. I haven't found the corresponding offset for 0x0203C020 yet, but I'll update this post if I do.
So for reference:
returntwo: .word 0x0814E6CD
returnone: .word 0x0814E6D9
otherramloc: .word 0x02022E2C
EDIT: This is a big assumption on my part, but 0x0203c020 seems to be free ram space. Under that assumption, I've found a place that'll hopefully work: 0x0203B200.
I haven't found any references to this in the ROM, so hopefully this'll work. Please make a backup before testing this though.

EDIT2: How does this look?

kijp0.jpg
 
Last edited:

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
The otherramloc seems to be 0x02022E2C. I haven't found the corresponding offset for 0x0203C020 yet, but I'll update this post if I do.
So for reference:
returntwo: .word 0x0814E6CD
returnone: .word 0x0814E6D9
otherramloc: .word 0x02022E2C
EDIT: This is a big assumption on my part, but 0x0203c020 seems to be free ram space. Under that assumption, I've found a place that'll hopefully work: 0x0203B200.
I haven't found any references to this in the ROM, so hopefully this'll work. Please make a backup before testing this though.

EDIT2: How does this look?

kijp0.jpg

That's what I had found to. I personally used something different to 203B200, but that works too!
I was going to post my port, but you guys have beaten me there.
 
252
Posts
10
Years
  • Age 27
  • Seen Jul 6, 2019
That's what I had found to. I personally used something different to 203B200, but that works too!
I was going to post my port, but you guys have beaten me there.
Just curious, what RAM offset did you use? I ask this since I imagine people will add their own moves to your rombase once you release your Emerald version, and it'd be nice to have consistency.

Anyway, I realized I should probably post how I ported this to EM.

1.
Code:
.text
.align 2
.thumb
.thumb_func
.global battlestringloaderhack
main:
mov r0, #0xC2
lsl r0, r0, #0x1
cmp r0, r6
bne normalcode
ldr r0, ramlocation
ldr r7, [r0, #0x0]
cmp r7, #0x0
beq alternative
mov r0, #0xA
lsl r0, r0, #0x18
cmp r7, r0
bge alternative
mov r0, #0x8
lsl r0, r0, #0x18
cmp r7, r0
blt alternative
b continue
alternative: mov r6, #0xC
ldr r1, returntwo
bx r1
continue: ldr r0, returnone
bx r0
normalcode: ldr r1, otherramloc
mov r0, #0xFF
strb r0, [r1, #0x0]
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align
ramlocation: .word 0x0203B200
returntwo: .word 0x0814E6CD
returnone: .word 0x0814E6D9
otherramloc: .word 0x02022E2C

Insert this routine into your ROM. Take note of the offset you insert it to.

2. Go to 0x14E6C2 in your hex editor and change FF 20 to 08 47. Then go to 0x14E6C8 and change the pointer to the location of your ASM routine +1.

Using it is as simple as putting
setword 0x203B200 0x8(location of your string)
printstring 0x184
in your battle script.
 

MrDollSteak

Formerly known as 11bayerf1
858
Posts
15
Years
Just curious, which RAM offset did you use? I ask this since I imagine people will add their own moves to your rombase once you release your Emerald version, and it'd be nice to have consistency.

Anyway, I realized I should probably post how I ported this to EM.

1.
Code:
.text
.align 2
.thumb
.thumb_func
.global battlestringloaderhack
main:
mov r0, #0xC2
lsl r0, r0, #0x1
cmp r0, r6
bne normalcode
ldr r0, ramlocation
ldr r7, [r0, #0x0]
cmp r7, #0x0
beq alternative
mov r0, #0xA
lsl r0, r0, #0x18
cmp r7, r0
bge alternative
mov r0, #0x8
lsl r0, r0, #0x18
cmp r7, r0
blt alternative
b continue
alternative: mov r6, #0xC
ldr r1, returntwo
bx r1
continue: ldr r0, returnone
bx r0
normalcode: ldr r1, otherramloc
mov r0, #0xFF
strb r0, [r1, #0x0]
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align
ramlocation: .word 0x0203B200
returntwo: .word 0x0814E6CD
returnone: .word 0x0814E6D9
otherramloc: .word 0x02022E2C

Insert this routine into your ROM. Take note of the offset you insert it to.

2. Go to 0x14E6C2 in your hex editor and change FF 20 to 08 47. Then go to 0x14E6C8 and change the pointer to the location of your ASM routine +1.

Using it is as simple as putting
setword 0x203B200 0x8(location of your string)
printstring 0x184
in your battle script.

I doubt people would be adding moves to my rombase as I've expanded it to 1023 available moves, so that it can include every actual move. As for custom moves, I doubt anyone would make effects that don't currently exist. But anyway I used 203E320 instead of 2023B200.

That being said I don't know much about the Emerald ram. Much less than Fire Red anyway, so I'll trust your judgment for what is unused, and will probably change it.
 

AtecainCorp.

Rejishan awake...
1,377
Posts
15
Years
It was nice. But I wonder that it was possible to make Pokemon Evolving During Battle? Not like Mega Evolutions. But normally. For example. Torchic gained lvl 16 in the middle of battle and start evolving in that moment beafore rival sent next Pokemon. That feature make game more like Anime series.
 
Back
Top