Gens/GS II
From Sega Retro
Gens/GS II is a partial rewrite of Gens/GS written by GerbilSoft. Gens/GS II improves the basic framework of the emulator, which will allow for the addition of many new features.
Contents
New features in Gens/GS II
- The UI now uses the Qt 4 library instead of GTK+ on Linux and Win32 on Windows. This means only one UI needs to be maintained for all platforms, instead of maintaining two separate UIs. It also means that Mac OS X is now supported natively.
- Full Unicode support provided by the Qt 4 library. (The onscreen display is still limited to cp1252; I may extend this later, but it's unlikely.)
- libgens does not use Qt, though it handles strings using UTF-8 natively. For full compatibility, it has parts of Gens/GS r7+'s Win32 Unicode Translation Layer in order to convert strings to/from ANSI and UTF-16 as necessary.
- The UI and emulation code are split into separate internal projects: libgens (for emulation) and gens-qt4 (for Qt4 UI). Additional UIs can be added later for other platforms, e.g. gens-win32 (for a minimal Win32 UI for Win9x, since Qt4 doesn't work on 9x) and gens-wii.
- ZOMG savestate format. Compared to the previous GSX-extended format, the ZOMG savestate format has much more comprehensive documentation and is extensible in a well-defined manner.
- OpenGL rendering. Gens/GS had OpenGL rendering on Linux, but Gens/GS II uses OpenGL rendering on all supported platforms.
- OpenGL shaders. Shader programs are used to provide certain effects, such as fast blur and the paused tint. Software fallbacks are still provided for systems that don't have the GL_ARB_fragment_program extension.
- 1x and 2x renderers are removed in favor of simply blitting to the OpenGL texture. 2x support is emulated by setting 640x480 output with nearest-neighbor interpolation.
- Support for more types of input devices. 3-button and 6-button gamepads are supported, but in addition, 2-button (SMS) gamepads are now supported. Teamplayer and 4WP support is much improved, and there's initial Sega Mouse support.
- Improved I/O tristate control. If a controller bit is set to input, then that bit shows up as a 1 on the controller side. Gens and Gens/GS do not properly implement this, but Gens/GS II does.
- Screenshots are now always saved in PNG format.
- Initial 64-bit and PowerPC ports. Compiling on these platforms currently results in a "no-emulation" build; that is, the CPU cores are not compiled, since they're still written in x86 assembly language. This does let me test the other components on these platforms, though. (DEBUGGING PURPOSES ONLY!)
- Color adjustment now has a fully-working "Inverted" option. In Gens/GS (and probably old Gens), using the "Inverted" option resulted in the wrong colors if brightness was not 0 or contrast was less than 0.
- Initial CD-ROM drive detection. Four backends are currently available: UDisks2, UDisks1, Unix, and Win32. As of the libgenscd rewrite, none of the backends have automatic disc detection. This will be re-added when Sega CD support is reimplemented.
- Sega CD Boot ROM configuration. The boot ROMs are examined when they are selected to determine their version and region code, and information is displayed regarding their compatibility. (Sega CD emulation hasn't been reimplemented yet.)
- Configuration is saved in ~/.config/gens-gs-ii/gens-gs-ii.conf (Unix, Linux, Mac OS X) or %APPDATA%\gens-gs-ii\gens-gs-ii.conf (Win32). A "portable" option will be added later for Win32, which will save the configuration in the executable's directory.
- Mac OS X customizations:
- Configuration changes are applied immediately.
- Fully-customizable keyboard shortcuts. There's no UI for it yet, but keyboard shortcuts can be customized in the configuration file.
- Internationalization. The user interface can be localized using Qt's translation system, which allows the UI text to be translated into multiple languages. Currently, US English and British English are fully supported, and there's an initial Japanese translation. More translations will probably be added once 1.0_beta1 nears completion.
Emulation Changes
- The VDP emulator has been ported from x86 assembly language to C++. (This was partially done in Gens/GS r7+, but Gens/GS II finishes it.) Among other things, it now passes all tests in Nemesis' Sprite Masking & Overflow Test ROM.
- Interlaced mode is now displayed using "flickering" interlaced (like Regen). That is, even fields are shown on one frame, and odd fields are shown on the next. This is a configurable option, and can be switched to flickering, even only (Gens-style), and odd only. 2x resolution mode (Kega-style) will be added later.
- Support for EEPROM save chips. Some games use Atmel I2C EEPROM chips instead of SRAM chips (e.g. NBA Jam), resulting in non-functional game save support on Gens/GS. With EEPROM support, game saving now works.
- Automatic SRAM/EEPROM saving. The SRAM/EEPROM contents is automatically saved to disk approximately one second after the game writes any data to the SRAM/EEPROM chip. This ensures that the internal save game is saved in case the emulator is shut down improperly (e.g. due to a crash or a power failure). Autosave is also triggered if the emulation is paused (by pressing Escape) or if a savestate with SRAM/EEPROM is loaded.
- Z80 can no longer read from M68K memory. Reads result in 0xFF. (Writes still function normally.) This matches the behavior of the original hardware.
- ROM cartridge handling has been abstracted into a new class, RomCartridgeMD. This class handles quirks for various ROMs:
- Puggsy: SRAM is automatically disabled. (Presence of SRAM triggers a copy-protection screen.)
- Psy-O-Blade: SRAM header is incorrect.
- HardBall '95: SRAM is located at $300000 with no $A130F1 register.
- Super Street Fighter II: Reworked the bankswitching system.
- Various unlicensed ROMs: Added read-only registers at $400000.
- Flat addressing: If no mapper is in use, ROMs up to 10 MB can be mapped from $000000 - $9FFFFF. This may fix some game hacks that use flat addressing instead of bankswitching. (This will not work for Sega CD "cartridge boot" or 32X games.)
Planned Features
- Standalone savestate viewer, which will allow users to view tiles, scroll planes, and sprites. This will later be integrated into an MDP plugin for real-time debugging functionality. Both ZOMG and GST savestates will be supported.
- Possibly a built-in "Credits Roll" ROM that displays the libgens credits in a fancy way.
- Automatic savestate option when closing an emulator. When reopening the emulator, the ROM and savestate would automatically be reloaded. (Suggested by gold_lightning in #retro.)
- Rewritten PCM emulator with proper support for the Envelope register.
- Rewritten CD-ROM handler with an abstract class interface. ISO/WAV and BIN/CUE will be implemented initially; ISO/MP3 may be added later. Physical CD-ROM support will probably be added after v1.0, since it requires different implementations on each platform. (BSD, Mac OS X, and Win32 all appear to use some sort of SCSI pass-through system, so it might be possible to write a single SCSI McdReader class with thin wrappers for the OS-dependent code. Linux has much simpler CD-ROM ioctl()'s, so it will probably be implemented first.)
- Compressed CD-ROM image support. Initial plans for a new format "MCDZ" have been written, though nothing has been published yet. Primary features of "MCDZ" will be lossless conversion to/from BIN/CUE (byte-identical BIN, parse-identical CUE) and support for gzip compression for data tracks and FLAC compression for audio tracks.
- Gamepad support is planned for 1.0_pre2. This includes the ability to map gamepad buttons to Gens actions, e.g. Quit, Save State, and Load State. Also planned is built-in Wii remote support via libcwiid. (Linux only)
Known Issues
- Framedropping doesn't work yet. If the system slows down for any reason, the emulator will stutter instead of dropping frames.
Features not ported from Gens/GS yet
- MDP plugin support.
- Sega CD and 32X emulation.
- Gamepad support.
- Command line parsing.
Preliminary Version Schedule
- Technical Preview 1: Implement framedropping; MD emulation fully implemented, along with ZOMG 0.8.
- Technical Preview 2: Sega CD emulation implemented with ISO/WAV, BIN/CUE, and possibly "MCDZ" support, along with ZOMG 0.9.
- Technical Preview 3: 32X emulation implemented, along with ZOMG 1.0.
- 1.0: Reimplement MDP plugin support and renderers.