• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

JPAN's Hacked Engine Issues

Originally posted by karatekid552 on Pokémon Hackers Online

A lot of Gen III Pokemon hackers have found JPAN's Hacked Engine to be extremely useful, as it adds a lot of new functions and options when creating their own hack. However, like all great hacks, it has its issues. So far, I have only come across a few, but my goal here is to create a specific thread for these bugs (a list will be kept in this first post), and for people who need help using the hack in general.

Known Issues and Solutions:
(these are all for version 1.1)

The Patch:
  • Problem: Can't fly to locations.

    Solution: You need to restore the header scripts that set the world map flags for each town. This can be done by creating new versions of the scripts in each map header that just say "setworldmapflag 0xXXX". You can reference these in a clean rom.

  • Problem: Upon losing a battle, the player doesn't go to a Pokecenter.

    Solution: Same as the flying one, you need to restore the scripts. However, JPAN completely hacked the sethealingplace command that takes care of this, so you will need to write new scripts. These will go in the header for each PC. The new syntax can be found in the .doc file that came with the hacked engine.

  • Problem: The player is always fishing.

    This really isn't an issue. It is because you are using your save file from a normal FireRed game. In a regular FR game, that var that controls the walking OW is used for other things, but when JPAN erased all of the scripts, he used this var to control OWs. Therefore, it is already going to be set to something else. Simply write a script to set all of the vars that control things like OWs, backsprites, and trainersprites to 0, and similar issues will disappear also.

The Tool:
  • Problem: The OW when the player goes to surf become all screwed up and freezes the game.

    Solution: Go to 0x5F2D0 in a hex editor. You should see a pointer, follow it. Now, jump ten bytes ahead (you should end up on the next row, one byte down and to the left of where you started) and change the byte to FF. The byte you need to change comes after a string of: 29 18 D0. So now, that string looks like 29 18 D0 FF.

    Also, you have to reset all of the vars you selected for the player OW switch. There should be 7 of them. Using a script right near the beginning of the game, set them all to 0. I used vars 0x408F -> 0x4096, so my script, at some point, would contain:
    setvar 0x408F 0x0
    setvar 0x4090 0x0
    setvar 0x4091 0x0
    setvar 0x4092 0x0
    setvar 0x4093 0x0
    setvar 0x4094 0x0
    setvar 0x4095 0x0
    setvar 0x4096 0x0
    Now it should work!

  • Problem: When using the hero backsprite switch, there is an issue where the opposing trainers palette is forced to be the hero's palette.

    Solution: Using a hex editor, search for this in your rom:
    43 01 C0 00 C0 18 E4 00 0C 19 04 19 23 68 00 2B 0C D0 60 68 0A 49 10 22 0B DF C0 24 09 19 0B DF 08 49 0B DF 09 19
    There should only be one result. The very next two bytes need to be change to C0 46, so now the string will look like:
    43 01 C0 00 C0 18 E4 00 0C 19 04 19 23 68 00 2B 0C D0 60 68 0A 49 10 22 0B DF C0 24 09 19 0B DF 08 49 0B DF 09 19 [B][I]C0 46[/I][/B]
    and it should work!

  • Problem: OWs only reload on warp.

    Solution: This isn't an issue, it was coded this way on purpose because it can get complicated loading OWs in runtime. However, if you have some ASM skills, see this thread: http://www.romhackersonline.com/showthread.php?t=14286

  • Problem: When using the hero backsprite switch on NO$GBA, it doesn't work, but when running it in VBA, it works perfectly.

    Solution: This is what happens when you don't use a BIOS file on VBA, mistakes are made. For the non-ASM folks, the explanation might not make sense, so I'll just spoiler it:

    JPAN used SWI 0xB (CPUSET) to copy the frames into the VRAM. The issue with this, is that he worked in this order:

    -Store new BS pointer in r3
    -Write new palettes in. (Using SWI 0xB)
    -Move r3 to r0.
    -Store BS in VRAM.

    On VBA, r3 is safe when you use SWI 0xB without a BIOS file. However, when using a real BIOS file, SWI 0xB overwrites r3 in the process. The number, at least for me, is always 170. So, when this gets moved into r0 and used as the source address for the image, the game just ignores it because it doesn't read from BIOS. (I think.XD) Credits to Jambo51 for having me look into that.

    Now, for the fix! Remember to see the first issue in this section also, as they are the same routine (he really botched this one, haha, but we love him anyways.<3) so you can kill two birds with one stone. Now, follow these instructions:
    First, go to 0x7630 in a hex editor and follow the pointer.
    To relay the rest of the instructions, I'm going to use this format:
    [CENTER][7630]+XX = YYYY[/CENTER]
    This means, "at the address "0x7630 + 0xXX", paste-write/type YYYY as is." Most of you already know this, but for newers guys and girls, this could confuse them. So, onto the fix:
    (Friendly reminder: This is all in HEX!)
    [7630] + 72 = 9A 46       (Before palette insertion, store r3 in r10 for safe keeping)
    [7630] + 74 = 00 00       (remove a now useless branch, as our last change removed a cmp)
    [7630] + 88 = 53 46       (recover the sprite location from r10 and mov it back to r3)
    [B]Optional:[/B] [7630] + 8A = CA 46        (may cause or prevent issues, idk, not necessary. Moves r9 onto r10. At this point, r9 should be 0 (and always is, at least for me), so this will reset r10 back to 0. Leaving r10 alone doesn't cause any issues for me, but this is for anyone who feels they need to reset r10.)
    Please note, that this removes JPAN's safety net, so that if a blank pointer (00000000) is loaded, the default BS is loaded instead. I did this because it was the only code at which I could add in the extra instructions required without making the routine longer and repointing. This error could occur if you load a BS outside of the region of the table that has been filled, but the the rom most likely won't crash, it will simply just show a blank sprite in most cases. So, if you see one, then you know what went wrong.

  • Problem: If you wanted to load an overworld sprite palette into almost any slot besides 0xA, then the game would not load the palette again after a fadescreen (such as going into a menu then back).

    Solution: Replace six bytes starting at at 0x5EECE with 00. [credit: diegoisawesome]

  • Problem: If you apply JPAN's Engine over a Pokémon Fire Red ROM, the special (0xF9) used for the PC script in the Player's room will not function properly:

    1) Compile this script: https://pastebin.com/raw/1ZLf0AXX
    2) Modify setmaptile according to the ID of the tile of the player's PC in Advance Map.
    3) Replace the one inside the main character's room with it and save. [credit: Mystelex]

Feel free to post any and all issues you have with the hack that have not been submitted already.