Hex Editor - fix Load .tbl file menu item when rom is in an archive

This commit is contained in:
adelikat 2015-02-22 03:36:54 +00:00
parent f3c29e5bc2
commit 2bc68b99c7
1 changed files with 16 additions and 5 deletions

View File

@ -1198,17 +1198,28 @@ namespace BizHawk.Client.EmuHawk
private void LoadTableFileMenuItem_Click(object sender, EventArgs e)
{
string romName;
string intialDirectory;
if (Global.Config.RecentRoms.MostRecent.Contains('|'))
{
romName = Global.Config.RecentRoms.MostRecent.Split('|').Last();
intialDirectory = Global.Config.RecentRoms.MostRecent.Split('|').First();
}
else
{
romName = Global.Config.RecentRoms.MostRecent;
intialDirectory = Path.GetDirectoryName(PathManager.MakeAbsolutePath(romName, null));
}
var ofd = new OpenFileDialog
{
FileName = Path.GetFileNameWithoutExtension(Global.Config.RecentRoms.MostRecent) + ".tbl",
InitialDirectory = Path.GetDirectoryName(PathManager.MakeAbsolutePath(Global.Config.RecentRoms.MostRecent, null)),
FileName = Path.GetFileNameWithoutExtension(romName) + ".tbl",
InitialDirectory = intialDirectory,
Filter = "Text Table files (*.tbl)|*.tbl|All Files|*.*",
RestoreDirectory = false
};
GlobalWin.Sound.StopSound();
var result = ofd.ShowDialog();
GlobalWin.Sound.StartSound();
var result = ofd.ShowHawkDialog();
if (result == DialogResult.OK)
{