hlfix - run WON Half-Life (hl.exe 1.1.x) natively on Windows 10/11
=====================================================================

INSTALL
  Copy ddraw.dll and hlfix.ini into the Half-Life folder (next to hl.exe).
  Start the game as usual. To uninstall, delete the two files.

  Remove any -window / -windowed / -width / -height / -w / -h switches from
  your shortcuts and .bat files; hlfix sets the window mode and resolution
  itself. (See "launcher command line bug" below for why they cause trouble.)

  If you previously set "Override high DPI scaling" or other compatibility
  options on hl.exe's Properties > Compatibility tab, turn them off.

WHAT IT FIXES
  1. Display scaling. hl.exe is not DPI aware, so at 125%/150%/... Windows
     virtualises it: the window is blown up and blurred, and the fullscreen
     window ends up the wrong size. That is why the window size had to be
     "resolution / scaling". hlfix declares the process DPI aware, so the
     game sees real pixels.

  2. No native resolutions. The launcher builds its OpenGL / windowed mode
     list from a hard-coded table of 8 sizes inside hl.exe (your hl.exe has
     been hex-edited to change them, which hl.exe.bak shows). hlfix replaces
     that table at runtime with every resolution your monitor reports, and
     always includes native. It applies to OpenGL fullscreen too, so
     widescreen fullscreen works now.

  3. Large resolutions silently rejected. The launcher caps the engine heap
     at 40MB and drops any mode whose framebuffer + surface cache would not
     leave 8MB free, which excludes 2560x1440 and up. hlfix raises the cap to
     128MB (HeapSizeKB).

  4. Title bar / taskbar (what the AutoHotkey script and hiding the taskbar
     did). In the default borderless mode the game window has no border and
     covers the whole monitor, so Windows treats it as fullscreen and the
     taskbar gets out of the way. There are no display mode switches, so
     alt-tab is instant. If the game or the 640x480 launcher menu is smaller
     than the screen, it is centred on black, kept above the taskbar while
     Half-Life is the active app, and released when you alt-tab away.

  5. Real fullscreen (WindowMode=fullscreen): 16-bit mode switches (emulated
     on Windows 10/11) are raised to 32-bit, and the desktop refresh rate is
     kept instead of dropping to 60Hz.

  6. Widescreen FOV. default_fov is applied across the whole screen width,
     so on 16:9 the standard 90 cuts off the top and bottom of the view.
     hlfix works out the matching FOV for your aspect ratio (106 at 16:9)
     and passes it as +default_fov, which overrides the "default_fov 115" in
     your valve/autoexec.cfg. Set Fov=off to keep your own value, or Fov=110
     etc. for a fixed one. CS and TFC clients in this install don't have the
     default_fov cvar, so it does nothing there.

  No game files are modified. Everything happens in memory, and the in-memory
  code patches only apply if the bytes match this hl.exe build. hl.exe and
  hl.exe.bak are both recognised.

LAUNCHER COMMAND LINE BUG (good to know)
  hl.exe finds switches with a plain substring search over the whole command
  line, so "-w" matches inside "-window" and "-h" matches inside "-heapsize",
  and the following word is read as the width/height. For example,
  "hl.exe -window -dev" asks for a width of 0, and the launcher falls back to
  the smallest mode.

SETTINGS
  See hlfix.ini; every option is documented there. The ones you might change:
    WindowMode = borderless | fullscreen | windowed | default
    Resolution = native | 2560x1440 | game  (game = use the in-game choice)
    Fov        = auto | off | 110
    FovBase    = 90  (the 4:3 FOV to match; raise for a wider view)

LIMITS
  - The launcher's own menus are fixed 640x480 dialogs. In borderless mode
    they are shown centred on a black screen (in fullscreen mode the launcher
    switches the display to 640x480 for them, as it always has).
  - Software and Direct3D renderers aren't covered; use OpenGL. In software
    mode the mode list is limited to 1600x1200.
  - hlfix.log (Log=1) records what happened on the last run. Send it over if
    something looks wrong.

BUILDING
  Source is hlfix.c with build.sh (i686-w64-mingw32-gcc). The DLL is a
  proxy: everything DirectDraw is forwarded to the system ddraw.dll.
