implements ADDKEY command:
This is an extension which I created loosely based on a similar
tool in 4DOS (keystack). It allows you to add keys into the
keyboard buffer in order to skip intro screens, games' hardware
configuration questions and similar.
There are two modes of operation:
The first mode inserts keys into the BIOS keyboard buffer using
INT16. Advantage: easy to use. Disadvantage: Fails with many
programs.
For example, if you have Civilization 1 with the addon OPL-3
driver, You would normally have to enter "1" "6" "1" at every
startup. Using this command sequence in a batch file (including
the autoexec section of dosbox.ini), you can skip the config
questions:
ADDKEY 1 6 1
CIV.EXE
To skip the intro as well, use:
ADDKEY 1 6 1 Space
CIV.EXE
Allowed are all single characters, plus the special arguments
"Space" and "Enter", separated with spaces, as many as the
buffer can hold. It only works when the program in question uses
the BIOS to read the keyboard.
The second mode of operation uses the dosbox keyboard
handler to add keypresses. It is able to fool any and all
programs (something which pure dos tools, including 4DOS's
keystack, can't do), but has a more complicated syntax.
It works by generating keypress and keyrelease events with
user-specifiable timings. By default, a given key is pressed
immediately and then released again with no delay:
ADDKEY 52
would simulate the Enter key. The number is a dosbox keysym.
basically, 0x1 = 1, 0x2 = 2, ..., 0x9 = 9, 10 = 0, 11 = q, 21 = a,
and so on. 52 is Enter. You have to use "0x1" instead of "1", as
"1" is used by simple mode above.
However, many programs need some time until they start to
read the keyboard. So using this syntax, you cann add pauses:
ADDKEY p1000 52 p500 52
would simulate the enter key after 1 second (1000 ms), and
another enter key press after another pause of half a second
(1.5 seconds after the command was executed).
I haven't come across this yet, but some programs might also
be sensitive to key press duration, so there is a syntax to
configure it:
ADDKEY l100 52
would simulate an enter key press for 100ms. The duration is
kept for all subsequent keys until changed. This allows you to
simulate Shifted keypresses (or Alt/Control):
ADDKEY l100 54 l40 21
would be Alt-A (press left alt for 100 ms, and almost
immediately press the "a" key for 40ms)
This can be mixed freely:
ADDKEY 52 p1000 l100 54 l0 21 p100 52
would be:
Press Enter immediately, wait a second, press left-alt for
100ms, press "a" immediately thereafter with a duration of 0ms
(which is the default), wait 100ms (until left-alt has been
released), then press Enter again.
Do not mix "simple" keys with the advanced mode however, this
might produce unexpected results.
Using the right amount of pauses and keys, this allows you to
skip any opening questions, intro screens, even load a saved
game or similar, since the keys are inserted as if SDL read them
from the keyboard.
I found that dosbox-svn did not implement feature addkey until 0.9.7 version.
It's very useful command to automate game entry having CLI console menu selecting like Dragon Strike.
Please consider it on future release. thank you :)
https://sourceforge.net/p/dosbox/patches/57
implements ADDKEY command: This is an extension which I created loosely based on a similar tool in 4DOS (keystack). It allows you to add keys into the keyboard buffer in order to skip intro screens, games' hardware configuration questions and similar.
There are two modes of operation:
The first mode inserts keys into the BIOS keyboard buffer using INT16. Advantage: easy to use. Disadvantage: Fails with many programs. For example, if you have Civilization 1 with the addon OPL-3 driver, You would normally have to enter "1" "6" "1" at every startup. Using this command sequence in a batch file (including the autoexec section of dosbox.ini), you can skip the config questions: ADDKEY 1 6 1 CIV.EXE
To skip the intro as well, use: ADDKEY 1 6 1 Space CIV.EXE
Allowed are all single characters, plus the special arguments "Space" and "Enter", separated with spaces, as many as the buffer can hold. It only works when the program in question uses the BIOS to read the keyboard.
The second mode of operation uses the dosbox keyboard handler to add keypresses. It is able to fool any and all programs (something which pure dos tools, including 4DOS's keystack, can't do), but has a more complicated syntax. It works by generating keypress and keyrelease events with user-specifiable timings. By default, a given key is pressed immediately and then released again with no delay: ADDKEY 52 would simulate the Enter key. The number is a dosbox keysym. basically, 0x1 = 1, 0x2 = 2, ..., 0x9 = 9, 10 = 0, 11 = q, 21 = a, and so on. 52 is Enter. You have to use "0x1" instead of "1", as "1" is used by simple mode above. However, many programs need some time until they start to read the keyboard. So using this syntax, you cann add pauses: ADDKEY p1000 52 p500 52 would simulate the enter key after 1 second (1000 ms), and another enter key press after another pause of half a second (1.5 seconds after the command was executed). I haven't come across this yet, but some programs might also be sensitive to key press duration, so there is a syntax to configure it: ADDKEY l100 52 would simulate an enter key press for 100ms. The duration is kept for all subsequent keys until changed. This allows you to simulate Shifted keypresses (or Alt/Control): ADDKEY l100 54 l40 21 would be Alt-A (press left alt for 100 ms, and almost immediately press the "a" key for 40ms) This can be mixed freely: ADDKEY 52 p1000 l100 54 l0 21 p100 52 would be: Press Enter immediately, wait a second, press left-alt for 100ms, press "a" immediately thereafter with a duration of 0ms (which is the default), wait 100ms (until left-alt has been released), then press Enter again.
Do not mix "simple" keys with the advanced mode however, this might produce unexpected results.
Using the right amount of pauses and keys, this allows you to skip any opening questions, intro screens, even load a saved game or similar, since the keys are inserted as if SDL read them from the keyboard.