-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_plus.bat
101 lines (72 loc) · 2.83 KB
/
build_plus.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
@ECHO OFF
REM // make sure we can write to the file s2built.bin
REM // also make a backup to s2built.prev.bin
IF NOT EXIST s2built.bin goto LABLNOCOPY
IF EXIST s2built.prev.bin del s2built.prev.bin
IF EXIST s2built.prev.bin goto LABLNOCOPY
move /Y s2built.bin s2built.prev.bin
IF EXIST s2built.bin goto LABLERROR3
REM IF EXIST s2built.prev.bin copy /Y s2built.prev.bin s2built.bin
:LABLNOCOPY
REM // delete some intermediate assembler output just in case
IF EXIST s2.p del s2.p
IF EXIST s2.p goto LABLERROR2
IF EXIST s2.h del s2.h
IF EXIST s2.h goto LABLERROR1
REM // clear the output window
cls
REM // run the assembler
REM // -xx shows the most detailed error output
REM // -c outputs a shared file (s2.h)
REM // -A gives us a small speedup
set AS_MSGPATH=win32/msg
set USEANSI=n
REM // allow the user to choose to print error messages out by supplying the -pe parameter
IF "%1"=="-pe" ( "win32/asw" -xx -c -A -L s2.asm ) ELSE "win32/asw" -xx -c -E -A -L s2.asm
REM // if there were errors, there won't be any s2.p output
IF NOT EXIST s2.p goto LABLERROR5
REM // combine the assembler output into a rom
IF EXIST s2.p "win32/s2p2bin_plus" s2.p s2built.bin s2.h
REM // fix some pointers and things that are impossible to fix from the assembler without un-splitting their data
IF EXIST s2built.bin "win32/fixpointer" s2.h s2built.bin off_3A294 MapRUnc_Sonic $2D 0 4 word_728C_user Obj5F_MapUnc_7240 2 2 1
REM REM // fix the rom header (checksum)
IF EXIST s2built.bin "win32/fixheader" s2built.bin
REM // if there were errors/warnings, a log file is produced
IF EXIST s2.log goto LABLERROR4
REM // done -- pause if we seem to have failed, then exit
IF EXIST s2built.bin exit /b
pause
exit /b
:LABLERROR1
echo Failed to build because write access to s2.h was denied.
pause
exit /b
:LABLERROR2
echo Failed to build because write access to s2.p was denied.
pause
exit /b
:LABLERROR3
echo Failed to build because write access to s2built.bin was denied.
pause
exit /b
:LABLERROR4
REM // display a noticeable message
echo.
echo **********************************************************************
echo * *
echo * There were build warnings. See s2.log for more details. *
echo * *
echo **********************************************************************
echo.
pause
exit /b
:LABLERROR5
REM // display a noticeable message
echo.
echo **********************************************************************
echo * *
echo * There were build errors. See s2.log for more details. *
echo * *
echo **********************************************************************
echo.
pause