forked from sonicretro/s1disasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.lua
executable file
·52 lines (39 loc) · 1.75 KB
/
build.lua
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
#!/usr/bin/env lua
--------------
-- Settings --
--------------
-- Set this to true to use a better compression algorithm for the DAC driver.
-- Having this set to false will use an inferior compression algorithm that
-- results in an accurate ROM being produced.
local improved_dac_driver_compression = false
---------------------
-- End of settings --
---------------------
local common = require "build_tools.lua.common"
local compression = improved_dac_driver_compression and "kosinski-optimised" or "kosinski"
local message, abort = common.build_rom("sonic", "s1blaze", "", "-p=FF -z=0," .. compression .. ",Size_of_DAC_driver_guess,after", false, "https://github.com/sonicretro/s1disasm")
if message then
exit_code = false
end
if abort then
os.exit(exit_code, true)
end
-- Build DEBUG ROM
message, abort = common.build_rom("sonic", "s1blaze.debug", "-D __DEBUG__ -OLIST s1blaze.debug.lst", "-p=FF -z=0," .. compression .. ",Size_of_DAC_driver_guess,after", false, "https://github.com/sonicretro/s1disasm")
if message then
exit_code = false
end
if abort then
os.exit(exit_code, true)
end
-- Append symbol table to the ROM.
local extra_tools = common.find_tools("debug symbol generator", "https://github.com/vladikcomper/md-modules", "https://github.com/sonicretro/s1disasm", "convsym")
if not extra_tools then
os.exit(false)
end
os.execute(extra_tools.convsym .. " sonic.lst s1blaze.bin -input as_lst -range 0 FFFFFF -exclude -filter \"z[A-Z].+\" -a")
os.execute(extra_tools.convsym .. " s1blaze.debug.lst s1blaze.debug.bin -input as_lst -range 0 FFFFFF -exclude -filter \"z[A-Z].+\" -a")
-- Correct the ROM's header with a proper checksum and end-of-ROM value.
common.fix_header("s1blaze.bin")
common.fix_header("s1blaze.debug.bin")
os.exit(exit_code, false)