added stretch to fullscreen

This commit is contained in:
BeZide93
2025-09-29 13:53:26 -05:00
committed by KeatonTheBot
parent 327416c967
commit fa5b5b127e
7 changed files with 70 additions and 12 deletions
+20 -10
View File
@@ -221,19 +221,29 @@ namespace LibKenjinx
[StructLayout(LayoutKind.Sequential)]
public struct GraphicsConfiguration
{
public float ResScale = 1f;
public float MaxAnisotropy = -1;
public bool FastGpuTime = true;
public bool Fast2DCopy = true;
public bool EnableMacroJit = false;
public bool EnableMacroHLE = true;
public bool EnableShaderCache = true;
public bool EnableTextureRecompression = false;
public BackendThreading BackendThreading = BackendThreading.Auto;
public AspectRatio AspectRatio = AspectRatio.Fixed16x9;
public float ResScale;
public float MaxAnisotropy;
public bool FastGpuTime;
public bool Fast2DCopy;
public bool EnableMacroJit;
public bool EnableMacroHLE;
public bool EnableShaderCache;
public bool EnableTextureRecompression;
public BackendThreading BackendThreading;
public AspectRatio AspectRatio; // <- important
public GraphicsConfiguration()
{
ResScale = 1f;
MaxAnisotropy = -1;
FastGpuTime = true;
Fast2DCopy = true;
EnableMacroJit = false;
EnableMacroHLE = true;
EnableShaderCache = true;
EnableTextureRecompression = false;
BackendThreading = BackendThreading.Auto;
AspectRatio = AspectRatio.Fixed16x9;
}
}
+30 -1
View File
@@ -132,7 +132,6 @@ namespace LibKenjinx
}
List<string> extensions = [];
var size = Marshal.SizeOf<IntPtr>();
var extPtr = (IntPtr*)nativeGraphicsInterop.VkRequiredExtensions;
for (int i = 0; i < nativeGraphicsInterop.VkRequiredExtensionsCount; i++)
{
@@ -274,6 +273,7 @@ namespace LibKenjinx
return stats;
}
[UnmanagedCallersOnly(EntryPoint = "device_launch_mii_editor")]
public static bool LaunchMiiEditAppletNative()
{
@@ -468,5 +468,34 @@ namespace LibKenjinx
CloseUser(userId);
}
// ----------------------
// Stretch: Helper + Exports
// ----------------------
// central logic (managed)
private static void ApplyFullscreenStretch(bool enable)
{
var ar = enable ? AspectRatio.Stretched : AspectRatio.Fixed16x9;
// Retrieve, modify, write back struct
var cfg = GraphicsConfiguration;
cfg.AspectRatio = ar;
GraphicsConfiguration = cfg;
// Hot-Apply for running emulation
var dev = SwitchDevice?.EmulationContext;
if (dev != null)
{
try { dev.Configuration.AspectRatio = ar; } catch { }
}
}
// CamelCase Export (JNA calls it here)
[UnmanagedCallersOnly(EntryPoint = "graphicsSetFullscreenStretch")]
public static void GraphicsSetFullscreenStretchNativeAlias(bool enable)
{
ApplyFullscreenStretch(enable);
}
}
}