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

Red hack: Shin Pokemon Red/Blue/Green/JP builds (Bugfix, AI, and QoL patch)

darthbr

Banned
237
Posts
8
Years
    • Seen Dec 8, 2023
    In lite version, pokemon trainers are changing pokemons a lot, kind annoying, how do i change this?

    obs: i found a bug IN LITE, that i used in my own version, in cerulean cave, when u enter, then surf, pokemons are at lv 113 , why? whats wrong? sometimes missigno appears There and bugged too..


    just noticed in ''master'' one, theres no pokemons encounter while surfing..
     
    Last edited:
    536
    Posts
    4
    Years
    • Seen today
    In lite version, pokemon trainers are changing pokemons a lot, kind annoying, how do i change this?

    obs: i found a bug IN LITE, that i used in my own version, in cerulean cave, when u enter, then surf, pokemons are at lv 113 , why? whats wrong? sometimes missigno appears There and bugged too..


    just noticed in ''master'' one, theres no pokemons encounter while surfing..

    Cerulean cave has no wild pokemon data for surfing. You must have changed something. wWaterRate (wram location d8a4) should be zero in that location. Go to that map's file in data/wildPokemon and make sure it the last line is "db $00". You need that there because it copies 00 into wWaterRate.

    AI is handled in engine/battle/trainer_ai.asm and you want to look at AIMoveChoiceModification4. Study it and tweak as you please.
     

    darthbr

    Banned
    237
    Posts
    8
    Years
    • Seen Dec 8, 2023
    Cerulean cave has no wild pokemon data for surfing. You must have changed something. wWaterRate (wram location d8a4) should be zero in that location. Go to that map's file in data/wildPokemon and make sure it the last line is "db $00". You need that there because it copies 00 into wWaterRate.

    AI is handled in engine/battle/trainer_ai.asm and you want to look at AIMoveChoiceModification4. Study it and tweak as you please.


    Thanks for the help, i checked it, its set db $00. when i use surf, wild pokemons from there appears at level 113 (the ''L'') doesnt appear, and missigno appears too.. i really dont know whats happening, the whole game is ok, i played it since 0 to e4, went to cerulean cave then it started.. maybe the mew event??? i removed it but still bugged. if i dont solve this i will remove my game from forum =(

    Thanks anyway for your help!!
     
    536
    Posts
    4
    Years
    • Seen today
    Thanks for the help, i checked it, its set db $00. when i use surf, wild pokemons from there appears at level 113 (the ''L'') doesnt appear, and missigno appears too.. i really dont know whats happening, the whole game is ok, i played it since 0 to e4, went to cerulean cave then it started.. maybe the mew event??? i removed it but still bugged. if i dont solve this i will remove my game from forum =(

    Thanks anyway for your help!!

    Just take it one step at a time and work backwards. You are getting wrong encounters while surfing in level 1 of cerulean cave right? Lets look at the function for wild mons on that level.

    DungeonMons1: in data/wildPokemon/unknowndungeon1.asm

    Make sure this terminates in db $00. If so, then something else is the problem. What actually calls or points to DungeonMons1? Let's do a search.

    We find that there is only one reference. It's a 2-byte pointer in the function WildDataPointers: in the file data/wild_mons.asm. There's even some comments in here that describe how the individual encounter files work. DungeonMons1 is on line 230, so its position in the pointer list is 228 in decimal or $E4 in hex. Checking map_constants.asm shows that this lines right up with level 1 of cerulean cave, which is map $E4.

    Now let's search for what refers to WildDataPointers. There's items.asm, but that's for locations on the pokedex map. Not useful. There's engine/overworld/wild_mons.asm as well, and that is very useful. There's a single function called LoadWildData.

    The first thing it does is get the current map number, $E4. It then traverses WildDataPointers so that register HL holds the location of the E4th entry on the list, DungeonMons1. Then it grabs the first byte of DungeonMons1 into register A, $0A. Since this is not zero, there is grass/cave encounter data that gets copied into a buffer and the value in register A becomes the encounter rate in wGrassRate. There are exactly 20 bytes (hex $14) that get copied into this buffer, so encounter lists must all be the same size and format. After the grass encounter list it gets the next byte of DungeonMons1 into register A, $00. Since this is zero, there is no encounter data for surfing on water and wWaterRate is set to $00. The function then returns. If the number in register A was not $00, then obviously it would try to load data into the buffer called wWaterMons and you'd have a non-zero number in wWaterRate.

    Final thing to check is engine/battle/wild_encounters.asm. There's a function there called TryDoWildEncounter. This handles all the checks of doing a wild encounter. Study the comments in this well to understand the circumstances where a wild battle is even allowed
     

    darthbr

    Banned
    237
    Posts
    8
    Years
    • Seen Dec 8, 2023
    Just take it one step at a time and work backwards. You are getting wrong encounters while surfing in level 1 of cerulean cave right? Lets look at the function for wild mons on that level.



    Make sure this terminates in db $00. If so, then something else is the problem. What actually calls or points to DungeonMons1? Let's do a search.

    We find that there is only one reference. It's a 2-byte pointer in the function WildDataPointers: in the file data/wild_mons.asm. There's even some comments in here that describe how the individual encounter files work. DungeonMons1 is on line 230, so its position in the pointer list is 228 in decimal or $E4 in hex. Checking map_constants.asm shows that this lines right up with level 1 of cerulean cave, which is map $E4.

    Now let's search for what refers to WildDataPointers. There's items.asm, but that's for locations on the pokedex map. Not useful. There's engine/overworld/wild_mons.asm as well, and that is very useful. There's a single function called LoadWildData.

    The first thing it does is get the current map number, $E4. It then traverses WildDataPointers so that register HL holds the location of the E4th entry on the list, DungeonMons1. Then it grabs the first byte of DungeonMons1 into register A, $0A. Since this is not zero, there is grass/cave encounter data that gets copied into a buffer and the value in register A becomes the encounter rate in wGrassRate. There are exactly 20 bytes (hex $14) that get copied into this buffer, so encounter lists must all be the same size and format. After the grass encounter list it gets the next byte of DungeonMons1 into register A, $00. Since this is zero, there is no encounter data for surfing on water and wWaterRate is set to $00. The function then returns. If the number in register A was not $00, then obviously it would try to load data into the buffer called wWaterMons and you'd have a non-zero number in wWaterRate.

    Final thing to check is engine/battle/wild_encounters.asm. There's a function there called TryDoWildEncounter. This handles all the checks of doing a wild encounter. Study the comments in this well to understand the circumstances where a wild battle is even allowed

    I really tried evertthing, but i dont know whats happening, just in this water... i will send to you PM my souce, you dont have to help me, but its my last attempt, if you could find whats happening..
     
    536
    Posts
    4
    Years
    • Seen today
    I really tried evertthin
    g, but i dont know whats happening, just in this water... i will send to you PM my souce, you dont have to help me, but its my last attempt, if you could find whats happening..

    Sometimes the hardest fixes are the most obvious. I loaded up your hack in the BGB debugger with the .sym file so I get the source code names for everything and started checking through the functions I mentioned in my previous post. First thing I did was head into the water of cerulean cave 1 and set a breakpoint for TryDoWildEncounter. I stepped through line by line verifying that what each line did was correct. As you can see from Capture1.png, the water rate is $33 instead of $00. That will cause surfing encounters when there is no surfing pokemon data. It's the same as how the cinnabar shoreline glitch used to work.

    Then I checked the LoadWildData function. See Capture2.png. It was doing everything correctly, yet still $33 was getting loaded into wWaterRate instead of $00. Encounter lists are exactly $14 bytes long (20 in decimal). No more and no less. That means 10 pokemon slots per map. This number is hard-coded.

    Now see Capture3.png and the problem becomes obvious. You are missing a pokemon entry, so your encounter list for cerulean cave 1 is only $12 bytes long. The LoadWildData function skips over your db $00 terminator and instead grabs the whatever value is two bytes beyond it.

    I checked the other two maps for cerulean cave and they also have only 9 pokemon. You need to go over your encounter lists and make sure they all have10 slots accounted for.
     

    Attachments

    • Shin Pokemon Red/Blue/Green/JP builds (Bugfix, AI, and QoL patch)
      Capture1.PNG
      84.2 KB · Views: 6
    • Shin Pokemon Red/Blue/Green/JP builds (Bugfix, AI, and QoL patch)
      Capture2.PNG
      33.8 KB · Views: 6
    • Shin Pokemon Red/Blue/Green/JP builds (Bugfix, AI, and QoL patch)
      Capture3.PNG
      27.7 KB · Views: 11

    darthbr

    Banned
    237
    Posts
    8
    Years
    • Seen Dec 8, 2023
    Sometimes the hardest fixes are the most obvious. I loaded up your hack in the BGB debugger with the .sym file so I get the source code names for everything and started checking through the functions I mentioned in my previous post. First thing I did was head into the water of cerulean cave 1 and set a breakpoint for TryDoWildEncounter. I stepped through line by line verifying that what each line did was correct. As you can see from Capture1.png, the water rate is $33 instead of $00. That will cause surfing encounters when there is no surfing pokemon data. It's the same as how the cinnabar shoreline glitch used to work.

    Then I checked the LoadWildData function. See Capture2.png. It was doing everything correctly, yet still $33 was getting loaded into wWaterRate instead of $00. Encounter lists are exactly $14 bytes long (20 in decimal). No more and no less. That means 10 pokemon slots per map. This number is hard-coded.

    Now see Capture3.png and the problem becomes obvious. You are missing a pokemon entry, so your encounter list for cerulean cave 1 is only $12 bytes long. The LoadWildData function skips over your db $00 terminator and instead grabs the whatever value is two bytes beyond it.

    I checked the other two maps for cerulean cave and they also have only 9 pokemon. You need to go over your encounter lists and make sure they all have10 slots accounted for.

    Omg really????? wow im very impressed!! thanks a lot your help, one more time, i sorry for disturbing, i wish you the best!! one more lesson that i learned... your hack is awesome, i played master last day, awesome coded.
     
    536
    Posts
    4
    Years
    • Seen today
    V1.13 has had a couple minor hotfixes. New patch is up. This prevents rocket hideout floor 3 from crashing and prevents female trainer sprites from glitching at the hall of fame.
     
    536
    Posts
    4
    Years
    • Seen today
    Another minor bugfix for both the master and lite branches. This prevents the flag for ghost marowak from getting stuck if you run from it. The flag getting stuck would result in all wild pokemon having the sprite and name for the GHOST without he silph scope until ghost marowak was defeated or ghost marowak blacked you out.
     
    536
    Posts
    4
    Years
    • Seen today
    Hmm...looks like it might be possible to backport the color functionality from pokemon yellow. This takes the Super Gamboy palettes that are already there and translates them to a format the Gameboy Color can understand. I'll take some time to study this.
     

    Chronosplit

    I play for keeps!
    492
    Posts
    13
    Years
    • Seen today
    Hmm...looks like it might be possible to backport the color functionality from pokemon yellow. This takes the Super Gamboy palettes that are already there and translates them to a format the Gameboy Color can understand. I'll take some time to study this.
    Interesting! Does this also translate well to Yellow's sprites?
     
    536
    Posts
    4
    Years
    • Seen today
    Interesting! Does this also translate well to Yellow's sprites?

    It will. Yellow's sprites are all in grayscale. The super gameboy palettes are used to give them color. They seems to be the same as red/blue. Yellow just has additional functions that convert the SGB palette packets into a form that can be displayed by the GBC.

    The SGB applies color in a very simple manner. It just palette-swaps the standard 4 grayscale colors with four other colors of choice. Pokémon goes two steps further and can apply a different palette swap to each quadrant of the screen and switch out palettes on the fly (most obvious during battle).
     

    JOBO

    o/_\O
    633
    Posts
    9
    Years
  • Hey Jojobear13! I'm loving shin Pokemon red and have been playing it for quite some time. I booted it up today and experienced a strange bug. I went to my personal pc to deposit some items, when I tried to deposit the coin case the game crashed. I rebooted, went to the PC again and it crashed a second time. I'm playing on "shin_pokemon_red_v113_hotfix3.ips". If you need any more info or a save file then let me know. Cheers :)
     
    9
    Posts
    3
    Years
    • Seen Jan 19, 2021
    Hey Jojobear13 I have what likely amounts to a silly question but I'm not sure what to do with the sunbathing pokemon in Vermilion to get past him?

    Loving your work thanks for all your hard efforts to bring such a nice rom to the community
     

    darthbr

    Banned
    237
    Posts
    8
    Years
    • Seen Dec 8, 2023
    What is the possibility to apply that danny E colored patch for those roms? i tried the vanilla patch in a clean rom then patch the lite one, but not sucefull, was it hard to modify?
     
    536
    Posts
    4
    Years
    • Seen today
    Hey Jojobear13! I'm loving shin Pokemon red and have been playing it for quite some time. I booted it up today and experienced a strange bug. I went to my personal pc to deposit some items, when I tried to deposit the coin case the game crashed. I rebooted, went to the PC again and it crashed a second time. I'm playing on "shin_pokemon_red_v113_hotfix3.ips". If you need any more info or a save file then let me know. Cheers :)

    I cannot replicate this. Everything seems to be working fine. I would need your .SAV file.

    Hey Jojobear13 I have what likely amounts to a silly question but I'm not sure what to do with the sunbathing pokemon in Vermilion to get past him?

    Loving your work thanks for all your hard efforts to bring such a nice rom to the community

    Get HM01 from the SS Anne. Unlike the original shrub that was there, the pokemon leaves permanently.

    What is the possibility to apply that danny E colored patch for those roms? i tried the vanilla patch in a clean rom then patch the lite one, but not sucefull, was it hard to modify?

    The possibility is zero. DannyE's patch is a massive overhaul of the graphics engine that essentially turns the game into a gameboy color exclusive. The code bases are barely comparable.
     
    Back
    Top