Create method to return MAME shaders

This commit is contained in:
Mathieu Comandon 2021-08-30 14:54:23 -07:00
parent 4980ef1a9a
commit b8f879fbb6

View file

@ -278,6 +278,18 @@ class mame(Runner): # pylint: disable=invalid-name
)
return True
def get_shader_params(self, shader_dir, shaders):
"""Returns a list of CLI parameters to apply a list of shaders"""
params = []
shader_path = os.path.join(self.working_dir, "shaders", shader_dir)
for index, shader in enumerate(shaders):
params += [
"-gl_glsl",
"-glsl_shader_mame%s" % index,
os.path.join(shader_path, shader)
]
return params
def play(self):
command = [self.get_executable(), "-skip_gameinfo", "-inipath", self.config_dir]
if self.runner_config.get("video"):
@ -290,14 +302,7 @@ class mame(Runner): # pylint: disable=invalid-name
command += ["-uimodekey", self.runner_config["uimodekey"]]
if self.runner_config.get("crt"):
shader_path = os.path.join(self.working_dir, "shaders/CRT-geom")
shaders = ["Gaussx", "Gaussy", "CRT-geom-halation"]
for index, shader in enumerate(shaders):
command += [
"-gl_glsl",
"-glsl_shader_mame%s" % index,
os.path.join(shader_path, shader)
]
command += self.get_shader_params("CRT-geom", ["Gaussx", "Gaussy", "CRT-geom-halation"])
command += ["-nounevenstretch"]
if self.game_config.get("machine"):