Reads MAME-RR input-port records. Known games use the bundled port layouts;
other games require an explicit input schema. Original port words, timestamps,
and analogue accumulator fields remain available in system_channels.
Usage
read_mar(
path,
analog = "raw",
deadzone = NULL,
triggers = "raw",
aliases = TRUE,
input_schema = NULL,
...
)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 throughstick_channels(). Original X/Y values remain inanalog_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.
NULLuses 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_Clampin 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 anNAangle. 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 thatbutton_layout()describes. WithFALSE, 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.- input_schema
A game-specific port schema; see the bundled
extdata/mar-layouts.jsonfor the schema structure.- ...
Reader-specific arguments, such as
controller_orderfor M64 or DTM, ormemberfor a recording inside a ZIP archive (seemovie_members()).
Examples
path <- system.file("extdata", "expanded", "arcade-dual-joysticks.mar",
package = "replayr")
movie <- read_mar(path)
# The two joysticks of a cabinet are the left and the right stick.
button_layout(movie)[, c("key", "name")]
#> key name
#> 1 start Start
#> 2 left_e Left joystick Right
#> 3 left_n Left joystick Up
#> 4 left_w Left joystick Left
#> 5 left_s Left joystick Down
#> 6 right_e Right joystick Right
#> 7 right_n Right joystick Up
#> 8 right_w Right joystick Left
#> 9 right_s Right joystick Down
names(system_channels(movie))
#> [1] "time_seconds" "time_attoseconds_low" "time_attoseconds_high"
#> [4] "port_p1_default" "port_p1_digital" "port_p2_default"
#> [7] "port_p2_digital" "port_system_default" "port_system_digital"
#> [10] "coin_1" "coin_2" "port_dsw_default"
#> [13] "port_dsw_digital"