Reads native LTM archives containing config.ini and inputs. Supports
the positional input format through libTAS 1.3.5 and the later tagged
format, including ordered input events and up to four controllers.
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 frame timing, source inputs, and metadata.
Details
Each row is a recorded frame. movie$timing contains framerate_num,
framerate_den, duration_seconds, realtime_sec, and realtime_nsec.
Frame durations follow the recorded rate changes. movie$input_events
retains each frame's ordered events, and movie$flags retains emulator flags.
source_input_log retains the original input lines and their row index.
Keyboard keys use their hexadecimal X KeySym in button_layout(), such as
keysym_ff53 for Right. Keyboard and mouse inputs occupy player 1 alongside
controller 1. Controller buttons retain gamepad identities, including L3
and R3. analog_channels() includes left_x, left_y, right_x,
right_y, left_trigger, and right_trigger as signed 16-bit source values.
Both sticks support the representations selected by analog.
Mouse channels are mouse_x, mouse_y, mouse_wheel, and mouse_mode;
mode 0 denotes absolute coordinates and mode 1 denotes relative movement.
The complete configuration remains in movie$header$configuration.
Examples
movie <- read_ltm(system.file("extdata", "computers", "dual-stick-menu.ltm", package = "replayr"))
movie
#> <replayr_movie [ltm] observations=5 players=2 buttons=17 source=dual-stick-menu.ltm>
#> Header keys: format, emulator, configuration, observation_unit, frame_count, declared_frame_count, legacy_input_format, keyboard_mouse_player, ...
#> P1 active observations: a=3, l1=1, l3=1, r3=2, keysym_20=1, keysym_ff53=4
channel_layout(movie)
#> column key name
#> 1 1 mouse_x mouse x
#> 2 2 mouse_y mouse y
#> 3 3 mouse_wheel mouse wheel
#> 4 4 mouse_mode mouse mode
#> 5 5 left_x Left stick X
#> 6 6 left_y Left stick Y
#> 7 7 right_x Right stick X
#> 8 8 right_y Right stick Y
#> 9 9 left_trigger Left trigger
#> 10 10 right_trigger Right trigger
# Every frame has its own length.
observation_time(movie)
#> [1] 0.00000000 0.01666667 0.05000000 0.06666667 0.08333333