Skip to contents

VBA recordings for Game Boy, Game Boy Color, Super Game Boy and Game Boy Advance. Game Boy and Game Boy Color recordings have eight controls. Game Boy Advance and Super Game Boy recordings add L and R: a Super Game Boy is played with an SNES pad, and the format records both buttons. Digital columns are compact; button_layout() gives their stable IDs. Numeric source channels are always retained in analog_channels().

Usage

read_vbm(
  path,
  analog = "raw",
  deadzone = NULL,
  triggers = "raw",
  aliases = TRUE,
  ...
)

Arguments

path

Recording file path.

analog

Stick representation: "raw" (default), "cardinal4", "cardinal8", "angle", or "angle+magnitude". A scalar applies to both sticks; c(left = "cardinal8", right = "angle") selects them independently. Cardinal modes add separate left/right logical direction columns. Continuous modes return numeric fields through stick_channels(). Original X/Y values remain in analog_channels() in every mode. Absent sticks add no columns.

deadzone

Radial threshold in centred axis half-range units, from zero to one. One value applies to both sticks; named left/right values are allowed. NULL uses the default of the controller, whichever emulator recorded it: 0.125 for the sticks of Nintendo's consoles (Nintendo 64, GameCube, Wii extensions, 3DS) and 0.25 for all other sticks. The first is close to the 15 of 128 units that the GameCube's controller library discards on each axis (PAD_Clamp in libogc). The second covers the resting position of a released PlayStation stick, up to about 32 of 128 units from the centre (psx-spx), and is close to the 7849 and 8689 of 32767 that Microsoft gives for the thumbsticks of PC gamepads (XInput). A game applies a threshold of its own, which the recording does not store; give that value to study one game. Neutral observations have no direction and an NA angle. Magnitude is kept.

triggers

"raw" (default) or "digital". For DTM, digital additionally projects each analogue trigger at 128/255 into separate L2/R2 columns. Hardware L/R click bits remain distinct from thresholded analogue triggers.

aliases

TRUE (default) places the controls of a recording under the shared IDs that button_layout() describes. With FALSE, a control that would be placed under another control's ID keeps the key of its source, so every control of the recording has a column of its own and no two are combined.

...

Reader-specific arguments, such as controller_order for M64 or DTM, or member for a recording inside a ZIP archive (see movie_members()).

Value

A replayr_movie with compact digital columns and selected stick fields.

Details

Every stored controller record is imported; header$declaredFrameCount keeps the header's count. commands retains the bits of each controller word that lie outside the layout, with their original values: 1024 and 2048 mark a reset (old timing, and the timing used since format version 1.1), and 4096 to 32768 are the deprecated motion-sensor bits.

The header identifies the ROM by its internal title (header$romName) and its header checksum (header$romHeaderChecksum), and adds the global checksum of a Game Boy ROM (header$romGlobalChecksum) or the game code of a Game Boy Advance ROM (header$romGameCode, such as "A2CE"). In place of the global checksum, a Game Boy Advance recording holds the checksum of the BIOS, in header$biosChecksum.

Examples

movie <- read_vbm(system.file("extdata", "sample.vbm", package = "replayr"))
movie
#> <replayr_movie [vbm] observations=3600 players=1 buttons=8 source=sample.vbm>
#> Header keys: version, uid, rerecordCount, controllerFlags, systemFlags, declaredFrameCount, isGBA, isGBC, ...
#> P1 active observations: dpad_right=900, dpad_left=900, dpad_down=900, dpad_up=900, start=6, select=4, b=900, a=450
recording_info(movie)
#>   format platform video_standard  unit observations frame_rate
#> 1    vbm       GB           <NA> frame         3600    59.7275
#>   frame_rate_source duration rerecords
#> 1          platform 60.27374         0