diff --git a/runtime/audio_mixer.c b/runtime/audio_mixer.c index 74b9a149..300252d1 100644 --- a/runtime/audio_mixer.c +++ b/runtime/audio_mixer.c @@ -25,6 +25,7 @@ #include +#include "menu_sound.h" #include "cfg.h" #include "audio_effects.h" #include "audio_reverb.h" @@ -202,6 +203,7 @@ static void SDLCALL sdl_pull(void *user, SDL_AudioStream *stream, int additional if (!frames) break; if (frames > 1024) frames = 1024; ring_pull(m, tmp, frames); + menu_sound_mix(tmp, frames, (int)m->channels, (int)m->rate); // the settings menu's sounds (menu_sound.c) if (!SDL_PutAudioStreamData(stream, tmp, (int)(frames * frame_bytes))) break; additional -= (int)(frames * frame_bytes); } diff --git a/runtime/cfg.c b/runtime/cfg.c index de0a8629..108b44fe 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -44,7 +44,7 @@ static const char *const known[] = { "FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FLUSH_SPAN", "FOV", "FOV_PATCH", "FPS60", "FPS_LIMIT", "FREEZE_IDLE", "FREE_CORES", "FULLSCREEN", "FXAA", "GAME_ASPECT", "GPA", "GPA_EMPTY", "GPL", "GPL_DRAW_BUILD", "GPU", "GPU_INDEX", "GPU_NAME", "HDR", "HDR_GAME_NITS", "HDR_HUE", "HDR_PEAK_NITS", "HDR_UI_NITS", "HIGHFPS_FIX", "INPUT", "INPUT_RECORD", "INPUT_SCRIPT", "LANG", "LIB_PREBUILD", - "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MEMORY", "MENU_LANG", "MENU_TEST", + "LIB_PREBUILD_KEEP", "LIB_PREBUILD_THREADS", "LOCALE", "LOD_GUARD", "LSTICK_DEADZONE", "MEMORY", "MENU_LANG", "MENU_SOUND_VOLUME", "MENU_TEST", "MENU_CURSOR", "MENU_CURSOR_LOG", "MENU_TEST_DIR", "MENU_TEST_SET", "MINIMAL_LAYOUT", "MIRROR_GAP", "MODS_DIR", "MODS_DISABLED", "MODS_ORDER", "MODS_REBUILD", "MOTION", "MOUSE_MODE", "MOUSE_DIRECT_PATCH", "MOUSE_SENS", "MOVIE_HOST", "MOVIE_PACE", "MVOBJ_ALL", "MVOBJ_BANKS", "MVOBJ_EQUAL", "MVOBJ_EXACT", "MVOBJ_EXEC", "MVOBJ_NOC4", "MVOBJ_ONLY", "MVOBJ_TIMES", "MVPREV_CHECK", "MVPREV_GROW", "MVPREV_SKIP", "MVPREV_TRUST", "MV_CHECK", "MV_SURVEY", @@ -81,7 +81,7 @@ static const struct { const char *key, *section; } sections[] = { {"PCSS", "display"}, {"MODS_DIR", "mods"}, {"MODS_ORDER", "mods"}, {"MODS_DISABLED", "mods"}, {"MODS_REBUILD", "mods"}, {"MENU_LANG", "language"}, {"LANG", "language"}, {"OPERATION_MODE", "language"}, - {"VOLUME", "audio"}, {"AUDIO_CHANNELS", "audio"}, + {"VOLUME", "audio"}, {"AUDIO_CHANNELS", "audio"}, {"MENU_SOUND_VOLUME", "audio"}, {"MOTION", "input"}, {"RUMBLE_STRENGTH", "input"}, {"RUMBLE_CURVE", "input"}, {"RUMBLE_TRIGGERS", "input"}, {"PAD_LAYOUT", "input"}, {"PROMPTS", "input"}, {"STICK_DEADZONE", "input"}, {"LSTICK_DEADZONE", "input"}, {"RSTICK_DEADZONE", "input"}, {"STICK_SENS", "input"}, @@ -144,7 +144,7 @@ static const CfgMeta metas[] = { {"OPERATION_MODE", "docked", "docked|handheld", RESTART}, {"ASSUME_FOCUS", "1", "0|1", LIVE}, // read on every focus change (ov_system.c) // Sound, Controls, Menu - {"VOLUME", "100", "0..100", LIVE}, {"AUDIO_CHANNELS", "stereo", "auto|stereo|5.1", RESTART}, + {"VOLUME", "100", "0..100", LIVE}, {"MENU_SOUND_VOLUME", "80", "0..100", LIVE}, {"AUDIO_CHANNELS", "stereo", "auto|stereo|5.1", RESTART}, {"MOTION", "1", "0|1", LIVE}, {"RUMBLE_STRENGTH", "130", "0..300", LIVE}, {"RUMBLE_CURVE", "0.6", "0.2..1.5", LIVE}, {"RUMBLE_TRIGGERS", "0", "0|1", LIVE}, {"PAD_LAYOUT", "auto", "auto|nintendo|xbox", LIVE}, {"PROMPTS", "nintendo", "nintendo|xbox|pc", RESTART}, diff --git a/runtime/fs.h b/runtime/fs.h index 90903e61..b8846c07 100644 --- a/runtime/fs.h +++ b/runtime/fs.h @@ -32,6 +32,7 @@ uint32_t romfs_open(uint64_t *out, const char *path, int mode); uint32_t romfs_read(uint64_t *out, uint64_t h, int64_t offset, void *buffer, uint64_t size); uint32_t romfs_size(int64_t *out, uint64_t h); void romfs_close(uint64_t h); +uint8_t *romfs_load(const char *rel, uint64_t *size_out); // whole file by RomFS-relative path, malloc'd (or NULL) uint32_t romfs_entry_type(int *out, const char *path); // The children of RomFS directory path: fn(name, is_dir, size, ctx) once per file and once per subdirectory, in // index order; fn returns 0 to stop. FS_R_PATH_NOT_FOUND when path is not a directory. diff --git a/runtime/menu_sound.c b/runtime/menu_sound.c new file mode 100644 index 00000000..f080473e --- /dev/null +++ b/runtime/menu_sound.c @@ -0,0 +1,189 @@ +// The settings menu's sounds: the game's own interface sounds (Sound/Resource/Stream/SE_Sys_*.bwav in the user's RomFS: +// cursor, decide, cancel, the Plus menu's open and close, the tab moves), decoded once and mixed over the game's output +// in the audio device callback (audio_mixer.c sdl_pull). Nothing is shipped: a RomFS without them stays silent. +// +// BWAV: "BWAV", byte order mark, version, CRC32, a prefetch flag (u16) and the channel count (u16), then 0x4C bytes per +// channel: codec (u16, 0 PCM16, 1 DSP-ADPCM), pan (u16, 0 left, 1 right, 2 middle), sample rate, sample count (u32), +// the count again, 16 DSP coefficients (s16), the absolute offset of the samples (u32), ... The interface sounds are +// 48 kHz DSP-ADPCM: 8-byte frames of a header (coefficient pair index, scale exponent) and 14 four-bit samples. +// +// Menu thread: menu_sound_play starts a voice (a free one, else the oldest). Audio thread: menu_sound_mix adds the +// voices to a block. A voice is free while its position is negative; the menu thread sets its sound first and its +// position last (release), the audio thread reads them in the other order (acquire). +// +// NX2NAVI_MENU_SOUND_VOLUME (menu_sound_volume, 0 to 100, default 80; 0 is silent): the level, under the output volume. +#include +#include +#include +#include + +#include "cfg.h" +#include "fs.h" +#include "host.h" +#include "menu_sound.h" +#include "platform/platform.h" + +typedef struct { + float *pcm; // interleaved stereo at 48 kHz + uint32_t frames; +} Sound; + +static const char *const kFiles[MENU_SOUND_COUNT] = { + [MENU_SOUND_OPEN] = "Sound/Resource/Stream/SE_Sys_PlusMenu_Open00.bwav", + [MENU_SOUND_CLOSE] = "Sound/Resource/Stream/SE_Sys_PlusMenu_Close00.bwav", + [MENU_SOUND_CURSOR] = "Sound/Resource/Stream/SE_Sys_Cursor00.bwav", + [MENU_SOUND_DECIDE] = "Sound/Resource/Stream/SE_Sys_Do00.bwav", + [MENU_SOUND_CANCEL] = "Sound/Resource/Stream/SE_Sys_Cancel00.bwav", + [MENU_SOUND_TAB_LEFT] = "Sound/Resource/Stream/SE_Sys_MinusMenu_TabMove_L00.bwav", + [MENU_SOUND_TAB_RIGHT] = "Sound/Resource/Stream/SE_Sys_MinusMenu_TabMove_R00.bwav", +}; + +static Sound sounds[MENU_SOUND_COUNT]; +static atomic_int loaded; // 0 not yet, 1 loading or done (sounds[] written before the release store of 2), 2 ready + +#define VOICES 8 +static struct { + atomic_int pos; // frame, -1 free + atomic_int sound; + uint64_t started; +} voices[VOICES]; +static uint64_t started_n; + +static uint16_t u16(const uint8_t *p) { return (uint16_t)(p[0] | p[1] << 8); } +static uint32_t u32(const uint8_t *p) { return (uint32_t)p[0] | (uint32_t)p[1] << 8 | (uint32_t)p[2] << 16 | (uint32_t)p[3] << 24; } + +static int16_t clamp16(int32_t v) { return (int16_t)(v < -32768 ? -32768 : v > 32767 ? 32767 : v); } + +// One channel into dst[2 * i + ch] (ch 0 or 1; mono pan writes both). 0 when the data does not fit the file. +static int decode_channel(const uint8_t *b, uint64_t size, const uint8_t *info, float *dst, uint32_t frames) { + uint16_t codec = u16(info), pan = u16(info + 2); + uint32_t count = u32(info + 8), off = u32(info + 0x30); + if (count > frames) count = frames; + int16_t coef[16]; + for (int i = 0; i < 16; i++) coef[i] = (int16_t)u16(info + 0x10 + 2 * i); + float scale = 1.0f / 32768.0f; + if (codec == 0) { // PCM16 + if ((uint64_t)off + (uint64_t)count * 2 > size) return 0; + for (uint32_t i = 0; i < count; i++) { + float v = (int16_t)u16(b + off + 2 * i) * scale; + if (pan != 1) dst[2 * i] += v; + if (pan != 0) dst[2 * i + 1] += v; + } + return 1; + } + if (codec != 1) return 0; + uint64_t need = ((uint64_t)count + 13) / 14 * 8; + if ((uint64_t)off + need > size) return 0; + int32_t h1 = 0, h2 = 0; + for (uint32_t i = 0; i < count; i++) { + const uint8_t *fr = b + off + (i / 14) * 8; + uint32_t k = i % 14; + int idx = fr[0] >> 4 & 7, sh = fr[0] & 15; + int nib = fr[1 + k / 2] >> (k & 1 ? 0 : 4) & 15; + if (nib >= 8) nib -= 16; + int32_t s = ((nib << sh) << 11) + coef[2 * idx] * h1 + coef[2 * idx + 1] * h2; + int16_t v = clamp16((s + 1024) >> 11); + h2 = h1, h1 = v; + if (pan != 1) dst[2 * i] += v * scale; + if (pan != 0) dst[2 * i + 1] += v * scale; + } + return 1; +} + +static void load_one(int id) { + uint64_t size = 0; + uint8_t *b = romfs_load(kFiles[id], &size); + if (!b) return; + if (size < 0x10 || memcmp(b, "BWAV", 4)) { free(b); return; } + uint16_t nch = u16(b + 0x0e); + if (!nch || nch > 2 || 0x10 + (uint64_t)nch * 0x4c > size) { free(b); return; } + uint32_t rate = u32(b + 0x10 + 4), frames = u32(b + 0x10 + 8); + if (rate != 48000 || !frames || frames > 48000 * 10) { // the interface sounds are 48 kHz and short + rt_log("menu_sound: %s: %u Hz, %u samples: not played", kFiles[id], rate, frames); + free(b); + return; + } + float *pcm = calloc((size_t)frames * 2, sizeof *pcm); + int ok = pcm != NULL; + for (uint16_t c = 0; ok && c < nch; c++) ok = decode_channel(b, size, b + 0x10 + c * 0x4c, pcm, frames); + free(b); + if (!ok) { free(pcm); return; } + if (nch == 1) for (uint32_t i = 0; i < frames * 2; i++) pcm[i] *= 0.7071f; // a middle-panned mono sound in both + sounds[id] = (Sound){pcm, frames}; +} + +static void load_all(void) { + int expect = 0; + if (!atomic_compare_exchange_strong(&loaded, &expect, 1)) return; + int n = 0; + for (int i = 0; i < MENU_SOUND_COUNT; i++) { + load_one(i); + n += sounds[i].pcm != NULL; + } + for (int i = 0; i < VOICES; i++) atomic_store(&voices[i].pos, -1); + rt_log("menu_sound: %d of %d interface sounds from the RomFS", n, MENU_SOUND_COUNT); + atomic_store_explicit(&loaded, 2, memory_order_release); +} + +// The menu's level times the output volume (NX2NAVI_VOLUME, as the game's sound has it). +static float volume(void) { + const char *v = cfg_value("NX2NAVI_MENU_SOUND_VOLUME"); + int n = v && *v ? atoi(v) : 80; + double master = cfg_double("NX2NAVI_VOLUME"); + if (master < 0) master = 0; + if (master > 100) master = 100; + return n <= 0 ? 0.0f : (float)((n >= 100 ? 1.0 : n / 100.0) * master / 100.0); +} + +static _Atomic uint64_t last_start_ns; + +void menu_sound_play(MenuSound id) { + if ((unsigned)id >= MENU_SOUND_COUNT || volume() <= 0) return; + // A cursor tick right after another sound (the focus moving with a tab change or a press) is the same action. + uint64_t now = plat_now_ns(); + if (id == MENU_SOUND_CURSOR && now - atomic_load(&last_start_ns) < 40000000ull) return; + atomic_store(&last_start_ns, now); + if (atomic_load_explicit(&loaded, memory_order_acquire) != 2) load_all(); + if (atomic_load_explicit(&loaded, memory_order_acquire) != 2 || !sounds[id].pcm) return; + int pick = -1; + uint64_t oldest = UINT64_MAX; + for (int i = 0; i < VOICES; i++) { + if (atomic_load_explicit(&voices[i].pos, memory_order_acquire) < 0) { pick = i; break; } + if (voices[i].started < oldest) oldest = voices[i].started, pick = i; + } + // A sound that replaces itself (holding a direction) restarts instead of stacking up. + for (int i = 0; i < VOICES; i++) + if (atomic_load_explicit(&voices[i].pos, memory_order_acquire) >= 0 && atomic_load(&voices[i].sound) == (int)id && + atomic_load(&voices[i].pos) < 2400) { // started under 50 ms ago + pick = i; + break; + } + atomic_store_explicit(&voices[pick].pos, -1, memory_order_release); + atomic_store_explicit(&voices[pick].sound, (int)id, memory_order_relaxed); + voices[pick].started = __atomic_add_fetch(&started_n, 1, __ATOMIC_RELAXED); + atomic_store_explicit(&voices[pick].pos, 0, memory_order_release); +} + +void menu_sound_mix(float *out, uint32_t frames, int channels, int rate) { + if (atomic_load_explicit(&loaded, memory_order_acquire) != 2 || rate != 48000 || channels < 2) return; + float g = -1; + for (int v = 0; v < VOICES; v++) { + int pos = atomic_load_explicit(&voices[v].pos, memory_order_acquire); + if (pos < 0) continue; + const Sound *s = &sounds[atomic_load_explicit(&voices[v].sound, memory_order_relaxed)]; + if (g < 0) g = volume(); + uint32_t n = s->frames - (uint32_t)pos < frames ? s->frames - (uint32_t)pos : frames; + const float *src = s->pcm + (size_t)pos * 2; + for (uint32_t i = 0; i < n; i++) { + out[(size_t)i * channels] += src[2 * i] * g; + out[(size_t)i * channels + 1] += src[2 * i + 1] * g; + } + int next = pos + (int)n; + // Only advance if the menu thread did not restart the voice meanwhile. + atomic_compare_exchange_strong(&voices[v].pos, &pos, next >= (int)s->frames ? -1 : next); + } +} + +void menu_sound_preload(void) { + if (atomic_load_explicit(&loaded, memory_order_acquire) == 0) load_all(); +} diff --git a/runtime/menu_sound.h b/runtime/menu_sound.h new file mode 100644 index 00000000..57f7317d --- /dev/null +++ b/runtime/menu_sound.h @@ -0,0 +1,27 @@ +// The settings menu's sounds, from the game's own interface sounds (menu_sound.c). +#pragma once +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + MENU_SOUND_OPEN, + MENU_SOUND_CLOSE, + MENU_SOUND_CURSOR, + MENU_SOUND_DECIDE, + MENU_SOUND_CANCEL, + MENU_SOUND_TAB_LEFT, + MENU_SOUND_TAB_RIGHT, + MENU_SOUND_COUNT +} MenuSound; + +void menu_sound_play(MenuSound id); // menu thread +void menu_sound_preload(void); // decodes the sounds now (the first play does it otherwise) +// Audio thread: adds the playing sounds to frames of interleaved float output (channels 0 and 1 get them). +void menu_sound_mix(float *out, uint32_t frames, int channels, int rate); + +#ifdef __cplusplus +} +#endif diff --git a/runtime/romfs.c b/runtime/romfs.c index 86db66b6..8f4f01b7 100644 --- a/runtime/romfs.c +++ b/runtime/romfs.c @@ -1024,6 +1024,30 @@ const char *romfs_entry(uint64_t i, uint64_t *offset, uint64_t *size) { } const char *romfs_image_path(void) { return image_file; } +// The whole of a RomFS file by its path from the RomFS root, for host-side readers (menu_sound.c: the game's own +// interface sounds); malloc'd, NULL when the file is absent or not in the image (an added mod file). The original +// file, not a mod's replacement. +uint8_t *romfs_load(const char *rel, uint64_t *size_out) { + if (!rel || !image) return NULL; + uint64_t i = file_index(rel); + if (i >= file_count) return NULL; + Entry e = entry(i); + uint8_t *b = malloc(e.size ? (size_t)e.size : 1); + if (!b) return NULL; + if (image_map) { + memcpy(b, image_map + e.offset, (size_t)e.size); + } else { + for (uint64_t done = 0; done < e.size;) { + uint32_t chunk = e.size - done > READ_CHUNK ? READ_CHUNK : (uint32_t)(e.size - done); + int64_t r = read_at(image, b + done, chunk, e.offset + done); + if (r <= 0) { free(b); return NULL; } + done += (uint64_t)r; + } + } + if (size_out) *size_out = e.size; + return b; +} + size_t romfs_overlay_count(void) { return noverlay; } diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index dcd4f6a3..14c94c8d 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -29,6 +29,7 @@ static int g_font_bad; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-function" #include "imstb_truetype.h" +#include "menu_sound.h" #pragma clang diagnostic pop #include "ui/amiibo_page.h" #include "ui/binds_page.h" @@ -88,6 +89,7 @@ static int change_open(int want) { g_open.store(open); g_reset.store(1); input_menu(open); + menu_sound_play(open ? MENU_SOUND_OPEN : MENU_SOUND_CLOSE); rt_log("menu: %s", open ? "open" : "closed"); } plat_mutex_unlock(&open_lock); @@ -717,6 +719,7 @@ static void tab_game(float scale) { static void tab_sound(float scale) { opt_begin("##sound", scale); opt_slider("NX2NAVI_VOLUME", UI_MENU_VOLUME, 0, 100, UI_MENU_VOLUME_DESC, 5, "%.0f %%"); + opt_slider("NX2NAVI_MENU_SOUND_VOLUME", UI_MENU_MENU_SOUNDS, 0, 100, UI_MENU_MENU_SOUNDS_DESC, 5, "%.0f %%"); static const UiTextId channels[] = {UI_MENU_CHANNELS_AUTO, UI_MENU_CHANNELS_STEREO, UI_MENU_CHANNELS_51}; opt_choice("NX2NAVI_AUDIO_CHANNELS", UI_MENU_AUDIO_CHANNELS, channels, 3, UI_MENU_AUDIO_CHANNELS_DESC); opt_end(); @@ -825,7 +828,7 @@ static void restart_confirm(void) { } ImGui::EndDisabled(); if (ImGui::IsKeyPressed(ImGuiKey_Escape, false) || ImGui::IsKeyPressed(ImGuiKey_GamepadFaceRight, false)) - close = true; + close = true, menu_sound_play(MENU_SOUND_CANCEL); if (close) { ImGui::CloseCurrentPopup(); restart_rebuild = false; @@ -869,6 +872,22 @@ static void go_to(int tab, const char *key) { opt_focus_key(key); } +// The game's interface sounds (menu_sound.c) for what the frame did: a press or click on an item, the cursor on another +// item, another tab by a click (L and R play theirs where they are read). The first frame after opening only records. +static void menu_sounds_frame(void) { + ImGuiContext &g = *GImGui; + static int last_frame = -2, last_tab = -1; + static ImGuiID last_nav; + bool fresh = g.FrameCount != last_frame + 1; + last_frame = g.FrameCount; + if (!fresh) { + if (g.ActiveId && g.ActiveIdIsJustActivated) menu_sound_play(MENU_SOUND_DECIDE); + else if (g.NavId && g.NavId != last_nav) menu_sound_play(MENU_SOUND_CURSOR); + if (g_tab != last_tab && last_tab >= 0) menu_sound_play(g_tab > last_tab ? MENU_SOUND_TAB_RIGHT : MENU_SOUND_TAB_LEFT); + } + last_nav = g.NavId, last_tab = g_tab; +} + static void layout_menu(uint32_t w, uint32_t h, float scale) { ImGui::GetBackgroundDrawList()->AddRectFilled(ImVec2(0, 0), ImVec2((float)w, (float)h), IM_COL32(4, 8, 20, 140)); float ww = fminf(w * 0.88f, 1400 * scale), wh = fminf(h * 0.86f, 820 * scale); @@ -899,6 +918,7 @@ static void layout_menu(uint32_t w, uint32_t h, float scale) { : ImGui::IsKeyPressed(ImGuiKey_GamepadL1, false) || ImGui::IsKeyPressed(ImGuiKey_Q, false) ? -1 : 0; if (step) g_tab_request = (g_tab + step + TAB_COUNT) % TAB_COUNT; + if (step) menu_sound_play(step > 0 ? MENU_SOUND_TAB_RIGHT : MENU_SOUND_TAB_LEFT); if (g_tab_request >= 0) g_focus_page = g_tab_request; // the new page's first row takes the cursor const ImGuiStyle &st = ImGui::GetStyle(); @@ -943,6 +963,7 @@ static void layout_menu(uint32_t w, uint32_t h, float scale) { if (ImGui::Button(cont, ImVec2(bw, 0))) set_open(0); ImGui::SameLine(); if (ImGui::Button(quit, ImVec2(bw, 0))) gfx_window_request_close(); + menu_sounds_frame(); bool was_modal = g_modal || binds_modal(); if (g_tab != TAB_CONTROLS) g_modal = false; if (!was_modal && (ImGui::IsKeyPressed(ImGuiKey_Escape, false) || ImGui::IsKeyPressed(ImGuiKey_GamepadFaceRight, false))) diff --git a/runtime/ui/option_rows.cpp b/runtime/ui/option_rows.cpp index b8dfa8ec..a7efacd3 100644 --- a/runtime/ui/option_rows.cpp +++ b/runtime/ui/option_rows.cpp @@ -18,6 +18,7 @@ extern "C" { #include "cfg.h" #include "platform/platform.h" #include "ui_text.h" +#include "menu_sound.h" // host.h pulls in cpu.h, which is C only: the one function needed from it, as declared there. void rt_log(const char *fmt, ...) __attribute__((format(printf, 1, 2))); } @@ -243,6 +244,7 @@ static void apply(const char *key, const char *value) { cfg_reset(&k, 1); } opt_save_soon(); + menu_sound_play(MENU_SOUND_CURSOR); } void opt_save_soon(void) { g_save_at = plat_now_ns() + 400000000ull; } diff --git a/runtime/ui_text.c b/runtime/ui_text.c index 7e5a7108..d5ad958e 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -226,7 +226,7 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_MODS_QUICKMENU_DESC] = "The port's fix for the black background of the weapon, shield and material menus " "at 60 FPS.", - [UI_MENU_VOLUME] = "Volume", [UI_MENU_VOLUME_DESC] = "Master volume of the game.", + [UI_MENU_VOLUME] = "Volume", [UI_MENU_VOLUME_DESC] = "Master volume of the game.", [UI_MENU_MENU_SOUNDS] = "Menu sounds", [UI_MENU_MENU_SOUNDS_DESC] = "Volume of this menu's sounds, the game's own cursor, confirm and cancel sounds. 0 turns them off.", [UI_MENU_AUDIO_CHANNELS] = "Speakers", [UI_MENU_AUDIO_CHANNELS_DESC] = "Stereo or 5.1 surround output. Automatic picks 5.1 when the Windows speaker setup " "has six or more channels. Applies after a restart.", @@ -703,7 +703,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_MODS_QUICKMENU] = "Исправление быстрого меню", [UI_MENU_MODS_QUICKMENU_DESC] = "Исправление порта: чёрный фон меню оружия, щитов и материалов при 60 FPS.", - [UI_MENU_VOLUME] = "Громкость", [UI_MENU_VOLUME_DESC] = "Общая громкость игры.", + [UI_MENU_VOLUME] = "Громкость", [UI_MENU_VOLUME_DESC] = "Общая громкость игры.", [UI_MENU_MENU_SOUNDS] = "Звуки меню", [UI_MENU_MENU_SOUNDS_DESC] = "Громкость звуков этого меню (курсор, выбор и отмена из самой игры). 0 выключает их.", [UI_MENU_AUDIO_CHANNELS] = "Динамики", [UI_MENU_AUDIO_CHANNELS_DESC] = "Стерео или объёмный звук 5.1. Автоматически выбирается 5.1, если в Windows " "настроено шесть каналов или больше. Применяется после перезапуска.", @@ -1108,7 +1108,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_OPERATION_MODE_DESC] = "Se o jogo acha que está no modo TV ou no modo portátil.", [UI_MENU_MODE_DOCKED] = "Modo TV", [UI_MENU_MODE_HANDHELD] = "Modo portátil", - [UI_MENU_VOLUME] = "Volume", [UI_MENU_VOLUME_DESC] = "Volume geral do jogo.", + [UI_MENU_VOLUME] = "Volume", [UI_MENU_VOLUME_DESC] = "Volume geral do jogo.", [UI_MENU_MENU_SOUNDS] = "Sons do menu", [UI_MENU_MENU_SOUNDS_DESC] = "Volume dos sons deste menu (cursor, confirmar e cancelar do próprio jogo). 0 desliga.", [UI_MENU_MOTION] = "Controles de movimento", [UI_MENU_MOTION_DESC] = "Mirar com o giroscópio do controle.", [UI_MENU_RUMBLE_STRENGTH] = "Intensidade da vibração", @@ -1655,6 +1655,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { "窗口失去焦点即暂停,如同在 Switch 上按 Home 键;" "这样被打断的读取可能会永久卡住。", [UI_MENU_VOLUME] = "音量", + [UI_MENU_MENU_SOUNDS] = "菜单音效", [UI_MENU_MENU_SOUNDS_DESC] = "此菜单音效(游戏自带的光标、确认和取消音效)的音量。0 为关闭。", [UI_MENU_VOLUME_DESC] = "游戏的主音量。", [UI_MENU_MOTION] = "体感操作", [UI_MENU_MOTION_DESC] = "用手柄的陀螺仪瞄准。", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index 83626368..36f1493b 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -91,7 +91,7 @@ typedef enum { UI_MENU_MODS_QUICKMENU, UI_MENU_MODS_QUICKMENU_DESC, // Sound - UI_MENU_VOLUME, UI_MENU_VOLUME_DESC, + UI_MENU_VOLUME, UI_MENU_VOLUME_DESC, UI_MENU_MENU_SOUNDS, UI_MENU_MENU_SOUNDS_DESC, UI_MENU_AUDIO_CHANNELS, UI_MENU_AUDIO_CHANNELS_DESC, UI_MENU_CHANNELS_AUTO, UI_MENU_CHANNELS_STEREO, UI_MENU_CHANNELS_51, // Controls