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;
|
2017-04-22 16:54:45 -04:00
|
|
|
|
public bool AutoHideMenu = false;
|
|
|
|
|
public bool DisplayTitleBarInfo = false;
|
2017-04-15 15:47:50 -04:00
|
|
|
|
|
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;
|
2017-05-04 22:55:46 -04:00
|
|
|
|
public bool FdsAutoInsertDisk = 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;
|
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;
|
2017-08-13 10:51:13 -04:00
|
|
|
|
public bool NsfRepeat = false;
|
|
|
|
|
public bool NsfShuffle = false;
|
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;
|
2017-07-23 14:11:59 -04:00
|
|
|
|
public bool DisableOsd = false;
|
2016-06-15 21:59:34 -04:00
|
|
|
|
|
2017-05-13 15:43:02 -04:00
|
|
|
|
public bool ShowFrameCounter = false;
|
|
|
|
|
public bool ShowGameTimer = false;
|
2017-05-22 20:14:02 -04:00
|
|
|
|
public bool ShowVsConfigOnLoad = false;
|
2017-05-13 15:43:02 -04:00
|
|
|
|
|
2017-07-25 22:43:39 -04:00
|
|
|
|
public bool DisableGameSelectionScreen = false;
|
|
|
|
|
public bool GameSelectionScreenResetGame = false;
|
|
|
|
|
|
2017-08-12 18:58:38 -04:00
|
|
|
|
public bool ConfirmExitResetPower = false;
|
|
|
|
|
|
2017-04-28 19:54:58 -04:00
|
|
|
|
public UInt32 RewindBufferSize = 300;
|
|
|
|
|
|
2017-08-11 22:20:07 -04:00
|
|
|
|
public bool OverrideAviFolder = false;
|
|
|
|
|
public bool OverrideMovieFolder = false;
|
|
|
|
|
public bool OverrideSaveDataFolder = false;
|
|
|
|
|
public bool OverrideSaveStateFolder = false;
|
|
|
|
|
public bool OverrideScreenshotFolder = false;
|
|
|
|
|
public bool OverrideWaveFolder = false;
|
|
|
|
|
|
|
|
|
|
public string AviFolder = "";
|
|
|
|
|
public string MovieFolder = "";
|
|
|
|
|
public string SaveDataFolder = "";
|
|
|
|
|
public string SaveStateFolder = "";
|
|
|
|
|
public string ScreenshotFolder = "";
|
|
|
|
|
public string WaveFolder = "";
|
|
|
|
|
|
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() {
|
2017-04-29 08:29:47 -04:00
|
|
|
|
FastForward = InteropEmu.GetKeyCode("Tab"),
|
|
|
|
|
Rewind = InteropEmu.GetKeyCode("Backspace")
|
2016-09-02 19:36:37 -04:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(EmulatorKeySet2 == null) {
|
|
|
|
|
EmulatorKeySet2 = new EmulatorKeyMappings() {
|
2017-04-29 08:29:47 -04:00
|
|
|
|
FastForward = InteropEmu.GetKeyCode("Pad1 R2"),
|
|
|
|
|
Rewind = InteropEmu.GetKeyCode("Pad1 L2")
|
2016-09-02 19:36:37 -04:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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("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);
|
2017-05-04 22:55:46 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.FdsAutoInsertDisk, preferenceInfo.FdsAutoInsertDisk);
|
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);
|
2017-07-23 14:11:59 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.DisableOsd, preferenceInfo.DisableOsd);
|
2016-06-25 20:46:54 -04:00
|
|
|
|
|
2017-05-13 15:43:02 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.ShowFrameCounter, preferenceInfo.ShowFrameCounter);
|
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.ShowGameTimer, preferenceInfo.ShowGameTimer);
|
|
|
|
|
|
2017-04-15 15:47:50 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.HidePauseOverlay, preferenceInfo.HidePauseOverlay);
|
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.DisplayMovieIcons, preferenceInfo.DisplayMovieIcons);
|
2017-07-25 22:43:39 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.DisableGameSelectionScreen, preferenceInfo.DisableGameSelectionScreen);
|
2017-08-12 18:58:38 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.ConfirmExitResetPower, preferenceInfo.ConfirmExitResetPower);
|
2017-04-15 15:47:50 -04:00
|
|
|
|
|
2016-06-25 20:46:54 -04:00
|
|
|
|
InteropEmu.NsfSetNsfConfig(preferenceInfo.NsfAutoDetectSilence ? preferenceInfo.NsfAutoDetectSilenceDelay : 0, preferenceInfo.NsfMoveToNextTrackAfterTime ? preferenceInfo.NsfMoveToNextTrackTime : -1, preferenceInfo.NsfDisableApuIrqs);
|
2017-08-13 10:51:13 -04:00
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.NsfRepeat, preferenceInfo.NsfRepeat);
|
|
|
|
|
InteropEmu.SetFlag(EmulationFlags.NsfShuffle, preferenceInfo.NsfShuffle);
|
|
|
|
|
|
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 });
|
2017-04-28 19:54:58 -04:00
|
|
|
|
|
|
|
|
|
InteropEmu.SetRewindBufferSize(preferenceInfo.RewindBufferSize);
|
2017-08-11 22:20:07 -04:00
|
|
|
|
|
|
|
|
|
InteropEmu.SetFolderOverrides(ConfigManager.SaveFolder, ConfigManager.SaveStateFolder, ConfigManager.ScreenshotFolder);
|
2015-12-27 22:05:45 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|