Fixed Loading Screen while Compiling Shaders

This commit is contained in:
BeZide93
2025-09-25 17:10:03 -05:00
committed by KeatonTheBot
parent 92c3b72b17
commit 7cc28d0242
3 changed files with 15 additions and 16 deletions
@@ -111,11 +111,11 @@ object KenjinxNative : KenjinxNativeJna by jnaInstance {
MainActivity.mainViewModel?.gameHost?.currentWindowHandle ?: -1
@JvmStatic
fun updateProgress(infoPtr: Long, progress: Float) =
MainActivity.mainViewModel?.gameHost?.setProgress(
NativeHelpers.instance.getStringJava(infoPtr),
progress
)
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)
}
/**
* Variant A (Pointer → Strings via NativeHelpers).
@@ -59,6 +59,13 @@ class MainActivity : BaseActivity() {
}
mainViewModel?.gameHost?.hideProgressIndicator()
}
// <<< NEW: is called from the Native/Lib page to set the loading progress
@JvmStatic
fun updateProgress(info: String, percent: Float) {
// Route directly via the GameHost it takes care of the progress states
mainViewModel?.gameHost?.setProgress(info, percent)
}
}
init {
@@ -51,7 +51,6 @@ class UiHandler {
var message: String = ""
init {
// 2.0.3 compatible: no parameters
KenjinxNative.uiHandlerSetup()
}
@@ -65,8 +64,7 @@ class UiHandler {
newMode: KeyboardMode,
newSubtitle: String,
newInitialText: String
)
{
) {
title = newTitle
message = newMessage
watermark = newWatermark
@@ -87,13 +85,11 @@ class UiHandler {
val inputListener = remember { inputText }
val validation = remember { mutableStateOf("") }
// Focus & keyboard control so the popup can be typed immediately like in 2.0.3
val focusRequester = remember { FocusRequester() }
val keyboard = LocalSoftwareKeyboardController.current
LaunchedEffect(showMessageListener.value, type) {
if (showMessageListener.value && type == 2) {
// small delay until the dialog is mounted
delay(100)
focusRequester.requestFocus()
keyboard?.show()
@@ -120,13 +116,9 @@ class UiHandler {
fun submit() {
if (type == 2) {
if (inputListener.value.length < minLength || inputListener.value.length > maxLength)
return
if (inputListener.value.length < minLength || inputListener.value.length > maxLength) return
}
KenjinxNative.uiHandlerSetResponse(
true,
if (type == 2) inputListener.value else ""
)
KenjinxNative.uiHandlerSetResponse(true, if (type == 2) inputListener.value else "")
showMessageListener.value = false
}