JustRegularLuna / rpp-backup

This repo is for Red++ v3, which is the latest playable version. The repo for v4 is not in a playable state at the moment, but dev will be resuming soon.
171 stars 43 forks source link

Game freeze/crash after (new) catch #21

Closed gslance closed 2 months ago

gslance commented 3 months ago

After about 13 hours and 71 creatures, the game will now consistently crash/freeze trying to catch any new Pokémon. The screen will sometimes display glitched graphics or a white screen while the music continues. On a GBA, it will reset. On emulators, the music may be garbled as well.

Here's what I've tried to see if it would run normally:

Sadly, the glitch is reproduced consistently. The last thing I've done before this all started was catch a Pikachu in the Viridian Forest, teach it Surf via the Move Learner in Fuchsia and then use a ThunderStone on it to make it a Raichu. It may not relevant to the issue but I thought I'd mention it.

I've attached the save game here so others may try it. It is in a ZIP file, the file is 32kB and named POKEMONR.sav, which is dumped from a physical cartridge (MidnightTrace V2) using a BurnMaster cartridge reader. Here it is: POKEMONR.zip

This is using the v3.0.2 Normal patch (regular graphics), which is the latest IPS version available on the repository as of this writing.

JustRegularLuna commented 3 months ago

I would like to start by saying that I am sorry you ran into an issue like this. This is the first time I have heard of anyone having this issue with catching Pokémon. I have to ask, were you using (or trying to use) cheats at any point leading up to this? If you tried a cheat for vanilla Red Version, and it "didn't work", it most likely corrupted something in memory. (Also, VisualBoyAdvance is not a recommended emulator, there is even a screen warning you NOT to use it when you boot up the game, because it is known to have issues).

gslance commented 3 months ago

No, absolutely no cheats, none! I was after a genuine experience, so I was playing normally from start to... this, haha!

I missed the bit about VisualBoyAdvance, I'll try another. But it still stands that its reproducible on real unmodded hardware. :(

JustRegularLuna commented 3 months ago

Fair enough, I just had to check, since I've never encountered or had someone else report anything like that. And since I used cheats on real hardware back in the 90s, and still have a gameshark, I couldn't just assume you hadn't tried to use cheats just because you were playing it on a flash cart.

I'm really not sure what to say here. I'm not sure what the cause would be, and I'm not still working on updates for this version. The next version of Red++ will be rebuilt from the ground up as a remake using heavily modified pokecrystal as the base, and I had no plans to come back to this older one.

gslance commented 3 months ago

That's a fair assumption on your part, for sure! Thanks for asking so I could clarify.

Anyway no problem, if there's no obvious fix here for now then that's that. I enjoyed my over 13 hours so for that thank you. I can't wait to see what else you can do in this space. Looking forward to play the rebuilt Red++, no matter the wait.

Thank you for responding!

gslance commented 3 months ago

So I have new info. I did some testing and retraced some steps. I found the culprit, I think.

It appears that the Pikachu that I taught Surf to via the Fuchsia move learner had caught corruption in some way. Having this Pokémon in the party meant that the catching sequence was not able to finish, probably because the game iterates over the party's Pokémon in the end. The same happens if this corrupted Pokémon is in the same Pokébox and the newly caught would be send there, the game probably iterates over that box too. On closer inspection on a previous save, it's a Pokémon I've already had in the box and not related to the Surf-taught Pikachu/Raichu! I don't know which Pokémon this was, but it's corrupted the entire box.

I have no knowledge on how this is programmed so I can only assume it's possibly to check if the party is full. For the box, I'm not sure - in my testing, having the corrupted Pokémon in the active box meant the glitch results in seeing that box (which is interactable) at the end of the catching sequence, as if viewing it from the PC. Strange, not sure why.

Viewing this Raichu (I evolved the Pikachu) corrupted Pokémon inside the Pokébox at a PC shows it as an unnamed (blank) level 165, discolored Omastar which OT is apparently a Dugtrio haha (another Pokémon in the same box). It has no moves.

If this corrupted Pokémon is not in the party and not in the active Pokébox to send newly caught to, the game behaves as normal. I have to reiterate that I didn't edit or hack the rom or its memory (I don't even know how), all that happened is that I caught a fresh Pikachu, taught it Surf and then evolved it by a thunder stone from Celadon store. Question is, why did this corrupt that Pikachu? Was it a fluke? Cosmic bit flips? I kid, but as a player, I'm glad I can continue as normal.

I hope it helps if someone stumbles upon this issue or similar. I will be deleting this corrupted Pokémon from my game but if anyone is interested, I have attached the savegame in the OP where this Raichu is available to analyze. The savegame attached to OP contains this mystery Pokémon. I don't know which it was beforehand or how long I've had it. It's there because of a Pokémon I've caught, but nothing else springs to memory as no encountered Pokémon has glitched for me during my (genuine) playtime.

EDIT: Releasing this corrupted Pokémon is impossible, it crashes the game. After putting it in the box it is not possible to withdraw it again to the party, it crashes the game.

JustRegularLuna commented 3 months ago

Really hard to say what would've corrupted the pokemon in the box, especially if you're not sure how long its been corrupted to even know where to start looking.

JustRegularLuna commented 3 months ago

The only thing I can think of is that the older port of crystal's audio engine (that this uses) was using an unused section of SRAM for some stuff, and if it unintentionally accessed the wrong SRAM bank it could've corrupted box data. But there isn't a good way to change that if that's the case. Re-replacing the sound engine in a project I'm not still developing just to cross my fingers and hope it solves an issue is not something I want to do.