コード例 #1
0
        public void LoadGame(string path)
        {
            var game = new retro_game_info
            {
                path = Marshal.StringToHGlobalAnsi(path)
            };

            try
            {
                if (!retro_load_game(ref game))
                {
                    throw new Exception($"Unable to load game: {path}");
                }
                retro_get_system_av_info(out _avInfo);
            }
            finally
            {
                Marshal.FreeHGlobal(game.path);
            }
        }
コード例 #2
0
 public static extern bool retro_load_game(ref retro_game_info game);
コード例 #3
0
 public bool ReplaceImageIndex(uint index, ref retro_game_info info) => _callback.replace_image_index(index, ref info);
コード例 #4
0
 public static unsafe extern int retro_load_game([MarshalAs(UnmanagedType.LPStruct)] retro_game_info game);
コード例 #5
0
 public bool LoadGameSpecial(uint gameType, ref retro_game_info game, uint numInfo)
 {
     return(_loadGameSpecial(gameType, ref game, numInfo));
 }
コード例 #6
0
 public bool LoadGame(ref retro_game_info game)
 {
     return(_loadGame(ref game));
 }
コード例 #7
0
ファイル: LibretroGame.cs プロジェクト: 3DArcade/3DArcade
        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);
        }