Post subject: Game Boy Player Player (GBA console verification)
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
I built a console verifier for GameCube games by tapping a torn open wire, as well as one for the Game Boy Advance using a Game Boy Player that I soldered to. The GCN verifier is untested beyond trying to use it for GB Player stuff, but in theory should work if Dolphin TASes are accurate enough (but I doubt they will be). Meanwhile, the GB Player stuff all fails to sync (pretty dramatically sometimes) due to lag frames being off. I'm tapping the SPS and keypad buttons directly on the mainboard for the GB Player, so I know frames aren't drifting, but I've run into the following problems with the games I've tested:
  • Super Mario Advance: Syncs better than the version of VBA-rr I have for some reason, but when it goes through a door ~30 seconds in, a lag frame screws it up and Mario dies. This might be fixable with a manual tweak.
  • Sonic Advance: Presses start one frame too soon. If I offset the frame, then it syncs terribly once the game starts and jumps into spikes and dies.
  • Pokémon FireRed: Presses Start one frame too soon, again. If I adjust this, it properly sets the gender of the trainer and then misses a frame when it tries to open the name select screen, thus offsetting the whole thing.
  • Fire Emblem: Seems to press start one frame too soon, preventing the new game from being started. Haven't looked too closely.
  • Metroid Fusion: Hoo boy. Misses some lag frames or SOMETHING and then doesn't get to the game select screen at the right time. Manually adjusting this got it to work better, but it's still horrible.
  • Digimon Sapphire (I needed a BK2 game): Works well up until the stage select screen shows up, then it presses start one frame too soon, again, messing up the rest of the TAS. Haven't tried inserting a frame manually yet.
If anyone has some TAS they really want to see verified, I can see about trying to fix the lag frames manually, but it might be unworkable for VBA's emulation.
Fortranm
He/Him
Editor, Experienced player (878)
Joined: 10/19/2013
Posts: 1121
How accurate is GB player itself?
GoddessMaria
She/Her
Reviewer, Experienced player (867)
Joined: 5/29/2009
Posts: 518
Location: Hell...
If I heard correctly, the timing differs on GB Player.
Current projects: failing at life
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
The Game Boy Player has a CPU AGB A on it, which is the exact same chip as in an orignal GBA. (The SP uses a CPU AGB B.) There's an auxiliary chip on the GB Player (GBS-DOL) that takes the frame data from the CPU AGB A (the output is specialized for the LCD, so they just read the LCD signal) and reencodes it for the GCN, and likewise takes the GCN controller data and sends it to the CPU AGB A. The GCN controller input, which is what I was using at first, polls 18 times per GCN frame, which is kind of weird. However, GCN frames are ~59.94 FPS, whereas GBA frames are ~59.73 FPS. The GB Player is not clocked specially. It's exactly the same 59.73 FPS as on a GBA, so there is drift between the CPU AGB A and the GCN that's flattened out by the GBS-DOL chip. This means that using the GCN port is unworkable. However, I bypass the GCN controller port entirely by soldering to the board between the GBS-DOL chip and the CPU AGB A, so it should emulate exactly the same. The only problems should arise from the GBS-DOL losing presentation frames; but that only causes the video to look wrong.
AntyMew
It/Its
Encoder, Player (35)
Joined: 10/22/2014
Posts: 425
GoddessMaria15 wrote:
If I heard correctly, the timing differs on GB Player.
Pretty sure he said it differed from VBA, not GBA
Just a Mew! 〜 It/She ΘΔ 〜
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
Also, a lot of this research was done previously by the people on Assembler Games, but they were mostly trying to reclock the CPU AGB A to sync with the GCN frames. The thread is a good read, regardless.
GoddessMaria
She/Her
Reviewer, Experienced player (867)
Joined: 5/29/2009
Posts: 518
Location: Hell...
Anty-Lemon wrote:
GoddessMaria15 wrote:
If I heard correctly, the timing differs on GB Player.
Pretty sure he said it differed from VBA, not GBA
I was partially expecting to be wrong on it. I wasn't entirely certain and memory is kind of hazy at times.
Current projects: failing at life
Site Admin, Skilled player (1254)
Joined: 4/17/2010
Posts: 11475
Location: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg
endrift: Can you record a real-time play in your emulator and check how it would sync?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
It should be possible; it'd take a bit of work (mGBA's movie format is more complex than VBM or BK2, which might mean I went overboard*) and I won't have a chance to do it for a little while. I reassembled the Game Boy Player to transport it, so I'll need to take it apart again. I plan to cut a hole in the side to make this unnecessary in the future but I haven't done it yet. *The biggest complexity that would affect it here is the fact the movie format has distinct frame markers from input markers, so seeking is a bit weird. However, mGBA movie files are able to be chunked to allow for non-linear movies, which is mostly relevant for recording and editing. Playback is simple, but I don't have a way of compiling the non-linear movies into a linear format yet.
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
So in comparing how VBMs play in VBA, mGBA and real hardware, the current state of affairs is pretty depressing. mGBA does not insert NEARLY enough lag frames, and VBA is a few too few in general. I have recordings of some games on hardware (tweaked slightly, but not that much, just to get them to sync at all). There's a lot of work to be done still on the emulator side. Gonna write up an article on how I set up the hardware verifier (the so-called "Game Boy Player Player") soon. Link to video Link to video (Youtube decided to nicely crop the first one, but not the second one, for some reason) E] Here's a better synced version with some more frames inserted to compensate (pre-cropped this time): Link to video E2] First 200 seconds sync perfectly now, but a few frames after that it starts to desync. It turns out that I needed to insert frames at the very beginning of each level, but that was all the work that it seems I needed to do for those levels. Link to video
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
As much as I hate to triple post, I've now written up a moderately long article on how I set up the Game Boy Player Player, and I now have a video that syncs up for ~5:50 before the first RNG boss has the wrong pattern. Of note is that I do not, in fact, have the very beginning of the TAS where it sets the language. This is due to it not being cleared when I clear my savedata, but I found a way to clear that too, so I'm gonna try syncing that to see if it changes the pattern at all. I may be able to screw with some framecounting before the game even starts, but that would probably only work for one boss pattern :/ Link to video
Spikestuff
They/Them
Editor, Publisher, Expert player (2643)
Joined: 10/12/2011
Posts: 6439
Location: The land down under.
endrift got some Super Mario Advance - Mario Bros. to sync from a test file. Sadly the test level was only for a single phase and not multiple.
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
GoddessMaria
She/Her
Reviewer, Experienced player (867)
Joined: 5/29/2009
Posts: 518
Location: Hell...
That's still a great achievement!
Current projects: failing at life
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
I'm just gonna leave this here. Link to video I'll post a full explanation of all the changes I had to make, and why, tomorrow. (I can try to take a video of it on a TV sometime soon, but I don't have a tripod or anything so it will be very shaky-cam.
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
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!
Joined: 7/2/2007
Posts: 3960
Congrats, endrift! Great work, on both the emulator and the console verification rig.
Pyrel - an open-source rewrite of the Angband roguelike game in Python.
Skilled player (1741)
Joined: 9/17/2009
Posts: 4981
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
Nice! Is it Movie #this TAS? Is the 16 seconds due to the extra 700+ frames along with the GBA start up? Either way imo it should still count as "console verified" due to the game timer being same for every stage but the last (by .12). Would you by any chance also try the other categories for Sonic Advance?
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
It's [1665] GBA Sonic Advance by Mukki in 10:46.52. I tried with the Amy run, but it uses the reset already so I can't fiddle with the RNG.
Skilled player (1741)
Joined: 9/17/2009
Posts: 4981
Location: ̶C̶a̶n̶a̶d̶a̶ "Kanatah"
endrift wrote:
It's [1665] GBA Sonic Advance by Mukki in 10:46.52. I tried with the Amy run, but it uses the reset already so I can't fiddle with the RNG.
Would delaying that reset work? Or adding another reset
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
Adding another reset or delaying the reset would result in the exact same value, as the reset is what sets the value. It's impossible to reduce the number of frames between the reset and the RNG seeding without destroying sync :(
endrift
Any
Emulator Coder
Joined: 12/14/2014
Posts: 161
Working on verifying a new movie, #4889: Fz-Last, Pike & alkdcY's GBA Castlevania: Aria of Sorrow "all souls" in 18:45.26. Link to video What's super interesting about this game is that mGBA (dev builds) and the actual hardware are in perfect sync, but VBA has completely different lag frames, so it took a lot of work manipulating the lag frames to even get this 4% of the submission syncing. However, given this, I don't have to replay it all the time on hardware when working on the sync, making this feasible to do in presumably only a few weeks.