diff --git a/auto-box/box-center.slang b/auto-box/box-center.slang new file mode 100644 index 0000000..a79f323 --- /dev/null +++ b/auto-box/box-center.slang @@ -0,0 +1,44 @@ +#version 450 + +/* + Box Center Shader + Centers pre-scaled output into the viewport, to prevent unintentional non-integer scaling. Maintains 1x scale of the input. + Author: Themaister + License: Public domain +*/ + +layout(std140, set = 0, binding = 0) uniform UBO +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + mat4 MVP; +} global; + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 box_scale = vec2(1.0); + + vec2 scale = (global.OutputSize.xy / global.SourceSize.xy) / box_scale; + vec2 middle = vec2(0.5); + vec2 diff = TexCoord - middle; + vTexCoord = middle + diff * scale; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0); +} \ No newline at end of file diff --git a/auto-box/box-max.slang b/auto-box/box-max.slang new file mode 100644 index 0000000..7ac3290 --- /dev/null +++ b/auto-box/box-max.slang @@ -0,0 +1,54 @@ +#version 450 + +/* + Box Max Shader + Automatically scales output to the maximum integer scale possible. + Author: Themaister + License: Public domain +*/ + +layout(std140, set = 0, binding = 0) uniform UBO +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + mat4 MVP; +} global; + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; + + +float min(vec2 x) +{ + if (x.x > x.y) + return x.y; + else + return x.x; +} + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 box_scale = floor(global.OutputSize.xy / global.SourceSize.xy); + box_scale = vec2(min(box_scale), min(box_scale)); + + vec2 scale = (global.OutputSize.xy / global.SourceSize.xy) / box_scale; + vec2 middle = vec2(0.5); + vec2 diff = TexCoord - middle; + vTexCoord = middle + diff * scale; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0); +} \ No newline at end of file diff --git a/auto-box/box.slang b/auto-box/box.slang new file mode 100644 index 0000000..939be8d --- /dev/null +++ b/auto-box/box.slang @@ -0,0 +1,50 @@ +#version 450 + +/* + Box Shader + Scales output according to the scale factor parameters. + Author: Themaister + License: Public domain +*/ + + +layout(std140, set = 0, binding = 0) uniform UBO +{ + vec4 SourceSize; + vec4 OriginalSize; + vec4 OutputSize; + uint FrameCount; + mat4 MVP; + float x_scale; + float y_scale; +} global; + +#pragma parameter x_scale "X Scale" 3.0 1.0 100.0 1.0 +#pragma parameter y_scale "Y Scale" 3.0 1.0 100.0 1.0 + +#pragma stage vertex +layout(location = 0) in vec4 Position; +layout(location = 1) in vec2 TexCoord; +layout(location = 0) out vec2 vTexCoord; + +void main() +{ + gl_Position = global.MVP * Position; + + vec2 box_scale = vec2(global.x_scale, global.y_scale); + + vec2 scale = (global.OutputSize.xy / global.SourceSize.xy) / box_scale; + vec2 middle = vec2(0.5); + vec2 diff = TexCoord - middle; + vTexCoord = middle + diff * scale; +} + +#pragma stage fragment +layout(location = 0) in vec2 vTexCoord; +layout(location = 0) out vec4 FragColor; +layout(set = 0, binding = 2) uniform sampler2D Source; + +void main() +{ + FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0); +} \ No newline at end of file diff --git a/border/gameboy-player/README.txt b/border/gameboy-player/README.md similarity index 61% rename from border/gameboy-player/README.txt rename to border/gameboy-player/README.md index 06439f5..99d5309 100644 --- a/border/gameboy-player/README.txt +++ b/border/gameboy-player/README.md @@ -1,7 +1,13 @@ -These shader presets will allow you to apply a 608x448 Game Boy Player border around a 240x160 input image from a Game Boy Advance core, with the input being scaled 2x to fit the border. - -Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 608x448 resolution. You will need to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. - -An example border is included, you can swap it out with another 608x448 Game Boy Player border in png format with the center 240x160 transparent. The borders included with this shader were ripped from a Game Boy Player disc by a kind anonymous user and were edited to appear correct with a GBA image fully shown. - +# Game Boy Player border shader + +These shader presets will allow you to apply a 608x448 Game Boy Player border around a 240x160 input image from a Game Boy Advance core, with the input being scaled 2x to fit the border. + +Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 608x448 resolution. + +One option to display it integer scaled is to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. + +The other option is to use one of the auto-box shaders in the last pass of the shader chain to integer scale or center the output of the border shader within the viewport. You may need to disable RetroArch's Integer Scaling and set the Aspect Ratio equal to your screen aspect ratio to see the whole image. + +An example border is included, you can swap it out with another 608x448 Game Boy Player border in png format with the center 240x160 transparent. The borders included with this shader were ripped from a Game Boy Player disc by a kind anonymous user and were edited to appear correct with a GBA image fully shown. + Using CRT-Royale with this border shader may result in flickering. This is due to it displaying the border shader as 480i, due to the output image being greater than 400px vertically. Disable interlacing detection in CRT Royale's user-settings.h if want 480p instead. \ No newline at end of file diff --git a/border/gameboy-player/gameboy-player-tvout+interlacing.slangp b/border/gameboy-player/gameboy-player-tvout+interlacing.slangp index ab54072..532ca1e 100644 --- a/border/gameboy-player/gameboy-player-tvout+interlacing.slangp +++ b/border/gameboy-player/gameboy-player-tvout+interlacing.slangp @@ -1,29 +1,32 @@ -shaders = "4" -shader0 = "../shaders/imgborder-gbp.slang" -shader1 = "../../crt/shaders/tvout-tweaks.slang" -shader2 = "../../misc/image-adjustment.slang" -shader3 = "../../misc/interlacing.slang" +shaders = 5 +shader0 = ../shaders/imgborder-gbp.slang +shader1 = ../../crt/shaders/tvout-tweaks.slang +shader2 = ../../misc/image-adjustment.slang +shader3 = ../../misc/interlacing.slang +shader4 = ../../auto-box/box-center.slang -scale_type_x0 = "absolute" -scale_x0 = "608" -scale_type_y0 = "absolute" -scale_y0 = "448" +scale_type_x0 = absolute +scale_x0 = 608 +scale_type_y0 = absolute +scale_y0 = 448 -scale_type_x1 = "viewport" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" +scale_type_x1 = viewport +scale_x1 = 1.000000 +scale_type_y1 = source +scale_y1 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;enable_480i;top_field_first" -box_scale = "2.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "1.000000" -enable_480i = "0.000000" -top_field_first = "1.000000" +filter_linear4 = false -textures = "BORDER" -BORDER = "gameboy-player.png" +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;enable_480i;top_field_first +box_scale = 2.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 1.000000 +enable_480i = 1.000000 +top_field_first = 1.000000 + +textures = BORDER +BORDER = gameboy-player.png diff --git a/border/gameboy-player/gameboy-player-tvout-gba-color+interlacing.slangp b/border/gameboy-player/gameboy-player-tvout-gba-color+interlacing.slangp index 78ac3a9..9df3a81 100644 --- a/border/gameboy-player/gameboy-player-tvout-gba-color+interlacing.slangp +++ b/border/gameboy-player/gameboy-player-tvout-gba-color+interlacing.slangp @@ -1,33 +1,39 @@ -shaders = "5" -shader0 = "../../handheld/shaders/color/gba-color.slang" -shader1 = "../shaders/imgborder-gbp.slang" -shader2 = "../../crt/shaders/tvout-tweaks.slang" -shader3 = "../../misc/image-adjustment.slang" -shader4 = "../../misc/interlacing.slang" - -scale_type0 = "source" -scale0 = "1.0" - -scale_type_x1 = "absolute" -scale_x1 = "608" -scale_type_y1 = "absolute" -scale_y1 = "448" - -scale_type_x2 = "viewport" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" - -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;enable_480i;top_field_first" -box_scale = "2.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" -enable_480i = "0.000000" -top_field_first = "1.000000" - -textures = "BORDER" -BORDER = "gameboy-player.png" +shaders = 6 +shader0 = ../../handheld/shaders/color/gba-color.slang +shader1 = ../shaders/imgborder-gbp.slang +shader2 = ../../crt/shaders/tvout-tweaks.slang +shader3 = ../../misc/image-adjustment.slang +shader4 = ../../misc/interlacing.slang +shader5 = ../../auto-box/box-center.slang + +scale_type0 = source +scale0 = 1.0 + +scale_type_x1 = absolute +scale_x1 = 608 +scale_type_y1 = absolute +scale_y1 = 448 + +scale_type_x2 = viewport +scale_x2 = 1.000000 +scale_type_y2 = source +scale_y2 = 1.000000 + +scale_type_y4 = source +scale_y4 = 1.000000 + +filter_linear5 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;enable_480i;top_field_first +box_scale = 2.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 +enable_480i = 1.000000 +top_field_first = 1.000000 + +textures = BORDER +BORDER = gameboy-player.png diff --git a/border/gameboy-player/gameboy-player-tvout-gba-color.slangp b/border/gameboy-player/gameboy-player-tvout-gba-color.slangp index e153103..5e9854c 100644 --- a/border/gameboy-player/gameboy-player-tvout-gba-color.slangp +++ b/border/gameboy-player/gameboy-player-tvout-gba-color.slangp @@ -1,30 +1,33 @@ -shaders = "4" -shader0 = "../../handheld/shaders/color/gba-color.slang" -shader1 = "../shaders/imgborder-gbp.slang" -shader2 = "../../crt/shaders/tvout-tweaks.slang" -shader3 = "../../misc/image-adjustment.slang" - -scale_type0 = "source" -scale0 = "1.0" - -scale_type_x1 = "absolute" -scale_x1 = "608" -scale_type_y1 = "absolute" -scale_y1 = "448" - -scale_type_x2 = "viewport" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" - -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "2.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" - -textures = "BORDER" -BORDER = "gameboy-player.png" +shaders = 5 +shader0 = ../../handheld/shaders/color/gba-color.slang +shader1 = ../shaders/imgborder-gbp.slang +shader2 = ../../crt/shaders/tvout-tweaks.slang +shader3 = ../../misc/image-adjustment.slang +shader4 = ../../auto-box/box-center.slang + +scale_type0 = source +scale0 = 1.0 + +scale_type_x1 = absolute +scale_x1 = 608 +scale_type_y1 = absolute +scale_y1 = 448 + +scale_type_x2 = viewport +scale_x2 = 1.000000 +scale_type_y2 = source +scale_y2 = 1.000000 + +filter_linear4 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 2.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 + +textures = BORDER +BORDER = gameboy-player.png diff --git a/border/gameboy-player/gameboy-player-tvout.slangp b/border/gameboy-player/gameboy-player-tvout.slangp index e30e44f..34d7558 100644 --- a/border/gameboy-player/gameboy-player-tvout.slangp +++ b/border/gameboy-player/gameboy-player-tvout.slangp @@ -1,26 +1,30 @@ -shaders = "3" -shader0 = "../shaders/imgborder-gbp.slang" -shader1 = "../../crt/shaders/tvout-tweaks.slang" -shader2 = "../../misc/image-adjustment.slang" +shaders = 4 +shader0 = ../shaders/imgborder-gbp.slang +shader1 = ../../crt/shaders/tvout-tweaks.slang +shader2 = ../../misc/image-adjustment.slang +shader3 = ../../auto-box/box-center.slang -scale_type_x0 = "absolute" -scale_x0 = "608" -scale_type_y0 = "absolute" -scale_y0 = "448" -scale_type_x1 = "viewport" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" +scale_type_x0 = absolute +scale_x0 = 608 +scale_type_y0 = absolute +scale_y0 = 448 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "2.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "480.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" +scale_type_x1 = viewport +scale_x1 = 1.000000 +scale_type_y1 = source +scale_y1 = 1.000000 -textures = "BORDER" -BORDER = "gameboy-player.png" +filter_linear3 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 2.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 480.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 + +textures = BORDER +BORDER = gameboy-player.png diff --git a/border/sgb/README.txt b/border/sgb/README.md similarity index 53% rename from border/sgb/README.txt rename to border/sgb/README.md index 597bfd5..09be7ad 100644 --- a/border/sgb/README.txt +++ b/border/sgb/README.md @@ -1,5 +1,11 @@ -These shader presets will allow you to apply a 256x224 Super Game Boy border around a 160x144 input image from a Game Boy core. - -Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy core's reported resolution of 160x144 into account, and not the output image's 256x224 resolution. You will need to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. - +# Super Game Boy border shader + +These shader presets will allow you to apply a 256x224 Super Game Boy border around a 160x144 input image from a Game Boy core. + +Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy core's reported resolution of 160x144 into account, and not the output image's 256x224 resolution. + +One option to display it integer scaled is to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. + +The other option is to use one of the auto-box shaders in the last pass of the shader chain to integer scale or center the output of the border shader within the viewport. You may need to disable RetroArch's Integer Scaling and set the Aspect Ratio equal to your screen aspect ratio to see the whole image. + An example border is included, you can swap it out with another 256x224 Super Game Boy border in png format with the center 160x144 transparent. Borders derived from an emulator screenshot may be shifted up one pixel and off center, so you would need to shift it down one pixel to center it. The "Super Game Boy Color" borders were created by BLUEamnesiac. \ No newline at end of file diff --git a/border/sgb/sgb-gbc-color-tvout+interlacing.slangp b/border/sgb/sgb-gbc-color-tvout+interlacing.slangp index 69d430f..54cd8c0 100644 --- a/border/sgb/sgb-gbc-color-tvout+interlacing.slangp +++ b/border/sgb/sgb-gbc-color-tvout+interlacing.slangp @@ -1,32 +1,38 @@ -shaders = "5" -shader0 = "../../handheld/shaders/color/gbc-color.slang" -shader1 = "../shaders/imgborder-sgb.slang" -shader2 = "../../crt/shaders/tvout-tweaks.slang" -shader3 = "../../misc/image-adjustment.slang" -shader4 = "../../misc/interlacing.slang" +shaders = 6 +shader0 = ../../handheld/shaders/color/gbc-color.slang +shader1 = ../shaders/imgborder-sgb.slang +shader2 = ../../crt/shaders/tvout-tweaks.slang +shader3 = ../../misc/image-adjustment.slang +shader4 = ../../misc/interlacing.slang +shader5 = ../../auto-box/box-center.slang filter_linear0 = false scale_type_0 = source scale0 = 1.0 -scale_type_x1 = "absolute" -scale_x1 = "256" -scale_type_y1 = "absolute" -scale_y1 = "224" +scale_type_x1 = absolute +scale_x1 = 256 +scale_type_y1 = absolute +scale_y1 = 224 -scale_type_x2 = "viewport" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" +scale_type_x2 = viewport +scale_x2 = 1.000000 +scale_type_y2 = source +scale_y2 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "1.000000" -location = "0.500000" -in_res_x = "160.000000" -in_res_y = "144.000000" -TVOUT_RESOLUTION = "320.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" +scale_type_y4 = source +scale_y4 = 2.000000 -textures = "BORDER" -BORDER = "sgb.png" +filter_linear5 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 1.000000 +location = 0.500000 +in_res_x = 160.000000 +in_res_y = 144.000000 +TVOUT_RESOLUTION = 320.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 + +textures = BORDER +BORDER = sgb.png diff --git a/border/sgb/sgb-tvout+interlacing.slangp b/border/sgb/sgb-tvout+interlacing.slangp index e793fab..7007aa3 100644 --- a/border/sgb/sgb-tvout+interlacing.slangp +++ b/border/sgb/sgb-tvout+interlacing.slangp @@ -1,27 +1,33 @@ -shaders = "4" -shader0 = "../shaders/imgborder-sgb.slang" -shader1 = "../../crt/shaders/tvout-tweaks.slang" -shader2 = "../../misc/image-adjustment.slang" -shader3 = "../../misc/interlacing.slang" +shaders = 5 +shader0 = ../shaders/imgborder-sgb.slang +shader1 = ../../crt/shaders/tvout-tweaks.slang +shader2 = ../../misc/image-adjustment.slang +shader3 = ../../misc/interlacing.slang +shader4 = ../../auto-box/box-center.slang -scale_type_x0 = "absolute" -scale_x0 = "256" -scale_type_y0 = "absolute" -scale_y0 = "224" +scale_type_x0 = absolute +scale_x0 = 256 +scale_type_y0 = absolute +scale_y0 = 224 -scale_type_x1 = "viewport" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" +scale_type_x1 = viewport +scale_x1 = 1.000000 +scale_type_y1 = source +scale_y1 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "1.000000" -location = "0.500000" -in_res_x = "160.000000" -in_res_y = "144.000000" -TVOUT_RESOLUTION = "320.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "0.000000" +scale_type_y3 = source +scale_y3 = 2.000000 -textures = "BORDER" -BORDER = "sgb.png" +filter_linear4 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 1.000000 +location = 0.500000 +in_res_x = 160.000000 +in_res_y = 144.000000 +TVOUT_RESOLUTION = 320.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 0.000000 + +textures = BORDER +BORDER = sgb.png diff --git a/border/sgba/README.md b/border/sgba/README.md new file mode 100644 index 0000000..0e6b699 --- /dev/null +++ b/border/sgba/README.md @@ -0,0 +1,11 @@ +# Super Game Boy Advance border shader + +These shader presets will allow you to apply a 320x240 Super Game Boy Advance border around a 240x160 input image from a Game Boy Advance core. + +Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 320x240 resolution. + +One option to display it integer scaled is to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. + +The other option is to use one of the auto-box shaders in the last pass of the shader chain to integer scale or center the output of the border shader within the viewport. You may need to disable RetroArch's Integer Scaling and set the Aspect Ratio equal to your screen aspect ratio to see the whole image. + +An example border is included, you can swap it out with another 320x240 Super Game Boy Advance border in png format with the center 240x160 transparent. The borders included with this shader were created by EndUser based on a concept by BLUEamnesiac. \ No newline at end of file diff --git a/border/sgba/README.txt b/border/sgba/README.txt deleted file mode 100644 index 2e262bf..0000000 --- a/border/sgba/README.txt +++ /dev/null @@ -1,5 +0,0 @@ -These shader presets will allow you to apply a 320x240 Super Game Boy Advance border around a 240x160 input image from a Game Boy Advance core. - -Please note that RetroArch's integer scaling function will not automatically set a correct integer scale for the output image, as it will only take the Game Boy Advance core's reported resolution of 240x160 into account, and not the output image's 320x240 resolution. You will need to set a custom viewport size, either with the Custom Ratio menu option or defining custom_viewport_width and custom_viewport_height in the config file, setting Aspect Ratio Index to "Custom", and enabling Integer Scaling to center the image automatically. - -An example border is included, you can swap it out with another 320x240 Super Game Boy Advance border in png format with the center 240x160 transparent. The borders included with this shader were created by EndUser based on a concept by BLUEamnesiac. \ No newline at end of file diff --git a/border/sgba/sgba-tvout+interlacing.slangp b/border/sgba/sgba-tvout+interlacing.slangp index 2ec7f00..ef89b9e 100644 --- a/border/sgba/sgba-tvout+interlacing.slangp +++ b/border/sgba/sgba-tvout+interlacing.slangp @@ -1,27 +1,33 @@ -shaders = "4" -shader0 = "../shaders/imgborder-sgba.slang" -shader1 = "../../crt/shaders/tvout-tweaks.slang" -shader2 = "../../misc/image-adjustment.slang" -shader3 = "../../misc/interlacing.slang" +shaders = 5 +shader0 = ../shaders/imgborder-sgba.slang +shader1 = ../../crt/shaders/tvout-tweaks.slang +shader2 = ../../misc/image-adjustment.slang +shader3 = ../../misc/interlacing.slang +shader4 = ../../auto-box/box-center.slang -scale_type_x0 = "absolute" -scale_x0 = "320" -scale_type_y0 = "absolute" -scale_y0 = "240" +scale_type_x0 = absolute +scale_x0 = 320 +scale_type_y0 = absolute +scale_y0 = 240 -scale_type_x1 = "viewport" -scale_x1 = "1.000000" -scale_type_y1 = "source" -scale_y1 = "1.000000" +scale_type_x1 = viewport +scale_x1 = 1.000000 +scale_type_y1 = source +scale_y1 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "1.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "1.000000" +scale_type_y3 = source +scale_y3 = 2.000000 -textures = "BORDER" -BORDER = "sgba.png" +filter_linear4 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 1.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 1.000000 + +textures = BORDER +BORDER = sgba.png diff --git a/border/sgba/sgba-tvout-gba-color+interlacing.slangp b/border/sgba/sgba-tvout-gba-color+interlacing.slangp index dcbfdcb..eeb6368 100644 --- a/border/sgba/sgba-tvout-gba-color+interlacing.slangp +++ b/border/sgba/sgba-tvout-gba-color+interlacing.slangp @@ -1,31 +1,37 @@ -shaders = "5" -shader0 = "../../handheld/shaders/color/gba-color.slang" -shader1 = "../shaders/imgborder-sgba.slang" -shader2 = "../../crt/shaders/tvout-tweaks.slang" -shader3 = "../../misc/image-adjustment.slang" -shader4 = "../../misc/interlacing.slang" +shaders = 6 +shader0 = ../../handheld/shaders/color/gba-color.slang +shader1 = ../shaders/imgborder-sgba.slang +shader2 = ../../crt/shaders/tvout-tweaks.slang +shader3 = ../../misc/image-adjustment.slang +shader4 = ../../misc/interlacing.slang +shader5 = ../../auto-box/box-center.slang -scale_type0 = "source" -scale0 = "1.0" +scale_type0 = source +scale0 = 1.0 -scale_type_x1 = "absolute" -scale_x1 = "320" -scale_type_y1 = "absolute" -scale_y1 = "240" +scale_type_x1 = absolute +scale_x1 = 320 +scale_type_y1 = absolute +scale_y1 = 240 -scale_type_x2 = "viewport" -scale_x2 = "1.000000" -scale_type_y2 = "source" -scale_y2 = "1.000000" +scale_type_x2 = viewport +scale_x2 = 1.000000 +scale_type_y2 = source +scale_y2 = 1.000000 -parameters = "box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS" -box_scale = "1.000000" -location = "0.500000" -in_res_x = "240.000000" -in_res_y = "160.000000" -TVOUT_RESOLUTION = "512.000000" -TVOUT_COMPOSITE_CONNECTION = "0.000000" -TVOUT_TV_COLOR_LEVELS = "1.000000" +scale_type_y4 = source +scale_y4 = 2.000000 -textures = "BORDER" -BORDER = "sgba.png" +filter_linear5 = false + +parameters = box_scale;location;in_res_x;in_res_y;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS +box_scale = 1.000000 +location = 0.500000 +in_res_x = 240.000000 +in_res_y = 160.000000 +TVOUT_RESOLUTION = 512.000000 +TVOUT_COMPOSITE_CONNECTION = 0.000000 +TVOUT_TV_COLOR_LEVELS = 1.000000 + +textures = BORDER +BORDER = sgba.png