mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-07-12 20:31:25 -07:00
wip: cube_g4_face is bugged
This commit is contained in:
+4
-1
@@ -345,7 +345,10 @@ function M.split_top_level_commas(body)
|
||||
token_start = i
|
||||
else
|
||||
local nx = M.skip_str_or_cmt(body, i)
|
||||
if nx > i then i = nx; token_start = nx else i = i + 1 end
|
||||
-- Don't advance token_start on skip: a trailing `/* ... */` after
|
||||
-- a macro call is part of the current entry's chunk, not the
|
||||
-- start of the next one.
|
||||
if nx > i then i = nx else i = i + 1 end
|
||||
end
|
||||
end
|
||||
local last = body:sub(token_start)
|
||||
|
||||
@@ -427,12 +427,34 @@ end
|
||||
-- ============================================================
|
||||
|
||||
local function main(args)
|
||||
if #args < 2 then
|
||||
print("Usage: luajit gen_atom_offsets.lua <metadata.h> <source1> [source2 ...]")
|
||||
os.exit(1)
|
||||
end
|
||||
local word_counts = load_word_counts(args[1])
|
||||
for i = 2, #args do process_source(args[i], word_counts) end
|
||||
if #args < 2 then
|
||||
print("Usage: luajit gen_atom_offsets.lua <metadata.h> <source1> [source2 ...]")
|
||||
os.exit(1)
|
||||
end
|
||||
local word_counts = load_word_counts(args[1])
|
||||
for i = 2, #args do
|
||||
local source_path = args[i]
|
||||
-- Also load the auto-generated <dir>.macs.h for this source's
|
||||
-- directory (if it exists). The metaprogram emits
|
||||
-- WORD_COUNT(mac_X, N) entries there for the MipsAtomComp_
|
||||
-- declarations in the source. Merging ensures the offset
|
||||
-- computation has the right word counts (no "unknown macro"
|
||||
-- warnings for the auto-generated components).
|
||||
local source_dir = dirname(source_path)
|
||||
-- dirname() keeps the trailing separator; basename_no_ext()
|
||||
-- on a path with a trailing separator returns "". Strip it.
|
||||
if #source_dir > 0 and (source_dir:sub(-1) == "/" or source_dir:sub(-1) == "\\") then
|
||||
source_dir = source_dir:sub(1, -2)
|
||||
end
|
||||
local macs_path = source_dir .. "/gen/" .. basename_no_ext(source_dir) .. ".macs.h"
|
||||
local ok, mc = pcall(load_word_counts, macs_path)
|
||||
if ok then
|
||||
for name, count in pairs(mc) do
|
||||
word_counts[name] = count
|
||||
end
|
||||
end
|
||||
process_source(source_path, word_counts)
|
||||
end
|
||||
end
|
||||
|
||||
main({...})
|
||||
+1184
-1141
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user