Category: SNES

UPDATE: The source package has been updated to fix some small issues for 64-bit systems.

First, it appears bsnes was crashing on Linux/amd64 platforms when selecting 'File->Load Cartridge'. The cause of this error was quite fun to track down. Luckily, I came across the fix in a kino changelog. It appears that gtk_file_chooser_dialog_new() is a vararg function. The very last parameter passed is pointer to a string. However, if you don't need this parameter (and I don't), you can pass it a null pointer. Well, null is defined as 0 in c++ (and (void*)0 in c). This is no problem on 32-bit architectures as an integer and pointer are the same length. But on Linux/amd64, an int is 32-bits, whereas a pointer is 64-bits. So, I was pushing half of the pointer, but the upper half was basically not set. So whenever the stack happened to contain a non-zero upper half, GTK+ would think the pointer was valid, and attempt to read from it. Quite a serious issue, I can see many people running into this problem. It's non-obvious, as non-vararg functions will promote int(0) to 64-bits automatically. The solution is to cast vararg null pointers explicitly. In my case, I had to replace 0 with (const gchar*)0.

Next, during the rewrite, I never added back command-line loading. Oops. This is now fixed.

Lastly, I came up with a proper fix for casting between integers and pointers: uintptr_t. This is a variable declared in stdint.h that states it is safe to cast a pointer to an integer, and then that integer back to a pointer. This is definitely the proper way to implement my window message passing system, and as such I have rewritten the relevent parts of libui and bsnes/lui to use uintptr_t. This should fix all compilation errors on Linux/amd64.


Five months and 43 WIP releases in the making, today I am releasing bsnes v0.020. I'd really like to express my thanks to blargg, for he has written a new S-DSP emulator that is an impressive 32 times more precise than all existing S-DSP emulators. It is now bus-accurate, and should produce bit-perfect sound output to that of a real SNES, excepting very minor, very extreme edge cases. Not only did he do this, he went out of his way to develop a special version exclusively for bsnes to ease licensing concerns and take advantage of bsnes' unique features, notably cothreads. I can't thank him enough. Unfortunately, bsnes has taken a ~10% speed hit over v0.019 by using this new S-DSP emulator, but I must stress the speed hit is entirely due to the way bsnes is implemented. blargg's standalone S-DSP emulator is very, very fast. Anyone is free to take a look at his S-DSP emulator, as he has released it as open source under the LGPL, by visiting his homepage, here.



Unfortunately, the new cross-platform UI is not entirely finished. Some sacrifices had to be made to support libui. Specifically, the following features are missing from v0.019, but will hopefully be added back in future releases:
• Fullscreen support
• Input Configuration panel cannot capture joypad input. Joypad support is still present, but it must be mapped manually through the Advanced panel or through editing bsnes.cfg by hand
• The Cheat Code Editor is missing, but cht files can still be used from bsnes v0.019, and created by hand
• Sufami Turbo support is not accessible from the UI
• The UI on Windows is slightly less polished due to compromises to allow the UI to be readable on Linux.

I am sorry for the rough edges listed above, but I wanted to get a new release out, as it has been over five months since the last release, and I really want the world to be able to experience blargg's new S-DSP emulator.

Changelog:
• 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 Official Site
:: bsnes 0.20 (experimental)