Skip to content

mostafahussein/DisplayOrientationFix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DisplayOrientationFix

An ASI plugin that fixes crashes and display issues in legacy Direct3D9 games on devices with non-default display orientations - such as the Lenovo Legion Go, Steam Deck, ROG Ally, GPD Win, Ayaneo, and others - where the Windows display orientation differs from the default.

How It Works

This plugin intercepts the display enumeration APIs and presents a normalized "default" view to the game. The OS rotation is left completely untouched - the game simply never sees it.

Hooked APIs:

  • EnumDisplaySettingsA / EnumDisplaySettingsW
  • EnumDisplaySettingsExA / EnumDisplaySettingsExW
  • GetSystemMetrics (SM_CXSCREEN / SM_CYSCREEN)
  • IDirect3D9::GetAdapterDisplayMode
  • IDirect3D9::EnumAdapterModes

Requirements

  • A Direct3D9 game (most PC games from ~2002–2012)
  • Ultimate ASI Loader - download the x86 version, rename to dinput8.dll, place in the game folder

Note: If you already have a ThirteenAG Widescreen Fix installed for the game, you already have the ASI Loader - skip straight to installation.


Installation

  1. Download DisplayOrientationFix.asi and DisplayOrientationFix.ini from the Releases page.
  2. Copy both files into the scripts folder inside your game directory (create it if it doesn't exist).
  3. Make sure dinput8.dll (Ultimate ASI Loader) is in the game's root folder.
  4. Launch the game normally — no need to change display orientation.
YourGame/
├── game.exe
├── dinput8.dll                         (Ultimate ASI Loader)
└── scripts/
    ├── DisplayOrientationFix.asi       ← this plugin
    └── DisplayOrientationFix.ini       ← configuration

Tested Games

Game Status Device OS Orientation Notes
Need for Speed: Underground ✅ Working Lenovo Legion Go Windows 11 Landscape (flipped) Fixes startup crash before EA logo

Expected to Work (same engine / D3D9, untested)

These games have been reported to crash on handheld displays (#1421, #1449):

  • Need for Speed: Most Wanted (2005) - reported crashing on Steam Deck
  • Need for Speed: Carbon - reported crashing on Steam Deck

Configuration

Edit DisplayOrientationFix.ini:

Setting Default Description
NormalizeDisplayOrientation 1 Enable/disable the fix
EnableLog 0 Write debug info to DisplayOrientationFix.log

Troubleshooting

Game still crashes:

  1. Set EnableLog = 1 in the INI
  2. Try launching again
  3. Check DisplayOrientationFix.log in the scripts folder
  4. Open an issue with the log contents and game name

Plugin not loading:

  • Make sure dinput8.dll (Ultimate ASI Loader) is in the game folder (next to the game exe, not inside scripts)
  • Make sure you have the x86 (32-bit) version of the ASI Loader, not x64
  • Make sure the .asi file is inside the scripts folder

Building From Source

Quick build (one command)

MSYS2 MINGW32 on Windows:

g++ -shared -static -O2 -s -o DisplayOrientationFix.asi dllmain.cpp -ld3d9

Linux cross-compilation:

i686-w64-mingw32-g++ -shared -static -O2 -s -o DisplayOrientationFix.asi dllmain.cpp -ld3d9

Credits

License

MIT

About

ASI plugin that fixes crashes in legacy D3D9 games caused by non-default Windows display orientations on handheld PCs (Legion Go, Steam Deck, ROG Ally, GPD Win)

Topics

Resources

License

Stars

Watchers

Forks

Contributors