Skip to contents

Imports MCM version 1 with fixed gamepad layouts for PC Engine, PC-FX, Atari Lynx, WonderSwan, Neo Geo Pocket, NES, and Master System. Each row represents one stored frame, with separate players for the format's controller ports. Numbered buttons have the lettered IDs in order: PC Engine and PC-FX I to VI are A, B, X, Y, L1 and R1, and Master System Fire 1 and 2 are A and B; button_layout() keeps their labels. Run, the Lynx's Pause and the Neo Geo Pocket's Option are Start; the Lynx's Option 1 and 2 are Select and Mode; PC Engine's switch between two and six buttons is Mode. The WonderSwan's X cross is the direction pad and its Y cross has the IDs of the N64's C-buttons. The Master System's Pause sits on the console and is returned by system_channels().

Usage

read_mcm(
  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 digital input. commands retains the command byte, and source_packets retains complete packets. An incomplete final packet produces a warning and remains in source_tail. The ROM checksum bytes are preserved in header$romMD5Bytes. Peripheral layouts beyond these fixed gamepads require a separate decoder.

Examples

movie <- read_mcm(system.file("extdata", "legacy", "pce.mcm", package = "replayr"))
n_players(movie)
#> [1] 5
# The numbered buttons of the PC Engine take the lettered identities in order.
button_layout(movie)[, c("key", "name")]
#>           key            name
#> 1  dpad_right           Right
#> 2   dpad_left            Left
#> 3   dpad_down            Down
#> 4     dpad_up              Up
#> 5       start             Run
#> 6      select          Select
#> 7           b              II
#> 8           a               I
#> 9           x             III
#> 10          y              IV
#> 11         l1               V
#> 12         r1              VI
#> 13       mode 2/6 Mode Select