[Guide] : fake-fullscreen and optimisation
-
@thecore you need to install and enable common mod tools.
Please consider using edits instead of posting multiple times.
-
@deletethis Yeah i had a forum bug where i did not have permission to make an edit
Anyway got it all working
-
I have improved the script, here is my result
The Definitive Supreme Commander Windowed Script
For single and dual screen
v1.00
thecore, tatsu, IO_Nox other sources on the netFeatures
Supports the following
Forged Alliance Forever
Downlord's FAF Client
LOUD Forged Alliance
Steam Forged Alliance
Steam Supreme Commander
Switch between single and dual screen
Lock mouse within gameHow to install
-
Install all the different version of Supreme Commander (see Features of supported games)
-
Install Common Mod Tools mod (This can be done from the Downlord's FAF Client)
-
Install ui-party mod (This can be done from the Downlord's FAF Client)
Now open each game, enable ui-party mod and set resolution to Windowed, DO NOT SKIP THIS
NOTE Steam Supreme Commander does not support ui-party mod -
Download Supreme Commander Launchers.zip
Now i am not able to upload a zip file for some strange reason so i have embedded it into a doc file, open the doc file and upzip from there
Supreme Commander Launchers.doc
If a forum moderator can fix the zip upload they can update it here -
Unzip Supreme Commander Launchers to your game directory
Note you should have 5 shortcuts (that will be configured) a scripts folder and an icons folder -
Configure Client Forged Alliance Forever shortcut
right click on Client Forged Alliance Forever shortcut and select properties
Enter in the following for target, note you must enter in you drive letter and the directory locaiton
!REPLACE ALL CAPS!
"D:\THE LOCATION TO THE GAME DIRECTORY\Supreme Commander Launchers\scripts\AutoHotkeyU32.exe" "D:\THE LOCATION TO THE GAME DIRECTORY\Supreme Commander Launchers\scripts\multiMonitor.ahk" client
NOTE the " client is the pram
Replace Start In with the THE LOCATION TO THE SUPREME COMANDER LAUNCHERS FOLDER
Click change icon and use the icon in the icons folder (forgedallianceIcon.ico)
Repeat the process for the other shortcuts, however replace pram in Target as follows
Client Forged Alliance Forever = multiMonitor.ahk" client
Forged Alliance Forever = multiMonitor.ahk" faf
LOUD Forged Alliance = multiMonitor.ahk" loud
Steam Forged Alliance = multiMonitor.ahk" steamFAF
Steam Supreme Commander multiMonitor.ahk" steamSCAn example of what the shortcuts will look like are
Client Forged Alliance Forever
Target
"E:\Games\Supreme Commander Launchers\scripts\AutoHotkeyU32.exe" "E:\Games\Supreme Commander Launchers\scripts\multiMonitor.ahk" clientStart in
"E:\Games\Supreme Commander Launchers"Forged Alliance Forever
Target
"E:\Games\Supreme Commander Launchers\scripts\AutoHotkeyU32.exe" "E:\Games\Supreme Commander Launchers\scripts\multiMonitor.ahk" fafStart in
"E:\Games\Supreme Commander Launchers"LOUD Forged Alliance
Target
"E:\Games\Supreme Commander Launchers\scripts\AutoHotkeyU32.exe" "E:\Games\Supreme Commander Launchers\scripts\multiMonitor.ahk" loudStart in
"E:\Games\Supreme Commander Launchers"Steam Forged Alliance
Target
"E:\Games\Supreme Commander Launchers\scripts\AutoHotkeyU32.exe" "E:\Games\Supreme Commander Launchers\scripts\multiMonitor.ahk" steamFAFStart in
"E:\Games\Supreme Commander Launchers"Steam Supreme Commander
Target
"E:\Games\Supreme Commander Launchers\scripts\AutoHotkeyU32.exe" "E:\Games\Supreme Commander Launchers\scripts\multiMonitor.ahk" steamSC
Start in
"E:\Games\Supreme Commander Launchers"!! Dubble check to make sure everything is correct !!
So now you should have 5 shortcuts with icons each with a different pram
-
open scripts\multiMonitor.ahk
Note you can use notepad++ -
Settings that the user can change if they want to
"global clipMouse = true" on by default
"global autoSetMonitorSize := true" on by default
"global startInDualScreenMode := false" off by default -
Settings the user must change !!!
pathOrLinkLOUD
pathOrLinkClient
The directory of where the game exe is,
e.g "E:\Games\supremeCommanderForgedAlliance"
By default FAF is located in "C:\ProgramData\FAForever\bin"
For LOUD you are need to find the SCFA_Updater.exe location
For Downlord's FAF Client you need to find the downlords-faf-client.exe locationThat should be it for setting up
How to use
To enable dual Screen mode press Ctrl F12
To enable single Screen mode press Ctrl F11
To stop the script press Ctrl F10
You can use the windows key to untrap the mouseBugs and limitations
ui-party mod
If you switch from dual screen to single screen when the match has started the idle avatar does not position correctly.
The ui-party icon also does not position correctly.
The drop down menu also does not quite position correctly
Steam Supreme Commander does not support ui-party modI spent a few days to get this to work I hope people find it helpful.
-
-
for those who aren't aware, there is a program to convert ahk scripts to an exe that you can simply run at startup, or create a task schedule to run on specific triggers.
-
For my updated script you do not need to convert the ahk file.
Just right click on the ahk file and go properties and click open with and select the AutoHotkeyU32.exe file in scripts -
Another improvement I just made is auto detect when the match is loading and auto switch to dual screen mode. This using the ImageSearch function.
To do this you do
SetTimer, loadingSearch, 100 loadingSearch: if (!ProcessExist(procGame)) return ;//checks if t if(!loaded) return var := 0 loop , 8 { var += 1 CoordMode Pixel,Relative ImageSearch, FoundX, FoundY, 0, 0, width, height, *50, %A_ScriptDir%\pics\%var%.jpg ; if (ErrorLevel = 0) { resize(width*2, height,procGame,true) settimer, loadingSearch, OFF break } } return
And the references pics you can use are here, put them in a folder in scripts called pics and call them
1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7jpg
8.jpg
Now i have only tested for 1920x1080 so if the ImageSearch cannot find the image you may need to play around with it.
I updated the resize rule
resize(x, y, gametype,active) { if(active = true) { if(dualScreenActive = true) return dualScreenActive := true } else { if(dualScreenActive = false) return dualScreenActive := false } WinMove, % "ahk_exe " gametype , , moveX, moveY, %x%, %y% WinMaximize, % "ahk_exe " gametype WinRestore, % "ahk_exe " gametype }
The full script
;//The Definitive Supreme Commander Windowed Borderless Script ;//thecore, tatsu, IO_Nox other sources on the net ;//1.01 ;//Supports ;//dual Monitors of the same resolution ;//mouse cursor traping ;//Supreme Commander steam version ;//Supreme Commander Forged Alliance steam version ;//Forged Alliance Forever ;//Downlord's FAF Client ;//LOUD ;//limitations ;//Only supports monitors of the same resolution ;//ui-party does not support steam Supreme Commander (9350) #NoEnv SendMode Input SetWorkingDir %A_ScriptDir% #Persistent ;//all personal variables are here global moveX := 0 ;//Sets the main screen x location, 0 being the "main display" X location global moveY := 0 ;//Sets the main screen x location, 0 being the "main display" Y location global width := 0 ;//resolution width (do not change) global height := 0 ;//resolution height (do not change) global clipMouse = true ;//This will trap the mouse cursor within the game while the game window is active, you can use windows key to deactivate the game window, global autoSetMonitorSize := true ;//set to use auto set resolution if(autoSetMonitorSize == true) { SysGet, Mon1, Monitor, 1 ;//get monitor 1 resolution width := % Mon1Left ; //set width resolution height := % Mon1Bottom ; //set width resolution ;//if the value is negative change it to positive number if(width < 0) { width := (-1 * width) } if(height < 0) { height := (-1 * height) } } else { ;//manually set monitor resolution size width := 1920 ;2560, 3840 ;//Sets the width resolution, for 1080p use (1920), for 1440p use (2560), for 4k use (3840) or use a custom value height := 1080 ;1440, 2160 ;//Sets the height resolution } global startInDualScreenMode := false ;//Set the default Screen mode on startup, true is start in dual screen mode global dualScreenActive := startInDualScreenMode ;//(do not change) ;//hotkey for dual screen mode is Ctrl F12 ;//hotkey for single screen mode is Ctrl F11 ;//hotkey for exit script is Ctrl F10 ;//Paths to different game exe types global pathOrLinkSteamSC := "steam://rungameid/9350" ;//Location to Supreme Commander steam version global pathOrLinkSteamFaf := "steam://rungameid/9420" ;//Location to Supreme Commander Forged Alliance steam version global pathOrLinkFAF := "C:\ProgramData\FAForever\bin" ;//Location to Forged Alliance Forever exe (this is normally found in "C:\ProgramData\FAForever\bin") global pathOrLinkLOUD := "E:\Games\supremeCommanderForgedAlliancee" ;//Location to LOUD SCFA_Updater.exe global pathOrLinkClient := "E:\Games\Downlord's FAF Client" ;//Location to Downlord's FAF Client exe ;//the name of the exe for each game type global procSteamSC := "SupremeCommander.exe" ;//Supreme Commander steam version global procSteamFaf := "SupremeCommander.exe" ;//Supreme Commander Forged Alliance steam version global procFAF := "ForgedAlliance.exe" ;//Forged Alliance Forever global procClient := "downlords-faf-client.exe" ;//Downlord's FAF Client global procLOUD := "SCFA_Updater.exe" ;//LOUD Updater ;//Set the number of processor threads to use, by default it will find auto find the max supported processors EnvGet, ProcessorCount, NUMBER_OF_PROCESSORS firstArg := A_Args[1] ;//get shortcut parameters command line first agrument StringLower, lowerCaseFirstArg, firstArg ;//Sets firstArg to lower case, not really needed but just in case the user puts in a uppercase value global procGame := "null" ;//holds the game exe to use global loaded := false ;//Run the following exe based off pram from shortcut ;//procGame - Sets which game exe name to use, this is the exe that will have the width and height changed ;//procName - Sets which exe that needs to be closed to stop the ahk script (e.g for the Downlord's FAF Client the script will stop once the client is shutdown and not the game exe) ;//procPath - Sets the game path ;//Run, %procName%, %procPath% - run the exe at the path if(lowerCaseFirstArg = "client") { ;//Run the Downlord's FAF Client procGame := procFAF procName := procClient procPath := pathOrLinkClient Run, %procName%, %procPath% } else if(lowerCaseFirstArg = "faf" ) { ;//Run Forged Alliance Forever procGame := procFAF procName := procFAF procPath := pathOrLinkFAF Run, %procName%, %procPath% } else if(lowerCaseFirstArg = "steamFAF") { ;//Run upreme Commander Forged Alliance steam version procGame := procSteamFaf procName := procSteamFaf procPath := pathOrLinkSteamFaf Run, %procPath% } else if(lowerCaseFirstArg = "loud") { ;//Run LOUD procGame := procFAF procName := procLOUD procPath := pathOrLinkLOUD Run, %procName%, %procPath% } else if(lowerCaseFirstArg = "steamSC") { ;//Run LOUD procGame := procSteamSC procName := procSteamSC procPath := pathOrLinkSteamSC Run, %procPath% } Process, Wait, %procName%, 120 ;//Wait upto 120 seconds for the exe to start procPID := ErrorLevel ;//set the error level ;//if the exe does not start show an error message and exit the script if not procPID { MsgBox The specified process did not appear. ExitApp ; Stop this script } ;//Call the exitProc function after the set time SetTimer, exitProc, 2000 ;//Call the CheckProc function after the set time SetTimer, CheckProc, 2000 if(clipMouse == true) { SetTimer, clipProc, 100 } SetTimer, loadingSearch, 100 ;//Function that will Manually switch from dual screen to single screen resize(x, y, gametype,active) { if(active = true) { if(dualScreenActive = true) return dualScreenActive := true } else { if(dualScreenActive = false) return dualScreenActive := false } WinMove, % "ahk_exe " gametype , , moveX, moveY, %x%, %y% WinMaximize, % "ahk_exe " gametype WinRestore, % "ahk_exe " gametype } ;//Hot key to switch from dual screen to single screen or to exit the script ^F12::resize(width*2, height,procGame,true) ;//Ctrl F12 to enter dual screen mode ^F11::resize(width, height,procGame,false) ;//Ctrl F11 to enter single screen mode ^F10::quit() ;//Ctrl F10 to stop the script ;//Resize the game on start up, CheckProc: if (!ProcessExist(procName)) return WinGet Style, Style, % "ahk_exe " procGame ;//Gets the style from the game exe if (Style & 0xC40000) { WinSet, Style, -0xC40000, % "ahk_exe " procGame ;//removes the titlebar and borders windowWidth := width ;//sets the windowWidth value to width ;//Checks the default screen mode if(startInDualScreenMode = true) { windowWidth := windowWidth*2 ;//use dual screen mode as default } ; //move the window to 0,0 and resize it to fit across 1 or 2 monitors. WinMove, % "ahk_exe " procGame , , moveX, moveY, windowWidth, height WinMaximize, % "ahk_exe " procGame WinRestore, % "ahk_exe " procGame ; //set High priority Process, Priority, %procGame%, H ; //sets the number of processors to use, by default it will use all processor except CPU0 ; //NOTE with windows 10, windows 11 this is not really needed gamePID := ErrorLevel ProcessHandle := DllCall("OpenProcess", "UInt", 0x1F0FFF, "Int", false, "UInt", gamePID) DllCall("SetProcessAffinityMask", "UInt", ProcessHandle, "UInt", 2**ProcessorCount - 2 ) DllCall("CloseHandle", "UInt", ProcessHandle) loaded := true } return clipProc: if (!ProcessExist(procGame)) return ;//checks if the game window is active if !WinActive("ahk_exe " procGame) { return } ;//trap mouse Confine := !Confine setWidth := width ;//trap mouse to dual screen if(dualScreenActive == true) { setWidth := setWidth * 2 } ClipCursor( Confine, 0, 0, setWidth, height) return loadingSearch: if (!ProcessExist(procGame)) return ;//checks if t if(!loaded) return var := 0 loop , 8 { var += 1 CoordMode Pixel,Relative ImageSearch, FoundX, FoundY, 0, 0, width, height, *50, %A_ScriptDir%\pics\%var%.jpg ; if (ErrorLevel = 0) { resize(width*2, height,procGame,true) settimer, loadingSearch, OFF break } } return 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" ) } ;//Check if the process exist ProcessExist(exeName) { Process, Exist, %exeName% return !!ERRORLEVEL } ;//exit script if the procName is not running exitProc: if (ProcessExist(procName) == 0) { quit() } return ;//quit the script quit() { ExitApp } return
So now when a game starts it will try and find the image and switch to dual screen mode. Have tested it and it is working quite nicely though you may need to add more images for different mods.
-
Version 1.02
- Added auto enable Dual screen mode (enableAutoDualScreen default is true)
- Added auto disable Dual screen mode, the script will check for the end game stats
menu - Improved some code and bugs
Add the following images to \pics\endgame
and under \pics\loadgame
Here is version 1.02
code.txt
Bugs
- The chart does not auto refresh when going from dual screen mode to single screen mode though you can just reselect the chart and it will refresh.
- In order for auto dual screen to work you the game window has to be active.
-
1.03
Fix an issue with FAF client games where the loading Image timer was not turned back on resulting in the auto fullscreen not working after the first game. -
1.04
Fix an issue where when using the downlords-faf-client the auto dual screen was not working correctly when playing the second game.Rename multiMonitor.txt to multiMonitor.ahk
multiMonitor.txt -
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 stringsc 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 assc 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.
-
Added compiled script (usp.exe) here, but if you want to run AHK scripts(*.ahk) AHK instalation is still needed.
-
@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
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...
-
This post is deleted! -
Also i am working on an interface in python
-
@io_nox
@io_nox Hi when going from single screen to dual at 1920x1080 it works mostly as intended (though it can get a few hiccups but it normalcy fixes itself when the game starts, sometimes i have to re toggle the full screen hotkey ).When testing at 960x540 my clipMouse breaks so i need to fix that (to test set clipMouse = false and autoSetMonitorSize = false) that and the image looks like
It kind of looks like the game does not resize the interface, normally this is not an issue if you are switching from 1920x1080 to 3840x1080.
Hopeful i can improve these issues.
-
This looks like a wonderful effort.
-
@thecore said in [Guide] : fake-fullscreen and optimisation:
Also i am working on an interface in python
nice!
yuck python, but nice anyways!
let me know once it's done
actually you and @io_nox should be collaborating and making something together.
-
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:
-
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
-
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...