Reads gzip-compressed openMSX XML replay files. Supported event schemas
cover keyboard matrices, joysticks, mice, trackballs, paddles, touchpads,
light guns, and autofire settings. The initial keyboard state is read from
the first replay snapshot. Every device is one controller: the keyboard
first, then the devices on the joystick ports by name, as listed in
movie$header$controllers. Their controls have the same IDs as in every
other reader: a joystick is the direction pad with A and B, the buttons of
a mouse or trackball are A and B, the JoyMega pad adds C, Start, X, Y, Z
and Mode, a light-gun trigger and a paddle's button are A, and a touch on
the touchpad is L3. openmsx_key_r8_b0 identifies a keyboard matrix row
and bit. All devices share one event stream, so each controller has a row
for every event.
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, device controls, and source XML.
Details
Each row follows one replay event. movie$events$timestamp_ticks retains
time in openMSX master-clock ticks (3,579,545 * 960 ticks per second), and
timestamp_seconds expresses the same event times in seconds.
timestamp_source, event_type, source_device, and source_xml retain
the event's original time, type, device, and XML.
analog_channels() preserves the values of each device on its controller.
Examples include mouse_dx and mouse_dy for movement and
touch_x and touch_y for touch coordinates. A
recorded autofire setting, such as openmsx_autofire_renshaturbo, belongs
to the machine and is returned by system_channels().
Movement deltas apply to their event; coordinates and settings persist
until updated. The replay schema version and machine name remain in
movie$header$replay_version and movie$header$machine.
Examples
movie <- read_omr(system.file("extdata", "computers", "keyboard-joystick.omr", package = "replayr"))
# Every device is a controller.
movie$header$controllers
#> [1] "keyboard" "keyjoystick1" "mouse"
observation_time(movie)
#> [1] 0 1 1 2 2 2 3