[SFC] bsnes Update

2007-02-17 - S-DSP

With some logs from DMV27, and assistance from blargg, I was able to fix the final remaining sound bug in bsnes. KON/KOFF behavior was updated to correct sound effects when pausing in Toy Story. Though despite having no known bugs, I'll continue to attempt to improve the accuracy even further.

I also worked a bit more on the lui port of bsnes. Video mode selection is now possible. But I still really need an input configuration window (and not to mention, Linux input support) at the very least before I can make another release.

bsnes v0.020 beta released

This is an early beta for the next release of bsnes. Please keep in mind that the new UI is not yet complete, so things are kind of minimal. This version should be a lot faster than the previous versions, but sound doesn't seem to be working right on some machines. If you get no sound, I apologize, this will hopefully be corrected in time for the next official release.

bsnes v0.020

Added blargg's new S-DSP emulator, runs at 1.024mhz. Many thanks to blargg for this, as this puts all portions of SNES emulation except for the S-PPU at bus-accuracy
blargg's S-DSP core fixes bugs in both Koushien 2 (J) and Toy Story (U)
Corrected all S-SMP cycle timings to be hardware accurate. Thanks to blargg for creating an amazing test ROM that tested every possible opcode
Corrected S-CPU wai instruction timing, fixes Mortal Kombat II
Reverted HDMA sync emulation once more to fix Breath of Fire II (G) and Secret of Mana (U)
Completely rewrote user interface to use libui, which is a wrapper that allows the same code to produce the same UI on both Windows (through the Win32 API) and Linux (through the GTK+ API)
Corrected $2100.d7 OAM reset behavior, thanks to research from anomie
Massively revamped the Linux port, should compile with no warnings or errors now
Added 64-bit support to libco, tested on FreeBSD/amd64, should work on Linux as well
Revamped makefile with suggestions from Nach
Improved Linux Xv renderer to use the far more common YUY2 format, which should work on most Xorg drivers, allowing hardware accelerated video scaling
Completely rewrote config file system. bsnes.cfg is now saved to user's profile folder on both Windows and Linux, allowing multi-user support
A lot more work has been done behind the scenes, including massive code cleanups and portability improvements

bsnes v0.021 released

This is a maintainence release. I am mostly releasing this for the sake of the recently released Der Langrisser translation.

Windows port can once again map joypads through the Input Configuration panel
Using enter or spacebar to assign a key should no longer instantly map those keys
F11 now toggles fullscreen mode
Esc now toggles menu on and off (use F11+Esc combined to hide UI completely)
Fixed a bug in King of Dragons (J, U, E), KOFF was not cleared during S-DSP power(), thanks to FitzRoy for the report, and blargg for assistance fixing the bug
Fixed serious crashing error with File->Load on Linux/amd64 port
Hopefully fixed min/max undefined error on GCC 4.2.0, but I am unable to test to verify
Fixed many cast const char* to char* warnings for GCC 4.2.0, but some probably remain, as again, I am unable to test as I lack GCC 4.2.0
Set XV_AUTO_COLORKEY to 1 for Video/Xv renderer. Should fix some video drivers where there was no output, especially after running mplayer, etc. Thanks to sinimas for the fix
Added clear_video() to Video/Xv renderer. Green edges at the bottom and right sides of the video output are now gone, and unloading a ROM will clear video

bsnes v0.022 released

* Fixed buffer overflow that was manifesting as corrupted tiles in Lemmings 2
* OAM and CGRAM addresses are now invalidated during active display, however the algorithms for how this address invalidation occurs is currently still unknown, so reads/writes are mapped to static addresses for now
* Re-added cheat code editor.
* Windows only: keypresses when main emulation window is not active are ignored once again

bsnes v0.023 released

- Fixed serious bug in S-SMP incw and decw instructions -- fixes sound bug in Emerald Dragon
- Added Nach's MinGW fixes -- can now be compiled with MinGW/GCC3 or MinGW/GCC4
- Fixed const char* cast warnings in GCC 4.2, thanks to [vEX] for the feedback
- Updated source to use latest libraries for libco, libui, etc.
- Added new advanced options to adjust aspect ratio correction
- Cleaned up source code a bit

bsnes v0.024 released

Improved CGRAM access timing restrictions, fixes a bug in WWF Super WrestleMania
Re-added Sufami Turbo menu to load ST and ST dual cartridges
Added support for the ST-010 coprocessor, used by F1 Race of Champions II
Improved libui to automatically adjust control sizes based on platform, vastly improves Windows UI
Fixed relative paths in config file for Windows port
bsnes no longer consumes 100% CPU time when idle on Linux port, thanks [vEX]
Fixed config file object to not rely on undefined C++ language behavior, thanks Nach

bsnes v0.025 released

Added DSP-3 support, thanks to John Weidman, Kris Bleakley, Lancer, z80 gaiden
Added DSP-4 support, thanks to Dreamer Nom, John Weidman, Kris Bleakley, Nach, z80 gaiden
Started on support for SuperFX, no games playable as chip emulation is less than 1% complete
Unsupported special chips will now display an alert
Missing stbios.bin file when loading Sufami Turbo cartridges will now display an alert
Video settings now saved separately for windowed and fullscreen mode
Advanced option video<.mode>.synchronize can be enabled for vsync, but will cause sound crackling
Added menu option to toggle FPS counter
Minor source code cleanup

bsnes v0.025a released

bsnes v0.026 released

Since the last public release, I've completely rewritten the memory mapping and cartridge loading systems. With this, I've added preliminary support for the Broadcast Satellaview (BS-X), however very few BS-X games will run at this time. I've also switched compilers from Visual C++/8 to MinGW/GCC4, which grants a ~5-10% speedup over the previous release.

Major source code cleanup
Completely rewrote memory mapper to support runtime MMCs
Updated S-DD1 MMC to use new memory mapping interface
Improved S-DD1 emulation, thanks to information from orwannon
Added support for SameGame -- load via "Load Special -> Load BS-X Slotted Cart" menu option
Completely rewrote cartridge loader to support BS-X, BS-X slotted carts and ST carts
Created custom dialog windows for multicart loading
Improved generic memory mapper, which eliminates the need for cart.db [Nach]
Added BS-X slotted cart detection to generic memory mapper [Nach]
Linux port will now ignore keypresses when window is inactive
Linux port will use much less CPU power when idle
Added detailed compilation instructions to Makefile for Linux port
Added "make install" target and PNG program icon for Linux port
Switched Windows compiler to MinGW/GCC4
Windows executable is now packed with UPX to decrease filesize
Removed .ufo, .gd7 and .078 ROM extensions; added .bs extension
Added preliminary support for the BS-X base unit, BS-X base cartridge + MMC, and BS-X flash I/O

bsnes v0.027 released

Major source code cleanup (lib/, ui/miu/, ui/vai/)
Cheat code editor was broken in v0.026, this is now fixed
Cheat code file format simplified for human readability
Makefile install target improvements [belegdol]
libui replaced with miu GUI library
Custom video / audio / input drivers replaced with vai HW library
ppc and ppc64 libco targets added [Vas Crabb]
x86 and x86-64 libco targets now work on OS X [Lucas Newman]

bsnes v0.028 released

OpenGL (with hardware filter mode support) and SDL video drivers added to Linux port
OpenAL (with speed regulation disable support) and OSS audio drivers added to Linux port [Nach]
SDL input driver (with joypad support) added to Linux port
Emulator pause option added
Added option to select behavior of bsnes when idle: allow input, ignore input or pause emulator
Added support to remap common GUI actions to key/joypad presses on the "Input Configuration" screen
bsnes will now clamp the video output size when it is larger than the screen resolution
GUI library has been enhanced, and renamed to hiro
Fullscreen mode now always centers video, rather than approximates
Fullscreen mode now works correctly on Linux/Openbox
Extra layer of abstraction in src/ui has been removed, as GUI lib unifies all ports anyway
Video, audio and input drivers unified into standard library, named ruby
All custom headers have been merged into a new template library, named nall
Makefile rewritten, vastly improved. Allows quick toggling of compiled-in drivers
Makefile: all object files now placed in /src/obj, binary placed in /
libco greatly enhanced, no longer requires an assembler to build [byuu, blargg, Nach]
libco SJLJ driver added; bsnes should now build on any Unix-derivative now (Solaris, OS X, PS3, etc) [Nach]
Fixed register $213e.d4 PPU1 open bus behavior [zones]
Windows port will not activate screensaver while bsnes is running [Nightcrawler]
Visual C++ target no longer requires stdint.h
And lots more -- mostly code refactoring related

bsnes v0.029 released

Greatly improved invalid DMA transfer behavior, should be nearly perfect now
Major code cleanup -- most importantly, almost all PPU timing-related settings moved back to PPU, from CPU
Added option to auto-detect file type by inspecting file headers rather than file extensions
Rewrote video filter system to move it out of the emulation core -- HQ2x and Scale2x will work even in hires and interlace modes now, 50% scanline filter added
Re-added bsnes window icon
Added new controller graphic when assigning joypad keys [FitzRoy]
Redundant "Advanced" panel settings which can be configured via the GUI are no longer displayed
Improved speed regulation settings
XP and Vista themes will now apply to bsnes controls
Added "Path Settings" window to allow easy selection of default file directories
Tab key now mostly works throughout most of the GUI (needs improvement)
Main window will no longer disappear when setting a video multipler which results in a window size larger than the current desktop resolution
Added two new advanced options: one to control GUI window opacity, and one to adjust the statusbar text

bsnes v0.030 released

bsnes v0.031 released

• Fixed bug and re-enabled HDMA bus sync delays
• Emulated newly discovered IRQ timing edge case
• Optimized offset-per-tile rendering
• Added state-machine implementation of S-DSP core, ~5% speedup
• Added SPC7110 detection, will now warn that this chip is unsupported
• Fixed very annoying Windows port OS beeping noise when using keyboard for input
• Linux port will now save most recent folder when no default ROM path is selected
• Added OpenGL rendering support to Windows port [krom]
• Fixed Direct3D pixel mode scaling bug [krom, sinamas, VG]
• Improved SNES controller graphic [FitzRoy]
• Added UPS (not IPS) soft-patching support; UPS patch must be made against unheadered ROM
• As always, cleaned up source code a bit

bsnes v0.032 released

A new version of bsnes has been released. This version includes multiple user interface enhancements, including localization support.

• Core: simplified CPU / SMP flag calculations
• Added ALSA audio output driver to Linux port [Nach]
• Improved font handling for Windows and Linux ports
• Greatly cleaned up the user interface
• Windows port now uses Unicode instead of ANSI
• Added localization support
• Config and locale files can now be placed inside bsnes executable directory for single-user mode, if desired
• Fixed crashing bug with HQ2x on Linux/amd64 port [RedDwarf, Nach]
• Hid "Power Cycle" option by default, as it is too similar to "Reset"
• Slighty tweaked program icon [FitzRoy]
• Minor code cleanups -- replaced union bitfields with templates, improved memory allocation, etc

bsnes v0.032a released

Very sorry for the inconvenience. Some last minute bugs snuck into the last release.

Also, I've added three new localizations: French (by tukuyomi), Portugese - Brazillain (by Hunter) and Russian (by Hatsuyuki). Dutch, Finnish and German should follow shortly, so be sure to check back in a week or so if you'd like one of those.

I forgot to mention this on the last update, but for any sites hosting the bsnes executable, you are free to distribute the archive with any locale you'd like. In fact, I'd prefer if you did, as it makes it easier for those who cannot read English.

• Windows: file open filters are now working once again
• All ports: emulation speed setting is now properly restored at startup

bsnes v0.033

This release adds SPC7110 emulation, without the need for graphics packs!!, and a rewritten S-RTC (real-time clock) emulator.

SPC7110 support means that Far East of Eden Zero, FEoEZ: Shounen Jump Edition, Momotarou Dentetsu Happy and Super Power League 4 are now all fully playable. I will warn you, the emulation is very slow in this version -- while most areas of each game will run at the same speed as other games, there are a few peak moments where speed will drop by up to ~50%. The reason for the slow-down is that I am currently uncertain how to determine the amount of data to decompress in advance, so I default to the maximum amount possible. The reason I am releasing now anyway, is because I beleive in the "release early, release often" paradigm. It will likely take me a few weeks to finish researching this chip, and I didn't want to keep the work I had private during that time. But rest assured, bsnes v034 should feature much faster SPC7110 emulation.

neviksti, Andreas Naive and jolly_codger worked non-stop on the SPC7110 decompression algorithm for the past two weeks. caitsith2 provided valuable data to the effort. I only wish that I could've been of some use, but alas, I had no role in this. In the end, it was neviksti who managed to crack all three(!!) compression modes of this chip, which turned out to be a customized 8-bit QM-coder with a prediction model. You can read more about this here. I would also like to thank Dark Force and John Weidman (aka The Dumper) for their research notes on the SPC7110 register interface.

For those who don't understand the hoopla about figuring out this compression algorithm when we already had graphics pack simulation, I should note that we have since found a few errors in these packs. Not to mention, you no longer need ~4-16MB packs for each game you wish to run. They work like any other game now. Better still, the chip can now be used to compress new graphics, eg for any future translation efforts on these titles.

The real-time clocks in both Far East of Eden Zero and Dai Kaijuu Monogatari 2 will now save a ".rtc" file in your save folder, which contains the clock as set by the video game, as well as a timestamp from your computer when the time was last updated. It uses the difference between the saved timestamp and current time to update the time. This allows you to specify any time you like, whereas previously bsnes would just use your computer's current time, ignoring the time you set in-game. It also allows the "round clock by 30 seconds" option in both games to work. I avoided this before because this method makes supporting daylight savings time and such impractical, although I should note that the original hardware did not support DST, either. This method was required to pass the SPC7110 tests, and is overall much more faithful to how the original chips worked.

Once again, I'd really like to personally thank neviksti for his tireless efforts. Eliminating graphics packs from SNES emulation was one of my primary reasons for getting involved in the SNES emulation scene. That neviksti managed to crack this algorithm means a lot to me. Thank you so much, neviksti. This release is dedicated to you, now go get some sleep ;)

bsnes v0.034 released

For this release: SPC7110 emulation speed has been greatly optimized, massive improvements to HDMA timing have been implemented, Multitap support was added, and the user interface was polished a bit more.

SPC7110 decompression code updated to latest version by neviksti and converted to a state machine; SPC7110 overhead is now identical to S-DD1 overhead (eg ~5% speed hit over standard games)
Fixed a major bug in SPC7110 data port emulation that was crashing Super Power League 4 [Jonas Quinn]
HDMA trigger point corrected to H=1104, bus sync timing corrected
All illegal DMA A-bus accesses should now be properly blocked
DMA state machine rewritten, greatly simplified
Major corrections to HDMA run timing; fixes flickering bugs in Mecarobot Golf and Super Mario Kart
Emulator now defaults to 2/1/3 SNES (CPU/PPU1/PPU2 revision numbers)
Multitap emulation added, can be attached to either or both controller ports; user interface updated to reflect this
Status messages (cartridge loaded / unloaded, UPS patch applied, etc) now appear in status bar
Added advanced configuration option, "input.analog_axis_resistance", to control gamepad analog stick sensitivity
Also, the SPC7110 emulator download link below was removed: if you are looking for this, please download the bsnes v034 source code, which has the most up-to-date version in the src/chip/spc7110 folder.

bsnes v0.035 released

This release adds vsync support, improved header detection and many new configuration options. Many thanks go to I.S.T. for extensively testing the new header detection for regressions.

Added video synchronization support at long last [blargg, byuu]
Added audio panel to control volume, latency, frequency and SNES input frequency settings
Added driver panel to select APIs to use for video, audio and input
Added crash handler for driver initialization
Xv and SDL video drivers now work with compositing enabled on Linux/Xorg
Improved ALSA audio driver for Linux
Now using a fixed output frequency, along with a 4-tap hermite resampler
Improved header detection; fixes Batman: Revenge of The Joker and a few fan translations
Frameskip will now randomly choose a frame in each set to display; helps with animations
Locales now support meta-data, which allows for unique translations of the same English input

bsnes v0.036 released

This release fixes a somewhat serious bug introduced in v035, and also vastly improves Windows support for non-ANSI filenames.

bsnes v0.037 released

This release adds support for the SNES mouse, Super Scope and Justifier peripherals. It also simplifies cartridge loading and refines the user interface. Lastly, GZ and ZIP archives can now contain non-ANSI characters (Chinese, Japanese, Russian, ...) This support existed in the last release for all uncompressed files. Together, this means only JMA support on Windows lacks support for loading non-ANSI filenames. This is due to the library itself (really, it's more Windows' fault), and licensing issues prevent me from patching libjma as I did with zlib (bsnes is not GPL compatible.) I'm planning to work with Nach to fix this in a future release.

About the cartridge loading changes ... the emulator now determines what kind of cartridge is being loaded (eg normal, BS-X BIOS, Sufami Turbo cart, etc) by looking inside the file itself. If it detects a cart type that requires more than one ROM image to load, it will present you with the appropriate specialized load menu automatically. Aside from being more intuitive, this method also allows loading of BS-X and Sufami Turbo games from the command-line or via file association.

added mouse support to DirectInput and SDL input drivers
up to 96 buttons per controller; 8 buttons per mouse (5 per mouse on Linux) can be mapped now
added SNES mouse support (does not support speed setting yet)
added Super Scope support
added Justifier support (supports both Justifiers)
input management system almost completely rewritten to support new controllers
"Load Special" menu removed, all cart loading merged to "Load Cartridge ..." option
replaced "Power Cycle" and "Unload Cartridge" with "Power" -> "On" / "Off"
when video exceeds screen size and is scaled down, aspect ratio is now maintained [Ver Greeneyes]
zlib modified to support non-ANSI characters
cheat code count was limited to 1,024 codes before; it now supports unlimited codes per game
added sort by description setting for cheat code list
polished listbox control interaction (disable buttons when nothing selected, etc)
cleaned up OBC-1 chip emulation (code is functionally identical to v036)
added option to toggle fullscreen mode to settings menu
added advanced mode options to toggle base unit (none, Satellaview) and system region (Auto-detect, NTSC, PAL)

bsnes v0.037a released

fixed a Linux listbox bug that left action buttons disabled when there was only one item [tukuyomi]
fixed a few strings that were not being translated by locale.cfg before [diminish]

bsnes v0.038 released

eliminated S-DD1 DMA enslavement to the S-CPU; this allows the S-DD1 to behave more like the real chip, and it also simplifies the S-CPU DMA module
eliminated S-PPU enslavement to the S-CPU; all processor cores now run independently of each other
added cycle-level S-PPU timing for OAM address reset and OBSEL; fixes scanline glitches in Mega Lo Mania and Winter Olympics
removed ppu.hack.* settings; as they are no longer needed due to above changes
corrected VRAM tiledata cache bug; fixes Super Buster Bros v1.0 reset glitch
added memory export and trace logging key bindings to user interface
removed WAV logging (to trim the emulation core)
embedded readme and license texts inside executable
simplified S-CPU, S-SMP flag register handling
source code cleanup for S-CPU timing module
GUI-Linux: added style improvements to the listbox and combo box controls
GUI-Linux: finally added filetype filter support to the file open dialog
GUI-all: shrunk configuration panel [FitzRoy]
GUI-all: modified paths panel descriptions for clarity [FitzRoy]

bsnes v0.039 released

Recovered ~10% speed loss from last release via S-CPU IRQ timing optimizations
Implemented O(1) binary-heap priority queue for event scheduling
Fixed a bug where BS-X slotted carts were never mapping SRAM
Fixed a bug where invalid controller input was always being allowed
Fixed all compilation warnings with GCC 4.3 and Visual C++ 9.0
Added advanced options to control S-CPU ALU hardware delays
S-RTC and SPC7110 timers updated to handle time_t overflow (Y2k38) gracefully
Cheat codes can now have multiple codes per entry, and multiple lines per description
Rewrote config file parser; removed config/ class from emulator core
Windows: added 256x256 image to program icon set
Linux: fixed Xorg keysym mapping, key names should show correctly in all cases now
UI: updated video panel, added fullscreen-on-startup and NTSC merge fields options
UI: simplified audio panel
UI: boolean options on advanced panel can be toggled via double-click
Lots of code cleanup, especially for S-CPU IRQ handling and nall template library

bsnes v0.040 released

bsnes v0.041 released

bsnes v0.042 released

Fixed a bug that was preventing BS-X carts from loading and mapping properly
Fixed a bug with mapping joypads after the first Improved window centering code to reduce flickering, still a bit volatile on Linux due to Qt/X11 limitations
Minor cleanup work on S-PPU BG renderer
Improved mouse axis / button mapping
Added proper support for analog joypad inputs: both sticks and triggers are now fully supported
Windows: added RawInput support, allows up to 16 keyboards + mice to be mapped independently
Windows: added XInput support, allows Xbox 360 controller triggers to operate independently
Windows and Linux: Screen saver and monitor power saving disable re-added

bsnes v0.044 released

This release adds full SA-1 support, with no known issues. All 26 games have been tested by myself and others, and a few have been beaten from start to finish. The latter include Super Mario RPG, Kirby's Dreamland 3, Kirby Super Star and Jikkyou Oshaberi Parodius.

Please understand that the SA-1 is essentially four times faster than the SNES' main CPU, so system requirements will be very high for these games. For example, on an E8400 @ 3.0GHz, I average ~160fps in ordinary games. But for SA-1 emulation, this drops to ~90fps, with the worst case being ~80fps.