Sega Mega Drive (SMD)

TODO: Problems with CRT effect and/or temporal blur (jumpy video) (Disabled temporal blur for now). TODO: Problem with FSGS crop and SMD interlace? Check Sonic 2 "demo mode".

TODO: Impractical gun/jump controls in Gunstar Heroes TODO: Impractical gun/jump controls in Mega Turrican

TODO: Support 3-button pad vs 6-button pad TODO: Support megamouse... ?

TODO: RetroArch / gamepad6 TODO: MAME / gamepad6

Supported Files

Supported file types:

NTSC vs PAL

Input Ports

FIXME: 3-button gamepad vs 6-button (and 2-button). Mega Mouse. Multitap? (port 3.. port 8)

Save Directory Layout

KBD: Mednafen F5 Save F7 Load KBD: Mame Shift+F7 Save F7 Load

FIXME: Saves are not portable... yet...

FIXME: Saves done in MAME appear in Mednafen, but not the other way around? FIXME: Save done in Mednafen appears in RetroArch, but crashes vice versa

RetroArch -> Mednafen: Mapper: SRAM SRAM Type: 0x5241f820 SRAM Start: 0x00200001 SRAM End: 0x002003ff Error reading from opened file ".../Data/Saves/UUID/59/5913062d-4e3b-5628-bac7-c1d465e395a6/75E9C470.sav": Unexpected EOF

FIXME: Different size? Sonic 3 1024 bytes (mednafen) vs 604 bytes (retroarch)

Example for Sonic The Hedgehog 3 (USA).md (Stored in Data/Saves/UUID/59/5913062d-4e3b-5628-bac7-c1d465e395a6):

Save.ini
# 75E9C470.srm
Mednafen/
  75E9C470.mc0
  75E9C470.mc1
  75E9C470.mc2
  75E9C470.sav # FIXME
MAME/
  # genesis/
  1.sta
  2.sta
  75E9C470.srm
RetroArch/
  Genesis-Plus-GX/
    75E9C470.srm
    75E9C470.state
    75E9C470.state1

The UUID is the variant UUID, and the base name for .srm and .state files (etc) is the first 8 hexadecimal letters of the SHA-1 ROM checksum. In this example, Mednafen has saved three save states in addition to the save RAM file (.srm).

G-Sync

Test games

Sonic the Hedgehog 3: Should be 320x224 and borderless for all regions (due to viewport setting).

Sonic the Hedgehog 3 [SET viewport = (nothing) in custom config] (EU / Mega Drive PAL) There should now be a black border on top and bottom of the display (320x240 output).

Ristar: Should be 320x224 in NTSC and 320x240 in PAL mode. In both cases, the graphics should fill the screen (game is optimized for full PAL frame).

Development notes

Useful references:

Resolution

In general, NTSC: 320x224, PAL: 320x240. It seems that many games in PAL mode still use 320x224, centered on the 320x240 output.

FIXME: MAME: It seems that MAME always uses 320x224 for Mega Drive/Genesis. Is this correct? Can it be adjusted? EDIT: Nevermind, it correctly uses 320x240 for Ristar (PAL), so it seems to detect the resolution of the running game somehow...

The Addams Family: Uses 256x224 ? (Did not verify) for both NTSC and PAL. Should be cropped. MAME seems to detect this as well, the game is cropped correctly. Mednafen: Shows 320x224 / 320x240. RetroArch / Genesis Plus GX: Seems to show 320x224 for both PAL/NTSC? Edit: By going into settings and changing from border: disabled to something else, and then back to disabled, this core also crops the game...

EDIT: It seems Mednafen does infact auto-detect and correct this when the md.correct_aspect option is enabled (horizontally), but it does not auto-detect if vertical PAL border should be cropped or not.

Test: .. (exceptions include games which make use of the "interlaced" screen mode - Sonic the Hedgehog 2 and Combat Cars)....

From https://segaretro.org/Sega_Mega_Drive_cartridges:

Fully optimised

Partially optimised

NTSC optimisations

Though rare, some NTSC Mega Drive games, typically those which originated in Europe, were not optimised for the hardware and so run faster than they should:

Games with 256-width resolution

Resolution can change throughout the same game, so ideally, the emulation should detect and correct this...

EDIT: It seems Mednafen does infact auto-detect and correct this when the md.correct_aspect option is enabled.

Games include (not an exhaustive list):

Mega Mouse

The following games support the Mega Mouse:

Display size

Batman - Revenge of the Joker (USA).md Display: 320x224 MAME: With noscale/square/pixeldoubling, the window is opened at 1x RetroArch: With noscale/square/pixeldoubling, the window opens @ 512x384 Resetting the window scale option to 2x in settings fixes the window. Mednafen-FS:

Save RAM

Sonic 3

Save data seems to be (up to) 1024 bytes. The first 16 bytes are 0xFF. The last 420 bytes are also 0xFF.

Mednafen: Every other byte is 0xFF (byte 0, 2, 4, 6, etc). MAME: Every byte is doubled (written twice? memory redundancy?)

Save data between Mednafen and MAME seems to be the same, except for the byte doubling (or lack of).

RetroArch/Genesis-Plus-GX: Seems to store data identical to Mednafen, except for not including the last 420 0xFF bytes.

https://forums.sonicretro.org/index.php?showtopic=22392: Regarding MD SRAM: Sonic 3's SRAM chip is only 8 bits wide, and is mapped to odd bytes. All the even bytes should be 0xFF (or 0x00 on some emulators). Gens (and Gens/GS) saves the SRAM in its native form. Kega and Regen have byteswapped SRAM, in which case the data is stored on even bytes instead of odd bytes.

Phantasy Star II

16384 bytes

Mednafen and RetroArch/Genesis-Plus-GX == Identical, byte 0, 2, 4 == 0xFF MAME: Every byte is doubled.

Sega Virtua Processor

Virtua Racing contains a custom-designed DSP chip, known officially as SVP, or Sega Virtua Processor.

FIXME: Test