Commit 77de0a16 authored by dylan grafmyre's avatar dylan grafmyre
Browse files

automated navgen supervising

parent d95df33f
......@@ -4,7 +4,7 @@ PROJECT_DIR?=C:\\hammer\ttt_terrorcon
PYTHON_BIN?=./env/scripts/python
SHLEX_BIN?=./contrib/shlex
SHLEX_FLAGS?=
SHLEX_FLAGS?=--low
EPOLL_THEN_BIN?=$(PYTHON_BIN) ./contrib/epoll-then
EPOLL_THEN_FLAGS?=
......@@ -181,10 +181,9 @@ maps/%.bsp: %.bsp
$(SHLEX_BIN) $(SHLEX_FLAGS) $(SHLEX_HL2LOG_FLAGS) \
"'$(GAME_DIR)$(GAME)'" -allowdebug $(VBIN_FLAGS) $(GAME_FLAGS) $(GAME_TTT_FLAGS) \
+sv_cheats 1 +nav_edit 1 +map navgen &
sleep 2
$(SHLEX_BIN) $(SHLEX_FLAGS) $(EPOLL_THEN_BIN) $(EPOLL_THEN_FLAGS) \
--literal "''" --file "'$(MOD_DIR)/data/runme.txt'" --timeout-sec 1800 -- \
taskkill -f -pid "$(shell $(WINPGREP_BIN) $(WINPGREP_FLAGS) hl2.exe )"
--literal ng_f --file "'$(MOD_DIR)/data/runme.txt'" --timeout-sec 1800 -- \
taskkill -f -pid "`$(WINPGREP_BIN) $(WINPGREP_FLAGS) hl2.exe`"
# ^ watch "$(MOD_DIR)/data/runme.txt" for content "ng_f", when match: kill hl2.exe
# timeout: 30min
cp -v "$(MOD_DIR)/maps/navgen.nav" $@
......@@ -218,16 +217,16 @@ maps/%.bsp: %.bsp
# addons-src/materials/vgui/maps/*.vtf
# addons-src/maps/*.res
# $(GMAD_BIN) $(GMAD_FLAGS) create -folder "addons-src" -out "$@"
addons/%.gma: %.bsp %.cubehdr addons-src/addon.json
addons/%.gma: %.bsp %.nav %.cubehdr addons-src/addon.json
rm -rv \
addons-src/maps/*.bsp \
addons-src/maps/thumb/*.png \
|| true
cp $(word 1, $^) addons-src/maps/
cp $(word 2, $^) addons-src/maps/
cp $(word 1, $^) addons-src/maps/ # bsp
cp $(word 2, $^) addons-src/maps/ # nav
mkdir -p addons-src/maps/graphs/
cp $(basename $(word 2, $^)).ain addons-src/maps/graphs/
cp thumbnail_map_128.png addons-src/maps/thumb/$(basename $(word 1, $^)).png
cp $(basename $(word 2, $^)).ain addons-src/maps/graphs/ # nav2
cp thumbnail_map_128.png addons-src/maps/thumb/$(basename $(word 1, $^)).png # in-game thumb
$(GMA_INSTALL_BSPZIP_ADDLIST_BIN) $(GMA_INSTALL_BSPZIP_ADDLIST_FLAGS) --bspzip-addlist $(basename $(word 1, $^)).bspzip-addlist --dst-prefix addons-src
$(GMAD_TAR_BIN) addons-src/ --output-tar $(@:.gma=.tar) --tar-prefix $(basename $(word 1, $^)) --gmad-bin $(GMAD_BIN) --output-gma $@ --output-index $(@:.gma=.tar-index) --output-digest $(@:.gma=.tar-sha1sums)
......
......@@ -16,10 +16,12 @@ LOGGER = logging.getLogger(os.path.basename(__file__))
ARGP = argparse.ArgumentParser()
ARGP.add_argument('--subprocess-shell', '-S', action='store_true')
ARGP.add_argument('--verbose', '-v', action='store_true')
ARGP.add_argument('--low', action='store_true')
ARGP.add_argument('--tail-bin')
ARGP.add_argument('--tail', help="follow a file while supervising a subprocess")
ARGP.add_argument('remainder', nargs=argparse.REMAINDER)
BELOW_NORMAL_PRIORITY_CLASS = 0x00004000
RE_GITBASH_STYLE = re.compile('^/(\w)/')
def main(argp=None, argv=None):
......@@ -66,7 +68,11 @@ def main(argp=None, argv=None):
tail_popen = subprocess.Popen([argp.tail_bin, '-fn0', argp.tail], stdout=sys.stderr.buffer)
cproc = None
try:
cproc = subprocess.run(execve, shell=argp.subprocess_shell)
cproc = subprocess.run(
execve,
shell=argp.subprocess_shell,
creationflags=(BELOW_NORMAL_PRIORITY_CLASS if argp.low else None),
)
except OSError as err:
LOGGER.error('%s:%s\nprogram: %r', err.__class__.__name__, err, execve[0])
return 2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment