diff --git a/src/platform/switch/main.c b/src/platform/switch/main.c index 3b5124e83..c0624423d 100644 --- a/src/platform/switch/main.c +++ b/src/platform/switch/main.c @@ -6,6 +6,7 @@ #include "feature/gui/gui-runner.h" #include #include +#include #include #include #include @@ -99,6 +100,7 @@ static u8 vmode; static u32 vwidth; static u32 vheight; static bool interframeBlending = false; +static bool sgbCrop = false; static bool useLightSensor = true; static struct mGUIRunnerLux lightSensor; @@ -298,6 +300,9 @@ static void _gameLoaded(struct mGUIRunner* runner) { if (mCoreConfigGetIntValue(&runner->config, "interframeBlending", &fakeBool)) { interframeBlending = fakeBool; } + if (mCoreConfigGetIntValue(&runner->config, "sgb.borderCrop", &fakeBool)) { + sgbCrop = fakeBool; + } if (mCoreConfigGetIntValue(&runner->config, "useLightSensor", &fakeBool)) { if (useLightSensor != fakeBool) { useLightSensor = fakeBool; @@ -332,8 +337,14 @@ static void _drawTex(struct mGUIRunner* runner, unsigned width, unsigned height, glUseProgram(program); glBindVertexArray(vao); - float aspectX = width / (float) vwidth; - float aspectY = height / (float) vheight; + float inwidth = width; + float inheight = height; + if (sgbCrop && width == 256 && height == 224) { + inwidth = GB_VIDEO_HORIZONTAL_PIXELS; + inheight = GB_VIDEO_VERTICAL_PIXELS; + } + float aspectX = inwidth / vwidth; + float aspectY = inheight / vheight; float max = 1.f; switch (screenMode) { case SM_PA: @@ -359,6 +370,11 @@ static void _drawTex(struct mGUIRunner* runner, unsigned width, unsigned height, break; } + if (screenMode != SM_SF) { + aspectX = width / (float) vwidth; + aspectY = height / (float) vheight; + } + aspectX *= max; aspectY *= max;