Skip to contents

Imports version-1 text and binary recordings from PCEjin and VBjin, with one row per recorded frame. PC Engine recordings support up to five controller ports; buttons I and II have the IDs of A and B, and Run that of Start. VBjin recordings include both Virtual Boy direction pads: the left one has the IDs of the direction pad and the right one those of the N64's C-buttons.

Usage

read_mc2(
  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 source metadata.

Details

player() returns the buttons for a selected port. The original command byte is retained in commands. Header fields identify the emulator and, when recorded, PC Engine CD mode. Incomplete binary packets and inconsistent controller fields produce an error.

Examples

movie <- read_mc2(system.file("extdata", "legacy", "vboy.mc2", package = "replayr"))
# The Virtual Boy has two direction pads.
button_layout(movie)[, c("key", "name")]
#>           key            name
#> 1  dpad_right  Left pad Right
#> 2   dpad_left   Left pad Left
#> 3   dpad_down   Left pad Down
#> 4     dpad_up     Left pad Up
#> 5       start           Start
#> 6      select          Select
#> 7           b               B
#> 8           a               A
#> 9          l1               L
#> 10         r1               R
#> 11    c_right Right pad Right
#> 12     c_left  Right pad Left
#> 13     c_down  Right pad Down
#> 14       c_up    Right pad Up