PDA

View Full Version : Some crazy ideas – VBANext inside SSNES



wraggster
July 24th, 2011, 21:02
News via http://blackbird.usask.ca/wordpress/?p=318

With the release of bSNES v064, libsnes was born. libsnes is essentially a quite simple API that exposes the functionality of a SNES emulator, allowing various new front-ends to be made. A libsnes library has been developed for, bSNES obviously, and SNES9x.

SSNES is one such front end, which I feel is now somewhat mature. It does sport some features not often found in other emulators, such as a complex multipass shader implementation in Cg and GLSL (XML), and frame-by-frame rewind.

Now, there’s one interesting aspect of libsnes. It is just a streamlined interface to perform common emulator things such as:

•Init console
•Load ROM
•Set callbacks for video, audio and input
•Run main loop
This is practically how every emulator works. The difference lies in the details. The question now is, can we implement a libsnes which emulates a different system than SNES for shits and giggles? It’s not like SSNES verifies the ROM image as a SNES game at any rate. It just calls snes_load_cartridge_normal(). It’s essentially emulator agnostic, which we’ll use to our advantage.

Now obviously, libsnes is SNES specific. For example it only has concepts of things that the SNES (emulator) can do. However, there is a console which is quite similar to the SNES in terms of interfacing, the GBA.

GBA fits quite easily into the model of SNES. It has the exact same buttons, sans the X and Y buttons, so that maps perfectly over from a configuration standpoint. Graphics are 15-bit XBGR, just like SNES, 240×160 resolution (except for the weird mode 5), etc. Audio is also signed 16-bit. We have to resample the audio on the GBA to ~32kHz to match SNES, but hey.

I mocked up a VBANext build which is essentially built as a libsnes shared library. Very incomplete, but it runs the two games I care about on GBA, Golden Sun, and Golden Sun 2. Then add in support for rewind and multipass shaders and have a blast. DSP audio effects are nice too, which might help the godawful sound quality of the GBA.

One added bonus is that we’re now able to test VBANext progress and regressions easily on the PC, since we actually have, you know, decent debuggers on the PC.

I do plan on making a GBA specific libgba at some point, but I’ll see how deep the libsnes rabbit hole goes.

If you want to test VBANext/libsnes, you can build it from our git repo in platforms/libgba, and just hit make. Makefile is only set up for *nix as of writing, but hey. People compiling themselves probably use *nix anyways. :p