Advanced loader - if magic folder necessary for the feature to work doesn't exist, create it. Allow drag and drop of dll files on the Current Core box

This commit is contained in:
adelikat 2017-05-04 17:54:21 -05:00
parent 286d03a359
commit 2b625e9c53
3 changed files with 32 additions and 3 deletions

View File

@ -1316,6 +1316,10 @@ namespace BizHawk.Client.EmuHawk
else
{
ofd.InitialDirectory = PathManager.GetPathType("Libretro", "Cores");
if (!Directory.Exists(ofd.InitialDirectory))
{
Directory.CreateDirectory(ofd.InitialDirectory);
}
}
ofd.RestoreDirectory = true;

View File

@ -97,11 +97,14 @@
//
// txtLibretroCore
//
this.txtLibretroCore.AllowDrop = true;
this.txtLibretroCore.Location = new System.Drawing.Point(81, 23);
this.txtLibretroCore.Name = "txtLibretroCore";
this.txtLibretroCore.ReadOnly = true;
this.txtLibretroCore.Size = new System.Drawing.Size(314, 20);
this.txtLibretroCore.TabIndex = 6;
this.txtLibretroCore.DragDrop += new System.Windows.Forms.DragEventHandler(this.txtLibretroCore_DragDrop);
this.txtLibretroCore.DragEnter += new System.Windows.Forms.DragEventHandler(this.txtLibretroCore_DragEnter);
//
// btnLibretroLaunchGame
//

View File

@ -130,22 +130,44 @@ namespace BizHawk.Client.EmuHawk
SuggestedExtensionFilter = filter;
Result = Command.RetroLaunchGame;
DialogResult = System.Windows.Forms.DialogResult.OK;
DialogResult = DialogResult.OK;
Close();
}
private void btnClassicLaunchGame_Click(object sender, EventArgs e)
{
Result = Command.ClassicLaunchGame;
DialogResult = System.Windows.Forms.DialogResult.OK;
DialogResult = DialogResult.OK;
Close();
}
private void btnLibretroLaunchNoGame_Click(object sender, EventArgs e)
{
Result = Command.RetroLaunchNoGame;
DialogResult = System.Windows.Forms.DialogResult.OK;
DialogResult = DialogResult.OK;
Close();
}
private void txtLibretroCore_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
if (Path.GetExtension(filePaths[0]).ToUpper() == ".DLL")
{
e.Effect = DragDropEffects.Copy;
return;
}
}
e.Effect = DragDropEffects.None;
}
private void txtLibretroCore_DragDrop(object sender, DragEventArgs e)
{
var filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);
Global.Config.LibretroCore = filePaths[0];
RefreshLibretroCore(false);
}
}
}