Fix microphone capture in DirectAudio games (#747)

This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-10-14 00:58:52 -04:00
1 parent 7ab10aef04
commit f9b58837d0
3 files changed
+26

No files matched your search

@@ -300,6 +300,7 @@ def main():
if not command:
return 2
env = os.environ.copy()
mic_enabled = env.get("BL_MIC_ENABLED")
mark_install_scripts(command, env)
app_id = game_id(env)
if app_id:
@@ -328,6 +329,8 @@ def main():
env = apply_config(env, {"version": 1}, app_id, fixes)
except (OSError, ValueError, TypeError, AttributeError):
print("droiddeck-game-env: invalid configuration; using inherited environment", file=sys.stderr)
if mic_enabled == "0":
env["BANNER_AUDIO_DIRECT_MIC"] = "0"
env = force_ssbs(command, env)
command, env = start_without_steam(command, env, app_id)
sync = load_sync()
+21
View File
@@ -43,6 +43,27 @@ class ReadConfigMappingTest(unittest.TestCase):
class GameEnvironmentTest(unittest.TestCase):
def test_directaudio_capture_follows_the_session_microphone_setting(self):
with tempfile.TemporaryDirectory() as tmp:
home = Path(tmp)
probe = home / "probe"
probe.write_text("#!" + sys.executable + "\nimport os\nprint(os.environ.get('BANNER_AUDIO_DIRECT_MIC', 'unset'))\n")
probe.chmod(0o755)
config = home / ".config/droiddeck/game-environment.json"
config.parent.mkdir(parents=True)
for enabled, override, expected in (("1", None, "1"), ("0", "1", "0"), ("1", "0", "0")):
with self.subTest(enabled=enabled, override=override):
profile = {} if override is None else {
"BANNER_AUDIO_DIRECT_MIC": override, "BL_MIC_ENABLED": override,
}
config.write_text(json.dumps({"version": 1, "games": {"42": profile}}))
env = dict(os.environ, HOME=tmp, BL_MIC_ENABLED=enabled,
BANNER_AUDIO_DIRECT_MIC="1", STEAM_COMPAT_DATA_PATH="/compatdata/42")
result = subprocess.run([sys.executable, str(BIN / "droiddeck-game-env"),
str(probe), "waitforexitandrun"],
env=env, text=True, capture_output=True, check=True)
self.assertEqual(result.stdout.strip(), expected)
def test_the_install_script_evaluator_gets_its_scripts_marked_first(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)