Act Labs USB Light Gun Compatibility Fix, Version 1.5.1
-------------------------------------------------------

WHAT THIS IS:

This is a fix that allows the Act Labs USB light guns to work with older games that were previously incompatible with the guns because of the way the games handle mouse input.

Out of the box, these games cannot be played with the Act Labs light gun because they do not read mouse movement in absolute mode.  The light gun sends absolute mouse coordinates to the PC, but these games only read relative mouse movements, and so the information received from the gun throws the targets way off.  This fix makes the games work with the light gun by essentially bypassing their mouse handling altogether, and plugging the absolute values directly into the games' internal coordinate variables.

This fix supports two-player games using two Act Labs TV USB guns (on all versions of Windows), or two PC Monitor USB Guns (on Windows XP only).


SUPPORTED GAMES:

- Virtua Squad 2 (aka Virtua Cop 2)
- House of the Dead 
- House of the Dead 2 (Adds two-player support with two Act Labs TV USB Guns)
- Die Hard Trilogy 2


RELEASE NOTES 

VERSION 1.5.2

- Added support for Xplosiv.net version of "House of the Dead 2".

VERSION 1.5.1

- Added support for "Virtua Cop 2" (same as "Virtua Squad 2", but just different enough to need its own fix).
- Added support for a version of "House of the Dead 2" published by Empire Interactive.
- Removed some minor debugging code that I forgot to clean out of version 1.5.


VERSION 1.5

- Added support for multiple PC Monitor light guns using "Raw Input" mechanism in Windows XP.
- Added DirectInputShimConfig.exe utility to facilitate Raw Input Device selection.


HOW TO INSTALL AND USE THIS FIX:

For all games except "Die Hard Trilogy 2", the installation instructions are the same.  Instructions for "Die Hard Trilogy 2" appear further down in this document.

STEP 1:

The games must be configured such that BOTH players are using the KEYBOARD.

For Virtua Squad 2:  Run the game.  Hit F7 to bring up the device selection window.  Make sure both players are set to use the keyboard.  Keep the default key assignments.  Exit the game.

For House of the Dead: Run the game.  Select "Options" from the main menu, then select "Controller Config" from the Options menu.  Make sure Player 1 (1P) is assigned to "Keyboard 1" and Player 2 (2P) is assigned to "Keyboard 2".  Keep the default key assignments.  Exit the game.

For House of the Dead 2:  Run the "House of the Dead 2 Config" program.  Select "Keyboard" for both players.

STEP 2: 

Copy the files "DINPUT.DLL", "DirectInputShim.ini", and "DirectInputShimConfig.exe" into the folder where the game's EXE is installed. 
       
The default folder for Virtua Squad 2 is "C:\SEGA\VCOP2\PROJECT".  
The default folder for House of the Dead is "C:\SEGA\THOTD".
The default folder for House of the Dead 2 is "C:\Program Files\SEGA\The House Of The Dead 2".

WARNING:  Do *NOT* copy "DINPUT.DLL" into your Windows System folder, as this will overwrite the real DirectInput DLL, and you will need to reinstall DirectX.
        
STEP 3: 

Run DirectInputShimConfig.exe, and select the correct game from the drop-down.  If you are running Windows XP, you can select the "Raw Input" mechanism to support two players, then choose from the available mouse devices for each player.  If you are not using Windows XP, then this option is disabled.  When you are finished, click "Save Configuration".
	
STEP 4: 

That's it!  Run the game and calibrate your Act Labs gun(s) as usual.  The game should now work with the gun.


SPECIAL NOTES FOR VIRTUA SQUAD 2/VIRTUA COP 2:

Once you install the fix, you may notice that mouse clicks do not work when you enter the game's pull-down menus.  You can still navigate these menus with the keyboard.


SPECIAL NOTES FOR HOUSE OF THE DEAD:

The "Skeletal Hand" cursor that appears in the menus does not move well with the light gun, but you can move it with the mouse or the arrow keys.  The gun works perfectly within the actual game.



HOW TO INSTALL AND USE THIS FIX FOR "DIE HARD TRILOGY 2":

Die Hard Trilogy 2 receives special treatment because, unlike the other games, this one normally runs directly off the CD.  So by default, it has no application folder in which you can install the Light Gun fix.  So you must create such a folder on the hard drive.

STEP 1:

Create a new folder on your hard drive, for example: "C:\Program Files\Die Hard Trilogy 2".  (I will refer to this as the "Application Folder").

STEP 2:

In Windows Explorer, locate the "Bin" folder on the "Die Hard Trilogy 2" CD-ROM.  Copy the file named "DynaLoad.exe" from the CD onto your hard drive, into the Application Folder you created in Step 1.

STEP 3:

In the Application Folder on your hard drive, right-click on "DynaLoad.exe" and select "Create Shortcut".  This will create a new file called "Shortcut to DynaLoad.exe".  Rename the shortcut to "Die Hard Trilogy 2".

Right-click on the shortcut file, and select "Properties".  In the Properties dialog, set the "Start In" value to the path of the Bin folder on the CD.  For example "D:\Bin".

This shortcut is how you must launch the game.  If you launch the game directly from the CD, the fix will not take effect.

STEP 4:

Copy the three files from this fix ("DINPUT.DLL", "DirectInputShim.ini", "DirectInputShimConfig.exe") into the Application Folder. 

STEP 5:

Run "DirectInputShimConfig.exe" and select "Die Hard Trilogy 2" from the Game drop-down.  Click on "Save Configuration".

STEP 6: 

That's it!  Run the game using the new shortcut, and calibrate the Act Labs gun as usual.  See the next section for special functions (grenades, gun select).


SPECIAL NOTES FOR DIE HARD TRILOGY 2:

Aside from the standard "Fire" and "Reload" buttons, this fix supports the following extra gun functions in "Die Hard Trilogy 2".

GRENADES:  Hold the reload button down while you pull the trigger.  This will set up a line of trajectory.  Let go of the Reload button to throw.

SELECT GUN:  To cycle through available guns, double-click the reload button (or shoot off-screen twice in quick succession).

This fix disables the game's mouse input by default.  If you want to use the mouse in the other game modes (3rd Person Action, or Extreme Driving), you can use the F12 key to toggle the fix on and off during the game.


HOW THIS FIX WORKS:
-------------------

The fix works by installing itself as a shim in between the game and the DirectInput API.  When an application or game loads a DLL, Windows searches for that DLL in a number of places.  The first place it looks is in the application folder (along side the EXE).  This is what allows the "fake" DINPUT.DLL provided in this fix to get loaded by the game.  The fake DLL in turn loads the real DINPUT.DLL (which it assumes is in the Windows system folder).

The fake DINPUT.DLL contains wrappers around the standard system Keyboard and Mouse devices.  When the game requests the Keyboard or Mouse devices, the corresponding wrapper classes are supplied instead.  The wrapper classes can therefore intercept calls to GetDeviceState, allowing them to cancel, modify, or inject fake events into the game's input.

But this only solves half the problem.  Even though we now have total control over the game's input, we still have to find a way to make the game work with absolute mouse coordinates instead or relative ones.  And thanks to some rather careful reverse-engineering, debugging, and memory-searching, we now know the location in memory where each game stores its X and Y coordinates for both players' gun sights.  These addresses are stored in the INI file.  (Except for Die Hard Trilogy 2, whose gun coordinate variables are never at the same fixed address, so they must be located programmatically.  This is handled in the DLL.)

So, when a player fires the light gun at the screen, the absolute mouse position is recorded, computed to the scale of the game's internal coordinate system, and plugged into the game's internal variables.  This moves the gun sight to the desired location.  Then, a keystroke corresponding to the player's "fire" key is injected by the fake Keyboard device.  And voila!  The shot is fired and goes exactly where it was intended.

This fix supports the Act Labs two-player TV guns by checking which mouse button was clicked.  If button 0, then the shot goes to player 1.  If button 2, then the shot goes to player 2.  Buttons 1 and 3 are mapped to each player's "reload" key.


THE INI FILE
------------

DirectInputShim.ini contains a number of variables that are used by the fix.  The default values should be fine, and should not be tampered with.

The variables are as follows:

[General]
UseConfig=XXXXXXX	This tells the DLL which game variables to use.
Player1Device=		The name of the input device to be used for player 1, in "raw input" mode.
Player2Device=		The name of the input device to be used for player 2, in "raw input" mode.

[XXXXXXX]
NumPlayers=		Number of players supported by the game. (1 or 2)
WindowClass=		The window class of the game's main window.
WindowTitle=		The title of the game's main window.
Player1GunX=		The address of the game's internal variable for player 1's X coordinate.
Player1GunY=		The address of the game's internal variable for player 1's Y coordinate.
Player1Trigger=		The scan code for player 1's selected key for "fire".
Player1Reload=		The scan code for player 1's selected key for "reload".
Player1Start=		The scan code for player 1's start key.
Player1Extra1=		The scan code of the key to be simulated when player 1 holds down the reload button while firing.
Player1Extra2=		The scan code of the key to be simulated when player 1 reloads twice in quick succession.
Player1RemapStart=	The scan code for the new key to be mapped to player 1's start key.
Player2GunX=		The address of the game's internal variable for player 2's X coordinate.
Player2GunY=		The address of the game's internal variable for player 2's Y coordinate.
Player2Trigger=		The scan code for player 2's selected key for "fire".
Player2Reload=		The scan code for player 2's selected key for "reload".
Player2Extra1=		The scan code of the key to be simulated when player 2 holds down the reload button while firing.
Player2Extra2=		The scan code of the key to be simulated when player 2 reloads twice in quick succession.
Player2Start=		The scan code for player 2's start key.
Player2RemapStart=	The scan code for the new key to be mapped to player 2's start key.
ScaleWidth=		The number of horizontal units in the game's coordinate system.
ScaleHeight=		The number of vertical units in the game's coordinate system.
ScaleOffsetX=		The horizontal position of the game's virtual "origin".
ScaleOffsetY=		The vertical position of the game's virtual "origin".
DataType=		The data type of the game's internal variables.
Player1HideGunSight=	Option: 1=Hide Player 1's gun sight between shots.  0=Leave it on screen. (default 1)
Player2HideGunSight=	Option: 1=Hide Player 2's gun sight between shots.  0=Leave it on screen. (default 1)
Player1AutoReload=	Option: 1=Automatically reload after every shot (Player 1). 0=No auto reload. (default 0)
Player2AutoReload=	Option: 1=Automatically reload after every shot (Player 2). 0=No auto reload. (default 0)
CancelMouseMove=	Option: 1=Prevent the game from receiving mouse movements. (default 1)
CancelMouseButtons=	Option: 1=Prevent the game from receiving mouse clicks. (default 1)


COMPATIBILITY WITH INTERNATIONAL OR PATCHED VERSIONS OF GAMES
-------------------------------------------------------------

This fix was written to support the retail versions of these games, as I obtained them here in the United States.  There may be slightly different versions of these games released elsewhere in the world, or by different publishers.  There may also exist patches for some of games which include updated EXE files.

This fix may not immediately work with some versions, because the games' internal memory addresses for the gun coordinates may be different (as is the case between Virtua Squad 2 and Virtua Cop 2).  It should be relatively easy to add new configurations to the INI file that allow this fix to work with other versions.  Should this be desired, please contact me via the Act Labs forums for more information.

- Jon Lunman



LEGAL STUFF
-----------

This fix is provided as-is, and is not officially supported by anyone.  Neither Act Labs nor I make any guarantees regarding its effectiveness.  Neither Act Labs nor I are responsible for anything bad that results from using or misusing it.  I am not in any way affiliated with Act Labs.  I just like their products.  :-)

"ACT LABS" is a trademark of ACT LABS, Ltd.  "House of the Dead", "House of the Dead 2", "Virtua Cop 2", and "Virtua Squad 2" are registered trademarks of Sega Corporation.  "Die Hard Trilogy 2" is a trademark of Twentieth Century Fox Film Corporation.  "Windows" is a registered trademark of Microsoft Corporation.
