Rustual Boy - A Virtual Boy emulator.

Overview

Rustual Boy

Build Status Build status rustualboy.com Compabitility Chat on discord License

Rustual Boy

Description

Rustual Boy is a Virtual Boy emulator. It can be used to play existing Virtual Boy games, as well as be a helpful development/debugging tool for homebrew for this platform.

The name "Rustual Boy" is a portmanteau of the words "Rust" and "Virtual Boy". Ok, the "Virtual Boy" part was obvious, but why "Rust"? In fact, Rustual Boy is written in the Rust programming language - a "systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety." Rust is a wonderful language with a thriving community, and as such provides a fantastic platform for an emulation project!

Status

Rustual Boy is currently able to emulate all commercial Virtual Boy titles, as well as many homebrew ones. It supports basic video/audio output and keyboard input, and also a simple CLI debugger. It runs on Windows, MacOS, Linux, and likely some other platforms Rust supports.

While Rustual Boy's core emulation is complete compatibility-wise, and in some respects is already one of the more accurate VB emulators available, the project is still young, and needs some time to mature. Particularly, its user interface is lacking (read: virtually non-existent), and there are some known (and probably unknown) stability/compatibility issues. Also, performance isn't fantastic yet, but the emulator should be playable at least.

That said, these things are bound to improve with time, and everyone is encouraged to grab a build or build the emulator, give it a shot, and report any bugs/feature requests!

Screenshots

screenie screenie screenie screenie

Known game compatibility

Key:

  • πŸ’– : Fully compatible. The game is fully playable with no known bugs (to our knowledge).
  • πŸ’” : Playable. The game can be played, but has some minor known glitches (described in the notes field).
  • 🚫 : Incompatible. The reason is described in the notes field.
  • N/A: Game does not exist for this region.

Games marked πŸ’– and πŸ’” are all included in the compatibility metric.

Game USA JP Notes
3-D Tetris πŸ’– N/A
Bound High! πŸ’– N/A ROM is both USA+JP
Galactic Pinball πŸ’” πŸ’” Vocal samples throughout the game play at the wrong rate, likely related to CPU clock cycle inaccuracy
Golf πŸ’” πŸ’” Game transitions to demo mode WAY too fast, sometimes softlocks when transitioning to/from demo mode
Insmouse No Yakata N/A πŸ’–
Jack Bros. πŸ’– πŸ’–
Mario Clash πŸ’– πŸ’–
Mario's Tennis πŸ’– πŸ’–
Nester's Funky Bowling πŸ’– N/A
Panic Bomber πŸ’– πŸ’–
Red Alarm πŸ’– πŸ’–
SD Gundam Dimension War N/A πŸ’–
Space Invaders Virtual Collection N/A πŸ’–
Space Squash N/A πŸ’–
Teleroboxer πŸ’” πŸ’” Small audio glitches during screen transitions after demo mode wins games
V-Tetris N/A πŸ’–
Vertical Force πŸ’– πŸ’–
Virtual Bowling N/A πŸ’” Samples play at the wrong rate
Virtual Boy Wario Land πŸ’” πŸ’” Game is fully playable, but some parts of the intro cutscene are too dark, due to inaccurate emulation of the physical LED periods used in the display
Virtual Fishing N/A πŸ’–
Virtual Lab N/A πŸ’–
Virtual League Baseball πŸ’– πŸ’–
Waterworld πŸ’– N/A

Building and running

Currently, the only dependency for building is Rust itself, which can be downloaded here. Once that's installed, you can clone the repo, and simply cargo build/cargo run your way to victory! It's recommended to use the --release flag as well, as emulation can require a lot of CPU power, so we'll want all the compiler help we can get.

Note: If you're new to using Cargo (Rust's build system), it's recommended to give the Cargo Guide a quick skim.

Rustual Boy has a very simple CLI interface:

$ rustual-boy-cli --help
Rustual Boy 0.2.0
ferris <[email protected]>, The Rustual Boy contributors
A CLI frontend to the Rustual Boy emulator

USAGE:
    rustual-boy-cli.exe [FLAGS] <ROM>

FLAGS:
    -s, --sram       Path to an SRAM
    -h, --help       Prints help information
    -V, --version    Prints version information

ARGS:
    <ROM>    The name of the ROM to load

The easiest way to run a game is to supply a single file argument:

rustual-boy-cli bound-high.vb

Input keymap

The Virtual Boy game pad consists of two d-pads, 4 buttons, and two shoulder buttons. These are mapped to the following keyboard keys:

Button Key
Left D-Pad Up W
Left D-Pad Down S
Left D-Pad Left A
Left D-Pad Right D
Right D-Pad Up I
Right D-Pad Down K
Right D-Pad Left J
Right D-Pad Right L
Select space
Start enter/return
A F
B H
Left bumper E
Right bumper U

For game pad layout reference, refer to this image. This key map is currently non-configurable.

Contributing

Rustual Boy aims to be an open project where anyone can contribute. If you're interested, check CONTRIBUTING.md!

License

Licensed under either of

at your option.

Comments
  • Can't enter debugger when video frames aren't being generated

    Can't enter debugger when video frames aren't being generated

    I'm been messing with getting vb-rs working in linux. There is something screwy such that the emulated cpu seems to get stuck in a loop and no longer rendering video frames. When its in the state its not possible to get into the debugger since the F12 check will only happen when there are video frames available.

    opened by jwestfall69 21
  • [WIP] Initial implementation of middleware, supporting common mode anaglyph rendering

    [WIP] Initial implementation of middleware, supporting common mode anaglyph rendering

    PR to support common mode anaglyph rendering through an intermediate crate (rustual-boy-middleware). Marked as WIP because I'd like I'd like feedback on the anaglyph implementation;

    • The mixing stage is pretty expensive right now (lots of casting to floats and doing math and back to integers) and can probably be "cuter" but it'll probably be less clear. It seems fast enough for now, but I haven't run any numbers to see if that's sustainable
    • I'm also not confident that the color mixing is correct because color spaces bend my brain a bit. Additive is probably good enough but I think to be technically correct we should be converting from the response curve of the VB LEDs -> linear, performing the addition, and then converting from linear to sRGB.
    • Not sure how I feel about rolling our own color type. I'm not really sure where we would pull it from without adding a bunch of unnecessary dependencies though.
    opened by bobtwinkles 18
  • Implement v810's instruction cache and part of the CHCW system register

    Implement v810's instruction cache and part of the CHCW system register

    The v810 cpu has a 1k direct-mapping instruction cache that's broken up in to 128x 8 byte blocks. Each 8 byte block is further broken up in to 2x 4 byte subblocks.

    The instruction cache implementation only keeps track of which memory addresses would be cached and not any actual instruction data. All halfword instruction reads were replaced with a wrapper function that returns the halfword and a bool if the read would have been cached or not. Nothing is currently being done with the cached bool result other then stop rust for throwing a dead_code notice. So there should be no real visual/audio change to emulation until its hooked in better.

    showcpucache command was added to the debugger to dump the contents of the cache and some basic stats on hits/misses.

    The CHCW system register implementation supports being able to enable/disable the cpu instruction cache as well as being able to clear entries within the cache. This leaves being able to dump/restore the cache from ram missing.

    Both implementations are based on info provided in the v810 architecture user's manual (U10082EJ1V0UM00.pdf). Chapter 7 for cpu instruction cache and chapter 2 (2.2.3) for CHCW.

    opened by jwestfall69 10
  • Currently core dumps under Mac OS X

    Currently core dumps under Mac OS X

    $ g log
    commit ae3e050dead3005e20720dc610e4f73f38f207da
    Merge: e4d4a1e 12d1108
    Author: ferris <[email protected]>
    Date:   Mon Feb 6 01:23:07 2017 +0100
    
        Merge pull request #12 from bobtwinkles/command-line
    
        Command line refinement
    
    $ cargo build --release
        Finished release [optimized] target(s) in 0.0 secs
    
    $ target/release/rustual-boy-cli wario.vb
    zsh: segmentation fault (core dumped)  target/release/rustual-boy-cli wario.vb
    
    $ shasum wario.vb
    274c328fbd904f20e69172ab826bf8f94ced1bdb  wario.vb
    

    A quick git bisect gave this sha as the first bad one: 4ee404049d749e6f1feca1a65edb619876aa480f

    Everything before is good, everything after is bad.

    opened by SirVer 7
  • Add cpu tracing thats enabled via features cpu-trace

    Add cpu tracing thats enabled via features cpu-trace

    cpu tracing allows tracking the before and after states of the registers/memory/etc that an instruction will use. This before and after data can then be displayed when using the step function in the debugger.

    (vb-rs 0xfff90fea) > cputrace cpu trace enabled: true

    Then when you run the step command it will look like this

    (vb-rs 0x07000c00) > s 0x07000c00 0fce0400 ld.w 4[r15], r16 before PC: 0x07000c00 PSW: 0x00010000 r15: 0x0500085c r16: 0x00000000 disp: 4 mem.w: [addr: 0x05000860, value: 0x0500089c] cpu cycles: 4 after PC: 0x07000c04 PSW: 0x00010000 r15: 0x0500085c r16: 0x0500089c disp: 4 mem.w: [addr: 0x05000860, value: 0x0500089c]

    This required tweaking the debugger step function which used to cpu.step(), then disassemble() to disassemble(), then cpu.step(). This was needed to make the pc reg and the disassembled instruction match up.

    opened by jwestfall69 4
  • debugger command parsing issue

    debugger command parsing issue

    I noticed this when adding the showcpucache debugger command.

    (vb-rs 0xfff40184) > showmem
    Unable to parse command: Error(Position(Eof, [104, 111, 119, 109, 101, 109]))
    

    That should have shown memory, but instead threw the above error. Those numbers end up being "howmem". The nom stuff is a bit confusing to me, but I assume whats happening is the tag!("s") is marking the input as complete even though there are more letters after it.

    opened by jwestfall69 4
  • Massive save state speedup

    Massive save state speedup

    Because libretro has an API that asks for the size seperately, and we have to serialize to get the size, the end result is that we change from 2 serializations for each save state down to 1.

    opened by Dr-Emann 3
  • Compatibility chart in README hard to grok

    Compatibility chart in README hard to grok

    TL;DR: I'd like to mush USA and Japan columns together.

    I come back randomly to see if anything's changed in compatibility and the split between USA and JP makes it hard to scan, especially when a title doesn't exist in a particular country.

    Considering they match 100% of the time, I think it'll be easier for newcomers to scan and understand the compatibility. Notes can be added if USA or JP differ.

    Worth it?

    opened by RandomInsano 3
  • vsu: output_left/right assignment in sample_clock() looks suspect

    vsu: output_left/right assignment in sample_clock() looks suspect

    ''' fn sample_clock(&mut self, audio_driver: &mut AudioDriver) { ... let mut acc_left = 0; let mut acc_right = 0;

            mix_sample(&mut acc_left, &mut acc_right, &self.voice1, self.voice1.output(&self.wave_tables)); 
            mix_sample(&mut acc_left, &mut acc_right, &self.voice2, self.voice2.output(&self.wave_tables));
    

    ... let output_left = ((((acc_left & 0xfff8) << 3) as isize) - 32768) as i16; let output_right = ((((acc_right & 0xfff8) << 3) as isize) - 32768) as i16; '''

    The assignment of output_left/right looks fishy.

    The values in acc_left/right get truncated down to being 16bits wide, then you make it 19bits wide with the shift, subtract 32k (I assume to try and make it signed?), then truncate it down to a i16?

    I seem to recall the << 3 being added as a hack to increase the volume. Seems like it would make more sense to do the shift before the 0xfff8 truncation?

    opened by jwestfall69 3
  • deadlock with debugger step command

    deadlock with debugger step command

    Using the step command in the debugger will cause a deadlock when it tries to mutex lock the audio driver, because its already being held by the main emulator loop.

    Also would you prefer PRs for bugs instead?

    opened by jwestfall69 2
  • Rustual Boy Help.

    Rustual Boy Help.

    so is there a way to reconfigure rustual boy like remapping the puttons/keys or using a controller. also are there more arguments to the exe to full screen the program.

    opened by NyTR0S96 1
  • Update dependencies, and fix warnings

    Update dependencies, and fix warnings

    • Make a cargo workspace at the top of the repo
    • Update all dependencies except combine to the newest version
      • cpal version 0.4 to 0.12 introduced some differences
    • Fix warnings
    opened by Dr-Emann 1
  • libretro tracking issue

    libretro tracking issue

    • [x] Support all output pixel formats
      • Currently we request the frontend use XRGB8888 format, but sometimes retroarch doesn't listen to this call (something we should actually look into and try to debug, as the libretro folks have said this is pretty weird), and other frontends may not support this format at all, so we need to support all possible formats.
    • [ ] Revisit controller/input impl to see if we actually need to map analog sticks like we do
      • It looks like libretro provides a couple different retropad options, one of which may do automatic analog stick -> dpad button conversion, which I would much rather rely on than doing it in the core.
    • [ ] Support multiple stereo output options
      • Currently we only do mixed red/electric cyan output, but we should support additional types as well. bparker in the libretro community had some nice ideas/insight here from professional experience.
    • [x] Use buffered audio output instead of callback-per-sample
      • This is just an optimization, but something we're pretty well equipped to take care of actually.
    • [x] Reduce allocations/copies in the AV output chain
      • Right now we have a somewhat elegant sink system for converting/filtering output from the emulator. However, since the emulator's output is fairly regular, we can rather provide storage and expected packing info as input instead of a sink and have the emu itself output in specific formats. This is less elegant but should be much faster, and I'm fairly certain we can still make this pretty safe with Rust. Especially for pixel output, this is likely a major performance bottleneck in both frontends currently.
    • [ ] Profile/benchmark perf in both libretro and cl frontends
    • [x] SRAM
    • [x] Consider exposing other types of RAM as well
      • The libretro API supports querying several types of memory, not just SRAM. This would allow a frontend to inspect system RAM, video RAM, etc.
    • [x] Serialization/deserialization
      • We need to be a bit careful here, since internal structures may change between versions. Specifically, an accuracy improvement/fix may introduce or remove an internal register, which we want to be a part of the serialized state ideally, but may not align with a previously-saved state. I'm not sure what the best approach here is yet, but I'm sure we can come up with something decent.
    • [ ] Make sure rustual-boy-libretro's Cargo.toml info is up-to-date and matching the rest of the repo
    • [ ] Get libretro core builds in CI/distribution pipeline
      • This includes distributing licensing docs, which differ from the CL license info as it uses a lot less IP.
      • We should also think through/document our manual release procedure (currently it's basically just pushing with a specific tag but I want to document that, and it may get a bit more complicated with version bumps etc as we progress).
    • [ ] When libretro core is more mature, speak with libretro folks about making rustual boy a primary retroarch core
      • I'm not sure what this entails, but I know at least we'll need to provide and maintain documentation, hook up builds in their pipeline, investigate cross compilation for multiple [esoteric] targets, etc.
    opened by yupferris 0
  • Account for cpu cycles that occur when entering an exception

    Account for cpu cycles that occur when entering an exception

    I wasnt able to find any docs that indicate how many cpu cycles it takes to enter an exception. I ended up going with 10, which is how many it takes to leave an exception (reti). However I suspect entering an exception is really going to be a few more then that.

    The added cpu cycles are applied to the first instruction executed in the exception.

    opened by jwestfall69 2
  • Hardcoded window size and display resolution

    Hardcoded window size and display resolution

    opened by seeq-dev 1
  • A suggestion (and a question) for Rustual Boy...

    A suggestion (and a question) for Rustual Boy...

    Can this emulator have the option to play in a Gameboy-like resolution (or view)?

    What do I mean by this? This emulator is about the Virtual Boy, right? A handheld console that had anaglyph 3D. My suggestion would be that if you can actually "fuse" the 3D colors (red and cyan) to make it look like you're playing a Gameboy game. This would actually be perfect for the people that don't have anaglyph glasses, like me.

    Also, will this emulator come with its own debugger, and perhaps other tools, for hacking games and creating homebrew games?

    opened by John-Enigma 3
Releases(v0.2.0-alpha)
Owner
Because bad code don't fly!
null
A Game Boy research project and emulator written in Rust

Mooneye GB Mooneye GB is a Game Boy research project and emulator written in Rust. The main goals of this project are accuracy and documentation. Some

Joonas Javanainen 802 Dec 28, 2022
RustBoyAdvance-NG is a Nintendoβ„’ Game Boy Advance emulator and debugger, written in the rust programming language.

RustBoyAdvance-NG Nintendo GameBoy Advance β„’ emulator and debugger, written in rust. WebAssembly Demo: https://michelhe.github.io/rustboyadvance-ng/ P

MishMish 510 Dec 30, 2022
A cross-platform sequencer that internally uses a Game Boy emulator to synthesize the sound

chiptrack chiptrack is a cross-platform sequencer that internally uses a Game Boy emulator to synthesize the sound. It uses: SixtyFPS for the UI. RBoy

Jocelyn Turcotte 26 Dec 7, 2022
A CPU emulator for running unit tests on Game Boy code.

evunit This is a unit testing application for Game Boy roms. It includes a CPU emulator, and loads test configurations from TOML files. Configuring a

Evie M. 8 Jan 1, 2023
Nes-emulator - A NES emulator made to learn the Rust programming language

nes-emulator Building $ rustc --version rustc 1.32.0 (9fda7c223 2019-01-16) $ cargo --version cargo 1.32.0 (8610973aa 2019-01-02) $ cargo build --rel

Michael Burge 225 Dec 23, 2022
The Resurgence VM, a register virtual machine designed for simplicity and ease of use, based on the old Rendor VM

Resurgence Join the Discord server! Resurgence aims to be an embeddable virtual machine with an easy-to-use API for projects like: Game engines Langua

null 12 Dec 5, 2022
Commodore 64 emulator written in Rust

Rust64 - a C64 emulator written in Rust This is my attempt to study the Rust programming language and have fun at the same time. The goal is to presen

Krzysztof Kondrak 214 Dec 27, 2022
A Flash Player emulator written in Rust

website | demo | nightly builds | wiki Ruffle Ruffle is an Adobe Flash Player emulator written in the Rust programming language. Ruffle targets both t

Ruffle 11.2k Jan 8, 2023
A Gameboy Emulator in Rust

RBoy A Gameboy Color Emulator written in Rust Implemented CPU All instructions correct All timings correct Double speed mode GPU Normal mode Color mod

Mathijs van de Nes 512 Dec 23, 2022
Full featured Cross-platform GameBoy emulator by Rust. Forever boys!.

Gameboy Full featured Cross-platform GameBoy emulator. Forever boys!. You can start a game with the following command, here with a built-in game "Boxe

Mohanson 1.2k Jan 2, 2023
NES emulator written in Rust to learn Rust

OxideNES A NES emulator in Rust. CPU should be accurate, PPU is mostly accurate, timing between the 2 is off for some corner cases and hardware qui

null 37 Nov 7, 2022
An NES emulator written in Rust

Pinky Pinky is an NES emulator written in Rust completely from scratch based only on publicly available documentation. You can run it in your Web brow

Koute 709 Dec 23, 2022
NES emulator written in Rust

sprocketnes is an emulator for the Nintendo Entertainment System written in the Rust programming language. Its purpose is to serve as a technology dem

Patrick Walton 725 Dec 27, 2022
NES emulator in rust

NES emulator in Rust plastic is a NES emulator built from scratch using Rust. This is a personal project for fun and to experience emulating hardware

Amjad Alsharafi 27 Dec 15, 2022
ZX Spectrum emulator written in Rust

rustzx ZX Spectrum emulator which I writing in rust. I develop this project just for fun and for learning the basics of computer architecture. License

Vladislav Nikonov 162 Dec 27, 2022
R.A.Z.E. A ZX Spectrum Emulator

R.A.Z.E. A ZX Spectrum emulator This project is part of a friendly competition to build an emulator using Rust and WebAssembly. Check the live version

Rodrigo Rivas Costa 37 Nov 25, 2022
Intel 8080 cpu emulator by Rust

i8080 i8080 is a emulator for Intel 8080 cpu. 8080 Programmers Manual 8080 opcodes [dependencies] i8080 = { git = "https://github.com/mohanson/i8080"

Mohanson 83 Dec 27, 2022
TestSuite4 is a framework designed to simplify development and testing of TON Contracts. It includes light-weight emulator of blockchain making it easy to develop contracts.

TestSuite4 0.1.2 TestSuite4 is a framework designed to simplify development and testing of TON Contracts. It contains lightweight blockchain emulator

TON Labs 26 Feb 3, 2022
Learn emulator and programming languages, target chip8, nes, gbc, gba ...

[WIP]learn emulator go-chip8 go run main.go source https://en.wikipedia.org/wiki/CHIP-8 http://devernay.free.fr/hacks/chip8/C8TECH10.HTM https://githu

ζ—©ζ™¨ζ΅·ι£Ž 4 Apr 30, 2021