Fox5 said:
Why can't hardware backwards compatibility be handled the same way as software emulators? Just lock everything to vsync and things generally turn out fine, they may even run better.
Things can mess up very quickly when the game itself does the same thing.
It is common good practice for PC games to do "proper" update physics. Ie when objects move, you give them a proper speed and acceleration, both of which are dependent on time (a velocity vector is an arbitrary unit
per second and acceleration is a change in speed
per second) and then multiply by the time elapsed since last snapshot to perform the update for the next snapshot. Snapshots are usually frames, but don't have to. Eg a physics snapshot is
not a frame in Doom 3, but rather a fixed 1s/60.
You don't have to bother at all on a platform where you can rely on performance of all components being constant, and a console obviously is such a platform. You can just move objects this and that distance
per frame, and accelerate them by some value
per frame. This will not work properly unless the emulator goes out of its way to pretend that the frame is as long as it was on the console, despite the game running at 85Hz instead of 60Hz.
Us poor gamers living in PAL regions have many a story to tell about games that rely heavily on frame timing. Eg Metroid Prime 2 has a warning text on the box that states that the game
requires a TV set that can handle PAL60. The game has not been adapted to the usual 50Hz, and now you guess why this might (not) have happened.
And you can go much crazier than just vsync.
It is not at all uncommon on console platforms that games catch a vblank interrupt for
all things that are convenient to do once per frame. Vblank is the point in time where the blank period begins in the traditional TV video formats, and historically the start of the time interval which is allocated to allow the cathode ray to travel back to the upper left corner.
You can
start by doing the page flip in a vblank handler. But that's just punching a different pointer into a register of the graphics processor. It's done very quickly, and you'll want to use the remainder of the time interval for other stuff. You can sample the joypad. You can do all your sound processing. And sound is the one area where I expect the biggest problems to occur.
Let's say you have a console game that uses double-buffered DMA for sound playback and is totally optimized for the console it runs on. The DMA buffers are
exactly the size required for the amount of samples that will play in one frame. 736 samples for 59.93Hz (NTSC rate) vblank interval and 44.1kHz playback rate.
You can arrange things so that every time the system enters that interrupt handler, the old DMA buffer is just finishing. You then have 1s/44100~=22,7µs to prepare the next sample. Because on a 500MHz CPU that's north of 11000 CPU cycles you might ... *drum roll* get the idea that you can pull this off with
single-buffered DMA. You can certainly mix a whole bunch of fresh samples in 11000 CPU cycles and be finished well in time to never have any clicks or skips.
Now, if you were to change the vblank period to 85Hz without adjusting the sound processing, you'd not play 736 samples per frame, but more like 519 and the remainder of the buffer would
just drop.
If OTOH you went to 50Hz (PAL), the DMA buffers would be too small (882 samples required, 736 samples allocated and mixed). You'd end up playing whatever garbage there is in memory behind the designated sound DMA buffer.
In both cases you'll end up with terribly distorted sound. You can fix it by either maintaining the exact vblank timing, or by patching up every single game that relies on it.
As Retro didn't bother to fix it even for the PAL version of MP2, I'm pretty confident that the latter option will not come to be the general solution for backwards compatibility.