forked from Lojemiru/AM2R-Autopatcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Drag-and-Drop AM2R_11.zip onto Here!.bat
167 lines (123 loc) · 4.4 KB
/
Drag-and-Drop AM2R_11.zip onto Here!.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
@ECHO OFF
SET version=15_2
REM AM2R Patching Utility
REM Written by Wanderer
REM Maintained by Lojical
SET output=AM2R_%version%
ECHO AM2R v11 to v%version% Patching Utility
ECHO ----------------------------------
ECHO.
cd "%~dp0"
REM Clean up existing files.
if exist %output% rmdir /s /q %output%
if exist utilities\android\assets rmdir /s /q utilities\android\assets
if exist utilities\android\AM2RWrapper.apk del utilities\android\AM2RWrapper.apk
if exist AndroidM2R_%version%-signed.apk del AndroidM2R_%version%-signed.apk
echo Java check...
where java > nul
SET JavaCode=%ErrorLevel%
if "%JavaCode%" == "0" (
echo Found.
) else (
echo Not found.
)
echo.
if "%~x1" == ".zip" (
ECHO Extracting AM2R_11.zip to %output%...
utilities\7za920\7za.exe x "%~1" -y -o%output% > nul
) else (
ECHO Copying AM2R_11 to %output%...
MD %output%
echo D | xcopy /s /v /y /q "%~1" %output%
)
if not exist %output% (
ECHO.
ECHO Extraction failed!
ECHO Aborting patching process.
ECHO Extract AM2R_11.zip manually and try again with that folder.
ECHO It is recommended to complete this process from the desktop.
ECHO.
pause
exit /b
)
ECHO Extraction successful.
ECHO.
utilities\gui\DropDownBox.exe "Windows;Android" "Choose your target platform:" "Platform" /I:0 /RI /C:13 >NUL
SET ReturnCode=%ErrorLevel%
if "%ReturnCode%"=="0" (
rmdir /s /q %output%
exit /b
)
if "%ReturnCode%"=="2" (
if not "%JavaCode%" == "0" (
rmdir /s /q %output%
utilities\gui\MessageBox.exe "Java was not found by this patcher! Java is required to sign the APK (app) and a signature is required to install to Android. Please do a standard installation of Java to this PC to create the Android version." "Warning!" "OK" "Exclamation" > nul
exit /b
)
)
ECHO Patching AM2R.exe...
REM utilities\floating\flips.exe --apply patch_data\AM2R.bps %output%\data.win %output%\AM2R.exe
utilities\xdelta\xdelta3.exe -f -d -s %output%\data.win patch_data\AM2R.xdelta %output%\AM2R.exe
ECHO.
if not "%ErrorLevel%"=="0" (
ECHO Patching failed!
ECHO Aborting patching process.
ECHO This patch applies ONLY to v1.1 of AM2R.
ECHO.
rmdir /s /q %output%
pause
exit /b
)
REM del /q %output%\data.win
if not "%ErrorLevel%"=="0" (
ECHO Patching failed!
ECHO Aborting patching process.
ECHO This patch applies ONLY to v1.1 of AM2R.
ECHO.
rmdir /s /q %output%
pause
exit /b
)
ECHO Copying patch files...
xcopy /s /v /y /q patch_data\files_to_copy %output%
Call :YesNoBox "Install high quality in-game music? Increases filesize by 194 MB!"
if "%YesNo%"=="6" (
REM IF "%ReturnCode%"=="2" utilities\gui\MessageBox.exe "You have chosen to install high quality music to the Android package. While this will work, please note that performance may suffer on slower devices, and music may be distorted. If you experience slowdowns and hangs, or the music is distorted, please try recreating the package with standard quality music." "Warning!" "OK" "Exclamation" > nul
ECHO.
ECHO Copying high quality music...
xcopy /s /v /y /q patch_data\HDR_HQ_in-game_music %output%
)
rem PACKAGE ANDROID APK
IF "%ReturnCode%"=="2" (
ECHO.
ECHO Packaging Android APK...
xcopy /s /v /y /q patch_data\android\AM2RWrapper.apk utilities\android > nul
move %output% utilities\android\assets > nul
xcopy /s /v /y /q patch_data\android\AM2R.ini utilities\android\assets > nul
ECHO Patching game.droid...
REM utilities\floating\flips.exe --apply patch_data\droid.bps utilities\android\assets\AM2R.exe utilities\android\assets\game.droid
utilities\xdelta\xdelta3.exe -f -d -s utilities\android\assets\data.win patch_data\droid.xdelta utilities\android\assets\game.droid
call utilities\android\apk_package_assets.bat
cd "%~dp0"
rmdir /s /q utilities\android\assets
move utilities\android\AM2RWrapper-aligned-debugSigned.apk AndroidM2R_%version%-signed.apk > nul
)
if "%ReturnCode%"=="1" (
del /q %output%\data.win
)
ECHO.
ECHO The operation was completed successfully. See you next mission!
IF "%ReturnCode%"=="1" explorer /select,%output%
IF "%ReturnCode%"=="2" explorer /select,AndroidM2R_%version%-signed.apk
timeout /t 8
exit /b
REM Pop-up prompt code below.
:YesNoBox
REM returns 6 = Yes, 7 = No. Type=4 = Yes/No
set YesNo=
set MsgType=4
set heading=%~2
set message=%~1
echo wscript.echo msgbox(WScript.Arguments(0),%MsgType%,WScript.Arguments(1)) >"%temp%\input.vbs"
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\input.vbs" "%message%" "%heading%"') do set YesNo=%%a
exit /b