mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 03:59:59 -04:00
Play the sound on a chosen output device: the audio_device setting and --audio-device pick it by index or part of its name, --list-audio-devices prints the devices, and a chosen device that goes away hands the output to the default one.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
// nx2navi.exe entry: reserves the guest address space, parses the command line and runs one mode.
|
||||
//
|
||||
// nx2navi.exe [--exefs DIR] [--romfs DIR] [--profile DIR] <mode>
|
||||
// nx2navi.exe [--exefs DIR] [--romfs DIR] [--profile DIR] [--audio-device VALUE] <mode>
|
||||
// --audio-device VALUE play the sound on one output device: sets NX2NAVI_AUDIO_DEVICE before the settings are read, so
|
||||
// it wins over nx2navi.ini's `audio_device =`. VALUE is default (the system default device),
|
||||
// a 1-based index as --list-audio-devices prints it (devices sorted by name), or part of a device name, case-insensitive
|
||||
// --list-audio-devices print each playback device's index, name, channels and frequency, mark the system default and
|
||||
// show which device NX2NAVI_AUDIO_DEVICE picks; needs no game files
|
||||
// --selftest layout, dispatch table and host-function registry; needs no game files
|
||||
// --probe-mods the mods folder scan, order and switches (mods.c); needs no game files
|
||||
// --probe-loader load and relocate the modules, check them against the measured 1.2.1 values
|
||||
@@ -475,7 +480,7 @@ static int probe_crash(int null) {
|
||||
}
|
||||
|
||||
static int usage(const char *argv0) {
|
||||
fprintf(stderr, "usage: %s [--exefs DIR] [--romfs DIR] [--profile DIR] [--selftest | --probe-loader | "
|
||||
fprintf(stderr, "usage: %s [--exefs DIR] [--romfs DIR] [--profile DIR] [--audio-device VALUE] [--list-audio-devices | --selftest | --probe-loader | "
|
||||
"--probe-cfg | --probe-dpi | --probe-mods | --probe-kernel | --probe-ipc | --probe-services | --probe-fs | --probe-gfx-abi | "
|
||||
"--probe-nvn | --probe-nvn-tex | --probe-window | --probe-shader | --probe-vkmem | "
|
||||
"--probe-vkexec | --probe-astc | --probe-movie | --probe-crash-call | --probe-crash-null | --probe-discord | "
|
||||
@@ -554,6 +559,12 @@ int main(int argc, char **argv) {
|
||||
if (path) {
|
||||
if (++i == argc) return usage(argv[0]);
|
||||
*path = argv[i];
|
||||
} else if (!strcmp(argv[i], "--audio-device")) {
|
||||
// Same approach as every setting: NX2NAVI_AUDIO_DEVICE is read from the environment first (cfg.c raw_get), and
|
||||
// nothing has read it yet because the audio renderer opens in rt_boot. An empty value would remove the variable
|
||||
// (plat_setenv) and hand the choice back to nx2navi.ini, so "default" is the spelling for the system default.
|
||||
if (++i == argc || !*argv[i]) return usage(argv[0]);
|
||||
plat_setenv("NX2NAVI_AUDIO_DEVICE", argv[i]);
|
||||
} else if (!strcmp(argv[i], "--seconds")) {
|
||||
char *end;
|
||||
if (++i == argc) return usage(argv[0]);
|
||||
@@ -579,6 +590,7 @@ int main(int argc, char **argv) {
|
||||
return 0;
|
||||
}
|
||||
if (!strcmp(mode, "--selftest")) return selftest();
|
||||
if (!strcmp(mode, "--list-audio-devices")) return list_audio_devices();
|
||||
if (!strcmp(mode, "--probe-loader")) return probe_loader();
|
||||
if (!strcmp(mode, "--probe-crash-call")) return probe_crash(0);
|
||||
if (!strcmp(mode, "--probe-crash-null")) return probe_crash(1);
|
||||
|
||||
Reference in New Issue
Block a user