public static void SetGameSpecificOverscan(bool overrideOverscan, UInt32 top, UInt32 bottom, UInt32 left, UInt32 right) { RomInfo romInfo = InteropEmu.GetRomInfo(); if (romInfo.PrgCrc32 == 0) { return; } GameSpecificInfo existingConfig = ConfigManager.Config.GameSpecificSettings.Find(gameConfig => gameConfig.GamePrgCrc32 == romInfo.GetPrgCrcString()); if (overrideOverscan || existingConfig != null) { //Only add if the config already exists, or if override setting is turned on GameSpecificInfo info = existingConfig ?? new GameSpecificInfo(); info.GameName = romInfo.GetRomName(); info.GamePrgCrc32 = romInfo.GetPrgCrcString(); info.OverrideOverscan = overrideOverscan; info.OverscanTop = top; info.OverscanBottom = bottom; info.OverscanLeft = left; info.OverscanRight = right; if (existingConfig == null) { ConfigManager.Config.GameSpecificSettings.Add(info); } } }
public static GameSpecificInfo CreateGameSpecificConfig() { RomInfo romInfo = InteropEmu.GetRomInfo(); GameSpecificInfo info = new GameSpecificInfo(); info.GameName = romInfo.GetRomName(); info.GamePrgCrc32 = romInfo.GetPrgCrcString(); return(info); }
public frmCheatImport() { InitializeComponent(); UpdateImportButton(); RomInfo romInfo = InteropEmu.GetRomInfo(); _gameCrc = romInfo.GetPrgCrcString(); _gameName = romInfo.GetRomName(); txtGameName.Text = _gameName; }
private void LoadGame(string romPath) { int archiveFileIndex = -1; if (frmSelectRom.SelectRom(romPath, ref archiveFileIndex)) { RomInfo romInfo = InteropEmu.GetRomInfo(romPath, archiveFileIndex); _gameCrc = romInfo.GetPrgCrcString(); _gameName = romInfo.GetRomName(); txtGameName.Text = _gameName; UpdateImportButton(); } }
private void LoadGame(string romPath) { ResourcePath resource = romPath; if (frmSelectRom.SelectRom(ref resource)) { RomInfo romInfo = InteropEmu.GetRomInfo(resource); _gameCrc = romInfo.GetPrgCrcString(); _gameName = romInfo.GetRomName(); txtGameName.Text = _gameName; UpdateImportButton(); } }
private void LoadGame(string romPath) { int archiveFileIndex = -1; if (frmSelectRom.SelectRom(romPath, ref archiveFileIndex)) { RomInfo romInfo = InteropEmu.GetRomInfo(romPath, archiveFileIndex); _gameCrc = romInfo.GetPrgCrcString(); if (_gameCrc != null) { ((CheatInfo)Entity).GameName = Path.GetFileNameWithoutExtension(romInfo.RomName); txtGameName.Text = ((CheatInfo)Entity).GameName; } } }
private void LoadGame(string romPath) { ResourcePath resource = romPath; if (frmSelectRom.SelectRom(ref resource)) { RomInfo romInfo = InteropEmu.GetRomInfo(resource); _gameCrc = romInfo.GetPrgCrcString(); if (_gameCrc != null) { ((CheatInfo)Entity).GameName = romInfo.GetRomName(); txtGameName.Text = ((CheatInfo)Entity).GameName; } } }
private void btnCreateCheat_Click(object sender, EventArgs e) { RomInfo romInfo = InteropEmu.GetRomInfo(); CheatInfo newCheat = new CheatInfo { GameCrc = romInfo.GetPrgCrcString(), GameName = romInfo.GetRomName(), Address = (uint)lstAddresses.CurrentAddress, CheatType = CheatType.Custom }; frmCheat frm = new frmCheat(newCheat); if (frm.ShowDialog() == DialogResult.OK) { OnAddCheat?.Invoke(newCheat, new EventArgs()); } }
protected override void OnShown(EventArgs e) { base.OnShown(e); _cheats = NestopiaCheatLoader.Load(ResourceManager.GetZippedResource("MesenCheatDb.xml"), "", ""); _gamesByCrc = new Dictionary <string, GameInfo>(); foreach (CheatInfo cheat in _cheats) { if (_gamesByCrc.ContainsKey(cheat.GameName)) { _gamesByCrc[cheat.GameCrc].CheatCount++; } else { _gamesByCrc[cheat.GameCrc] = new GameInfo() { Name = cheat.GameName, Crc = cheat.GameCrc, CheatCount = 1 }; } } lblCheatCount.Text = ResourceHelper.GetMessage("CheatsFound", _gamesByCrc.Count.ToString(), _cheats.Count.ToString()); lstGames.Sorted = true; txtSearch.Focus(); UpdateList(); RomInfo info = InteropEmu.GetRomInfo(); if (!string.IsNullOrWhiteSpace(info.GetRomName())) { string loadedGameCrc = info.GetPrgCrcString(); for (int i = 0, len = lstGames.Items.Count; i < len; i++) { if (((GameInfo)lstGames.Items[i]).Crc == loadedGameCrc) { lstGames.TopIndex = Math.Max(0, i - 10); lstGames.SelectedIndex = i; break; } } } }
private void UpdateGameList(string gameCrc = null) { RomInfo romInfo = InteropEmu.GetRomInfo(); Dictionary <string, string> nameByCrc = new Dictionary <string, string>(); if (!string.IsNullOrWhiteSpace(romInfo.GetRomName())) { nameByCrc[romInfo.GetPrgCrcString()] = romInfo.GetRomName(); } foreach (CheatInfo cheat in _cheats) { if (!nameByCrc.ContainsKey(cheat.GameCrc)) { nameByCrc[cheat.GameCrc] = cheat.GameName; } } lstGameList.Items.Clear(); List <GameInfo> gameList = new List <GameInfo>(); foreach (KeyValuePair <string, string> kvp in nameByCrc) { gameList.Add(new GameInfo { Text = kvp.Value, Crc = kvp.Key }); } lstGameList.Items.AddRange(gameList.ToArray()); if (lstGameList.Items.Count > 0) { if (gameCrc == null) { if (_selectedItem == null && !string.IsNullOrWhiteSpace(romInfo.GetRomName())) { gameCrc = romInfo.GetPrgCrcString(); } else { gameCrc = _selectedItem?.Crc; } } _selectedItem = null; if (gameCrc != null) { foreach (GameInfo info in lstGameList.Items) { if (info.Crc == gameCrc) { _selectedItem = info; info.Selected = true; break; } } } if (_selectedItem == null && lstGameList.Items.Count > 0) { _selectedItem = (GameInfo)lstGameList.Items[0]; lstGameList.Items[0].Selected = true; } } else { _selectedItem = null; } if (_selectedItem != null) { _selectedItem.EnsureVisible(); } btnDeleteGameCheats.Enabled = mnuDeleteGameCheats.Enabled = btnExportGame.Enabled = mnuExportGame.Enabled = _selectedItem != null; UpdateCheatList(); }
public static GameSpecificInfo GetGameSpecificInfo() { RomInfo romInfo = InteropEmu.GetRomInfo(); GameSpecificInfo existingConfig = ConfigManager.Config.GameSpecificSettings.Find(gameConfig => gameConfig.GamePrgCrc32 == romInfo.GetPrgCrcString()); return(existingConfig); }