Skip to content

Instantly share code, notes, and snippets.

@atshane253
Last active October 22, 2017 05:49
Show Gist options
  • Save atshane253/34c04553342b76f97e10e8439303e153 to your computer and use it in GitHub Desktop.
Save atshane253/34c04553342b76f97e10e8439303e153 to your computer and use it in GitHub Desktop.
figuring out canoe inputs and porting TAS to it
simple unix text files
invalid videos usually don't crash, Canoe just sits there until disturbed.
# hash tag comments until the next line
files are saved with version headers, known headers:
# Inputs version 2.1.0213.0 (Canoe Win32)
(builtin classic demo)
# Inputs version 2.3.0531.0 (Canoe L.ARM)
(US SNES mini dp-snesusa-nerd release-v2.0.13-0-g9dca6c5)
v2.3.0531 begins each file with a # Sha1 hash
different for each .inputs on the same rom (hash contents? test no press runs)
Canoe convieniently saves the emulator state on boot, and automatically records
inputs. It supports recording multiple segments into a file, new segments are
probably triggered by pressing reset and either returning to the menu, or using
the built-in rewind feature. Segments begin with a small block of definitions.
This segment header is the same on both versions I've seen:
VPad0WPad0XPad0YPad0Reset0Shot0Resume0Save0
Canoe writes comments every ten seconds and at the end of the segment or file
with the time in XmYs and frame count. Canoe saves a new clip every ten seconds,
saving the state and starting a new input file. The latest 4 full clips are kept,
files are renamed [0-4].(inputs|break). When you save the state, Canoe pauses
writing the current input and saves the state into 5.break, and saves a screen
shot and the total run time in seconds in state.(png|time) (does this lose time
over multiple partial seconds? does it matter?).
Normally, on the second frame Canoe will plug in VPad and WPad.
_VPad1WPad1_...
Although it always boots enabling 2 controllers, Canoe respects only plugging
in one controller, and won't re-enable it during replay. XPad1 and YPad1 don't
enable 3P and 4P
Tested in Super Bomberman 2.
Resets are triggered by setting Reset1 in a frame and following with Reset0.
..Reset1_Reset0_..
Canoe will sometimes hang until the end of .inputs is reached if Reset is held
or used oddly.
The controller's buttons are recorded as they are pressed or released, as a
bitfield of currently pressed buttons on the controller. Frames are separated
by an underscore, subframe input is probably not possible (what buttons are used,
first set in a frame? last? just crash?). The button state is held until the
next change. The bit array matches the usual SNES controller register order,
with the two bytes swapped.
0 nothin
+1 00 01 (0)
+2 00 02 (1)
+4 00 04 (2)
+8 00 08 (3)
+16 00 10 R
+32 00 20 L
+64 00 40 X
+128 00 80 A
+256 01 00 Right
+512 02 00 Left
+1024 04 00 Down
+2048 08 00 Up
+4096 10 00 Start
+8192 20 00 Select
+16384 40 00 Y
+32768 80 00 B
To make a simple "classic" demo:
Save a state
Make sure to press the reset button within 45 seconds of starting the rom
Copy the initial state to the rom
from /var/lib/clover/profile/0/CLV-U-GAMEX/suspendpoint1/rollback/0.break
to %hakchi2%\games_snes\CLV-U-GAMEX\autoplay\A.inputs.state
Create a new input file %hakchi2%\games_snes\CLV-U-GAMEX\autoplay\A.inputs
Add a suitable number of underscores "_", one per frame
____________________________________________________________
60 frames x 60 seconds = 3600 _ per minute of idle demo
Don't actually need most of the stuff Canoe writes to idle for a minute
Sync with hakchi
If you want to start the idle demo where the state was saved, use the highest
numbered #.break file from the state in place of 0.break.
Should really do some real emulator testing with TA or something else really random,
see if there's any point to trying to translate movies to this emu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment