Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
How much lag feos? Anything quantitative?
I wonder if it would be better to just send the client audio/video instead of having it run the movie. They can be streamed as they are generated I suppose which might be faster but i dont know anything about networking.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
It took quite a bit of digging, but all of this is actually correct.
To understand what's happening here, you first have to realize that the 'pause' button on SMS is actually tied to a non-maskable interrupt. The routine the game is doing is decrementing a counter at $DFE7. The problem is that the decrement happens once per interrupt. So when you press pause every other frame, you get 2 decrements on frames with the pause (1 for NMI and one for VBlank.)
The obvious question is then why doesn't TwoMbit have this effect? Well I'm not 100% sure but if they happened to poll input at vblank, what would happen is that the NMI would happen first and then immediately the Vblank IRQ would happen before the decrement could take place.
Actually, with subframe inputs there would be enough time to decrement the counter in only a couple of frames. I'm not sure if this would make the game crash though.
This is because Pause is an NMI and not effected by lag.
NMI always happens, but depending on the state of the RAM it could have no effect.
Reset on the other hand, is treated as a normal controller input. So if the controller is not being read, the reset won't work. Strange stuff.
I'm not sure what TwoMbit is doing exactly but it seems like it's just doing a power cycle.
Here is some great SMS info:
https://pastebin.com/raw/eU8E2nKi
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
GG/SMS and intellivision could use some compatibility testing for sure. (I just committed a fix for SMS Xyzolog that I saw was broken in your doc.)
Ah ok, I see, it's not the core that is throwing the error. The hotkey ctrl+s is acting both in TAStudio and in EMUHawk. CTRL+S in EmuHawk is flush savram, and it apparently doesn't check if there is an instance of saveram available to work with. I'll try to figure out what's going on there.
EDIT: fixed in master.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
1- fixed in master (as best i could, still a couple pixels off)
2- works fine for me. What game were you testing with?
EDIT: EMU 7800 is pretty buggy, your time might be better spent on other systems. Atari 7800 really needs a modern in house core (unless you plan on fixing the bugs yourself, in which case nevermind me.)
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
1.12.1
1 - Not sure what you are asking here, can you give a specific example? Is it fixed in 1.12.2?
1.12.2
1-It looks like you are trying to load a tasproj from a previous version. This will not work since I had to change EMU7800 core states. This means a state variable will be missing in TASproj's from older versions. Export to BK2 then reimport to a tasproj should work, or just clear out the greenzones.
2-fixed in master, try the dev build
3-This should have been fixed, but if you have a file where it happens please send it to me.
4-unsure what's happening here, I'll test it out though.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Not sure exactly what you are reffering to, but I'm guessing NES->Graphics Settings->allow more then 8 sprites per scanline is what you want.
If not you'll need to be more specific.
If you mean for game gear games, its SMS->Sprite Limit
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Really? I must be reading the code wrong then.
So far I've only been looking at read2004.nes start up, and I can't get the first 5 frames to sync up (which only involves reading the VBlank flag) so there must be something else different happening there.
Back to the drawing board I guess.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
I've been comparing trace logs between Mesen and BizHawk but things don't seem to be working out. I believe the problem is that Mesen emulates the system like CPU_tick->PPU_tickx3 while BizHawk does the opposite.
This is a big problem for games, and for tests that rely on absolutely timed code, since the issues that crop up are related to reading the VBlank flag which is sensitive to 1 ppu tick.
We rely heavily on relatively timed test ROMs, which sync themselves to a singal PPU tick, but the syncing process masks out how the emulator deals with it.
Both ways are almost certainly wrong and mistiming certain situations. I believe this is a significant roadblock to getting many more games to sync on hardware.
Probably what we really need is an emulator in between visualNES and Mesen/BizHawk that runs at the master clock tick level without being a chip simulator.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Ok, version 1 is broken because the format changed between releases.
Version 2 records fine but yeah when you resize the recording it slows down considerably, I'm not sure exactly what is causing this, must be using a lot of computing power trying to rescale, not sure there is anything I can do about it though.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
I tested again using the same game and steps you used above. Everything runs fine and recording happened at 60 FPS. The resulting video looked and played correctly.
If you want you can send me your specific movie file and I can try making a recording of it to see if anything happens, but other then that I'm not sure what I can do since everything works correctly for me.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Oh that was fast, thank you! I didn't see that option.
One other thing, is it possible to add an option to have the VBlank flag set at power on? Most games are pretty good about checking first but there are important examples where the game just blindly waits for 2 vblanks and obvious differences appear when it is set at power on.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Some console testing needs to be done with paperboy before a new run can be made. The arrangement of customer houses after power on is determined by power up timings in the emulator, and I am almost certain that the configuartion in the currently published run is not accessible at power on.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Thanks for the fixes!
One other thing I noticed is that when I pause the emulator, the counters disappear. This makes it a bit difficult to compare frames, is there a way they can be made to stay visible?
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Well, it doesn't sound all that great on console, but also the EMU7800 core used in BizHawk is not partiuclarly strong. Comparing against other video online of this game, there are pretty obvious emulation issues. Might be worth while to make an in house 7800 core that is less buggy.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Thanks!
I mean counting the CPU cycles that takes in the trace logger so it starts at 8 (9?) instead of 0.
EDIT: Also I'm noticing that Mesen seems to not be resetting everything completely on reloading a game / doing a power cycle. I am working with the game Bible Buffet (USA) (Unl) (v6.0) and when I first open Mesen and load the game, it takes 9 lag frames to get to the title screen. But, if I subsequently load the game or do a power cycle, it takes 10 lag frames, any ideas what is causing that?
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
@Sour: is there a frame counter in mesen? I found a lag counter but couldn't find the frame counter.
Also , what do think of powering on nes from CPU reset routine ? This is what biz hawk currently does and it would make it easier to compare trace logs.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
DId you mean altered PPU/CPU sync? because I don't think battletoads is affected by the APU in any way.
Building twice worked! Ok cool now I can do tests.
I'll do some more tests as time permits and try to track down where the two emulators differ.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Oh yeah, I forgot about that one, you are right.
Also, are we sure this game is emulated well enough that all these glitches are valid? Some of the glitches seem to strain the system pretty hard, and debugging utilities are currently pretty limited.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Sour, here are a couple of bk2's to test against Mesen, They are for Bionic Commando. I'll get a few more editted into this post by the end of the day too.
This is a good test since it requires fairly careful timing but not quite down to the ppu tick.
http://tasvideos.org/userfiles/info/37881733414401898http://tasvideos.org/userfiles/info/37881743719985076
If you are feeling ambitious, this battletoads run is known to sync completely through on console:
http://tasvideos.org/userfiles/info/38673693612623545
Battletoads requires exacting ppu level timing from power on to sync, so this run is probably the single strongest piece of evidence that BizHawk is actually doing something correctly beyond what FCEUX is able to do for actual games. You might need to fiddle with power on timing to get it to sync though.
EDIT:
Here are 2 more test runs for Streemerzzz. They sync on BizHawk but console testing indicates they both should desync. I'll be very interested to see what Mesen does with them.
http://tasvideos.org/userfiles/info/36472647975351756http://tasvideos.org/userfiles/info/36428673262038989
I tried testing myself but after I compile Mesen and try to run it I get errors (both in x86 and x64):
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
It's possible with the mini boss skip that doing level 7 first is slightly faster over all then stage 8 first. It probably would be pretty close, at least worth looking into if a serious attempt to optimize this is being made.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
NES: Works for me, can you give a specific example of a code that doesn't work?
SNES: not sure
Genesis: known to not work in 1.12.1, should work now in the dev build though so give it a try.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Sour wrote:
Things I recorded in NesHawk and played back in Mesen:
-Super Mario Bros: OK
-Super Mario Bros V.S: OK
-Akumajou Dracula: Desyncs - the FDS implementation between Mesen/NesHawk is pretty different with regards to how the drive is emulated, so this is mostly unavoidable unless we agree on very specific timings.
-Contra: Desyncs near the end of level 1
Things I grabbed off TasVideos:
-Balloon Fight by Weegeechan: OK
-Castlevania 3 (Warp glitch): Desyncs, but seems to desync in NesHawk too?
-Addams Family by ventuz: Desyncs, but seems to desync in NesHawk too?
The main thing I had to modify in Mesen was the moment the frame number is changed (scanline 241 for NesHawk, was scanline -1 for Mesen), else almost everything was desynced.
One thing I noticed in NesHawk, after a reset (Scanline = 0, Cycle = 0), FrameAdvance is called, which calls this:
runppu(postNMIlines * kLineTime - delay);
This might mean that the CPU and PPU are running for ~20 scanlines, before resyncing back to scanline 0? I'm assuming I'm wrong since that would probably screw up a lot of stuff..
At this point, I guess I would need to use NesHawk's trace logger & compare it with Mesen to see why Contra desyncs - the rest is hard to judge since FDS will desync no matter what at this point, and the other 2 also desync in NesHawk.
EDIT: Forgot to mention, this only supports reading bk2 files, not creating them.
Contra uses the DMC so any stray controller read glitches will throw off the run. I imagine we don't emulate that exactly the same so I'm not surprised that one fails.
After reset, BizHawk runs a ppudead frame similar to power on, so no it doesn't jump into a frame in that awkward way, but it also isn't exactly the same as hitting reset either. This is a work in progress.
I only slightly modified FDS code to improve sound emulation and otherwise have not looked at all into how it is emulated, yeah probably hopeless to sync for now.
I'll try to post some BK2's that should sync in mesen in the next couple of days when I have a bit more time.
Editor, Experienced Forum User, Published Author, Expert player
(3572)
Joined: 11/30/2014
Posts: 2744
Location: US
Wow that ending input early trick. Well done finding that one. Congrats team 4.
We only missed 3rd by a couple frames.... ouch. XD
I have to say great work to Tompa for basically carrying the team. Also he found an instant mini boss kill that i didn't see in the winning submission, so good work on that too. This game sure was glitchy!
Thanks for hosting ThunderAxe31, I didn't really like the game but the time frame to TAS it in seemed sufficient so good job estimating that right.