If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Bugs:Metal Slug 2: Super Vehicle-001/II (Neo Geo)

From The Cutting Room Floor
(Redirected from Bugs:Metal Slug 2 (Neo Geo))
Jump to navigation Jump to search

This page details bugs of Metal Slug 2: Super Vehicle-001/II (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)