Archived
1
0
forked from MeloNX/MeloNX

Working prototype

This commit is contained in:
Daniil Vinogradov 2025-03-08 02:04:47 +01:00
parent 4589e6da3b
commit 68ba8868cc
8 changed files with 13 additions and 5 deletions

View File

@ -17,6 +17,7 @@ import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.remember
@ -62,8 +63,9 @@ open class MainActivity: SDLActivity {
setContent {
val gameIsRunning = remember { GameState.shared._isGameRunning.projectedValue }
val startGameConfig = remember { GameState.shared._startGameConfig.projectedValue }
val fps = remember { GameState.shared._fps.projectedValue }
Box {
Box(modifier = Modifier.fillMaxSize()) {
SDLComposeSurface()
if (gameIsRunning?.value != true) {
val saveableStateHolder = rememberSaveableStateHolder()
@ -73,10 +75,13 @@ open class MainActivity: SDLActivity {
}
}
}
Text(
"FPS: ${fps?.value ?: 0 }"
)
if (startGameConfig?.value != null) {
runSimulator(GameState.shared.startGameConfig!!)
// GameState.shared.startGameConfig = null
GameState.shared.startGameConfig = null
}
}

View File

@ -349,7 +349,7 @@ public extension Ryujinx {
resscale: Double = 1.00,
maxAnisotropy: Double = 0,
macroHLE: Bool = false,
ignoreMissingServices: Bool = false,
ignoreMissingServices: Bool = true,
hypervisor: Bool = false,
expandRam: Bool = false,
dfsIntegrityChecks: Bool = false,

View File

@ -10,6 +10,7 @@ enum ContentTab: String, Hashable {
public static var shared = GameState()
public var isGameRunning: Bool = false
public var startGameConfig: Ryujinx.Configuration?
public var fps: Int = 0
}
struct ContentView: View {
@ -81,14 +82,16 @@ private extension ContentView {
Task {
try await Task.sleep(nanoseconds: 5_000_000_000)
Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { timer in
if Ryujinx.shared.getCurrentFps() != 0 {
GameState.shared.fps = Ryujinx.shared.getCurrentFps()
logger.info("FPS: \(GameState.shared.fps)")
if GameState.shared.fps != 0, isLoading {
withAnimation {
isLoading = false
}
GameState.shared.isGameRunning = true
// isAnimating = false
timer.invalidate()
// timer.invalidate()
}
}
}