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

Quick Research & Development Thread

Deokishisu

Mr. Magius
990
Posts
18
Years
  • Reusable TMs in Emerald

    So I was taking a peek through good old reseach and development today when I saw a cute little post about resuable TMs. You know, making TMs act like HMs. After seeing that it had been found on Ruby and FireRed, I thought, why not find it one Emerald? So I did.

    To do this little bad boy, go to 0x1B6EE0 in your Emerald ROM and change the A9 there to 90.
    Simple as that!

    Here's a tiny little explanation for those wondering.

    First, 0x1B6EE0 is this little section of code called when a TM or HM is being used. For simplicity's sake, I'll show what is relevant:

    Code:
    081B6EE0: 20A9 mov r0, #0xA9
    081B6EE2: 0040 lsl r0, r0, #0x1
    081B6EE4: 4284 cmp r4, r0
    081B6EE6: bhi $081B6EF0

    What it does, is first take the number A9, and put it in r0. Then, it takes r0 and left shifts it 1. This is the same as multiplying by 2 (A9 << 1 = A9 * 2 = 152). If one was to look at any item editor, they would see that this is the index of TM50 in Emerald. Then, this new value is compared to r4, which has the index of the TM/HM being used. If this number higher, the game knows that an HM was used, so it goes to the relevant area to keep it.

    This is where we come in. What we want the game to think is that all TMs are the same as HMs. So, what we need to do is change the index it looks for into the index for the first TM, rather than the first HM. So looking at the items, TM01's index is 121. Dividing this by 2 gives 90, so that is why we put 90. The only downside to doing this really is that item 120 is included in this check, which doesn't matter because it's not a TM anyway (it's the Devon Goods). So there ya have it!

    This may make the TMs reusable, but what about the PP issue? If you can repeatedly use a TM, you can refresh the PP of the move. Like, if I'm mid-Elite Four and have zero PP on Flamethrower, I can use the Flamethrower TM, overwrite the existing Flamethrower move on my Pokemon, and its PP is restored. The true B/W and up functionality will require more code to fix this.

    EDIT: I missed a step in restoring PP. Inserting it in the example above, I'd replace the used up PP Flamethrower with another TM move, then I would relearn Flamethrower from the TM again, thus restoring the PP. There has to be another TM move as a middleman.
     
    Last edited:

    Le pug

    Creator of Pokémon: Discovery / Fat Kid
    870
    Posts
    10
    Years
  • Here is some more research on the emerald specials. Might update in the future. This is an extension to the research provided by droomph at THIS LINK

    Emerald specials:
    Spoiler:
     
    Last edited:

    Tlachtli

    Crit happens.
    267
    Posts
    12
    Years
  • Not exactly R&D, but a useful image I found:
    In Emerald BPEE, the uncompressed type images used for TMs/HMs (different from the ones used on the Poke info page) are found at 0xDC4378 and use the palette at 0xDC4338.

    Potentially useful if you're adding new types to a hack and want to make TMs with moves of those types. The Power/Type/PP images are on there too, if you want to change how those look.
     

    DoesntKnowHowToPlay

    Tiny Umbrella with Lots and Lots of Good
    265
    Posts
    12
    Years
    • Seen Feb 24, 2024
    Ditto's unique ability to breed with everything despite being genderless is a property of its egg group, but it won't actually produce the right eggs if you give something outside of slot x84 the Ditto egg group- you'll just get a bunch of Bulbasaur if there's no female involved. To fix this, change the byte at x4602A from x84 to the slot you want to behave like Ditto.

    While I'm pointing out breeding quirks that are of no use to anyone:

    An egg that would hatch as the byte at x46068 (normally x1D, female nidoran) has a 50% chance to instead hatch as the byte at x4607E (normally x20, male nidoran).

    Furthermore, an egg that would normally hatch as the word at x460d0 (normally x183, Illumise) has a 50% chance of hatching as twice the byte at x46096 (normally xC1, half of Volbeat's index number).

    Volbeat and male Nidoran family members do not produce their female counterparts when breeding with Ditto in Gen 3.

    There's a second Ditto check at x460A2- this one doesn't affect the child's species but it probably is important for inheritance.

    If an egg would hatch to be double the byte at x45fa8 (xB4, half of Wynaut's index number) and a parent is not holding the item at x45fd8 and x45fdc (xDD, Lax Incense), the baby will become the byte at x45fe0 (xCA, Wobbuffet).

    If an egg would hatch to be double the byte at x45fb0 (xAF, half of Azurill's index number) and a parent is not holding the item at x45fee and x45ff2 (xDC, Sea Incense), the baby will become the byte at x45ff6 (xB7, Marill).

    Azurill's index number is constructed a second time at x45fe6- I'm not exactly sure *why* it's needed but if the baby's index number doesn't match it the game won't consider changing it to a Marill.
     
    Last edited:

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • Here is some more research on the emerald specials. Might update in the future. This is an extension to the research provided by droomph at THIS LINK

    Emerald specials:
    Spoiler:



    **Ace_Master_of_Turtles aka acertony also helped in this research

    1: You misspelled Groudon :D
    2: I don't think special 0xFB clears all pokemon for good. FR has a similar one, but it updates your party then clears it, so it IS retrievable. You just need to find another special that can restore it. This is probably used in the battle factory, so you may need to go through that script and see when your party comes back. Just a suggestion as it may not be a complete delete.
     

    karatekid552

    What happens if I push it?....
    1,771
    Posts
    11
    Years
  • 1: You misspelled Groudon :D
    2: I don't think special 0xFB clears all pokemon for good. FR has a similar one, but it updates your party then clears it, so it IS retrievable. You just need to find another special that can restore it. This is probably used in the battle factory, so you may need to go through that script and see when your party comes back. Just a suggestion as it may not be a complete delete.

    There is a litteral special in all games that does clear the party. All it does is overwrite the party's ram offset with 00s. The specials you are talking about are actually used to save and load the game.
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • There is a litteral special in all games that does clear the party. All it does is overwrite the party's ram offset with 00s. The specials you are talking about are actually used to save and load the game.

    Hmm
    This can be used for the battle factory too
    *ponders*
     

    Le pug

    Creator of Pokémon: Discovery / Fat Kid
    870
    Posts
    10
    Years
  • Hmm
    This can be used for the battle factory too
    *ponders*

    well if there is a special for it to return, then yes i am wrong and that'd be good to mention however i use that special in my hack of emerald and since i've used it my old party is gone and i have a new one and it works fine as a complete erase of the party

    and yes lol i did spell Gourdon wrong

    Here is some more research on the emerald specials. Might update in the future. This is an extension to the research provided by droomph at THIS LINK

    Emerald specials:
    Spoiler:


    Some more special research for emerald:

    Spoiler:
     
    Last edited:

    Deokishisu

    Mr. Magius
    990
    Posts
    18
    Years
  • I have two more specials to add to the Emerald list.

    Spoiler:


    These are found in the script that handles the secret bases. You know, checking if you have Secret Power and actually making the base and such. In Emerald, the script is located at 2759F1. There's also a special 0x15 in there, but I'm not sure what that does. My best guess is that it reads the tile in front of you and stores a value in 0x8007. If so, that's how the script tells whether you're in front of an indent, a tree, or a bush that you can make a secret base in; it checks 0x8007 (nothing in the script seems to put any values there before they're checked, so I figured it must be the special) for a few values and then branches off into the different types of secret bases. Because I don't need to mess with that special, I'm not really doing any sort of experimentation with it. Maybe with some ingenuity, someone could hack it to read more values and give us more types of secret bases?
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • Spoiler:

    0x1A Shuts down the PC and changes the tile from the lit up screen to the black screen. If you have a tileset that's not the PC tileset, it'll LOOK wrong, but it will be the correct tile. Do it in a PC.

    0x21 This is a LINK BATTLE command. If there's nobody to link to (AKA using walk through walls to go to link maps) it'll do the last battle you've done since battle data isn't cleared. So I'm saying the last battle you did was the Poochyena battle. Most of the "communication failed" specials you listed are linking specials that DO work, but in specific conditions.
     
    1,323
    Posts
    16
    Years
    • Seen Dec 9, 2023
    A common problem with many hacks that have edited the Town Map is that when checking the Town Map, you don't always appear at the right position. This is because the game looks at a table that determines the width and height of each map name when checking the Town Map.

    The table is located at 0x3F2178. The format is very simple:
    [WW] 00 [HH] 00

    WW = Width
    HH = Height

    I've wrote out the offsets that will take you to the dimensions of the Kanto map locations:
    3F2178 = PALLET TOWN
    3F217C = VIRIDIAN CITY
    3F2180 = PEWTER CITY
    3F2184 = CERULEAN CITY
    3F2188 = LAVENDER TOWN
    3F218C = VERMILION CITY
    3F2190 = CELADON CITY
    3F2194 = FUCHSIA CITY
    3F2198 = CINNABAR ISLAND
    3F219C = INDIGO PLATEAU
    3F21A0 = SAFFRON CITY
    3F21A4 = ROUTE 4
    3F21A8 = ROUTE 10
    3F21AC = ROUTE 1
    3F21B0 = ROUTE 2
    3F21B4 = ROUTE 3
    3F21B8 = ROUTE 4
    3F21BC = ROUTE 5
    3F21C0 = ROUTE 6
    3F21C4 = ROUTE 7
    3F21C8 = ROUTE 8
    3F21CC = ROUTE 9
    3F21D0 = ROUTE 10
    3F21D4 = ROUTE 11
    3F21D8 = ROUTE 12
    3F21DC = ROUTE 13
    3F21E0 = ROUTE 14
    3F21E4 = ROUTE 15
    3F21E8 = ROUTE 16
    3F21EC = ROUTE 17
    3F21F0 = ROUTE 18
    3F21F4 = ROUTE 19
    3F21F8 = ROUTE 20
    3F21FC = ROUTE 21
    3F2200 = ROUTE 22
    3F2204 = ROUTE 23
    3F2208 = ROUTE 24
    3F220C = ROUTE 25
    3F2210 = VIRIDIAN FOREST
    3F2214 = MT. MOON
    3F2218 = S.S. ANNE
    3F221C = UNDERGROUND PATH
    3F2220 = UNDERGROUND PATH
    3F2224 = DIGLETT'S CAVE
    3F2228 = VICTORY ROAD
    3F222C = ROCKET HIDEOUT
    3F2230 = SILPH CO.
    3F2234 = POKéMON MANSION
    3F2238 = SAFARI ZONE
    3F223C = POKéMON LEAGUE
    3F2240 = ROCK TUNNEL
    3F2244 = SEAFOAM ISLANDS
    3F2248 = POKéMON TOWER
    3F224C = CERULEAN CAVE
    3F2250 = POWER PLANT
    (Sevii Islands continue on right after, I only wrote Kanto offsets because I'm lazy)

    Now to demonstrate what I mean, let's say you're in Pallet Town.
    6_zps88cde5c2.png


    At 0x3F2178, the offset for Pallet Town's dimensions (as well as the start of the whole table), we see the bytes 01 00 01 00. The first 01 simply means that on the Town Map, Pallet Town is only 01 tile high, and the second 01 simply means that on the Town Map, Pallet Town is only 01 tile wide.

    Because of that, no matter where you are in Pallet Town, on the Town Map, you'll be limited to those dimensions:
    2_zpsc296bd07.png


    Now lets change Pallet Town's Town Map width to 03. Simply change the byte at 0x3F2178 to 03. Now let's walk all the way to the right side of Pallet Town.
    1_zpsfd3cb2eb.png


    So we changed Pallet Town's Town Map width to 03, let's check the Town Map:
    3_zps7363859b.png

    As you can see, it affects our visual position on the Town Map. This is because we altered Pallet Town's Town Map width to 03.

    If we go to the middle of Pallet Town, then we get this:
    4_zps3b1a276c.png
    5_zps77f52a74.png


    And all the way to the left:
    6_zps88cde5c2.png
    2_zpsc296bd07.png


    The same applies to height. This is how your position is controlled on the Town Map, as each Map name as a width and height associated with it.
     

    interdpth

    I've seen things, man.
    275
    Posts
    19
    Years
    • Seen Jun 8, 2021
    A common problem with many hacks that have edited the Town Map is that when checking the Town Map, you don't always appear at the right position. This is because the game looks at a table that determines the width and height of each map name when checking the Town Map.


    This is awesome, I'm going to use this for the world map editor. Any chance you can do it for Ruby? ;0

    also, t-swizzle for dream girl
     

    DoesntKnowHowToPlay

    Tiny Umbrella with Lots and Lots of Good
    265
    Posts
    12
    Years
    • Seen Feb 24, 2024
    FVF4tzR.png


    There's a table at x45FD54 that controls the position of various elements during the item animation on a per-mon basis. Each entry is 5 bytes, and the first entry maps to Bulbasaur rather than 0x0. It looks like Unown does some funny business with this table as well.

    0x0 = X position of TM right-ward from left edge of sprite
    0x1 = Y position of TM downward from top edge of sprite
    0x2 = How much Y position is modified when sprite is stretched (eg. start of TM animation, using a potion on a happy mon)
    0x3 = X position of non-TM item
    0x4 = Y position of non-TM item
     

    Full Metal

    C(++) Developer.
    810
    Posts
    16
    Years
  • Quick python script that's useful for debugging a map if you know it's header offset and don't feel like loading up advance map.

    Sample output:
    Code:
    D:\User\Desktop>pkmap.py D:\User\Desktop\frcpy.gba 350618
    Map@ 0x350618
    flash_thing 0x0
    type 0x1
    music 0x12c
    connection_header 0x835276c
    2 connections @ 137701204
    {'bank': 3, 'filler': 0, 'number': 19, 'offset': 0, 'type': 2}
    {'bank': 3, 'filler': 0, 'number': 39, 'offset': 0, 'type': 1}
    weather 0x2
    event_data 0x83b4e50
    show_label 0x0
    index 0x4e
    battle_type 0x0
    map_scripts 0x816545a
    map_data 0x82dd4c0
    unknown 0x601
    label 0x58
    
    Recompiling:
    b"\xc0\xd4-\x08PN;\x08ZT\x16\x08l'5\x08,\x01N\x00X\x00\x02\x01\x01\x06\x00\x00"
    ================================================================================
     
    5,256
    Posts
    16
    Years
  • This is probably something you could find by yourself but it's nice to have it in one place I guess.

    0xE991F8 - Trainer Card Tileset
    0x3CC6F0 - Trainer Card Front Tilemap
    0x3CC984 - Trainer Card Back Tilemap
    0x3CCEC8 - Trainer Card Background Tilemap
    0x3CD5E8 - Badges
    0x3CC368 - Trainer Card Stickers
    0xE99198 - Palettes (first is the Trainer Card itself (and the stickers? I think), then the background for males, then the background for females)
     
    79
    Posts
    15
    Years
    • Seen Apr 13, 2014
    Well I'm not sure how much of what I'm about to post isn't already known, but I couldn't find it, so here goes.

    Spoiler:


    I think I isolated the routine for the tall grass in Pokemon Ruby by working backwards from the shared information in Fire Red (there was a post about making the tall grass work, and I started from those offsets). What I'm trying to do is change how the tall grass animation handles sprite priority (basically, make it behave just like the normal grass as far as layers are concerned by making both the player and the grass priority 2 instead of the player's body changing to 3)
    Spoiler:

    I got this far, but I'm stuck. I have no idea what to change, or how much to change, or what to change it to. I have limited experience working with HEX, and I never really looked at ASM until a few days ago.

    I would imagine that I would need to change one value or so to make it behave like the normal grass (I still want the player to be forced to walk through it, and I can manage with the animation frames given, but I dont want the player disappearing behind the grass's roots). If anyone is interested in this problem, for purposes of eking out a bit more customization from the behaviors already found in the game, or just to help out a newbie who tried his best, I would greatly appreciate it.
     
    79
    Posts
    15
    Years
    • Seen Apr 13, 2014
    A common problem with many hacks that have edited the Town Map is that when checking the Town Map, you don't always appear at the right position. This is because the game looks at a table that determines the width and height of each map name when checking the Town Map.

    The table is located at 0x3F2178. The format is very simple:
    [WW] 00 [HH] 00

    WW = Width
    HH = Height

    Spoiler:

    I'm pretty sure that functionality is built into AdvanceMap 1.92. I did that a couple weeks ago on my Ruby hack. Maybe it's different between RSE and FRLG, though. I'm not sure, and I'm at school so I can't check right now.

    In AM, though, you pull up the world map editor, and on the right there's boxes for the width and height, close to where the position boxes are.
     

    GoGoJJTech

    (☞゚ヮ゚)☞ http://GoGoJJTech.com ☜(゚ヮ゚☜)
    2,475
    Posts
    11
    Years
  • I'm pretty sure that functionality is built into AdvanceMap 1.92. I did that a couple weeks ago on my Ruby hack. Maybe it's different between RSE and FRLG, though. I'm not sure, and I'm at school so I can't check right now.

    In AM, though, you pull up the world map editor, and on the right there's boxes for the width and height, close to where the position boxes are.

    FRLG is more strongly built, so AMAP isn't supporting that. You usually had to make a map that fit kanto before
     
    1,323
    Posts
    16
    Years
    • Seen Dec 9, 2023
    I'm pretty sure that functionality is built into AdvanceMap 1.92. I did that a couple weeks ago on my Ruby hack. Maybe it's different between RSE and FRLG, though. I'm not sure, and I'm at school so I can't check right now.

    In AM, though, you pull up the world map editor, and on the right there's boxes for the width and height, close to where the position boxes are.
    The boxes for width and height is only there if you're hacking Ruby/Sapphire/Emerald. It's not there for FR/LG, so to edit the width/height you would have to refer to the offsets I posted earlier.
     

    kearnseyboy6

    Aussie's Toughest Mudder
    300
    Posts
    15
    Years
    • Seen Jun 22, 2019
    Finally no more trouble with OAK, GARY, HERO introduction sprite palettes!

    They are 256 colours so when you look them up on a palette viewer you might find that OAKs palettes are stored in slots 7 and 8. This means you can have 32 colours for these sprites too!!

    So all you have to go is into Infranview --> decrease colour depth to 32 --> Increase colour depth to 256. Next just move all colours into rows 7 and 8 and save and insert in NLZ-Advance as 256 colours (also make sure your transparent is at the first tile.. I forgot). Then simply hex edit find the palette in the ROM or APE and insert it! Wahla! No more glitchy greenish and red intro sprites!
     
    Back
    Top