commit 1c017ace32532dfabc0817e66a028304429904cd Author: Sheldon Lee Date: Sat Jul 16 21:04:30 2022 +0800 Initial commit. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6cefd3f --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Unlock FPS batch file for An Anime Game Launcher. + +This is my own modification of the batch file adapted from [this batch file](https://aagl.launcher.moe/dl/unlockfps.bat), and the ``launcher.bat`` found in [this repo][Krock/dawn], where the former is a modification of the latter. + +AAGL was updated to use a more recent version of [this][fps-unlock], so this batch file is adapted for this. + +# Installation and use + +To install this, put the unlockfps.bat file into the root of your game directory, where ``launcher.bat`` is also found. + +The game root directory is found in your wineprefix: +``` +WINEPREFIX/drive_c/Program Files/GAMEROOT +``` +Substitute WINEPREFIX and GAMEROOT with your AAGL installation's wine prefix, and your game's root directory accordingly. + +Example wineprefix location: +``` +~/.local/share/anime-game-launcher/game +``` + +## Related projects + +[An Anime Game Launcher]: https://notabug.org/Krock/dawn.git +[Krock/dawn]: https://notabug.org/Krock/dawn.git +[fps-unlock]: https://github.com/34736384/genshin-fps-unlock diff --git a/unlockfps.bat b/unlockfps.bat new file mode 100644 index 0000000..dc8f287 --- /dev/null +++ b/unlockfps.bat @@ -0,0 +1,68 @@ +@echo off + +REM Notice: This file is overwritten for each patch for safety reasons. +REM Hence, any manual changes will be overwritten by the next patch. + +REM ============ AVOID CHANGES HERE ============ + +SET perr1=1 +SET perr2=1 +SET perr=0 + +REM Verify that the important hosts are blocked +setlocal EnableDelayedExpansion +FOR /f "delims=" %%i IN ('ping -n 1 -w 1 log-upload-os.hoyoverse.com') DO ( + echo %%i | find "[0.0.0.0]" >nul + IF !ERRORLEVEL! EQU 0 SET "perr1=0" + echo %%i | find "could not find host" >nul + IF !ERRORLEVEL! EQU 0 SET "perr1=0" +) +FOR /f "delims=" %%i IN ('ping -n 1 -w 1 overseauspider.yuanshen.com') DO ( + echo %%i | find "[0.0.0.0]" >nul + IF !ERRORLEVEL! EQU 0 SET "perr2=0" + echo %%i | find "could not find host" >nul + IF !ERRORLEVEL! EQU 0 SET "perr2=0" +) + +REM There's no OR operator for "IF" +IF %perr1% EQU 1 SET perr=1 +IF %perr2% EQU 1 SET perr=1 + +IF %perr% NEQ 0 ( + REM Show the message to the user + echo ERROR: Crucial domains are not blocked. Please re-run the patch script. >_error.txt + notepad _error.txt + del _error.txt + exit +) + +REM Emulate the games behaviour +copy mhyprot2.sys "%TEMP%\" +regedit mhyprot2_running.reg + +REM Disable crash reporting +IF EXIST GenshinImpact_Data\upload_crash.exe ( + move "GenshinImpact_Data\upload_crash.exe" "GenshinImpact_Data\upload_crash.exe.bak" +) +IF EXIST GenshinImpact_Data\Plugins\crashreport.exe ( + move "GenshinImpact_Data\Plugins\crashreport.exe" "GenshinImpact_Data\Plugins\crashreport.exe.bak" +) + +REM cd into fpsunlock directory, so it doesn't execute in same working directory as Genshin, otherwise it will complain. + +set "your_dir=..\fpsunlock" +pushd %cd% +cd %your_dir% +start unlockfps.exe %* + +REM Only start first time, so unlockfps can detect game location. Subsequent launches can be done from unlockfps's GUI or it's autostart. +IF NOT EXIST fps_config.json ( + popd + start GenshinImpact.exe %* +) + +REM This is a check for the old file generated by an older version of unlockfps + +REM IF NOT EXIST fps_config.ini ( +REM start GenshinImpact.exe %* +REM )