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

[ASM & Hex✓] [SOLVED](Fire Red) Making an ASM routine for disabling EXP gain easily insertable into hacks

Manekimoney

Banned
169
Posts
6
Years
    • Seen Jan 18, 2024
    (This post is made by an ASM noob, so apologies if it's a dumb question)

    THIS ASM routine can make it possible for the hacker to disable EXP gain by checking a simple flag. It works by making ever pokemon act as level 100, so it probably also works with many added features, like Gen 6 EXP shares and such.

    Full routine:

    Spoiler:


    Due to it's simplicity, you should be able to insert into pretty much any ROM hack that has at least a little bit of free space and didn't modify its EXP gaining code too much.
    However, the routine works by enabling a flag.

    (this line of the routine does the flag thing):
    Code:
    ldr r2, =(0x806E6D0 +1) @checkflag 0xFF *0x2 + 4 = 0x202

    I want to modify the routine so either it's pernamently activated, or at the very least, it is enabled by a flag that the player is expected to pernamently have activated (for example, flag 0x828, which enables your Pokemon team menu).
    With this change, the routine could be inserted into quite a few ROM hacks (including already made ones, like Radical Red, Glazed etc.) and pernamently disabling EXP in them without any other fiddling.

    My knowledge of ASM hacking is bottom of the barrel, so sadly I don't know how to make practical edits to ASM routines or even how to edit this simple flag in the ASM (and I didn't really manage to find any resource on flag locations)

    Any help or advice is appreciated.
     
    Last edited:
    13
    Posts
    3
    Years
    • Seen Jan 19, 2021
    Code:
    dynamic 0x[your offset]
    
    
    
    
    #org @start
    setflag 0x[your flag]
    msgbox @txt msg_normal
    end
    
    #org @txt
    = Flag Activated!

    Add an Event on A-Map,search for Free Space on FSF,assign the Free Space to the Event,Open the event's script;edit it and past the above code

    Where [your offset] is an offset with Free Space where you'd like to insert the script and [your flag] is the flag for activating this battle system,you must talk to the event if you want this system to be activated,I advise you to make the event in front of the player's bedroom door,and make a hidesprite later...
     

    Manekimoney

    Banned
    169
    Posts
    6
    Years
    • Seen Jan 18, 2024
    Code:
    dynamic 0x[your offset]
    
    #org @start
    setflag 0x[your flag]
    msgbox @txt msg_normal
    end
    
    #org @txt
    = Flag Activated!

    Add an Event on A-Map,search for Free Space on FSF,assign the Free Space to the Event,Open the event's script;edit it and past the above code

    Where [your offset] is an offset with Free Space where you'd like to insert the script and [your flag] is the flag for activating this battle system,you must talk to the event if you want this system to be activated,I advise you to make the event in front of the player's bedroom door,and make a hidesprite later...


    Well, I know how that works. The problem I have is that many already made ROM hacks can already have the flag 0x202 (which the ASM routine uses), already used in other stuff. This would mean that setting the 0x202 flag by just inserting a random NPC could have consequences, like breaking story important events or completely softlocking the game.

    There's also a thing for hacks that cannot be opened up with Advance map due to them messing around with the game's code too much.

    But yeah, your solution does work if I would be just making a Pokemon ROM hack. My main post wasn't clear in what I actually want, sorry.
    I want an ASM routine, that could be inserted into any already made ROM hack (for example, Pokemon Radical Red or Glazed) and as soon as it is inserted, without any map fiddling, you would have EXP disabled for the entire game.
     
    13
    Posts
    3
    Years
    • Seen Jan 19, 2021
    You can use this routine on ANY game,for Game like Radical Red they will surely expand the safe flags like in JPAN's Tut,and Nobody's gonna use that little flag,there are a lot other flags like 5XX.......
    Just test you'll see that I'm right ;)
     

    Manekimoney

    Banned
    169
    Posts
    6
    Years
    • Seen Jan 18, 2024
    You can use this routine on ANY game,for Game like Radical Red they will surely expand the safe flags like in JPAN's Tut,and Nobody's gonna use that little flag,there are a lot other flags like 5XX.......
    Just test you'll see that I'm right ;)

    Yeah, it might work on some hacks, but only one way to find out. Hopefully the game doesn't softlock partway through lol

    I'll try it out, but will still leave the thread unsolved, since this method can still lead to issues when playing a ROM hack that just happens to use the 0x202 flag.
     

    Manekimoney

    Banned
    169
    Posts
    6
    Years
    • Seen Jan 18, 2024
    Write C0 46 at 21CFC to disable exp gain

    I tested it. It does work on base Fire Red. It's safe to assume that it also works on ROM hacks that didn't mess with EXP gain.

    When I tested it on a ROM hack like Radical Red, it didn't work, even though the hex code around 21CFC is 99.9% identical, so it seems that the "true" EXP code is actually located completely elsewhere.
    It seems that for a hack like that, I'll probably need to learn a bit on how Complete Fire Red upgrade works.

    This is still a very useful info, so thank you
     
    13
    Posts
    3
    Years
    • Seen Jan 19, 2021
    Do you know how to modify this routine ?
    Spoiler:

    If you know you'll be able to change the flag to an already activated flag if not then

    Code:
    .text
    .align 2
    .thumb
    .thumb_func
    
    main:
    	push {r0-r3}
    	mov r0, #0xFF
    	lsl r0, r0, #0x1
    	add r0, r0, #0x4
    	ldr r2, =(0x806E6D0 +1) @checkflag 0xFF + 25 = 124
    	bl linker
    	cmp r0, #0x1
    	beq skip
    	pop {r0-r3}
    	cmp r0, #0x64
    	beq noCrash
    	ldr r0, =(0x8021D24 +1)
    	bx r0
    	
    skip:
    	pop {r0-r3}
    	
    noCrash:
    	ldr r1, [r5]
    	add r1, #0x53
    	ldrb r0, [r1]
    	ldr r2, =(0x8021D04 +1)
    
    linker:
    	bx r2
    		
    .align 2
    I don't know if it will work but it point to the flag 124,I think it's already activated in Every Game but I'M NOT SURE!

    Btw you can ask FBI too
     

    Manekimoney

    Banned
    169
    Posts
    6
    Years
    • Seen Jan 18, 2024
    ldr r2, =(0x806E6D0 +1) @checkflag 0xFF + 25 = 124
    I'm pretty sure this just changes a comment that is in the ASM routine, not the actual function of the routine.

    Also, there's no point to searching to an alternative solution with this anymore. Anon822's solution works on pretty much anything that this routine would have.

    I'll probaby tag this thread as solved shortly since the main ASM problem (or at least it's function) is solved, unless someone can provide some further help for disabling EXP in hacks that use a different EXP systems than base Fire Red
     
    Last edited:
    13
    Posts
    3
    Years
    • Seen Jan 19, 2021
    Sorry xD I'm not very good at asm

    Also there's a lot of person who knows ASM and are active ! Spherical Ice for example
     
    453
    Posts
    6
    Years
    • Seen May 17, 2024
    The edit I posted doesn't work with CFRU hacks because CFRU uses its own table for battle script commands, and in this table atk23 is replaced with a new implementation.
    I quickly tried replacing the atk23 pointer in this table with the default atk23 pointer, and it seemed to work fine for disabling exp gain in radical red.
     

    Manekimoney

    Banned
    169
    Posts
    6
    Years
    • Seen Jan 18, 2024
    The edit I posted doesn't work with CFRU hacks because CFRU uses its own table for battle script commands, and in this table atk23 is replaced with a new implementation.
    I quickly tried replacing the atk23 pointer in this table with the default atk23 pointer, and it seemed to work fine for disabling exp gain in radical red.

    What's the default atk23 pointer? It seems that I may be able to fix it up myself then.
     

    Manekimoney

    Banned
    169
    Posts
    6
    Years
    • Seen Jan 18, 2024
    atk23 starts at 0x8021A68, which you could find from the pokefirered linker map or knizz's idb.

    Alright, got the EXP disable working. Thank you very much.

    I did try to locate it with a map file, but I couldn't find an offset that was even close to 0x8021A68. Perhaps I was looking at a wrong file or something. All I found for that location is this in my map file:
    Code:
                    0x08217818                gFont4JapaneseGlyphs
                    0x0821f818                gFont4JapaneseGlyphWidths

    The atk23 file SHOULD have been in between that tho, so maybe I was using a wrong map file from a modified ROM file or something.


    ---------------------------------------------------------------

    For anyone else wondering on how to do it.

    HOW TO DISABLE EXP ON "COMPLETE FIRE RED UPGRADE" HACKS (that changed the EXP formula from original Fire Red):

    First, you need to find the pointer that corresponds for the EXP gaining formula (atk23_getexp) in the ROM hack that uses "Complete Fire Red Upgrade".

    This spoiler showcases how you can locate the pointer in hacks other than Radical Red. If you just want to disable EXP for Radical Red 2.1, you can just skip this.
    Spoiler:


    Anyway the pointer you will find for "atk23_getexp" in Radical Red 2.1 would be: 29 3A 47 09, located at 1436ED8


    Now that you found the pointer to edit, fix it to the one that should correspond to the original Fire Red one : 69 1A 02 08

    Only one thing left to edit. Changing the original Fire Red EXP formula to not give any EXP. Go to 21CFC and insert C0 46. That's it.

    If everything was done correctly, your pokemon should simply skip the EXP gaining at the end of every opponent pokemon KO.


    Big thanks to Anon822 for helping me figure it out.
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    THIS ASM routine can make it possible for the hacker to disable EXP gain by checking a simple flag. It works by making ever pokemon act as level 100, so it probably also works with many added features, like Gen 6 EXP shares and such.

    Wow once again, you're looking into the exact thing i was interested in too, I had the idea to try setting them to 100 as a simple fix but i was worried that would affect other things.

    Like stat gains from evs etc. since those are gained by level, can you explain how this script tricks the game into seeing level 100 but not affecting stats?
     

    Manekimoney

    Banned
    169
    Posts
    6
    Years
    • Seen Jan 18, 2024
    Wow once again, you're looking into the exact thing i was interested in too, I had the idea to try setting them to 100 as a simple fix but i was worried that would affect other things.

    Like stat gains from evs etc. since those are gained by level, can you explain how this script tricks the game into seeing level 100 but not affecting stats?

    Well, sadly, this particular solution does affect EVs (since it seems to skip the entire procedure after fainting a Pokemon, which probably includes gaining EVs). While I don't know how to remove EXP gain completely (at least in Gen 3 games), while not affecting EVs, one way to sort of circumvent this problem would be to make Vitamins super buffed and easily accessible.
    The only other way that I know off to """disable""" EXP, is to edit each and every Pokemon's EXP gained from them to 1 (you cannot set it to 0 in gen 3 games). This would make it so it takes like a 100-1000 battles to gain a level, however, it is not as "legitimate", since normal leveling up is still completely possible.

    The one other way that comes to mind (that I didn't figure out yet) AND would work with EVs, is to locate the EXP gaining formula, and find a way to multiply it by 0 or some other edit that removes any EXP gained.
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    The one other way that comes to mind (that I didn't figure out yet) AND would work with EVs, is to locate the EXP gaining formula, and find a way to multiply it by 0 or some other edit that removes any EXP gained.

    Thanks for taking the time to respond even after your thread was solved.
    And yeah that's what I was looking at as my answer, I'm look into creating a series of training items, to make ev training go easier.

    Sometimes you want exp but not evs if you have strong pokemon being used to train weaker ones.
    Or you just want to progress without worrying about messing up your evs.
    But other times you'd want neither or evs without exp, if the you're in danger of over-leveling but haven't finished ev training your main pokmeon yet.
    I'm still looking but at this point idk if its even possible to separate the two.


    But it sounds like if I'm not too picky that lvl 100 trick would work perfectly for me. I think most held effect items are done by flag anyway, so it should work pretty well.
     
    1
    Posts
    3
    Years
    • Seen Jun 26, 2022
    This is great, it fits perfectly with a potencially competitive hack. Also, I notice Radical Red has the forced set battle style (cant switch pokémon when K.O). I am working with CFRU rom and tried modifying this without any succes: 28 92 87 1D 08 at x1D8727 (it worked on the original fire red, but not in the CFRU since it has its own new implementation).

    By chance, do anyone know how to force set battle style in CFRU?

    Dont know if this is the right place to ask, sorry if so, thanks in advance.
     
    Back
    Top