Jagged Alliance 2 Crash Monitor
by AndroidXP - 19.08.2006
-------------------------------

> How to install?
Extract the contents of the zip to your JA2 install directory
Note: If you put it somewhere else, it will still work, but you will have to start JA2 manually after launching JA2CM

> How to use?
To start JA2, simply lauch JA2CM.exe instead of ja2.exe
If you have a shortcut to JA2 on your desktop, the easiest way is to modify it so it points to JA2CM.exe. You will notice no
change to the usual behaviour of launching JA2.

> How does it work?
JA2CM runs in the background and monitors the JA2 process. Should JA2 become unresponsive (due to a crash), JA2CM will
shut down the non-responding process, saving you from doing a complete system reboot.
If JA2 exits normally, or after it crashed, JA2CM will shut down itself, too.

> Why not use Ctrl-Alt-Del?
Sometimes when JA2 crashes, it doesn't unlock the graphics handle, thus not only preventing Alt-Tab completely, but also
the taskmanager will only show up in the background (invisible). You can still use it blindly, but this can cause the unwanted 
shutdown of other processes, and additionally you have to memorize the correct key sequence, too. JA2CM voids this problem, as 
it works completely automatic.

> What are all these command line parameters for, and how to use them?
There are currently five command line parameters:
  -debug
     Enables logging output of JA2CM's actions into JA2CM.log
  -nostart
     Disables the automatic startup of JA2. When you use it, you have to first start JA2CM.exe and after that ja2.exe
  -noshutdown
     Disables the automatic shutdown of JA2CM after JA2 crashed or exited normally. Use this if you want JA2CM to stay 
     active after it has been started once. It's best to use together with -nostart, if you want to put JA2CM in the 
     autostart folder, for example
  -checkdelay=X
     Range: 1-300, default = 20 (seconds)
     Sets the delay before a JA2CM starts to check for responsiveness. Don't set this too low, or it might detect a just
     starting up JA2 process as "unresponsive".
  -checkinterval=X
     Range: 1-300, default = 5 (seconds)
     Sets the interval at which responsiveness checks occur. A lower value means faster response time on a crash, but also
     slightly higher CPU load (not that the CPU load is noticeable, anyway). Do not set this too high, or else you might
     have to wait very long until the crash is detected.

Example of how to use all parameters ("Target" field in the shortcut):
"C:\Program Files\JaggedAlliance2\JA2CM.exe" -nostart -noshutdown -debug -checkdelay=30 -checkinterval=10


> Requirements:
Microsoft .NET Framework 2.0
(http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5)


> Change history:

~ Version 1.0.0.0
Initial release

~ Version 1.0.0.1
Added check to prevent running multiple instances of JA2CM
Added feature to automatically start JA2 if the JA2CM.exe is placed in the install directory of JA2
Renamed output binary from Ja2CrashMonitor.exe to JA2CM.exe

~ Version 1.0.0.2
Added command line switch "-nostart" to disable automatic startup of JA2
Added command line switch "-noshutdown" to disable the automatic shutdown of JA2CM after exiting JA2 - Instead it will stay idle until JA2 is started up again
	Example:       "JA2CM.exe -nostart -noshutdown"
	In a shortcut: "C:\Program Files\JaggedAlliance2\JA2CM.exe" -nostart -noshutdown

~ Version 1.0.0.3
Added command line switch "-debug" to output JA2CM's actions into JA2CM.log

~ Version 1.0.0.4
Added version number output to JA2CM.log
Added 20 second delay after finding the JA2 process (before starting responsiveness check)

~ Version 1.0.0.5
Updated debug output a bit
Added additional responsiveness check one second after JA2 was found to be unresponsive. Should prevent unnecessary shutdown on small hiccups
Added command line parameter "-checkdelay=X" to manually define the delay before starting responsiveness check (default: 20)
Added command line parameter "-checkinterval=X" to manually define the delay between each responsiveness check (default: 5)
	Example: "JA2CM.exe -checkdelay=30 -checkinterval=10"
	Note:	 Value is in seconds. Minimum is 1 second, maximum is 300 (5 minutes)
		 Use a higher checkdelay if JA2CM already ends JA2 during startup. Using a lower interval will make the 
		 reaction to a unresponsive JA2 faster, but at a cost of increased CPU load (which is very small anyways).