So yes! I got full sync working on the GBPP, and the process involved was a bit more...complicated than I'd thought it would be.
Several things were necessary: First, I had to insert a frame before "press start" as it was pressing start too soon. Second, I had to insert three frames at the end of every level. I eventually realized that this was due to the time taken writing to flash. This seemed to get every act synchronizing fine, up until Casino Paradise's boss. It was an RNG-heavy boss, and the seed was wrong. At that point, I basically gave up.
Until Zeupar gave me some information (from FatRatKnight) on how the RNG works. It turns out it's a
linear congruential generator, so if I could predict the seed and how many times it was incremented, it should always be the same. Right? Well, I modified mGBA to incorporate the "realistic" flash timings and discovered that the RNG state is
identical right up until the boss. But that's when it does something nasty: it reseeds the RNG with the number of frames since the game restarted. And the emulators were running too fast, so the number of frames that had ACTUALLY gone by was too high; I couldn't just subtract frames to decrease that seed. Right?
Wrong. Reseting the game by pressing A+B+Start+Select actually resets that counter, but skips the intro as well, causing it to have a frame counter of approximately 740 less at equivalent points into menuing. Turns out that approach also saves frames overall (as seen in the Amy run), but it was NOT done in the Mukki run, which let me abuse it. The problem was...I didn't know what the exact state that frame counter would be in when it was at equivalent states in the game. And that number had to MATCH when it reseeded the RNG for every next boss to sync (since it only reseeds once). These wait frames could easily be inserted during menuing to prevent any side effects, but they had to be done after the reset.
Well, 740 states is a bit much to work through by hand, so I wrote a bot to try all of them. It took 5 minutes per attempt to get it to sync the Casino Paradise boss again, but it turns out that that wasn't enough to get later bosses to sync--it only needed two good values in a row, instead of all of them. So that was 83 frames of wait right there--already almost a second and a half. But then I needed to get the NEXT boss to sync, which meant all subsequent tries had to take more than six minutes. (I was using 386 seconds as my test length.) I only had to review a few seconds of each run, but I still had to play that much back on hardware. This would take upwards of three days. After about 300 tries, I decided to reverse the search to start from the end of the domain and work backwards. But at 629 additional wait frames (for a total of 712 wait frames, more than 11 seconds), the next boss synced. And after adding the three frames per stage, so did the next one. And the next one. And adding two frames for the final stage instead of three, the whole game synced.
The run is overall quite a bit longer due to waiting during menuing, but the core TAS has not changed. Each stage still has the same timer at the end, except for the final boss, which is .12 seconds longer (and I don't know why).
But here we have the first console-verified Game Boy Advance TAS, Sonic Advance by Mukki. And a big thanks to FatRatKnight and Zeupar for giving me enough insight into the RNG to bring this verification back from the dead. Without it, I wouldn't have known how to manage the RNG!
P.S. There's a pretty good assortment of outtakes from the botting that I'll probably composite into a 5-second-per-clip sequence when I get a chance.
Onwards to Sonic Advance 2, I suppose!