From 5a1ec94b02758b2fc4528572dda54ac0d648ef64 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 17 Aug 2020 17:51:27 -0700 Subject: [PATCH] mGUI: Add mute (closes #1494) --- CHANGES | 1 + src/feature/gui/gui-config.c | 12 ++++++++++++ src/feature/gui/gui-runner.c | 6 ++++++ src/feature/gui/gui-runner.h | 3 ++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 53113ed4d..fdbc08eca 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,7 @@ Features: - e-Reader card scanning - Add WebP and APNG recording + - Add mute option in homebrew ports - Support for unlicensed Pokemon Jade/Diamond Game Boy mapper - Support for unlicensed BBD Game Boy mapper - Support for unlicensed Hitek Game Boy mapper diff --git a/src/feature/gui/gui-config.c b/src/feature/gui/gui-config.c index ee14a019c..a888766ca 100644 --- a/src/feature/gui/gui-config.c +++ b/src/feature/gui/gui-config.c @@ -81,6 +81,16 @@ void mGUIShowConfig(struct mGUIRunner* runner, struct GUIMenuItem* extra, size_t }, .nStates = 2 }; + *GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) { + .title = "Mute", + .data = "mute", + .submenu = 0, + .state = false, + .validStates = (const char*[]) { + "Off", "On" + }, + .nStates = 2 + }; *GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) { .title = "Use BIOS if found", .data = "useBios", @@ -91,10 +101,12 @@ void mGUIShowConfig(struct mGUIRunner* runner, struct GUIMenuItem* extra, size_t }, .nStates = 2 }; +#ifdef M_CORE_GBA *GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) { .title = "Select GBA BIOS path", .data = "gba.bios", }; +#endif #ifdef M_CORE_GB *GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) { .title = "Select GB BIOS path", diff --git a/src/feature/gui/gui-runner.c b/src/feature/gui/gui-runner.c index 5d45f69ad..95ad90a26 100644 --- a/src/feature/gui/gui-runner.c +++ b/src/feature/gui/gui-runner.c @@ -56,6 +56,7 @@ static const struct mInputPlatformInfo _mGUIKeyInfo = { [mGUI_INPUT_SCREENSHOT] = "Take screenshot", [mGUI_INPUT_FAST_FORWARD_HELD] = "Fast forward (held)", [mGUI_INPUT_FAST_FORWARD_TOGGLE] = "Fast forward (toggle)", + [mGUI_INPUT_MUTE_TOGGLE] = "Mute (toggle)", }, .nKeys = GUI_INPUT_MAX }; @@ -490,6 +491,11 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) { runner->setFrameLimiter(runner, true); } } + if (guiKeys & (1 << mGUI_INPUT_MUTE_TOGGLE)) { + int mute = !runner->core->opts.mute; + mCoreConfigSetUIntValue(&runner->config, "mute", mute); + runner->core->reloadConfigOption(runner->core, "mute", &runner->config); + } uint16_t keys = runner->pollGameInput(runner); if (runner->prepareForFrame) { runner->prepareForFrame(runner); diff --git a/src/feature/gui/gui-runner.h b/src/feature/gui/gui-runner.h index fda78f982..6b5c87619 100644 --- a/src/feature/gui/gui-runner.h +++ b/src/feature/gui/gui-runner.h @@ -23,7 +23,8 @@ enum mGUIInput { mGUI_INPUT_SCREEN_MODE, mGUI_INPUT_SCREENSHOT, mGUI_INPUT_FAST_FORWARD_HELD, - mGUI_INPUT_FAST_FORWARD_TOGGLE + mGUI_INPUT_FAST_FORWARD_TOGGLE, + mGUI_INPUT_MUTE_TOGGLE, }; struct mGUIBackground {