UI: Fixed data migration process not properly closing the program after ending (and also not copying files to the right folders)

This commit is contained in:
Sour 2019-06-22 15:32:59 -04:00
parent ede0119073
commit f2401d5bd4
4 changed files with 16 additions and 3 deletions

View file

@ -414,7 +414,7 @@ These options configure which portions of the code is copied into the clipboard
<div></div>
* **Show break notifications**: When enabled, a "notification" will be shown over the disassembly window indicating what caused the debugger to break the execution (e.g: a CPU/PPU read/write, a decayed OAM read, etc.)
* **Show instruction progression**: When enabled, the code window will display an indicator showing how far along into the current instruction the execution is. This also shows an estimate of how many cycles the instruction will take to complete (this estimate may increase for various reasons such as a page being crossed, etc.). `R` is Read, `W` is Write, `X` is execution or PPU rendering read, `DR` is a dummy read, and `DMC` is an APU DMC read
* **Show instruction progression**: When enabled, the code window will display an indicator showing how far along into the current instruction the execution is. This also shows an estimate of how many cycles the instruction will take to complete (this estimate may increase for various reasons such as a page being crossed, etc.). `R` is read, `W` is write, `X` is execution, `DR` is a dummy read, and `DMC` is an APU DMC read
* **Show selection length**: When enabled, the code window will display the current selection's length in bytes (when more than 1 line is selected)
<div></div>

View file

@ -54,7 +54,7 @@ namespace Mesen.GUI.Forms.Config
}
foreach(string subdir in Directory.GetDirectories(source)) {
GetFilesToCopy(subdir, Path.Combine(target, Path.GetDirectoryName(subdir)), sourceFiles, targetFiles);
GetFilesToCopy(subdir, Path.Combine(target, Path.GetFileName(subdir)), sourceFiles, targetFiles);
}
}

View file

@ -15,6 +15,8 @@ namespace Mesen.GUI.Forms.Config
{
public partial class frmPreferences : BaseConfigForm
{
public bool NeedRestart { get; private set; }
public frmPreferences()
{
InitializeComponent();
@ -228,6 +230,10 @@ namespace Mesen.GUI.Forms.Config
string targetFolder = radStorageDocuments.Checked ? ConfigManager.DefaultDocumentsFolder : ConfigManager.DefaultPortableFolder;
if(MesenMsgBox.Show("CopyMesenDataPrompt", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, ConfigManager.HomeFolder, targetFolder) == DialogResult.OK) {
try {
//Save any other changes before copying the data
UpdateObject();
ConfigManager.ApplyChanges();
MigrateData(ConfigManager.HomeFolder, targetFolder);
} catch(Exception ex) {
MesenMsgBox.Show("UnexpectedError", MessageBoxButtons.OK, MessageBoxIcon.Error, ex.ToString());
@ -260,7 +266,7 @@ namespace Mesen.GUI.Forms.Config
ConfigManager.SaveConfig();
ConfigManager.RestartMesen(true);
Application.Exit();
this.NeedRestart = true;
return true;
}

View file

@ -125,6 +125,13 @@ namespace Mesen.GUI.Forms
VsDualOutputOption originalVsDualOutput = ConfigManager.Config.PreferenceInfo.VsDualVideoOutput;
if(frm.ShowDialog(sender, this) == DialogResult.OK) {
if(frm.NeedRestart) {
//Data folder has changed, end process
ConfigManager.DoNotSaveSettings = true;
this.Close();
return;
}
VsDualOutputOption newVsDualOutput = ConfigManager.Config.PreferenceInfo.VsDualVideoOutput;
if(originalVsDualOutput != newVsDualOutput) {
if(newVsDualOutput == VsDualOutputOption.Both || originalVsDualOutput == VsDualOutputOption.Both) {