Support setting options in all cases where dsda is invoked.

Also allow overriding options for the fabricate and record commands.
This commit is contained in:
yrriban 2025-07-26 10:56:37 -04:00
parent 469d8eb13a
commit 00334120b0
3 changed files with 25 additions and 6 deletions

View file

@ -58,6 +58,17 @@ class Wad(dcc.config.Base):
wads = [self.pwad_path.joinpath(wad) for wad in wads] wads = [self.pwad_path.joinpath(wad) for wad in wads]
return wads return wads
def options_dict(self):
return self._config.get("options", {})
def options(self):
options = []
for k, v in self.options_dict().items():
list.append(options, f"{k}={v}")
if len(options) > 0:
return ["-assign", ",".join(options)]
return []
class WadMap(Wad): class WadMap(Wad):
def get_parser(self, prog_name): def get_parser(self, prog_name):
@ -95,6 +106,7 @@ class WadMap(Wad):
args = args + ["-complevel", str(self.complevel())] args = args + ["-complevel", str(self.complevel())]
args = args + ["-skill", "4"] args = args + ["-skill", "4"]
args = args + ["-warp", self.map] args = args + ["-warp", self.map]
args = args + self.options()
return args return args
def complevel(self): def complevel(self):

View file

@ -18,13 +18,14 @@ class Fabricate(dcc.doom_base.WadMap):
command = [self.dsda] command = [self.dsda]
if not parsed_args.fg and shutil.which("xvfb-run") is not None: if not parsed_args.fg and shutil.which("xvfb-run") is not None:
command = ["xvfb-run"] + command command = ["xvfb-run"] + command
options = []
for k, v in self._config.get("fabricate_options", {}).items():
list.append(options, f"{k}={v}")
if len(options) > 0:
options = ["-assign", ",".join(options)]
subprocess.run( subprocess.run(
command + self.dsda_preamble() + options command + self.dsda_preamble()
+ ["-timedemo", self.demo_in_path()] + ["-timedemo", self.demo_in_path()]
+ ["-viddump", self.video_path()] + ["-viddump", self.video_path()]
) )
def options_dict(self):
opt_dict = super().options_dict()
for k, v in self._config.get("fabricate_options", {}).items():
opt_dict[k] = v
return opt_dict

View file

@ -9,3 +9,9 @@ class Record(dcc.doom_base.WadMap):
[self.dsda] + self.dsda_preamble() + [self.dsda] + self.dsda_preamble() +
["-record", self.demo_out_path()] ["-record", self.demo_out_path()]
) )
def options_dict(self):
opt_dict = super().options_dict()
for k, v in self._config.get("record_options", {}).items():
opt_dict[k] = v
return opt_dict