From ccc2a8ec433ef95464558f3c135ba49b4f047b41 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 21 Aug 2024 00:39:56 +0200 Subject: [PATCH] Revert "no need admin rights for starting obs" This reverts commit d22e489a95f100d1e9a08f9afe36bf9cdf26a98f. --- Makefile | 1 + windows/start_obs_as_shadowplay.bat | 19 +++++++++++++++++++ windows11.bat | 13 ++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 windows/start_obs_as_shadowplay.bat diff --git a/Makefile b/Makefile index f8a760b..d9f5cc2 100644 --- a/Makefile +++ b/Makefile @@ -193,6 +193,7 @@ sync-windows: @$(WGET) $(REPO_SRC)/windows/installers/vencord.bat -O $(WIN_HOME)/Documents/Local/vencord_installer.bat @$(WGET) $(REPO_SRC)/windows/fix_nvidia_wsl.bat -O $(WIN_HOME)/Documents/Local/fix_nvidia_wsl.bat @$(WGET) $(REPO_SRC)/windows/fix_mihoyo_shortcut.bat -O $(WIN_HOME)/Documents/Local/fix_mihoyo_shortcut.bat + @$(WGET) $(REPO_SRC)/windows/start_obs_as_shadowplay.bat -O $(LOCALAPPDATA)/start_obs_as_shadowplay.bat @echo "$(WIN) Scripts synced!" @echo diff --git a/windows/start_obs_as_shadowplay.bat b/windows/start_obs_as_shadowplay.bat new file mode 100644 index 0000000..367a55e --- /dev/null +++ b/windows/start_obs_as_shadowplay.bat @@ -0,0 +1,19 @@ +@ECHO OFF + +:: Start as administrator +fltmc >NUL 2>&1 || ( + PowerShell Start -Verb RunAs '%0' 2>NUL || ( + EXIT 1 + ) + EXIT 0 +) + +:: Working directory +CD "%ProgramFiles%\obs-studio\bin\64bit" + +:: Run OBS +START "OBS Shadowplay batch wrapper" ^ + obs64.exe --portable --minimize-to-tray --disable-missing-files-check ^ + --profile "ReplayBuffer" --scene "ReplayBuffer" --startreplaybuffer + +EXIT /B diff --git a/windows11.bat b/windows11.bat index c706826..abbffd5 100644 --- a/windows11.bat +++ b/windows11.bat @@ -374,13 +374,12 @@ PowerShell -Command "Invoke-WebRequest -Uri !repo!/.config/obs/basic/profiles/Re PowerShell -Command "Invoke-WebRequest -Uri !repo!/.config/obs/basic/scenes/ReplayBuffer.json -OutFile '%ProgramFiles%\obs-studio\config\obs-studio\basic\scenes\ReplayBuffer.json'" :: Setup the autostart of shadowplay -PowerShell -Command "$WshShell = New-Object -COM WScript.Shell;" ^ - "$Shortcut = $WshShell.CreateShortcut('%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\OBS.lnk');" ^ - "$Shortcut.TargetPath = '%ProgramFiles%\obs-studio\bin\64bit\obs64.exe';" ^ - "$Shortcut.WorkingDirectory = '%ProgramFiles%\obs-studio\bin\64bit';" ^ - "$Shortcut.Arguments = '--portable --minimize-to-tray --disable-missing-files-check " ^ - "--profile ""ReplayBuffer"""" --scene ""ReplayBuffer"""" --startreplaybuffer';" ^ - "$Shortcut.Save()" +SCHTASKS /Create /TN "OBS Shadowplay" ^ + /TR "'%LOCALAPPDATA%\start_obs_as_shadowplay.bat'" ^ + /SC ONLOGON ^ + /RU "%USERNAME%" ^ + /RL HIGHEST ^ + /F :: Allow system to go in sleep mode when OBS is running POWERCFG /REQUESTSOVERRIDE PROCESS obs64.exe DISPLAY SYSTEM AWAYMODE