FM2 Movies

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
FM2 Movies
by on (#79188)
The input log is specified in the file, but the docs don't really say when they should occur. At the beginning of a frame? the end? every time the joystick read is polled?

by on (#79195)
I got it working on SMB1 and SMB2 by incrementing and setting the joystick state at the start of every frame. Unfortunately, this doesn't work for SMB3 or Metroid. Haven't tried any others yet.

SMB3 gets out of sync and Metroid doesn't even get past the press start.

by on (#79199)
I'd do it every read first, seems most likely.

by on (#79211)
nope, that doesn't work exactly right. Metroid gets past the press start, but SMB1 now gets out of sync.

I agree though that is probably how it should work.

by on (#79214)
I read through the code for FCEUX, and it looks like they do it at the end of a frame. This is a pretty horrible way to do it as if they have a single timing bug which they fix, it invalidates playthroughs. It really should be once per joyread. That also means that any other emulator wanting to use FCEUX has to emulate all the benefits and bugs of FCEUX in order to use the playbacks. ick!

We really should come up with a standard. Is it possible to make one future proof? Would doing it on joyread make it future proof?

by on (#79215)
There are often two to four joyreads in a frame, especially in games using DPCM. Are you familiar with the "double clock bug"?

by on (#79218)
This is indeed a nontrivial topic, because even a slightest difference in initialization state or timing of an emulator can cause a desynch eventually.

I gave up trying to get FM2 files (converted to NMV) to play back correctly in Nintendulator (thread). The behaviour was very inconsistent.. movies would play back just fine for 5 minutes and then desynch. My goal was to get them to play back on PowerPak, but I gave up on that (at least momentarily) because most movies are for NTSC and I don't have an NTSC NES to test on.

I guess the only sure fire way to verify that stuff is being played back as it should (i.e. in the way FCEUX would play it) would be to log the playback of the movie in FCEUX Trace Logger and compare that against a log from your emulator.

by on (#79233)
tepples wrote:
There are often two to four joyreads in a frame, especially in games using DPCM. Are you familiar with the "double clock bug"?


? nope

by on (#79234)
Zelex wrote:
? nope

When DPCM samples are playing, the CPU periodically interrupts the program to fetch sample data, and for some reason these fetches can cause "phantom" clocks on the controllers, effectively corrupting the joypad data.

To solve this, some games read the controllers multiple times in the same frame until two consecutive reads match. DPCM also causes problems when reading data from VRAM through $2007, and AFAIK there's no fix for that, except for not doing that and play DPCM at the same time.

by on (#79236)
Are the movie files not simply the recordings of what was read back from each $4016/4017 poll? If not, why? Can still decode that to show button presses onscreen if desired.

Wouldn't help emulator synchronization much, but makes supporting any input peripheral automatic, and avoids at least some timing issues.

by on (#79247)
I'm pretty sure the reason that SMB1 works is that the entire game runs in the vblank NMI. That makes synchronization pretty darn simple and its hard to get wrong. The other games that don't work probably don't work because for some reason my emulator doesn't match exactly how many cycles are run per scanline with FCEUX. At least that gives me a target. But yeah, its probably a waste of time as the smallest thing can cause an eventual mis-sync.

by on (#79254)
FCEUX doesn't even pass the NMI timing tests, so FM2 movies are worthless for future-use until the emulator can pass the basic timing tests.