Cleaned some tools up
Some checks failed
Build Dusk / run-tests (push) Failing after 2m13s
Build Dusk / build-linux (push) Successful in 2m4s
Build Dusk / build-psp (push) Failing after 1m47s

This commit is contained in:
2026-01-27 08:40:13 -06:00
parent 81b08b2eba
commit fb93453482
17 changed files with 61 additions and 143 deletions

View File

@@ -24,17 +24,22 @@ with open(args.csv, newline="", encoding="utf-8") as csvfile:
# For each ID
inputIds = []
inputIdValues = {}
for row in reader:
inputId = row["id"]
if inputId not in inputIds:
inputIds.append(inputId)
# For each ID, create enum entry.
count = 0
outHeader += "typedef enum {\n"
outHeader += " INPUT_ACTION_NULL = 0,\n\n"
outHeader += f" INPUT_ACTION_NULL = {count},\n\n"
count += 1
for inputId in inputIds:
outHeader += f" {csvIdToEnumName(inputId)},\n"
outHeader += f"\n INPUT_ACTION_COUNT\n"
inputIdValues[inputId] = count
outHeader += f" {csvIdToEnumName(inputId)} = {count},\n"
count += 1
outHeader += f"\n INPUT_ACTION_COUNT = {count}\n"
outHeader += "} inputaction_t;\n\n"
# Write IDs to char array.
@@ -43,6 +48,13 @@ with open(args.csv, newline="", encoding="utf-8") as csvfile:
outHeader += f" [{csvIdToEnumName(inputId)}] = \"{inputId}\",\n"
outHeader += f"}};\n\n"
# Lua Script
outHeader += f"static const char_t *INPUT_ACTION_SCRIPT = \n"
for inputId in inputIds:
# Reference the enum
outHeader += f" \"{csvIdToEnumName(inputId)} = {inputIdValues[inputId]}\\n\"\n"
outHeader += f";\n\n"
# Write to output file.
os.makedirs(os.path.dirname(args.output), exist_ok=True)
with open(args.output, "w", encoding="utf-8") as outFile: