FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    1. Home
    2. IO_Nox
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 16
    • Groups 0

    IO_Nox

    @IO_Nox

    11
    Reputation
    4
    Profile views
    16
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    IO_Nox Unfollow Follow

    Best posts made by IO_Nox

    • RE: [Guide] : fake-fullscreen and optimisation

      New script revision

      I tried to localize all variable you need to set manually in the begining.
      Threads count is now AHK work!
      This is 2 in 1 script.
      (May be one day I will do 3 in 1 for any map editor... but now I think it will work if you change all FAF Client staff to your Map Editor staff)

      My steam shortcut simply runs script

      [{000214A0-0000-0000-C000-000000000046}]
      Prop3=19,9
      [InternetShortcut]
      IDList=
      IconIndex=0
      URL=file:///D:/Program%20Files/SC%20FAF%20borderleess.ahk
      IconFile=D:\Steam\steam\games\540979be595a41206b56a2e427c29dce1c212ad2.ico
      HotKey=0
      

      My faf client shortcut runs SAME script with command line parameter faf
      Object value is:
      "D:\Program Files\SC FAF borderleess.ahk" faf

      ![faf shortcut Properties img](a181882b-4a64-4edf-8849-966746c95b13-image.png image url)

      One Script to run them all!

      if I

      • run it with command line parameter faf (no matter file name) or
      • rename script file into FAF borderleess.ahk
        it will run FAF Client
      • else it will run game from steam (if file name NOT starts with "faf").

      Note:
      If file name starts from FAF it will allways run FAF, so you can have 2 copies like "faf script.ahk" and "sc script.ahk" to run game if you don't want to use command line parameter:

      • "faf script.ahk" will run only multiplayer, and
      • "sc script.ahk" will run singleplayer by default and multiplayer if called with parameter faf

      Problem:
      "D:\Program Files\Downlord's FAF Client\downlords-faf-client.exe" is not starting client... but "downlords-faf-client.exe" works fine (if script is in faf client's dir)...
      so i am calling this script from fake faf shortcut to call another faf client shortcut from it...
      Interesting thing is that AHK tells me "File exists" if I'm giving it my full path... but can't run it...

      About runnig game with command line args:
      AHK can do it, but some trying, AHK docks reading and googlesearching may be needed. I left some tips in code as comments, maybe it will be helpfull.

      File D:\Program Files\SC FAF borderleess.ahk:

      #NoEnv
      SendMode Input
      SetWorkingDir %A_ScriptDir%
      #Persistent
      
      
      ; all personal variables are here
      
      ; move the window to 0,0 and resize it to fit across 1 or 2 monitors
      moveX := 0
      moveY := 0
      width := 1920
      height := 1080
      
      ; single player game link from steam or normal file path
      pathOrLinkGame := "steam://rungameid/9420"
      
      ; multiplayer client path
      pathOrLinkClient := "D:\Program Files\downlords-faf-client.lnk"
      
      ; problem:
      ; "D:\Program Files\Downlord's FAF Client\downlords-faf-client.exe"
      ; is not starting client... but "downlords-faf-client.exe" works...
      ; but then this script must be in faf client dir...
      ; so i am calling this script from shortcut to call faf shortcut from it...
      
      ; if you run game with command line parameters add them in path string,
      ; for example path := "C:\Program Files\Notepad++\notepad++.exe --help"
      ; works fine, note: in *.lnk Object string works like 
      ; "my.exe" myArg1
      ; but here it will be like path := "my.exe myArg1"
      ; Some tips from AHK docks:
      ; If path/link string contains any commas, they must be escaped 
      ; as shown three times in the following example:
      ; Run rundll32.exe shell32.dll`,Control_RunDLL desk.cpl`,`, 3  
      ; It opens Control Panel > Display Properties > Settings
      ; To include an actual quote character inside a quoted string,
      ; specify two consecutive quotes as shown twice in this example: 
      ; "She said, ""An apple a day.""".
      
      ; usually you don't need to cheange anythig else bellow
      ; you can uncomment DEBUG MESSAGE STRING bellow
      ; to check how script have autoset some variables
      
      
      ; process (*.exe) names for game and faf client
      procSingleplayer := "SupremeCommander.exe"
      procMultiplayer := "ForgedAlliance.exe" 
      procClient := "downlords-faf-client.exe"
      
      
      ; this will automatically find your processor threads count
      EnvGet, ProcessorCount, NUMBER_OF_PROCESSORS
      
      
      singlePlayer := true
      ; true to run singleplayer game
      ; false to run multiplayer faf-client
      ; script will try to detect it automatically
      
      ; get command line first agrument
      firstArg := A_Args[1]
      StringLower, lowerCaseFirstArg, firstArg
      
      ; get first 3 lettest of this script file name
      first3chars := SubStr(A_ScriptName, 1, 3)
      StringLower, lowerCaseFirst3chars, first3chars
      
      ; it will set singlePlayer to false in 2 cases:
      ; case 1:
      ;	script runs with command line argument "faf" or "FAF"
      ;	for example Object field in *.lnk:
      ;	"D:\Program Files\SC FAF borderleess.ahk" faf
      ; case 2:
      ;	file name of this script starts with "FAF..." or "faf.."
      ;	for example: "D:\Program Files\FAF borderleess.ahk"
      
      if(lowerCaseFirstArg = "faf" or lowerCaseFirst3chars = "faf")
      {
      	singlePlayer := false
      }
      ; now "singlePlayer" variable is set
      
      ; process for game
      procGame := singlePlayer ? procSingleplayer : procMultiplayer
      
      
      
      ; DEBUG MESSAGE STRING is bellow, this string is to check if it works right
      ; MsgBox, % ProcessorCount " threads " ( singlePlayer ? "Singleplayer: " : "Multiplayer: " ) procGame
      ; delete ; character to uncomment string above to see info window on script start
      
      
      
      procName := singlePlayer ? procGame : procClient
      procPath := singlePlayer ? pathOrLinkGame : pathOrLinkClient
      
      
      ; Start game or client and 
      ; wait for process to start, but no more then 120 seconds
      Run, %procPath%
      Process, Wait, %procName%, 120
      procPID := ErrorLevel
      if not procPID
      {
          MsgBox The specified process did not appear.
          ExitApp ; Stop this script
      }
      
      SetTimer, CheckProc, 2000
      
      if(!singlePlayer)
      {
      	; Stop then FAF Client stoped
      	Process, WaitClose, %procClient%
      	ExitApp
      }
      
      
      CheckProc:
          if (!ProcessExist(procGame))
              return
      
          WinGet Style, Style, % "ahk_exe " procGame
          if (Style & 0xC40000)
          {
      		; remove the titlebar and borders
              WinSet, Style, -0xC40000, % "ahk_exe " procGame 
      		; move the window to 0,0 and resize it to fit across 1 or 2 monitors.
              WinMove, % "ahk_exe " procGame , , moveX, moveY, width, height
              WinMaximize, % "ahk_exe " procGame
              WinRestore, % "ahk_exe " procGame
      
              ; set High priority and cores affinity 
              Process, Priority, %procGame%, H
              gamePID := ErrorLevel
              ProcessHandle := DllCall("OpenProcess", "UInt", 0x1F0FFF, "Int", false, "UInt", gamePID)
              DllCall("SetProcessAffinityMask", "UInt", ProcessHandle, "UInt", 2**ProcessorCount - 2 )
      		DllCall("CloseHandle", "UInt", ProcessHandle)
      		
      		; I have 4 threads, so 2**ProcessorCount - 2 will be 2^4 - 2= 16 - 2 = 14
      		; 1110 binary = 14 decimal.
      		; this means CPU 0 unchecked (right most 0 in binary number), 
      		; CPU 1-3 checked (ones in binary number) for 4 threads optimization
              
              if(singlePlayer)
      		{
      			ExitApp  ; Stop this script
      		}
      		else
      		{
      			Process, WaitClose, %procGame%
      		}
          }
      return
      
      ProcessExist(exeName)
      {
         Process, Exist, %exeName%
         return !!ERRORLEVEL
      }
      return
      
      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      Made anower variant of AHK script.
      Using Win 10, AutoHotkey, Steam version of game and Downlord's FAF Client.
      For some reason Steam runs "SupremeCommander.exe", FAF Client runs "ForgedAlliance.exe".

      I made some manipulations to make AHK script

      • stop or pause by itself if game haven't started after 2 minutes or right after script done all things,

      • do things only once on each game start,

      • do nothing then nothing is needed and also

      • run singleplayer from descktop shortcut made by Steam,

      • run multyplayer from descktop shortcut for Downlord's FAF Client.

      Lets start from Steam descktop sortcut:
      Just right click game shortcut , go to Properties and change URL (I had steam://rungameid/9420, we will start it in script) and insert full file path to your script, Save. Old URL insert into script.
      To check it, simply open sortcut in any notepad you have. You will see somethig like that:
      File "Supreme Commander Forged Alliance.url":

      [{000214A0-0000-0000-C000-000000000046}]
      Prop3=19,9
      [InternetShortcut]
      IDList=
      IconIndex=0
      URL=file:///D:/Program%20Files/FAF%20borderleess%20fullscreen%20window.ahk
      IconFile=D:\Steam\steam\games\540979be595a41206b56a2e427c29dce1c212ad2.ico
      HotKey=0
      

      Note: just Ctrl+C -> Ctrl+V full file path, Windows will add "file:///...%20..." staff by itself if done in Properties.

      Next is doing the same for FAF Client:
      Right click this time Downlord's FAF Client sortcut (it is standard *.lnk, no url staff) go to Properties and change Object path from "D:\Program Files\Downlord's FAF Client\downlords-faf-client.exe" to "D:\Program Files\Downlord's FAF Client\FAF borderleess.ahk". Old Object run in script.

      So, it is time for scripts!

      Scrip file "FAF borderleess fullscreen window.ahk" in "D:/Program Files/" directory for singleplayer:

      #NoEnv
      SendMode Input
      SetWorkingDir %A_ScriptDir%
      #Persistent
      
      Run, steam://rungameid/9420
      procName := "SupremeCommander.exe"
      
      Process, Wait, %procName%, 120 ; Waits for process to start, no more then 120 seconds
      NewPID := ErrorLevel
      if not NewPID
      {
          MsgBox The specified process did not appear.
          ExitApp ; Stop this script
      }
      
      SetTimer, CheckProc, 2000
      return
      
      CheckProc:
          if (!ProcessExist(procName))
              return
           
          WinGet Style, Style, % "ahk_exe " procName
          if (Style & 0xC40000)
          {
              WinSet, Style, -0xC40000, % "ahk_exe " procName ; remove the titlebar and border(s)
              WinMove, % "ahk_exe " procName , , 0, 0, 1920, 1080 ; move the window to 0,0 and resize it to fit across 1 or 2 monitors.
              WinMaximize, % "ahk_exe " procName
              WinRestore, % "ahk_exe " procName
      
              ; set High priority and cores affinity 
              Process, Priority, %procName%, H
              ProcessHandle := DllCall("OpenProcess", "UInt", 0x1F0FFF, "Int", false, "UInt", NewPID)
              DllCall("SetProcessAffinityMask", "UInt", ProcessHandle, "UInt", 14 ) ; 1110x2 = 14x10 CPU 0 unchecked, CPU 1-3 checked
              DllCall("CloseHandle", "UInt", ProcessHandle)
      
              ExitApp  ; Stop this script
          }
      return
      
      ProcessExist(exeName)
      {
         Process, Exist, %exeName%
         return !!ERRORLEVEL
      }
      return
      

      This one starts before singleplayer, calls Steam to run the game, waits for game, does borderleess fullscreen and optimisation and stops right after that. No script running while you are playing.

      Scrip file "FAF borderleess.ahk" in "D:\Program Files\Downlord's FAF Client" directory for multyplayer:

      #NoEnv
      SendMode Input
      SetWorkingDir %A_ScriptDir%
      #Persistent
      
      Run, downlords-faf-client.exe
      
      procName := "ForgedAlliance.exe"
      procNameClient := "downlords-faf-client.exe"
      
      Process, Wait, %procNameClient%, 120 ; Waits for process to start, no more then 120 seconds
      NewPID := ErrorLevel
      if not NewPID
      {
          MsgBox The specified process did not appear.
          ExitApp ; Stop this script
      }
      
      SetTimer, CheckProc, 2000
      
      ; Stop then FAF Client stoped
      Process, WaitClose, %procNameClient%
      ExitApp
      
      CheckProc:
          if (!ProcessExist(procName))
              return
      
          WinGet Style, Style, % "ahk_exe " procName
          if (Style & 0xC40000)
          {
              WinSet, Style, -0xC40000, % "ahk_exe " procName ; remove the titlebar and border(s)
              WinMove, % "ahk_exe " procName , , 0, 0, 1920, 1080 ; move the window to 0,0 and resize it to fit across 1 or 2 monitors.
              WinMaximize, % "ahk_exe " procName
              WinRestore, % "ahk_exe " procName
      
              ; set High priority and cores affinity 
              Process, Priority, %procName%, H
              NewPID := ErrorLevel
              ProcessHandle := DllCall("OpenProcess", "UInt", 0x1F0FFF, "Int", false, "UInt", NewPID)
              DllCall("SetProcessAffinityMask", "UInt", ProcessHandle, "UInt", 14 ) ; 1110x2 = 14x10 CPU 0 unchecked, CPU 1-3 checked
              DllCall("CloseHandle", "UInt", ProcessHandle)
      
              Process, WaitClose, %procName%
          }
      return
      
      ProcessExist(exeName)
      {
         Process, Exist, %exeName%
         return !!ERRORLEVEL
      }
      return
      

      This starts before FAF Client and waits for FAF Client to run the game. Script is checking for game in loop every 2 seconds. On every game start it does borderleess fullscreen and optimisation BUT does NOT stop after that. Script pauses the loop while you are playing, but is still running while doing nothing. Then the game is over script will resume the loop to catch your next game start. Once you stops FAF Client, sript will stop automaticully.

      Now :

      • sortcurts will run AHK scripts,

      • scripts will run game in Steam or run FAF Client,

      • scripts do nothing while you are in game

      • you don't need to stop scripts and

      • you can hide script file anywhere (well, for FAF Client better keep it in client's dir, maybe becase of ' in directory name).

      • Oh, and you need only AutoHotkey for this to work.

      If all worked fine you will see in task manager high priority and unchecked first core (CPU 0) affinity for game process, "fake fullscreen mode" in game and no Alt+Tab issues.

      Note:
      In case your taskbar don't want to hide at all (rarely happens when very actively using other soft at game start, so I don't fix it) you may add hotkey or auto hiding like this:

      Process, Wait, %procName%, 120
      NewPID := ErrorLevel
      if not NewPID
      {
          MsgBox The specified process did not appear.
          ExitApp
      }
      ; hide taskbar on process start
      HideShowTaskbar(true)
      
      ; here do anythig like SetTimer, CheckProc, 2000
      
      Process, WaitClose, %procName%
      ; show taskbar on process stop and stop this script
      HideShowTaskbar(false)
      ExitApp
      
      ; set action to true to hide or false to show Taskbar
      HideShowTaskbar(action) {
         static ABM_SETSTATE := 0xA, ABS_AUTOHIDE := 0x1, ABS_ALWAYSONTOP := 0x2
         VarSetCapacity(APPBARDATA, size := 2*A_PtrSize + 2*4 + 16 + A_PtrSize, 0)
         NumPut(size, APPBARDATA), NumPut(WinExist("ahk_class Shell_TrayWnd"), APPBARDATA, A_PtrSize)
         NumPut(action ? ABS_AUTOHIDE : ABS_ALWAYSONTOP, APPBARDATA, size - A_PtrSize)
         DllCall("Shell32\SHAppBarMessage", UInt, ABM_SETSTATE, Ptr, &APPBARDATA)
      }
      
      taskBarIsHidden = false
      ; ["ctrl" + "win" + "z"] hotkey to toggle taskbar
      ; this should be in the end of the script, nothing else worked otherwise...
      ^#z:: HideShowTaskbar(taskBarIsHidden := taskBarIsHidden = true ? false : true)
      
      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      @tatsu

      Not that well it seems)
      Thanks for you comment I reread post and found one significant error:
      It seem I Copy-pasted not the latest version, multipleer script neend one extra line to make it pause the loop
      " Process, WaitClose, %procName%" in the end of "if" section. Without this line script do not pause the loop...

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      One more error fix: in "NewPID" remain procces ID of FAF Client, not the game, so process affinity was set for FAF Client, not for game 😕
      Fixed by adding "NewPID := ErrorLevel" after setting high priority:

      ; set High priority and cores affinity 
              Process, Priority, %procName%, H
              NewPID := ErrorLevel
              ProcessHandle := DllCall("OpenProcess", "UInt", 0x1F0FFF, "Int", false, "UInt", NewPID)
              DllCall("SetProcessAffinityMask", "UInt", ProcessHandle, "UInt", 14 ) ; 1110x2 = 14x10 CPU 0 unchecked, CPU 1-3 checked
              DllCall("CloseHandle", "UInt", ProcessHandle)
              
              Process, WaitClose, %procName%
          }
      

      Hope it was last one...

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      affinity for 16 logical processors

      as @tatsu said 15 ones and last zero may work, by on my 4 threads in win 10 number 1110 have not worked and 14 worked well. So you can try 1111111111111110 and if it is not working here some counting systems math staf:

      • for me 4 threads, so - 1110 in binary is 0 * 2^0 + 1 * 2^1 + 1 * 2^2 + 1 * 2^3 = 0 * 1 + 1 * 2 + 1 * 4 + 1 * 8 = 14 in decimal (normaly used in live)
      • for your 16 threads: 1111111111111110 binary is 65534 in decimal (from some random converter in goole search first page) 3a022b3d-6273-410f-b842-9eb21f045a27-image.png
        so you will have:
      DllCall("SetProcessAffinityMask", "UInt", ProcessHandle, "UInt", 65534 )
      

      It works like you are setting yes/no flags for each CPU: 0 to disable and 1 to anable, and combines result in 1 number. Flag f for CPU-N will be f * 2^N and sum of all flags is your number. Why fist CPU-0 is always last right? It's because in numbers power order is reverted - similar way 65534 in decimal is 4 * 10^0 + 3 * 10^1 + 5 * 10^2 + 5 * 10^3 + 6 * 10^4

      replace "steam://rungameid/9420" in the script with the contents of the Target of the LOUD desktop shortcut ("F:\SteamLibrary\steamapps\common\Supreme Commander Forged Alliance\bin\SupremeCommander.exe" /log "..\logs\Loud.log" /init "..\LOUD\bin\LoudDataPath.lua")?

      Should work I think, thecnicaly it is just link or path to executable file. Where is no tricky symbols in path ""F:\SteamLibrary\steamapps\common\Supreme Commander Forged Alliance\bin\SupremeCommander.exe"
      but I don't know if " /log "..\logs\Loud.log" /init "..\LOUD\bin\LoudDataPath.lua"" additional part will work properly but usually it should work.

      Based on this https://www.autohotkey.com/docs/commands/Run.htm#Remarks
      and this
      https://autohotkey.com/board/topic/9603-run-exe-with-parameters/

      Try somethig like

      Run, "F:\SteamLibrary\steamapps\common\Supreme Commander Forged Alliance\bin\SupremeCommander.exe" /log "..\logs\Loud.log" /init "..\LOUD\bin\LoudDataPath.lua"
      

      or

      Run, "F:\SteamLibrary\steamapps\common\Supreme Commander Forged Alliance\bin\SupremeCommander.exe" log "..\logs\Loud.log"  init "..\LOUD\bin\LoudDataPath.lua"
      

      or

      Run %ComSpec% /c ""F:\SteamLibrary\steamapps\common\Supreme Commander Forged Alliance\bin\SupremeCommander.exe" /log "..\logs\Loud.log" /init "..\LOUD\bin\LoudDataPath.lua""
      

      or anover variation.

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      faster way to get magical number for N threads is
      2^N - 2

      • 2 threads: 4 - 2 = 2
      • 4 threads: 16 - 2 = 14
      • 6 threads: 64 - 2 = 62
      • 8 threads: 256 - 2 = 254
      • 10 threads: 1024 - 2 = 1022
      • 12 threads: 4096 - 2 = 4094
      • 14 threads: 16384 - 2 = 16382
      • 16 threads: 65536 - 2 = 65534
        why: 2^N - 1 in binary will be number of N ones (111...111) we need number lower by 1, so (2^N - 1) - 1 is 11...110
      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      By the way, AHK can make some GUI
      ....so if someone need to run everything from 1 script and/or 1 shortcut it is possible to make interactive window whith buttons or other standard controlles and then run things by "double-click sortcut->see a small dialog window -> press one of buttons or somethig similar -> game started in some way"

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      Resize bug update:

      I replaced normal resizing

      WinMaximize, % "ahk_exe " procGame
      WinRestore, % "ahk_exe " procGame
      

      with perverted one

      WinHide , % "ahk_exe " procGame
      WinMaximize, % "ahk_exe " procGame
      WinRestore, % "ahk_exe " procGame
      WinShow  , % "ahk_exe " procGame
      

      and got somethig new:

      • instead of game window I now have debug log
      • resizing of log window works greate
      • if log window is active I can listen game music and sounds
      • if I can find a way to go back to game window it may fix this bug

      Log here: log.txt
      Снимок экрана (8).png Снимок экрана (9).png

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      Solved my image freze on resizing bug (lost video adapter):
      Moved game to the system disc (C:\ in my case, the game was moved in Steam GUI).
      This solution was found here:
      https://forums.faforever.com/viewtopic.php?f=3&t=18603

      @thecore, the mouse clip (from v 1.04) is broken for a not fullscreen window, maybe a Windows 10 ui scaling involved here - it locks mouse but in the area with lesser width and height then actual window and actual window size is more when what I set it to be in args.

      Here is the working variant for any window size:

      
      if(clipMouse = true)
      {
      	SetTimer, clipProc, 100 
      }
      clipProc: 
      	if (!ProcessExist(procGame)) 
      		return
      	;//checks if the game window is active
      	if !WinActive("ahk_exe " procGame)
      	{
      		return
      	}
      	
      	; this will get your game window size
      	WinGetTitle, winTitle, ahk_exe %procGame%
      	WinGetPos, X, Y, W, H, %winTitle%
      	
      	;//trap mouse
      	ClipCursor( true, X, Y, W, H)
      	
      return
      ; //lock the mouse within the game window
      ClipCursor( Confine=True, x1=0 , y1=0, x2=1, y2=1 ) 
      {
      	VarSetCapacity(R,16,0),  NumPut(x1,&R+0),NumPut(y1,&R+4),NumPut(x2,&R+8),NumPut(y2,&R+12)
      	return Confine ? DllCall( "ClipCursor", UInt,&R ) : DllCall( "ClipCursor" )
      }
      

      full script here (just delete .txt to use it):
      definitiveResizeAndMouseLock.ahk.txt

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      A Little error in full script:
      definitiveResizeAndMouseLock.ahk.txt
      I screwed up at automathic setting for the dual screen size 😉
      was:

      	width_2 := width*2
      	height_2 := height*2
      

      now is good one:

      	width_2 := width*2
      	height_2 := height
      

      Result of the modified definiteve script divide for sortcut proxy:

      • only the mouse lock to reuse with any app
        mouseLock.ahk.txt
      • only the resize hotkeys to reuse with any app
        definitiveResize.ahk.txt

      Full example: Universal Sortcut Parser.rar

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox

    Latest posts made by IO_Nox

    • RE: [Guide] : fake-fullscreen and optimisation

      A Little error in full script:
      definitiveResizeAndMouseLock.ahk.txt
      I screwed up at automathic setting for the dual screen size 😉
      was:

      	width_2 := width*2
      	height_2 := height*2
      

      now is good one:

      	width_2 := width*2
      	height_2 := height
      

      Result of the modified definiteve script divide for sortcut proxy:

      • only the mouse lock to reuse with any app
        mouseLock.ahk.txt
      • only the resize hotkeys to reuse with any app
        definitiveResize.ahk.txt

      Full example: Universal Sortcut Parser.rar

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      Solved my image freze on resizing bug (lost video adapter):
      Moved game to the system disc (C:\ in my case, the game was moved in Steam GUI).
      This solution was found here:
      https://forums.faforever.com/viewtopic.php?f=3&t=18603

      @thecore, the mouse clip (from v 1.04) is broken for a not fullscreen window, maybe a Windows 10 ui scaling involved here - it locks mouse but in the area with lesser width and height then actual window and actual window size is more when what I set it to be in args.

      Here is the working variant for any window size:

      
      if(clipMouse = true)
      {
      	SetTimer, clipProc, 100 
      }
      clipProc: 
      	if (!ProcessExist(procGame)) 
      		return
      	;//checks if the game window is active
      	if !WinActive("ahk_exe " procGame)
      	{
      		return
      	}
      	
      	; this will get your game window size
      	WinGetTitle, winTitle, ahk_exe %procGame%
      	WinGetPos, X, Y, W, H, %winTitle%
      	
      	;//trap mouse
      	ClipCursor( true, X, Y, W, H)
      	
      return
      ; //lock the mouse within the game window
      ClipCursor( Confine=True, x1=0 , y1=0, x2=1, y2=1 ) 
      {
      	VarSetCapacity(R,16,0),  NumPut(x1,&R+0),NumPut(y1,&R+4),NumPut(x2,&R+8),NumPut(y2,&R+12)
      	return Confine ? DllCall( "ClipCursor", UInt,&R ) : DllCall( "ClipCursor" )
      }
      

      full script here (just delete .txt to use it):
      definitiveResizeAndMouseLock.ahk.txt

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      Somehow made both debug and game windows appear at same time:

      • game image frozen on resize
      • debug log on the moment after resize is here:
        WARNING: .\DeviceD3D9.cpp(866) Invalid call
        WARNING: .\DeviceD3D9.cpp(866) Invalid call
        WARNING: Unable to load texture: d:\steam\steamapps\common\supreme commander forged alliance\gamedata\units.scd\units\uel0001\uel0001_albedo.dds
        WARNING: Unable to load texture: d:\steam\steamapps\common\supreme commander forged alliance\gamedata\units.scd\units\uel0001\uel0001_normalsts.dds
        WARNING: Unable to load texture: d:\steam\steamapps\common\supreme commander forged alliance\gamedata\units.scd\units\uel0001\uel0001_specteam.dds
        WARNING: error loading batched texture: .\DeviceD3D9.cpp(779) Not available
        INFO: Unable to load texture from file: /textures/ui/uef/game/drag-handle/drag-handle-ll_btn_over.dds
        WARNING: error loading batched texture: .\DeviceD3D9.cpp(779) Not available
        INFO: Unable to load texture from file: /textures/ui/uef/game/drag-handle/drag-handle-ul_btn_over.dds
        WARNING: error loading batched texture: .\DeviceD3D9.cpp(779) Not available
        INFO: Unable to load texture from file: /textures/ui/common/icons/units/land_over.dds
        WARNING: error loading batched texture: .\DeviceD3D9.cpp(779) Not available
        INFO: Unable to load texture from file: /textures/ui/common/icons/units/amph_over.dds
        WARNING: .\DeviceD3D9.cpp(866) Invalid call
        WARNING: .\DeviceD3D9.cpp(866) Invalid call
        WARNING: unable to lock dynamic texture: Invalid call
        WARNING: Unable to load texture: d:\steam\steamapps\common\supreme commander forged alliance\gamedata\effects.scd\effects\entities\aeonbuildeffect\aeonbuildeffect01_albedo.dds
        WARNING: Unable to load texture: d:\steam\steamapps\common\supreme commander forged alliance\gamedata\effects.scd\effects\entities\aeonbuildeffect\aeonbuildeffect01_normalsts.dds
        WARNING: Unable to load texture: d:\steam\steamapps\common\supreme commander forged alliance\gamedata\effects.scd\effects\entities\aeonbuildeffect\aeonbuildeffect01_specteam.dds
        WARNING: unable to lock dynamic texture: Invalid call
        WARNING: .\DeviceD3D9.cpp(866) Invalid call
        WARNING: .\DeviceD3D9.cpp(866) Invalid call
      • just like changing resolution from game menu it seems game lost traces of my videocard...
      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      Resize bug update:

      I replaced normal resizing

      WinMaximize, % "ahk_exe " procGame
      WinRestore, % "ahk_exe " procGame
      

      with perverted one

      WinHide , % "ahk_exe " procGame
      WinMaximize, % "ahk_exe " procGame
      WinRestore, % "ahk_exe " procGame
      WinShow  , % "ahk_exe " procGame
      

      and got somethig new:

      • instead of game window I now have debug log
      • resizing of log window works greate
      • if log window is active I can listen game music and sounds
      • if I can find a way to go back to game window it may fix this bug

      Log here: log.txt
      Снимок экрана (8).png Снимок экрана (9).png

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      For the shortcut proxy an idea was to make it easier for the end users: no digging insides of any scripts, only giving right parameters and/or simply placing in right places. So technically it is same as using *.bat / *.sh files to call many actions from one duble click.

      Will dig into the my window resizing problem later... it happend once in ladder game in the past, but now I'm thinking it was somehow accidetly cased by random resizing (maybe mouse lock can prevent this).

      One little fix and ctrl+f10 kombo (script stopping) deleted, I think this shold work fine with command line arguments:

      definitive args.ahk.txt

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      @thecore, may I ask If you had issue with game image freezing (but blind play is possible) and/or gray screen on game resize?

      I'm trying to test your 1.04 script modifided for command line arguments usage (may be a little broken in process) on single screen and resizing brakes the game even without any script...

      My current setup is here:
      Universal Sortcut Parser.rar

      01.png 02.png
      Notes:

      • first screensort - playable
      • second - after resize - musick works, mouse clicks works, menu works and units are moving, but image is broken - it is sctatic and you can esily broke game to gray sceen by colapsing and reopening the window, and I can't close the game window in normal way so only task manager helps.
      • Hm, white space at the bottom of the screensort isn't normal, looks like I have properly f*cked up resizing...
      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      Added compiled script (usp.exe) here, but if you want to run AHK scripts(*.ahk) AHK instalation is still needed.

      Universal Sortcut Parser.rar

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      Universal Sortcut Parser
      Version 1.0
      Universal Sortcut Parser.rar

      • Launch multiple applications from one shortcut.
      • Call usp.ahk with launch parameters and it will run sortcuts and scripts for this parameters.

      I tryed to divide command line arguments parsing, app starting and scripts. That way scripst may be more clean and reusable and you can ran many independent scripts and files for each option.
      I haven't compiled it, so AutoHotkey shold be installed.
      So it now works like

      • you call this proxy with command line arguments,
      • proxy launches files, links, scripts with predefined commandline arguments.

      Easiest way to create new option myOpt (if you will call scripts without any args) is to create dirs myOpt in both scripts and shortcuts dirs (or only one of them if you don't care, division of scrips and other files is made for scripts reusage in different options) and place your shortcuts, files and scripts there. And then create shortcut for usp.ahk and add command line argument myOpt in Object value like "usp.ahk" myOpt

      I now have 3 normal sortcuts (.lnk) on desctop for (Object values bellow):

      • Downlord's FAF Client
      "D:\Program Files\Universal Sortcut Parser\usp.ahk" faf
      
      • Supreme Commander Forged Alliance
      "D:\Program Files\Universal Sortcut Parser\usp.ahk" sc
      
      • FAForever Map Editor
      "D:\Program Files\Universal Sortcut Parser\usp.ahk" maps
      

      Note:

      "D:\Program Files\Universal Sortcut Parser\usp.ahk" faf sc maps
      
      • this will call all 3 options at once 🙂

      Options may be written in file and/or inerpreted from file names: files (and all files in folders) named for option in shortcuts and scripts folders will be called.

      Example for options.txt:

      test script blank testArg1 arg2
      test run C:\Program Files\Notepad++\notepad++.exe --help
      
      faf file D:\Program Files\Downlord's FAF Client\downlords-faf-client.exe
      faf script borderlessOptimisation ForgedAlliance.exe downlords-faf-client.exe
      
      
      sc run steam://rungameid/9420
      sc script borderlessOptimisation SupremeCommander.exe -
      
      maps file D:\Program Files\fafmapeditor_alpha_v0704_WIP1\FAForeverMapEditor.exe
      maps script borderlessOptimisation ForgedAlliance.exe FAForeverMapEditor.exe
      

      About options in file:

      • file will test if file (or dir) exsists and call it (or all files in dir),
      • run will just call anything, USE IT to call files with command line arguments,
      • scripts will search for all matching files and folders in scripts folder and can run them with normal and "additional" command line arguments.

      Note:

      • base script name can't contain spaces because spaces are dividers in string parsing, but it does not mater for files in folders.

      For example I have adapted my old script and placed it in
      scripts/borderlessOptimisation 0 0 1920 1080 folder and I'm calling it for sc option by string

      sc script borderlessOptimisation SupremeCommander.exe -
      

      This means that in scripts folder will be called all files named like borderlessOptimisation.exe, borderlessOptimisation second file.ahk, etc. and all files in directories named like borderlessOptimisation and borderlessOptimisation more args.
      If I have borderlessOptimisation second file.ahk it will be called with 2 args SupremeCommander.exe - (game and client proccees names for my script, "-" as second arg is to make it run normally if more args are added later).
      I have SC FAF borderleess ARGS.ahk in folder named borderlessOptimisation 0 0 1920 1080 so it will be called with 4 more args (6 args total), same as

      sc run scripts/borderlessOptimisation 0 0 1920 1080/SC FAF borderleess ARGS.ahk SupremeCommander.exe - 0 0 1920 1080
      

      and same may be done by copy-pasting original Supreme Commander Forged Alliance.lnk shortcut to shortcuts dir and remnaming it into "sc borderlessOptimisation SupremeCommander.exe -.lnk" or just placing shortcut in folder named this way.

      Read README.txt for more understending about the naming and some other things.

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      By the way, AHK can make some GUI
      ....so if someone need to run everything from 1 script and/or 1 shortcut it is possible to make interactive window whith buttons or other standard controlles and then run things by "double-click sortcut->see a small dialog window -> press one of buttons or somethig similar -> game started in some way"

      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox
    • RE: [Guide] : fake-fullscreen and optimisation

      New script revision

      I tried to localize all variable you need to set manually in the begining.
      Threads count is now AHK work!
      This is 2 in 1 script.
      (May be one day I will do 3 in 1 for any map editor... but now I think it will work if you change all FAF Client staff to your Map Editor staff)

      My steam shortcut simply runs script

      [{000214A0-0000-0000-C000-000000000046}]
      Prop3=19,9
      [InternetShortcut]
      IDList=
      IconIndex=0
      URL=file:///D:/Program%20Files/SC%20FAF%20borderleess.ahk
      IconFile=D:\Steam\steam\games\540979be595a41206b56a2e427c29dce1c212ad2.ico
      HotKey=0
      

      My faf client shortcut runs SAME script with command line parameter faf
      Object value is:
      "D:\Program Files\SC FAF borderleess.ahk" faf

      ![faf shortcut Properties img](a181882b-4a64-4edf-8849-966746c95b13-image.png image url)

      One Script to run them all!

      if I

      • run it with command line parameter faf (no matter file name) or
      • rename script file into FAF borderleess.ahk
        it will run FAF Client
      • else it will run game from steam (if file name NOT starts with "faf").

      Note:
      If file name starts from FAF it will allways run FAF, so you can have 2 copies like "faf script.ahk" and "sc script.ahk" to run game if you don't want to use command line parameter:

      • "faf script.ahk" will run only multiplayer, and
      • "sc script.ahk" will run singleplayer by default and multiplayer if called with parameter faf

      Problem:
      "D:\Program Files\Downlord's FAF Client\downlords-faf-client.exe" is not starting client... but "downlords-faf-client.exe" works fine (if script is in faf client's dir)...
      so i am calling this script from fake faf shortcut to call another faf client shortcut from it...
      Interesting thing is that AHK tells me "File exists" if I'm giving it my full path... but can't run it...

      About runnig game with command line args:
      AHK can do it, but some trying, AHK docks reading and googlesearching may be needed. I left some tips in code as comments, maybe it will be helpfull.

      File D:\Program Files\SC FAF borderleess.ahk:

      #NoEnv
      SendMode Input
      SetWorkingDir %A_ScriptDir%
      #Persistent
      
      
      ; all personal variables are here
      
      ; move the window to 0,0 and resize it to fit across 1 or 2 monitors
      moveX := 0
      moveY := 0
      width := 1920
      height := 1080
      
      ; single player game link from steam or normal file path
      pathOrLinkGame := "steam://rungameid/9420"
      
      ; multiplayer client path
      pathOrLinkClient := "D:\Program Files\downlords-faf-client.lnk"
      
      ; problem:
      ; "D:\Program Files\Downlord's FAF Client\downlords-faf-client.exe"
      ; is not starting client... but "downlords-faf-client.exe" works...
      ; but then this script must be in faf client dir...
      ; so i am calling this script from shortcut to call faf shortcut from it...
      
      ; if you run game with command line parameters add them in path string,
      ; for example path := "C:\Program Files\Notepad++\notepad++.exe --help"
      ; works fine, note: in *.lnk Object string works like 
      ; "my.exe" myArg1
      ; but here it will be like path := "my.exe myArg1"
      ; Some tips from AHK docks:
      ; If path/link string contains any commas, they must be escaped 
      ; as shown three times in the following example:
      ; Run rundll32.exe shell32.dll`,Control_RunDLL desk.cpl`,`, 3  
      ; It opens Control Panel > Display Properties > Settings
      ; To include an actual quote character inside a quoted string,
      ; specify two consecutive quotes as shown twice in this example: 
      ; "She said, ""An apple a day.""".
      
      ; usually you don't need to cheange anythig else bellow
      ; you can uncomment DEBUG MESSAGE STRING bellow
      ; to check how script have autoset some variables
      
      
      ; process (*.exe) names for game and faf client
      procSingleplayer := "SupremeCommander.exe"
      procMultiplayer := "ForgedAlliance.exe" 
      procClient := "downlords-faf-client.exe"
      
      
      ; this will automatically find your processor threads count
      EnvGet, ProcessorCount, NUMBER_OF_PROCESSORS
      
      
      singlePlayer := true
      ; true to run singleplayer game
      ; false to run multiplayer faf-client
      ; script will try to detect it automatically
      
      ; get command line first agrument
      firstArg := A_Args[1]
      StringLower, lowerCaseFirstArg, firstArg
      
      ; get first 3 lettest of this script file name
      first3chars := SubStr(A_ScriptName, 1, 3)
      StringLower, lowerCaseFirst3chars, first3chars
      
      ; it will set singlePlayer to false in 2 cases:
      ; case 1:
      ;	script runs with command line argument "faf" or "FAF"
      ;	for example Object field in *.lnk:
      ;	"D:\Program Files\SC FAF borderleess.ahk" faf
      ; case 2:
      ;	file name of this script starts with "FAF..." or "faf.."
      ;	for example: "D:\Program Files\FAF borderleess.ahk"
      
      if(lowerCaseFirstArg = "faf" or lowerCaseFirst3chars = "faf")
      {
      	singlePlayer := false
      }
      ; now "singlePlayer" variable is set
      
      ; process for game
      procGame := singlePlayer ? procSingleplayer : procMultiplayer
      
      
      
      ; DEBUG MESSAGE STRING is bellow, this string is to check if it works right
      ; MsgBox, % ProcessorCount " threads " ( singlePlayer ? "Singleplayer: " : "Multiplayer: " ) procGame
      ; delete ; character to uncomment string above to see info window on script start
      
      
      
      procName := singlePlayer ? procGame : procClient
      procPath := singlePlayer ? pathOrLinkGame : pathOrLinkClient
      
      
      ; Start game or client and 
      ; wait for process to start, but no more then 120 seconds
      Run, %procPath%
      Process, Wait, %procName%, 120
      procPID := ErrorLevel
      if not procPID
      {
          MsgBox The specified process did not appear.
          ExitApp ; Stop this script
      }
      
      SetTimer, CheckProc, 2000
      
      if(!singlePlayer)
      {
      	; Stop then FAF Client stoped
      	Process, WaitClose, %procClient%
      	ExitApp
      }
      
      
      CheckProc:
          if (!ProcessExist(procGame))
              return
      
          WinGet Style, Style, % "ahk_exe " procGame
          if (Style & 0xC40000)
          {
      		; remove the titlebar and borders
              WinSet, Style, -0xC40000, % "ahk_exe " procGame 
      		; move the window to 0,0 and resize it to fit across 1 or 2 monitors.
              WinMove, % "ahk_exe " procGame , , moveX, moveY, width, height
              WinMaximize, % "ahk_exe " procGame
              WinRestore, % "ahk_exe " procGame
      
              ; set High priority and cores affinity 
              Process, Priority, %procGame%, H
              gamePID := ErrorLevel
              ProcessHandle := DllCall("OpenProcess", "UInt", 0x1F0FFF, "Int", false, "UInt", gamePID)
              DllCall("SetProcessAffinityMask", "UInt", ProcessHandle, "UInt", 2**ProcessorCount - 2 )
      		DllCall("CloseHandle", "UInt", ProcessHandle)
      		
      		; I have 4 threads, so 2**ProcessorCount - 2 will be 2^4 - 2= 16 - 2 = 14
      		; 1110 binary = 14 decimal.
      		; this means CPU 0 unchecked (right most 0 in binary number), 
      		; CPU 1-3 checked (ones in binary number) for 4 threads optimization
              
              if(singlePlayer)
      		{
      			ExitApp  ; Stop this script
      		}
      		else
      		{
      			Process, WaitClose, %procGame%
      		}
          }
      return
      
      ProcessExist(exeName)
      {
         Process, Exist, %exeName%
         return !!ERRORLEVEL
      }
      return
      
      posted in Frequently Asked Questions
      IO_NoxI
      IO_Nox