An imported recording with assigned input streams. Recordings whose
polls have unassigned ports use replayr_poll_stream. A replayr_movie
is a list with the following elements:
Details
headerNamed list of header key-value pairs lifted from the source file. The synthetic
_formatentry records which parser produced the movie, such as"fm2","bk2", or"ltm".commandsInteger vector with one entry per observation. Per-observation emulator command bits, where the format uses them.
inputsLogical 3D array, dimensions
(observations, players, buttons).TRUEmeans the button was held at that observation.analogList of numeric channel matrices, one per player. Rows align with
inputs; columns are named by the keys ofchannel_layout(), and units depend on the format.analog_modeSelected representation label. Numeric source values are retained in every mode.
stick_modesNamed left/right choices:
"raw","cardinal4","cardinal8","angle", or"angle+magnitude".button_ids,button_keys,layout_versionStable control identities and registry version for the compact input columns.
stick_valuesSelected numeric stick channels, one matrix per player; accessed with
stick_channels().source_pathPath the movie was loaded from, or
NA. ZIP imports also retain the selectedsource_member.events,timing,input_eventsWhere present, source-specific event records and timing. See the format-specific reader.
button_mnemonicsCharacter vector. One mnemonic per third-dimension slot of
inputs; source-defined controls may use multi-character labels.button_namesCharacter vector. Friendly labels paired with
button_mnemonics.
The accessors name control columns by button_keys; mnemonics and labels
are further columns of button_layout().
Use n_observations(), n_players(), n_buttons() to read the array
shape and player() to extract one player's buttons as a 2D matrix.
summary() counts held observations and
activations per control, as.data.frame()
returns one row per observation, and [movie[i]][subset-recording] selects
observations and keeps the class.
Examples
movie <- read_movie(system.file("extdata", "sample.dtm", package = "replayr"))
class(movie)
#> [1] "replayr_movie"
# Observations, controllers and controls.
dim(movie$inputs)
#> [1] 3600 1 12
names(movie$header)[1:5]
#> [1] "_format" "Platform" "romId" "romMD5"
#> [5] "rerecordCount"
movie
#> <replayr_movie [dtm] observations=3600 players=1 buttons=12 source=sample.dtm>
#> Header keys: Platform, romId, romMD5, rerecordCount, frameCount, inputCount, inputCountRole, availablePollCount, ...
#> P1 active observations: dpad_right=900, dpad_left=900, dpad_down=900, dpad_up=900, start=6, b=900, a=450, x=288
# The accessors and methods work on a selection as on the whole recording.
summary(movie[1:600])
#> dtm recording sample.dtm: 600 controller polls, 1 controller, 12 controls
#> Controls active at least once:
#> controller key name held activations
#> 1 dpad_right Right 150 5
#> 1 dpad_left Left 150 5
#> 1 dpad_down Down 150 5
#> 1 dpad_up Up 150 5
#> 1 start Start 1 1
#> 1 b B 150 26
#> 1 a A 75 16
#> 1 x X 48 13
#> Numeric channels:
#> controller key name min max missing
#> 1 left_trigger Left trigger 0 0 0
#> 1 right_trigger Right trigger 0 0 0
#> 1 left_x Left stick X 58 198 0
#> 1 left_y Left stick Y 58 198 0
#> 1 right_x Right stick X 128 189 0
#> 1 right_y Right stick Y 128 128 0