fix scaler

This commit is contained in:
Wengier 2022-01-08 05:08:15 -05:00
parent e0c78841a0
commit a7d9172e44
3 changed files with 10 additions and 8 deletions

View File

@ -84,6 +84,7 @@ typedef struct Render_t {
scalerOperation_t op;
bool clearCache;
bool forced;
bool prompt;
bool hardware;
ScalerLineHandler_t lineHandler;
ScalerLineHandler_t linePalHandler;

View File

@ -1202,7 +1202,7 @@ void DOSBOX_SetupConfigSections(void) {
// Some frequently used option sets
const char* vsyncrate[] = { "%u", 0 };
const char* force[] = { "", "forced", 0 };
const char* force[] = { "", "forced", "prompt", 0 };
const char* cyclest[] = { "auto","fixed","max","%u",0 };
const char* mputypes[] = { "intelligent", "uart", "none", 0 };
const char* vsyncmode[] = { "off", "on" ,"force", "host", 0 };
@ -1886,6 +1886,7 @@ void DOSBOX_SetupConfigSections(void) {
Pmulti->SetValue("normal2x",/*init*/true);
Pmulti->Set_help("Scaler used to enlarge/enhance low resolution modes. If 'forced' is appended,\n"
"then the scaler will be used even if the result might not be desired.\n"
"Appending 'prompt' will cause a confirmation message for forcing the scaler.\n"
"To fit a scaler in the resolution used at full screen may require a border or side bars.\n"
"To fill the screen entirely, depending on your hardware, a different scaler/fullresolution might work.\n"
"Scalers should work with most output options, but they are ignored for openglpp and TrueType font outputs.");

View File

@ -52,6 +52,7 @@ uint32_t GFX_palette32bpp[256] = {0};
unsigned int GFX_GetBShift();
void RENDER_CallBack( GFX_CallBackFunctions_t function );
bool systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton);
#if defined(USE_TTF)
bool resetreq=false;
@ -481,13 +482,10 @@ void RENDER_Reset( void ) {
if( sdl.desktop.isperfect ) /* Handle scaling if no pixel-perfect mode */
goto forcenormal;
if((!dblh || !dblw) && scaler != "none" && strncasecmp(scaler.c_str(), "normal", 6) && !render.scale.forced && sdl.desktop.want_type != SCREEN_TTF) {
std::string message = "This scaler may not work properly or have undesired effect:\n\n"+scaler+"\n\nDo you want to load the scaler anyway?\n\n(You may append 'forced' to the scaler setting to force load the scaler without this message)";
bool systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton);
if (systemmessagebox("Loading scaler", message.c_str(), "yesno","question", 1))
render.scale.forced = true;
else
SetVal("render", "scaler", "none");
if(render.scale.prompt && (!dblh || !dblw) && !((dblh || dblw) && !render.scale.hardware) && scalerOpTV != render.scale.op && scaler != "none" && strncasecmp(scaler.c_str(), "normal", 6) && !render.scale.forced && sdl.desktop.want_type != SCREEN_TTF) {
std::string message = "This scaler may not work properly or have undesired effect:\n\n"+scaler+"\n\nDo you want to force load the scaler?";
render.scale.forced = systemmessagebox("Loading scaler", message.c_str(), "yesno","question", 1);
render.scale.prompt = false;
}
if ((dblh && dblw) || (render.scale.forced && dblh == dblw/*this branch works best with equal scaling in both directions*/)) {
/* Initialize always working defaults */
@ -1076,7 +1074,9 @@ void RENDER_UpdateFromScalerSetting(void) {
unsigned int p_op = render.scale.op;
render.scale.forced = false;
render.scale.prompt = false;
if(f == "forced") render.scale.forced = true;
else if(f == "prompt") render.scale.prompt = true;
if (scaler == "none") { render.scale.op = scalerOpNormal; render.scale.size = 1; render.scale.hardware=false; }
else if (scaler == "normal2x") { render.scale.op = scalerOpNormal; render.scale.size = 2; render.scale.hardware=false; }