Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Emulation & ROM Hacking

Pokemon Yellow romhack - Problems with corrupted sprites - Page 1

Pokemon Yellow romhack - Problems with corrupted sprites

Posted by: Finish3r
Date: 2020-05-02 12:04:55
Deleted original post from Gen 1 glitch discussion, didn't see this board, duh

Hello! First of all, this is about a small romhack I'm making. I just got a random inspiration couple of days ago, and decided to add Gorochu (lost evolution of Pikachu and Raichu) back to the game. Since I've been having problems with it, I decided to post here, as I've been lurking here a long time, and you've probably reverse-engineered the game so well that you'd know what is wrong here.

First, I downloaded a Pokemon Yellow (US) ROM disassembly, and started looking how the game was made, and inserted Gorochu in accordingly. I have been building ROM's inbetween to check that everything is working, and happened to keep one where Gorochu itself is like a even more random and corrupting 4 4, and 4 4 itself is not harmful at all, haha!

So, I've gotten almost everything working to this point. I inserted Gorochu to hex $56 (former Missingno. and next slot after Pikachu and Raichu for convenience), and coded him to be Pokedex number #027, moving every other pokemon after that up one slot (Mew now being #152). Base stats, typing, cries, Pokedex entries and everything seems to be working fine. Only thing; Gorochu's sprite is corrupted, and every Pokemon after that (in Pokedex order) are corrupted with Mew even causing a 4 4-like effect. I haven't checked every single one, but it seems that way. Keep in mind that Gorochu has it's own custom sprites and they are coded to load in like any other Pokemon.

It seems like something is going wrong in sprite decompression (not sure, just guessing), the sprite just don't seem to load in properly, and with very wrong data. I've looked through the code many times and I can't find anything wrong, no typos, anything. Also every file where other Pokemons are mentioned, I've added Gorochu in the same way.

Could it be some pointers messed up or misaligned data otherwise? zero experience speaking, first time etc. Where should I be looking at? Also, I know this is very little info to work with, so if you need any other things (code, ROM, anything) just ask. Thanks!

EDIT 1: Looked through many Pokemon, found out EVERYTHING after Gorochu has a glitched sprite, and cause varying degrees of memory corruption. Seems like the game somehow messed up the sprite pointers and sprite data in general. How could this affect Gorochu and later in Pokedex order (#027-152), I don't yet know. Quite fascinating actually.

EDIT 2: Attempted to use "Gorochu" in battle with partial success. The backsprite is extremely volatile, as it loads a very long time and when loaded, it instantly corrupts a varying amount of memory. Going through the source code yet again.

EDIT 3: Edited main.asm very slightly, as the sprite bank loading code seemed to skip Gorochu altogether. No effect.


EDIT 4: Massive breakthrough! Gorochu's sprite offset caused all other Pokemon after it to become corrupted. Adjusted the offset, and no more problems there. Gorochu's sprite still doesn't want to load, though. Also, added an custom attack just for Gorochu, called "Arc" which is Electric-type, with 170 base damage, 70 accuracy and 10 PP. That works fine, but it shows up as Thunder Wave.

Re: Pokemon Yellow romhack - Problems with corrupted sprites

Posted by: Raven Freak
Date: 2020-05-05 11:18:37
Where exactly did you put Gorochu's sprites? Was it in a new bank, or in an already existing bank? Whenever I added a new Pokemon to my Blue/Red hack, I was having issues where the sprite didn't want to show up, because I was placing it's sprite data in a new bank. I crammed my new Pokemon's sprites into Bank 3, and fixed the pointer to load it's sprites in home.asm. If you search for Mew, you can see how the game load's Mew's and the fossil sprites, because they're all located in separate banks than the other Pokemon. Doing this, fixed my issue where Animon's sprites didn't want to load, because I wasn't telling the game properly to load the bank that contained it's sprites. As for your new move "showing up as Thunder Wave" do you mean the animation or the name of the move? I found a tutorial via github that adds Ancientpower, but you can virtually rename the move and change the animation to whatever you want.
https://github.com/TheFakeMateo/RedPlusPlus/commit/b08480dfdd82374d10a96cf994be7883d6ddb88c

Re: Pokemon Yellow romhack - Problems with corrupted sprites

Posted by: Finish3r
Date: 2020-05-05 17:40:53

Where exactly did you put Gorochu's sprites? Was it in a new bank, or in an already existing bank? Whenever I added a new Pokemon to my Blue/Red hack, I was having issues where the sprite didn't want to show up, because I was placing it's sprite data in a new bank. I crammed my new Pokemon's sprites into Bank 3, and fixed the pointer to load it's sprites in home.asm. If you search for Mew, you can see how the game load's Mew's and the fossil sprites, because they're all located in separate banks than the other Pokemon. Doing this, fixed my issue where Animon's sprites didn't want to load, because I wasn't telling the game properly to load the bank that contained it's sprites.


I assume you mean the "sections" in main.asm? First I attempted "Pics 4"/bank 4 as it was the only one which didn't throw errors while building the ROM, but that didn't line up with the index numbers so I made adjustments to the scripts and inserted Gorochu to "Pics 3"/bank 3 next to Raichu, and that didn't help either.  Also, Gorochu is located in the middle of the bank, so it shouldn't skip loading it at all.

Thanks for that link! I happened to check everything related to the "Arc" move and it seems I misplaced some lines of code. I assume it is fixed now, I'll test it out when I get Gorochu's sprite working.