Beispiel #1
0
        protected void SetStateIndex(int index)
        {
            if (_retroPlayer == null)
            {
                return;
            }
            LibRetroFrontend retro = _retroPlayer.LibRetro;

            if (retro != null)
            {
                retro.SetStateIndex(index);
            }
        }
Beispiel #2
0
        protected void LoadState()
        {
            if (_retroPlayer == null)
            {
                return;
            }
            LibRetroFrontend retro = _retroPlayer.LibRetro;

            if (retro != null)
            {
                retro.LoadState();
            }
        }
Beispiel #3
0
        public void SetMediaItem(LibRetroMediaItem mediaItem)
        {
            if (_retro != null)
            {
                return;
            }

            _state = PlayerState.Active;
            IResourceLocator locator = mediaItem.GetResourceLocator();

            string gamePath;

            if (!string.IsNullOrEmpty(mediaItem.ExtractedPath))
            {
                gamePath = mediaItem.ExtractedPath;
            }
            else if (locator.TryCreateLocalFsAccessor(out _accessor))
            {
                gamePath = _accessor.LocalFileSystemPath;
            }
            else
            {
                return;
            }

            string saveName = DosPathHelper.GetFileNameWithoutExtension(locator.NativeResourcePath.FileName);

            ServiceRegistration.Get <ILogger>().Debug("LibRetroPlayer: Creating LibRetroFrontend: Core Path '{0}', Game Path '{1}', Save Name '{2}'", mediaItem.LibRetroPath, gamePath, saveName);

            _corePath     = mediaItem.LibRetroPath;
            _isCoreLoaded = ServiceRegistration.Get <ILibRetroCoreInstanceManager>().TrySetCoreLoading(_corePath);
            if (!_isCoreLoaded)
            {
                ShowLoadErrorDialog();
                return;
            }

            _retro          = new LibRetroFrontend(mediaItem.LibRetroPath, gamePath, saveName);
            _isLibretroInit = _retro.Init();
            //if (_isLibretroInit)
            //{
            //  TimingInfo timingInfo = _retro.GetTimingInfo();
            //  if (timingInfo != null)
            //    MediaItemAspect.SetAttribute(mediaItem.Aspects, VideoAspect.ATTR_FPS, (int)timingInfo.FPS);
            //}
        }
Beispiel #4
0
 public void Dispose()
 {
     if (_retro != null)
     {
         _retro.Dispose();
         _retro = null;
     }
     if (_accessor != null)
     {
         _accessor.Dispose();
         _accessor = null;
     }
     if (_isCoreLoaded)
     {
         ServiceRegistration.Get <ILibRetroCoreInstanceManager>().SetCoreUnloaded(_corePath);
         _isCoreLoaded = false;
     }
 }