Wolf3434 Posted June 14, 2021 Share Posted June 14, 2021 (edited) Hi All. I read up on this but I still can't get it Tried adding this to the Exit autohotkey script. Also added ESC as the hotkey under exiting yuzu when playing. Tried both but the only way I can exit is ALT-F4. ; This section closes Yuzu when pressing Escape $Esc:: { Process, Close, {{{StartupEXE}}} } Anybody get yuzu to exit on a hotkey to work? Edited June 14, 2021 by Wolf3434 Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted June 14, 2021 Share Posted June 14, 2021 18 minutes ago, Wolf3434 said: Anybody get yuzu to exit on a hotkey to work? Use this: $Esc:: { WinClose, ahk_exe {{{StartupEXE}}} } Add it to LaunchBox > Tools > Manage Emulators > Yuzu > Running AutoHotKey Script tab. Also make sure you do not run yuzu.exe with admin privileges. 2 Quote Link to comment Share on other sites More sharing options...
Wolf3434 Posted June 15, 2021 Author Share Posted June 15, 2021 Thanks a Mill, I realized run as Admin was causing my issue ? You're a legend Quote Link to comment Share on other sites More sharing options...
The Papaw Posted August 6, 2021 Share Posted August 6, 2021 On 6/14/2021 at 5:57 AM, Koroth said: Use this: $Esc:: { WinClose, ahk_exe {{{StartupEXE}}} } Add it to LaunchBox > Tools > Manage Emulators > Yuzu > Running AutoHotKey Script tab. Also make sure you do not run yuzu.exe with admin privileges. From my understanding, if you use an Nvidea card, you need to run Yuzu as Admin so it can utilize the threaded optimization features via the Nvidea Control Panel??? Has it changed? Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted August 8, 2021 Share Posted August 8, 2021 On 8/6/2021 at 11:45 PM, Wanderer189 said: From my understanding, if you use an Nvidea card, you need to run Yuzu as Admin so it can utilize the threaded optimization features via the Nvidea Control Panel??? Has it changed? No, I don't think that it has changed. But of course you don't NEED Yuzu to run as admin for it being able to run. But I have found a way to run Yuzu as admin, without UAC prompt and with an exit script. First I added an "Yuzu Admin" emulator to LaunchBox. This is just an AutoHotKey script. When I start a Switch game in LaunchBox, LaunchBox passes the rom name to this "Yuzu Admin" script. This "Yuzu Admin" script then copies the rom name to a second script and after that the second script gets executed as a scheduled task with admin privileges. So that second script is elevated and starts Yuzu with command-line parameters and rom name. Also that second script contains the Yuzu exit script so I can exit Yuzu with Escape. All this is a bit complicated and maybe there are easier ways to accomplice the same. Quote Link to comment Share on other sites More sharing options...
Aevans0001 Posted September 16, 2021 Share Posted September 16, 2021 (edited) On 8/8/2021 at 7:35 AM, Koroth said: No, I don't think that it has changed. But of course you don't NEED Yuzu to run as admin for it being able to run. But I have found a way to run Yuzu as admin, without UAC prompt and with an exit script. First I added an "Yuzu Admin" emulator to LaunchBox. This is just an AutoHotKey script. When I start a Switch game in LaunchBox, LaunchBox passes the rom name to this "Yuzu Admin" script. This "Yuzu Admin" script then copies the rom name to a second script and after that the second script gets executed as a scheduled task with admin privileges. So that second script is elevated and starts Yuzu with command-line parameters and rom name. Also that second script contains the Yuzu exit script so I can exit Yuzu with Escape. All this is a bit complicated and maybe there are easier ways to accomplice the same. @Korothcan you send the contents of your script here? Edited September 16, 2021 by Aevans0001 Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted September 16, 2021 Share Posted September 16, 2021 (edited) 6 hours ago, Aevans0001 said: can you send the contents of your script here? The way I found to run Yuzu as admin from LaunchBox without UAC prompt is convoluted and takes a few steps. 1. Create a new text file and copy/paste the below script to that text file. Save the text file as Yuzu_Admin.ahk (so with an .ahk file extension.) #NoEnv #SingleInstance SetTitleMatchMode, 2 SetWorkingDir %A_ScriptDir% FileRead, YuzuLauncherTempFile, YuzuLauncher_Default.ahk StringReplace, YuzuLauncherTempFile, YuzuLauncherTempFile, RomFile, %1% FileDelete, YuzuLauncher.ahk FileAppend, %YuzuLauncherTempFile%, YuzuLauncher.ahk Run, C:\Windows\System32\schtasks.exe /run /tn "Yuzu Admin" Process, Wait, yuzu.exe Process, WaitClose, yuzu.exe ExitApp 2. In LaunchBox create an emulator. For example Yuzu Admin. In the "Emulator Application Path" point to AutoHotkey.exe in LaunchBox\ThirdParty\AutoHotkey. In the "Default Command-line Parameters" field add the path to the Yuzu_Admin.ahk script between double quotes. 3. Create a new text file and copy/paste the below script to that text file. Save the text file as YuzuLauncher_Default.ahk (so with an .ahk file extension.) Make sure the created scripts (Yuzu_Admin.ahk and YuzuLauncher_Default.ahk) are in the same folder. #NoEnv #SingleInstance SetTitleMatchMode, 3 SetWorkingDir %A_ScriptDir% Game = RomFile Run, %A_WorkingDir%\yuzu\yuzu-windows-msvc\yuzu.exe -f -g "%Game%" Process, Wait, yuzu.exe Process, WaitClose, yuzu.exe ExitApp $Esc:: { WinClose, ahk_exe yuzu.exe ExitApp } Before we continue, first an explanation of what the scripts do. The Yuzu_Admin.ahk we added to LaunchBox as an emulator, in the first part takes the YuzuLauncher_Default.ahk script and adds the rom name and file path then saves the script as YuzuLauncher.ahk. The second part starts the Windows Task Scheduler task we yet have to create. The by YuzuLauncher_Default.ahk script created YuzuLauncher.ahk script is what we are going to add as a Windows Task Scheduler task and is executed with admin privileges. It starts Yuzu with the -f -g command-line parameters and the path to the rom file. It also has the LaunchBox exit script for Yuzu in it. 4. Then create a Windows Task Scheduler task. I am not going in to the details right now how to create a scheduled task because I assume you know how to do that. In the "Application Path" of the task point to LaunchBox\ThirdParty\AutoHotkey\AutoHotkey.exe and in the command-line field add the path to YuzuLauncher.ahk between double quotes. (in my case "E:\LaunchBox\Emulators\Nintendo Switch\YuzuLauncher.ahk"). Make sure to tick "Run Task with highest priority". Then go back to the Yuzu_Admin.ahk script and in the line: Run, C:\Windows\System32\schtasks.exe /run /tn "Yuzu Admin" replace Yuzu Admin with the name of your task. Of course you must set up your Switch games to use the "Yuzu Admin" emulator. *Note* I don't intend this write-up as a guide. More a proof of concept because in my opinion something like this is more for advanced users. The scripts reference script names: (Yuzu_Admin.ahk and YuzuLauncher_Default.ahk) so when copy/paste/saving the scripts, you HAVE to save them with those names. Anywhere a path is mentioned (in setting it up in LaunchBox or the scripts themselves), the paths must be edited to reflect your setup. *Note 2* All this is to run an emulator (Yuzu in this case) with Admin Privileges, no UAC prompt and still being able to exit the emulator with Escape from LaunchBox while LaunchBox provides the rom names and file paths. Because this setup right here is quite convoluted, I am curious if someone knows of an easier way. *Edit* TLDR: Add a script to LaunchBox as an emulator that passes the rom name and file paths to a second script. The second script starts the emulator with those rom names and file paths, but is added to the Windows Task Scheduler to be executed with admin privileges. Edited September 16, 2021 by Koroth 2 Quote Link to comment Share on other sites More sharing options...
Your Friendly A.I Overlord Posted September 16, 2021 Share Posted September 16, 2021 I feel like adding one more bit of information for some further explanation. Yuzu_Admin.ahk (which I added as an emulator to LaunchBox) takes the YuzuLauncher_Default.ahk script and in the line "Game = RomFile" replaces "RomFile" with the path to your rom file. Then it saves the script as YuzuLauncher.ahk. After launching a game, YuzuLauncher.ahk would look like this: #NoEnv #SingleInstance SetTitleMatchMode, 3 SetWorkingDir %A_ScriptDir% Game = H:\Roms\Nintendo Switch\Crash Team Racing Nitro-Fueled (USA)\Crash Team Racing Nitro-Fueled.nsp Run, %A_WorkingDir%\yuzu\yuzu-windows-msvc\yuzu.exe -f -g "%Game%" Process, Wait, yuzu.exe Process, WaitClose, yuzu.exe ExitApp $Esc:: { WinClose, ahk_exe yuzu.exe ExitApp } When launching another game, YuzuLauncher.ahk is deleted. Then Yuzu_Admin.ahk (which I added as an emulator to LaunchBox) takes the YuzuLauncher_Default.ahk script again and replaces "RomFile" with the new path to your rom file and saves it as YuzuLauncher.ahk. And so on. 1 Quote Link to comment Share on other sites More sharing options...
ArcadeBaron Posted October 17, 2022 Share Posted October 17, 2022 This worked for me also! Thank you, my dude. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.