@echo off
color 0A
title verify_GAME.bat
CD /d "%~dp0"
if not exist hactool.exe echo :: Place hactool.exe in folder with verify_GAME.bat!
if not exist hactool.exe echo.
if not exist hactool.exe pause
if not exist hactool.exe exit
if not exist keys.txt echo :: Place Keys.txt in folder with verify_GAME.bat!
if not exist keys.txt echo.
if not exist keys.txt pause
if not exist keys.txt exit
if exist temp.txt del temp.txt
if "%~x1"==".nca" goto nca
if exist NCA_files RD /S /Q NCA_files
set file="%~1"
if "%~x1"==".xci" goto xci
if not "%~x1"==".nsp" echo :: Drag only XCI, NSP, or NCA files onto verify_GAME.bat!
if not "%~x1"==".nsp" echo.
if not "%~x1"==".nsp" pause
if not "%~x1"==".nsp" exit
hactool -k keys.txt -t pfs0 -x --outdir=NCA_files %file%
cls
goto dun
:xci
hactool -k keys.txt -t xci -x --securedir=NCA_files %file%
cls
:dun
for %%I in ("NCA_files\*.nca") do set nca=%%I& set nca2=%%~nxI& call :sub
if exist NCA_files RD /S /Q NCA_files
if exist temp.txt del temp.txt
echo.
certUtil -hashfile "%~dpnx1" MD5 >temp.txt
(
set /p var1=
set /p MD5=
)<temp.txt
echo ------------------------------------------------------------------------------------------------------------------------
echo.
echo :: %~nx1
echo :: MD5: %MD5%
echo.
echo ------------------------------------------------------------------------------------------------------------------------
if exist temp.txt del temp.txt
echo.
pause
if not exist verify_GAME.bat findstr "verify_GAME.bat" *.bat>log.txt
if exist verify_GAME.bat goto skippy
(
set /P bat=
)<log.txt
del log.txt
set nbat=%bat:~0,-22%
ren "%nbat%" verify_GAME.bat
:skippy
exit
:sub
if exist temp.txt del temp.txt
hactool -k keys.txt -t nca --verify %nca% >temp.txt 2>&1
if "%skip%"=="yes" goto skip
echo.
echo :: Checking if game contains Original files!
echo ------------------------------------------
set skip=yes
:skip
echo.
findstr /I /C:"Fixed-Key Signature (GOOD)" temp.txt >nul 2>&1
if "%errorlevel%"=="0" echo :: Fixed-Key Signature (GOOD) - %nca2%& echo :: This NCA file is Original!& goto :eof
echo :: Fixed-Key Signature (FAIL) - %nca2%
echo :: NCA file has been Modified. Use at your own risk!
goto :eof
:nca
for %%I in ("%~dp1*.nca") do set nca=%%I& set nca2=%%~nxI& call :sub
if exist NCA_files RD /S /Q NCA_files
if exist temp.txt del temp.txt
echo.
pause
if not exist verify_GAME.bat findstr "verify_GAME.bat" *.bat>log.txt
if exist verify_GAME.bat goto skippy1
(
set /P bat=
)<log.txt
del log.txt
set nbat=%bat:~0,-22%
ren "%nbat%" verify_GAME.bat
:skippy1
exit