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); } }
public static extern bool retro_load_game(ref retro_game_info game);
public bool ReplaceImageIndex(uint index, ref retro_game_info info) => _callback.replace_image_index(index, ref info);
public static unsafe extern int retro_load_game([MarshalAs(UnmanagedType.LPStruct)] retro_game_info game);
public bool LoadGameSpecial(uint gameType, ref retro_game_info game, uint numInfo) { return(_loadGameSpecial(gameType, ref game, numInfo)); }
public bool LoadGame(ref retro_game_info game) { return(_loadGame(ref game)); }
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); }