Advertisement
FoddEx

LightWeight Mod Switcher

Sep 15th, 2015
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 25.01 KB | None | 0 0
  1. :restart
  2.  
  3.  
  4. ::  ******************************************************
  5. ::  *    LIGHTWEIGHT GRAND THEFT AUTO V  MOD SWITCHER    *
  6. ::  *                         By                         *
  7. ::  *                      RainBawZ                      *
  8. ::  *                SocialClub: kukpappa                *
  9. ::      *                 --NO AUTO-UPDATE--                 *
  10. ::  ******************************************************
  11.  
  12.  
  13.     setlocal enabledelayedexpansion
  14.     mode con cols=100 lines=50
  15.     set curfile=gtavms.bat
  16.     set dbg=0
  17.     set force=0
  18.     set single=0
  19.     set break=0
  20.     if /i "%1"=="debug" (
  21.         @Echo on
  22.         set dbg=1
  23.         prompt GTAVMS CODE EXECUTION$S$G$G$S
  24.         if /i "%2"=="force" (
  25.             set force=1
  26.         )
  27.     ) else (
  28.         @Echo off
  29.     )
  30.     if /i "%1"=="force" (
  31.         set force=1
  32.     )
  33.     title GTA V Mod Switcher [v!version!]
  34.     color 8F
  35.     for /F "tokens=1,2 delims=#" %%A in ('"prompt #$H#$E# & echo on & for %%B in (1) do rem"') do (
  36.         set "DEL=%%A"
  37.     )
  38.     set protected=bink2w64.dll,common.rpf,d3dcompiler_46.dll,d3dcsx_46.dll,GFSDK_ShadowLib.win64.dll,GFSDK_TXAA.win64.dll,GFSDK_TXAA_AlphaResolve.win64.dll,GTA5.exe,GTAVLauncher.exe,installscript.vdf,steam_api64.dll,x64a.rpf,x64b.rpf,x64c.rpf,x64d.rpf,x64e.rpf,x64f.rpf,x64g.rpf,x64h.rpf,x64i.rpf,x64j.rpf,x64k.rpf,x64l.rpf,x64m.rpf,x64n.rpf,x64o.rpf,x64p.rpf,x64q.rpf,x64r.rpf,x64s.rpf,x64t.rpf,x64u.rpf,x64v.rpf,x64w.rpf,update\update.rpf,update\x64\metadata.dat,update\x64\data\errorcodes\american.txt,update\x64\data\errorcodes\chinese.txt,update\x64\data\errorcodes\french.txt,update\x64\data\errorcodes\german.txt,update\x64\data\errorcodes\italian.txt,update\x64\data\errorcodes\japanese.txt,update\x64\data\errorcodes\korean.txt,update\x64\data\errorcodes\mexican.txt,update\x64\data\errorcodes\polish.txt,update\x64\data\errorcodes\portuguese.txt,update\x64\data\errorcodes\russian.txt,update\x64\data\errorcodes\spanish.txt,update\x64\dlcpacks\mpchristmas2\dlc.rpf,update\x64\dlcpacks\mpheist\dlc.rpf,update\x64\dlcpacks\mpluxe\dlc.rpf,update\x64\dlcpacks\mpluxe2\dlc.rpf,update\x64\dlcpacks\mppatcheseng\dlc.rpf,update\x64\dlcpacks\patchday1ng\dlc.rpf,update\x64\dlcpacks\patchday2bng\dlc.rpf,update\x64\dlcpacks\patchday2ng\dlc.rpf,update\x64\dlcpacks\patchday3ng\dlc.rpf,update\x64\dlcpacks\patchday4ng\dlc.rpf,update\x64\dlcpacks\patchday5ng\dlc.rpf,x64\metadata.dat,x64\audio\audio_rel.rpf,x64\audio\occlusion.rpf,x64\audio\sfx\ANIMALS.rpf,x64\audio\sfx\ANIMALS_FAR.rpf,x64\audio\sfx\ANIMALS_NEAR.rpf,x64\audio\sfx\CUTSCENE_MASTERED_ONLY.rpf,x64\audio\sfx\DLC_GTAO.rpf,x64\audio\sfx\INTERACTIVE_MUSIC.rpf,x64\audio\sfx\ONESHOT_AMBIENCE.rpf,x64\audio\sfx\PAIN.rpf,x64\audio\sfx\POLICE_SCANNER.rpf,x64\audio\sfx\PROLOGUE.rpf,x64\audio\sfx\RADIO_01_CLASS_ROCK.rpf,x64\audio\sfx\RADIO_02_POP.rpf,x64\audio\sfx\RADIO_03_HIPHOP_NEW.rpf,x64\audio\sfx\RADIO_04_PUNK.rpf,x64\audio\sfx\RADIO_05_TALK_01.rpf,x64\audio\sfx\RADIO_06_COUNTRY.rpf,x64\audio\sfx\RADIO_07_DANCE_01.rpf,x64\audio\sfx\RADIO_08_MEXICAN.rpf,x64\audio\sfx\RADIO_09_HIPHOP_OLD.rpf,x64\audio\sfx\RADIO_11_TALK_02.rpf,x64\audio\sfx\RADIO_12_REGGAE.rpf,x64\audio\sfx\RADIO_13_JAZZ.rpf,x64\audio\sfx\RADIO_14_DANCE_02.rpf,x64\audio\sfx\RADIO_15_MOTOWN.rpf,x64\audio\sfx\RADIO_16_SILVERLAKE.rpf,x64\audio\sfx\RADIO_17_FUNK.rpf,x64\audio\sfx\RADIO_18_90S_ROCK.rpf,x64\audio\sfx\RADIO_ADVERTS.rpf,x64\audio\sfx\RADIO_NEWS.rpf,x64\audio\sfx\RESIDENT.rpf,x64\audio\sfx\S_FULL_AMB_F.rpf,x64\audio\sfx\S_FULL_AMB_M.rpf,x64\audio\sfx\S_FULL_GAN.rpf,x64\audio\sfx\S_FULL_SER.rpf,x64\audio\sfx\S_MINI_AMB.rpf,x64\audio\sfx\S_MINI_GAN.rpf,x64\audio\sfx\S_MINI_SER.rpf,x64\audio\sfx\S_MISC.rpf,x64\audio\sfx\SCRIPT.rpf,x64\audio\sfx\SS_AC.rpf,x64\audio\sfx\SS_DC.rpf,x64\audio\sfx\SS_FF.rpf,x64\audio\sfx\SS_GM.rpf,x64\audio\sfx\SS_NP.rpf,x64\audio\sfx\SS_QR.rpf,x64\audio\sfx\SS_ST.rpf,x64\audio\sfx\SS_UZ.rpf,x64\audio\sfx\STREAMED_AMBIENCE.rpf,x64\audio\sfx\STREAMED_VEHICLES.rpf,x64\audio\sfx\STREAMED_VEHICLES_GRANULAR.rpf,x64\audio\sfx\STREAMED_VEHICLES_GRANULAR_NPC.rpf,x64\audio\sfx\STREAMED_VEHICLES_LOW_LATENCY.rpf,x64\audio\sfx\STREAMS.rpf,x64\audio\sfx\WEAPONS_PLAYER.rpf
  39.     set rootDrive="%~d0"
  40.     cls
  41.     if !dbg!==1 (
  42.         del /q GTAVMS_debug.bat > nul
  43.     )
  44.     Echo Initializing GTAV Mod Switcher...
  45.     Echo.
  46.     if not exist GTAVMS_debug.bat (
  47.         Echo     Creating debug script...
  48.         Echo @Echo off > GTAVMS_debug.bat
  49.         Echo setlocal enabledelayedexpansion >> GTAVMS_debug.bat
  50.         Echo for /F "tokens=1,2 delims=#" %%%%A in ^('"prompt #$H#$E# & echo on & for %%%%B in (1) do rem"'^) do ^( >> GTAVMS_debug.bat
  51.         Echo     set "DEL=%%%%A" >> GTAVMS_debug.bat
  52.         Echo ^) >> GTAVMS_debug.bat
  53.         Echo color 8C >> GTAVMS_debug.bat
  54.         Echo call :clr 8F " ***DEBUGGER*** " >> GTAVMS_debug.bat
  55.         Echo Echo. >> GTAVMS_debug.bat
  56.         Echo call :clr 89 "*COLLECTING DATA. Please wait...*" >> GTAVMS_debug.bat
  57.         Echo call :clr 8F "----------" >> GTAVMS_debug.bat
  58.         Echo call :clr 8C "Error log:" >> GTAVMS_debug.bat
  59.         Echo call gtavms debug force ^>gtavms_debug_log.log >> GTAVMS_debug.bat
  60.         Echo @Echo off >> GTAVMS_debug.bat
  61.         Echo call :clr 8F "----------" >> GTAVMS_debug.bat
  62.         Echo call :clr 8A "*DONE*" >> GTAVMS_debug.bat
  63.         Echo pause ^> nul >> GTAVMS_debug.bat
  64.         Echo exit >> GTAVMS_debug.bat
  65.         Echo :clr >> GTAVMS_debug.bat
  66.         Echo ^<nul ^> X set /p ".=." >> GTAVMS_debug.bat
  67.         Echo set "param=^^%%^~2" ^^! >> GTAVMS_debug.bat
  68.         Echo set "param=^!param:"=^\"^!" >> GTAVMS_debug.bat
  69.         Echo findstr /p /A:%%1 "." "^!param^!\..\X" nul >> GTAVMS_debug.bat
  70.         Echo ^<nul set /p ".=%%DEL%%%%DEL%%%%DEL%%%%DEL%%%%DEL%%%%DEL%%%%DEL%%" >> GTAVMS_debug.bat
  71.         Echo del /q X ^> nul >> GTAVMS_debug.bat
  72.         Echo Echo. >> GTAVMS_debug.bat
  73.         Echo exit /b >> GTAVMS_debug.bat
  74.         call :ColorMsg 8A "        OK"
  75.         Echo.      
  76.     )
  77.     Echo     Querying registry for GTAVMS version...
  78.     reg query HKCU\Software\FoddEx\GTAVMS /v version > nul
  79.     if !errorlevel!==1 (
  80.         call :ColorMsg 8E "        No entry. Adding..."
  81.         set version=1.5.1
  82.         reg add HKCU\Software\FoddEx\GTAVMS /f /v version /t REG_SZ /d "!version!" > nul
  83.         call :ColorMsg 8A "             OK"
  84.     ) else (
  85.         for /f "tokens=2* skip=2" %%A in ('reg query HKCU\Software\FoddEx\GTAVMS /v version') do (
  86.             set version=%%B
  87.         )
  88.         call :ColorMsg 8A "        OK"
  89.     )
  90.     Echo.
  91.     Echo     Setting title...
  92.     title GTA V Mod Switcher [v!version!]
  93.     call :ColorMsg 8A "        OK"
  94.     Echo.
  95.    
  96. :pre.cnt
  97.     Echo     Checking GTA5 process...
  98.     tasklist /fi "IMAGENAME eq GTA5.exe" | find /i "GTA5.exe" > nul
  99.     if !errorlevel!==0 (
  100.         cls
  101.         call :ColorMsg 8C "GTA V is running."
  102.         Echo.
  103.         Echo Modifying game files while the game is running
  104.         Echo might affect game behavior and gameplay.
  105.         Echo.
  106.         Echo Press any key to continue.
  107.         if !force!==0 pause > nul
  108.         cls
  109.     )
  110.     call :ColorMsg 8A "        OK"
  111.     Echo.
  112.     if not !search!==1 (
  113.         Echo     Querying registry for GTA path...
  114.         reg query HKCU\Software\FoddEx\GTAVMS /v path > nul
  115.     ) else (
  116.         set errorlevel=1
  117.     )
  118.     if !errorlevel!==1 (
  119.         cls
  120.         Echo Locating Grand Theft Auto V installation. Please be patient...
  121.         Echo NOTE: The duration may vary depending on the size of your
  122.         Echo file system and number of disks.
  123.         Echo.
  124.         for /f "tokens=2 delims==" %%Z in ('wmic logicaldisk get name /value') do (
  125.             Echo **%%Z**>tmp
  126.             for /f %%C in (tmp) do (
  127.                 set disk=%%C
  128.                 set disk=!disk:~2,-3!
  129.                 Echo Searching !disk!\ drive...
  130.                 del /q tmp > nul
  131.                 for /f "tokens=*" %%A in ('dir "!disk!\GTA5.exe" /b /s 2^> nul') do (
  132.                     for /f "tokens=*" %%I in ("%%A") do (
  133.                         set pDrive=%%~dI
  134.                         set pPath=%%~pI
  135.                         Echo.
  136.                         call :ColorMsg 89 "    GTA V.exe file:   %%I"
  137.                         call :ColorMsg 89 "    Disk:              !pDrive!"
  138.                         call :ColorMsg 89 "    Disk location:     !pPath!"
  139.                         Echo.
  140.                         Echo Is this correct? Y/N
  141.                         if !force!==1 (
  142.                             Echo END
  143.                             endlocal
  144.                             exit /b
  145.                         )
  146.                         set /p conf=">> "
  147.                         if /i "!conf!"=="Y" (
  148.                             set gtaPath=!pDrive!!pPath!
  149.                             if exist "!gtaPath!" (
  150.                                 reg add HKCU\Software\FoddEx\GTAVMS /f /v path /t REG_SZ /d "!gtaPath!" > nul
  151.                                 if "%%~dI"=="!rootDrive!" (
  152.                                     cd "%%~dpI"
  153.                                 ) else (
  154.                                     cd /d "%%~dpI"
  155.                                 )
  156.                                 cd..
  157.                                 goto search.break
  158.                             ) else (
  159.                                 call :ColorMsg 8C "An unknown error occurred."
  160.                                 if !force!==0 pause > nul
  161.                                 endlocal
  162.                                 exit /b
  163.                             )
  164.                         )
  165.                     )
  166.                 )
  167.             )
  168.             call :ColorMsg 8C "    Done. No result"
  169.             Echo.
  170.         )
  171.     ) else (
  172.         for /f "tokens=2* skip=2" %%A in ('reg query HKCU\Software\FoddEx\GTAVMS /v path') do (
  173.             set gtaPath=%%B
  174.             if exist "!gtaPath!" (
  175.                 for /f "tokens=*" %%C in ("!gtaPath!") do (
  176.                     if "!_drive!"=="!rootDrive!" (
  177.                         cd "%%C"
  178.                     ) else (
  179.                         cd /d "%%C"
  180.                     )
  181.                     cd..
  182.                 )
  183.                 call :ColorMsg 8A "        OK"
  184.                 goto search.break
  185.             )
  186.             call :ColorMsg 8C "Registry value "HKCU\Software\FoddEx\GTAVMS\path" contains invalid data."
  187.             Echo.
  188.             goto manualPath
  189.         )
  190.     )
  191.    
  192. :manualPath
  193.     Echo Unable to locate Grand Theft Auto V on your computer.
  194.     Echo Please enter the path manually.
  195.     if !force!==1 (
  196.         Echo END
  197.         endlocal
  198.         exit /b
  199.     )
  200.     set /p gtaPath="Path: "
  201.     if not exist "!gtaPath!\GTA5.exe" (
  202.         call :ColorMsg 8C "!gtaPath! is not a valid path."
  203.         timeout /t 3 > nul
  204.         cls
  205.         goto manualPath
  206.     ) else (
  207.         reg add HKCU\Software\FoddEx\GTAVMS /f /v path /t REG_SZ /d "!gtaPath!" > nul
  208.         goto search.break
  209.     )
  210.    
  211. :reset
  212.  
  213. :search.break
  214.     timeout /t 1 > nul
  215.     set "curDir=%cd%"
  216.     if not exist "Grand Theft Auto V\GTA5.exe" (
  217.         cls
  218.         call :ColorMsg 8C "An error occurred."
  219.         if !dbg!==1 (
  220.             Echo.
  221.             Echo ERROR: GTA5.EXE not found in "%cd%"
  222.         )
  223.         Echo.
  224.         Echo Press any key to run a new search.
  225.         if !force!==0 pause > nul
  226.         reg delete HKCU\Software\FoddEx\GTAVMS /v /f path > nul
  227.         cls
  228.         endlocal
  229.         set search=1
  230.         goto restart
  231.     )
  232.     set "gtaBin=Grand Theft Auto V"
  233.     if not exist GTAVmodBin (
  234.         mkdir GTAVmodBin
  235.     )
  236.     set modBin=GTAVmodBin
  237.    
  238. :analyze
  239.     set asiList=
  240.     set ModAsiList=
  241.     set dllList=
  242.     set ModDllList=
  243.     set txtList=
  244.     set ModTxtList=
  245.     set asiCount=0
  246.     set ModAsiCount=0
  247.     set dllCount=0
  248.     set ModDllCount=0
  249.     set txtCount=0
  250.     set ModTxtCount=0
  251.     cls
  252.     Echo Analyzing Mods directory...
  253.     for /f %%A in ('dir /b "!modBin!\*.asi" 2^> nul') do (
  254.         set /a ModAsiCount=!ModAsiCount!+1
  255.         set ModAsiList=!ModAsiList!,%%A
  256.     )
  257.     Echo     Found !ModAsiCount! .asi files.
  258.     Echo.
  259.     for /f %%A in ('dir /b "!modBin!\*.dll" 2^> nul') do (
  260.         set /a ModDllCount=!ModDllCount!+1
  261.         set ModDllList=!ModDllList!,%%A
  262.     )
  263.     Echo     Found !ModDllCount! .dll files.
  264.     Echo.
  265.     for /f %%A in ('dir /b "!modBin!\*.txt" 2^> nul') do (
  266.         set /a ModTxtCount=!ModTxtCount!+1
  267.         set ModTxtList=!ModTxtList!,%%A
  268.     )
  269.     for /f %%A in ('dir /b "!modBin!\*.ini" 2^> nul') do (
  270.         set /a ModTxtCount=!ModTxtCount!+1
  271.         set ModTxtList=!ModTxtList!,%%A
  272.     )
  273.     for /f %%A in ('dir /b "!modBin!\*.inf" 2^> nul') do (
  274.         set /a ModTxtCount=!ModTxtCount!+1
  275.         set ModTxtList=!ModTxtList!,%%A
  276.     )
  277.     for /f %%A in ('dir /b "!modBin!\*.cfg" 2^> nul') do (
  278.         set /a ModTxtCount=!ModTxtCount!+1
  279.         set ModTxtList=!ModTxtList!,%%A
  280.     )
  281.     Echo     Found !ModTxtCount! mod related plain-text files.
  282.     Echo.
  283.     if exist !modBin!\scripts (
  284.         Echo     Found scripts folder for .NET mods.
  285.         Echo.
  286.     )
  287.     Echo ----------
  288.     Echo Analyzing GTA V directory...
  289.     for /f %%A in ('dir /b "!gtaBin!\*.asi" 2^> nul') do (
  290.         set /a asiCount=!asiCount!+1
  291.         set asiList=!asiList!,%%A
  292.     )
  293.     Echo     Found !asiCount! .asi files.
  294.     Echo.
  295.     for /f %%A in ('dir /b "!gtaBin!\*.dll" 2^> nul') do (
  296.         if not %%A==bink2w64.dll (
  297.             if not %%A==d3dcompiler_46.dll (
  298.                 if not %%A==GFSDK_ShadowLib.win64.dll (
  299.                     if not %%A==GFSDK_TXAA.win64.dll (
  300.                         if not %%A==GFSDK_TXAA_AlphaResolve.win64.dll (
  301.                             if not %%A==steam_api64.dll (
  302.                                 if not %%A==d3dcsx_46.dll (
  303.                                     set /a dllCount=!dllCount!+1
  304.                                     set dllList=!dllList!,%%A
  305.                                 )
  306.                             )
  307.                         )
  308.                     )
  309.                 )
  310.             )
  311.         )
  312.     )
  313.     Echo     Found !dllCount! non standard .dll files.
  314.     Echo.
  315.     for /f %%A in ('dir /b "!gtaBin!\*.txt" 2^> nul') do (
  316.         set /a txtCount=!txtCount!+1
  317.         set txtList=!txtList!,%%A
  318.     )
  319.     for /f %%A in ('dir /b "!gtaBin!\*.ini" 2^> nul') do (
  320.         set /a txtCount=!txtCount!+1
  321.         set txtList=!txtList!,%%A
  322.     )
  323.     for /f %%A in ('dir /b "!gtaBin!\*.inf" 2^> nul') do (
  324.         set /a txtCount=!txtCount!+1
  325.         set txtList=!txtList!,%%A
  326.     )
  327.     for /f %%A in ('dir /b "!gtaBin!\*.cfg" 2^> nul') do (
  328.         set /a txtCount=!txtCount!+1
  329.         set txtList=!txtList!,%%A
  330.     )
  331.     Echo     Found !txtCount! mod related plain-text files.
  332.     Echo.
  333.     if exist !gtaBin!\scripts (
  334.         Echo     Found scripts folder for .NET mods.
  335.         Echo.
  336.     )
  337.     Echo.
  338.     Echo Done.
  339.     timeout /t 2 > nul
  340.     goto main
  341.    
  342. :main
  343.     set modActive=0
  344.     set modInactive=0
  345.     cls
  346.     call :ColorMsg 89 "Active mods:"
  347.     if exist !gtaBin!\NativeTrainer.asi (
  348.         call :ColorMsg 8A "    -Native Trainer [NativeTrainer.asi]"
  349.         Echo.
  350.         set modActive=1
  351.     )
  352.     if exist !gtaBin!\ScriptHookV.dll (
  353.         call :ColorMsg 8A "    -Script Hook V [ScriptHookV.dll]"
  354.         Echo.
  355.         set modActive=1
  356.     )
  357.     if exist !gtaBin!\OpenIV.asi (
  358.         call :ColorMsg 8A "    -OpenIV ASI Loader [OpenIV.asi]"
  359.         Echo.
  360.         set modActive=1
  361.     )
  362.     if exist !gtaBin!\ScriptHookVDotNet.asi (
  363.         set modActive=1
  364.         if exist !gtaBin!\ScriptHookVDotNet.dll (
  365.             call :ColorMsg 8A "    -Script Hook V .NET [ScriptHookVDotNet.asi]"
  366.             call :ColorMsg 8A "    -Script Hook V .NET [ScriptHookVDotNet.dll]"
  367.             Echo.
  368.         ) else (
  369.             call :ColorMsg 8E "    -Script Hook V .NET [ScriptHookVDotNet.asi]"
  370.             Echo.
  371.         )
  372.     ) else (
  373.         if exist !gtaBin!\ScriptHookVDotNet.dll (
  374.             set modActive=1
  375.             call :ColorMsg 8E "    -Script Hook V .NET [ScriptHookVDotNet.dll]"
  376.             Echo.
  377.         )
  378.     )
  379.     if exist !gtaBin!\dinput8.dll (
  380.         call :ColorMsg 8A "    -ASI Loader [dinput8.dll]"
  381.         Echo.
  382.         set modActive=1
  383.     )
  384.     if !asiCount! GTR 1 (
  385.         set modActive=1
  386.         Echo     -One or more unknown mod scripts/DLLs:
  387.         for /f %%A in ('dir /b "!gtaBin!\*.asi" 2^> nul') do (
  388.             if not %%A==NativeTrainer.asi (
  389.                 if not %%A==ScriptHookVDotNet.asi (
  390.                     if not %%A==OpenIV.asi (
  391.                         call :ColorMsg 8A "        -%%A"
  392.                         Echo.
  393.                     )
  394.                 )
  395.             )
  396.         )
  397.         for /f %%A in ('dir /b "!gtaBin!\*.dll" 2^> nul') do (
  398.             if not %%A==bink2w64.dll (
  399.                 if not %%A==d3dcompiler_46.dll (
  400.                     if not %%A==GFSDK_ShadowLib.win64.dll (
  401.                         if not %%A==GFSDK_TXAA.win64.dll (
  402.                             if not %%A==GFSDK_TXAA_AlphaResolve.win64.dll (
  403.                                 if not %%A==steam_api64.dll (
  404.                                     if not %%A==d3dcsx_46.dll (
  405.                                         if not %%A==ScriptHookVDotNet.dll (
  406.                                             if not %%A==ScriptHookV.dll (
  407.                                                 if not %%A==dinput8.dll (
  408.                                                     call :ColorMsg 8A "        -%%A"
  409.                                                     Echo.
  410.                                                 )
  411.                                             )
  412.                                         )
  413.                                     )
  414.                                 )
  415.                             )
  416.                         )
  417.                     )
  418.                 )
  419.             )
  420.         )
  421.     )
  422.     if exist !gtaBin!\scripts (
  423.         set modActive=1
  424.         if !asiCount! LSS 2 (
  425.             Echo     -One or more unknown mod scripts/DLLs:
  426.             Echo         -Script folder for .NET based mods:
  427.             for /f %%A in ('dir /b "!gtaBin!\scripts\*.asi" 2^> nul') do (
  428.                 call :ColorMsg 8A "            -%%A"
  429.                 Echo.
  430.             )
  431.             for /f %%A in ('dir /b "!gtaBin!\scripts\*.dll" 2^> nul') do (
  432.                 call :ColorMsg 8A "            -%%A"
  433.                 Echo.
  434.             )
  435.         ) else (
  436.             Echo         -Script folder for .NET based mods:
  437.             for /f %%A in ('dir /b "!gtaBin!\scripts\*.asi" 2^> nul') do (
  438.                 call :ColorMsg 8A "            -%%A"
  439.                 Echo.
  440.             )
  441.             for /f %%A in ('dir /b "!gtaBin!\scripts\*.dll" 2^> nul') do (
  442.                 call :ColorMsg 8A "            -%%A"
  443.                 Echo.
  444.             )
  445.         )
  446.     )
  447.     if !modActive!==0 (
  448.         call :ColorMsg 8B "    None."
  449.     )
  450.     Echo.
  451.     Echo ----------
  452.     call :ColorMsg 89 "Inactive mods:"
  453.     if exist !modBin!\NativeTrainer.asi (
  454.         call :ColorMsg 8E "    -Native Trainer [NativeTrainer.asi]"
  455.         Echo.
  456.         set modInactive=1
  457.     )
  458.     if exist !modBin!\ScriptHookV.dll (
  459.         call :ColorMsg 8E "    -Script Hook V [ScriptHookV.dll]"
  460.         Echo.
  461.         set modInactive=1
  462.     )
  463.     if exist !modBin!\OpenIV.asi (
  464.         call :ColorMsg 8E "    -OpenIV ASI Loader [OpenIV.asi]"
  465.         Echo.
  466.         set modInactive=1
  467.     )
  468.     if exist !modBin!\ScriptHookVDotNet.asi (
  469.         set modInactive=1
  470.         if exist !modBin!\ScriptHookVDotNet.dll (
  471.             call :ColorMsg 8E "    -Script Hook V .NET [ScriptHookVDotNet.asi]"
  472.             call :ColorMsg 8E "    -Script Hook V .NET [ScriptHookVDotNet.dll]"
  473.             Echo.
  474.         ) else (
  475.             call :ColorMsg 8B "    -Script Hook V .NET [ScriptHookVDotNet.asi] "
  476.             Echo.
  477.         )
  478.     ) else (
  479.         if exist !modBin!\ScriptHookVDotNet.dll (
  480.             set modInactive=1
  481.             call :ColorMsg 8B "    -Script Hook V .NET [ScriptHookVDotNet.dll]"
  482.             Echo.
  483.         )
  484.     )
  485.     if exist !modBin!\dinput8.dll (
  486.         call :ColorMsg 8E "    -ASI Loader [dinput8.dll]"
  487.         Echo.
  488.         set modInactive=1
  489.     )
  490.     if !ModAsiCount! GTR 1 (
  491.         set modInactive=1
  492.         Echo     -One or more unknown mod scripts/DLLs:
  493.         for /f %%A in ('dir /b "!modBin!\*.asi" 2^> nul') do (
  494.             if not %%A==NativeTrainer.asi (
  495.                 if not %%A==ScriptHookVDotNet.asi (
  496.                     if not %%A==OpenIV.asi (
  497.                         call :ColorMsg 8E "        -%%A"
  498.                         Echo.
  499.                     )
  500.                 )  
  501.             )
  502.         )
  503.         for /f %%A in ('dir /b "!modBin!\*.dll" 2^> nul') do (
  504.             if not %%A==ScriptHookVDotNet.dll (
  505.                 if not %%A==ScriptHookV.dll (
  506.                     if not %%A==dinput8.dll (
  507.                         call :ColorMsg 8E "        -%%A"
  508.                         Echo.
  509.                     )
  510.                 )
  511.             )
  512.         )
  513.     )
  514.     if exist !modBin!\scripts (
  515.         set modInactive=1
  516.         if !ModAsiCount! LSS 2 (
  517.             Echo     -One or more unknown mod scripts:
  518.             Echo         -Script folder for .NET based mods:
  519.             for /f %%A in ('dir /b "!modBin!\scripts\*.asi" 2^> nul') do (
  520.                 call :ColorMsg 8E "            -%%A"
  521.                 Echo.
  522.             )
  523.             for /f %%A in ('dir /b "!modBin!\scripts\*.dll" 2^> nul') do (
  524.                 call :ColorMsg 8E "            -%%A"
  525.                 Echo.
  526.             )
  527.         ) else (
  528.             Echo         -Script folder for .NET based mods:
  529.             for /f %%A in ('dir /b "!modBin!\scripts\*.asi" 2^> nul') do (
  530.                 call :ColorMsg 8E "            -%%A"
  531.                 Echo.
  532.             )
  533.             for /f %%A in ('dir /b "!modBin!\scripts\*.dll" 2^> nul') do (
  534.                 call :ColorMsg 8E "            -%%A"
  535.                 Echo.
  536.             )
  537.         )
  538.     )
  539.     if !modInactive!==0 (
  540.         call :ColorMsg 8B "    None."
  541.     )
  542.     Echo.
  543.     Echo ----------
  544.     if !single!==0 (
  545.         if not !modInactive!==0 (
  546.             call :ColorMsg 8A "Press 1 to enable all inactive mods."
  547.         )
  548.         if not !modActive!==0 (
  549.             call :ColorMsg 8E "Press 2 to disable all active mods."
  550.         )
  551.         set actionPrompt=
  552.     ) else (
  553.         set actionPrompt=Disable/Enable mod
  554.     )
  555.     if !single!==0 (
  556.         call :ColorMsg 8B "Press Z for single-mode"
  557.     ) else (
  558.         call :ColorMsg 8B "Press Z for multi-mode"
  559.     )
  560.     Echo Press X to exit
  561.     if !force!==1 (
  562.         Echo END
  563.         endlocal
  564.         exit /b
  565.     )
  566.     set /p action="!actionPrompt!>> "
  567.     if !single!==1 (
  568.         if /i not !action!==Z (
  569.             if /i not !action!==X (
  570.                 call :CheckMod !action!
  571.             )
  572.         )
  573.     ) else (
  574.         if !action!==1 (
  575.             if !modInactive! NEQ 0 (
  576.                 goto enable
  577.             )
  578.         )
  579.         if !action!==2 (
  580.             if !modActive! NEQ 0 (
  581.                 goto disable
  582.             )
  583.         )
  584.     )
  585.     if /i !action!==X (
  586.         goto end
  587.     )
  588.     if /i !action!==Z (
  589.         if !single!==0 (
  590.             set single=1
  591.         ) else (
  592.             set single=0
  593.         )
  594.     )
  595.     goto main
  596.    
  597. :disable
  598.     cls
  599.     Echo Disabling mods...
  600.     Echo     .ASI files...
  601.     for %%A in (!asiList!) do (
  602.         move "!curDir!\!gtaBin!\%%A" "!curDir!\!modBin!" > nul
  603.         if not exist "!curDir!\!modBin!\%%A" (
  604.             call :ColorMsg 8C "        ERROR: %%A could not be disabled."
  605.             Echo         Press any key to continue...
  606.             pause > nul
  607.         ) else (
  608.             call :ColorMsg 8E "        Disabled %%A"
  609.         )
  610.     )
  611.     Echo.
  612.     Echo     .DLL files...
  613.     for %%A in (!dllList!) do (
  614.         move "!curDir!\!gtaBin!\%%A" "!curDir!\!modBin!" > nul
  615.         call :ColorMsg 8E "        Disabled %%A"
  616.     )
  617.     Echo.
  618.     Echo     Configuration/documentation files [.TXT, .INI, .CFG, .INF]...
  619.     for %%A in (!txtList!) do (
  620.         move "!curDir!\!gtaBin!\%%A" "!curDir!\!modBin!" > nul
  621.         if not exist "!curDir!\!modBin!\%%A" (
  622.             call :ColorMsg 8C "        ERROR: %%A could not be disabled."
  623.             Echo         Press any key to continue...
  624.             pause > nul
  625.         ) else (
  626.             call :ColorMsg 8E "        Disabled %%A"
  627.         )
  628.     )
  629.     Echo.
  630.     if exist !gtaBin!\scripts (
  631.         Echo     .NET based scripts [scripts folder]...
  632.         move "!curDir!\!gtaBin!\scripts" "!curDir!\!modBin!" > nul
  633.         if not exist "!curDir!\!modBin!\scripts" (
  634.             call :ColorMsg 8C "        ERROR: .NET based scripts could not be disabled."
  635.             Echo         Press any key to continue...
  636.             pause > nul
  637.         ) else (
  638.             call :ColorMsg 8E "        Disabled .NET based scripts."
  639.         )
  640.     )
  641.     Echo.
  642.     timeout /t 2 > nul
  643.     goto reset
  644.  
  645. :enable
  646.     cls
  647.     for /f %%A in ('dir /b "!modBin!\*.*" 2^> nul') do (
  648.         goto enable.cnt
  649.     )
  650.     call :ColorMsg 8C "No mods to enable."
  651.     timeout /t 2 > nul
  652.     goto reset
  653.  
  654. :enable.cnt
  655.     cls
  656.     Echo Enabling mods...
  657.     if exist !modBin!\*.asi (
  658.         Echo     .ASI files...
  659.         for /f %%A in ('dir /b "!modBin!\*.asi" 2^> nul') do (
  660.             move "!curDir!\!modBin!\%%A" "!curDir!\!gtaBin!" > nul
  661.             if not exist "!curDir!\!gtaBin!\%%A" (
  662.                 call :ColorMsg 8C "        ERROR: %%A could not be enabled."
  663.                 Echo         Press any key to continue...
  664.                 pause > nul
  665.             ) else (
  666.                 call :ColorMsg 8A "        Enabled %%A"
  667.             )
  668.         )
  669.         Echo.
  670.     )
  671.     if exist !modBin!\*.dll (
  672.         Echo     .DLL files...
  673.         for /f %%A in ('dir /b "!modBin!\*.dll" 2^> nul') do (
  674.             move "!curDir!\!modBin!\%%A" "!curDir!\!gtaBin!" > nul
  675.             if not exist "!curDir!\!gtaBin!\%%A" (
  676.                 call :ColorMsg 8C "        ERROR: %%A could not be enabled."
  677.                 Echo         Press any key to continue...
  678.                 pause > nul
  679.             ) else (
  680.                 call :ColorMsg 8A "        Enabled %%A"
  681.             )
  682.         )
  683.         Echo.
  684.     )
  685.     if exist !modBin!\*.txt (
  686.         Echo     Configuration/documentation files: .TXT
  687.         for /f %%A in ('dir /b "!modBin!\*.txt" 2^> nul') do (
  688.             move "!curDir!\!modBin!\%%A" "!curDir!\!gtaBin!" > nul
  689.             if not exist "!curDir!\!gtaBin!\%%A" (
  690.                 call :ColorMsg 8C "        ERROR: %%A could not be enabled."
  691.                 Echo         Press any key to continue...
  692.                 pause > nul
  693.             ) else (
  694.                 call :ColorMsg 8A "        Enabled %%A"
  695.             )
  696.         )
  697.         Echo.
  698.     )
  699.     if exist !modBin!\*.ini (
  700.         Echo     Configuration/documentation files: .INI
  701.         for /f %%A in ('dir /b "!modBin!\*.ini" 2^> nul') do (
  702.             move "!curDir!\!modBin!\%%A" "!curDir!\!gtaBin!" > nul
  703.             if not exist "!curDir!\!gtaBin!\%%A" (
  704.                 call :ColorMsg 8C "        ERROR: %%A could not be enabled."
  705.                 Echo         Press any key to continue...
  706.                 pause > nul
  707.             ) else (
  708.                 call :ColorMsg 8A "        Enabled %%A"
  709.             )
  710.         )
  711.         Echo.
  712.     )
  713.     if exist !modBin!\*.inf (
  714.         Echo     Configuration/documentation files: .INF
  715.         for /f %%A in ('dir /b "!modBin!\*.inf" 2^> nul') do (
  716.             move "!curDir!\!modBin!\%%A" "!curDir!\!gtaBin!" > nul
  717.             if not exist "!curDir!\!gtaBin!\%%A" (
  718.                 call :ColorMsg 8C "        ERROR: %%A could not be enabled."
  719.                 Echo         Press any key to continue...
  720.                 pause > nul
  721.             ) else (
  722.                 call :ColorMsg 8A "        Enabled %%A"
  723.             )
  724.         )
  725.         Echo.
  726.     )
  727.     if exist !modBin!\*.cfg (
  728.         Echo     Configuration/documentation files: .CFG
  729.         for /f %%A in ('dir /b "!modBin!\*.cfg" 2^> nul') do (
  730.             move "!curDir!\!modBin!\%%A" "!curDir!\!gtaBin!" > nul
  731.             if not exist "!curDir!\!gtaBin!\%%A" (
  732.                 call :ColorMsg 8C "        ERROR: %%A could not be enabled."
  733.                 Echo         Press any key to continue...
  734.                 pause > nul
  735.             ) else (
  736.                 call :ColorMsg 8A "        Enabled %%A"
  737.             )
  738.         )
  739.         Echo.
  740.     )
  741.     if exist !modBin!\scripts (
  742.         Echo     .NET based scripts [scripts folder]...
  743.         move "!curDir!\!modBin!\scripts" "!curDir!\!gtaBin!" > nul
  744.         if not exist "!curDir!\!gtaBin!\scripts" (
  745.             call :ColorMsg 8C "        ERROR: .NET based scripts could not be enabled."
  746.             Echo         Press any key to continue...
  747.             pause > nul
  748.         ) else (
  749.             call :ColorMsg 8A "        Enabled .NET based scripts."
  750.         )
  751.     )
  752.     Echo.
  753.     timeout /t 2 > nul
  754.     goto reset
  755.  
  756. :end
  757.     endlocal
  758.     if !dbg!==1 (
  759.         exit /b
  760.     )
  761.     exit
  762.    
  763.    
  764. ::  SUBROUTINES
  765.  
  766. :ColorMsg
  767.     <nul > X set /p ".=."
  768.     set "param=^%~2" !
  769.     set "param=!param:"=\"!"
  770.     findstr /p /A:%1 "." "!param!\..\X" nul
  771.     <nul set /p ".=%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%%DEL%"
  772.     del /q X > nul
  773.     Echo.
  774.     exit /b
  775.  
  776. :CheckMod
  777.     set arg=%1
  778.     if not exist "!curDir!\!gtaBin!\!arg!" (
  779.         if not exist "!modBin!\!arg!" (
  780.             Echo.
  781.             call :ColorMsg 8C "No mod file called !arg!"
  782.             timeout /t 2 > nul
  783.             goto menu
  784.         ) else (
  785.             call :enableSingle !arg!
  786.         )
  787.     ) else (
  788.         call :disableSingle !arg!
  789.     )
  790.     goto :eof
  791.    
  792. :enableSingle
  793.     set arg=%1
  794.     move "!curDir!\!modBin!\!arg!" "!curDir!\!gtaBin!" > nul
  795.     if not exist "!curDir!\!gtaBin!\!arg!" (
  796.         call :ColorMsg 8C "        ERROR: !arg! could not be enabled."
  797.         Echo         Press any key to continue...
  798.         pause > nul
  799.         goto menu
  800.     ) else (
  801.         call :ColorMsg 8A "        Enabled !arg!"
  802.     )
  803.     timeout /t 2 > nul
  804.     goto reset
  805.  
  806. :disableSingle
  807.     set arg=%1
  808.     call :ProtectionTable !arg!
  809.     if !break!==1 goto reset
  810.     move "!curDir!\!gtaBin!\!arg!" "!curDir!\!modBin!" > nul
  811.     if not exist "!curDir!\!modBin!\!arg!" (
  812.         call :ColorMsg 8C "        ERROR: !arg! could not be disabled."
  813.         Echo         Press any key to continue...
  814.         pause > nul
  815.         goto menu
  816.     ) else (
  817.         call :ColorMsg 8E "        Disabled !arg!"
  818.     )
  819.     timeout /t 2 > nul
  820.     goto reset
  821.  
  822. :ProtectionTable
  823. set arg=%1
  824. for %%X in (!protected!) do (
  825.     if /i !arg!==%%X (
  826.         call :ColorMsg 8C "ERROR: !arg! could not be disabled due to game integrity protection"
  827.         Echo.
  828.         Echo Press any key to continue.
  829.         pause > nul
  830.         set break=1
  831.     )
  832. )
  833. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement