Here is the source code (gzipped diff patch file) of the rerecording support.
http://bisqwit.iki.fi/src/patch-dosbox-0.70-rerecording-alpha6.gz
http://bisqwit.iki.fi/src/patch-dosbox-0.70-rerecording-alpha5.gz
http://bisqwit.iki.fi/src/patch-dosbox-0.70-rerecording-alpha4.gz
http://bisqwit.iki.fi/src/patch-dosbox-0.70-rerecording-alpha3.gz
http://bisqwit.iki.fi/src/patch-dosbox-0.70-rerecording-alpha2.gz
http://bisqwit.iki.fi/src/patch-dosbox-0.70-rerecording-alpha1.gz
Here is a precompiled version for Windows (of version alpha5, not newest).
https://files.tasvideos.org/bisqwit/dosbox-rerecording-exe-a5.zip
It also requires this SDL dll file to run.
http://bisqwit.iki.fi/kala/sdl-dll.zip
This version of DosBox redefines the following keys:
Shift+1 to Shift+0: Select savestate slot (to type numbers (instead of selecting savestates), you must use the numpad)
shift+F1: saves savestate
shift+F2: loads savestate
shift+F3: frame advance
shift+F4: pause/unpause
shift+F5: ask & load movie
shift+F6: ask & create movie
shift+F7: toggle movie readonly access
shift+F8: close movie
none
F10 + key: Toggle "permanently on" for the selected key
non
F9 + key: Change autofire function for the selected key
There is no way to feed these keys directly to the game.
By default, it loads a movie "movie.dof" upon start and starts in paused, readonly mode. It does not load a movie automatically now.
Notes regarding savestates:
- You can only load a savestate in the same displaymode it was created in.
- Sometimes, frame advance immediately after loading a savestate causes an X11 error. It annoys me a lot. I haven't been able to fix it yet. But fortunately, it does not corrupt movies.
Other notes:
- Input sampling rate is defined in "InputInterval" variable in dosbox.cpp. Shorter number = input sampled more often (more precise input, larger movie files).
- Only keyboard input it considered. Use of mouse, joystick, etc, will inevitably cause a desync.
- This dosbox cannot create / change actual files. Everything happens virtually, so that movies are replayable.
- Do not use speed throttling. You must use a fixed "number of cycles" and frameskip=0 (no frame skipping).
- The savestates contain numerous pointers which have been saved raw. Function pointers that is. If you recompile dosbox, all old savestates stop working.
EDIT 2007-03-21: Newer version of patch (alpha2). This version adds some safeguards against movie file breakage due to weird combination of load/save state and toggle readonly. Also, it added the F9 and F10 hotkeys.
I just couldn't have those as sourcecode customization options, considering that every time I tweak and compile the source, all old savestates will stop working.
EDIT: Newer version of patch (alpha3). This version adds nesvideos-style AVI capture support and a mode13 hack which reduces dosbox crashing when the game is in mode13. Unfortunately it only works in mode13, so it's disabled by default. Mouse support is also preliminarily under construction.
EDIT 2007-03-25: Newer version of patch (alpha4). This version improves the support of protected mode games. This time I'm trying to make Descent rerecording working. Currently the savestates don't seem to restore the state entirely; the game occassionally crashes when the savestate is loaded. Also, the savestate slot selection keys were changed. Instead of 1, it's now shift+1.
Default movie file was changed from sc2.dof to movie.dof.
EDIT 2007-03-31: Fixed a bug that involved movie being initialized before the configuration was read, effectively meaning that ignored the CPU speed setting in the movie.
EDIT 2007-09-30: New version (alpha6): Added support for programs that use DOS functions to read keyboard input. Those should now be TASable. Also changed the hotkeys a bit (added shift+, dropped F9 and F10). You may want to change them by editing gui/sdl_mapper.cpp.
HOW TO GET STARTED (on Windows):
Place SDL.dll somewhere that it's found when it's needed. Ask Windows-people how to do that.
Start dosbox in the directory (folder) of your game. (Ask the Windows-people for how to do that. It is important, so that you don't need to type paths while the movie is recording.)
It will automatically start creating a movie file, movie.dof.
(If there's already one, either delete it before starting dosbox, or hit F7 to go to readwrite mode. Observe the log window to see whether it's in readwrite or readonly mode.)
Hit F4 to unpause the emulator. When you actually start creating a movie, you will probably want to frameadvance using F3 instead of unpausing with F4.
Type "mount c .", press enter, and type "c:", and press enter, and then you are in the directory of your game (if you started dosbox in that directory, which you really should have). Start the game, or its setup, or whatever, by typing the name of that program or its startup script. ???. Profit.
Read this post for the hotkeys regarding readonly mode, savestates etc.
Using autoexec commands in the movie is not recommended, because you can do it just as well during the movie recording, and it takes on average about 1.3*strlen(commands) frames to input them.
You probably should create a configuration file for yourself, and edit it. Type "config -writeconf dosbox.conf" in dosbox, and then close dosbox and edit the dosbox.conf file.
* You should adjust the "memsize" setting to the number of megabytes you presume the game might need memory.
* You should adjust the "cycles" setting in the CPU section. If it is an older game, a lower value for cycles is good. If it's a newer game or a CPU-intensive one, a higher value is necessary. Hint: If the game requires a 100 MHz computer, use 100000. If the game requires a 20 Mhz computer, use 20000. And so on. Note: Dosbox default is 3000. Note: The higher value you use, the harder dosbox will lag, but the more fluently the game will run in the final product. Thus, larger number = faster and more beautiful movie (applies especially with 3D games). But don't overdo it; use only as large number as is required, not larger.
** If your game is extremely old, and it will become ridiculously fast when you use a high CPU rate, please do not do that. Use only a CPU rate that makes sense for the game of that era.
* You should adjust the soundcard mixing settings. Disable those cards which are not needed by your game, and set the mixing rates accordingly. If your game produces 44 kHz digital sound, then you should set the mixing rate at 44 kHz. If it only produces 11 kHz sound, you should set it at 22 kHz or 11 kHz.
* Set "keyboardlayout=" . Do not use "auto", it will cause portability problems.
Your game installation should be as pure as possible. This means, no configuration files from previous runs of the game or its SETUP, no saved games, no userdesigned scenarios, etc. Everything should be as pristine as possible to ensure that others who wish to try your movie, have equal chances of getting it to work.
(This is not required for your testing, but it will probably become a rule on this site for Dosbox submissions.)
Note that TASes made with the current Dosbox version are not yet officially accepted on this site, so don't start creating that laboursome cool movie yet. (This rule may be bent on individual basis, but until the system is robust enough, it's better to not have movie files that may not be playable with future versions and that
lack important features anyway.)