Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Starting to test out GBA verifications. Decided to do a test run of a short homebrew game (Feline) to test out my workflow. This test run was made entirely in my new core to test out save states and TASing tools. Seems to be working well so far. Feline is also interesting from an emulation point of view by itself because if you get seen by the lab rats, the game attempts to change ARM mode in an architecturally unpredictable way (attempting to set the thumb bit by MSR instruction.) Turns out nothing bad happens on hardware, but it took me a while to figure out why it was crashing on me in emulator. EDIT: Old video replaced with published version Link to video The run plays out the same in mGBA, except you can start a frame earlier in my core (presumably due to pre-fetch but I haven't checked the details), so this was a relatively easy test. Once I fix a few more emulation bugs I'll try something more difficult.
ViGadeomes
He/Him
Judge, Active player (311)
Joined: 10/16/2017
Posts: 462
Location: France
So exciting !
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
I did some tests with Metroid Fusion and Fire Emblem and they both desynced, apparently due to loading times, I believe because of VRAM access delays not implemented yet. The GBA has a feature called forced blank that allows you to access VRAM without any conflicts. A side effect of this though is that the screen fades to white. So, if you want to change scenes with a fade to black instead, which both of those game do, you have to deal with VRAM access delays as the PPU is still rendering. Fusion made it the furthest so here is a video: --superseded by more recent progfress-- So it looks like I'll have to implement this before further testing.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
I tested two of the latest homebrew publications. [5017] GBA Sushi the Cat by Cephla & Technickle in 01:18.22 synced, so I was able to add that one to the console verified list. This would have raised the number of current GBA console verifications from 2 to 3, but Sonic Advance was improved recently so back to 2. [5141] GBA Powerpig by Darkman425 in 05:22.95 desynced about half way through the game. I then tried the movie in GBAHawk, and it desynced at the same spot as on hardware. So I resynced the movie and tried again, and it synced: Link to video So this is the first example of a real world accuracy improvement compared to mGBA. Aside from Homebrews I still haven't had any luck syncing any games, so more work is needed.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Tested Coin Fall, currently on workbench. In mGBA, console verification fails (right at the start.) In GBAHawk, it succeeds: Link to video
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Link to video By pure chance I stumbled upon a big time save in Powerpig. There is one frame every so many frames where you can complete one level and skip the next level intro, saving a couple seconds every level. It is possible to hit this glitch just moving normally through a level, so it seems Darkman425 was just extremely unlucky to have not stumbled upon this in the original. I found it while improving another level, so this skip glitch isn't the only improvement. I console verified this new run as well, so finally I have an actual console verified improvement over an existing publication. Eventually I will ask for GBAHawk to be accepted for publications, so it's nice to already have a relevant example, even if only in homebrew.
Darkman425
He/They
Editor, Judge, Skilled player (1293)
Joined: 9/19/2021
Posts: 263
Location: Texas
Is that glitch related to the weird one I never figured out where I took damage randomly?
Switch friend code: SW-2632-3851-3712
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Darkman425 wrote:
Is that glitch related to the weird one I never figured out where I took damage randomly?
I'm not sure, I don't know why this new glitch works either. General homebrew glitchiness isn't surprising to me, so I'm not really looking too deeply into it. EDIT: although looking at it again, it looks like I now have 3 lives throughout the run, so maybe something changed? Perhaps I can improve some stages where waiting was required before. EDIT2: Turns out no more time can be saved with damage boosts, but only because you have to wait for the skip glitch to line up. Also my other time save also didn't end up saving time due to waiting, so the only time save is in waiting for the skip glitch.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Link to video I found an improvement in Coin Fall and console verified the improved movie in GBAHawk. So along with Power Pig this can eventually be submitted to add another 2 runs to the console verified list. This game samples input at irregular intervals, so I needed a slight adjustment to the dump script to get it to work. Something I'll need to keep in mind when investigating desyncs in the future. I don't believe I verified where input is sampled for Metroid Fusion or Fire Emblem, I'll have to double check and keep better notes.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
With GBAHawk now being accepted for publication, the improvements to Powerpig and Coin Fall are published and verified. An improvement to my original Feline run is also published and verified. Additionally, 2 other homebrews, Sushi the Cat and Anarchaeologist were able to be verified with the mGBA core in BizHawk. This brings the total number of current GBA console verified runs to 6. It would be 7 but Sonic Advance was improved a few months back and the improvement hasn't been verified yet. It's also worth noting that 5 of these are short homebrews. I had retested both Fire Emblem and Metroid Fusion after the latest round of accuracy improvements. Fire Emblem made it much further than before, but eventually desyncs shortly into level 1. No improvement to Metroid Fusion. It appears both desyncs occur due to one extra lag frame on console compared to emulator. RetroEdit put a lot of work into Shrek 2, revealing that every emulator tested under counts lag. This is not unexpected given the results from Fire Emblem and Metroid Fusion. I expect the resolution to come from improved prefetcher emulation, but currently there are no failing test ROMs that would point out the way to improve things. So still a lot of work to do but progress is being made.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
It turns out that until now I had missed an important detail in prefetch emulation, in that the prefetcher only runs when executing code from ROM. This is stated pretty clearly in mGBA's article on the matter, and it makes sense (no point running a whole separate component if you are say executing code from IWRAM) but I evidently just glossed over it. After implementing this, Metroid Fusion now syncs to as far as I have managed to resync the movie file itself: EDIT: video removed, superceded by complete resync. It's cool to see some new progress on first party games syncing on console. This fix doesn't seem to help Fire Emblem at all though, so still improvements left to be made. EDIT: Oh, and also in testing I realized Sushi the Cat actually wasn't behaving the same on console as in the TAS. It turns out there are two LESS lag frames at one point in loading. The run still plays out ok, but you can see the difference in how enemy animation frames line up. GBAHawk gave the correct lag, so I resynced the movie and redid the verificaiton from it.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Since it seemed to me like prefetch was the most likely source of sync error, I decided to recompile the tte_demo with prefetch enabled to see what errors popped up. To my surprise there was only one failing count. Looking into it, the only possible fix (that didn't break everything else) was for ROM accesses that aren't instruction fetches to completely reset the prefetcher. Previously I had only reset the current fetch. The prefetcher can have up to 8 values buffered, but rarely has more than 1, so this behaviour escaped previous testing. Implementing this finally brings further sync progress to Fire Emblem: EDIT: video removed, superceded by complete resync Unfortunately re-syncing Fire Emblem is incredibly tedious as the current run was made on VBA, so many lag frames have to be added. So it will be a slow grind working on more stages from here. Metroid Fusion now syncs up to 30 minutes into the run, surprisingly easily. Lots of good progress there. Finally RetroEdit's Shrek 2 with built in inputs now gives 25DA as opposed to 2520 previously, much better but still not quite there (supposed to be 2611.) I'm going to keep working on Fire Emblem and see how far I can get. I'm also going to look for shorter runs to work on now that I'm starting to see some progress.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
EDIT: Video removed, superceded by proper resync retaining original inputs Finally was able to console verify (a resync of) Metroid Fusion. It turns out there is some quirky edge cases of branching to the next address the prefetcher will fetch, and emulation of this needs to be correct enough for Metroid Fusion to sync. This run ended up requiring many precise timings and careful emulation of edge cases, so I'm cautiously optimistic that other games will console verify as well. RetroEdit's Shrek 2 input hack also now works in GBAHawk, so that's another good sign (although the actual game uses EEPROM which has imprecise timings.) But hopefully many SRAM games will work at least. Console verifying this game has been my goal ever since I started working on GBAHawk, so its really cool to finally see it working. I have a little clean up to do in the code and will release GBAHawk 2.0.0 with the emulation fixes needed for this to work. Now the grind to resync other runs can start. I'm really interested in Castlevania and mega Man Zero series. Would be cool to see those working. I can't figure out how to resync Fire Emblem, so I'm going to put that one on hold for now. Eventually I also have to characterize EEPROM and Flash timings, but that's something for later.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Thanks to RetroEdit doing some resyncs, I was able to verify DK; King of Swing, pretty cool! Link to video In the coming days I will also do 200% and Diddy mode. RetroEdit says these resyncs were very simple, so this probably isn't pushing accuracy very much , but it's still nice to see some success. I will also return to Metroid Fusion when I get a chance and try to redo the resync so I can give it a check mark, and also look at 100%. EDIT: 3 for 3 on King of swing verifications, awesome!
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
EDIT: Video removed, superseded by improvement. I finished a run of Flintstones that now syncs on console so that is one mystery solved. I haven't had time to properly test all the necessary cases so this won't be a submitted TAS for a while (will be with version 2.0.2 of GBAHawk eventfully.) This was a very interesting example of just how far apart cause and effect of accuracy errors can be, and was also why it took so long to track down. RetroEdit made a resync of Shrek 2 but it currently desyncs on the next to last level on console. Haven't been able to dig into it very deeply yet but seems it could be an accuracy issue rather than a EEPROM issue. So one mystery solved but another one takes its place. I tried another EEPROM game Ty 2, but it is extremely sensitive to EEPROM timing so it desynced almost right away. I might put an EEPROM timing parameter into GBAHawk eventually to give more games a chance of syncing, still too early though. RetroEdit also managed to make a resync of WarioLand 4, so I think that will be next. Testing continues.
GoddessMaria
She/Her
Reviewer, Experienced player (868)
Joined: 5/29/2009
Posts: 519
Location: Hell...
I was wondering something... how do you go about converting the movies from GBAHawk to what's expected by console? Do you utilize the same script that is on the TASbot site or something else?
Current projects: failing at life
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
GoddessMaria wrote:
I was wondering something... how do you go about converting the movies from GBAHawk to what's expected by console? Do you utilize the same script that is on the TASbot site or something else?
I use this python script to convert the movie file to GBI inputs,: https://github.com/alyosha-tas/GBA_replay_files/blob/main/gba_script.py It is a small modification from this one by TIKevin83: https://pastebin.com/6jaPXm4H After that the machinery for playback all comes from GBI (just the same as for GBC.)
GoddessMaria
She/Her
Reviewer, Experienced player (868)
Joined: 5/29/2009
Posts: 519
Location: Hell...
Alyosha wrote:
GoddessMaria wrote:
I was wondering something... how do you go about converting the movies from GBAHawk to what's expected by console? Do you utilize the same script that is on the TASbot site or something else?
I use this python script to convert the movie file to GBI inputs,: https://github.com/alyosha-tas/GBA_replay_files/blob/main/gba_script.py It is a small modification from this one by TIKevin83: https://pastebin.com/6jaPXm4H After that the machinery for playback all comes from GBI (just the same as for GBC.)
Thanks so much! So... after floundering about like an idiot, I managed to get my movie to play on console. Unfortunately said movie, Sonic Advance, desynced at the start in Secret Base Zone Act 2 on console. It played back fine on emulator, though, which makes me wonder if there's additional timing differences not being accounted for or cart reading issues. Link to video
Current projects: failing at life
ViGadeomes
He/Him
Judge, Active player (311)
Joined: 10/16/2017
Posts: 462
Location: France
Hello, Convert console verified movies made on other GBA emulators to GBAHawk that are then known to sync on console would also be cool at one point to test if they sync on GBAHawk: GBA Super Mario Advance 4: Super Mario Bros. 3 "warps" by EZGames69, GoddessMaria in 11:07.65 GBA Sonic Advance by Mukki & ruadath in 10:49.73. there seems to be no archive of the movies used for the console verification here sadly: GBA Sonic Advance by Mukki in 10:46.52 GBA Sonic Advance 2 by Mukki in 18:01.78
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
GoddessMaria wrote:
Thanks so much! So... after floundering about like an idiot, I managed to get my movie to play on console. Unfortunately said movie, Sonic Advance, desynced at the start in Secret Base Zone Act 2 on console. It played back fine on emulator, though, which makes me wonder if there's additional timing differences not being accounted for or cart reading issues. Link to video
Cool, nice progress! Comparing your video to the publication video, it looks like the A press to start the level is happening at a different time, probably due to Flash timing. Since the python script doesn't need the movie to sync to create inputs, you could potentially try adding / removing frames in the movie file to get something that works, as was done in the Super Mario Advance 4: SMB3 case. I haven't tested Flash timings at all yet, so this is just a guess.
ViGadeomes wrote:
Hello, Convert console verified movies made on other GBA emulators to GBAHawk that are then known to sync on console would also be cool at one point to test if they sync on GBAHawk:
The games you listed use Flash for saving, so it's probably not worth converting them yet until I work on timing testing, as the results will probably change in the future. At the moment I'm bogged down with other things, I doubt I'll make significant progress before 2024 comes around.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Thanks to RetroEdit for providing a resync, one of the Warioland 4 runs has now been console verified. Awesome! RetroEdit's resync workflow is a huge advancement and should greatly accelerate console verification of GBA games in the future. Cool stuff happening all around. Link to video
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
I was able to resync the baseline Sonic Advance run and console verify it: Link to video I had to change some inputs on the ice level boss fight due to different icicles, so it's not the exact same as the original, but still its good to see consistency between both this and the knuckles version. The previous version of this TAS was verified in its original form, so there is a possibility the original run would work on some other cart, just not my particular one due to different Flash timings. I'll try the other 3 runs of this game when i get a chance.
Active player (261)
Joined: 12/13/2016
Posts: 352
do you have the gbmv of the resynced movie? there was some "low hanging fruit" improvements to sonic advance that I did not have time to get working because of lag/sync issues -- maybe we can try again on the more accurate emulator and get lucky
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
ruadath wrote:
do you have the gbmv of the resynced movie? there was some "low hanging fruit" improvements to sonic advance that I did not have time to get working because of lag/sync issues -- maybe we can try again on the more accurate emulator and get lucky
https://tasvideos.org/UserFiles/Info/638359331014930395 Here you go, good luck!
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3827)
Joined: 11/30/2014
Posts: 2834
Location: US
Good progress in console verification recently. Sonic Advance Knuckles, Flintstones, and two runs of Connect 4 all verified. Additionally Perfection (which comes from the same cart as connect 4) was able to be verified directly from the BizHawk movie. So that's 5/5, good stuff. I tried resyncing an older Sonic Advance run made on vba but wasn't able to get correct RNG, so the remaining 3 Sonic Advance runs will need more effort to get working. I'm going to do my best to get to 20 verified runs by the end of the year.