mirror of https://github.com/mgba-emu/mgba.git
All: Use mCoreConfigGetBoolValue
This commit is contained in:
parent
58ddecb830
commit
c39f2ccb78
|
@ -414,40 +414,20 @@ void mCoreConfigMap(const struct mCoreConfig* config, struct mCoreOptions* opts)
|
|||
}
|
||||
_lookupUIntValue(config, "sampleRate", &opts->sampleRate);
|
||||
|
||||
int fakeBool;
|
||||
if (_lookupIntValue(config, "useBios", &fakeBool)) {
|
||||
opts->useBios = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "audioSync", &fakeBool)) {
|
||||
opts->audioSync = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "videoSync", &fakeBool)) {
|
||||
opts->videoSync = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "lockAspectRatio", &fakeBool)) {
|
||||
opts->lockAspectRatio = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "lockIntegerScaling", &fakeBool)) {
|
||||
opts->lockIntegerScaling = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "interframeBlending", &fakeBool)) {
|
||||
opts->interframeBlending = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "resampleVideo", &fakeBool)) {
|
||||
opts->resampleVideo = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "suspendScreensaver", &fakeBool)) {
|
||||
opts->suspendScreensaver = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "mute", &fakeBool)) {
|
||||
opts->mute = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "skipBios", &fakeBool)) {
|
||||
opts->skipBios = fakeBool;
|
||||
}
|
||||
if (_lookupIntValue(config, "rewindEnable", &fakeBool)) {
|
||||
opts->rewindEnable = fakeBool;
|
||||
}
|
||||
_lookupBoolValue(config, "audioSync", &opts->audioSync);
|
||||
_lookupBoolValue(config, "videoSync", &opts->videoSync);
|
||||
|
||||
_lookupBoolValue(config, "lockAspectRatio", &opts->lockAspectRatio);
|
||||
_lookupBoolValue(config, "lockIntegerScaling", &opts->lockIntegerScaling);
|
||||
_lookupBoolValue(config, "interframeBlending", &opts->interframeBlending);
|
||||
_lookupBoolValue(config, "resampleVideo", &opts->resampleVideo);
|
||||
|
||||
_lookupBoolValue(config, "useBios", &opts->useBios);
|
||||
_lookupBoolValue(config, "skipBios", &opts->skipBios);
|
||||
|
||||
_lookupBoolValue(config, "suspendScreensaver", &opts->suspendScreensaver);
|
||||
_lookupBoolValue(config, "mute", &opts->mute);
|
||||
_lookupBoolValue(config, "rewindEnable", &opts->rewindEnable);
|
||||
|
||||
_lookupIntValue(config, "fullscreen", &opts->fullscreen);
|
||||
_lookupIntValue(config, "width", &opts->width);
|
||||
|
|
|
@ -228,13 +228,10 @@ static void _GBCoreLoadConfig(struct mCore* core, const struct mCoreConfig* conf
|
|||
mCoreConfigCopyValue(&core->config, config, "useCgbColors");
|
||||
mCoreConfigCopyValue(&core->config, config, "allowOpposingDirections");
|
||||
|
||||
int fakeBool = 0;
|
||||
mCoreConfigGetIntValue(config, "allowOpposingDirections", &fakeBool);
|
||||
gb->allowOpposingDirections = fakeBool;
|
||||
mCoreConfigGetBoolValue(config, "allowOpposingDirections", &gb->allowOpposingDirections);
|
||||
|
||||
if (mCoreConfigGetIntValue(config, "sgb.borders", &fakeBool)) {
|
||||
gb->video.sgbBorders = fakeBool;
|
||||
gb->video.renderer->enableSGBBorder(gb->video.renderer, fakeBool);
|
||||
if (mCoreConfigGetBoolValue(config, "sgb.borders", &gb->video.sgbBorders)) {
|
||||
gb->video.renderer->enableSGBBorder(gb->video.renderer, gb->video.sgbBorders);
|
||||
}
|
||||
|
||||
#if !defined(MINIMAL_CORE) || MINIMAL_CORE < 2
|
||||
|
@ -260,11 +257,8 @@ static void _GBCoreReloadConfigOption(struct mCore* core, const char* option, co
|
|||
return;
|
||||
}
|
||||
|
||||
int fakeBool;
|
||||
if (strcmp("mute", option) == 0) {
|
||||
if (mCoreConfigGetIntValue(config, "mute", &fakeBool)) {
|
||||
core->opts.mute = fakeBool;
|
||||
|
||||
if (mCoreConfigGetBoolValue(config, "mute", &core->opts.mute)) {
|
||||
if (core->opts.mute) {
|
||||
gb->audio.masterVolume = 0;
|
||||
} else {
|
||||
|
@ -289,15 +283,12 @@ static void _GBCoreReloadConfigOption(struct mCore* core, const char* option, co
|
|||
if (config != &core->config) {
|
||||
mCoreConfigCopyValue(&core->config, config, "allowOpposingDirections");
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "allowOpposingDirections", &fakeBool)) {
|
||||
gb->allowOpposingDirections = fakeBool;
|
||||
}
|
||||
mCoreConfigGetBoolValue(config, "allowOpposingDirections", &gb->allowOpposingDirections);
|
||||
return;
|
||||
}
|
||||
if (strcmp("sgb.borders", option) == 0) {
|
||||
if (mCoreConfigGetIntValue(config, "sgb.borders", &fakeBool)) {
|
||||
gb->video.sgbBorders = fakeBool;
|
||||
gb->video.renderer->enableSGBBorder(gb->video.renderer, fakeBool);
|
||||
if (mCoreConfigGetBoolValue(config, "sgb.borders", &gb->video.sgbBorders)) {
|
||||
gb->video.renderer->enableSGBBorder(gb->video.renderer, gb->video.sgbBorders);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -288,9 +288,7 @@ static void _GBACoreLoadConfig(struct mCore* core, const struct mCoreConfig* con
|
|||
}
|
||||
}
|
||||
|
||||
int fakeBool = 0;
|
||||
mCoreConfigGetIntValue(config, "allowOpposingDirections", &fakeBool);
|
||||
gba->allowOpposingDirections = fakeBool;
|
||||
mCoreConfigGetBoolValue(config, "allowOpposingDirections", &gba->allowOpposingDirections);
|
||||
|
||||
mCoreConfigCopyValue(&core->config, config, "allowOpposingDirections");
|
||||
mCoreConfigCopyValue(&core->config, config, "gba.bios");
|
||||
|
@ -322,11 +320,8 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
|
|||
return;
|
||||
}
|
||||
|
||||
int fakeBool;
|
||||
if (strcmp("mute", option) == 0) {
|
||||
if (mCoreConfigGetIntValue(config, "mute", &fakeBool)) {
|
||||
core->opts.mute = fakeBool;
|
||||
|
||||
if (mCoreConfigGetBoolValue(config, "mute", &core->opts.mute)) {
|
||||
if (core->opts.mute) {
|
||||
gba->audio.masterVolume = 0;
|
||||
} else {
|
||||
|
@ -351,9 +346,7 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
|
|||
if (config != &core->config) {
|
||||
mCoreConfigCopyValue(&core->config, config, "allowOpposingDirections");
|
||||
}
|
||||
if (mCoreConfigGetIntValue(config, "allowOpposingDirections", &fakeBool)) {
|
||||
gba->allowOpposingDirections = fakeBool;
|
||||
}
|
||||
mCoreConfigGetBoolValue(config, "allowOpposingDirections", &gba->allowOpposingDirections);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -363,7 +356,8 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
|
|||
if (config != &core->config) {
|
||||
mCoreConfigCopyValue(&core->config, config, "videoScale");
|
||||
}
|
||||
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetIntValue(&core->config, "hwaccelVideo", &fakeBool) && fakeBool) {
|
||||
bool value;
|
||||
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetBoolValue(&core->config, "hwaccelVideo", &value) && value) {
|
||||
int scale;
|
||||
mCoreConfigGetIntValue(config, "videoScale", &scale);
|
||||
GBAVideoGLRendererSetScale(&gbacore->glRenderer, scale);
|
||||
|
@ -377,7 +371,8 @@ static void _GBACoreReloadConfigOption(struct mCore* core, const char* option, c
|
|||
renderer = &gbacore->renderer.d;
|
||||
}
|
||||
#ifdef BUILD_GLES3
|
||||
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetIntValue(&core->config, "hwaccelVideo", &fakeBool) && fakeBool) {
|
||||
bool value;
|
||||
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetBoolValue(&core->config, "hwaccelVideo", &value) && value) {
|
||||
mCoreConfigGetIntValue(&core->config, "videoScale", &gbacore->glRenderer.scale);
|
||||
renderer = &gbacore->glRenderer.d;
|
||||
} else {
|
||||
|
@ -556,7 +551,8 @@ static void _GBACoreChecksum(const struct mCore* core, void* data, enum mCoreChe
|
|||
static void _GBACoreReset(struct mCore* core) {
|
||||
struct GBACore* gbacore = (struct GBACore*) core;
|
||||
struct GBA* gba = (struct GBA*) core->board;
|
||||
int fakeBool;
|
||||
bool value;
|
||||
UNUSED(value);
|
||||
if (gbacore->renderer.outputBuffer
|
||||
#ifdef BUILD_GLES3
|
||||
|| gbacore->glRenderer.outputTex != (unsigned) -1
|
||||
|
@ -567,7 +563,7 @@ static void _GBACoreReset(struct mCore* core) {
|
|||
renderer = &gbacore->renderer.d;
|
||||
}
|
||||
#ifdef BUILD_GLES3
|
||||
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetIntValue(&core->config, "hwaccelVideo", &fakeBool) && fakeBool) {
|
||||
if (gbacore->glRenderer.outputTex != (unsigned) -1 && mCoreConfigGetBoolValue(&core->config, "hwaccelVideo", &value) && value) {
|
||||
mCoreConfigGetIntValue(&core->config, "videoScale", &gbacore->glRenderer.scale);
|
||||
renderer = &gbacore->glRenderer.d;
|
||||
} else {
|
||||
|
@ -575,7 +571,7 @@ static void _GBACoreReset(struct mCore* core) {
|
|||
}
|
||||
#endif
|
||||
#ifndef DISABLE_THREADING
|
||||
if (mCoreConfigGetIntValue(&core->config, "threadedVideo", &fakeBool) && fakeBool) {
|
||||
if (mCoreConfigGetBoolValue(&core->config, "threadedVideo", &value) && value) {
|
||||
if (!core->videoLogger) {
|
||||
core->videoLogger = &gbacore->threadProxy.d;
|
||||
}
|
||||
|
@ -604,13 +600,9 @@ static void _GBACoreReset(struct mCore* core) {
|
|||
#endif
|
||||
|
||||
bool forceGbp = false;
|
||||
if (mCoreConfigGetIntValue(&core->config, "gba.forceGbp", &fakeBool)) {
|
||||
forceGbp = fakeBool;
|
||||
}
|
||||
bool vbaBugCompat = true;
|
||||
if (mCoreConfigGetIntValue(&core->config, "vbaBugCompat", &fakeBool)) {
|
||||
vbaBugCompat = fakeBool;
|
||||
}
|
||||
mCoreConfigGetBoolValue(&core->config, "gba.forceGbp", &forceGbp);
|
||||
mCoreConfigGetBoolValue(&core->config, "vbaBugCompat", &vbaBugCompat);
|
||||
if (!forceGbp) {
|
||||
gba->memory.hw.devices &= ~HW_GB_PLAYER_DETECTION;
|
||||
}
|
||||
|
|
|
@ -538,9 +538,7 @@ void CoreController::overrideMute(bool override) {
|
|||
if (m_fastForward || m_fastForwardForced) {
|
||||
core->opts.mute = m_fastForwardMute >= 0;
|
||||
} else {
|
||||
int fakeBool = 0;
|
||||
mCoreConfigGetIntValue(&core->config, "mute", &fakeBool);
|
||||
core->opts.mute = fakeBool;
|
||||
mCoreConfigGetBoolValue(&core->config, "mute", &core->opts.mute);
|
||||
}
|
||||
}
|
||||
core->reloadConfigOption(core, NULL, NULL);
|
||||
|
@ -1122,9 +1120,7 @@ void CoreController::updateFastForward() {
|
|||
if (!mCoreConfigGetIntValue(&m_threadContext.core->config, "volume", &m_threadContext.core->opts.volume)) {
|
||||
m_threadContext.core->opts.volume = 0x100;
|
||||
}
|
||||
int fakeBool = 0;
|
||||
mCoreConfigGetIntValue(&m_threadContext.core->config, "mute", &fakeBool);
|
||||
m_threadContext.core->opts.mute = fakeBool;
|
||||
mCoreConfigGetBoolValue(&m_threadContext.core->config, "mute", &m_threadContext.core->opts.mute);
|
||||
m_threadContext.impl->sync.fpsTarget = m_fpsTarget;
|
||||
setSync(true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue