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.fillMaxSize
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
@ -62,8 +63,9 @@ open class MainActivity: SDLActivity {
setContent { setContent {
val gameIsRunning = remember { GameState.shared._isGameRunning.projectedValue } val gameIsRunning = remember { GameState.shared._isGameRunning.projectedValue }
val startGameConfig = remember { GameState.shared._startGameConfig.projectedValue } val startGameConfig = remember { GameState.shared._startGameConfig.projectedValue }
val fps = remember { GameState.shared._fps.projectedValue }
Box { Box(modifier = Modifier.fillMaxSize()) {
SDLComposeSurface() SDLComposeSurface()
if (gameIsRunning?.value != true) { if (gameIsRunning?.value != true) {
val saveableStateHolder = rememberSaveableStateHolder() val saveableStateHolder = rememberSaveableStateHolder()
@ -73,10 +75,13 @@ open class MainActivity: SDLActivity {
} }
} }
} }
Text(
"FPS: ${fps?.value ?: 0 }"
)
if (startGameConfig?.value != null) { if (startGameConfig?.value != null) {
runSimulator(GameState.shared.startGameConfig!!) 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, resscale: Double = 1.00,
maxAnisotropy: Double = 0, maxAnisotropy: Double = 0,
macroHLE: Bool = false, macroHLE: Bool = false,
ignoreMissingServices: Bool = false, ignoreMissingServices: Bool = true,
hypervisor: Bool = false, hypervisor: Bool = false,
expandRam: Bool = false, expandRam: Bool = false,
dfsIntegrityChecks: Bool = false, dfsIntegrityChecks: Bool = false,

View File

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