updated Win32/SDL port

This commit is contained in:
ekeeke31 2010-06-30 08:16:20 +00:00
parent daf11963b1
commit d2b4f21de8
8 changed files with 418 additions and 251 deletions

View File

@ -1,50 +1,125 @@
--------------------
Genesis Plus History Genesis Plus History
-------------------- --------------------
Note: All recent changes directly come from the GX (Gamecube/Wii) port, code by Eke-Eke. All recent changes were backported from the GX version (Gamecube/Wii port), maintained by Eke-Eke.
Please look at http://code.google.com/p/genplus-gx/ for more infos.
[14/12/08] (Eke-Eke) version 1.3.0
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- YM2612 bugfixes (MAME core): [06/30/10] version 1.4.0 (Eke-Eke)
----------------------------------------------------------------------------------------------------------------------------------------------------
[Core/Sound]
* completely rewrote sound processing/mixing: sound chips are now clocked with exact output framerate
to ensure 100% smooth video & audio playback, with no lag or skipping, while rendering an accurate number
of samples per frame and keeping PSG & FM chips in sync.
* improved PSG & FM chips synchronization with CPU execution (fixed point precision).
* improved YM2612 core general accuracy (SSG-EG, CSM mode,...) (based upon Nemesis recent tests on real hardware)
* improved YM2612 LFO emulation accuracy: fixes "Spider-Man & Venom : Separation Anxiety" (intro)
* fixed YM2612 bug with Timer B: fixes "Langrisser Hikari II"/"Der Langrisser II" (Sega logo)
* fixed YM2612 context saving/loading.
* fixed YM2612 state on reset.
* removed outdated & less accurate Gens YM2612 core
* added configurable YM2612 DAC resolution emulation.
* added configurable & faster FIR resampler (thanks to Blargg & AamirM), removed libsamplerate support.
* added configurable Low-Pass filtering
* added configurable 3-Band Equalizer (thanks to Neil C).
* added an option to boost SN76489 Noise Channel.
* adjusted SN76489 cut-off frequency.
[Core/VDP]
* added support for CRAM writes during horizontal blanking (Striker, Zero the Kamikaze Squirrel,...)
* added support for 2-Cell vertical scrolling in Interlaced 2 mode
* added support for some undocumented mode register bits
* added proper emulation of HV Counter latch: fixes Sunset Riders intro
* added pixel-accurate emulation of mid-line display on/off (Nigel Mansell World Championship PAL, Ren & Stimpy's Invention PAL,...)
* improved FIFO timings accuracy: fixes Sol Deace intro
* improved sprite masking accuracy (thanks to Nemesis for his test program)
* improved sprites processing accuracy: fixes (un)masked sprites in Mickey Mania (3D level), Sonic 2 (VS mode).
* improved HBLANK flag timing accuracy: fixes Mega Turrican (Sky level)
* improved horizontal blanking & HINT/VINT occurence timing accuracy, as measured on real hardware.
* improved HCounter accuracy in 40-cell mode, as measured on real hardware.
* improved color accuracy in VDP highlight mode to match results observed on real hardware
[Core/CPU]
* updated Z80 core to last version (fixes interrupt Mode 0 timing and some BIT instructions).
* fixed some Z80 instructions timing.
* improved Z80 interrupt accuracy
* improved 68k accuracy (initial Reset timing + auto-vectored interrupts handling).
* improved 68k timing accuracy for DIVU/DVIS (thanks to Jorge Cwik) & MULU/MULS instructions.
* improved Z80 & 68k cpu execution/synchronization accuracy by using Master Clock as common reference (now run exactly 3420 M-Cycles per line).
* modified Z80 & 68k cores to directly use external cycle count instead of intermediate counters.
[Core/Extra]
* added Game Genie hardware emulation (Game Genie ROM is now fully supported).
* added Action Replay hardware emulation (Action replay ROM is now fully supported).
* added S&K "Lock-On" hardware emulation (you can "lock" any games to Sonic & Knuckles).
* added Cartridge "hot swap" feature.
* added missing EEPROM support in some games.
* added accurate TMSS emulation (VDP lock-out)
* fixed Realtec mapper emulation: fixes missing sound in Balloon Boy / Funny World.
* fixed lightgun auto-detection: fixes default cursor position in Lethal Enforcers II.
* lots of code cleanup, bugfixes & optimization.
----------------------------------------------------------------------------------------------------------------------------------------------------
[12/14/08] version 1.3.0 (Eke-Eke)
----------------------------------------------------------------------------------------------------------------------------------------------------
* YM2612 bugfixes (MAME core):
.fixed EG Decay->Substain transition when SL & DR are minimals: fix tracks #3 and #9 in "Mega Turrican" .fixed EG Decay->Substain transition when SL & DR are minimals: fix tracks #3 and #9 in "Mega Turrican"
.fixed a bug in SSG-EG emulation code: fix Level 1 music in "Alisia Dragoon" .fixed a bug in SSG-EG emulation code: fix Level 1 music in "Alisia Dragoon"
.modified SSG-EG Decay End Level: fix some sound effects (ChainSaw, Zap...) in "Beavis & Butthead" .modified SSG-EG Decay End Level: fix some sound effects (ChainSaw, Zap...) in "Beavis & Butthead"
.improved Detune overflow accuracy: fix very high frequency sounds in many games .improved Detune overflow accuracy: fix very high frequency sounds in many games
.fixed registers 0x20-0x26 Reset state: fix intro music in "B.O.B" .fixed registers 0x20-0x26 Reset state: fix intro music in "B.O.B"
.reverted incorrect fix with KEY ON: fix "Flamethrower" sound effect in "Alien 3" and many others .reverted incorrect fix with KEY ON: fix "Flamethrower" sound effect in "Alien 3" and many others
- adjusted HCounter values: fixes line flickering in "Sonic 3D" bonus stage * adjusted HCounter values: fixes line flickering in "Sonic 3D" bonus stage
- adjusted VINT timing: fixes hang-up in "V.R Troopers" * adjusted VINT timing: fixes hang-up in "V.R Troopers"
- improved HBLANK flag accuracy: fixes line flickering in "Gouketsuji Ichizoku" * improved HBLANK flag accuracy: fixes line flickering in "Gouketsuji Ichizoku"
- fixed broken Z80 access to WRAM: fixes hang-up in "Mamono Hunter Youko" * fixed broken Z80 access to WRAM: fixes hang-up in "Mamono Hunter Youko"
- modified JCART emulation: fixes corrupted tracks logo in "Micro Machines 2" * modified JCART emulation: fixes corrupted tracks logo in "Micro Machines 2"
- added Blargg's NTSC Filters support (NTSC video artifacts emulation) * added Blargg's NTSC Filters support (NTSC video artifacts emulation)
- optimized VDP rendering core, rewrote 68k interface (memory handlers, cycle execution, interrupts): greatly improved emulation speed * optimized VDP rendering core, rewrote 68k interface (memory handlers, cycle execution, interrupts): greatly improved emulation speed
----------------------------------------------------------------------------------------------------------------------------------------------------
[08/26/08] (Eke-Eke) [08/26/08] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- YM2612(MAME): fixed LFO phase update for CH3 special mode: fix sound effects in Warlock & Aladdin (thanks to AamirM)
- YM2612(MAME): fixed EG attenuation level on "KEY ON": fix Ecco 2's splash sound
- YM2612(MAME): fixed SSG-EG emulation: fix Bubba'n Stix (Track 5) and many others
- YM2612(MAME): replaced sample interpolation with libsamplerate support, High Quality mode is now more accurate
- implemented cycle-accurate HINT timings: every timing sensitive games/demos are now *finally* working fine
- fixed a bug affecting CRAM/VSRAM DMA timings
- fixed Sprite Attribute Table address mask for VRAM writes
- improved accuracy of 68k access to Z80: fix music in Pacman 2 when entering PAUSE menu
- disabled "Address Error" emulation when UMK3 hack is loaded: fix game crashing after a round ends up
- added support for some more unlicensed games: Pocket Monster, King of Fighter 98, Soul Blade (credits to Haze)
- improved Menacer emulation: fix lightgun support in Body Count & T2: The Arcade Game
- added Konami Justifier emulation: fix lightgun support in Lethal Enforcers 1 & 2
- added Sega Mouse emulation (Populous 2, Body Count, Shangai 2, Fun'n Games, ...)
* YM2612(MAME): fixed LFO phase update for CH3 special mode: fix sound effects in Warlock & Aladdin (thanks to AamirM)
* YM2612(MAME): fixed EG attenuation level on "KEY ON": fix Ecco 2's splash sound
* YM2612(MAME): fixed SSG-EG emulation: fix Bubba'n Stix (Track 5) and many others
* YM2612(MAME): replaced sample interpolation with libsamplerate support, High Quality mode is now more accurate
* implemented cycle-accurate HINT timings: every timing sensitive games/demos are now *finally* working fine
* fixed a bug affecting CRAM/VSRAM DMA timings
* fixed Sprite Attribute Table address mask for VRAM writes
* improved accuracy of 68k access to Z80: fix music in Pacman 2 when entering PAUSE menu
* disabled "Address Error" emulation when UMK3 hack is loaded: fix game crashing after a round ends up
* added support for some more unlicensed games: Pocket Monster, King of Fighter 98, Soul Blade (credits to Haze)
* improved Menacer emulation: fix lightgun support in Body Count & T2: The Arcade Game
* added Konami Justifier emulation: fix lightgun support in Lethal Enforcers 1 & 2
* added Sega Mouse emulation (Populous 2, Body Count, Shangai 2, Fun'n Games, ...)
----------------------------------------------------------------------------------------------------------------------------------------------------
[07/16/08] (Eke-Eke) [07/16/08] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- adjusted (again) HINT timings: fix Double Dragon 2 (game freezed), hopefully does not break anything else
- fixed broken EEPROM support for Codemaster games * adjusted (again) HINT timings: fix Double Dragon 2 (game freezed), hopefully does not break anything else
- modified input update timings: fix Dungeons & Dragons - Warriors of the Eternal Sun (thanks to Notaz) * fixed broken EEPROM support for Codemaster games
- added support for "Ultimate Mortal Kombat Trilogy" hack (max. size supported is 10MBytes) * modified input update timings: fix Dungeons & Dragons * Warriors of the Eternal Sun (thanks to Notaz)
- added (VERY) preliminar support for PICO roms (credits to Notaz for his documentation) * added support for "Ultimate Mortal Kombat Trilogy" hack (max. size supported is 10MBytes)
- improved YM2612 emulation (credits to Nemesis for his tests on real hardware): * added (VERY) preliminar support for PICO roms (credits to Notaz for his documentation)
* improved YM2612 emulation (credits to Nemesis for his tests on real hardware):
.implemented phase overflow emulation: improved fix for special music instrument used in Comix Zone, Flashback, Ariel, Shaq Fu... .implemented phase overflow emulation: improved fix for special music instrument used in Comix Zone, Flashback, Ariel, Shaq Fu...
.improved SSG-EG emulation in MAME core (also based on additional code from Alone Coder) .improved SSG-EG emulation in MAME core (also based on additional code from Alone Coder)
.improved Timers emulation accuracy .improved Timers emulation accuracy
@ -52,99 +127,126 @@ Note: All recent changes directly come from the GX (Gamecube/Wii) port, code by
.fixed Channel 3 CSM mode emulation .fixed Channel 3 CSM mode emulation
.implemented sample interpolation in MAME core to emulate the chip at original frequency (HQ YM2612 mode, from gens) .implemented sample interpolation in MAME core to emulate the chip at original frequency (HQ YM2612 mode, from gens)
----------------------------------------------------------------------------------------------------------------------------------------------------
[06/01/08] (Eke-Eke) [06/01/08] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- improved HCounter accuracy: fix graphic glitches in "Striker (Europe)"
- improved HINT timing accuracy: fix flickering in "Zero The Kamikaze Squirrel (USA)"
- improved rendering accuracy when backdrop color is modified during HBLANK (Road Rash I/II/III)
- fixed broken Game Genie support
* improved HCounter accuracy: fix graphic glitches in "Striker (Europe)"
* improved HINT timing accuracy: fix flickering in "Zero The Kamikaze Squirrel (USA)"
* improved rendering accuracy when backdrop color is modified during HBLANK (Road Rash I/II/III)
* fixed broken Game Genie support
----------------------------------------------------------------------------------------------------------------------------------------------------
[04/19/08] (Eke-Eke) [04/19/08] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- modified VINT timings a little bit: fix lockup during Desert Strike's intro
- corrected 68k interrupts handling: fix graphic glitches in Darius II/Sagaia
* modified VINT timings a little bit: fix lockup during Desert Strike's intro
* corrected 68k interrupts handling: fix graphic glitches in Darius II/Sagaia
----------------------------------------------------------------------------------------------------------------------------------------------------
[04/06/08] (Eke-Eke) [04/06/08] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- updated SVP core: fix some perspective issues in Virtua Racing (thanks to Notaz)
- added internal SAT update during VRAM Fill: fix unmasked sprites during Battletech's intro
- fixed m68k core issues with gcc 4.2.3: fix Xperts, Lemmings 2, M1 Abrams Battle Tank
- forced YM2612 Enveloppe update: fix intro music in Batman&Robin (thanks to Aamir)
* updated SVP core: fix some perspective issues in Virtua Racing (thanks to Notaz)
* added internal SAT update during VRAM Fill: fix unmasked sprites during Battletech's intro
* fixed m68k core issues with gcc 4.2.3: fix Xperts, Lemmings 2, M1 Abrams Battle Tank
* forced YM2612 Enveloppe update: fix intro music in Batman&Robin (thanks to Aamir)
----------------------------------------------------------------------------------------------------------------------------------------------------
[03/01/08] (Eke-Eke) [03/01/08] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- added SVP emulation: Virtua Racing is now emulated (big thanks to Notaz and TascoDeluxe)
- fixed VDP registers behaviour when VDP Mode 4 is enabled: fix Bass Masters Classic Pro, Captain Planet & The Planeeters
- corrected a bug in DMA Fill operation: fix James Pond 3, Rockman World/Megaman Willy Wars (corrupted VRAM)
- corrected typo errors in CPU cycle counters update: fix optiom screen music in "College Slam" and probably others games.
- added preliminary support of undocumented YM2612 bug: fixes soundtracks of Shaq Fu, Spiderman, Comix Zone, Ariel and some others
- added support for mappers & copy protection devices used in many unlicensed/pirate cartridges (see cart_hw.c for details)
- rewrote memory handlers for better modularity and some (little) speedup
- reduced Savestate size
* added SVP emulation: Virtua Racing is now emulated (big thanks to Notaz and TascoDeluxe)
* fixed VDP registers behaviour when VDP Mode 4 is enabled: fix Bass Masters Classic Pro, Captain Planet & The Planeeters
* corrected a bug in DMA Fill operation: fix James Pond 3, Rockman World/Megaman Willy Wars (corrupted VRAM)
* corrected typo errors in CPU cycle counters update: fix optiom screen music in "College Slam" and probably others games.
* added preliminary support of undocumented YM2612 bug: fixes soundtracks of Shaq Fu, Spiderman, Comix Zone, Ariel and some others
* added support for mappers & copy protection devices used in many unlicensed/pirate cartridges (see cart_hw.c for details)
* rewrote memory handlers for better modularity and some (little) speedup
* reduced Savestate size
----------------------------------------------------------------------------------------------------------------------------------------------------
[01/07/08] (Eke-Eke) [01/07/08] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- fixed interleaved rom detection: roms with .smd extension should now work fine
- fixed a recently introduced bug in VDP registers writes: fixes bad colors in Toy Story (intro)
- updated list of games using EEPROM: added Sports Talk Baseball (internal memory check fixed) and Brian Lara Cricket
- fixed VINT flag update when VINT is disabled: fixes NCAA College Football
- adjusted DMA timings in H32 mode: fixes flickering in Out of this World, Kawasaki Superbike Challenge & Formula One
- adjusted line rendering and HBLANK timings: fixes flickering in Nigel Mansell's World Championship Racing, Deadly Moves/Power Athlete
- fixed unmapped ROM reads through Z80 Bank: fixes Zombie High (Proto)
- added support for custom ROM/RAM mapping used by Game no Kanzume Otokuyou
* fixed interleaved rom detection: roms with .smd extension should now work fine
* fixed a recently introduced bug in VDP registers writes: fixes bad colors in Toy Story (intro)
* updated list of games using EEPROM: added Sports Talk Baseball (internal memory check fixed) and Brian Lara Cricket
* fixed VINT flag update when VINT is disabled: fixes NCAA College Football
* adjusted DMA timings in H32 mode: fixes flickering in Out of this World, Kawasaki Superbike Challenge & Formula One
* adjusted line rendering and HBLANK timings: fixes flickering in Nigel Mansell's World Championship Racing, Deadly Moves/Power Athlete
* fixed unmapped ROM reads through Z80 Bank: fixes Zombie High (Proto)
* added support for custom ROM/RAM mapping used by Game no Kanzume Otokuyou
----------------------------------------------------------------------------------------------------------------------------------------------------
[12/28/07] (Eke-Eke) [12/28/07] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- many sourcecode cleanup and optimization
- completely rewrote EEPROM emulation: now support all known EEPROM types (24C01-24C65) and mappers (Sega, Acclaim, EA, Codemasters) * many sourcecode cleanup and optimization
* completely rewrote EEPROM emulation: now support all known EEPROM types (24C01-24C65) and mappers (Sega, Acclaim, EA, Codemasters)
used in a few games (now use internal game database) as external RAM. This should at least fix save support in the following games: used in a few games (now use internal game database) as external RAM. This should at least fix save support in the following games:
. NBA Jam (alternate Acclaim mapper) . NBA Jam (alternate Acclaim mapper)
. College Slam, Frank Thomas Big Hurt Baseball (24C65 type) . College Slam, Frank Thomas Big Hurt Baseball (24C65 type)
. NHLPA Hockey 93, Rings of Power (EA mapper) . NHLPA Hockey 93, Rings of Power (EA mapper)
. Micro Machines serie, Brian Lara Cricket 96/Shane Warne Cricket (Codemasters mapper) . Micro Machines serie, Brian Lara Cricket 96/Shane Warne Cricket (Codemasters mapper)
- external RAM is now initialized to 0xFF by default: fix Micromachines 2, Dino Dini Soccer * external RAM is now initialized to 0xFF by default: fix Micromachines 2, Dino Dini Soccer
- fixed SRAM 16-bits memory handlers: fix some Sega Sports and EA Sports games (NFL95, NBA Action 95, NHL97, NHL98,...) * fixed SRAM 16-bits memory handlers: fix some Sega Sports and EA Sports games (NFL95, NBA Action 95, NHL97, NHL98,...)
- modified WRITE_xxx & READ_xxx macros for better portability and faster memory access on BIG ENDIAN platform * modified WRITE_xxx & READ_xxx macros for better portability and faster memory access on BIG ENDIAN platform
- completely rewrote BIG ENDIAN support in render.c and vdp.c: rendering should be a little faster * completely rewrote BIG ENDIAN support in render.c and vdp.c: rendering should be a little faster
- rewrote ROM bankswitch emulation (Super Street Fighter II): ROM access are faster, using memory pointers instead of reading ROM copy from ARAM * rewrote ROM bankswitch emulation (Super Street Fighter II): ROM access are faster, using memory pointers instead of reading ROM copy from ARAM
- fixed leftmost Window/PlaneA column render and implemented Window bug (as described by Charles Mc Donald) * fixed leftmost Window/PlaneA column render and implemented Window bug (as described by Charles Mc Donald)
- improved "Sprite Limit" and "Sprite Collision" detection accuracy * improved "Sprite Limit" and "Sprite Collision" detection accuracy
- modified RGB565 Color Palette to use the full available color range (0-31;0-63) * modified RGB565 Color Palette to use the full available color range (0-31;0-63)
- implemented "cycle accurate" HV Interrupt timings: fix Sesame's Street Counting Cafe, Legend of Galahad (intro) * implemented "cycle accurate" HV Interrupt timings: fix Sesame's Street Counting Cafe, Legend of Galahad (intro)
- improved VDP access timings accuracy (added FIFO emulation): fix Double Clutch * improved VDP access timings accuracy (added FIFO emulation): fix Double Clutch
- improved DMA timings accuracy: fix Winter Olympics (E), Arch Rivals and probably more * improved DMA timings accuracy: fix Winter Olympics (E), Arch Rivals and probably more
- fixed HCounter again: Road Rash serie (I,II,III) don't need timing hacks anymore * fixed HCounter again: Road Rash serie (I,II,III) don't need timing hacks anymore
- fixed VCounter in Interlaced 2 mode: fix Combat Cars "VS-Mode" * fixed VCounter in Interlaced 2 mode: fix Combat Cars "VS-Mode"
- improved Interlaced 2 mode (double resolution) rendering: Sonic 2, Combat Cars ("VS-Modes") look far better * improved Interlaced 2 mode (double resolution) rendering: Sonic 2, Combat Cars ("VS-Modes") look far better
- added TMSS BIOS support (optional) * added TMSS BIOS support (optional)
- rewrote part of the YM2162 MAME's core: fixed internal FM timers handling, removed non-YM2612 emulation code and unused multiple cpu support * rewrote part of the YM2162 MAME's core: fixed internal FM timers handling, removed non-YM2612 emulation code and unused multiple cpu support
- implemented "cycle accurate" FM timers & sound samples rendering * implemented "cycle accurate" FM timers & sound samples rendering
- improved Z80 Interrupt timing accuracy: fix Sonic 3 music slowdowns * improved Z80 Interrupt timing accuracy: fix Sonic 3 music slowdowns
- updated Z80 & 68000 cores to last MAME versions * updated Z80 & 68000 cores to last MAME versions
- improved Soft Reset emulation: X-Men 2 and Eternal Champions (random character selection) now work more like on real hardware. * improved Soft Reset emulation: X-Men 2 and Eternal Champions (random character selection) now work more like on real hardware.
- added full overscan emulation (vertical & horizontal borders) for "pixel perfect" aspect ratio (tested against a real genesis) * added full overscan emulation (vertical & horizontal borders) for "pixel perfect" aspect ratio (tested against a real genesis)
----------------------------------------------------------------------------------------------------------------------------------------------------
[07/20/07] (Eke-Eke) [07/20/07] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- corrected TeamPlayer support: fix multiplayer in Gauntlet 4 (Sept. version), Pengo and a lot of others
- added J-Cart support: enable multiplayer in Codemasters games (Pete Sampras, Micromachines games, Super Skidmarks) * corrected TeamPlayer support: fix multiplayer in Gauntlet 4 (Sept. version), Pengo and a lot of others
- added serial EEPROM autodetection: fix games with bad SRAM informations in header (NBA Jam TE) * added J-Cart support: enable multiplayer in Codemasters games (Pete Sampras, Micromachines games, Super Skidmarks)
- added SVP faking: display 2D graphics in Virtua Racing (the game is however still unplayable) * added serial EEPROM autodetection: fix games with bad SRAM informations in header (NBA Jam TE)
- added support for more internal IO registers: fixe some unlicensed games (Wisdom Tree games...) * added SVP faking: display 2D graphics in Virtua Racing (the game is however still unplayable)
- added preliminary support for unmapped protection device: fix some unlicensed games with special built-in hardware (Squirell King, Lion King 2...) * added support for more internal IO registers: fixe some unlicensed games (Wisdom Tree games...)
- added "Soft Reset" combo (in game, use L+Z triggers): this should be like pressing the RESET button on a real Genesis and this is required * added preliminary support for unmapped protection device: fix some unlicensed games with special built-in hardware (Squirell King, Lion King 2...)
* added "Soft Reset" combo (in game, use L+Z triggers): this should be like pressing the RESET button on a real Genesis and this is required
in some games to enable special features or even complete the game (ex: X-Men). in some games to enable special features or even complete the game (ex: X-Men).
[06/21/07] (Eke-Eke)
-------------------
- added Multitap support (EA 4-Way Play and Sega Teamplayer): allowed up to four players in games supporting those peripherals
- added partial Sega Menacer lightgun support (use Analog Stick): automatically set when detecting the 6-in-1 Menacer game
----------------------------------------------------------------------------------------------------------------------------------------------------
[06/21/07] (Eke-Eke)
----------------------------------------------------------------------------------------------------------------------------------------------------
* added Multitap support (EA 4-Way Play and Sega Teamplayer): allowed up to four players in games supporting those peripherals
* added partial Sega Menacer lightgun support (use Analog Stick): automatically set when detecting the 6-in-1 Menacer game
----------------------------------------------------------------------------------------------------------------------------------------------------
[05/18/07] (Eke-Eke) [05/18/07] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- you can now switch between FM cores without reseting the game. FM registers value are automatically restored when switching.
- removed the previous VINT timings modification because it brokes some games (Rocket Knight, Thunderforce III,...) * you can now switch between FM cores without reseting the game. FM registers value are automatically restored when switching.
- added automatic Timing configuration (VDP latency, VINT timing & alternate Line Timing) at game loading, based upon specific romname detection. * removed the previous VINT timings modification because it brokes some games (Rocket Knight, Thunderforce III,...)
* added automatic Timing configuration (VDP latency, VINT timing & alternate Line Timing) at game loading, based upon specific romname detection.
This means you can still modify some of these options afterwards but they are now automatically set/unset when loading a game which need This means you can still modify some of these options afterwards but they are now automatically set/unset when loading a game which need
special timing fixes. These fixes are also automatically desactivated when the current game doesn't need them. special timing fixes. These fixes are also automatically desactivated when the current game doesn't need them.
For information, games that are actually detected and need special timings to run properly are: For information, games that are actually detected and need special timings to run properly are:
@ -152,81 +254,110 @@ For information, games that are actually detected and need special timings to ru
.Sesame Street Counting Cafe (don't boot) .Sesame Street Counting Cafe (don't boot)
.Chaos Engine/Soldiers of Fortune (graphic glitches on scrolling) .Chaos Engine/Soldiers of Fortune (graphic glitches on scrolling)
----------------------------------------------------------------------------------------------------------------------------------------------------
[05/08/07] (Eke-Eke) [05/08/07] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- VINT timings are now a little more accurate: fixes Sesame's Street Counting Cafe
- SN76496 MAX_OUTPUT back to normal
- modified FB_WNOISE value in SN76496 core according to John Kortink's last informations
- added support for Maxim's PSG core, same as used in SMSPLUS (it becomes the default PSG core)
- updated FM core to the latest MAME version
- corrected DAC output level (fixes voices and some special FX being too low)
- added support for Gens YM2612 (FM) core (MAME's one still remains default FM core)
- added configurable preamplification for each sound cores (see Emulator Options)
- added some other configurable sound options (boost overall volume, FM improvment for Gens YM2612)
* VINT timings are now a little more accurate: fixes Sesame's Street Counting Cafe
* SN76496 MAX_OUTPUT back to normal
* modified FB_WNOISE value in SN76496 core according to John Kortink's last informations
* added support for Maxim's PSG core, same as used in SMSPLUS (it becomes the default PSG core)
* updated FM core to the latest MAME version
* corrected DAC output level (fixes voices and some special FX being too low)
* added support for Gens YM2612 (FM) core (MAME's one still remains default FM core)
* added configurable preamplification for each sound cores (see Emulator Options)
* added some other configurable sound options (boost overall volume, FM improvment for Gens YM2612)
----------------------------------------------------------------------------------------------------------------------------------------------------
[04/11/07] (Eke-Eke) [04/11/07] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- corrected MAX_OUTPUT value in SN76496 core: fix PSG sound (SFX) volume
* corrected MAX_OUTPUT value in SN76496 core: fix PSG sound (SFX) volume
----------------------------------------------------------------------------------------------------------------------------------------------------
[03/17/07] (Eke-Eke) [03/17/07] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- added an option to enable alternate line rendering timing (fix single line error in Road Rash series and Legend of Galahad's Intro)
- Color RAM update now always reset color 0 to border color (fix color glitches in Mortal Kombat,...) (thanks to Noop's for the idea)
* added an option to enable alternate line rendering timing (fix single line error in Road Rash series and Legend of Galahad's Intro)
* Color RAM update now always reset color 0 to border color (fix color glitches in Mortal Kombat,...) (thanks to Noop's for the idea)
----------------------------------------------------------------------------------------------------------------------------------------------------
[03/09/07] (Eke-Eke) [03/09/07] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- modified HV counter tables (fix graphic glitches in Skitchin's sky, Lotus 2 Recs, Panorama Cotton, Dashin Desperados & maybe more)
- completely rewrote DMA timings emulation so that it works for all games (no more cpu freezing)
- added all DMA tranfer rates handling for each three DMA modes and added dma busy flag emulation
- modified interrupts handling on VDP register #0 and #1 writes (fix Lemmings status bar)
- added VDP RAM write latency (fix Chaos Engine/Soldier of Fortune gfx glitches)
- modified FM timers handling a bit (fix Vectorman2 music)
- corrected Sprite Limit rendering (fix Sonic 1 & Micromachines 2 title screens)
- corrected IO Registers writes (fix Decap' Attack controls, no more need for alternate input)
- corrected 6 Buttons Pad emulation (fix 6buttons detection in Mortal Kombat 3, Comix Zone and other 6-buttons compatible games)
- modified sound mixing a bit according to Generator sourcecode (FM and PSG ratios seems more correct)
* modified HV counter tables (fix graphic glitches in Skitchin's sky, Lotus 2 Recs, Panorama Cotton, Dashin Desperados & maybe more)
* completely rewrote DMA timings emulation so that it works for all games (no more cpu freezing)
* added all DMA tranfer rates handling for each three DMA modes and added dma busy flag emulation
* modified interrupts handling on VDP register #0 and #1 writes (fix Lemmings status bar)
* added VDP RAM write latency (fix Chaos Engine/Soldier of Fortune gfx glitches)
* modified FM timers handling a bit (fix Vectorman2 music)
* corrected Sprite Limit rendering (fix Sonic 1 & Micromachines 2 title screens)
* corrected IO Registers writes (fix Decap' Attack controls, no more need for alternate input)
* corrected 6 Buttons Pad emulation (fix 6buttons detection in Mortal Kombat 3, Comix Zone and other 6-buttons compatible games)
* modified sound mixing a bit according to Generator sourcecode (FM and PSG ratios seems more correct)
----------------------------------------------------------------------------------------------------------------------------------------------------
[02/07/07] (Eke-Eke) [02/07/07] (Eke-Eke)
------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------
- fixed fm timers (fix missing music in Castle of Illusion, Quackshot, Undead Line, Wonderboy in Monster Lair, Cal 50, Turbo Outrun, Thundeforce 4 and maybe more)
- added complete EEPROM emulation (save support now works fine in Wonderboy5, Megaman Willy Wars, NBA Jam...) (credits to Notaz, adapted from Picodrive code)
- added preliminar dma timing emulation (fix bottom screen in Legend of Galahad) (credits to Notaz, adapted from Picodrive code)
- hack: clear Vint pending after Hint (INT level 4) acknowledge (fix Fatal Rewind)
- hack: modify read_bus16 to return a random value (fake fetch) (fix Time Killers)
- modified cpu execution timings, with more correct hblank and interrupts timing (fix ISS Deluxe, Double Dragon 2 and certainly more) (Based on Gens code)
- modified busreq mechanism: better synchro between z80 & 68k (no need to dejitter anymore) (Based on Gens code)
- added sprite collision detection (fix Strider 2)
- modified dma fill operation for big endian platform (fix Contra Hardcorps gfx garbage)
[05/25/03] * fixed fm timers (fix missing music in Castle of Illusion, Quackshot, Undead Line, Wonderboy in Monster Lair, Cal 50, Turbo Outrun, Thundeforce 4 and maybe more)
------------------- * added complete EEPROM emulation (save support now works fine in Wonderboy5, Megaman Willy Wars, NBA Jam...) (credits to Notaz, adapted from Picodrive code)
- Fixed a typo that made Z80 banked access to the VDP registers always fail. * added preliminar dma timing emulation (fix bottom screen in Legend of Galahad) (credits to Notaz, adapted from Picodrive code)
* hack: clear Vint pending after Hint (INT level 4) acknowledge (fix Fatal Rewind)
* hack: modify read_bus16 to return a random value (fake fetch) (fix Time Killers)
* modified cpu execution timings, with more correct hblank and interrupts timing (fix ISS Deluxe, Double Dragon 2 and certainly more) (Based on Gens code)
* modified busreq mechanism: better synchro between z80 & 68k (no need to dejitter anymore) (Based on Gens code)
* added sprite collision detection (fix Strider 2)
* modified dma fill operation for big endian platform (fix Contra Hardcorps gfx garbage)
[05/17/03]
-------------------
- Modified the rendering code to handle unaligned longword access to memory.
[04/20/03] ----------------------------------------------------------------------------------------------------------------------------------------------------
------------------- [05/25/03] (Charles MacDonald)
- Modified 68000 emulator to prevent 'tas.b $mem' from writing data back ----------------------------------------------------------------------------------------------------------------------------------------------------
* Fixed a typo that made Z80 banked access to the VDP registers always fail.
----------------------------------------------------------------------------------------------------------------------------------------------------
[05/17/03] (Charles MacDonald)
----------------------------------------------------------------------------------------------------------------------------------------------------
* Modified the rendering code to handle unaligned longword access to memory.
----------------------------------------------------------------------------------------------------------------------------------------------------
[04/20/03] (Charles MacDonald)
----------------------------------------------------------------------------------------------------------------------------------------------------
* Modified 68000 emulator to prevent 'tas.b $mem' from writing data back
after a read (fixes Gargoyles). after a read (fixes Gargoyles).
- Fixed bug in 68000 emulator to swap order of words written for address * Fixed bug in 68000 emulator to swap order of words written for address
register indirect pre-decremented writes (fixes Jim Power graphics). register indirect pre-decremented writes (fixes Jim Power graphics).
- Added support for 240-line displays (for Super Skidmarks). * Added support for 240-line displays (for Super Skidmarks).
- Rewrote part of the interrupt handling (fixes some raster effects). * Rewrote part of the interrupt handling (fixes some raster effects).
- Removed sprite collision detection code (never really worked). * Removed sprite collision detection code (never really worked).
- Optimized sprite rendering inner loop. * Optimized sprite rendering inner loop.
[04/13/03]
-------------------
- Finished up memory map for VDP DMA V-bus reads.
- Fixed handling of 68000 writes to I/O chip at even addresses.
- Fixed bit 7 handling of control register in I/O chip.
- Finished up Z80 memory map.
- Added code to handle Genesis hardware lock-ups.
- Removed some faulty code from the 68000 memory map handlers.
[03/22/03] ----------------------------------------------------------------------------------------------------------------------------------------------------
------------------- [04/13/03] (Charles MacDonald)
- Completed implementation of Z80 banked memory handlers. ----------------------------------------------------------------------------------------------------------------------------------------------------
* Finished up memory map for VDP DMA V-bus reads.
* Fixed handling of 68000 writes to I/O chip at even addresses.
* Fixed bit 7 handling of control register in I/O chip.
* Finished up Z80 memory map.
* Added code to handle Genesis hardware lock-ups.
* Removed some faulty code from the 68000 memory map handlers.
----------------------------------------------------------------------------------------------------------------------------------------------------
[03/22/03] (Charles MacDonald)
----------------------------------------------------------------------------------------------------------------------------------------------------
* Completed implementation of Z80 banked memory handlers.

View File

@ -2,12 +2,13 @@
Genesis Plus Genesis Plus
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Version 1.2a based on the original version 1.2a
by Charles Mac Donald by Charles Mac Donald
WWW: http://cgfm2.emuviews.com WWW: http://cgfm2.emuviews.com
additional code by Eke-Eke version 1.4
WWW: http://gxdev.wordpress.com/ by Eke-Eke
WWW: http://code.google.com/p/genplus-gx
What's New What's New
@ -16,34 +17,40 @@
see CHANGELOG see CHANGELOG
Features (NEW!) Features
--------- ---------
* cycle-accurate CPUs emulation & synchronization (68000, Z80, YM2612, SN76489) * NTSC (60Hz) & PAL (50Hz) hardware emulation
* cycle-accurate VDP emulation (DMA, FIFO, HV interrupts, HBLANK,…) * highly accurate 68000 & Z80 CPU emulation
* original frequency YM2612 emulation (High Quality FM) * highly accurate VDP emulation (HBLANK, DMA, FIFO, HV interrupts, undocumented registers, display mid-line changes…)
* basic hardware latency emulation * cycle-accurate YM2612 emulation (FM synthesis is done at the original frequency, using FIR resampling)
* full overscan area (horizontal & vertical colored borders) emulation * cycle-accurate chip synchronization (68000/Z80/YM2612/SN76489)
* TMSS BIOS support * basic hardware latency emulation (VDP/68k, Z80/68k)
* PICO hardware support (experimental) * full overscan area (horizontal & vertical colored borders) emulation (optional)
* 3-buttons & 6-buttons controllers * accurate TMSS model emulation incl. internal BIOS support (optional)
* Sega Team Player & EA 4-Way Play multitap adapters (up to 8players !) * Blargg's software NTSC filters support (optional)
* Sega Menacer & Konami Justifier lightguns * PICO emulation (partial)
* Sega Mouse & Sega Mega Mouse * 3-buttons & 6-buttons controllers support
* SVP DSP (Virtua Racing) * Sega Team Player & EA 4-Way Play multitap adapters support
* J-Cart * Sega Menacer & Konami Justifier lightguns support
* backup RAM (parallel SRAM/FRAM and serial EEPROM) * Sega Mouse support
* ROM bankswitch (Super Street Fighter 2) * J-Cart adapter support(Micro Machines & Pete Sampras series, Super Skidmarks)
* SRAM switch (Phantasy Star 4, Legend of Thor, Sonic the Hedgehog 3) * SVP DSP emulation (Virtua Racing)
* ROM mappers & copy protection devices used in many unlicensed/pirate cartridges * SRAM support (up to 64kB)
* serial EEPROM emulation (all known chips)
* ROM bankswitch hardware support (Super Street Fighter 2)
* ROM/SRAM bankswitch hardware support (Phantasy Star 4, Legend of Thor, Sonic the Hedgehog 3)
* emulates most banking & copy protection devices used in unlicensed/pirate cartridges
* native Game Genie & Action Replay hardware emulation
* Lock-On hardware emulation
* support for ROM image up to 10MB (Ultimate MK3 hack)
Usage Usage
----- -----
The Windows version runs windowed in a 16-bit desktop with NO sound or The Windows version runs windowed in a 16-bit desktop with 48Hz sound using SDL but
joystick support. without joystick support.
The DOS version has most of the functionality from SMS Plus, such The DOS version has most of the functionality from SMS Plus, such
as audio, joysticks, etc. as audio, joysticks, etc.
@ -51,29 +58,27 @@
Windows/DOS controls: Windows/DOS controls:
Arrow Keys - Directional pad Arrow Keys - Directional pad
A,S,D,F - 1P gamepad, buttons A, B, C, Start A,S,D,F - 1P gamepad, buttons A, B, C, StartTab - Hard Reset
Tab - Hard Reset
Esc - Exit program Esc - Exit program
F7 - Load Savestate (game.gpz) F7 - Load Savestate (game.gpz)
F8 - Save Savestate (game.gpz) F8 - Save Savestate (game.gpz)
F9 - Toggle CPU clock: PAL(50hz)/NTSC(60hz) F9 - Toggle CPU clock: PAL(50hz)/NTSC(60hz)
F10 - Soft Reset F10 - Soft Reset
F11 - Toggle Player # (keyboard/mouse) F11 - Toggle Border emulation (vertical only)
F12 - Toggle Player # (keyboard/mouse)
DOS only: DOS only:
End - Exit program End - Exit program
F1-F4 - Set frameskip level (F1 = no skip ... F4 = skip 3 frames) F1-F4 - Set frameskip level (F1 = no skip ... F4 = skip 3 frames)
F5 - Log 68k memory access (for debug ONLY)
F6 - Log messages (for debug ONLY) F6 - Log messages (for debug ONLY)
WIndows only: WIndows only:
End - Exit program End - Exit program
F1-F4 - Set frameskip level (F1 = no skip ... F4 = skip 3 frames) F4 - Toggle Audio (ONLY when Turbo mode is OFF)
F5 - Log messages (for debug ONLY) F6 - Toggle Turbo mode (ONLY when Audio is OFF)
F6 - Toggle Turbo mode
The mouse can be used for lightgun games, PICO games and when the Sega Mouse is activated. The mouse can be used for lightgun games, PICO games and when the Sega Mouse is activated.
@ -134,25 +139,27 @@
(from the Gamecube/Wii port: http://code.google.com/p/genplus-gx ) (from the Gamecube/Wii port: http://code.google.com/p/genplus-gx )
The Genesis emulator authors: Bart Trzynadlowski, Quintesson, Steve Snake, The Genesis emulator authors: Bart Trzynadlowski, Quintesson, Steve Snake,
James Ponder, Stef, Gerrie, Sardu, Haze, Notaz, Nemesis, AamirM James Ponder, Stef, Gerrie, Sardu, AamirM
The regular people and many lurkers at segadev. The regular people and many lurkers at segadev and spritesmind.net.
People from SpritesMind.net forums
The MAME team for the CPU and sound chip emulators. The MAME team for the CPU and sound chip emulators.
Maxim for his SN76489 emulator Maxim for his SN76489 emulator.
Stef (again) for his alternate YM2612 emulator Nemesis for his researches about the YM2612 and VDP.
Notaz for his SVP emulator Notaz for his SVP emulator.
Tasco Deluxe for his documentation of Realtec mapper Tasco Deluxe for his documentation of Realtec mapper.
Erik de Castro Lopo for his "Secret Rabbit Code" library aka libsamplerate Haze for his reverse-engineering of most unlicensed games protection.
Jean-Loup Gailly and Mark Adler for their useful zip library Shay Green (Blargg) for his FIR Resampler & NTSC Video Filter.
Neil C for his 3-Band EQ implementation.
Jean-Loup Gailly and Mark Adler for their useful zip library.
Contact Contact
@ -164,12 +171,14 @@
Eke-Eke Eke-Eke
E-mail: eke_eke31@yahoo.fr E-mail: eke_eke31@yahoo.fr
WWW: http://gxdev.wordpress.com/ WWW: http://code.google.com/p/genplus-gx
Legal Legal
----- -----
Copyright (C) 1999, 2000, 2001, 2002, 2003 Charles MacDonald Copyright (C) 1999, 2000, 2001, 2002, 2003 Charles MacDonald
Copyright (C) 2006-2010 Eke-Eke
The source code is distributed under the terms of the GNU General Public The source code is distributed under the terms of the GNU General Public
License. License.

View File

@ -102,19 +102,24 @@ void set_config_defaults(void)
config.psgBoostNoise = 0; config.psgBoostNoise = 0;
config.filter = 1; config.filter = 1;
config.low_freq = 200; config.low_freq = 200;
config.high_freq = 20000; config.high_freq = 8000;
config.lg = 1.0; config.lg = 1.0;
config.mg = 1.0; config.mg = 1.0;
config.hg = 1.0; config.hg = 1.0;
config.lp_range = 50;
config.rolloff = 0.999;
/* system options */ /* system options */
config.region_detect = 0; config.region_detect = 0;
config.force_dtack = 0; config.force_dtack = 0;
config.bios_enabled = 0; config.addr_error = 1;
config.tmss = 0;
config.lock_on = 0;
config.romtype = 0;
/* display options */ /* display options */
config.overscan = 1; config.overscan = 1;
config.render = 1; config.render = 0;
/* controllers options */ /* controllers options */
input.system[0] = SYSTEM_GAMEPAD; input.system[0] = SYSTEM_GAMEPAD;

View File

@ -66,12 +66,17 @@ typedef struct
uint8 filter; uint8 filter;
uint16 low_freq; uint16 low_freq;
uint16 high_freq; uint16 high_freq;
uint8 lp_range;
float lg; float lg;
float mg; float mg;
float hg; float hg;
float rolloff;
uint8 region_detect; uint8 region_detect;
uint8 force_dtack; uint8 force_dtack;
uint8 bios_enabled; uint8 addr_error;
uint8 tmss;
uint8 lock_on;
uint8 romtype;
uint8 overscan; uint8 overscan;
uint8 render; uint8 render;
uint8 ntsc; uint8 ntsc;

View File

@ -90,9 +90,8 @@ int main (int argc, char *argv[])
bios_rom[i] = bios_rom[i+1]; bios_rom[i] = bios_rom[i+1];
bios_rom[i+1] = temp; bios_rom[i+1] = temp;
} }
config.bios_enabled |= 2; config.tmss |= 2;
} }
else config.bios_enabled = 0;
/* initialize genesis VM */ /* initialize genesis VM */
init_machine(); init_machine();

View File

@ -17,7 +17,7 @@ CFLAGS = `sdl-config --cflags` -march=i686 -O6 -fomit-frame-pointer -Wall -Wn
#-g -ggdb -pg #-g -ggdb -pg
#-fomit-frame-pointer #-fomit-frame-pointer
#LDFLAGS = -pg #LDFLAGS = -pg
DEFINES = -DLSB_FIRST -DX86_ASM DEFINES = -DLSB_FIRST
INCLUDES = -I. -I.. -I../z80 -I../m68k -I../sound -I../cart_hw -I../cart_hw/svp -I../ntsc INCLUDES = -I. -I.. -I../z80 -I../m68k -I../sound -I../cart_hw -I../cart_hw/svp -I../ntsc
LIBS = `sdl-config --libs` -lz -lm LIBS = `sdl-config --libs` -lz -lm

View File

@ -32,7 +32,7 @@ void set_config_defaults(void)
config.romtype = 0; config.romtype = 0;
/* display options */ /* display options */
config.overscan = 0; config.overscan = 1;
config.render = 0; config.render = 0;
/* controllers options */ /* controllers options */

View File

@ -123,6 +123,8 @@ sms_ntsc_t *sms_ntsc;
struct { struct {
SDL_Surface* surf_screen; SDL_Surface* surf_screen;
SDL_Surface* surf_bitmap; SDL_Surface* surf_bitmap;
SDL_Rect srect;
SDL_Rect drect;
Uint32 frames_rendered; Uint32 frames_rendered;
} sdl_video; } sdl_video;
@ -143,22 +145,40 @@ static int sdl_video_init()
static void sdl_video_update() static void sdl_video_update()
{ {
SDL_Rect rect;
system_frame(0); system_frame(0);
/* viewport size changed */ /* viewport size changed */
if(bitmap.viewport.changed) if(bitmap.viewport.changed & 1)
{ {
bitmap.viewport.changed = 0; bitmap.viewport.changed &= ~1;
rect.w = bitmap.viewport.w+2*bitmap.viewport.x;
rect.h = bitmap.viewport.h+2*bitmap.viewport.y;
if (config.render && (interlaced || config.ntsc)) rect.h *= 2;
if (config.ntsc) rect.w = (reg[12]&1) ? MD_NTSC_OUT_WIDTH(rect.w) : SMS_NTSC_OUT_WIDTH(rect.w);
rect.x=(VIDEO_WIDTH-rect.w)/2;
rect.y=(VIDEO_HEIGHT-rect.h)/2;
/* NTSC filters */ /* source bitmap */
sdl_video.srect.w = bitmap.viewport.w+2*bitmap.viewport.x;
sdl_video.srect.h = bitmap.viewport.h+2*bitmap.viewport.y;
sdl_video.srect.x = 0;
sdl_video.srect.y = 0;
if (sdl_video.srect.w > VIDEO_WIDTH)
{
sdl_video.srect.x = (sdl_video.srect.w - VIDEO_WIDTH) / 2;
sdl_video.srect.w = VIDEO_WIDTH;
}
if (sdl_video.srect.h > VIDEO_HEIGHT)
{
sdl_video.srect.y = (sdl_video.srect.h - VIDEO_HEIGHT) / 2;
sdl_video.srect.h = VIDEO_HEIGHT;
}
/* destination bitmap */
sdl_video.drect.w = sdl_video.srect.w;
sdl_video.drect.h = sdl_video.srect.h;
sdl_video.drect.x = (VIDEO_WIDTH - sdl_video.drect.w) / 2;
sdl_video.drect.y = (VIDEO_HEIGHT - sdl_video.drect.h) / 2;
/* clear destination surface */
SDL_FillRect(sdl_video.surf_screen, 0, 0);
/*if (config.render && (interlaced || config.ntsc)) rect.h *= 2;
if (config.ntsc) rect.w = (reg[12]&1) ? MD_NTSC_OUT_WIDTH(rect.w) : SMS_NTSC_OUT_WIDTH(rect.w);
if (config.ntsc) if (config.ntsc)
{ {
sms_ntsc = (sms_ntsc_t *)malloc(sizeof(sms_ntsc_t)); sms_ntsc = (sms_ntsc_t *)malloc(sizeof(sms_ntsc_t));
@ -193,14 +213,13 @@ static void sdl_video_update()
free(md_ntsc); free(md_ntsc);
md_ntsc = NULL; md_ntsc = NULL;
} }
} } */
} }
SDL_BlitSurface(sdl_video.surf_bitmap, NULL, sdl_video.surf_screen, &rect); SDL_BlitSurface(sdl_video.surf_bitmap, &sdl_video.srect, sdl_video.surf_screen, &sdl_video.drect);
SDL_UpdateRect(sdl_video.surf_screen, 0, 0, 0, 0); SDL_UpdateRect(sdl_video.surf_screen, 0, 0, 0, 0);
++sdl_video.frames_rendered; ++sdl_video.frames_rendered;
} }
static void sdl_video_close() static void sdl_video_close()
@ -229,7 +248,7 @@ static Uint32 sdl_sync_timer_callback(Uint32 interval)
{ {
int fps = vdp_pal ? (sdl_video.frames_rendered / 3) : sdl_video.frames_rendered; int fps = vdp_pal ? (sdl_video.frames_rendered / 3) : sdl_video.frames_rendered;
sdl_sync.ticks = sdl_video.frames_rendered = 0; sdl_sync.ticks = sdl_video.frames_rendered = 0;
sprintf(caption, "Genesis Plus SDL - %d fps", fps); sprintf(caption, "Genesis Plus SDL - %d FPS", fps);
SDL_WM_SetCaption(caption, NULL); SDL_WM_SetCaption(caption, NULL);
} }
return interval; return interval;
@ -260,6 +279,7 @@ static int sdl_control_update(SDLKey keystate)
{ {
case SDLK_TAB: case SDLK_TAB:
{ {
system_init();
system_reset(); system_reset();
break; break;
} }
@ -280,10 +300,10 @@ static int sdl_control_update(SDLKey keystate)
case SDLK_F4: case SDLK_F4:
{ {
SDL_FillRect(sdl_video.surf_screen, 0, 0); /*config.ntsc ++;
config.ntsc ++;
if (config.ntsc > 3) config.ntsc = 0; if (config.ntsc > 3) config.ntsc = 0;
bitmap.viewport.changed = 1; bitmap.viewport.changed = 1;*/
if (!turbo_mode) use_sound ^= 1;
break; break;
} }
@ -295,7 +315,7 @@ static int sdl_control_update(SDLKey keystate)
case SDLK_F6: case SDLK_F6:
{ {
turbo_mode ^=1; if (!use_sound) turbo_mode ^=1;
break; break;
} }
@ -350,9 +370,9 @@ static int sdl_control_update(SDLKey keystate)
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32; hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32;
/* reinitialize overscan area */ /* reinitialize overscan area */
bitmap.viewport.x = config.overscan ? 14 : 0; bitmap.viewport.x = (config.overscan & 2) ? ((reg[12] & 1) ? 16 : 12) : 0;
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0; bitmap.viewport.y = (config.overscan & 1) ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
bitmap.viewport.changed = 1;
break; break;
} }
@ -364,18 +384,18 @@ static int sdl_control_update(SDLKey keystate)
case SDLK_F11: case SDLK_F11:
{ {
joynum ++; config.overscan ^= 1;
if (joynum > MAX_DEVICES - 1) bitmap.viewport.x = (config.overscan & 2) ? ((reg[12] & 1) ? 16 : 12) : 0;
joynum = 0; bitmap.viewport.y = (config.overscan & 1) ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
bitmap.viewport.changed = 1;
break; break;
} }
case SDLK_F12: case SDLK_F12:
{ {
config.overscan ^= 1; joynum ++;
bitmap.viewport.x = config.overscan ? ((reg[12] & 1) ? 16 : 12) : 0; if (joynum > MAX_DEVICES - 1)
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0; joynum = 0;
bitmap.viewport.changed = 1;
break; break;
} }
@ -531,7 +551,7 @@ int main (int argc, char **argv)
bios_rom[i] = bios_rom[i+1]; bios_rom[i] = bios_rom[i+1];
bios_rom[i+1] = temp; bios_rom[i+1] = temp;
} }
config.bios_enabled |= 2; config.tmss |= 2;
} }
/* initialize SDL */ /* initialize SDL */
@ -543,8 +563,7 @@ int main (int argc, char **argv)
exit(1); exit(1);
} }
sdl_video_init(); sdl_video_init();
if (use_sound) if (use_sound) sdl_sound_init();
sdl_sound_init();
sdl_sync_init(); sdl_sync_init();
/* initialize Genesis virtual system */ /* initialize Genesis virtual system */
@ -557,6 +576,7 @@ int main (int argc, char **argv)
bitmap.pitch = (bitmap.width * bitmap.granularity); bitmap.pitch = (bitmap.width * bitmap.granularity);
bitmap.data = sdl_video.surf_bitmap->pixels; bitmap.data = sdl_video.surf_bitmap->pixels;
SDL_UnlockSurface(sdl_video.surf_bitmap); SDL_UnlockSurface(sdl_video.surf_bitmap);
bitmap.viewport.changed = 3;
/* initialize emulation */ /* initialize emulation */
audio_init(SOUND_FREQUENCY, vdp_pal ? 50:60); audio_init(SOUND_FREQUENCY, vdp_pal ? 50:60);
@ -574,8 +594,7 @@ int main (int argc, char **argv)
/* reset emulation */ /* reset emulation */
system_reset(); system_reset();
if(use_sound) if(use_sound) SDL_PauseAudio(0);
SDL_PauseAudio(0);
/* 3 frames = 50 ms (60hz) or 60 ms (50hz) */ /* 3 frames = 50 ms (60hz) or 60 ms (50hz) */
if(sdl_sync.sem_sync) if(sdl_sync.sem_sync)
@ -623,8 +642,7 @@ int main (int argc, char **argv)
free(cart.rom); free(cart.rom);
sdl_video_close(); sdl_video_close();
if (use_sound) sdl_sound_close();
sdl_sound_close();
sdl_sync_close(); sdl_sync_close();
SDL_Quit(); SDL_Quit();