From: notaz Date: Tue, 24 Oct 2023 18:42:04 +0000 (+0300) Subject: gpulib: add a "borderless" option to restore old behavior X-Git-Tag: r24~90 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=44e76f8ad4944acfc109baf89beda7b723f8a209 gpulib: add a "borderless" option to restore old behavior --- diff --git a/frontend/libretro.c b/frontend/libretro.c index d74a7b41..5a44e43e 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -2293,8 +2293,10 @@ static void update_variables(bool in_flight) { if (strcmp(var.value, "game") == 0) pl_rearmed_cbs.screen_centering_type = 1; - else if (strcmp(var.value, "manual") == 0) + else if (strcmp(var.value, "borderless") == 0) pl_rearmed_cbs.screen_centering_type = 2; + else if (strcmp(var.value, "manual") == 0) + pl_rearmed_cbs.screen_centering_type = 3; else // auto pl_rearmed_cbs.screen_centering_type = 0; } diff --git a/frontend/libretro_core_options.h b/frontend/libretro_core_options.h index 60832742..8379ade9 100644 --- a/frontend/libretro_core_options.h +++ b/frontend/libretro_core_options.h @@ -439,12 +439,13 @@ struct retro_core_option_v2_definition option_defs_us[] = { "pcsx_rearmed_screen_centering", "(GPU) Screen centering", NULL, - "The PSX has a feature allowing it to shift the image position on screen. Some (mostly PAL) games used this feature in a strange way making the image miscentered and causing borders to appear. With 'Auto' the emulator tries to correct this miscentering automatically. 'Game-controlled' uses the settings supplied by the game. 'Manual' allows to override those values with the settings below.", + "The PSX has a feature allowing it to shift the image position on screen. Some (mostly PAL) games used this feature in a strange way making the image miscentered and causing uneven borders to appear. With 'Auto' the emulator tries to correct this miscentering automatically. 'Game-controlled' uses the settings supplied by the game. 'Manual' allows to override those values with the settings below.", NULL, "video", { { "auto", "Auto" }, { "game", "Game-controlled" }, + { "borderless", "Borderless" }, { "manual", "Manual" }, { NULL, NULL }, }, diff --git a/frontend/menu.c b/frontend/menu.c index 6516e343..868a486a 100644 --- a/frontend/menu.c +++ b/frontend/menu.c @@ -1264,7 +1264,7 @@ static const char *men_soft_filter[] = { "None", #endif NULL }; static const char *men_dummy[] = { NULL }; -static const char *men_centering[] = { "Auto", "Ingame", "Force", NULL }; +static const char *men_centering[] = { "Auto", "Ingame", "Borderless", "Force", NULL }; static const char h_scaler[] = "int. 2x - scales w. or h. 2x if it fits on screen\n" "int. 4:3 - uses integer if possible, else fractional"; static const char h_cscaler[] = "Displays the scaler layer, you can resize it\n" diff --git a/frontend/plugin_lib.h b/frontend/plugin_lib.h index 97d44f25..76220978 100644 --- a/frontend/plugin_lib.h +++ b/frontend/plugin_lib.h @@ -111,13 +111,15 @@ struct rearmed_cbs { } gpu_peopsgl; // misc int gpu_caps; - int screen_centering_type; // 0 - auto, 1 - game conrolled, 2 - manual + int screen_centering_type; int screen_centering_x; int screen_centering_y; }; extern struct rearmed_cbs pl_rearmed_cbs; +enum centering_type { C_AUTO = 0, C_INGAME, C_BORDERLESS, C_MANUAL }; + enum gpu_plugin_caps { GPU_CAP_OWNS_DISPLAY = (1 << 0), GPU_CAP_SUPPORTS_2X = (1 << 1), diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index fdb109ce..f0767745 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -13,8 +13,11 @@ #include #include "gpu.h" #include "../../libpcsxcore/gpu.h" // meh +#include "../../frontend/plugin_lib.h" +#ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif #ifdef __GNUC__ #define unlikely(x) __builtin_expect((x), 0) #define preload __builtin_prefetch @@ -81,9 +84,9 @@ static noinline void update_width(void) sw /= hdiv; sw = (sw + 2) & ~3; // according to nocash switch (gpu.state.screen_centering_type) { - case 1: + case C_INGAME: break; - case 2: + case C_MANUAL: x = gpu.state.screen_centering_x; break; default: @@ -125,9 +128,12 @@ static noinline void update_height(void) /* nothing displayed? */; else { switch (gpu.state.screen_centering_type) { - case 1: + case C_INGAME: + break; + case C_BORDERLESS: + y = 0; break; - case 2: + case C_MANUAL: y = gpu.state.screen_centering_y; break; default: @@ -903,8 +909,6 @@ void GPUgetScreenInfo(int *y, int *base_hres) *base_hres >>= 1; } -#include "../../frontend/plugin_lib.h" - void GPUrearmedCallbacks(const struct rearmed_cbs *cbs) { gpu.frameskip.set = cbs->frameskip; diff --git a/plugins/gpulib/vout_pl.c b/plugins/gpulib/vout_pl.c index 958468c9..ab56cad2 100644 --- a/plugins/gpulib/vout_pl.c +++ b/plugins/gpulib/vout_pl.c @@ -29,9 +29,11 @@ static void check_mode_change(int force) { int w = gpu.screen.hres; int h = gpu.screen.vres; - int w_out = w; - int h_out = h; + int w_out, h_out; + if (gpu.state.screen_centering_type == C_BORDERLESS) + h = gpu.screen.h; + w_out = w, h_out = h; #ifdef RAW_FB_DISPLAY w = w_out = 1024, h = h_out = 512; #endif