Can I make it so the window fits the games resolution?
#11
(06-24-2013, 03:25 PM)vsub Wrote: Looks like it will be a lot more complicated to automatically resize the window(there are way too many conditions to be added so the code to always work and plus,it has to constantly get info(every 5 seconds)

So I made the code to work in a different way
1.Run the script(it doesn't matter when,before or after starting pcsx2)
2.Make the GSdx window active(he becomes active automatically anyway),wait the title to contains the native resolution in the title and right click on the window(inside the window,not the title)
3.The window will be resided according to your settings.

Native on - Will resize the window to the game native resolution

Native off and custom resolution is set - the code will get the info from the GSdx.ini file and resize the window to the custom resolution you set

Native off and scaling mode used - The code get the scaling mode,get the native resolution,multiply the width and height by the scaling mode and resize the window using the result.

Also along with resized,the window is also centered

Code:
#SingleInstance,Force
WinWaitActive,GSdx |
WinGet,GSdxW,ID,A
WinGet,PCSX2Path,ProcessPath,AHK_id %GSdxW%
SplitPath,PCSX2Path,,Dir

IfExist,%Dir%\inis\GSdx.ini
GSdx_ini = %Dir%\inis\GSdx.ini
Else
GSdx_ini = %A_MyDocuments%\pcsx2\inis\GSdx.ini

#IfWinActive,GSdx |
~RButton::
KeyWait,RButton
Critical
IfWinNotExist,ahk_id %GSdxW%
WinGet,GSdxW,ID,A
WinGet,WMode,MinMax,A
WinGetPos,X,Y
If (WMode != 0) or (X = 0 && Y = 0)
Return
MouseGetPos,,,,Control
If Control not in wxWindowClassNR1
Return

; ++++++++++++++Get Native Resolution+++++++++++++++++++

Loop
{
WinGetTitle,GSdx,ahk_id %GSdxW%
Size := SubStr(GSdx,8,3)
If Size is Digit
Break
}
Loop,Parse,GSdx,|
If A_Index = 2
{
Size := SubStr(A_LoopField,2,7)
StringSplit,Size,Size,x
Break
}

; ++++++++++++Read GSdx Settings++++++++++++

FileRead,GSdx_s,%GSdx_ini%
If GSdx_s contains nativeres=0
{
Native = off
If GSdx_s contains upscale_multiplier=1
{
Upscale = Custom
IniRead,resx,%GSdx_ini%,Settings,resx
IniRead,resy,%GSdx_ini%,Settings,resy
}
Else
IniRead,Upscale,%GSdx_ini%,Settings,upscale_multiplier
}
Else
{
Native = on
}

; +++++++++++++++Resize Window+++++++++++++++++++++++++


If ((Native = "off") && (Upscale = "Custom"))
{
WinMove,ahk_id %GSdxW%,,% (A_ScreenWidth/2)-(resx/2),% (A_ScreenHeight/2)-(resy/2),%resx%,%resy%

Return
}
If ((Native = "off") && (Upscale != "Custom"))
{
resx := Size1 * Upscale
resy := Size2 * Upscale
WinMove,ahk_id %GSdxW%,,% (A_ScreenWidth/2)-(resx/2),% (A_ScreenHeight/2)-(resy/2),%resx%,%resy%
Return
}
If Native = on
WinMove,ahk_id %GSdxW%,,% (A_ScreenWidth/2)-(Size1/2),% (A_ScreenHeight/2)-(Size2/2),%Size1%,%Size2%
Return

This is perfect, thank you so much! You are a god among men!
Reply

Sponsored links





Users browsing this thread: 1 Guest(s)