Cheats: Automatically use current game when adding a new cheat
This commit is contained in:
parent
3630395d6e
commit
33c201984c
1 changed files with 15 additions and 5 deletions
|
@ -29,6 +29,10 @@ namespace Mesen.GUI.Forms.Cheats
|
||||||
|
|
||||||
_gameHash = cheat.GameHash;
|
_gameHash = cheat.GameHash;
|
||||||
|
|
||||||
|
if(string.IsNullOrWhiteSpace(cheat.GameName)) {
|
||||||
|
LoadGame(InteropEmu.GetROMPath());
|
||||||
|
}
|
||||||
|
|
||||||
radGameGenie.Tag = CheatType.GameGenie;
|
radGameGenie.Tag = CheatType.GameGenie;
|
||||||
radProActionRocky.Tag = CheatType.ProActionRocky;
|
radProActionRocky.Tag = CheatType.ProActionRocky;
|
||||||
radCustom.Tag = CheatType.Custom;
|
radCustom.Tag = CheatType.Custom;
|
||||||
|
@ -64,15 +68,21 @@ namespace Mesen.GUI.Forms.Cheats
|
||||||
((CheatInfo)Entity).GameHash = _gameHash;
|
((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)
|
private void btnBrowse_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OpenFileDialog ofd = new OpenFileDialog();
|
OpenFileDialog ofd = new OpenFileDialog();
|
||||||
ofd.Filter = ResourceHelper.GetMessage("FilterRom");
|
ofd.Filter = ResourceHelper.GetMessage("FilterRom");
|
||||||
if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
if(ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
||||||
_gameHash = MD5Helper.GetMD5Hash(ofd.FileName);
|
LoadGame(ofd.FileName);
|
||||||
if(_gameHash != null) {
|
|
||||||
txtGameName.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue