Advertisement
DuskDegree9667

Baldur's Gate Enhanced Edition Full Screen Winded Mode Fix for Windows 11

Jan 23rd, 2025
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Persistent  ; Keep the script running
  2.  
  3. ; Check every second if Baldur.exe is still running
  4. SetTimer, CheckProcess, 5000
  5.  
  6. SetTitleMatchMode, 2  ; Set matching mode for window titles
  7. SetTimer, CheckGameWindow, 1000  ; Check every second
  8. return
  9.  
  10. CheckGameWindow:
  11.    ; Look for the game window by its class name
  12.     IfWinExist, ahk_class SDL_app ; SDL_app is the window class for Baldur.exe
  13.     {
  14.         ; Get the window's handle
  15.         WinGet, gameWindow, ID, ahk_class SDL_app
  16.        
  17.         ; Get the process name for the window (i.e., executable name)
  18.         WinGet, ProcessName, ProcessName, ahk_id %gameWindow%
  19.        
  20.         ; Only proceed if the executable is Baldur.exe
  21.         If (ProcessName = "Baldur.exe")
  22.         {
  23.             ; Remove the title bar and borders to make it borderless
  24.             WinSet, Style, -0xC00000, ahk_id %gameWindow%
  25.            
  26.             ; Get the screen dimensions of the primary monitor
  27.             ScreenWidth := A_ScreenWidth
  28.             ScreenHeight := A_ScreenHeight
  29.  
  30.             ; Move the top-left corner of the window for Baldur's Gate to X=-7,Y=-7 and make it take up the entire screen space of the primary 1440p monitor
  31.  
  32.           ; WinMove,    WinTitle,          , WinText (Blank),   X Position,     Y Position,     Screen Width+Offset,    Screen Height+Offset
  33.             WinMove,    ahk_id %gameWindow%,                ,   -7,             -7,             2560+14,                1440+14
  34.            
  35.             ; For some reason the WinMove function causes the window for Baldur.exe to be rendered with 7 pixels of empty space on all sides.
  36.             ; Adding 14 pixels to the screen width and height and then setting an offset of -7 pixels solves this issue on my screen.
  37.             ; You may need to find different values for these.
  38.         }
  39.     }
  40. return
  41.  
  42. CheckProcess:
  43.    ; Check if Baldur's Gate: Enhanced Edition is still running
  44.     if !ProcessExist("Baldur.exe") {
  45.         ExitApp  ; Terminate the script if Baldur.exe is not running
  46.     }
  47. Return
  48.  
  49. ; Function to check if a process is running
  50. ProcessExist(ProcessName) {
  51.     Process, Exist, %ProcessName%
  52.     return ErrorLevel  ; Returns non-zero if process exists
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement