2014-06-04 19:18:14 +00:00
using System ;
using System.Drawing ;
using System.Windows.Forms ;
2014-07-15 01:09:36 +00:00
2014-06-04 22:14:58 +00:00
using BizHawk.Client.Common ;
2014-07-15 01:09:36 +00:00
using BizHawk.Emulation.Common ;
2014-06-04 19:18:14 +00:00
2014-07-02 14:27:12 +00:00
using BizHawk.Emulation.Cores.Nintendo.N64 ;
2014-07-02 23:28:36 +00:00
using BizHawk.Emulation.Cores.Nintendo.SNES ;
2014-07-03 03:44:14 +00:00
using BizHawk.Emulation.Cores.Sega.Saturn ;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx ;
using BizHawk.Emulation.Cores.Sega.MasterSystem ;
using BizHawk.Emulation.Cores.ColecoVision ;
using BizHawk.Emulation.Cores.Atari.Atari2600 ;
2014-07-02 14:27:12 +00:00
2014-06-04 19:18:14 +00:00
namespace BizHawk.Client.EmuHawk
{
public partial class ProfileConfig : Form
{
public ProfileConfig ( )
{
InitializeComponent ( ) ;
}
private void ProfileConfig_Load ( object sender , EventArgs e )
{
2014-07-15 00:05:18 +00:00
if ( ! VersionInfo . DeveloperBuild )
2014-06-04 22:14:58 +00:00
{
2014-07-15 00:05:18 +00:00
ProfileSelectComboBox . Items . Remove ( "Custom Profile" ) ;
2014-06-04 22:14:58 +00:00
}
2014-07-15 00:50:42 +00:00
switch ( Global . Config . SelectedProfile )
{
default :
case Config . ClientProfile . Custom : // For now
case Config . ClientProfile . Casual :
ProfileSelectComboBox . SelectedItem = "Casual Gaming" ;
break ;
case Config . ClientProfile . Longplay :
ProfileSelectComboBox . SelectedItem = "Longplays" ;
break ;
case Config . ClientProfile . Tas :
ProfileSelectComboBox . SelectedItem = "Tool-assisted Speedruns" ;
break ;
2014-09-13 01:21:55 +00:00
case Config . ClientProfile . N64Tas :
ProfileSelectComboBox . SelectedItem = "N64 Tool-assisted Speedruns" ;
break ;
2014-07-15 00:50:42 +00:00
}
2015-01-04 17:54:13 +00:00
AutoCheckForUpdates . Checked = Global . Config . Update_AutoCheckEnabled ;
2014-06-04 19:18:14 +00:00
}
2014-07-15 00:05:18 +00:00
private void OkBtn_Click ( object sender , EventArgs e )
2014-06-04 20:15:33 +00:00
{
2015-01-04 18:07:54 +00:00
switch ( ProfileSelectComboBox . SelectedItem . ToString ( ) )
{
default :
case "Custom Profile" : // For now
case "Casual Gaming" :
Global . Config . SelectedProfile = Config . ClientProfile . Casual ;
break ;
case "Longplays" :
Global . Config . SelectedProfile = Config . ClientProfile . Longplay ;
break ;
case "Tool-assisted Speedruns" :
Global . Config . SelectedProfile = Config . ClientProfile . Tas ;
break ;
case "N64 Tool-assisted Speedruns" :
Global . Config . SelectedProfile = Config . ClientProfile . N64Tas ;
break ;
}
if ( Global . Config . SelectedProfile = = Config . ClientProfile . Casual )
2014-06-04 22:14:58 +00:00
{
DisplayProfileSettingBoxes ( false ) ;
2015-02-23 23:43:51 +00:00
Global . Config . NoLowResLargeScreenshotWithStates = false ;
2014-06-04 22:14:58 +00:00
Global . Config . SaveScreenshotWithStates = false ;
Global . Config . AllowUD_LR = false ;
2014-07-02 21:20:45 +00:00
Global . Config . BackupSavestates = false ;
2015-01-25 13:00:01 +00:00
Global . Config . SaveStateCompressionLevelNormal = 0 ;
2014-07-02 21:20:45 +00:00
Global . Config . RewindEnabledLarge = false ;
Global . Config . RewindEnabledMedium = false ;
Global . Config . RewindEnabledSmall = true ;
2014-09-13 01:21:55 +00:00
Global . Config . SkipLagFrame = false ;
2014-07-02 21:20:45 +00:00
// N64
2014-07-14 19:56:52 +00:00
var n64Settings = GetSyncSettings < N64 , N64SyncSettings > ( ) ;
2014-07-20 16:59:03 +00:00
n64Settings . Rsp = N64SyncSettings . RspType . Rsp_Hle ;
n64Settings . Core = N64SyncSettings . CoreType . Dynarec ;
2014-07-02 21:20:45 +00:00
Global . Config . N64UseCircularAnalogConstraint = true ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < N64 > ( n64Settings ) ;
2014-07-02 21:20:45 +00:00
2014-07-02 23:28:36 +00:00
// SNES
2014-07-14 19:56:52 +00:00
var snesSettings = GetSyncSettings < LibsnesCore , LibsnesCore . SnesSyncSettings > ( ) ;
2014-07-02 23:28:36 +00:00
snesSettings . Profile = "Performance" ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < LibsnesCore > ( snesSettings ) ;
2014-07-02 23:28:36 +00:00
2014-07-03 03:44:14 +00:00
//Saturn
2014-07-14 19:56:52 +00:00
var saturnSettings = GetSyncSettings < Yabause , Yabause . SaturnSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
saturnSettings . SkipBios = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < Yabause > ( saturnSettings ) ;
2014-07-03 03:44:14 +00:00
//Genesis
2014-07-14 19:56:52 +00:00
var genesisSettings = GetSyncSettings < GPGX , GPGX . GPGXSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
genesisSettings . Region = LibGPGX . Region . Autodetect ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < GPGX > ( genesisSettings ) ;
2014-07-03 03:44:14 +00:00
//SMS
2014-07-14 19:56:52 +00:00
var smsSettings = GetSyncSettings < SMS , SMS . SMSSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
smsSettings . UseBIOS = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < SMS > ( smsSettings ) ;
2014-07-03 03:44:14 +00:00
//Coleco
2014-07-14 19:56:52 +00:00
var colecoSettings = GetSyncSettings < ColecoVision , ColecoVision . ColecoSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
colecoSettings . SkipBiosIntro = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < ColecoVision > ( colecoSettings ) ;
2014-07-03 03:44:14 +00:00
//A2600
2014-07-14 19:56:52 +00:00
var a2600Settings = GetSyncSettings < Atari2600 , Atari2600 . A2600SyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
a2600Settings . FastScBios = true ;
a2600Settings . LeftDifficulty = false ;
a2600Settings . RightDifficulty = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < Atari2600 > ( a2600Settings ) ;
2014-07-03 11:43:06 +00:00
// NES
Global . Config . NES_InQuickNES = true ;
2014-06-04 22:14:58 +00:00
}
2015-01-04 18:07:54 +00:00
else if ( Global . Config . SelectedProfile = = Config . ClientProfile . Longplay )
2014-06-04 22:14:58 +00:00
{
DisplayProfileSettingBoxes ( false ) ;
2015-02-23 23:43:51 +00:00
Global . Config . NoLowResLargeScreenshotWithStates = false ;
2014-06-04 22:14:58 +00:00
Global . Config . SaveScreenshotWithStates = false ;
Global . Config . AllowUD_LR = false ;
2014-07-03 03:44:14 +00:00
Global . Config . BackupSavestates = false ;
2014-09-13 01:21:55 +00:00
Global . Config . SkipLagFrame = false ;
2014-10-09 20:40:33 +00:00
Global . Config . SaveStateCompressionLevelNormal = 5 ;
2014-07-02 21:20:45 +00:00
Global . Config . RewindEnabledLarge = false ;
Global . Config . RewindEnabledMedium = false ;
Global . Config . RewindEnabledSmall = true ;
// N64
2014-07-14 19:56:52 +00:00
var n64Settings = GetSyncSettings < N64 , N64SyncSettings > ( ) ;
2014-07-20 16:59:03 +00:00
n64Settings . Rsp = N64SyncSettings . RspType . Rsp_Z64_hlevideo ;
n64Settings . Core = N64SyncSettings . CoreType . Pure_Interpret ;
2014-07-02 21:20:45 +00:00
Global . Config . N64UseCircularAnalogConstraint = true ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < N64 > ( n64Settings ) ;
2014-07-02 23:28:36 +00:00
// SNES
2014-07-14 19:56:52 +00:00
var snesSettings = GetSyncSettings < LibsnesCore , LibsnesCore . SnesSyncSettings > ( ) ;
2014-07-02 23:28:36 +00:00
snesSettings . Profile = "Compatibility" ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < LibsnesCore > ( snesSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// Saturn
2014-07-14 19:56:52 +00:00
var saturnSettings = GetSyncSettings < Yabause , Yabause . SaturnSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
saturnSettings . SkipBios = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < Yabause > ( saturnSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// Genesis
2014-07-14 19:56:52 +00:00
var genesisSettings = GetSyncSettings < GPGX , GPGX . GPGXSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
genesisSettings . Region = LibGPGX . Region . Autodetect ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < GPGX > ( genesisSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// SMS
2014-07-14 19:56:52 +00:00
var smsSettings = GetSyncSettings < SMS , SMS . SMSSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
smsSettings . UseBIOS = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < SMS > ( smsSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// Coleco
2014-07-14 19:56:52 +00:00
var colecoSettings = GetSyncSettings < ColecoVision , ColecoVision . ColecoSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
colecoSettings . SkipBiosIntro = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < ColecoVision > ( colecoSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// A2600
2014-07-14 19:56:52 +00:00
var a2600Settings = GetSyncSettings < Atari2600 , Atari2600 . A2600SyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
a2600Settings . FastScBios = false ;
a2600Settings . LeftDifficulty = true ;
a2600Settings . RightDifficulty = true ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < Atari2600 > ( a2600Settings ) ;
2014-07-03 11:43:06 +00:00
// NES
Global . Config . NES_InQuickNES = true ;
2014-07-02 21:20:45 +00:00
}
2015-01-04 18:07:54 +00:00
else if ( Global . Config . SelectedProfile = = Config . ClientProfile . Tas )
2014-07-02 21:20:45 +00:00
{
DisplayProfileSettingBoxes ( false ) ;
// General
2015-02-23 23:43:51 +00:00
Global . Config . NoLowResLargeScreenshotWithStates = false ;
2014-07-02 21:20:45 +00:00
Global . Config . SaveScreenshotWithStates = true ;
Global . Config . AllowUD_LR = true ;
Global . Config . BackupSavestates = true ;
2014-09-13 01:21:55 +00:00
Global . Config . SkipLagFrame = false ;
2014-10-09 20:40:33 +00:00
Global . Config . SaveStateCompressionLevelNormal = 5 ;
2014-09-13 01:21:55 +00:00
// Rewind
Global . Config . RewindEnabledLarge = false ;
Global . Config . RewindEnabledMedium = false ;
Global . Config . RewindEnabledSmall = false ;
// N64
var n64Settings = GetSyncSettings < N64 , N64SyncSettings > ( ) ;
n64Settings . Rsp = N64SyncSettings . RspType . Rsp_Z64_hlevideo ;
n64Settings . Core = N64SyncSettings . CoreType . Pure_Interpret ;
Global . Config . N64UseCircularAnalogConstraint = false ;
PutSyncSettings < N64 > ( n64Settings ) ;
// SNES
var snesSettings = GetSyncSettings < LibsnesCore , LibsnesCore . SnesSyncSettings > ( ) ;
snesSettings . Profile = "Compatibility" ;
PutSyncSettings < LibsnesCore > ( snesSettings ) ;
// Saturn
var saturnSettings = GetSyncSettings < Yabause , Yabause . SaturnSyncSettings > ( ) ;
saturnSettings . SkipBios = true ;
PutSyncSettings < Yabause > ( saturnSettings ) ;
// Genesis
var genesisSettings = GetSyncSettings < GPGX , GPGX . GPGXSyncSettings > ( ) ;
genesisSettings . Region = LibGPGX . Region . Autodetect ;
PutSyncSettings < GPGX > ( genesisSettings ) ;
// SMS
var smsSettings = GetSyncSettings < SMS , SMS . SMSSyncSettings > ( ) ;
smsSettings . UseBIOS = false ;
PutSyncSettings < SMS > ( smsSettings ) ;
// Coleco
var colecoSettings = GetSyncSettings < ColecoVision , ColecoVision . ColecoSyncSettings > ( ) ;
colecoSettings . SkipBiosIntro = true ;
PutSyncSettings < ColecoVision > ( colecoSettings ) ;
// A2600
var a2600Settings = GetSyncSettings < Atari2600 , Atari2600 . A2600SyncSettings > ( ) ;
a2600Settings . FastScBios = false ;
a2600Settings . LeftDifficulty = true ;
a2600Settings . RightDifficulty = true ;
PutSyncSettings < Atari2600 > ( a2600Settings ) ;
// NES
Global . Config . NES_InQuickNES = true ;
}
2015-01-04 18:07:54 +00:00
else if ( Global . Config . SelectedProfile = = Config . ClientProfile . N64Tas )
2014-09-13 01:21:55 +00:00
{
DisplayProfileSettingBoxes ( false ) ;
// General
2015-02-23 23:43:51 +00:00
Global . Config . NoLowResLargeScreenshotWithStates = false ;
2014-09-13 01:21:55 +00:00
Global . Config . SaveScreenshotWithStates = true ;
Global . Config . AllowUD_LR = true ;
2014-10-09 21:11:32 +00:00
Global . Config . BackupSavestates = false ;
2014-09-13 01:21:55 +00:00
Global . Config . SkipLagFrame = true ;
2014-10-09 20:40:33 +00:00
Global . Config . SaveStateCompressionLevelNormal = 0 ;
2014-07-02 21:20:45 +00:00
// Rewind
Global . Config . RewindEnabledLarge = false ;
Global . Config . RewindEnabledMedium = false ;
Global . Config . RewindEnabledSmall = false ;
// N64
2014-07-14 19:56:52 +00:00
var n64Settings = GetSyncSettings < N64 , N64SyncSettings > ( ) ;
2014-10-09 21:11:32 +00:00
n64Settings . Rsp = N64SyncSettings . RspType . Rsp_Hle ;
2014-07-20 16:59:03 +00:00
n64Settings . Core = N64SyncSettings . CoreType . Pure_Interpret ;
2014-07-02 21:20:45 +00:00
Global . Config . N64UseCircularAnalogConstraint = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < N64 > ( n64Settings ) ;
2014-07-02 23:28:36 +00:00
// SNES
2014-07-14 19:56:52 +00:00
var snesSettings = GetSyncSettings < LibsnesCore , LibsnesCore . SnesSyncSettings > ( ) ;
2014-07-02 23:28:36 +00:00
snesSettings . Profile = "Compatibility" ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < LibsnesCore > ( snesSettings ) ;
2014-07-02 23:28:36 +00:00
2014-07-03 11:43:06 +00:00
// Saturn
2014-07-14 19:56:52 +00:00
var saturnSettings = GetSyncSettings < Yabause , Yabause . SaturnSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
saturnSettings . SkipBios = true ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < Yabause > ( saturnSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// Genesis
2014-07-14 19:56:52 +00:00
var genesisSettings = GetSyncSettings < GPGX , GPGX . GPGXSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
genesisSettings . Region = LibGPGX . Region . Autodetect ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < GPGX > ( genesisSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// SMS
2014-07-14 19:56:52 +00:00
var smsSettings = GetSyncSettings < SMS , SMS . SMSSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
smsSettings . UseBIOS = false ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < SMS > ( smsSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// Coleco
2014-07-14 19:56:52 +00:00
var colecoSettings = GetSyncSettings < ColecoVision , ColecoVision . ColecoSyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
colecoSettings . SkipBiosIntro = true ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < ColecoVision > ( colecoSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// A2600
2014-07-14 19:56:52 +00:00
var a2600Settings = GetSyncSettings < Atari2600 , Atari2600 . A2600SyncSettings > ( ) ;
2014-07-03 03:44:14 +00:00
a2600Settings . FastScBios = false ;
a2600Settings . LeftDifficulty = true ;
a2600Settings . RightDifficulty = true ;
2014-07-14 19:56:52 +00:00
PutSyncSettings < Atari2600 > ( a2600Settings ) ;
2014-07-03 11:43:06 +00:00
// NES
Global . Config . NES_InQuickNES = true ;
2014-06-04 22:14:58 +00:00
}
2015-01-04 18:07:54 +00:00
else if ( Global . Config . SelectedProfile = = Config . ClientProfile . Custom )
2014-06-04 22:14:58 +00:00
{
2014-07-02 23:28:36 +00:00
//Disabled for now
//DisplayProfileSettingBoxes(true);
2014-06-04 22:14:58 +00:00
}
2014-07-15 00:05:18 +00:00
2015-01-04 17:54:13 +00:00
bool oldUpdateAutoCheckEnabled = Global . Config . Update_AutoCheckEnabled ;
Global . Config . Update_AutoCheckEnabled = AutoCheckForUpdates . Checked ;
if ( Global . Config . Update_AutoCheckEnabled ! = oldUpdateAutoCheckEnabled )
{
if ( ! Global . Config . Update_AutoCheckEnabled ) UpdateChecker . ResetHistory ( ) ;
UpdateChecker . BeginCheck ( ) ; // Call even if auto checking is disabled to trigger event (it won't actually check)
}
2014-07-15 00:05:18 +00:00
DialogResult = DialogResult . OK ;
Close ( ) ;
}
private void CancelBtn_Click ( object sender , EventArgs e )
{
DialogResult = DialogResult . Cancel ;
Close ( ) ;
2014-06-04 20:15:33 +00:00
}
2014-06-04 22:14:58 +00:00
private void DisplayProfileSettingBoxes ( bool cProfile )
2014-06-04 20:15:33 +00:00
{
2014-07-15 01:09:36 +00:00
if ( cProfile )
2014-06-04 20:15:33 +00:00
{
2014-06-29 02:28:48 +00:00
ProfileDialogHelpTexBox . Location = new Point ( 217 , 12 ) ;
ProfileDialogHelpTexBox . Size = new Size ( 165 , 126 ) ;
2014-06-04 22:14:58 +00:00
SaveScreenshotStatesCheckBox . Visible = true ;
SaveLargeScreenshotStatesCheckBox . Visible = true ;
AllowUDLRCheckBox . Visible = true ;
2015-01-04 17:54:13 +00:00
CustomProfileOptionsLabel . Visible = true ;
2014-06-04 20:15:33 +00:00
}
2014-07-15 01:09:36 +00:00
else
2014-06-04 20:15:33 +00:00
{
2014-06-29 02:28:48 +00:00
ProfileDialogHelpTexBox . Location = new Point ( 184 , 12 ) ;
ProfileDialogHelpTexBox . Size = new Size ( 198 , 126 ) ;
2014-06-04 22:14:58 +00:00
ProfileDialogHelpTexBox . Text = "Options: \r\nCasual Gaming - All about performance! \r\n\nTool-Assisted Speedruns - Maximum Accuracy! \r\n\nLongplays - Stability is the key!" ;
SaveScreenshotStatesCheckBox . Visible = false ;
SaveLargeScreenshotStatesCheckBox . Visible = false ;
AllowUDLRCheckBox . Visible = false ;
2015-01-04 17:54:13 +00:00
CustomProfileOptionsLabel . Visible = false ;
2014-06-04 20:15:33 +00:00
}
}
2014-06-04 22:14:58 +00:00
private void SaveScreenshotStatesCheckBox_MouseHover ( object sender , EventArgs e )
{
ProfileDialogHelpTexBox . Text = "Save Screenshot with Savestates: \r\n * Required for TASing \r\n * Not Recommended for \r\n Longplays or Casual Gaming" ;
}
private void SaveLargeScreenshotStatesCheckBox_MouseHover ( object sender , EventArgs e )
{
ProfileDialogHelpTexBox . Text = "Save Large Screenshot With States: \r\n * Required for TASing \r\n * Not Recommended for \r\n Longplays or Casual Gaming" ;
}
private void AllowUDLRCheckBox_MouseHover ( object sender , EventArgs e )
{
ProfileDialogHelpTexBox . Text = "All Up+Down or Left+Right: \r\n * Useful for TASing \r\n * Unchecked for Casual Gaming \r\n * Unknown for longplays" ;
}
2014-07-02 14:27:12 +00:00
2014-07-14 19:56:52 +00:00
private static TSetting GetSyncSettings < TEmulator , TSetting > ( )
where TSetting : class , new ( )
2014-07-15 01:09:36 +00:00
where TEmulator : IEmulator
2014-07-14 19:56:52 +00:00
{
// should we complain if we get a successful object from the config file, but it is the wrong type?
2014-10-31 15:46:13 +00:00
object fromcore = null ;
var settable = new SettingsAdapter ( Global . Emulator ) ;
if ( settable . HasSyncSettings )
fromcore = settable . GetSyncSettings ( ) ;
return fromcore as TSetting
2014-07-14 19:56:52 +00:00
? ? Global . Config . GetCoreSyncSettings < TEmulator > ( ) as TSetting
? ? new TSetting ( ) ; // guaranteed to give sensible defaults
}
private static TSetting GetSettings < TEmulator , TSetting > ( )
where TSetting : class , new ( )
2014-07-15 01:09:36 +00:00
where TEmulator : IEmulator
2014-07-14 19:56:52 +00:00
{
// should we complain if we get a successful object from the config file, but it is the wrong type?
2014-10-31 15:46:13 +00:00
object fromcore = null ;
var settable = new SettingsAdapter ( Global . Emulator ) ;
if ( settable . HasSettings )
fromcore = settable . GetSettings ( ) ;
return fromcore as TSetting
2014-07-14 19:56:52 +00:00
? ? Global . Config . GetCoreSettings < TEmulator > ( ) as TSetting
? ? new TSetting ( ) ; // guaranteed to give sensible defaults
}
private static void PutSettings < TEmulator > ( object o )
2014-07-15 01:09:36 +00:00
where TEmulator : IEmulator
2014-07-14 19:56:52 +00:00
{
if ( Global . Emulator is TEmulator )
2014-07-03 03:44:14 +00:00
{
2014-10-31 15:46:13 +00:00
var settable = new SettingsAdapter ( Global . Emulator ) ;
settable . PutSettings ( o ) ;
2014-07-03 03:44:14 +00:00
}
else
{
2014-07-15 01:09:36 +00:00
Global . Config . PutCoreSettings < TEmulator > ( o ) ;
2014-07-03 03:44:14 +00:00
}
}
2014-07-15 01:09:36 +00:00
private static void PutSyncSettings < TEmulator > ( object o )
where TEmulator : IEmulator
2014-07-03 03:44:14 +00:00
{
2014-07-15 01:09:36 +00:00
if ( Global . Emulator is TEmulator )
2014-07-03 03:44:14 +00:00
{
2014-07-15 01:09:36 +00:00
GlobalWin . MainForm . PutCoreSyncSettings ( o ) ;
2014-07-03 03:44:14 +00:00
}
else
{
2014-07-15 01:09:36 +00:00
Global . Config . PutCoreSyncSettings < TEmulator > ( o ) ;
2014-07-03 03:44:14 +00:00
}
}
2014-06-04 19:18:14 +00:00
}
}