示例#1
0
 public void GetSystemAVInfo(ref retro_system_av_info avInfo)
 {
     _getSystemAVnfo(ref avInfo);
 }
示例#2
0
 public static extern void retro_get_system_av_info(out retro_system_av_info info);
示例#3
0
        public bool Start(LibretroCore core, string gameDirectory, string gameName)
        {
            bool result = false;

            _core = core;
            Name  = gameName;

            if (!string.IsNullOrEmpty(gameName))
            {
                string directory = FileSystem.GetAbsolutePath(gameDirectory);

                string gamePath = GetGamePath(directory, gameName);
                if (gamePath == null)
                {
                    // Try Zip archive
                    string archivePath = FileSystem.GetAbsolutePath($"{directory}/{gameName}.zip");
                    if (File.Exists(archivePath))
                    {
                        Guid gameGuid = Guid.NewGuid();
                        System.IO.Compression.ZipFile.ExtractToDirectory(archivePath, $"{ExtractDirectory}/{gameName}_{gameGuid}");
                        gamePath       = GetGamePath($"{ExtractDirectory}/{gameName}_{gameGuid}", gameName);
                        _extractedPath = gamePath;
                    }
                }

                if (gamePath != null)
                {
                    retro_game_info gameInfo = GetGameInfo(gamePath);
                    if (_core.retro_load_game(ref gameInfo))
                    {
                        try
                        {
                            SystemAVInfo = new retro_system_av_info();
                            _core.retro_get_system_av_info(ref SystemAVInfo);

                            Running = true;
                            result  = true;
                        }
                        catch (Exception e)
                        {
                            Log.Exception(e, "Libretro.LibretroGame.Start");
                        }
                    }
                }
                else
                {
                    Log.Error($"Game '{gameName}' not found in directory '{gameDirectory}'.", "Libretro.LibretroGame.Start");
                }
            }
            else if (core.SupportNoGame)
            {
                retro_game_info gameInfo = new retro_game_info();
                if (_core.retro_load_game(ref gameInfo))
                {
                    try
                    {
                        SystemAVInfo = new retro_system_av_info();
                        _core.retro_get_system_av_info(ref SystemAVInfo);

                        Running = true;
                        result  = true;
                    }
                    catch (Exception e)
                    {
                        Log.Exception(e, "Libretro.LibretroGame.Start");
                    }
                }
            }
            else
            {
                Log.Warning($"Game not set, running '{core.CoreName}' core only.", "Libretro.LibretroGame.Start");
            }

            return(result);
        }