Derur's picture
Upload 30 files
b8e81f8 verified
@echo off
REM --------------------------------------------------------------------------------
REM Configuration:
REM Set a Quick Save and Quick Load hotkey - http://www.pygame.org/docs/ref/key.html
REM --------------------------------------------------------------------------------
set "quicksavekey=K_F5"
set "quickloadkey=K_F9"
REM --------------------------------------------------------------------------------
REM !! END CONFIG !!
REM --------------------------------------------------------------------------------
REM The following variables are Base64 encoded strings for unrpyc and rpatool
REM Due to batch limitations on variable lengths, they need to be split into
REM multiple variables, and joined later using powershell.
REM --------------------------------------------------------------------------------
REM unrpyc by CensoredUsername
REM https://github.com/CensoredUsername/unrpyc
REM Edited to remove multiprocessing and adjust output spacing 44febb0 2019-10-07T07:06:47.000Z
REM https://github.com/F95Sam/unrpyc
REM --------------------------------------------------------------------------------
REM !! DO NOT EDIT BELOW THIS LINE !!
REM --------------------------------------------------------------------------------
set "version=0.91 (includes Gideon.v5 mods) (191007)"
title UnRen.bat v%version%
:init
REM --------------------------------------------------------------------------------
REM Splash screen
REM --------------------------------------------------------------------------------
cls
echo.
echo __ __ ____ __ __
echo / / / /___ / __ \___ ____ / /_ ____ _/ /_
echo / / / / __ \/ /_/ / _ \/ __ \ / __ \/ __ ^`/ __/
echo / /_/ / / / / _^, _/ __/ / / / / /_/ / /_/ / /_
echo \____/_/ /_/_/ ^|_^|\___/_/ /_(_)_.___/\__^,_/\__/ v%version%
echo.
echo ----------------------------------------------------
echo.
REM --------------------------------------------------------------------------------
REM We need powershell for later, make sure it exists
REM --------------------------------------------------------------------------------
if not exist "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" (
echo ! Error: Powershell is required, unable to continue.
echo This is included in Windows 7, 8, 10. XP/Vista users can
echo download it here: http://support.microsoft.com/kb/968929
echo.
rem pause>nul|set/p=. Press any key to exit...
exit
)
REM --------------------------------------------------------------------------------
REM Set our paths, and make sure we can find python exe
REM --------------------------------------------------------------------------------
set "currentdir=%~dp0%"
set "pythondir=%currentdir%..\lib\windows-i686\"
set "renpydir=%currentdir%..\renpy\"
set "gamedir=%currentdir%"
if exist "game" if exist "lib" if exist "renpy" (
set "pythondir=%currentdir%lib\windows-i686\"
set "renpydir=%currentdir%renpy\"
set "gamedir=%currentdir%game\"
)
if not exist "%pythondir%python.exe" (
set "pythondir=%currentdir%..\lib\windows-x86_64\"
set "renpydir=%currentdir%..\renpy\"
set "gamedir=%currentdir%"
if exist "game" if exist "lib" if exist "renpy" (
set "pythondir=%currentdir%lib\windows-x86_64\"
set "renpydir=%currentdir%renpy\"
set "gamedir=%currentdir%game\"
)
)
if not exist "%pythondir%python.exe" (
echo ! Error: Cannot locate python.exe, unable to continue.
echo Are you sure we're in the game's root or game directory?
echo.
rem pause>nul|set/p=. Press any key to exit...
exit
)
:menu
goto decompile
:decompile
REM --------------------------------------------------------------------------------
REM Write to temporary file first, then convert. Needed due to binary file
REM --------------------------------------------------------------------------------
set "decompcab=%currentdir%rpycdecdata\_decomp.cab"
set "decompilerdir=%currentdir%rpycdecdata\decompiler"
set "unrpycpy=%currentdir%rpycdecdata\unrpyc.py"
set "deobfuscate=%currentdir%rpycdecdata\deobfuscate.py"
if not exist "%gamedir%*.rpyc" (
echo No .rpyc files found in %gamedir%!
echo.
goto finish
)
REM --------------------------------------------------------------------------------
REM Decompile rpyc files
REM --------------------------------------------------------------------------------
echo Searching for rpyc files...
cd "%gamedir%"
set "PYTHONPATH=%pythondir%Lib"
for /r %%f in (*.rpyc) do (
if not %%~nf == un (
echo + Decompiling "%%~nf%%~xf" - %%~zf bytes
"%pythondir%python.exe" -O "%unrpycpy%" -c --init-offset "%%f"
)
)
echo.
REM --------------------------------------------------------------------------------
REM Clean up
REM --------------------------------------------------------------------------------
echo Cleaning up temporary files...
del "%unrpycpy%"
del "%unrpycpy%o"
del "%decompcab%.tmp"
del "%decompcab%"
del "%deobfuscate%"
del "%deobfuscate%o"
rmdir /Q /S "%decompilerdir%"
rmdir /Q /S "%currentdir%rpycdecdata\"
echo.
goto finish
:finish
REM --------------------------------------------------------------------------------
REM We are done
REM --------------------------------------------------------------------------------
echo ----------------------------------------------------
echo Finished!
echo ----------------------------------------------------
exit