public void StopGame(int exitCode) { Cpu.Stop(); foreach (KThread thread in this.Threads) { thread.Exit(0); } this.DestroyTimerQueue(); for (int n = 0; n < Interrupts.Length; n++) { for (int m = 0; m < Interrupts[n].Length; m++) { KIntHandler handler = Interrupts[n][m]; if (handler != null) { handler.Dispose(); Interrupts[n][m] = null; } } } foreach (Module module in Bios._modules) { module.Stop(); } Bios.Game = null; Bios.BootStream = null; }
public void Destroy() { Debug.Assert(_isCreated == true); if (_isCreated == false) { return; } // Destroy thread _shutDown = true; _stateChangeEvent.Set(); _thread.Interrupt(); _cpu.Stop(); if (_thread.Join(1000) == false) { // Failed to wait, so kill _thread.Abort(); } while (_thread.IsAlive == true) { Thread.Sleep(10); } _thread = null; #if XMB // Destroy XMB _xmb.Cleanup(); _xmb = null; #else #endif // Destroy all the components foreach (IComponentInstance component in _instances) { if (component != null) { component.Cleanup(); } } _instances.Clear(); _audio = null; _bios = null; _cpu = null; _io.Clear(); _video = null; _isCreated = false; _state = InstanceState.Idle; this.OnStateChanged(); }