Thanks for the suggestions @Ortega, but still no luck after testing with those changes.
I’ve been doing some research on why I’m having issues with my device. It looks like the shader is affected by both the aspect ratio and the resolution, just from random tests I’ve been doing on my iPhone. So I tried to figure out the maximum custom resolution I could set in Retroarch on my iPhone without losing the weird aspect ratio that results from Desmume’s hybrid layout.
An iPhone X has a resolution of 2436 x 1125 pixels and renders images at a scale of 3x (iOS Device Compatibility Reference). It looks like Retroarch uses a ‘safe area’ that avoids the screen’s curves, notch, and iOS UI etc. According to this, that safe area resolution (landscape) should be 2172 x 1062 pixels:
2436 − 3*(44 + 44) = 2172px width
1125 − 3*(21) = 1062px height
Values I found by opening the Retroarch xcode project in xcode verifies that as well.
So, if 2172 x 1062 px is the max res I can work with, what custom resolution should I set to keep Desmume’s hybrid layout aspect ratio? Desmume has an internal resolution of 256 x 192 pixels, according to the core options and to jdgleaver’s shader. So if I set the core options to hybrid layout 3:1, like the shader says I’m supposed to do, then that’d be a resolution/aspect ratio of 341.33 x 192 pixels:
256*(4/3) = 341.333333333333px width
192px height (Im pretty sure height stays the same)
If I scale that aspect ratio up, by multiples of 3 to get rid of the decimals, which I assume do not play nicely with the shader, the largest I can get before going outside the safe area is 1024 x 576 px (i.e.
341.33:192*3). Scaling it up 6 times (
341.33:192*6) gives 2048 x 1152 px, which is taller than the safe area but it looks ok even though it overlaps with the ‘swipe-up-bar’ at the bottom of the screen. But with both, the shader doesn’t look even or uniform:
1024 x 576 px
2048 x 1152 px
I noticed that in Retroarch settings video > scaling > aspect ratio, Desmume’s DAR (default aspect ratio) is shown as 341:192, so I tried dropping the 0.333333 decimals completely. Largest res I can get in the safe area is 1705 x 960 px (or 2046 x 1152 px, like in the screenshot in my first post above, if I let the image overlap with the iOS UI at the bottom). Still, neither has a uniform grid:
1705 x 960 px
2046 x 1152 px
So, I’m not really sure what to do. I’ve looked at tweaking the shader settings in the .glslp preset file, but nothing seems to work really. I’ve been playing with adding settings like
scale_type, but I still can’t get it right:
shaders = "1"
shader0 = "shaders/zfast_lcd_nds_hybrid_hd.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
parameters = "BORDERMULT"
BORDERMULT = "40.0"
scale_type_y0 = "source"
scale_y0 = "3"
scale_type_x0 = "source"
scale_x0 = "3"
Any further insights or advice welcome.