Posts for Alyosha
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
I've released version 1.7 of GBAHawk which has more stable linking and improved emulation accuracy, particularly for prefetch. It also cleans up numerous minor bugs. With this release I've finally reached the point where I'll have to develop some of my own tests to make more progress. Things are finally starting to come together and it's refreshing to be on the frontier of emulation for a change. Audio DMA tests will definitely need to be first, so progress will slow down for a while as I figure out how to put things together.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
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, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
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, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
Cool and very obscure new discovery, nice. I wonder how many other games have stuff like this? I managed to console verify this (I used BizHawk which has one less lag frame at the start but is otherwise identical.) Link to video
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
I took another look at 'world_map_gba' to try to resolver the issue. The first thing I did was try out the ROM on GBP to see the expected result: The interesting scanline is the one with a single brown pixel that sticks out on the right side of the castle into the grass approximately at the height of the player's eyes. This scanline is indicative of audio DMA delaying execution of the code that updates the reference regs when HBL IRQ happens. GBP seems to internally blend frames together, and this is why the effected scanline is slightly duller and blurrier than the others, as it is flickering between frames. In fact this is exactly what NanoboyAdvance gets if you turn on LCD ghosting (without it the flickering is noticeable, but this is a display issue not an emulation issue.) Then I looked at the code the game was using to see what the driver of the issue is and why GBAHawk wasn't matching hardware. It turns out pretty much everything except FIFO DMA is a non-factor. The timer that ultimately runs the FIFO is turned on after a VBlank IRQ, and the prefetcher isn't turned on at the time, and as these are well studied things, the absolute timing of when FIFO ticks happen is set. The latching of various involved ppu parameters is also well tested. So really the only movable parameter is timing of the FIFO DMAs. Before I could mess with that though I had several small bugs in the audio code (off by one errors and not clearing fifo on reset) as well as the ppu (a mish-mash old and new code from when I was working on reference point latching.) Once those were fixed it was just a matter of checking which FIFO ticks the DMA needed to run on to match hardware. Having done so however, the results are kind of awkward, new DMAs occur when the sample buffer has 14 samples left, instead of the expected and more natural 16. So something still likely isn't right. I implemented what I had for now though, as it was still better than before and fixes some definite bugs. A more thorough testing of FIFO DMA is still needed.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
I finally redid my IRQ code, and the results are much cleaner and resolve a couple of issues. One issue is when IME was being checked which would have been hard to fix with my old code but is pretty naturally following the correct timing in the new code. The other is an edge case encountered in trading in pokemon where a serial IRQ was triggered at exactly the wrong cycle to skip an IME enable. The old code had no way to follow up on this and trigger it later, but its not a problem for the new code. Below is a video of pokemon trading in action. Link to video The linked core is able to keep up at 60 fps everywhere except saving. Other games like Advance Wars 2 also don't make it to 60 fps with multi-pak linking at all, as there is simply too much code running, but at least there are no linking errors. I have some more clean ups to do before making an official release. So far in my testing there are no regressions in test ROMs, games, or TASes, so that's good (you never really know what will happen when changing something fundamental like IRQs.) The last thing I want to do is figure out cancel-irq-ie.gba, which seems to be an issue of figuring what happens when flags/enables are being set/cleared at the same time.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
I released GBAHawk version 1.6.1 mainly as a bug fix release. A major bug was saving cart RAM twice, which obviously bloats the state size needlessly, especially when playing games with 256k RAM. Besides bug fixes I also added support for Warioware Twisted. I use a different control scheme than mGBA uses, at least in the BizHawk implementation. There, mouse position corresponds to angular rate (which is what the cart ultimately reads.) In GBAHawk mouse position corresponds to angular position. So you control the game with speed of mouse movement. I actually got a cart (JPN version) just to test this out. I think I captured the feel of the real game pretty well, hysteresis and all. That brings game compatibility up to where I want it for now. Next up is a rewrite of the IRQ handler.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
In the hide and seek level you can use your ghost to collect the gems and save several seconds.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
WhiteHat94 wrote:
I did an RTA run of the NES port last year, not sure how directly similar the versions are but figured I would mention it at least. https://www.youtube.com/watch?v=HNmJgGi-7zw
The games arent directly comparable, but yuour run did make me realize that i didnt consider death abuse, which would save me a lot of time in the third and forth dungeons, so thanks for posting.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
-superseded- Here is a console verified complete test run of the game. I was really happy the verification made it all the way to the end. It turns out there are some interesting tricks and glitches in this game. The biggest one is being able to hit enemies with multiple weapons at the same time. With some precise positioning this allows me to kill several bosses very quickly, including the last boss with only a single dynamite and sword slash. The next most important glitch is enemy despawn. Occasionally enemies simply won't spawn. The most important use of this is the Bat boss refight, where I manipulate him not to spawn which saves a lot of time since this version of the boss has greatly increased health. Also if you press up against a wall while going around a corner, you get a small but noticable boost. This saves a few frames at a time, which adds up to a lot over the course of the run. Routing is pretty fixed, since you need items in each previous dungeons to complete the next one, and they are all far apart. The only real routing choice is whether or not to get the powerup and red key from the desert cave. It takes 29 seconds to cross the desert without going to the cave, and 76 seconds with the cave. The time it takes inside the cave is about the same as it would take to go out of your way to get a red key in the third dungeon if you didn't get it in the cave. So, this mean it costs 47 seconds to go to the cave and get a weapon powerup. However this time is also spent farming, since you need 100 gold by the time you reach the merchant to buy the dynamite. So I think if I greatly improve farming early game I can skip the cave. It's hard to estimate how much time the powerup saves, but I doubt it is more than 15 seconds. So I should be roughly 30 seconds ahead.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
Here is a really well polished homebrew adventure game called Anguna. I made a test run of the first dungeon: https://tasvideos.org/UserFiles/Info/638263248982014754 So far it syncs on console: -supercded- I'm going to be working on it over time in between emulation improvements. Seems interesting enough but not too long.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
I released GBAHawk v1.6 with support for RTC and solar sensor. So now Pokemon RTC events should work and Boktai games can be played. I also added a setting for disabled RTC, which i guess is what pokemon speedruns use. I haven't tested pokemon linking yet, that's one of the next follow up things to work on. I believe with this the only other incompatibility is in WarioWare which needs a different kind of gyro sensor than Yoshi uses. I'll implement that eventually. Of course there are many peripherals but those hold no interest to me, so probably I'll leave it at that. Maybe the only nice thing to have would be the e-reader, but that's in the future. Time now to look at those IRQ tests, then I'll finally be caught up at the point of having to write my own test ROMs.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
Pretty interesting little puzzle game, nice work!
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
I released version 1.5.1 of GBAHawk which contains numerous bug fixes including initial compatibility for pokemon (though RTC still doesn't work.) I also realized I missed the 'archived' NBA tests in my accounting, where I currently fail some of the IRQ tests, seems to be some non-trivial things happening there I haven't looked at yet. I think the ppu tests are working, so current number of failed tests is 3. For now though it's finally time to finish RTC and solar sensor.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
The initial release of GBAHawk led to the uncovering of a variety of bugs. Several small bugs were cleaned up straight away. There was however one very serious bug in the cpu emulation that somehow eluded detection until now. This bug made it so that unsigned bytes could sometimes be loaded as signed bytes due to not properly clearing the flag that decides which to do. This occurred partly because I was sloppy in managing the flag, but also partly due to a much more subtle error. I was setting the flag on instruction decode, but clearing it on instruction execution. This is normally fine, but ARM instructions can be executed conditionally. So the flag could be set and then never cleared. Surprisingly this didn't cause chaos everywhere, as I only noticed this by happenstance when looking over the unreleased Another World. It could have been effecting RNG or enemy behaviour in other games which wasn't so far detectable, so I'm glad I stumbled upon this before making too many TASes. Anyway I finally got around to implementing VRAM open bus for BG fetches, resolving another test ROM, leaving only 2 that fail. It seems I should do something similar for OAM accesses, but it is not clear to me how several edge cases should be resolved, so I'll hold off for now. The next immediate thing to do though is work on the RTC so gen 3 pokemon can be played. This will probably also lead to more work on linking. EDIT: also fixed obj window test, and associated demo, so that leaves only world map not working.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
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, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
feos wrote:
Alyosha wrote:
Giving this a bump, I would like to submit some of the runs I have.
Please test by sending a userfile.
It works! Cool I will try to make some submissions.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
fleroviux wrote:
Hello, good job on this emulator so far. I have been following this thread for a while. It's exciting to finally see another GBA emulation project focusing on cycle accuracy.
Hello and thanks! Your test ROMs have of course been a big help in this process, so thanks for your efforts there as well. Still a lot of work to do but I have enjoyed the process so far the GBA is a pretty neat piece of hardware.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
RetroEdit wrote:
I gave it a try myself and submitted a pull request: https://github.com/TASVideos/tasvideos/pull/1601
Wow, thanks a lot! I really appreciate you taking the time to put this together.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
Randomno wrote:
Why not add the parser yourself Alyosha? Should be quite simple if it's the same as bk2.
Normally I would try and copy-paste my way to success, but I currently lack the spare brain power to do so.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
Alyosha wrote:
I would like to request that my Gameboy Advance emulator, GBAHawk, be supported on the site for movie uploads / submissions. It can be downloaded here: https://github.com/alyosha-tas/GBAHawk/releases It is a derivative of BizHawk, so shares a very similar (though heavily modified / stripped down) user interface. TAS tools are all the same, features like RAM watch and LUA are still supported. Movie extension is .gbmv, but is just .bk2 renamed to avoid confusion. Audio / video recording is the same. Two improvements to existing TASes already exist, and are console verified: https://www.youtube.com/watch?v=avBgeBKQ8_c, https://www.youtube.com/watch?v=rKP7X7TY1_k. Additional capabilities include subframe resets and limited support for linked play. Missing features are RTC, light sensor, and other peripherals. These will be added in future releases.
Giving this a bump, I would like to submit some of the runs I have.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
Cephla wrote:
Thanks for finding these much-needed route improvements alyosha. I've started implementing the second improvement but it might be a wait before I post anything final since I'm busy with other stuff.
Additionally, the levels starting at frames 6138, 10035, and 18917 can be improved substantially by using your ghost routing in one direction to collect / deposit gems for you to avoid a lot of back and forth. You used this trick in the last level already, which was pretty clever I didn't think to try it myself, I just looked where else it could be applied.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
Cool game. The level starting out 20668 has a better rout , here is a test run , which can be improved by a lot manipulating enemies more to avoid waitng: https://tasvideos.org/UserFiles/Info/638228039595713529 EDIT: https://tasvideos.org/UserFiles/Info/638228100506667353 Another level improved by a couple seconds.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
I would like to request that my Gameboy Advance emulator, GBAHawk, be supported on the site for movie uploads / submissions. It can be downloaded here: https://github.com/alyosha-tas/GBAHawk/releases It is a derivative of BizHawk, so shares a very similar (though heavily modified / stripped down) user interface. TAS tools are all the same, features like RAM watch and LUA are still supported. Movie extension is .gbmv, but is just .bk2 renamed to avoid confusion. Audio / video recording is the same. Two improvements to existing TASes already exist, and are console verified: https://www.youtube.com/watch?v=avBgeBKQ8_c, https://www.youtube.com/watch?v=rKP7X7TY1_k. Additional capabilities include subframe resets and limited support for linked play. Missing features are RTC, light sensor, and other peripherals. These will be added in future releases.
Alyosha
He/Him
Editor, Experienced Forum User, Published Author, Expert player (3602)
Joined: 11/30/2014
Posts: 2749
Location: US
Making some progress on linking. Here is a short video demonstrating single pack linking for Mario Kart Super Circuit: Link to video EDIT: Mario Kart multi pack linking also seems to work, as does advance wars 2 single pack linking, so it's a bit more robust than just this one example, though I didn't try anything else yet. I made this using TAStudio, so at least under initial testing sync is stable, also movie playback and recording was at least at 60 fps, so surprisingly still full speed (on a modern desktop cpu anyway.) So far what I have is only very rudimentary and takes a lot of shortcuts, but its a worthwhile proof of concept. Linking for GBA is pretty well documented in GBA Tek, so getting things working is really just a matter of carefully sorting through everything there, but it is much more complicated than ordinary Gameboy as there are several modes and more shared state to keep track of. Now that I have a basic proof of concept working, refining it and improving it over time is a more approachable task. Back to accuracy improvements for now though.