Imports Nintendo 3DS CTM recordings as ordered device polls. Pad and Circle
Pad, touch, accelerometer, gyroscope, IR C-stick, and extra-HID polls each
occupy their own rows. polls() exposes event_type and flags identifying
the observed device. observed_inputs marks the digital controls measured
at each poll; numeric fields for other devices are NA.
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_poll_stream containing ordered device polls and metadata.
Details
analog_channels() retains the source coordinates, motion values, and
battery level. The Circle Pad and C-stick support the four stick modes
through analog, using their source-specific centres and scales.
poll_bytes retains the seven-byte records. Timing follows device-poll
order; CTM provides no video-frame assignment for these rows.
Examples
stream <- read_ctm(system.file("extdata", "legacy", "devices.ctm", package = "replayr"))
# Each row is the poll of one device: pad, touch screen or a sensor.
class(stream)
#> [1] "replayr_poll_stream"
observation_unit(stream)
#> [1] "device poll"
channel_layout(stream)$key
#> [1] "left_x" "left_y" "touch_x" "touch_y"
#> [5] "touch_valid" "accel_x" "accel_y" "accel_z"
#> [9] "gyro_x" "gyro_y" "gyro_z" "right_x"
#> [13] "right_y" "extra_c_stick_x" "extra_c_stick_y" "battery_level"