diff --git a/mkxp.json b/mkxp.json index 91c31c3..cb4928c 100644 --- a/mkxp.json +++ b/mkxp.json @@ -169,10 +169,27 @@ // "vsync": false, + // Specify the internal screen width on startup. + // If set to 0, it will default to the default + // resolution width specific to the RGSS version. + // (640 in RGSS1, 544 in RGSS2 or higher) + // (default: 0) + // + // "defInternalScreenW": 640, + + + // Specify the internal screen height on startup. + // If set to 0, it will default to the default + // resolution height specific to the RGSS version. + // (480 in RGSS1, 416 in RGSS2 or higher) + // (default: 0) + // + // "defInternalScreenH": 480, + + // Specify the window width on startup. If set to 0, // it will default to the default resolution width - // specific to the RGSS version (640 in RGSS1, 544 - // in RGSS2 or higher). + // (Refer to defInternalScreenW) // (default: 0) // // "defScreenW": 640, @@ -180,8 +197,7 @@ // Specify the window height on startup. If set to 0, // it will default to the default resolution height - // specific to the RGSS version (480 in RGSS1, 416 - // in RGSS2 or higher). + // (Refer to defInternalScreenH) // (default: 0) // // "defScreenH": 480, diff --git a/src/config.cpp b/src/config.cpp index cdd7a29..5f1cd8a 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -148,6 +148,8 @@ void Config::read(int argc, char *argv[]) { {"framebufferScalingFactor", 1.}, {"atlasScalingFactor", 1.}, {"vsync", false}, + {"defInternalScreenW", 0}, + {"defInternalScreenH", 0}, {"defScreenW", 0}, {"defScreenH", 0}, {"windowTitle", ""}, @@ -251,6 +253,8 @@ try { exp } catch (...) {} SET_OPT_CUSTOMKEY(jit.minCalls, JITMinCalls, integer); SET_OPT_CUSTOMKEY(yjit.enabled, YJITEnable, boolean); SET_OPT(rgssVersion, integer); + SET_OPT(defInternalScreenW, integer); + SET_OPT(defInternalScreenH, integer); SET_OPT(defScreenW, integer); SET_OPT(defScreenH, integer); @@ -361,11 +365,17 @@ try { exp } catch (...) {} } static void setupScreenSize(Config &conf) { + if (conf.defInternalScreenW <= 0) + conf.defInternalScreenW = (conf.rgssVersion == 1 ? 640 : 544); + + if (conf.defInternalScreenH <= 0) + conf.defInternalScreenH = (conf.rgssVersion == 1 ? 480 : 416); + if (conf.defScreenW <= 0) - conf.defScreenW = (conf.rgssVersion == 1 ? 640 : 544); + conf.defScreenW = conf.defInternalScreenW; if (conf.defScreenH <= 0) - conf.defScreenH = (conf.rgssVersion == 1 ? 480 : 416); + conf.defScreenH = conf.defInternalScreenH; } bool Config::fontIsSolid(const char *fontName) const { diff --git a/src/config.h b/src/config.h index b3e0cae..f1af0ca 100644 --- a/src/config.h +++ b/src/config.h @@ -58,6 +58,8 @@ struct Config { double atlasScalingFactor; bool vsync; + int defInternalScreenW; + int defInternalScreenH; int defScreenW; int defScreenH; std::string windowTitle; diff --git a/src/display/graphics.cpp b/src/display/graphics.cpp index 0f3c880..544f7c3 100644 --- a/src/display/graphics.cpp +++ b/src/display/graphics.cpp @@ -66,9 +66,6 @@ #include -#define DEF_SCREEN_W (rgssVer == 1 ? 640 : 544) -#define DEF_SCREEN_H (rgssVer == 1 ? 480 : 416) - #define DEF_FRAMERATE (rgssVer == 1 ? 40 : 60) #define DEF_MAX_VIDEO_FRAMES 30 @@ -837,9 +834,9 @@ struct GraphicsPrivate { IntruList dispList; GraphicsPrivate(RGSSThreadData *rtData) - : scResLores(DEF_SCREEN_W, DEF_SCREEN_H), - scRes(rtData->config.enableHires ? (int)lround(rtData->config.framebufferScalingFactor * DEF_SCREEN_W) : DEF_SCREEN_W, - rtData->config.enableHires ? (int)lround(rtData->config.framebufferScalingFactor * DEF_SCREEN_H) : DEF_SCREEN_H), + : scResLores(rtData->config.defInternalScreenW, rtData->config.defInternalScreenH), + scRes(rtData->config.enableHires ? (int)lround(rtData->config.framebufferScalingFactor * rtData->config.defInternalScreenW) : rtData->config.defInternalScreenW, + rtData->config.enableHires ? (int)lround(rtData->config.framebufferScalingFactor * rtData->config.defInternalScreenH) : rtData->config.defInternalScreenH), scSize(scRes), winSize(rtData->config.defScreenW, rtData->config.defScreenH), screen(scRes.x, scRes.y), threadData(rtData),