Jubatian / cuzebox

CUzeBox emulator
GNU General Public License v3.0
12 stars 2 forks source link

CUzebox emulator

:Author: Sandor Zsuga (Jubatian) :License: GNU GPLv3 (version 3 of the GNU General Public License)

Overview

This is a currently experimental emulator for the Uzebox game console written entirely in C, using SDL 2.

It can be compiled with Emscripten as well for providing games embedded in web sites. For games it supports it works better than the Uzem emulator.

For building, use the Make_config.mk file to specify target platform. Currently it should build for Linux and Emscripten, and Windows as cross compile target using mingw32-gcc (I can not test native compiles for that platform since I don't have the OS).

Controls

On the keybouard, you can control Player 1's SNES controller as follows:

The emulator itself can be controlled with the following keys:

You can direct keyboard input to Player 2's SNES controller by holding down either ALT key.

The UZEM keymap maps the buttons of the SNES controller according to the Uzem emulator with the addition that 'Y' also triggers an SNES Y button press (so the mapping is useful on a QWERTZ keyboard). It is not recommended for developing games with complex controls since its layout differs much to the layout of the real controller.

If you have two (physical) game controllers, the emulator will start with two player controller allocation (so one of the controllers belong to Player 1, the other to Player 2), otherwise it will start with one player (both the keyboard and a single game controller will belong to Player 1). The keyboard always belongs to Player 1.

If you want to see how fast the AVR core can possibly run, turn off debug informations and use a small display while the frame rate limiter is off. On computers where the AVR core can actually run very fast this will still have some rendering (and notably blit to screen) overhead (since the frames are still fully rendered even then).

The Emscripten build can be maximized to full screen with the browser's full screen option.

Emulated components

Currently the following features are implemented:

Currently lacking but planned:

Notes:

The SD card emulation is fairly capable, it has several compile time constants in the cu_spisd.c file which you may adjust. You can set them to emulate a strict SD card breaking several existing games, but which can help you developing more robust SD code.

The SD write feature is sandboxed within the directory of the game. It doesn't emulate subdirectories. You may only override existing file contents, expand files or create new ones, it should be capable to track these operations if you write the FAT first.

A bootloader can be started simply by passing the bootloader's .hex file as parameter to the emulator. The virtual SD card is composed from the files existing in the same directory. Note that the emulator can not remember what the bootloader wrote last time into the flash. (So you can not start the last selected game with the 0.4.5 bootloader as it recognizes the game by a CRC written in EEPROM, not by flash content. The 5.x.yy bootloaders work fine)

Emscripten notes

After setting up Emscripten so it is capable to compile examples, at least on Linux compiling the emulator should require the following steps:

The game can also be a .hex file (but needs to be renamed to "gamefile.uze"). This game will be added to the build's virtual filesystem.

A "cuzebox_minimal.html" file is also provided to demonstrate the Emscripten build, which contains the bare necessities to start the compiled emulator in a browser.

To get the minimal size for your build, you can set the following flags in "Make_config.mk":

A compiled game needs the "cuzebox.js", the "cuzebox.html.mem" and either the "cuzebox.html" or "cuzebox_minimal.html" files to function. It also needs "cuzebox.data" if it was built with FLAG_SELFCONT set zero (default).

Video capture

By default the video capture feature is not compiled in. You can enable it in Make_config.mk.

To use it, you need ffmpeg installed with mp3lame for audio and H.264 for video.

You can toggle capturing with F5 during running the emulation: you may use it multiple times to capture only sections of a session. During this phase the emulator will write out large uncompressed video to allow running reasonably well.

The video capture is independent of the frame rate management: you will get perfect continuous 60 FPS video even if the emulator slows down or skips frames due to being unable to keep up with the task.

When you exit the emulator, it will launch a slow video encoding step when it produces proper 720p H.264 video from the material it recorded.

Note that the state of frame merging (F7) notably affects the performance of video captures and the output size. Having it on results in larger video sizes, slower encoding, and worse emulation performance. It should be turned off for games which don't need it, but should be kept on where necessary (if the game in question uses some type of sprite rotation or effect based on rapidly alternating between two images).