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

[EM] Battle Engine Upgrade (On Halt, Will undergo reboot!)

Status
Not open for further replies.
116
Posts
16
Years
  • There are a couple of major bugs with this engine, so I've described their fixes below:

    -Skill swap makes bad eggs:
    --ctrl+ f ability_change(void), find it in helper_functions.c
    --look through this function for things that sat "u8"
    --replace them with "u16"


    -Volt switch crashing when used in double battles with only two pokemon
    --Ctrl+f jumpifonlyonepokemon(void)
    --Replace the command with this, using correct indenting:

    {
    if (count_party_pokemon(bank_attacker) <= 1)
    battlescripts_curr_instruction = (void*) read_word(battlescripts_curr_instruction);
    else if ((count_party_pokemon(bank_attacker) <= 2) && (battle_flags.double_battle))
    battlescripts_curr_instruction = (void*) read_word(battlescripts_curr_instruction);
    else
    battlescripts_curr_instruction += 4;
    }

    For replace u8 with u16 in the function of ability_change, do I also need to replace all u8 with u16 in the related functions such as findability_in_table and forbidenabilitiestable1, 2, 3, 4?
     
    Last edited:

    luuma

    searching for Meaning, offering HA numel
    162
    Posts
    10
    Years
  • For replace u8 with u16 in the function of ability_change, do I also need to replace all u8 with u16 in the related functions such as findability_in_table and forbidenabilitiestable1, 2, 3, 4?
    those seem to work fine already, but i havent tested it. I'd try with both, and test by using skill swap on a mon with Schooling or Power Construct (power build?) or something. those abilities should be blocked but might not be if a u8 size memory section isnt holding them
     
    116
    Posts
    16
    Years
  • those seem to work fine already, but i havent tested it. I'd try with both, and test by using skill swap on a mon with Schooling or Power Construct (power build?) or something. those abilities should be blocked but might not be if a u8 size memory section isnt holding them
    Does it mean that I need only replace u8 with u16 in the ability_change function except the functions of findability_in_table and forbidenabilitiestable1, 2, 3, 4?
     

    luuma

    searching for Meaning, offering HA numel
    162
    Posts
    10
    Years
  • Does it mean that I need only replace u8 with u16 in the ability_change function except the functions of findability_in_table and forbidenabilitiestable1, 2, 3, 4?

    Yes, you only need to replace u8 with u16 for the ability_change function

    The other functions do not cause the error but may have smaller errors associated with them that do not matter
     
    116
    Posts
    16
    Years
  • Yes, you only need to replace u8 with u16 for the ability_change function

    The other functions do not cause the error but may have smaller errors associated with them that do not matter

    When I compiled the edited code, the following warnings available.
    attachment.php


    Do your compilation shows the above warnings?

    And do you mind to tell me in details about in what situation the skill swap will be made bad eggs?
     

    Attachments

    • 2018-07-25 21_01_03-Command Prompt.png
      2018-07-25 21_01_03-Command Prompt.png
      46.3 KB · Views: 585
    Last edited:

    luuma

    searching for Meaning, offering HA numel
    162
    Posts
    10
    Years
  • When I compiled the edited code, the following warnings available.
    attachment.php


    Do your compilation shows the above warnings?

    And do you mind to tell me in details about in what situation the skill swap will be made bad eggs?

    yes, that error is part of why it fixes the issue

    when the ability is switched, it gets loaded into a couple of offsets in the game's ram, which is basically like a space on a memory card that changes lots. "u8" means it's loaded into 8 individual bits (00000000), changing them to any value from 00000000 to 11111111.
    This is generally enough to store 255 different values, but for some reason (that I don't understand at all) one of the bytes wasn't getting used in this case, so the game was only able to store 127 values.
    This meant that for abilities put in later than ability no.127 (something around sheer force), the game would accidentally change one of the bytes that was being used for something else. and the byte was in use for one of the pokemon in the player's party, so it failed something called a checksum, and was turned into a bad egg.

    Changing the command from u8 to u16 allocates twice as much memory (now has 0000000000000000) as is needed for any ability (which is normally only ever even stored in a u8 slot), but means that it finds space to spare for itself every time and never causes a bad egg. The compiler error is accurate, abilities are only u8 in size, but it still puts it in the massive space it's been given

    will check for any side effects this eve
    EDIT: none I could find :)
     
    Last edited:
    116
    Posts
    16
    Years
  • yes, that error is part of why it fixes the issue

    when the ability is switched, it gets loaded into a couple of offsets in the game's ram, which is basically like a space on a memory card that changes lots. "u8" means it's loaded into 8 individual bits (00000000), changing them to any value from 00000000 to 11111111.
    This is generally enough to store 255 different values, but for some reason (that I don't understand at all) one of the bytes wasn't getting used in this case, so the game was only able to store 127 values.
    This meant that for abilities put in later than ability no.127 (something around sheer force), the game would accidentally change one of the bytes that was being used for something else. and the byte was in use for one of the pokemon in the player's party, so it failed something called a checksum, and was turned into a bad egg.

    Changing the command from u8 to u16 allocates twice as much memory (now has 0000000000000000) as is needed for any ability (which is normally only ever even stored in a u8 slot), but means that it finds space to spare for itself every time and never causes a bad egg. The compiler error is accurate, abilities are only u8 in size, but it still puts it in the massive space it's been given

    will check for any side effects this eve

    It's very very details. Thanks in advance.
     
    157
    Posts
    7
    Years
    • Seen Nov 19, 2023
    So I've just implemented the hacked engine into my rom including the pokeball expansion. Unfortunately Pokemon immediately break free of all the new pokeballs unless this battle engine is installed with the pokeball expansion. I was wondering if anyone should help me get the expanded pokeballs to function correctly either without installing the battle engine or how to install the battle engine and then delete all of it from my rom other than the pokeball functionality. Any info on this would be really appreciated.
     

    Sefuree

    Canada Goose
    3,183
    Posts
    10
    Years
  • I have multiple problems, going thorugh the installation guide.

    1. Clicking the first link, i can not download the required files, because there is nothing to download: https://sourceforge.net/projects/devkitpro/files/latest/download?source=typ_redirect

    2. Clicking the second link, i can not download the required files, because there is nothing to download: https://sourceforge.net/projects/devkitpro/files/devkitARM/devkitARM_r45/

    Does anyone have devkitARM r45's setup file still since it no longer exists.

    Whenever I click the links to try and download, there's nothing there, even after I click the blue arrow. Thanks!

    You can still get devkitARM r45 setup in this pc thread
    https://www.pokecommunity.com/showthread.php?p=9907673
     
    Last edited:
    113
    Posts
    9
    Years
    • Seen Aug 3, 2023
    Has anybody been able to solve the issue where PGE throws an error when you use this hack in conjunction with Expanded Pokemon? It throws the error when you attempt to edit the added Pokemon and it seems to stem from the repointed attack table. I've messed around with the PGE ini several times, but I just can't figure out how to fix this.

    Relevant INI
    Spoiler:


    The error I'm getting is basically telling me the data I'm trying to access is out of bounds.
     
    Last edited:
    Status
    Not open for further replies.
    Back
    Top