Skip to contents

Imports the DFT archives of Dustmod, a modified version of the game Dustforce DX, by following their entry script and INCLUDE commands. Each row represents one scripted input frame. Directional double taps are preserved in double_tapped; source_digits and source_values retain the original 0, 1, and 2 encoding. Optional taunt and restart columns are retained when present.

Usage

read_dft(
  path,
  analog = "raw",
  deadzone = NULL,
  triggers = "raw",
  aliases = TRUE,
  entry = NULL,
  ...
)

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 through stick_channels(). Original X/Y values remain in analog_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. NULL uses 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_Clamp in 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 an NA angle. 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 that button_layout() describes. With FALSE, 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.

entry

Entry script member. NULL selects the archive's unique main.txt; an explicit member resolves archives with several candidates.

...

Reader-specific arguments, such as controller_order for M64 or DTM, or member for a recording inside a ZIP archive (see movie_members()).

Value

A replayr_movie with source scripts, commands, and locations.

Details

source_locations identifies the archive member and line for each row. source_commands preserves loading, synchronisation, mouse, statistics, and include commands in script order. MOUSE coordinates and button states apply to the next scripted row, with observation masks identifying those rows. SYNCLOAD can add runtime waiting whose duration requires execution in the game; the imported rows retain script order.

Examples

movie <- read_dft(system.file("extdata", "computers", "menu-double-tap.dft", package = "replayr"))
# Jump, dash and the attacks are actions of the game, not buttons.
button_layout(movie)[, c("id", "key", "kind")]
#>                id            key   kind
#> 1               1     dpad_right button
#> 2               2      dpad_left button
#> 3               3      dpad_down button
#> 4               4        dpad_up button
#> 5               5          start button
#> 6               7              b button
#> 7               8              a button
#> 8               9              x button
#> 9              22         c_down button
#> 10             23           c_up button
#> 11    action:jump    action_jump action
#> 12    action:dash    action_dash action
#> 13   action:light   action_light action
#> 14   action:heavy   action_heavy action
#> 15   action:taunt   action_taunt action
#> 16 action:restart action_restart action
head(analog_channels(movie), 3)
#>      mouse_x mouse_y
#> [1,]      NA      NA
#> [2,]      NA      NA
#> [3,]      NA      NA