From 46953b279151adff7778c530926a62996ab247ed Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 29 Sep 2018 12:07:43 -0700 Subject: [PATCH] Wii: Expose stretch configuration in settings --- CHANGES | 1 + src/platform/wii/main.c | 53 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index bca96600f..2a81dbbac 100644 --- a/CHANGES +++ b/CHANGES @@ -113,6 +113,7 @@ Misc: - mGUI: Add SGB border configuration option - mGUI: Add support for different settings types - Wii: Disable use of strtof_l (fixes mgba.io/i/1106) + - Wii: Expose stretch configuration in settings 0.7 beta 1: (2018-09-24) - Initial beta for 0.7 diff --git a/src/platform/wii/main.c b/src/platform/wii/main.c index f1df0c86c..ff6e39045 100644 --- a/src/platform/wii/main.c +++ b/src/platform/wii/main.c @@ -469,9 +469,49 @@ int main(int argc, char* argv[]) { "Bilinear (pixelated)", }, .nStates = 3 - } + }, + { + .title = "Horizontal stretch", + .data = "stretchWidth", + .submenu = 0, + .state = 7, + .validStates = (const char*[]) { + "1/2x", "0.6x", "1/3x", "0.7x", "1/4x", "0.8x", "0.9x", "1.0x" + }, + .stateMappings = (const struct GUIVariant[]) { + GUI_V_F(0.5f), + GUI_V_F(0.6f), + GUI_V_F(1.f / 3.f), + GUI_V_F(0.7f), + GUI_V_F(0.75f), + GUI_V_F(0.8f), + GUI_V_F(0.9f), + GUI_V_F(1.0f), + }, + .nStates = 8 + }, + { + .title = "Vertical stretch", + .data = "stretchHeight", + .submenu = 0, + .state = 6, + .validStates = (const char*[]) { + "1/2x", "0.6x", "1/3x", "0.7x", "1/4x", "0.8x", "0.9x", "1.0x" + }, + .stateMappings = (const struct GUIVariant[]) { + GUI_V_F(0.5f), + GUI_V_F(0.6f), + GUI_V_F(1.f / 3.f), + GUI_V_F(0.7f), + GUI_V_F(0.75f), + GUI_V_F(0.8f), + GUI_V_F(0.9f), + GUI_V_F(1.0f), + }, + .nStates = 8 + }, }, - .nConfigExtra = 3, + .nConfigExtra = 5, .setup = _setup, .teardown = 0, .gameLoaded = _gameLoaded, @@ -517,6 +557,15 @@ int main(int argc, char* argv[]) { _mapKey(&runner.params.keyMap, CLASSIC_INPUT, WPAD_CLASSIC_BUTTON_LEFT, GUI_INPUT_LEFT); _mapKey(&runner.params.keyMap, CLASSIC_INPUT, WPAD_CLASSIC_BUTTON_RIGHT, GUI_INPUT_RIGHT); + + float stretch = 0; + if (mCoreConfigGetFloatValue(&runner.config, "stretchWidth", &stretch)) { + wStretch = fminf(1.0f, fmaxf(0.5f, stretch)); + } + if (mCoreConfigGetFloatValue(&runner.config, "stretchHeight", &stretch)) { + hStretch = fminf(1.0f, fmaxf(0.5f, stretch)); + } + if (argc > 1) { size_t i; for (i = 0; runner.keySources[i].id; ++i) {