We just released a Feb. 5 '89 prototype of DuckTales for the NES!
If you'd like to support our preservation efforts (and this wasn't cheap), please consider donating or supporting us on Patreon. Thank you!

Bugs:Metal Slug 2 (Neo Geo)

From The Cutting Room Floor
Jump to navigation Jump to search

This page details bugs of Metal Slug 2 (Neo Geo).

Metal Slug 2 is infamous for its poor performance on the original Neo Geo hardware (and accurate emulators), resulting in near-constant slowdown which makes the game crawl along at a pace unlike the rest of the series. While this is partly the result of a poorly optimized engine, there is also a bug in the main program's framerate-locking code, found in 241-1.p1 (MAME ROM naming). Metal Slug 2 is locked to a maximum of 30 frames per second, updating only on odd frames. The bug in question crops up when slowdown causes the game to consistently miss odd frames, since it will then wait a further two frames before updating. The result is that when the game should be dropping to 20 FPS, it instead drops to 15 FPS and when it should be dropping to 10FPS, it instead drops to 7.5 FPS. When genuinely dropping to framerates which don't cause the game to miss odd frames (such as 15 FPS), the issue is not seen.

trap15 (see source) documented the bug with the following pseudocode and created a patch which corrects this behavior: it does not make any further modifications to the engine, so the result is slowdown that occurs with the same frequency as the stock game, but with much-reduced severity.

void vblank_callback(void)
{
  if(vblank_counter != 0xFF)
    vblank_counter++;
  if(vblank_counter != 2)
    return;
  vblank_occurred = 0xFF;
  // do things...
}
void game_update(void)
{
  // do things...
  for(;;) {
    if(vblank_occurred & 0x80) {
      vblank_occurred &= ~0x80;
      break;
    }
    vblank_occurred &= ~0x80;
  }
  vblank_counter = 0;
  // do things...
}
(Source: trap15)