• 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] 510 EV cap on CFRU based ROMs

McPaul

On my way to become a controversial and hated memb
288
Posts
6
Years
  • Hello! I want to remove the 510 EV cap on CFRU based ROMs and the check doesn't work the same way as normal GBA games check. I know how it works on normal games with the double check (there is a 40 to be replaced by C0 and a FD 01 to be replaced by F9 05) but this isn't enough on CFRU based ROMs, the EV are still capped at 510 when these two checks are removed.

    Could maybe someone help me please?

    Thanks a lot in advance!
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    Hello! I want to remove the 510 EV cap on CFRU based ROMs and the check doesn't work the same way as normal GBA games check. I know how it works on normal games with the double check (there is a 40 to be replaced by C0 and a FD 01 to be replaced by F9 05) but this isn't enough on CFRU based ROMs, the EV are still capped at 510 when these two checks are removed.

    Could maybe someone help me please?

    Thanks a lot in advance!

    Have you checked the FAQ completely?
    I don't know much about it, but if your problem isn't solved via the faq or an error on your part, I'd assume the upgrade cleared or rewrote the data in places, so values you're trying to change could be in a completely different offset or location. I think the change you need to make should be the same but its just not where you think it should be.

    bugs here; https://github.com/Skeli789/Complete-Fire-Red-Upgrade/blob/master/Bugs.txt

    I'd like to know how to remove or change the cap on a normal rom though. Do you know specific offsets needed?
     
    Last edited:

    McPaul

    On my way to become a controversial and hated memb
    288
    Posts
    6
    Years
  • On a normal Fire Red (Squirrels) it's 40 to C0 on 439E0 and FD 01 to F9 05 on 43A3C.

    To find it on a modified ROM (a CFRU one for example) a took some bytes around and searched them on the CFRU ROM (and found them) but even if it's enough on a clean ROM it isn't on Radical Red or Pokémon Unbound for example.
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    On a normal Fire Red (Squirrels) it's 40 to C0 on 439E0 and FD 01 to F9 05 on 43A3C.

    Wow thanks a lot for that info. dang sorry that couldn't help you, so you're trying to find the data within the patched rom, that used the cfru engine?

    If you patched the regular version of fire red could you find it on that? Maybe I'm wrong(because like i said I don't know much about this besides whats in the thread) but is there even a point to applying a patch(that wasn't already built on the engine) to CFRU?

    I thought the author said the point wasn't to apply patches to the engine but to use that as a creation tool.
    Just trying to help you find a workable solution.

    But if you're just having trouble finding it on a patch for the rom you want to use, all I can recommend is going to the git page for the rom and maybe submit a bug to try and get in touch with who made it and ask them. That or see if theres a changelog that's useful.

    Thanks again for the help, now I just need to figure out what it means so I can set my own values.
     

    McPaul

    On my way to become a controversial and hated memb
    288
    Posts
    6
    Years
  • Still on it! If anyone has an idea for games like Unboubd it's welcome!
     
    990
    Posts
    4
    Years
  • Still on it! If anyone has an idea for games like Unboubd it's welcome!

    There might be a better way to do this, but open up the "bytereplacement" file in a Notepad (located in CFRU master folder), and under "##Optional Byte Changes##", add:
    Code:
    ##EV Cap
    080439E0 C0
    08043A3C F9 05


    I'm not 100% this will work, but you can give it a try.
     

    McPaul

    On my way to become a controversial and hated memb
    288
    Posts
    6
    Years
  • When just using CFRU on a clean ROM i have no problem removing the cap so CFRU is actually not the problem.

    I want to play Pokémon Unbound unfair difficulty but without the EV limit.
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    When just using CFRU on a clean ROM i have no problem removing the cap so CFRU is actually not the problem.

    I want to play Pokémon Unbound unfair difficulty but without the EV limit.

    Gotcha, and for future reference its a good idea to hit the respond button and then the pencil icon to quote me before you comment.
    Apparently because of how the forums are setup quoting is the only way the person you're talking to will get a notification. ( I only found your comment by accident because I hadn't closed this tab yet)

    That aside, I see the normal code that upsurge posted.
    ##EV Cap
    080439E0 C0
    08043A3C F9 05

    Can you show us what the bytes look like at that section of unbound? To try and compare. I don't have that rom so I can' t check it myself.
     

    McPaul

    On my way to become a controversial and hated memb
    288
    Posts
    6
    Years
  • Gotcha, and for future reference its a good idea to hit the respond button and then the pencil icon to quote me before you comment.
    Apparently because of how the forums are setup quoting is the only way the person you're talking to will get a notification. ( I only found your comment by accident because I hadn't closed this tab yet)

    That aside, I see the normal code that upsurge posted.


    Can you show us what the bytes look like at that section of unbound? To try and compare. I don't have that rom so I can' t check it myself.

    The thing is, I found those checks in Unbound. The problem is that there are OTHER checks too (those cited are not enough to bypass the 510 EV limit) and I want to find these other checks.
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    The thing is, I found those checks in Unbound. The problem is that there are OTHER checks too (those cited are not enough to bypass the 510 EV limit) and I want to find these other checks.


    Ok hey man, so I reached out to the rom author and he tried to help me out here's what he says.

    Do you mean the EV cap for stat-boosting items? Iirc there were a whole bunch of changes necessary for that and they're probably in both the CFRU's special_inserts.asm file and bytereplacement file.

    So check out the special insert asm and the bytereplacement file, see if they replaced the offset that's usually used to control evs. It sounds like that may be the case.

    I'm not 100% that will help but I can't think of anything else. Good luck.
     
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023

    Ok I think I found why your change didn't work.
    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.

    So if that solution worked for exp gain, then replacing the value you tried to change with the default one from base fire red should make it work the same way it did in fire red so you can change the bytes you showed me to turn off the limit.

    oh and for reference they were talking in asm. check out hex maniac advance if you don't already have it, that should make it much easier to find and make any changes you'd need to. It can open more than one rom at once so you can have both roms open at the same time for quick transfer.

    Good luck.
     
    Last edited:
    853
    Posts
    3
    Years
    • Seen Nov 9, 2023
    don't know if he got it working but I just thought here was the best place to put this.
    so to remove the squirrels fire red ev cap limiter you change the values at the 2 addresses.

    439E0 from 40 to C0

    43A3C from FD 01 to F9 05

    So quick translation of what I found. the first address value is the per stat limit, 40 in hex translates to 64.
    The second address is for the total ev cap. FD 01 if you reverse that using I think its called little indian or something, its 1FD which is 509.

    The 64 is the max per stat ev stat gain rounded up. 255 evs per stat /4 gives 63.75 gain (which is odd because the values round down ingame.

    The 509 is 1 minus the total ev limit. 255 x 2 = 510

    So the changes aren't exactly removing the limiter completely but raising it to, +192 stat points per stat. & 1152 total evs. The first one is crazy high, and means you can get 768 evs in any one stat.



    edit:
    So I've used modexe to compare since that also deals with ev-cap and I think the above method isn't the complete solution.

    So in mod exe they have a value that says, "Ev's cap to 252" which is useful because pokemon games round down so getting that 64 points is actually impossible.

    But the offsets they have listed for fire red are 0x0439FC & 0x043A02.
    The bytes listed there are listed at FF.

    So I think this part is for the max per stat evs.
    To actually raise the ev cap I believe you'd need to change all 4 of these.

    439E0 - for the amount of stat points you want to gain.

    43A3C - for the total ev cap minus 1.
    &
    0439FC & 043A02 - for the per stat ev cap.


    ok now to bring it back to topic,
    cfru is a C-injector so it uses both binary to directly hack the rom, the decomp-esque C functions to change mechanics and rearrange data automatically without needing touch it directly.


    for CFRU you need to deal with the values for MAX_TOTAL_EVS, totalEvs, & currentEv, all found in the exp.c function around line 699.

    and EV_Cap there, and in asm_defines.s (personally I found I had to remove the value EV_Cap from several values in the defines file, because once I raised it they no longer worked, so I deleted the value ev cap everyone else it was listed that didn't have to do with evs or experience in asm_defines.s and just replaced it with FF so it was still about the same.


    I also added the first two addresses to the file that only listed 0439FC & 043A02, don't know if that's necessary.)


    Now the reason I believe the ev cap fix doesn't work by itself, in base game, totalEVs and currentEV are limited to 1 byte which has a max value of FF aka 255.

    And there's no space to change the second set of addresses that change the actual per stat cap.

    But in cfru you can change the space allocated for the ev values from 1 byte to 2 bytes.

    Changing only the first set without the second, only increases the max evs you can gain, but not the per stat cap.


    So what happens is you can gain a lot more evs, but once the per stat limit is reached, it will just reset to 0. -_-



    Now, you should be able to do this in binary to make it actually work, if there are pointers that lead to those values, what you'd need to do is change the pointer to free space and then type in the value you want. Then the ev cap limit would be changed. (I think) and if you're working with an existing hack, since you can't decompile it again, the binary route is your only option for changing the ev limits.

    So make a cfru file, with the evs set as normal, look through the offset file, and try to find the variables I listed above ev_cap current ev max total evs etc.

    Then use a hex editor and search for instances of that pointer, it should I assume go to values of FC (252) if that is right, keep note of where it is.

    Open your unbound or other cfru patched rom in the hex editor and check the same offset if its the same, then you can change the pointer to go to a place where there's free space.

    Then fill in the value you want.


    For reference incase you don't know.
    A pointer is the offset with the first and last 2 values switched and with an 08 on the end.

    ex.

    123456 becomes 56341208
     
    Last edited:
    173
    Posts
    4
    Years
    • Seen Feb 4, 2024
    does anyone know where these offsets are in emerald?
    6DC2C - for the amount of stat points you want to gain.
    6DC88 - for the total EV cap minus 1.
    6DC48 & 6DC4E - for the per stat EV cap.
     
    Last edited:
    173
    Posts
    4
    Years
    • Seen Feb 4, 2024
    I have this problem too, in CFRU based hack like Unbound it has two "FF 20 40 00" and "47 00 00 FD 01 00", but modify them doesn't work, EV total value still cap at 510... I just wanna see offsets of existing hack ROM not source code.
     
    173
    Posts
    4
    Years
    • Seen Feb 4, 2024
    Oh yeah, I decided to install CFRU manually, and generate two ROMs, one is EV 510, another is EV 1512, then compare them.
    510 EV cap on CFRU based ROMs

    It blows my mind, it's not like vanilla one that use somehow 01FD to compare greater than...
     
    6
    Posts
    338
    Days
    • Seen Nov 24, 2023
    Once I change "On a normal Fire Red (Squirrels) it's 40 to C0 on 439E0 and FD 01 to F9 05 on 43A3C" in Hex Maniac Advance and change the ev.vitamin limit to 255 per stat, how come it still doesn't let me go over the 510 EV cap still to edit every stat to max EVs with vitamins?
     
    6
    Posts
    338
    Days
    • Seen Nov 24, 2023
    In Pokemon Emerald, when you change offsets:

    6DC2C - for the amount of stat points you want to gain.
    6DC88 - for the total EV cap minus 1.
    6DC48 & 6DC4E - for the per stat EV cap.

    It still doesn't let you go over the 510 EV cap through battling like in Fire Red, has anyone been able to figure this out?
     
    Back
    Top