Editor, Player (69)
Joined: 1/18/2008
Posts: 663
Is the next input polled at the start of the next vblank, or does this game poll at the end? If so: the problem is the windowed mode causing that frame to be repeated. In this case, as the run otherwise syncs, I will need to dump the inputs per-latch which as I understand isn't supported yet in this emulator. If not: it shouldn't be the bot.
true on twitch - lsnes windows builds 20230425 - the date this site is buried
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
Hmm, nope there doesn't seem to be any nearby poll. Back to the drawing board I guess. True, are you still able to try this on console and record the results? I tried many combinations of starting states and NMI hits but they all sync. Maybe if I can see exactly what's happening on screen I can try t orecreate it. EDIT: Actually, I see where it would desync in level 6 due to windowing input latches exactly where True describes in the console verification tests page. I don't see where it would desync in level 9, though as described in the most recent published movie's submission page. Both movies encounter a similar problem in area 6. What happens is an input is latched right before NMI. Only a couple of the subsequent 8 polls are done before the NMI, with the rest of the them done only after about 2200 cycles. I'm not sure how exactly the bot behaves in this situation though, but it's my best guess. EDIT2: I also notice that FCEUX has different lag frames in those two movies in the respective areas where Trus said they desynced, so that might be the cause as well, maybe it will work dumping it from BizHawk? (Maybe I should have checked that first.)
Editor, Player (69)
Joined: 1/18/2008
Posts: 663
Can you post either the syncing run in .bk2 format or the per-frame input dump from Bizhawk? (Would have told you on IRC but you left again.)
true on twitch - lsnes windows builds 20230425 - the date this site is buried
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
Here are the two runs, both the old one and the new one. They sync on the latest Dev build of BizHawk. Old: http://tasvideos.org/userfiles/info/37881733414401898 New: http://tasvideos.org/userfiles/info/37881743719985076 There are no differences in input or gameplay, the only change is in how lag is flagged between the two emulators. I'm at least somewhat hopeful/confident that these runs will sync. But I think this is also a very rare situation that won't really offer much insight into other games, but hey its better then nothing!
Joined: 3/11/2008
Posts: 583
Location: USA
feos wrote:
also more accurate than PowerPak. Though, no flash cart is as precise and a real cart, so absolute levels of accuracy shouldn't be tested against them.
Uh…
NES (+PowerPak)**		29	42	 8	44	1	2	126
Famicom AV (+Everdive)	33	44	 7	43	2	3	132 [everdive sic]
Difference				 4   2  -1  -1  1   1    6
----------------------------------------------------
Gray cells on PPak		 5	 3	 0	 2	4	1	 15
Gray cells on Edrive	 4	 1	 6	 0	1	0	 12
Given that half the difference is "untested" (not marked pass/fail), that the untested groups are counted as failures, and that untested on EACH side > difference…I'm going to say "needs more data" rather than "Everdrive more accurate". I believe one could set up firmware so that it doesn't return to menu on reset, but I'd need to investigate further.
After lunch: The off-site link to the data on the powerpak tests is dead(404). It does not seem interesting that they fail the CPU test on a known-unstable (/machine-dependent) opcode $AB LAX. Register state rejiggering is probably among the easiest of things to change on a PowerPak mapper firmware file.
MESHUGGAH
Other
Skilled player (1918)
Joined: 11/14/2009
Posts: 1353
Location: 𝔐𝔞𝔤𝑦𝔞𝔯
Streemerz (from my #4050: MESHUGGAH's NES Streemerz: Super Strength Emergency Squad Zeta "Time Attack" in 03:31.87 notes:) - You can manipulate explosion sprite to pop up at different places by pressing A,L,R at random places. This can also affect enemies spawn (delaying them by 1 frame), so this is "remanipulated" to make 0 frame delays (you can't make them faster). I also believe that the game polls for input multiple times within a frame IIRC. It's easy to check by using my luascript which draws lag frames red in TAS Editor. This means that desyncs can happen because of these two factors (too). Battletoads If you request any movie for testing purposes just write it and I upload it. I can also replicate events (if you record the video, frame by frame) in TAS Editor. It isn't hard since the glitched TAS only goes to warp and then the magic happens. edit: IIRC it works in all versions, but levels and final magic is different (talking about japanese and europe)
PhD in TASing 🎓 speedrun enthusiast ❤🚷🔥 white hat hacker ▓ black box tester ░ censorships and rules...
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
After lots of searching and experimenting for the simplest test case that can provide useful data, I finally stumbled upon Donkey Kong Jr. The FCEUX version of this run is completely wrong due to bad powerup timing, but Mesen and BizHawk differ by only a single instruction on Frame 242, right when play begins. The difference is right at an NMI where an RNG routine is being performed. Eventually this change leads to the first red alligator going across the platform in BizHawk (where Jr. promptly runs into him) and down the vine in Mesen, (where Jr. passes but dies shortly there after on the third vine.) This is much much easier to examine then trying to track pies in Streemerz several minutes into the run, so hopefully with some console testing we can actually learn something.
Editor, Player (69)
Joined: 1/18/2008
Posts: 663
Sorry, things have not been great for me lately... haven't been able to do tests. Get together a test - the game (exact version), preferably the movie but a raw input dump works, the mode if a raw dump (per-frame, per-latch), and what exactly I should test for - and I will get to it soon. For Donkey Kong Jr it looks like a small NROM128 game so I can burn and do this one, assuming I can find blank EPROMs. My eraser is missing or stolen...
true on twitch - lsnes windows builds 20230425 - the date this site is buried
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
That's ok, I've basically made no progess until now anyway. Hope things finally start improving for you True. http://tasvideos.org/userfiles/info/39855636856675139 Here is the test run, play it on BizHawk 1.13.0. Dk Jr. will die shortly into the run, that's ok, just capture the inputs until the end. The Rom is: Donkey Kong Jr. (W) (PRG1) [!].nes SHA1:5D8CBA2011229DC67CCFF6C99E647238F260E7AF This run is basically testing power on timing. As far as I can tell, the folllowing 3 outcomes (deaths) are most likely: Left: BizHawk 1.13.0 Center: BizHawk Master Right: Mesen 0.9.0 http://i1053.photobucket.com/albums/s468/daviomace/dkjr_zpsddevsf8s.png I suspect that all 3 deaths might be possible on a NES, but I would really like to know how likely each one is, or if some other result all together happens. This is testing power on at roughly the CPU cycle level. If all 3 results (or more) are possible, then power on variability is higher then previously thought. If possible running the test a large number of times would be good to get a broad statistical sample. My hope is that only one or two outcomes actually happen though, which would be welcome. let's see
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
For the first time in a long time I have some new direction for possible NES console verifications. I have created a movie file with a version of Bizhawk that syncs to Mesen's power up timings. the movie file won't sync in the dev build of bizhawk since the timings are different, but here is a r08 of the input file I made using my personal build: https://www.dropbox.com/s/ukn7330nwkjhqxe/streemerz.bk2%20%281%29.frame.r08?dl=0 If anyone out there has the ability to do some console testing please give it a try. Keep in mind that NES power up timings are still quite variable, so it might take numerous tries to get it to sync, as this game is ppu timing sensitive. If this works out it is likely that I will change NEShawk's timings to match Mesen, then there will be many new areas to investigate, but for now hopefully this test works.
MESHUGGAH
Other
Skilled player (1918)
Joined: 11/14/2009
Posts: 1353
Location: 𝔐𝔞𝔤𝑦𝔞𝔯
Wouldn't other games could serve as a better example / easier to test and compare the results of console and bizhawk? - Paperboy - Already verified hard to verify TASes (Mega Man geg, Battletoads geg)
PhD in TASing 🎓 speedrun enthusiast ❤🚷🔥 white hat hacker ▓ black box tester ░ censorships and rules...
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
No, streemerz should have the same sync requirements as battletoads but somehow never synced on console in earlier tests despite many tries . So it’s likely that battletoads synced only from lucky error cancelling.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
https://www.dropbox.com/s/rr4mn6trfh5iqgj/streemerz_joe.bk2%20%281%29.frame.r08?dl=0 http://tasvideos.org/userfiles/info/71811809490780451 Here is a streemerz input file for superb joe mode. once again this sync on Mesen and my personal build but not on Bizhawk dev build.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
I'm starting to look into nes console verifications again. For now I'm still working along the lines of syncing some runs to mesen start up timings. The first successful one so far is nightshade: http://tasvideos.org/userfiles/info/71845677054219302 I've also has a few setbacks with some games behaving differently even though I otherwise match mesen's start up timings, so there is definitely more to look into.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
Dusting off this thread as I prepare for renewed NES console testing. Surprisingly there are some notable changes since I last looked at this. Probably one of the first important things to look at is this: https://forums.nesdev.com/viewtopic.php?f=3&t=18414 This glitch (currently unimplemented in NESHawk, but is in Mesen) actually effects a published TAS: http://tasvideos.org/3314M.html . It also occurs in Streemerz (but I can't tell yet if it effects sync.) The internal workings of Mesen timing have changed significantly as well. I used to be able to match execution between NESHawk and Mesen but as of 0.9.9 I am unable to do so. There isn't much testing here yet, could be interesting, maybe just using current Mesen will solve all the problems. Unfortunately, Sour has since left emulation, so if something doesn't work, it's not really clear what to do. I have several games lined up for testing: Donkey Kong: No agreement between NESHawk, Mesen 0.9.8, and 0.9.9, will be interesting to see what console shows. Nightshade: Again no agreement Bionic Commando: NESHawk and both versions of Mesen agree that this run should work on console, but it never has. Lolo 3: shows interesting power up timing variability between emulators Lots of interesting stuff to work on. My goal (still) is to see Streemerz work on console.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
Started doing some preliminary work. I confirmed that the OAM glitch occurs on console and that if I implement it in NESHawk I can match sync with Mesen 0.9.8. I found several other games that encounter the new OAM glitch, apparently it's not too uncommon to turn off the screen during rendering. They reset $2003 with manual writes though, so are unaffected. Looked at Monopoly, confirmed it uses uninitialized RAM, but is otherwise not too timing sensitive, those runs should work on console with RAM cleared to 0.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
Got my TAStm32 board working and am streaming some Donkey Kong TAS verification attempts now. Current NESHawk settings resulted in no syncs. Mesen 0.9.8 settings also resulted in no syncs. Currently trying alternate settings that work for SMB3 glitch run, with some success.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
Mixed results in testing today. Donkey Kong syncs with minor adjustments to the current run, but only with 1/4 probability due to start up variability. T&C surf designs syncs with the OAM glitch implemented properly. Silver Surfer needs RAM cleared, I think it would work with that, but doesn't with just hard resets. Nightshade doesn't work, not sure why, but it's MMC3 so might be related to that. Bionic Commando desyncs in the same spot as described by Bigbass, very strange as nothing of note appears to be happening at that point.
Bigbass
He/Him
Moderator
Joined: 2/2/2021
Posts: 194
Location: Midwest
Alyosha wrote:
Donkey Kong syncs with minor adjustments to the current run, but only with 1/4 probability due to start up variability.
Curious, what is the variability from? Uninitialized RAM affecting something?
TAS Verifications | Mastodon | Github | Discord: @bigbass
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
Bigbass wrote:
Alyosha wrote:
Donkey Kong syncs with minor adjustments to the current run, but only with 1/4 probability due to start up variability.
Curious, what is the variability from? Uninitialized RAM affecting something?
I mean this hardware effect: http://forums.nesdev.com/viewtopic.php?t=6186 For games requiring careful timing, that use most ppu features, this basically gives them a 1/4 chance of working from power on. Also there is probably some additional variability of the ppu and cpu seeing the end of reset at slightly different times. If you look earlier in this thread, you can see some results from True when running the read2004.nes test rom on hardware. He got more then 4 different values, meaning something else is giving some timing variability. I think this is what is keeping Nightshade from working (or possibly working but with very low probability.) Almost all NES test roms test relative timing between events, so we don't know very much about absolute timing from power on. I'm not even entirely sure the test rom suite is internally consistent in always relying on the same power up alignment. NES is far messier then GB/C in this sense. Mesen 0.9.9 emulates the alignment variability (options->emulation->advanced-> randomize power on/reset cpu/ppu alignment) if you are interested in tinkering with it. Link to video
Emulator Coder, Judge, Experienced player (730)
Joined: 2/26/2020
Posts: 783
Location: California
So by chance you can effectively enter into several different "odd modes" for the NES. At least for GB/C that can only happen for GBC and that's with multiple speed switches...
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
CasualPokePlayer wrote:
So by chance you can effectively enter into several different "odd modes" for the NES. At least for GB/C that can only happen for GBC and that's with multiple speed switches...
Essentially yes, it makes tracking down emulation issues especially difficult, because if you have a run that desyncs in 3 different ways, how do you know which one is the emulation issue and which ones are from the wrong alignment? This is why I have anchored NESHawk to a particular run of Battletoads that was shown to work on console for so long, changing it without a lot of evidence that a different state would be better was just too risky. Anyway, I figured out what is wrong with Bionic Commando, incompatible lag definition between emulator and replay device, and having fixed that it now works. I'll be streaming the results a bit later if anyone is interested. I also updated the dump script for NESHawk which works better with the new Frame-increments-after-emulation rule. http://tasvideos.org/userfiles/info/72231161716346055 Unfortunately a lot of runs I try use uninitialized RAM, so progress is pretty slow on actually verifying new things, eventually I'll need to make a RAM clearing cart, there's a lot to do.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
I updated NESHawk's timing of the oninputpoll event to match actual polling and made an appropriate dump script, so now I can test games that do more then one poll per frame. http://tasvideos.org/userfiles/info/72268404788366985 With this I was able to verify Balloon Fight: Link to video I also verified the all items run of Bionic Commando as well (although that run is outdated as it doesn't use the skips in the last level.) I'll get some videos up later today and organize .r08 files.
Alyosha
He/Him
Editor, Emulator Coder, Expert player (3824)
Joined: 11/30/2014
Posts: 2832
Location: US
I did some investigating of power on timing using the numerous playback attempts of Roger Rabbit I recorded. As it turns out it wasn't that hard to nail down exactly what the valid power on states were. In the following results, ofst is the offset from cycle zero, scanline 0 where the ppu starts that the cpu starts executing cycles, vbl is the state of the vbl flag at power on, and even_odd is the parity of the frame (one cycle skipped every other frame for NTSC consoles.) ofst = -1, vbl = true, even_odd = false; gives no match to console. ofst = -2, vbl = true, even_odd = false; gives exact match to console. Gives correct items. ofst = -3, vbl = true, even_odd = false; gives exact match to console. ofst = -4, vbl = true, even_odd = false; gives exact match to console. ofst = -5, vbl = true, even_odd = false; gives exact match to console. ofst = -6, vbl = true, even_odd = false; gives no match to console. ofst = -1, vbl = true, even_odd = true; gives no match to console. ofst = -2, vbl = true, even_odd = true; gives no match to console. Gives correct items. ofst = -3, vbl = true, even_odd = true; gives no match to console. ofst = -4, vbl = true, even_odd = true; gives no match to console. ofst = -5, vbl = true, even_odd = true; gives no match to console. ofst = -5, vbl = false, even_odd = true; gives no match to console. ofst = -4, vbl = false, even_odd = true; gives no match to console. ofst = -3, vbl = false, even_odd = true; gives no match to console. ofst = -2, vbl = false, even_odd = true; gives no match to console. ofst = -1, vbl = false, even_odd = true; gives no match to console. ofst = -5, vbl = false, even_odd = false; gives no match to console. ofst = -4, vbl = false, even_odd = false; gives no match to console. ofst = -3, vbl = false, even_odd = false; gives no match to console. ofst = -2, vbl = false, even_odd = false; gives no match to console. ofst = -1, vbl = false, even_odd = false; gives no match to console. ofst = 0, vbl = false, even_odd = false; gives no match to console. The results are pretty definitive. No valid states result from even_odd being true or from VBL being false. The documentation says that VBl is expected to be on some of the time, but I couldn't find any cases where it was off that matched playback. I originally expected valid ofst values clustered around 0, but I guess the CPU takes an extra cycle to reset, so -3 is the next most likely one, which is what we see here. values of -5 and -2 are possible but of low probability. (Mesen appears to match -5 in 0.9.9.) I then tested nightshade, and got a syncing run using -2, but only with very low probability ~1/20 or less. Testing with -3 resulted in a desync, not sure why, maybe something to do with MMC3 clocking. -4 did result in a syncing run though with much higher probability (worked on the third try.) A run of Donkey Kong on the -4 setting also synced to console. So with all of that, it seems very likely that the new startup state will be ofst = -4, vbl = true, and even_odd = false. I'm going to get complete runs of Nightshade and Roger Rabbit tested on these setting, and then try Battletoads, if everything works I will update NESHawk settings in master.
Patashu
He/Him
Joined: 10/2/2005
Posts: 4044
Out of curiosity, is NES startup state the kind of thing that tends to be similar between different people's NESes or different, or do you only know about your own for now?
My Chiptune music, made in Famitracker: http://soundcloud.com/patashu My twitch. I stream mostly shmups & rhythm games http://twitch.tv/patashu My youtube, again shmups and rhythm games and misc stuff: http://youtube.com/user/patashu