2015-12-27 22:05:45 -05:00
|
|
|
|
using System;
|
2016-02-19 13:05:04 -05:00
|
|
|
|
using Mesen.GUI.Forms;
|
2015-12-27 22:05:45 -05:00
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Config
|
|
|
|
|
{
|
|
|
|
|
public class PreferenceInfo
|
|
|
|
|
{
|
2016-02-19 13:05:04 -05:00
|
|
|
|
public Language DisplayLanguage = Language.SystemDefault;
|
|
|
|
|
|
2015-12-27 22:05:45 -05:00
|
|
|
|
public bool SingleInstance = true;
|
2016-01-31 13:53:17 -05:00
|
|
|
|
public bool PauseWhenInBackground = false;
|
|
|
|
|
public bool AllowBackgroundInput = false;
|
2015-12-27 22:05:45 -05:00
|
|
|
|
public bool AutoLoadIpsPatches = true;
|
2016-01-14 19:52:28 -05:00
|
|
|
|
public bool AllowInvalidInput = false;
|
2016-01-14 22:20:50 -05:00
|
|
|
|
public bool RemoveSpriteLimit = false;
|
2016-01-31 14:03:12 -05:00
|
|
|
|
|
2017-04-15 15:47:50 -04:00
|
|
|
|
public bool DisplayMovieIcons = false;
|
|
|
|
|
public bool HidePauseOverlay = false;
|
|
|
|
|
|
2016-08-31 20:54:38 -04:00
|
|
|
|
public bool AutoSave = true;
|
|
|
|
|
public Int32 AutoSaveDelay = 5;
|
|
|
|
|
public bool AutoSaveNotify = false;
|
|
|
|
|
|
2016-01-28 20:47:16 -05:00
|
|
|
|
public bool FdsAutoLoadDisk = true;
|
|
|
|
|
public bool FdsFastForwardOnLoad = false;
|
2015-12-27 22:05:45 -05:00
|
|
|
|
|
2016-01-31 14:03:12 -05:00
|
|
|
|
public bool AssociateNesFiles = false;
|
|
|
|
|
public bool AssociateFdsFiles = false;
|
|
|
|
|
public bool AssociateMmoFiles = false;
|
|
|
|
|
public bool AssociateMstFiles = false;
|
2016-06-25 20:46:54 -04:00
|
|
|
|
public bool AssociateNsfFiles = false;
|
|
|
|
|
public bool AssociateNsfeFiles = false;
|
2016-08-14 20:12:50 -04:00
|
|
|
|
public bool AssociateUnfFiles = false;
|
2016-06-25 20:46:54 -04:00
|
|
|
|
|
|
|
|
|
public bool NsfDisableApuIrqs = true;
|
|
|
|
|
public bool NsfMoveToNextTrackAfterTime = true;
|
|
|
|
|
public Int32 NsfMoveToNextTrackTime = 120;
|
|
|
|
|
public bool NsfAutoDetectSilence = true;
|
|
|
|
|
public Int32 NsfAutoDetectSilenceDelay = 3000;
|
2016-01-31 14:03:12 -05:00
|
|
|
|
|
2016-01-31 14:28:31 -05:00
|
|
|
|
public bool PauseOnMovieEnd = true;
|
2016-02-08 23:23:31 -05:00
|
|
|
|
public bool AutomaticallyCheckForUpdates = true;
|
2016-01-31 14:28:31 -05:00
|
|
|
|
|
2016-05-22 14:43:07 -04:00
|
|
|
|
public bool CloudSaveIntegration = false;
|
|
|
|
|
public DateTime CloudLastSync = DateTime.MinValue;
|
|
|
|
|
|
2016-09-02 19:36:37 -04:00
|
|
|
|
public EmulatorKeyMappings? EmulatorKeySet1;
|
|
|
|
|
public EmulatorKeyMappings? EmulatorKeySet2;
|
|
|
|
|
|
2016-06-15 21:59:34 -04:00
|
|
|
|
public bool DisableGameDatabase = false;
|
|
|
|
|
|
2015-12-27 22:05:45 -05:00
|
|
|
|
public PreferenceInfo()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-02 19:36:37 -04:00
|
|
|
|
public void InitializeDefaults()
|
|
|
|
|
{
|
|
|
|
|
if(EmulatorKeySet1 == null) {
|
|
|
|
|
EmulatorKeySet1 = new EmulatorKeyMappings() {
|
|
|
|
|
FastForward = InteropEmu.GetKeyCode("Tab")
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(EmulatorKeySet2 == null) {
|
|
|
|
|
EmulatorKeySet2 = new EmulatorKeyMappings() {
|
|
|
|
|
FastForward = InteropEmu.GetKeyCode("Pad1 R2")
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-31 14:03:12 -05:00
|
|
|
|
static public void ApplyConfig()
|
|
|
|
|
{
|
|
|
|
|
PreferenceInfo preferenceInfo = ConfigManager.Config.PreferenceInfo;
|
|
|
|
|
|
2016-12-13 20:05:42 -05:00
|
|
|
|
if(Program.IsMono) {
|
|
|
|
|
FileAssociationHelper.ConfigureLinuxMimeTypes();
|
|
|
|
|
} else {
|
|
|
|
|
FileAssociationHelper.UpdateFileAssociation("nes", preferenceInfo.AssociateNesFiles);
|
|
|
|
|
FileAssociationHelper.UpdateFileAssociation("fds", preferenceInfo.AssociateFdsFiles);
|
|
|
|
|
FileAssociationHelper.UpdateFileAssociation("mmo", preferenceInfo.AssociateMmoFiles);
|
|
|
|
|
FileAssociationHelper.UpdateFileAssociation("mst", preferenceInfo.AssociateMstFiles);
|
|
|
|
|
FileAssociationHelper.UpdateFileAssociation("nsf", preferenceInfo.AssociateNsfFiles);
|
|
|
|
|
FileAssociationHelper.UpdateFileAssociation("nsfe", preferenceInfo.AssociateNsfeFiles);
|
|
|
|
|
FileAssociationHelper.UpdateFileAssociation("unf", preferenceInfo.AssociateUnfFiles);
|
|
|
|
|
}
|
2016-01-06 23:10:29 -05:00
|
|
|
|
|
2016-01-14 19:52:28 -05:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.AllowInvalidInput, preferenceInfo.AllowInvalidInput);
|
2016-01-14 22:20:50 -05:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.RemoveSpriteLimit, preferenceInfo.RemoveSpriteLimit);
|
2016-01-28 20:47:16 -05:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.FdsAutoLoadDisk, preferenceInfo.FdsAutoLoadDisk);
|
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.FdsFastForwardOnLoad, preferenceInfo.FdsFastForwardOnLoad);
|
2016-01-31 14:28:31 -05:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.PauseOnMovieEnd, preferenceInfo.PauseOnMovieEnd);
|
2016-01-31 13:53:17 -05:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.AllowBackgroundInput, preferenceInfo.AllowBackgroundInput);
|
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.PauseWhenInBackground, preferenceInfo.PauseWhenInBackground);
|
2016-06-15 21:59:34 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.DisableGameDatabase, preferenceInfo.DisableGameDatabase);
|
2016-06-25 20:46:54 -04:00
|
|
|
|
|
2017-04-15 15:47:50 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.HidePauseOverlay, preferenceInfo.HidePauseOverlay);
|
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.DisplayMovieIcons, preferenceInfo.DisplayMovieIcons);
|
|
|
|
|
|
2016-06-25 20:46:54 -04:00
|
|
|
|
InteropEmu.NsfSetNsfConfig(preferenceInfo.NsfAutoDetectSilence ? preferenceInfo.NsfAutoDetectSilenceDelay : 0, preferenceInfo.NsfMoveToNextTrackAfterTime ? preferenceInfo.NsfMoveToNextTrackTime : -1, preferenceInfo.NsfDisableApuIrqs);
|
2016-08-31 20:54:38 -04:00
|
|
|
|
InteropEmu.SetAutoSaveOptions(preferenceInfo.AutoSave ? (uint)preferenceInfo.AutoSaveDelay : 0, preferenceInfo.AutoSaveNotify);
|
2016-09-02 19:36:37 -04:00
|
|
|
|
InteropEmu.SetEmulatorKeys(new EmulatorKeyMappingSet() { KeySet1 = preferenceInfo.EmulatorKeySet1.Value, KeySet2 = preferenceInfo.EmulatorKeySet2.Value });
|
2015-12-27 22:05:45 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|