-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconvert.bat
188 lines (175 loc) · 4.88 KB
/
convert.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
@echo off
echo -=- Luxor to OpenSMCE Game Converter -=-
echo.
echo ===========================================
echo Step 0. Checking the requirements...
echo ===========================================
set good=1
py --version >nul
if %errorlevel% neq 0 (
echo ! Python is not installed !
set good=0
)
if not exist data\ (
echo ! Folder "data" does not exist !
set good=0
)
rem if exist data\data\ (
rem echo ! Folder "data" is nested too deeply !
rem set good=0
rem )
if not exist english\ (
echo ! Folder "english" does not exist !
set good=0
)
rem if exist english\english\ (
rem echo ! Folder "english" is nested too deeply !
rem set good=0
rem )
if not exist assets\ (
echo ! Folder "assets" does not exist !
set good=0
)
if exist data\sprites\powerups\scorpion.spr (
set outfolder="Luxor Amun Rising"
set appendix="Luxor_Amun_Rising_appendix"
) else if exist data\data\sprites\powerups\scorpion.spr (
set outfolder="Luxor Amun Rising"
set appendix="Luxor_Amun_Rising_appendix"
) else (
set outfolder="Luxor"
set appendix="Luxor_appendix"
)
if not exist %appendix%\ (
echo ! Folder "%appendix%" does not exist !
set good=0
)
if %good% equ 1 (
echo All good!
) else (
echo ===========================================
echo The converter found some issues and will not convert the game properly.
echo They are listed above.
echo Before proceeding, fix them and run convert.bat again.
echo If you think some of these errors are false positive,
echo contact me on Discord!
echo ===========================================
echo.
echo The converter will now close.
pause
goto exit
)
echo Detected game: %outfolder%
echo.
echo.
echo.
echo If you haven't checked README file yet, just in case please do it before proceeding!
echo The original files will be available in "_BACKUP" directory. If you want to, you can delete it afterwards.
echo ===========================================
echo The converter will start working once you press any key.
pause
echo.
echo.
echo.
echo.
echo.
echo ===========================================
echo Step 1. Preparing and backing up...
echo ===========================================
if exist data\data\ (
echo The "data" folder is nested too deeply, fixing...
xcopy /q /s /y "data\data\" "data\"
rmdir /s /q data\data
echo Done!
)
if exist English\English\ (
echo The "English" folder is nested too deeply, fixing...
xcopy /q /s /y "English\English\" "English\"
rmdir /s /q English\English
echo Done!
)
mkdir "_BACKUP"
xcopy /q /s /y "data\" "_BACKUP\data\"
xcopy /q /s /y "English\" "_BACKUP\English\"
xcopy /q /s /y "assets\" "_BACKUP\assets\"
xcopy /q /s /y "%appendix%\" "_BACKUP\%appendix%\"
echo.
echo.
echo.
echo.
echo.
echo ===========================================
echo Step 2. Merging data/ with english/...
echo ===========================================
xcopy /q /s /y "English\data\" "data\"
rmdir /s /q English
echo.
echo.
echo.
echo.
echo.
echo ===========================================
echo Step 3. Converting...
echo ===========================================
setlocal enabledelayedexpansion
py -m pip install pillow
py main.py --all
if %errorlevel% neq 0 (
echo ===========================================
echo Oh no^^! Something has gone wrong during the conversion process.
echo Please screenshot the console and send it to me via Discord^^!
echo ===========================================
echo.
echo The converter will now close.
choice /m "Would you like to revert the files to the original state"
set /a keep=2-!errorlevel!
if !keep! equ 1 (
echo.
echo Okay, reverting...
rmdir /s /q output
rmdir /s /q %outfolder%
rmdir /s /q data
rmdir /s /q assets
rmdir /s /q %appendix%
xcopy /q /s /y "_BACKUP\data\" "data\"
xcopy /q /s /y "_BACKUP\English\" "English\"
xcopy /q /s /y "_BACKUP\assets\" "assets\"
xcopy /q /s /y "_BACKUP\%appendix%\" "%appendix%\"
rmdir /s /q _BACKUP
)
goto exit
)
setlocal disabledelayedexpansion
echo.
echo.
echo.
echo.
echo.
echo ===========================================
echo Step 4. Copying additional files...
echo ===========================================
xcopy /q /s "data\music\" "output\music\"
xcopy /q /s "data\sound\" "output\sounds\"
xcopy /q /s "%appendix%\*" "output\"
del "output\music\*.sl3"
del "output\sounds\*.sl3"
echo.
echo.
echo.
echo.
echo.
echo ===========================================
echo Step 5. Cleaning up...
echo ===========================================
ren output %outfolder%
rmdir /s /q data
rmdir /s /q assets
rmdir /s /q %appendix%
ren "%outfolder%\_config.json" "config.json"
echo The converter finished its job, hopefully successfully.
echo If you haven't spotted any error in this console, you can launch OpenSMCE now..
echo If you have spotted an error though, make sure you have Python installed and all required folders.
echo If you struggle to find a source of the error, send a screenshot of this console to me via Discord!
echo Press any key to close this window.
pause
:exit