Пример #1
0
      public bool SwitchProcess(Process newProcess, Emulator emulator)
      {
          IEmuRamIO newIo = null;

          try
          {
              newIo = newProcess != null ? _ioCreationTable[emulator.IOType](newProcess, emulator) : null;
          }
          catch (DolphinNotRunningGameException e)
          {
              MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
              return(false);
          }
          return(SwitchIO(newIo));
      }
Пример #2
0
        private bool SwitchIO(IEmuRamIO newIO, Process newProcess = null)
        {
            lock (_mStreamProcess)
            {
                IsRunning = false;

                // Dipose of old process
                (_io as IDisposable)?.Dispose();
                if (_io != null)
                {
                    _io.OnClose -= ProcessClosed;
                }

                // Check for no process
                if (newIO == null)
                {
                    goto Error;
                }

                try
                {
                    // Open and set new process
                    _io          = newIO;
                    _io.OnClose += ProcessClosed;
                    _process     = newProcess;
                }
                catch (Exception) // Failed to create process
                {
                    goto Error;
                }

                IsEnabled = true;
                IsRunning = true;

                return(true);

Error:
                _io      = null;
                _process = null;
                return(false);
            }
        }
Пример #3
0
        public bool SwitchProcess(Process newProcess, Emulator emulator)
        {
            IEmuRamIO newIo = newProcess != null ? _ioCreationTable[emulator.IOType](newProcess, emulator, Config.RamSize) : null;

            return(SwitchIO(newIo, newProcess));
        }