mirror of
https://github.com/libretro/Mesen.git
synced 2024-12-16 05:48:05 +00:00
Cheats: Automatically use current game when adding a new cheat
This commit is contained in:
parent
3630395d6e
commit
33c201984c
@ -28,7 +28,11 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
Entity = cheat;
|
||||
|
||||
_gameHash = cheat.GameHash;
|
||||
|
||||
|
||||
if(string.IsNullOrWhiteSpace(cheat.GameName)) {
|
||||
LoadGame(InteropEmu.GetROMPath());
|
||||
}
|
||||
|
||||
radGameGenie.Tag = CheatType.GameGenie;
|
||||
radProActionRocky.Tag = CheatType.ProActionRocky;
|
||||
radCustom.Tag = CheatType.Custom;
|
||||
@ -64,15 +68,21 @@ namespace Mesen.GUI.Forms.Cheats
|
||||
((CheatInfo)Entity).GameHash = _gameHash;
|
||||
}
|
||||
|
||||
private void LoadGame(string romPath)
|
||||
{
|
||||
_gameHash = MD5Helper.GetMD5Hash(romPath);
|
||||
if(_gameHash != null) {
|
||||
((CheatInfo)Entity).GameName = Path.GetFileNameWithoutExtension(romPath);
|
||||
txtGameName.Text = ((CheatInfo)Entity).GameName;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnBrowse_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = ResourceHelper.GetMessage("FilterRom");
|
||||
if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
||||
_gameHash = MD5Helper.GetMD5Hash(ofd.FileName);
|
||||
if(_gameHash != null) {
|
||||
txtGameName.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
|
||||
}
|
||||
LoadGame(ofd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user