-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.lua
37 lines (26 loc) · 1.21 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
#!/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("s2", "s2built", "", "-p=FF -z=0," .. compression .. ",Size_of_DAC_driver_guess,after", false, "https://github.com/sonicretro/s2disasm")
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/skdisasm", "convsym")
os.execute(extra_tools.convsym .. " s2.lst s2built.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("s2built.bin")
os.exit(exit_code, false)