mirror of https://github.com/mgba-emu/mgba.git
mGUI: Add fast forward mute
This commit is contained in:
parent
86ec2d4d22
commit
b78f47b214
|
@ -103,6 +103,16 @@ void mGUIShowConfig(struct mGUIRunner* runner, struct GUIMenuItem* extra, size_t
|
||||||
},
|
},
|
||||||
.nStates = 2
|
.nStates = 2
|
||||||
};
|
};
|
||||||
|
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
|
||||||
|
.title = "Fast forward mute",
|
||||||
|
.data = "fastForwardMute",
|
||||||
|
.submenu = 0,
|
||||||
|
.state = false,
|
||||||
|
.validStates = (const char*[]) {
|
||||||
|
"Off", "On"
|
||||||
|
},
|
||||||
|
.nStates = 2
|
||||||
|
};
|
||||||
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
|
*GUIMenuItemListAppend(&menu.items) = (struct GUIMenuItem) {
|
||||||
.title = "Use BIOS if found",
|
.title = "Use BIOS if found",
|
||||||
.data = "useBios",
|
.data = "useBios",
|
||||||
|
|
|
@ -455,6 +455,12 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
|
||||||
int drawFps = false;
|
int drawFps = false;
|
||||||
mCoreConfigGetIntValue(&runner->config, "fpsCounter", &drawFps);
|
mCoreConfigGetIntValue(&runner->config, "fpsCounter", &drawFps);
|
||||||
|
|
||||||
|
int mute = false;
|
||||||
|
mCoreConfigGetIntValue(&runner->config, "mute", &mute);
|
||||||
|
|
||||||
|
int fastForwardMute = false;
|
||||||
|
mCoreConfigGetIntValue(&runner->config, "fastForwardMute", &fastForwardMute);
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
|
|
||||||
#ifndef DISABLE_THREADING
|
#ifndef DISABLE_THREADING
|
||||||
|
@ -506,20 +512,32 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
|
||||||
if (guiKeys & (1 << mGUI_INPUT_SCREENSHOT)) {
|
if (guiKeys & (1 << mGUI_INPUT_SCREENSHOT)) {
|
||||||
mCoreTakeScreenshot(runner->core);
|
mCoreTakeScreenshot(runner->core);
|
||||||
}
|
}
|
||||||
|
bool muteTogglePressed = guiKeys & (1 << mGUI_INPUT_MUTE_TOGGLE);
|
||||||
|
if (muteTogglePressed) {
|
||||||
|
mute = !mute;
|
||||||
|
mCoreConfigSetUIntValue(&runner->config, "mute", mute);
|
||||||
|
runner->core->reloadConfigOption(runner->core, "mute", &runner->config);
|
||||||
|
}
|
||||||
if (runner->setFrameLimiter) {
|
if (runner->setFrameLimiter) {
|
||||||
if (guiKeys & (1 << mGUI_INPUT_FAST_FORWARD_TOGGLE)) {
|
if (guiKeys & (1 << mGUI_INPUT_FAST_FORWARD_TOGGLE)) {
|
||||||
fastForward = !fastForward;
|
fastForward = !fastForward;
|
||||||
}
|
}
|
||||||
if (fastForward || (heldKeys & (1 << mGUI_INPUT_FAST_FORWARD_HELD))) {
|
bool fastForwarding = fastForward || (heldKeys & (1 << mGUI_INPUT_FAST_FORWARD_HELD));
|
||||||
|
if (fastForwarding) {
|
||||||
|
if (fastForwardMute && !mute && !muteTogglePressed) {
|
||||||
|
mCoreConfigSetUIntValue(&runner->core->config, "mute", fastForwardMute);
|
||||||
|
runner->core->reloadConfigOption(runner->core, "mute", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
runner->setFrameLimiter(runner, false);
|
runner->setFrameLimiter(runner, false);
|
||||||
} else {
|
} else {
|
||||||
runner->setFrameLimiter(runner, true);
|
runner->setFrameLimiter(runner, true);
|
||||||
|
|
||||||
|
if (fastForwardMute && !mute && !muteTogglePressed) {
|
||||||
|
mCoreConfigSetUIntValue(&runner->core->config, "mute", !fastForwardMute);
|
||||||
|
runner->core->reloadConfigOption(runner->core, "mute", NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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);
|
uint16_t keys = runner->pollGameInput(runner);
|
||||||
if (runner->prepareForFrame) {
|
if (runner->prepareForFrame) {
|
||||||
|
@ -651,6 +669,8 @@ void mGUIRun(struct mGUIRunner* runner, const char* path) {
|
||||||
}
|
}
|
||||||
mCoreConfigGetIntValue(&runner->config, "fpsCounter", &drawFps);
|
mCoreConfigGetIntValue(&runner->config, "fpsCounter", &drawFps);
|
||||||
mCoreConfigGetIntValue(&runner->config, "showOSD", &showOSD);
|
mCoreConfigGetIntValue(&runner->config, "showOSD", &showOSD);
|
||||||
|
mCoreConfigGetIntValue(&runner->config, "mute", &mute);
|
||||||
|
mCoreConfigGetIntValue(&runner->config, "fastForwardMute", &fastForwardMute);
|
||||||
#ifdef M_CORE_GB
|
#ifdef M_CORE_GB
|
||||||
if (runner->core->platform(runner->core) == mPLATFORM_GB) {
|
if (runner->core->platform(runner->core) == mPLATFORM_GB) {
|
||||||
runner->core->reloadConfigOption(runner->core, "gb.pal", &runner->config);
|
runner->core->reloadConfigOption(runner->core, "gb.pal", &runner->config);
|
||||||
|
|
Loading…
Reference in New Issue