private void UpdateState() { m_emuStatus = PCSX2IPC.Status(m_ipc); switch (m_status) { case KAMIStatus.Unconnected: if (PCSX2IPC.GetError(m_ipc) == PCSX2IPC.IPCStatus.Success) { m_connected = true; } break; case KAMIStatus.Connected: if (PCSX2IPC.GetError(m_ipc) != PCSX2IPC.IPCStatus.Success) { m_connected = false; break; } if (m_emuStatus != PCSX2IPC.EmuStatus.Shutdown) { string titleId = PCSX2IPC.GetGameID(m_ipc); string gameVersion = PCSX2IPC.GetGameVersion(m_ipc); m_game = GameManager.GetGame(m_ipc, titleId, gameVersion); } break; case KAMIStatus.Ready: if (PCSX2IPC.GetError(m_ipc) != PCSX2IPC.IPCStatus.Success) { m_connected = false; m_game = null; } else if (m_emuStatus == PCSX2IPC.EmuStatus.Shutdown) { m_game = null; } break; case KAMIStatus.Injecting: if (PCSX2IPC.GetError(m_ipc) != PCSX2IPC.IPCStatus.Success) { m_connected = false; m_game = null; m_injecting = false; } else if (m_emuStatus == PCSX2IPC.EmuStatus.Shutdown) { m_game = null; m_injecting = false; } break; } }
private void UpdateGui() { string version = m_connected ? PCSX2IPC.Version(m_ipc) : ""; string title = m_connected ? PCSX2IPC.GetGameTitle(m_ipc) : ""; string titleId = m_connected ? PCSX2IPC.GetGameID(m_ipc) : ""; string gameVersion = m_connected ? PCSX2IPC.GetGameVersion(m_ipc) : ""; string hash = m_connected ? PCSX2IPC.GetGameUUID(m_ipc) : ""; Dispatcher.BeginInvoke((Action)(() => { if (m_connected) { infoLabel.Content = $"Version: {version}\n"; infoLabel.Content += $"Title: {title}\n"; infoLabel.Content += $"TitleId: {titleId}\n"; infoLabel.Content += $"Game Version: {gameVersion}\n"; infoLabel.Content += $"Hash: {hash}\n"; infoLabel.Content += $"Emu Status: {m_emuStatus}\n"; } statusLabel.Content = $"KAMI Status: {m_status}"; })); }