From 267add3227d88a66498b5d3eb97b56c3fcee5859 Mon Sep 17 00:00:00 2001 From: bicarus <202771338+bicarus-dev@users.noreply.github.com> Date: Thu, 11 Jun 2026 00:40:53 -0700 Subject: [PATCH] iidx: set SOUND_OUTPUT_DEVICE even when -iidx is not enabled (#749) ## Link to GitHub Issue or related Pull Request, if one exists n/a ## Description of change For cab usage, when `-exec bm2dx.dll` is used without `-iidx` then SOUND_OUTPUT_DEVICE never gets set. Change this so that `SOUND_OUTPUT_DEVICE` gets set unconditionally if `-iidxsounddevice` is set. ## Testing --- src/spice2x/games/iidx/iidx.cpp | 6 +----- src/spice2x/launcher/launcher.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/spice2x/games/iidx/iidx.cpp b/src/spice2x/games/iidx/iidx.cpp index e6f74ec..ce74cec 100644 --- a/src/spice2x/games/iidx/iidx.cpp +++ b/src/spice2x/games/iidx/iidx.cpp @@ -543,11 +543,7 @@ namespace games::iidx { // if the user specified a value (other than auto), use it as the environment var // probably "wasapi" or "asio", but it's not explicitly checked here for forward compat if (SOUND_OUTPUT_DEVICE.has_value() && SOUND_OUTPUT_DEVICE.value() != "auto") { - log_info( - "iidx", - "using user-supplied \"{}\" for SOUND_OUTPUT_DEVICE", - SOUND_OUTPUT_DEVICE.value()); - SetEnvironmentVariable("SOUND_OUTPUT_DEVICE", SOUND_OUTPUT_DEVICE.value().c_str()); + // the environemnt variable was already set in launcher.cpp SOUND_OUTPUT_DEVICE_IN_EFFECT = SOUND_OUTPUT_DEVICE; return; } diff --git a/src/spice2x/launcher/launcher.cpp b/src/spice2x/launcher/launcher.cpp index f184e33..8843676 100644 --- a/src/spice2x/launcher/launcher.cpp +++ b/src/spice2x/launcher/launcher.cpp @@ -1644,12 +1644,23 @@ int main_implementation(int argc, char *argv[]) { GRAPHICS_FS_ORIENTATION_SWAP = true; } + + // for cab usage - set environment variables (outside of -iidx module) if (games::iidx::DISABLE_CAMS.has_value() && games::iidx::DISABLE_CAMS.value() && !cfg::CONFIGURATOR_STANDALONE) { - log_misc("launcher", "CONNECT_CAMERA env var set to 0"); + log_misc("launcher::iidx", "CONNECT_CAMERA env var set to 0"); SetEnvironmentVariable("CONNECT_CAMERA", "0"); } + if (games::iidx::SOUND_OUTPUT_DEVICE.has_value() && + games::iidx::SOUND_OUTPUT_DEVICE.value() != "auto" && + !cfg::CONFIGURATOR_STANDALONE) { + log_info( + "launcher::iidx", + "using user-supplied \"{}\" for SOUND_OUTPUT_DEVICE", + games::iidx::SOUND_OUTPUT_DEVICE.value()); + SetEnvironmentVariable("SOUND_OUTPUT_DEVICE", games::iidx::SOUND_OUTPUT_DEVICE.value().c_str()); + } // deleted options if (options[launcher::Options::OpenKFControl].value_bool() && !cfg::CONFIGURATOR_STANDALONE) {