示例#1
0
        public bool Init()
        {
            bool canLoad = ServiceRegistration.Get <ILibRetroCoreInstanceManager>().TrySetCoreLoading(_corePath);

            if (!canLoad)
            {
                ShowLoadErrorDialog();
                return(false);
            }

            try
            {
                _retro = new LibRetroEmulator(_corePath);
                _retro.Init();
                InitializeProperties();
                return(true);
            }
            catch (Exception ex)
            {
                ServiceRegistration.Get <ILogger>().Error("LibRetroProxy: Exception initialising LibRetro core '{0}'", ex, _corePath);
            }
            finally
            {
                _retro.Dispose();
                _retro = null;
                ServiceRegistration.Get <ILibRetroCoreInstanceManager>().SetCoreUnloaded(_corePath);
            }
            return(false);
        }
        protected void InitializeLibRetro()
        {
            _textureOutput = new TextureOutput(SkinContext.Device);
            //_soundOutput = new LibRetroDirectSound(SkinContext.Form.Handle, _settings.AudioDeviceId, _settings.AudioBufferSize);
            _soundOutput   = new LibRetroXAudio(_settings.AudioDeviceId);
            _retroEmulator = new LibRetroEmulator(_corePath)
            {
                SaveDirectory   = _settings.SavesDirectory,
                SystemDirectory = _settings.SystemDirectory,
                LogDelegate     = RetroLogDlgt,
                Controller      = _controllerWrapper,
                AudioOutput     = _soundOutput as IAudioOutput,
                VideoOutput     = _textureOutput
            };

            SetCoreVariables();
            _retroEmulator.Init();
            Logger.Debug("LibRetroFrontend: Libretro initialized");
        }