Pass game list to NetPlayUICallbacks and implement OnMsgChangeGame, OnMsgStartGame, FindGameFile

This commit is contained in:
Tom Pratt
2026-05-06 13:44:53 +02:00
committed by Tom Pratt
parent 1464fdfc28
commit 766374434c
6 changed files with 131 additions and 8 deletions

View File

@@ -6,6 +6,7 @@ import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import org.dolphinemu.dolphinemu.features.netplay.Netplay
import org.dolphinemu.dolphinemu.services.GameFileCacheManager
class NetplaySetupViewModel : ViewModel() {
private val _connectionRole = MutableStateFlow<ConnectionRole>(ConnectionRole.Connect)
@@ -26,6 +27,10 @@ class NetplaySetupViewModel : ViewModel() {
private val _connectPort = MutableStateFlow(Netplay.getConnectPort().toString())
val connectPort = _connectPort.asStateFlow()
init {
GameFileCacheManager.startLoad()
}
fun setConnectionRole(connectionRole: ConnectionRole) {
_connectionRole.value = connectionRole
}
@@ -55,6 +60,10 @@ class NetplaySetupViewModel : ViewModel() {
}
fun connect() {
if (GameFileCacheManager.isLoading().value == true) {
return
}
Netplay.saveSetup(
nickname = nickname.value,
connectionType = connectionType.value,