-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakepart.bat
More file actions
240 lines (199 loc) · 6.04 KB
/
makepart.bat
File metadata and controls
240 lines (199 loc) · 6.04 KB
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Sexy Makefile Executor ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
@chcp 1252
setlocal enabledelayedexpansion
set MOVEROM=1
set ERROR=0
set COMPILE1=0
set COMPILE2=0
set COMPILE3=0
set COMPILE4=0
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Change Here ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Ultra folder (NO QUOTATIONS)
set ROOT=C:\ultra
:: Emulator ROM folder (QUOTATIONS REQUIRED)
set ROMFOLDER="Z:\"
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Color Function Setup ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
cls && color 07
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (set "DEL=%%a")
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Check for folders ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
IF NOT EXIST %ROOT% (
goto fix1
) ELSE (
goto fix2
)
:fix1
call :PainText 04 "Error locating the ultra folder."
echo.
call :PainText 04 "Please edit this batch file (line 16) to have the correct directory."
echo.
echo.
pause
exit
:fix2
for /F "delims=" %%a in ('@findstr /s /b "N64KITDIR" "Makefile" ') do set "n64kitdir=%%a"
for /f "tokens=2 delims==" %%a in ("%n64kitdir%") do set "result=%%a"
IF NOT EXIST %result% (
call :PainText 04 "Error locating the n64sdk folder."
echo.
call :PainText 04 "Please edit your makefile to have the correct directory."
echo.
echo.
pause
exit
)
goto fix3
:fix3
IF NOT EXIST %ROMFOLDER% (
call :PainText 04 "Error locating ROM folder."
echo.
call :PainText 04 "Please edit this batch file (line 18) to have the correct directory."
echo.
call :PainText 04 "if you ignore this error, the rom will not be moved after compilation."
echo.
echo.
set MOVEROM=0
)
goto main
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Setup Make ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:main
call :PainText 09 "Setting up make for the N64"
set gccdir=%ROOT%\gcc
set PATH=%ROOT%\gcc\mipse\bin;%ROOT%\usr\sbin
set gccsw=-mips3 -mgp32 -mfp32 -funsigned-char -D_LANGUAGE_C -D_ULTRA64 -D__EXTENSIONS__
set n64align=on
set GCC_CELF=ON
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Cleanup Old Files ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo.
echo.
call :PainText 02 "Moving to the compilation directory"
echo.
call :PainText 02 "Cleaning up old files"
echo.
call :PainText 02 "Creating Out Folder"
@mkdir out 2>nul
cd out
del /q *
echo.
call :PainText 02 "Creating Bin Folder"
@mkdir bin 2>nul
cd bin
del /q *
cd..
cd..
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Run Make ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo.
echo.
call :PainText 0c "Select what to compile"
echo.
echo Options (ex: MR to compile Stages+ROM)
echo S - Sprites
echo O - Objects
echo M - Stages
echo R - ROM
echo.
set /P q="Options: "
if not x%q:S=%==x%q% set COMPILE1=1
if not x%q:O=%==x%q% set COMPILE2=1
if not x%q:M=%==x%q% set COMPILE3=1
if not x%q:R=%==x%q% set COMPILE4=1
if %COMPILE1%==1 (
cd assets
cd sprites
call makeme.bat -silent
cd..
cd..
)
if %COMPILE2%==1 (
cd assets
cd objects
call makeme.bat -silent
cd..
cd..
)
if %COMPILE3%==1 (
cd assets
cd stages
call makeme.bat -silent
cd..
cd..
)
if %COMPILE4%==0 (
goto finish
)
echo.
echo.
call :PainText 0C "Running ROM Make"
echo.
make
if NOT exist *.n64 (
move /-y *.o "out\bin\" >nul
echo.
call :PainText 04 "An error occured during compiation."
echo.
echo.
pause
exit
)
echo.
call :PainText 0C "Running makemask"
echo.
for /R "%~dp0" %%f in (*.n64) do makemask "%%f"
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Move files to output folder ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo.
call :PainText 02 "Moving Object files"
move /-y *.o "out\bin\" >nul
move /-y *.out "out\bin\" >nul
move /-y *.n64 "out\" >nul
echo.
echo.
call :PainText 0E "Compilation finished!"
echo.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Ask to move file to ROM folder ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if !MOVEROM!==1 (
goto choice
) ELSE (
goto finish
)
:choice
set /P c=Move the ROM to the Project64 ROM Folder[Y/N]?
if /I "%c%" EQU "Y" goto :move
if /I "%c%" EQU "N" call :PainText 0E "Done!" & echo. & echo. & pause & exit
goto :choice
:move
for /R "%~dp0out" %%f in (*.n64) do copy /y "%%f" %ROMFOLDER%
call :PainText 0E "Done!"
echo.
goto finish
:finish
echo.
pause
exit
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Color Function ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:PainText
<nul set /p=". ."
<nul set /p "=%DEL%" > "%~2"
\Windows\system32\findstr /v /a:%1 /R "+" "%~2" nul
del "%~2" > nul
<nul set /p=""
goto :eof