Reads JRSR text archives containing an events section. Keyboard edges,
mouse buttons and movement, joystick events, and reset commands are decoded.
Other emulator events remain in movie$events with their arguments and
original source lines. Initialisation sections remain in
movie$header$initialization and movie$event_sections.
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.- ...
Reader-specific arguments, such as
controller_orderfor M64 or DTM, ormemberfor a recording inside a ZIP archive (seemovie_members()).
Value
A replayr_movie with event times, reconstructed states, and source events.
Details
Each row follows one timestamped event. movie$events$timestamp_ns gives
absolute time in nanoseconds after applying recorded RELATIVE and
ABSOLUTE options. timestamp_source retains the source timestamp text.
Keyboard and button states persist until the next relevant event;
mouse movement channels record the displacement at that event.
Keyboard identities use jpcrr_key_<number>, preserving JPC-RR's key-code
namespace. The Pause event appears as a jpcrr_pause pulse. Keyboard and
mouse inputs occupy player 1. analog_channels() exposes mouse_dx,
mouse_dy, and mouse_wheel, and the joystick channels
joystick_x_hold_ns and joystick_y_hold_ns. Joystick values are recorded
game-port hold times in nanoseconds and remain NA before their first update.
Examples
movie <- read_jrsr(system.file("extdata", "computers", "keyboard-mouse.jrsr", package = "replayr"))
observation_unit(movie)
#> [1] "event"
observation_time(movie)
#> [1] 0.00e+00 1.00e-07 1.50e-07 1.75e-07 2.00e-07 2.50e-07 3.00e-07 3.00e-07
#> [9] 3.20e-07 4.00e-07 4.25e-07 4.50e-07
analog_channels(movie)[1:4, ]
#> mouse_dx mouse_dy mouse_wheel joystick_x_hold_ns joystick_y_hold_ns
#> [1,] 0 0 0 NA NA
#> [2,] 0 0 0 NA NA
#> [3,] 0 0 0 NA NA
#> [4,] -3 0 0 NA NA