MH2EyeTurn v3.0 - PS2/PSP title screen eye turns for Manhunt 2 PC
==================================================================
by adam13 - dixmor-hospital.com

On the PS2 and PSP versions of Manhunt 2, holding a shoulder button makes the
menu background look left or right - the big eye on the title screen slides
over, with its layers moving at different depths. The PC version still
contains the code for this, but nothing in the PC game ever triggers it. This
mod hooks it back up to keyboard and mouse, plus controller bindings for
players using the XInput (HybridInput) controller mod (Credits to its original creator).

Features
--------
- Eye pan (the console feature): uses the game's own pan code, driven exactly
  like the PS2 version (read from the PS2 executable, SLUS_216.13):
  hold right = look right, hold left = look left, let go = back to centre.
  Same distance, same speed, same layer depth (parallax) as the console.
- Only the background moves - the logo, "press enter" and menu text stay
  still, like the consoles (can be changed).
- Pupil glance (extra): pick which way the eye's pupil looks by hand.
- Everything is configurable in MH2EyeTurn.ini.

Default controls
----------------
                     Keyboard     Controller (needs XInput/HybridInput mod)
  Look left          Q            LB
  Look right         E            RB
  Pupil look left    Z            D-pad left
  Pupil look right   C            D-pad right

Requirements
------------
- Manhunt 2 PC
- An ASI loader (for example Ultimate ASI Loader as d3d9.dll or
  dinput8.dll). Most Manhunt 2 mod setups already have one.
- For controller play: the XInput (HybridInput) mod. Controller support in
  Manhunt 2 PC comes from that mod, not from MH2EyeTurn; MH2EyeTurn only adds
  bindings for it.

Install
-------
1. Copy both files from "Game files" next to Manhunt2.exe or in a mods directory:
     MH2EyeTurn.asi
     MH2EyeTurn.ini
2. Start the game, go to the title screen and hold Q / E (or LB / RB).

Uninstall: delete MH2EyeTurn.asi, MH2EyeTurn.ini and MH2EyeTurn.log.

Updating from v2.x: the pan settings were renamed. Delete your old
MH2EyeTurn.ini (or replace it with the new one) to get the new options.

Configuration (MH2EyeTurn.ini)
------------------------------
Edit the file and restart the game. Delete it to restore the defaults
(a fresh one is written on the next launch).

[Pan]
  KeyLeft / KeyRight   Keyboard or mouse bindings
  PadLeft / PadRight   Controller bindings (XInput/HybridInput mod)
  Mode                 Return = PS2/PSP behaviour (back to centre on release)
                       Hold   = stays where you let go
  Distance             How far it looks each way (0.25 = console value)
  SpeedScale           Movement speed (1.0 = console speed)
  Invert               Swap left/right
  AnalogRightStick     Right stick as analog control (tilt = how far)
  TitleScreenOnly      0 = every menu with a layered background (like the
                       PS2 code), 1 = title screen only
  MoveMenuText         0 = only the background moves, 1 = text moves too

[Pupil]
  KeyLeft / KeyRight / PadLeft / PadRight   Bindings
  IdleTimeout          Seconds before the pupil goes back to glancing on its own
  RandomGlance         0 = pupil stays where you left it
  GlanceMinSeconds / GlanceMaxSeconds       Random glance interval

[General]
  RequireFocus         Ignore input while the game window isn't focused
  StickDeadzone        Deadzone for stick bindings (0.0 - 1.0)
  Log                  Write MH2EyeTurn.log next to the game

Binding names
  Keyboard/mouse: A-Z, 0-9, F1-F24, LEFT RIGHT UP DOWN, SPACE TAB ENTER,
    SHIFT CTRL ALT (+ L/R versions), INSERT DELETE HOME END PAGEUP PAGEDOWN,
    NUMPAD0-NUMPAD9, COMMA PERIOD MINUS PLUS LBRACKET RBRACKET,
    MOUSE1-MOUSE5 (MOUSE4/5 = side buttons), or a raw key code like 0x51.
  Controller: LB RB (L1 R1), LT RT (L2 R2), A B X Y, DPAD_LEFT DPAD_RIGHT
    DPAD_UP DPAD_DOWN, START BACK, LS RS (stick clicks),
    LSTICK_LEFT LSTICK_RIGHT RSTICK_LEFT RSTICK_RIGHT.
  Up to 4 per action, comma separated:  KeyLeft = Q, MOUSE4
  NONE = unbound.

Troubleshooting
---------------
Check MH2EyeTurn.log next to Manhunt2.exe. A working install shows:
  [EyeTurn] MH2EyeTurn v3.0 by adam13 (dixmor-hospital.com) loaded
  [EyeTurn] Pupil hook installed
  [EyeTurn] Pan hook installed (console pan, PS2 speed)
- No log at all: the ASI loader isn't loading .asi files.
- "skipped" lines: your Manhunt2.exe is a different build; the mod checks
  the game code first and leaves it alone instead of crashing.

Credits
-------
Mod by adam13. Released on dixmor-hospital.com.

AI disclosure
-------------
This mod was made with the help of AI tools. The reverse engineering of the
PC and PS2 executables, the code, the build scripts and this README were
produced with AI assistance, directed and tested in-game by adam13.

Source code
-----------
The "Source" folder has the full source (one file, no dependencies) and
two build scripts (only needed if you want to compile it yourself):
  build.bat        Windows, Visual Studio with C++ tools
  build_clang.sh   Linux/macOS cross-build with LLVM (clang-cl + lld-link)

How it works (addresses are for the exe above, base 0x400000):
- The console pan still ships in the PC exe. Each layered menu background
  has a current pan (bg+0x194) and a target (bg+0x198). Its draw function
  (vtable 0x664524 [3] = 0x550F70) moves the pan toward the target and offsets
  the layers by pan x 0.7 / 0.9 / 1.8; the eye follows the first layer.
  The page methods that set the target (+0.25, -0.25, 0) are never called on PC.
- On PS2 (SLUS_216.13) the frontend input code calls them every frame:
  R1 held -> +0.25, else L1 held -> -0.25, else 0. The pan moves 0.04 per
  frame at 30 fps.
- MH2EyeTurn does the same from your bindings and moves the pan at the same
  speed, scaled to real time so it isn't twice as fast at 60 fps.
- Pupil: hooks neo::EyeLayerInset (vtable 0x662F1C [2] = 0x53D370) and picks
  which of the eye texture's 4 frames is shown.
- Every hook verifies the original game code before patching.
