build improvements (no binary changes)

This commit is contained in:
4am 2024-06-11 11:36:20 -04:00
parent a6c3fc70f6
commit a55bd69fd4
2 changed files with 11 additions and 8 deletions

View File

@ -163,7 +163,7 @@ $(GAMEHELP): $(GAMEHELP.SOURCES) | $(MD)
# precompute binary data structures for slideshow configuration files
$(SS): $(SS.SOURCES) | $(MD)
mkdir -p "$@"
$(PARALLEL) '[ $$(echo "{/}" | cut -c-3) = "ACT" ] && bin/buildslideshow.py -d "$(GAMES.CONF)" < "{}" > "$@/{/}" || bin/buildslideshow.py "$(GAMES.CONF)" < "{}" > "$@/{/}"' ::: res/SS/*
$(PARALLEL) 'bin/buildslideshow.py "{}" "$(GAMES.CONF)" < "{}" > "$@/{/}"' ::: res/SS/*
(cd "$(BUILDDIR)"/SS/ && for f in *; do echo "$$f"; done) > "$(SS.LIST)"
@touch "$@"

View File

@ -1,14 +1,13 @@
#!/usr/bin/env python3
# flags
# -d include game display name (default off = display name will be 0-length string)
# parameters
# stdin - input containing slideshow (e.g. some file in res/SS/)
# stdout - binary OKVS data structure
# 1 - list of games with metadata (e.g. build/GAMES.CONF)
# 1 - name of slideshow file (used to decide whether if this is an action slideshow)
# 2 - name of file containing list of games with metadata (e.g. build/GAMES.CONF)
import argparse
import os.path
import struct
import sys
@ -27,8 +26,12 @@ def build(records, args):
for x in games_list
if x and x[0] not in ('#', '[')]
games_cache = {}
for flags, key, displayname in games_list:
games_cache[key] = (flags, args.displayname and displayname or "")
if os.path.basename(args.slideshow_file).startswith('ACT'):
for flags, key, displayname in games_list:
games_cache[key] = (flags, displayname)
else:
for flags, key, dummy in games_list:
games_cache[key] = (flags, "")
record_count = len(records)
# yield OKVS header (2 x 2 bytes, unsigned int, little-endian)
@ -56,8 +59,8 @@ def build(records, args):
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Build indexed OKVS structure from slideshow configuration file")
parser.add_argument("slideshow_file")
parser.add_argument("games_file")
parser.add_argument("-d", "--displayname", action="store_true", default=False, help="include game display name (default off = display name will be 0-length string)")
args = parser.parse_args()
records = [x.strip() for x in sys.stdin.readlines()]
records = [x.partition('=') for x in records if x and x[0] not in ('#', '[')]