This repository has been archived by the owner on Jul 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.bat
152 lines (152 loc) · 6.8 KB
/
setup.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@echo off
REM BL-MCP version 1.4
REM @author acomputerdog 4-8-14
REM TODO:
REM * get blazeloader sources that are not the newest dev version.
REM * get libraries without hardcoding them
if not exist "%cd%/BlazeLoader/instlflg" (
setlocal EnableDelayedExpansion
echo --- MCP and BL setup script ---
echo Please select an install type:
echo 1 - Cancel install
echo 2 - Setup MCP for developing BlazeLoader itself
echo 3 - Setup MCP for developing BlazeLoader mods
choice /C 123
echo.
if errorlevel 3 (
echo Setting up MCP to develop BlazeLoader mods.
echo Unmodified BlazeLoader sources will be excluded from getChangedSrc and reobfuscate scripts.
set setupmode=mod
) else if errorlevel 2 (
echo Setting up MCP to develop BlazeLoader itself.
echo Unmodified BlazeLoader sources will be included with getChangedSrc and reobfuscate scripts.
set setupmode=bl
) else (
echo MCP setup canceled.
pause
exit /b -1
)
if not exist "%cd%/temp/setup" mkdir "%cd%\temp\setup\"
echo.
echo Extracting downloader script...
REM begin embedded VBScript file
echo strURL = WScript.Arguments.Item(0^)>"%cd%/temp/setup/bl_downloader.vbs"
echo strPath = WScript.Arguments.Item(1^)>>"%cd%/temp/setup/bl_downloader.vbs"
echo dim xHttp: Set xHttp = createobject("MSXML2.ServerXMLHTTP.6.0"^)>>"%cd%/temp/setup/bl_downloader.vbs"
echo dim bStrm: Set bStrm = createobject("Adodb.Stream"^)>>"%cd%/temp/setup/bl_downloader.vbs"
echo xHttp.Open "GET", strURL, False>>"%cd%/temp/setup/bl_downloader.vbs"
echo xHttp.Send>>"%cd%/temp/setup/bl_downloader.vbs"
echo with bStrm>>"%cd%/temp/setup/bl_downloader.vbs"
echo .type = 1 1>>"%cd%/temp/setup/bl_downloader.vbs"
echo .open>>"%cd%/temp/setup/bl_downloader.vbs"
echo .write xHttp.responseBody>>"%cd%/temp/setup/bl_downloader.vbs"
echo .savetofile strPath, 2 1>>"%cd%/temp/setup/bl_downloader.vbs"
echo end with>>"%cd%/temp/setup/bl_downloader.vbs"
echo WScript.Quit>>"%cd%/temp/setup/bl_downloader.vbs"
REM end embedded VBScript file
if exist "%cd%/temp/setup/bl_downloader.vbs" (
echo Done.
) else (
echo Unable to extract downloader script, aborting install!
pause
exit /b 3
)
echo.
echo Downloading BlazeLoader from "http://github.com/warriordog/BlazeLoader/archive/master.zip"...
cscript.exe //B "%cd%/temp/setup/bl_downloader.vbs" http://github.com/warriordog/BlazeLoader/archive/master.zip "%cd%/temp/setup/BlazeLoader_repo.zip"
echo Done.
echo.
echo Downloading 7-Zip from "http://www.acomputerdog.net/BL_STORE/7-zip_package.exe"...
cscript.exe //B "%cd%/temp/setup/bl_downloader.vbs" http://www.acomputerdog.net/BL_STORE/7-zip_package.exe "%cd%/temp/setup/7-zip_package.exe"
echo Done.
echo.
echo Extracting 7-Zip...
"%cd%/temp/setup/7-zip_package.exe" /q:a /t:"%cd%\temp\setup\7-zip\" /c /r:n
if exist "%cd%/temp/setup/7-zip/7z.exe" (
echo Done.
) else (
echo 7-zip was not extracted! (you may need to disable your antivirus if the self-extracting archive was blocked^)
echo Unable to extract BlazeLoader, aborting install!
pause
exit /b 1
)
echo.
echo Extracting BlazeLoader...
"%cd%/temp/setup/7-zip/7z.exe" e -o"%cd%/BlazeLoader/" -y "%cd%/temp/setup/BlazeLoader_repo.zip" mcp.ver
"%cd%/temp/setup/7-zip/7z.exe" x -o"%cd%/temp/setup/" -y "%cd%/temp/setup/BlazeLoader_repo.zip"
xcopy /I /Y /E /C /Q "%cd%\temp\setup\BlazeLoader-master\*" "%cd%\BlazeLoader"
rmdir /S /Q "%cd%\temp\setup\BlazeLoader-master"
echo Done.
echo.
set /p mcpver=<"%cd%/BlazeLoader/version/mcp.ver"
if not exist "%cd%/temp/setup/mcp!mcpver!.zip" (
echo Downloading MCP...
cscript.exe //B "%cd%/temp/setup/bl_downloader.vbs" http://mcp.ocean-labs.de/files/archive/mcp%mcpver%.zip "%cd%/temp/setup/mcp!mcpver!.zip"
echo Done.
) else (
echo MCP already downloaded; skipping download.
)
echo.
echo Extracting MCP...
"%cd%/temp/setup/7-zip/7z.exe" x -bd -ba -o"%cd%" -y "%cd%/temp/setup/mcp!mcpver!.zip"
if exist "%cd%/decompile.bat" (
echo Done.
) else (
echo MCP version !mcpver! was not found, provide it manually to %cd%/temp/setup/mcp!mcpver!.zip! Aborting install!
pause
exit /b 2
)
echo.
REM TODO: Find a way to do this without hardcoding anything. Maybe reuse Libaries.txt, or write a batch JSON parser(If I go insane)?
echo Downloading and copying libraries...
if not exist "%cd%/lib/" mkdir "%cd%/lib/"
cscript.exe //B "%cd%/temp/setup/bl_downloader.vbs" "http://repo1.maven.org/maven2/org/ow2/asm/asm-debug-all/4.1/asm-debug-all-4.1.jar" "%cd%/lib/asm-debug-all-4.1.jar"
xcopy /Y "%appdata%\.minecraft\libraries\net\minecraft\launchwrapper\1.9\*.jar" "%cd%\lib\"
REM TODO: These libraries need to be downloaded as already compiled.
cscript.exe //B "%cd%/temp/setup/bl_downloader.vbs" http://github.com/warriordog/CompCore/archive/master.zip "%cd%/temp/setup/CompCore_repo.zip"
if not exist "%cd%/temp/setup/CompCore_repo.zip" (
echo CompCore was not downloaded; aborting setup!
exit /b 3
)
cscript.exe //B "%cd%/temp/setup/bl_downloader.vbs" http://github.com/warriordog/OBFUtil/archive/master.zip "%cd%/temp/setup/OBFUtil_repo.zip"
if not exist "%cd%/temp/setup/OBFUtil_repo.zip" (
echo OBFUtil was not downloaded; aborting setup!
exit /b 4
)
"%cd%/temp/setup/7-zip/7z.exe" x -o"%cd%/BlazeLoader/" -y "%cd%/temp/setup/CompCore_repo.zip"
"%cd%/temp/setup/7-zip/7z.exe" x -o"%cd%/BlazeLoader/" -y "%cd%/temp/setup/OBFUtil_repo.zip"
echo Done.
echo.
echo Applying AccessTransformer...
if not exist "%cd%/jars/libraries/org/ow2/asm/asm-debug-all/4.1/" mkdir "%cd%/jars/libraries/org/ow2/asm/asm-debug-all/4.1/"
xcopy /I /Y "%cd%\lib\asm-debug-all-4.1.jar" "%cd%\jars\libraries\org\ow2\asm\asm-debug-all\4.1\"
"%cd%/BlazeLoader/util/apply_at.bat"
echo Done.
echo.
echo Decompiling...
"%cd%/runtime/bin/python/python_mcp.exe" "%cd%/runtime/decompile.py"
echo Done.
echo.
echo Copying BlazeLoader sources...
xcopy /I /Y /E /C /Q "%cd%\BlazeLoader\src\*" "%cd%\src\minecraft\"
xcopy /I /Y /E /C /Q "%cd%\BlazeLoader\res\*" "%cd%\src\minecraft\"
echo Done.
echo.
if "!setupmode!" == "bl" (
echo Recompiling...
"%cd%/runtime/bin/python/python_mcp.exe" "%cd%/runtime/recompile.py"
) else (
echo Updating MD5s...
echo yes|"%cd%/runtime/bin/python/python_mcp.exe" "%cd%/runtime/updatemd5.py"
)
echo Done.
echo.
echo %date%-%time%>"%cd%/BlazeLoader/instlflg"
echo MCP setup complete!
echo.
pause
) else (
echo MCP has already been set up!
pause
exit /b -2
)