DebugSwitches

From TTWiki
Jump to navigationJump to search

Debug switches are not useful for most people, but they can sometimes help fixing odd problems in the patch. They are mostly intended to be used by developers when testing the patch.

To use them, they must be the first switch on TTDPatch's command line, and start with an exclamation mark, "!". After the exclamation mark follows the list of debug switches, each of them possibly trailed by a "+" or "-" to choose two different modes of operation. Currently if neither "+" nor "-" is specified, "+" is assumed. An example:

ttdpatch.exe -!v+T+w-

This would run TTDPatch to collect new version information and terminate before even starting TTD. If any warnings occur, they are ignored.

Alternatively, since revision 798 debug switches may be specified in the configuration file:

debugswitches v+T+w-

Here's the complete list of debug switches:

Switch Meaning
v- Ignore TTD version info stored with TTDPatch (i.e. do not recognize TTD version)
v+ Collect TTD version info and write to a file
s- Never swap out the real mode code when starting TTD (DOS only)
s+ Always swap out the real mode code when starting TTD (DOS only)
c This switch is very special: if specified, TTDPatch will not process the command line options as usual, instead it will treat the rest of the command line as name and arguments of a program to run. This feature can be used to analyze TTDPatch's memory usage in the DOS version.
t- Assume TTDLOAD(W).OVL exists and is correct, don't process it or try to locate the original files. Currently this is useful only if combined with the c debug switch, otherwise it'll prevent TTDPatch from working and may cause a crash.
m- Run even if there's not enough memory to start TTD (DOS only)
f- Don't read or create the default ttdpatch.cfg
a- Don't check dependencies between switches. If used, TTDPatch will not correct illegal combinations of switches. Warning: some switch combinations are dangerous. For example, if startyear is set to 1927 and generalfixes to off, TTD will probably hang when you try to start a new random game. Normally, i.e. without this debug switch, TTDPatch would prevent that by turning generalfixes on. See New Starting Year for more information.
w- Do not wait for a key after a warning message, just continue
w+ Do not wait for a key after a warning message, just abort
o+ Reorder all switches alphabetically when writing a configuration file, not only the new ones
T- Terminate TTDPatch after parsing the cfg/cmdline (only TTDPatch 2.0.1 alpha 51 or higher)
T+ Terminate TTD immediately after collecting version information (see v+)
L+ Load language data from the file named language.dat instead of the TTDPatch executable. Useful in debugging because many debuggers fail to load symbol information with those data appended to the executable.
C+ Load patch code from loaderd.bin and ttdprotd.bin for DOS or loaderw.bin and ttdprotw.bin for Windows. Useful in debugging because many debuggers fail to load symbol information with that code appended to the executable.
R+ Load relocation information from relocd.bin for DOS or relocw.bin for Windows. Useful in debugging because many debuggers fail to load symbol information with that code appended to the executable.
I- Prevent the enhanced keyboard handler from updating keyboard LED indicators. The Lock keys will still toggle internal flags, though. (DOS only)
S+ Dump information about all supported switches (non-debug, non-special ones) to swtchlst.txt and abort
S- Write current patch version and switch information in XML format to switches.xml and abort (only TTDPatch 2.0.1 alpha 21 or higher)
P+ Don't check ttdpatch.dll to see if it needs to be updated.
n+ Use noregistry information from registry.ini
n- Do not use noregistry information
r Do not run TTDLOAD(W).OVL directly (since 2.5 beta 9)