mirror of
https://git.ryujinx.app/projects/Kenji-NX.git
synced 2026-09-25 13:10:05 +02:00
added stretch to fullscreen
This commit is contained in:
@@ -137,6 +137,10 @@ class GameHost(context: Context?, private val mainViewModel: MainViewModel) : Su
|
||||
}
|
||||
} catch (_: Throwable) {}
|
||||
|
||||
val qs = org.kenjinx.android.viewmodels.QuickSettings(mainViewModel.activity)
|
||||
try {
|
||||
KenjinxNative.graphicsSetFullscreenStretch(qs.stretchToFullscreen)
|
||||
} catch (_: Throwable) {}
|
||||
_guestThread = thread(start = true, name = "KenjinxGuest") {
|
||||
runGame()
|
||||
}
|
||||
@@ -280,6 +284,7 @@ class GameHost(context: Context?, private val mainViewModel: MainViewModel) : Su
|
||||
|
||||
// If rotation is known: Force plausibility (Landscape ↔ Portrait)
|
||||
expectedRotation?.let { rot ->
|
||||
// ROTATION_90 (1) / ROTATION_270 (3) => Landscape
|
||||
val landscape = (rot == 1 || rot == 3)
|
||||
if (landscape && h > w) {
|
||||
val t = w; w = h; h = t
|
||||
|
||||
@@ -53,6 +53,7 @@ interface KenjinxNativeJna : Library {
|
||||
fun graphicsRendererSetSize(width: Int, height: Int)
|
||||
fun graphicsRendererSetVsync(vSyncMode: Int)
|
||||
fun graphicsRendererRunLoop()
|
||||
fun graphicsSetFullscreenStretch(enable: Boolean)
|
||||
fun deviceReloadFilesystem()
|
||||
fun inputInitialize(width: Int, height: Int)
|
||||
fun inputSetClientSize(width: Int, height: Int)
|
||||
@@ -119,10 +120,10 @@ object KenjinxNative : KenjinxNativeJna by jnaInstance {
|
||||
|
||||
@JvmStatic
|
||||
fun updateProgress(infoPtr: Long, progress: Float) {
|
||||
// Get string from native pointer and push into progress overlay
|
||||
val text = NativeHelpers.instance.getStringJava(infoPtr)
|
||||
MainActivity.mainViewModel?.gameHost?.setProgress(text, progress)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun onSurfaceSizeChanged(width: Int, height: Int) {
|
||||
// No-Op: Placeholder – Hook if needed.
|
||||
@@ -187,6 +188,7 @@ object KenjinxNative : KenjinxNativeJna by jnaInstance {
|
||||
|
||||
/**
|
||||
* Variant B (strings directly). Used by newer JNI/interop paths.
|
||||
* Signature exactly matches the C# call in AndroidUIHandler.cs / Interop.UpdateUiHandler(...).
|
||||
*/
|
||||
@JvmStatic
|
||||
fun uiHandlerUpdate(
|
||||
|
||||
@@ -36,6 +36,7 @@ class QuickSettings(val activity: Activity) {
|
||||
var enableShaderCache: Boolean
|
||||
var enableTextureRecompression: Boolean
|
||||
var enableMacroHLE: Boolean
|
||||
var stretchToFullscreen: Boolean
|
||||
var resScale: Float
|
||||
var maxAnisotropy: Float
|
||||
var isGrid: Boolean
|
||||
@@ -74,6 +75,7 @@ class QuickSettings(val activity: Activity) {
|
||||
enableShaderCache = sharedPref.getBoolean("enableShaderCache", true)
|
||||
enableTextureRecompression = sharedPref.getBoolean("enableTextureRecompression", false)
|
||||
enableMacroHLE = sharedPref.getBoolean("enableMacroHLE", true)
|
||||
stretchToFullscreen = sharedPref.getBoolean("stretchToFullscreen", false)
|
||||
resScale = sharedPref.getFloat("resScale", 1f)
|
||||
maxAnisotropy = sharedPref.getFloat("maxAnisotropy", 0f)
|
||||
useVirtualController = sharedPref.getBoolean("useVirtualController", true)
|
||||
@@ -112,6 +114,7 @@ class QuickSettings(val activity: Activity) {
|
||||
putBoolean("enableShaderCache", enableShaderCache)
|
||||
putBoolean("enableTextureRecompression", enableTextureRecompression)
|
||||
putBoolean("enableMacroHLE", enableMacroHLE)
|
||||
putBoolean("stretchToFullscreen", stretchToFullscreen)
|
||||
putFloat("resScale", resScale)
|
||||
putFloat("maxAnisotropy", maxAnisotropy)
|
||||
putBoolean("useVirtualController", useVirtualController)
|
||||
|
||||
+4
@@ -57,6 +57,7 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||
enableShaderCache: MutableState<Boolean>,
|
||||
enableTextureRecompression: MutableState<Boolean>,
|
||||
enableMacroHLE: MutableState<Boolean>,
|
||||
stretchToFullscreen: MutableState<Boolean>,
|
||||
resScale: MutableState<Float>,
|
||||
maxAnisotropy: MutableState<Float>,
|
||||
useVirtualController: MutableState<Boolean>,
|
||||
@@ -91,6 +92,7 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||
enableShaderCache.value = sharedPref.getBoolean("enableShaderCache", true)
|
||||
enableTextureRecompression.value = sharedPref.getBoolean("enableTextureRecompression", false)
|
||||
enableMacroHLE.value = sharedPref.getBoolean("enableMacroHLE", false)
|
||||
stretchToFullscreen.value = sharedPref.getBoolean("stretchToFullscreen", false)
|
||||
resScale.value = sharedPref.getFloat("resScale", 1f)
|
||||
maxAnisotropy.value = sharedPref.getFloat("maxAnisotropy", 0f)
|
||||
useVirtualController.value = sharedPref.getBoolean("useVirtualController", true)
|
||||
@@ -131,6 +133,7 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||
enableShaderCache: MutableState<Boolean>,
|
||||
enableTextureRecompression: MutableState<Boolean>,
|
||||
enableMacroHLE: MutableState<Boolean>,
|
||||
stretchToFullscreen: MutableState<Boolean>,
|
||||
resScale: MutableState<Float>,
|
||||
maxAnisotropy: MutableState<Float>,
|
||||
useVirtualController: MutableState<Boolean>,
|
||||
@@ -167,6 +170,7 @@ class SettingsViewModel(val activity: MainActivity) {
|
||||
putBoolean("enableShaderCache", enableShaderCache.value)
|
||||
putBoolean("enableTextureRecompression", enableTextureRecompression.value)
|
||||
putBoolean("enableMacroHLE", enableMacroHLE.value)
|
||||
putBoolean("stretchToFullscreen", stretchToFullscreen.value)
|
||||
putFloat("resScale", resScale.value)
|
||||
putFloat("maxAnisotropy", maxAnisotropy.value)
|
||||
putBoolean("useVirtualController", useVirtualController.value)
|
||||
|
||||
@@ -111,6 +111,7 @@ class SettingViews {
|
||||
val enableShaderCache = remember { mutableStateOf(false) }
|
||||
val enableTextureRecompression = remember { mutableStateOf(false) }
|
||||
val enableMacroHLE = remember { mutableStateOf(false) }
|
||||
val stretchToFullscreen = remember { mutableStateOf(false) }
|
||||
val resScale = remember { mutableFloatStateOf(1f) }
|
||||
val maxAnisotropy = remember { mutableFloatStateOf(0f) }
|
||||
val useVirtualController = remember { mutableStateOf(true) }
|
||||
@@ -165,6 +166,7 @@ class SettingViews {
|
||||
enableShaderCache,
|
||||
enableTextureRecompression,
|
||||
enableMacroHLE,
|
||||
stretchToFullscreen,
|
||||
resScale,
|
||||
maxAnisotropy,
|
||||
useVirtualController,
|
||||
@@ -210,6 +212,7 @@ class SettingViews {
|
||||
enableShaderCache,
|
||||
enableTextureRecompression,
|
||||
enableMacroHLE,
|
||||
stretchToFullscreen,
|
||||
resScale,
|
||||
maxAnisotropy,
|
||||
useVirtualController,
|
||||
@@ -259,6 +262,7 @@ class SettingViews {
|
||||
selectedOrientation = orientationPref.value,
|
||||
onOrientationSelected = { sel ->
|
||||
orientationPref.value = sel
|
||||
// Save and use immediately
|
||||
val qs = QuickSettings(mainViewModel.activity)
|
||||
qs.orientationPreference = sel
|
||||
qs.save()
|
||||
@@ -1245,6 +1249,7 @@ class SettingViews {
|
||||
enableShaderCache.SwitchSelector(label = "Shader Cache")
|
||||
enableTextureRecompression.SwitchSelector(label = "Texture Recompression")
|
||||
enableMacroHLE.SwitchSelector(label = "Macro HLE")
|
||||
stretchToFullscreen.SwitchSelector(label = "Stretch to Fullscreen")
|
||||
ResolutionScaleDropdown(
|
||||
selectedScale = resScale.floatValue,
|
||||
onScaleSelected = { scale ->
|
||||
|
||||
Reference in New Issue
Block a user