Mednafen

Virtual Boy Documentation

Last updated January 2, 2024
Valid as of 1.32.0-UNSTABLE

Table of Contents:

Introduction

Virtual Boy emulation in Mednafen is original code, except for an extremely modified(optimizations, bug fixes, and better all-around emulation) V810 emulator core taken from Reality Boy years ago for PC-FX emulation.

Virtual Boy ROM images must each have an extension of ".vb" or ".vboy" to be recognized as such. Mednafen versions prior to 0.9.13 allowed ".bin" as well, but this conflicts with the Sega Megadrive emulation module.

Due to how the left+right views are transformed into a single image, enabling most of the image filter effects(bilinear interpolation, OpenGL pixel shaders, special scalers, etc.) is not recommended. However, they will work properly with the "cscope" and "sidebyside" 3D modes, and may work tolerably with the "anaglyph" 3D mode. This limitation may be corrected in the future by refactoring the 3D mode mixing out to the driver side, post individual filtering for each left/right view; however, this would significantly negatively impact performance.

To use the "hli" mode with a "Line Interlaced 3D" monitor, you'll want to set "vb.yscale(fs)" to 1, "vb.liprescale" appropriately, and "vb.xscale(fs)" to 2 multiplied by the value of "vb.liprescale".

NOTE: The "hli" and "vli" modes will not work properly in windowed video output mode; you may need to adjust the window's position to get the lines to line up correctly for the 3D effect to work.


Custom Palettes

Global Filename:Description:
vb.palVB LED Active Time; 256 left, 256 right. If only 256 triplets are present, then they will be used for both left and right views. When the custom palette's right view colors are the same as the left view colors(either explicitly, or when using a 256-entry custom palette), and anaglyph 3D mode is active, then the custom palette will not be used.

256 or 512 RGB triplets

Settings Reference

Caution: Any settings that change emulation behavior as seen from the emulated game are shown with the setting name bolded in the table. One should be conscious of these settings if one has changed them from the default values when using network play or movies, as they can cause desychronizations if not set the same among hosts(or between the recording emulator and the playing emulator).

Setting:Value Type:Possible Values:Default Value:Description:
vb.3dmodeenumanaglyph
cscope
sidebyside
vli
hli
left
right
anaglyph3D mode.
  • anaglyph - Anaglyph
    Used in conjunction with classic dual-lens-color glasses.

  • cscope - CyberScope
    Intended for use with the CyberScope 3D device.

  • sidebyside - Side-by-Side
    The left-eye image is displayed on the left, and the right-eye image is displayed on the right.

  • vli - Vertical Line Interlaced
    Vertical lines alternate between left view and right view.

  • hli - Horizontal Line Interlaced
    Horizontal lines alternate between left view and right view.

  • left - Left View Only
    Show only the left view.

  • right - Right View Only
    Show only the right view.
 
vb.3dreverseboolean0
1
0Reverse left/right 3D views.
 
vb.allow_draw_skipboolean0
1
0Allow draw skipping.

If "vb.instant_display_hack" is set to "1", and this setting is set to "1", then frame-skipping the drawing to the emulated framebuffer will be allowed. THIS WILL CAUSE GRAPHICAL GLITCHES, AND THEORETICALLY(but unlikely) GAME CRASHES, ESPECIALLY WITH DIRECT FRAMEBUFFER DRAWING GAMES.

 
vb.anaglyph.lcolorinteger0x000000 through 0xFFFFFF0xffba00Anaglyph maximum-brightness color for left view.
 
vb.anaglyph.presetenumdisabled
red_blue
red_cyan
red_electriccyan
red_green
green_magenta
yellow_blue
red_blueAnaglyph preset colors.
  • disabled - Disabled
    Forces usage of custom anaglyph colors.

  • red_blue - Red/Blue
    Classic red/blue anaglyph.

  • red_cyan - Red/Cyan
    Improved quality red/cyan anaglyph.

  • red_electriccyan - Red/Electric Cyan
    Alternate version of red/cyan

  • red_green - Red/Green

  • green_magenta - Green/Magenta

  • yellow_blue - Yellow/Blue
 
vb.anaglyph.rcolorinteger0x000000 through 0xFFFFFF0x00baffAnaglyph maximum-brightness color for right view.
 
vb.cpu_emulationenumfast
accurate
fastCPU emulation mode.
  • fast - Fast Mode
    Fast mode trades timing accuracy, cache emulation, and executing from hardware registers and RAM not intended for code use for performance.

  • accurate - Accurate Mode
    Increased timing accuracy, though not perfect, along with cache emulation, at the cost of decreased performance. Additionally, even the pipeline isn't correctly and fully emulated in this mode.
 
vb.default_colorinteger0x000000 through 0xFFFFFF0xF0F0F0Default maximum-brightness color to use in non-anaglyph 3D modes.
 
vb.disable_parallaxboolean0
1
0Disable parallax for BG and OBJ rendering.
 
vb.input.instant_read_hackboolean0
1
1Input latency reduction hack.

Reduces latency in some games by 20ms by returning the current pad state, rather than latched state, on serial port data reads. This hack may cause some homebrew software to malfunction, but it should be relatively safe for commercial official games.

 
vb.instant_display_hackboolean0
1
0Display latency reduction hack.

Reduces latency in games by displaying the framebuffer 20ms earlier. This hack has some potential of causing graphical glitches, so it is disabled by default.

 
vb.ledonscalereal1.0 through 2.01.75LED on duration to linear RGB conversion coefficient.

Setting this higher than the default will cause excessive white crush in at least one game. A value of 1.0 is close to ideal, other than causing the image to be rather dark.

 
vb.liprescaleinteger1 through 102Line Interlaced prescale.
 
vb.sidebyside.separationinteger0 through 10240Number of pixels to separate L/R views by.

This setting refers to pixels before vb.xscale(fs) scaling is taken into consideration. For example, a value of "100" here will result in a separation of 300 screen pixels if vb.xscale(fs) is set to "3".

 

Setting:Value Type:Possible Values:Default Value:Description:
vb.debugger.disfontsizeenum5x7
6x9
6x12
6x13
9x18
5x7Disassembly font size.

Note: Setting the font size to larger than the default may cause text overlap in the debugger.

  • 5x7 - 5x7

  • 6x9 - 6x9

  • 6x12 - 6x12

  • 6x13 - 6x13. CJK support.

  • 9x18 - 9x18; CJK support.
 
vb.debugger.memcharencstring shift_jisCharacter encoding for the debugger's memory editor.
 
vb.enableboolean0
1
1Enable (automatic) usage of this module.
 
vb.forcemonoboolean0
1
0Force monophonic sound output.
 
vb.scanlinesinteger-100 through 1000Enable scanlines with specified opacity.

Opacity is specified in %; IE a value of "100" will give entirely black scanlines.

Negative values are the same as positive values for non-interlaced video, but for interlaced video will cause the scanlines to be overlaid over the previous(if the "video.deinterlacer" setting is set to "weave", the default) field's lines.

 
vb.shaderenumnone
autoip
autoipsharper
scale2x
sabr
ipsharper
ipxnoty
ipynotx
ipxnotysharper
ipynotxsharper
goat
noneEnable specified OpenGL shader.

Obviously, this will only work with the OpenGL "video.driver" setting, and only on cards and OpenGL implementations that support shaders, otherwise you will get a black screen, or Mednafen may display an error message when starting up. When a shader is enabled, the "vb.videoip" setting is ignored.

  • none - None/Disabled

  • autoip - Auto Interpolation
    Will automatically interpolate on each axis if the corresponding effective scaling factor is not an integer.

  • autoipsharper - Sharper Auto Interpolation
    Same as "autoip", but when interpolation is done, it is done in a manner that will reduce blurriness if possible.

  • scale2x - Scale2x

  • sabr - SABR v3.0
    GPU-intensive.

  • ipsharper - Sharper bilinear interpolation.

  • ipxnoty - Linear interpolation on X axis only.

  • ipynotx - Linear interpolation on Y axis only.

  • ipxnotysharper - Sharper version of "ipxnoty".

  • ipynotxsharper - Sharper version of "ipynotx".

  • goat - Simple approximation of a color TV CRT look.
    Intended for fullscreen modes with a vertical resolution of around 1000 to 1500 pixels. Doesn't simulate halation and electron beam energy distribution nuances.
 
vb.shader.goat.fprogboolean0
1
0Force interlaced video to be treated as progressive.

When disabled, the default, the "video.deinterlacer" setting is effectively ignored with respect to what appears on the screen, unless it's set to "blend" or "blend_rg". When enabled, it may be prudent to disable the scanlines effect controlled by the "vb.shader.goat.slen" setting, or else the scanline effect may look objectionable.

 
vb.shader.goat.hdivreal-2.00 through 2.000.50Constant RGB horizontal divergence.
 
vb.shader.goat.patenumgoatron
borg
slenderman
goatronMask pattern.
  • goatron - Goatron
    Brightest.

  • borg - Borg
    Darkest.

  • slenderman - Slenderman
    Spookiest?
 
vb.shader.goat.slenboolean0
1
1Enable scanlines effect.
 
vb.shader.goat.tpreal0.00 through 1.000.50Transparency of otherwise-opaque mask areas.
 
vb.shader.goat.vdivreal-2.00 through 2.000.50Constant RGB vertical divergence.
 
vb.specialenumnone
hq2x
hq3x
hq4x
scale2x
scale3x
scale4x
2xsai
super2xsai
supereagle
nn2x
nn3x
nn4x
nny2x
nny3x
nny4x
noneEnable specified special video scaler.

The destination rectangle is NOT altered by this setting, so if you have xscale and yscale set to "2", and try to use a 3x scaling filter like hq3x, the image is not going to look that great. The nearest-neighbor scalers are intended for use with bilinear interpolation enabled, for a sharper image, though the "autoipsharper" shader may provide better results.

  • none - None/Disabled

  • hq2x - hq2x

  • hq3x - hq3x

  • hq4x - hq4x

  • scale2x - scale2x

  • scale3x - scale3x

  • scale4x - scale4x

  • 2xsai - 2xSaI

  • super2xsai - Super 2xSaI

  • supereagle - Super Eagle

  • nn2x - Nearest-neighbor 2x

  • nn3x - Nearest-neighbor 3x

  • nn4x - Nearest-neighbor 4x

  • nny2x - Nearest-neighbor 2x, y axis only

  • nny3x - Nearest-neighbor 3x, y axis only

  • nny4x - Nearest-neighbor 4x, y axis only
 
vb.stretchenum0
full
aspect
aspect_int
aspect_mult2
aspect_mult2Stretch to fill screen.
  • 0 - Disabled

  • full - Full
    Full-screen stretch, disregarding aspect ratio.

  • aspect - Aspect Preserve
    Full-screen stretch as far as the aspect ratio(in this sense, the equivalent xscalefs == yscalefs) can be maintained.

  • aspect_int - Aspect Preserve + Integer Scale
    Full-screen stretch, same as "aspect" except that the equivalent xscalefs and yscalefs are rounded down to the nearest integer.

  • aspect_mult2 - Aspect Preserve + Integer Multiple-of-2 Scale
    Full-screen stretch, same as "aspect_int", but rounds down to the nearest multiple of 2.
 
vb.tblurboolean0
1
0Enable video temporal blur(50/50 previous/current frame by default).
 
vb.tblur.accumboolean0
1
0Accumulate color data rather than discarding it.
 
vb.tblur.accum.amountreal0 through 10050Blur amount in accumulation mode, specified in percentage of accumulation buffer to mix with the current frame.
 
vb.videoipenum0
1
x
y
0Enable (bi)linear interpolation.
  • 0 - Disabled

  • 1 - Bilinear

  • x - Linear (X)
    Interpolation only on the X axis.

  • y - Linear (Y)
    Interpolation only on the Y axis.
 
vb.xresinteger0 through 655360Full-screen horizontal resolution.

A value of "0" will cause the current desktop horizontal resolution to be used.

 
vb.xscalereal0.01 through 2562.000000Scaling factor for the X axis in windowed mode.
 
vb.xscalefsreal0.01 through 2561.000000Scaling factor for the X axis in fullscreen mode.

For this setting to have any effect, the "vb.stretch" setting must be set to "0".

 
vb.yresinteger0 through 655360Full-screen vertical resolution.

A value of "0" will cause the current desktop vertical resolution to be used.

 
vb.yscalereal0.01 through 2562.000000Scaling factor for the Y axis in windowed mode.
 
vb.yscalefsreal0.01 through 2561.000000Scaling factor for the Y axis in fullscreen mode.

For this setting to have any effect, the "vb.stretch" setting must be set to "0".