Jump to content
LaunchBox Community Forums

Windowcast RetroArch core configuration?


Parse

Recommended Posts

This core: https://forums.libretro.com/t/official-release-thread-for-windowcast-core/40464

So basically it allows any standalone game and emulators to work within RA, so you can use its shaders.

In my setup on LB, I used RA on emulator, path to .txt and the game as an addition app to start before RA.

It kind of works, but the game window starts on top of RA and I cound't find a way to exit both by pressing esc. I think it would be ideal to have a bit of delay to start RA. So, any suggestions?

Link to comment
Share on other sites

  • 5 months later...

I've been playing with this a couple times now and it's rather experimental as the dev says. Awesome idea, but still very much a WIP. They have mostly great notes on how to setup and use it, but for the life of me why the hell they didn't include the oh so mandatory setting of making Retroarch not pause when the window is not active in these notes is beyond me! I had to read through the libretro thread to find others talking about it. Makes sense, obviously, that it is req, but that was something that slipped through the cracks.

My main gripe is it doesn't seem to work with putting Retroarch in fullscreen. Doesn't matter if it's exclusive or windowed fullscreen or if I used the software or vulkan version. When you use the CTRL+ALT+T shortcut it plops the game window ON TOP of Retroarch. When in fullscreen if the game window is not on top, inputs will not be detected at all. So I must resort to only using Retroarch in a window and this is not desirable, at all. You are stuck seeing the title menu and file menu and Windows system tray on the display.

 

Started farting around with an AHK script tonight to change the window style of Retoarch, removing the title and file menu, it's borders, resizing the window , and hiding the system tray. This works as I hoped it would and doesn't mess up behavior with this core! But I'm just not getting how some other users say fullscreen works fine.....seems "YMMV" kinda thing. I'm one of the unlucky ones who cannot use fullscreen. They are aware of the issue, but seem to think it's just a Nvidia issue as they advise on changing a setting in the Nvidia control panel. I'm on an AMD card so not sure if that is why I have the problem. There is no equivalent setting in Radeon Settings for me to change.....or so I thought. (as I type this....I search for the equivalent setting with google) I found this thread and seemed hopeful but I didn't find any difference when toggling this setting "OpenGL Triple Buffering" and thought I was out of luck.....or so I thought again! I found a workaround thanks to this response from one of the AMD team

Quote

"Currently, DXGI support for Vulkan is enabled by default for specific features. However, end-users are not allowed to control this functionality. It will be enabled by default eventually.

Users can turn it on by enabling the OS HDR mode with a HDR capable display."

https://community.amd.com/t5/opengl-vulkan/dxgi-swapchain-on-opengl-and-vulkan-games/m-p/578792

 

LMAO holy cow! TURNING ON HDR ALLOWS ME TO USE FULLSCREEN PROPERLY WITH THIS CORE! This must be one of the weirdest workarounds I've stumbled onto. I know this will not help users without a HDR capable display but it's an option to try if you have the means. Little weird it's working like this as another post from them implies these settings about "DXGI support" should be enabled by default, but it sure isn't working for me without enabling HDR. Though I see their post date is from 12/7/23 and my AMD GPU drivers are v23.8.2 so I will need to update to the latest 24.4.1 version and see if that makes a difference! Fingers crossed!🤞

 

Then I just need to automate the LB/BB launching process. Once I iron it all out, I can share my experience and methods to get all this working.

Link to comment
Share on other sites

Posted (edited)

Gloomy rainy Sunday here in my neck of the woods. Perfect time to tackle this project. Unfortunately updating to latest AMD GPU drivers did not help me one way or the other. I still cannot use WindowCast core and put Retroarch in fullscreen unless I have HDR enabled in Windows Display Settings. So I played with a script that can handle launching it both ways, with or w/o HDR enabled

Since I assume users would be like me and already have games imported, I wanted to design a script to work with everything configured as it currently is. No need to edit game entries and the like. I tested mainly with native Windows games, those being Streets of Rage 4, Raiden III, Dead Cells, Ninja Gaiden Sigma 2, Andro Dunos II, and Natsuki Chronicles. Tried some other emulators like Dolphin and Yuzu and didn't find a different experience there. Same things went good or poor.

The bad part is more I use this the more I run into random issues. Stuff that results in it just booting to white screen and do nothing. Or maybe Retoarch opens to the point you see its taskbar icon but then no window appears. Playing a video in VLC or just having Firefox open results in funny business like that. I know that is not a normal use case, but I usually have other stuff going on as I test stuff like this so that's how that came about. Randomly I'll get some weird artifacting and inputs will not be recognized. But this all seems on par with something experimental and in progress. I didn't really notice any lag or stuttering or FPS loss. That stuff only seems to get introduced depending on how crazy you go with implementing Mega Bezels which I assume is why anyone would want to use this core in the first place. And that's really the shader's fault, not the core.

On the good side, when it works, it works well. Every game and emulator I tried worked. A couple games needed additional means to work well and I'll mention that later. Lots of great shader options out there to use, I didn't run into issue trying any certain one. They all seemed to work as expected.

Some bits I notice is the text file is interpreted as case insensitive and I did test every game I tried with both their window title and exe file name. Only one did not work with the exe file name, that was Streets of Rage 4. Booted, but just a white screen (made sure it was not due to above bug of having other stuff open). If I use its window title it works fine. So that was an outlier. With that in mind I thought I would design my scripts to be case insensitive too in order for it to properly use this file for window or exe file names.

 

Here is what I come up for me launching with HDR enabled. This will launch Retroarch into fullscreen. Users copying this will need to adjust RetroarchEXE and WindowCastFile variables to the correct path where they are stored on your system. Optionally you could also adjust TimeOutDelay, RunRetroarchDelay, and FocusHotkeyDelay if needed.

It's going to make use of the file you put the window title or game exe name in. When the script starts it's looking for one of these windows or processes to exist before continuing. If it takes too long (10 secs), it will timeout and a message box will pop up to tell you script is terminating.  Once the window is found it's going to launch Retroarch and then use the CTRL+ALT+T hotkey to push focus to the game so inputs are detected. Then it's going to wait for the game/emulator to close before closing Retroarch and exiting the script. Escape is also a hotkey to close Retroarch.

Spoiler
SetWorkingDir, % A_ScriptDir
SetTitleMatchMode, RegEx    ; seems to work like mode 2 (partial match) but allows for use of expressions
RetroarchWinTitle := "ahk_exe retroarch.exe"
RetroarchEXE := "..\..\..\Emulators\Retroarch\retroarch.exe"
WindowCastFile := "..\..\..\ROMS\WindowCast\WindowCast.txt"
WindowCastListArray := []
TimeOutDelay := 10000       ; close script if game/emulator window is not found in X seconds
RunRetroarchDelay := 1500   ; delay between finding game/emulator window and then opening Retroarch
FocusHotkeyDelay := 2000    ; delay between launching Retroarch and sending hotkey to grab focus of game/emulator window. *HDR/Fullscreen method ONLY*

; Read WindowCast window list file and parse into array
FileRead, WindowCastList, %WindowCastFile%
Loop, Parse, WindowCastList, `r, `r`n 
{
    If (InStr(A_LoopField, "#"))
        Continue
    WindowCastListArray.Push(A_LoopField)
}

; Loop through list to check which window exists
InitialTime := A_TickCount
WindowCheck:
Loop, % WindowCastListArray.Count() {
    ; Check if entry is an exe
    If (InStr(WindowCastListArray[A_Index], ".exe")) {
        If (WinExist("ahk_exe " . "i)" . WindowCastListArray[A_Index])) {
            ExistingWindow := WindowCastListArray[A_Index]
            Break
        }    
    }
    ; If entry is not an exe, it is a window title
    Else If (WinExist("i)" . WindowCastListArray[A_Index])) {
        ExistingWindow := WindowCastListArray[A_Index]
        Break
    }
    DurationTime := A_TickCount - InitialTime
    If (DurationTime >= TimeOutDelay) {
        MsgBox, 4096, Window Check Timeout, Couldn't find existing window. Exiting script!
        ExitApp
    }
}
If (ExistingWindow = "")
    Goto, WindowCheck

Sleep, RunRetroarchDelay
Run, %RetroarchEXE% -L wgc_libretro.dll %WindowCastFile% -f
WinWait, % RetroarchWinTitle
Sleep, % FocusHotkeyDelay
; Sends hotkey to give focus to game window so inputs are detected
Send {LCtrl down}{LAlt down}{t down}{t up}{LAlt up}{LCtrl up}
If (InStr(ExistingWindow, ".exe")) 
    WinWaitClose, % "ahk_exe" . "i)" . ExistingWindow
Else
    WinWaitClose, % "i)" . ExistingWindow
WinClose, % RetroarchWinTitle
ExitApp

; Hotkey to exit Retroarch and terminate script
$Esc:: ; keyboard modifier ($) is needed so input isn't "eaten" by the game
WinClose, % RetroarchWinTitle
ExitApp

 

 

 

 

 

Same thing but this is how I first had to think about stuff if I am in SDR mode. If you have issues like me with putting Retroarch into fullscreen with this core and do not have the option of using HDR then you will want to use this version. What is different here is changing window style of Retroarch so it takes up your whole screen without the system thinking it's in fullscreen mode.

Spoiler
SetWorkingDir, % A_ScriptDir
SetTitleMatchMode, RegEx    ; seems to work like mode 2 (partial match) but allows for use of expressions
RetroarchWinTitle := "ahk_exe retroarch.exe"
RetroarchEXE := "..\..\..\Emulators\Retroarch\retroarch.exe"
WindowCastFile := "..\..\..\ROMS\WindowCast\WindowCast.txt"
WindowCastListArray := []
TimeOutDelay := 10000       ; close script if game/emulator window is not found in X seconds
RunRetroarchDelay := 1500   ; delay between finding game/emulator window and then opening Retroarch

; Read WindowCast window list file and parse into array
FileRead, WindowCastList, %WindowCastFile%
Loop, Parse, WindowCastList, `r, `r`n 
{
    If (InStr(A_LoopField, "#"))
        Continue
    WindowCastListArray.Push(A_LoopField)
}

; Loop through list to check which window exists
InitialTime := A_TickCount
WindowCheck:
Loop, % WindowCastListArray.Count() {
    ; Check if entry is an exe
    If (InStr(WindowCastListArray[A_Index], ".exe")) {
        If (WinExist("ahk_exe " . "i)" . WindowCastListArray[A_Index])) {
            ExistingWindow := WindowCastListArray[A_Index]
            Break
        }    
    }
    ; If entry is not an exe, it is a window title
    Else If (WinExist("i)" . WindowCastListArray[A_Index])) {
        ExistingWindow := WindowCastListArray[A_Index]
        Break
    }
    DurationTime := A_TickCount - InitialTime
    If (DurationTime >= TimeOutDelay) {
        MsgBox, 4096, Window Check Timeout, Couldn't find existing window. Exiting script!
        ExitApp
    }
}
If (ExistingWindow = "")
    Goto, WindowCheck

Else {
    Sleep, % RunRetroarchDelay
    Run, %RetroarchEXE% -L wgc_libretro.dll %WindowCastFile%
    WinWait, % RetroarchWinTitle
    WinSet, Style, -0x40000, %RetroarchWinTitle%                    ; removes sizing borders
    WinSet, Style, -0xC00000, %RetroarchWinTitle%                   ; removes title bar
    DllCall("SetMenu", uint, WinActive(RetroarchWinTitle), uint, 0) ; removes file menu bar
    WinHide, ahk_class Shell_TrayWnd                                ; hides system tray
    ; cannot use exact screen dimensions or else it acts just like normal fullscreen
    ; normal fullscreen can make the game image freeze in Retroarch
    ; add +1 to width so it is not considered true fullscreen
    WinMove, %RetroarchWinTitle%, , 0, 0, % A_ScreenWidth + 1, %A_ScreenHeight%
}
; Sends hotkey to give focus to game window so inputs are detected
Send {LCtrl down}{LAlt down}{t down}{t up}{LAlt up}{LCtrl up}
If (InStr(ExistingWindow, ".exe")) 
    WinWaitClose, % "ahk_exe" . "i)" . ExistingWindow
Else
    WinWaitClose, % "i)" . ExistingWindow
WinClose, % RetroarchWinTitle
WinShow, ahk_class Shell_TrayWnd
ExitApp

; Hotkey to exit Retroarch, show Windows system tray, and terminate script
$Esc:: ; keyboard modifier ($) is needed so input isn't "eaten" by the game
WinClose, % RetroarchWinTitle
WinShow, ahk_class Shell_TrayWnd
ExitApp

 

 

 

 

For anyone who wants to automate that, here is what I'm employing in a single script. It's detecting if HDR is enabled or not. You will need to get the proper registry address yourself which is going to be specific to your system's display.  I have a main system in my computer room and a HTPC in the living room so this is why I have a line checking which computer is running but I haven't bothered to get the address for the other display yet.

Spoiler
SetWorkingDir, % A_ScriptDir
SetTitleMatchMode, RegEx    ; seems to work like mode 2 (partial match) but allows for use of expressions
RetroarchWinTitle := "ahk_exe retroarch.exe"
RetroarchEXE := "..\..\..\Emulators\Retroarch\retroarch.exe"
WindowCastFile := "..\..\..\ROMS\WindowCast\WindowCast.txt"
WindowCastListArray := []
TimeOutDelay := 10000       ; close script if game/emulator window is not found in X seconds
RunRetroarchDelay := 1500   ; delay between finding game/emulator window and then opening Retroarch
FocusHotkeyDelay := 2000    ; delay between launching Retroarch and sending hotkey to grab focus of game/emulator window. *HDR/Fullscreen method ONLY*

; Read WindowCast window list file and parse into array
FileRead, WindowCastList, %WindowCastFile%
Loop, Parse, WindowCastList, `r, `r`n 
{
    If (InStr(A_LoopField, "#"))
        Continue
    WindowCastListArray.Push(A_LoopField)
}

; Loop through list to check which window exists
InitialTime := A_TickCount
WindowCheck:
Loop, % WindowCastListArray.Count() {
    ; Check if entry is an exe
    If (InStr(WindowCastListArray[A_Index], ".exe")) {
        If (WinExist("ahk_exe " . "i)" . WindowCastListArray[A_Index])) {
            ExistingWindow := WindowCastListArray[A_Index]
            Break
        }    
    }
    ; If entry is not an exe, it is a window title
    Else If (WinExist("i)" . WindowCastListArray[A_Index])) {
        ExistingWindow := WindowCastListArray[A_Index]
        Break
    }
    DurationTime := A_TickCount - InitialTime
    If (DurationTime >= TimeOutDelay) {
        MsgBox, 4096, Window Check Timeout, Couldn't find existing window. Exiting script!
        ExitApp
    }
}
If (ExistingWindow = "")
    Goto, WindowCheck

; Check if HDR is enabled
; Read HDR status in registry
If (A_ComputerName = "DESKTOP-Z390") {
    RegRead, REG_DWORD, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\MonitorDataStore\SAM713F16780800_01_07E5_37, AdvancedColorEnabled
}
Else If (A_ComputerName = "DESKTOP-B760") {
    ; NEED TO GET PROPER REGISTRY ADDRESS FOR HTPC DISPLAY!
    ; RegRead, REG_DWORD, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\MonitorDataStore\SAM713F16780800_01_07E5_37, AdvancedColorEnabled
}

; #########################################################################################
; HDR VERSION: Runs in Retroarch fullscreen mode
; #########################################################################################
If (REG_DWORD = 1) {
    Sleep, RunRetroarchDelay
    Run, %RetroarchEXE% -L wgc_libretro.dll %WindowCastFile% -f
    WinWait, % RetroarchWinTitle
    Sleep, % FocusHotkeyDelay
}
; #########################################################################################
; SDR VERSION: Runs Retroarch in window mode, change its window style, and hide system tray
; #########################################################################################
Else {
    Sleep, % RunRetroarchDelay
    Run, %RetroarchEXE% -L wgc_libretro.dll %WindowCastFile%
    WinWait, % RetroarchWinTitle
    WinSet, Style, -0x40000, %RetroarchWinTitle%                    ; removes sizing borders
    WinSet, Style, -0xC00000, %RetroarchWinTitle%                   ; removes title bar
    DllCall("SetMenu", uint, WinActive(RetroarchWinTitle), uint, 0) ; removes file menu bar
    WinHide, ahk_class Shell_TrayWnd                                ; hides system tray
    ; cannot use exact screen dimensions or else it acts just like normal fullscreen
    ; normal fullscreen can make the game image freeze in Retroarch
    ; add +1 to width so it is not considered true fullscreen
    WinMove, %RetroarchWinTitle%, , 0, 0, % A_ScreenWidth + 1, %A_ScreenHeight%
}
; Sends hotkey to give focus to game window so inputs are detected
Send {LCtrl down}{LAlt down}{t down}{t up}{LAlt up}{LCtrl up}
If (InStr(ExistingWindow, ".exe")) 
    WinWaitClose, % "ahk_exe" . "i)" . ExistingWindow
Else
    WinWaitClose, % "i)" . ExistingWindow
WinClose, % RetroarchWinTitle
WinShow, ahk_class Shell_TrayWnd
ExitApp

; Hotkey to exit Retroarch, show Windows system tray, and terminate script
$Esc:: ; keyboard modifier ($) is needed so input isn't "eaten" by the game
WinClose, % RetroarchWinTitle
WinShow, ahk_class Shell_TrayWnd
ExitApp

 

 

 

For emulators I put in the Running Script field a Run command for this WindowCast script. For ex

Run, ..\..\Utilities\Scripts\WindowCast\WindowCast.ahk

 

For native Windows games I mainly use scripts to launch them, so in those scripts I can add a line to run the WindowCast script (basically same as above) or you can add the WindowCast script as an Additional Application and check Automatically Run Before Main Application

 

 

 

When testing Andro Dunos II this game forcefully runs in fullscreen mode much like a game from it's original era, ya know the 90's. So I just used DxWnd for the first time to force it into a window mode and that was a super easy experience. The included help files by means of a local html files helps explained how to use it perfectly. I had to use this program in order to make use of WindowCast with Andro Dunos II.

Another one that needed (maybe subjective) unique care was Streets of Rage 4. When in window mode it defaults to a small window and does not remember its window size between launches. It looks way too pixelated at this small window size all scaled up to 4K so I had to get a better image quality here. Simply maximizing the game window still leaves letter boxing because for whatever reason they didn't make window size default to a 16:9 aspect ratio but the game itself maintains aspect ratio...hence black bars will appear if it's not exact 16:9. I figure using WinMove commands would help and they do move and resize it just fine, but the game doesn't seem to actually update it's render output unless you adjust the window via its borders. As in you must grab the borders via the mouse to get resolution to change. So I had to add a bit for this game to make the game window always on top and then automate moving the mouse to click and drag the window size to be bigger, then immediately tell it to not always be on top. So the launching looks a little goofy seeing the window for a split sec and it grows at that too but the end result is a much better looking game! In the end I had to make a special script with a few extra lines in it just for this one game due to this. Here is that extra bit

Spoiler
; Resize game window via mouse grabbing the border
; Using maximize button still leaves letter boxing
; Using WinMove commands or WinMaximize commands does not update rendering resolution
Sleep, % ResizeDelay
WinHide, ahk_class Shell_TrayWnd                            ; hides system tray
WinSet, Style, -0xC00000, % "i)" . ExistingWindow           ; removes title bar
WinMove, % "i)" . ExistingWindow, , 0, 0                    ; moves game window to top left corner
WinSet, AlwaysOnTop, On, % "i)" . ExistingWindow            ; put game window on top in order to resize with the mouse
MouseClickDrag, Left, 810, 515, 3760, 2115                  ; resize for higher resolution and specific coordinates are to maintain 16:9 aspect ratio
WinSet, AlwaysOnTop, Off, % "i)" . ExistingWindow

 

 

One thing I left less than optimized was I couldn't get rid of all the file menu and bottom message center in Yuzu's UI. So I instead opt to crop that portion off with the shader used in Retroarch. I will try and play with stuff like this more to see if I cannot get that removed. Title bar (yellow highlight) removes OK, as do the borders, but file menu doesn't and who knows about the bottom one.

Yuzu.thumb.PNG.e733c8c5934bf4e45aee03ba05302b87.PNG

 

 

 

Here are some examples of the final result in action! I got some mods going in in NGS2 so it works more like the original version with dismembering limbs and all the bloody gore that was taken out so it could run on the PS3. I'm running the Master Collection version on Steam.

SOR4.thumb.png.ea571d32f996bc4425b022a1e89690f6.png

NinjaGaidenSigmaII.thumb.png.fc46f390afd9865ec9f4a37b699be789.png

AndroDunosII.thumb.png.3adb499284f0fef3aaa567b1078072b6.png

NatsukiChronicles.thumb.png.c9d76bce35ac600a015098d0cf7f0b10.png

You have no idea how hard it is to take a screen shot in a shoot 'em up and not die lol

Edited by skizzosjt
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...