2014-06-04 19:18:14 +00:00
using System ;
using System.Collections.Generic ;
using System.ComponentModel ;
using System.Data ;
using System.Drawing ;
using System.Linq ;
using System.Text ;
using System.Windows.Forms ;
2014-06-04 22:14:58 +00:00
using BizHawk.Client.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
{
2014-07-02 21:20:45 +00:00
// TODO:
// Save the profile selected to Global.Config (Casual is the default)
// Default the dropdown to the current profile selected instead of empty
// Put save logic in the Ok button click, not the profile selected change event!
2014-06-04 19:18:14 +00:00
public ProfileConfig ( )
{
InitializeComponent ( ) ;
}
private void ProfileConfig_Load ( object sender , EventArgs e )
{
}
private void OkBtn_Click ( object sender , EventArgs e )
{
/* Saving logic goes here */
2014-06-04 22:14:58 +00:00
if ( ProfileSelectComboBox . SelectedIndex = = 3 )
{
//If custom profile, check all the checkboxes
2014-07-02 21:20:45 +00:00
//Save to config.ini
2014-06-04 22:14:58 +00:00
}
2014-07-02 21:20:45 +00:00
2014-06-04 19:18:14 +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 ProfileSelectComboBox_SelectedIndexChanged ( object sender , EventArgs e )
2014-06-04 20:15:33 +00:00
{
2014-06-04 22:14:58 +00:00
if ( ProfileSelectComboBox . SelectedIndex = = 0 ) //Casual Gaming
{
DisplayProfileSettingBoxes ( false ) ;
Global . Config . SaveLargeScreenshotWithStates = false ;
Global . Config . SaveScreenshotWithStates = false ;
Global . Config . AllowUD_LR = false ;
2014-07-02 21:20:45 +00:00
Global . Config . BackupSavestates = false ;
Global . Config . RewindEnabledLarge = false ;
Global . Config . RewindEnabledMedium = false ;
Global . Config . RewindEnabledSmall = true ;
// N64
var n64Settings = GetN64SyncSettings ( ) ;
n64Settings . RspType = N64SyncSettings . RSPTYPE . Rsp_Hle ;
n64Settings . CoreType = N64SyncSettings . CORETYPE . Dynarec ;
Global . Config . N64UseCircularAnalogConstraint = true ;
PutN64SyncSettings ( n64Settings ) ;
2014-07-02 23:28:36 +00:00
// SNES
var snesSettings = GetSnesSyncSettings ( ) ;
snesSettings . Profile = "Performance" ;
PutSnesSyncSettings ( snesSettings ) ;
2014-07-03 03:44:14 +00:00
//Saturn
var saturnSettings = GetSaturnSyncSettings ( ) ;
saturnSettings . SkipBios = false ;
PutSaturnSyncSettings ( saturnSettings ) ;
//Genesis
var genesisSettings = GetGenesisSyncSettings ( ) ;
genesisSettings . Region = LibGPGX . Region . Autodetect ;
PutGenesisSyncSettings ( genesisSettings ) ;
//SMS
var smsSettings = GetSMSSyncSettings ( ) ;
smsSettings . UseBIOS = false ;
PutSMSSyncSettings ( smsSettings ) ;
//Coleco
var colecoSettings = GetColecoVisionSyncSettings ( ) ;
colecoSettings . SkipBiosIntro = false ;
PutColecoVisionSyncSettings ( colecoSettings ) ;
//A2600
var a2600Settings = GetA2600SyncSettings ( ) ;
a2600Settings . FastScBios = true ;
a2600Settings . LeftDifficulty = false ;
a2600Settings . RightDifficulty = false ;
PutA2600SyncSettings ( a2600Settings ) ;
2014-07-03 11:43:06 +00:00
// NES
Global . Config . NES_InQuickNES = true ;
2014-06-04 22:14:58 +00:00
}
else if ( ProfileSelectComboBox . SelectedIndex = = 2 ) //Long Plays
{
DisplayProfileSettingBoxes ( false ) ;
Global . Config . SaveLargeScreenshotWithStates = false ;
Global . Config . SaveScreenshotWithStates = false ;
Global . Config . AllowUD_LR = false ;
2014-07-03 03:44:14 +00:00
Global . Config . BackupSavestates = false ;
2014-07-02 21:20:45 +00:00
Global . Config . RewindEnabledLarge = false ;
Global . Config . RewindEnabledMedium = false ;
Global . Config . RewindEnabledSmall = true ;
// N64
var n64Settings = GetN64SyncSettings ( ) ;
n64Settings . RspType = N64SyncSettings . RSPTYPE . Rsp_Z64_hlevideo ;
n64Settings . CoreType = N64SyncSettings . CORETYPE . Pure_Interpret ;
Global . Config . N64UseCircularAnalogConstraint = true ;
PutN64SyncSettings ( n64Settings ) ;
2014-07-02 23:28:36 +00:00
// SNES
var snesSettings = GetSnesSyncSettings ( ) ;
snesSettings . Profile = "Compatibility" ;
PutSnesSyncSettings ( snesSettings ) ;
2014-07-03 03:44:14 +00:00
2014-07-03 11:43:06 +00:00
// Saturn
2014-07-03 03:44:14 +00:00
var saturnSettings = GetSaturnSyncSettings ( ) ;
saturnSettings . SkipBios = false ;
PutSaturnSyncSettings ( saturnSettings ) ;
2014-07-03 11:43:06 +00:00
// Genesis
2014-07-03 03:44:14 +00:00
var genesisSettings = GetGenesisSyncSettings ( ) ;
genesisSettings . Region = LibGPGX . Region . Autodetect ;
PutGenesisSyncSettings ( genesisSettings ) ;
2014-07-03 11:43:06 +00:00
// SMS
2014-07-03 03:44:14 +00:00
var smsSettings = GetSMSSyncSettings ( ) ;
smsSettings . UseBIOS = false ;
PutSMSSyncSettings ( smsSettings ) ;
2014-07-03 11:43:06 +00:00
// Coleco
2014-07-03 03:44:14 +00:00
var colecoSettings = GetColecoVisionSyncSettings ( ) ;
colecoSettings . SkipBiosIntro = false ;
PutColecoVisionSyncSettings ( colecoSettings ) ;
2014-07-03 11:43:06 +00:00
// A2600
2014-07-03 03:44:14 +00:00
var a2600Settings = GetA2600SyncSettings ( ) ;
a2600Settings . FastScBios = false ;
a2600Settings . LeftDifficulty = true ;
a2600Settings . RightDifficulty = true ;
PutA2600SyncSettings ( a2600Settings ) ;
2014-07-03 11:43:06 +00:00
// NES
Global . Config . NES_InQuickNES = true ;
2014-07-02 21:20:45 +00:00
}
else if ( ProfileSelectComboBox . SelectedIndex = = 1 ) //TAS
{
DisplayProfileSettingBoxes ( false ) ;
// General
Global . Config . SaveLargeScreenshotWithStates = true ;
Global . Config . SaveScreenshotWithStates = true ;
Global . Config . AllowUD_LR = true ;
Global . Config . BackupSavestates = true ;
// Rewind
Global . Config . RewindEnabledLarge = false ;
Global . Config . RewindEnabledMedium = false ;
Global . Config . RewindEnabledSmall = false ;
// N64
var n64Settings = GetN64SyncSettings ( ) ;
n64Settings . RspType = N64SyncSettings . RSPTYPE . Rsp_Z64_hlevideo ;
n64Settings . CoreType = N64SyncSettings . CORETYPE . Pure_Interpret ;
Global . Config . N64UseCircularAnalogConstraint = false ;
PutN64SyncSettings ( n64Settings ) ;
2014-07-02 23:28:36 +00:00
// SNES
var snesSettings = GetSnesSyncSettings ( ) ;
snesSettings . Profile = "Compatibility" ;
PutSnesSyncSettings ( snesSettings ) ;
2014-07-03 11:43:06 +00:00
// Saturn
2014-07-03 03:44:14 +00:00
var saturnSettings = GetSaturnSyncSettings ( ) ;
saturnSettings . SkipBios = true ;
PutSaturnSyncSettings ( saturnSettings ) ;
2014-07-03 11:43:06 +00:00
// Genesis
2014-07-03 03:44:14 +00:00
var genesisSettings = GetGenesisSyncSettings ( ) ;
genesisSettings . Region = LibGPGX . Region . Autodetect ;
PutGenesisSyncSettings ( genesisSettings ) ;
2014-07-03 11:43:06 +00:00
// SMS
2014-07-03 03:44:14 +00:00
var smsSettings = GetSMSSyncSettings ( ) ;
smsSettings . UseBIOS = false ;
PutSMSSyncSettings ( smsSettings ) ;
2014-07-03 11:43:06 +00:00
// Coleco
2014-07-03 03:44:14 +00:00
var colecoSettings = GetColecoVisionSyncSettings ( ) ;
colecoSettings . SkipBiosIntro = true ;
PutColecoVisionSyncSettings ( colecoSettings ) ;
2014-07-03 11:43:06 +00:00
// A2600
2014-07-03 03:44:14 +00:00
var a2600Settings = GetA2600SyncSettings ( ) ;
a2600Settings . FastScBios = false ;
a2600Settings . LeftDifficulty = true ;
a2600Settings . RightDifficulty = true ;
PutA2600SyncSettings ( a2600Settings ) ;
2014-07-03 11:43:06 +00:00
// NES
Global . Config . NES_InQuickNES = true ;
2014-06-04 22:14:58 +00:00
}
else if ( ProfileSelectComboBox . SelectedIndex = = 3 ) //custom
{
2014-07-02 23:28:36 +00:00
//Disabled for now
//DisplayProfileSettingBoxes(true);
2014-06-04 22:14:58 +00:00
}
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-06-04 22:14:58 +00:00
if ( cProfile = = true )
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 ;
GeneralOptionsLabel . Visible = true ;
2014-06-04 20:15:33 +00:00
}
2014-06-04 22:14:58 +00:00
else if ( cProfile = = false )
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 ;
GeneralOptionsLabel . 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
#region Core specific Config setting helpers
// Unfortunatley there is not yet a generic way to match a sync setting object with its core implementation, so we need a bunch of these
2014-07-02 21:20:45 +00:00
private static N64SyncSettings GetN64SyncSettings ( )
{
if ( Global . Emulator is N64 )
{
return ( N64SyncSettings ) Global . Emulator . GetSyncSettings ( ) ;
}
else
{
2014-07-14 11:48:28 +00:00
return ( N64SyncSettings ) Global . Config . GetCoreSyncSettings < N64 > ( )
? ? new N64SyncSettings ( ) ;
2014-07-02 21:20:45 +00:00
}
}
private static void PutN64SyncSettings ( N64SyncSettings s )
2014-07-02 14:27:12 +00:00
{
if ( Global . Emulator is N64 )
{
GlobalWin . MainForm . PutCoreSyncSettings ( s ) ;
}
else
{
Global . Config . PutCoreSyncSettings < N64 > ( s ) ;
}
}
2014-07-02 23:28:36 +00:00
private static LibsnesCore . SnesSyncSettings GetSnesSyncSettings ( )
{
if ( Global . Emulator is LibsnesCore )
{
return ( LibsnesCore . SnesSyncSettings ) Global . Emulator . GetSyncSettings ( ) ;
}
else
{
2014-07-14 11:48:28 +00:00
return ( LibsnesCore . SnesSyncSettings ) Global . Config . GetCoreSyncSettings < LibsnesCore > ( )
? ? new LibsnesCore . SnesSyncSettings ( ) ;
2014-07-02 23:28:36 +00:00
}
}
private static void PutSnesSyncSettings ( LibsnesCore . SnesSyncSettings s )
{
if ( Global . Emulator is LibsnesCore )
{
GlobalWin . MainForm . PutCoreSyncSettings ( s ) ;
}
else
{
Global . Config . PutCoreSyncSettings < LibsnesCore > ( s ) ;
}
}
2014-07-03 03:44:14 +00:00
private static Yabause . SaturnSyncSettings GetSaturnSyncSettings ( )
{
if ( Global . Emulator is Yabause )
{
return ( Yabause . SaturnSyncSettings ) Global . Emulator . GetSyncSettings ( ) ;
}
else
{
2014-07-14 11:48:28 +00:00
return ( Yabause . SaturnSyncSettings ) Global . Config . GetCoreSyncSettings < Yabause > ( )
? ? new Yabause . SaturnSyncSettings ( ) ;
2014-07-03 03:44:14 +00:00
}
}
private static void PutSaturnSyncSettings ( Yabause . SaturnSyncSettings s )
{
if ( Global . Emulator is Yabause )
{
GlobalWin . MainForm . PutCoreSyncSettings ( s ) ;
}
else
{
Global . Config . PutCoreSyncSettings < Yabause > ( s ) ;
}
}
private static GPGX . GPGXSyncSettings GetGenesisSyncSettings ( )
{
if ( Global . Emulator is GPGX )
{
return ( GPGX . GPGXSyncSettings ) Global . Emulator . GetSyncSettings ( ) ;
}
else
{
2014-07-14 11:48:28 +00:00
return ( GPGX . GPGXSyncSettings ) Global . Config . GetCoreSyncSettings < GPGX > ( )
? ? new GPGX . GPGXSyncSettings ( ) ;
2014-07-03 03:44:14 +00:00
}
}
private static void PutGenesisSyncSettings ( GPGX . GPGXSyncSettings s )
{
if ( Global . Emulator is GPGX )
{
GlobalWin . MainForm . PutCoreSyncSettings ( s ) ;
}
else
{
Global . Config . PutCoreSyncSettings < GPGX > ( s ) ;
}
}
private static SMS . SMSSyncSettings GetSMSSyncSettings ( )
{
if ( Global . Emulator is SMS )
{
return ( SMS . SMSSyncSettings ) Global . Emulator . GetSyncSettings ( ) ;
}
else
{
2014-07-14 11:48:28 +00:00
return ( SMS . SMSSyncSettings ) Global . Config . GetCoreSyncSettings < SMS > ( )
? ? new SMS . SMSSyncSettings ( ) ;
2014-07-03 03:44:14 +00:00
}
}
private static void PutSMSSyncSettings ( SMS . SMSSyncSettings s )
{
if ( Global . Emulator is SMS )
{
GlobalWin . MainForm . PutCoreSyncSettings ( s ) ;
}
else
{
Global . Config . PutCoreSyncSettings < SMS > ( s ) ;
}
}
private static ColecoVision . ColecoSyncSettings GetColecoVisionSyncSettings ( )
{
if ( Global . Emulator is ColecoVision )
{
return ( ColecoVision . ColecoSyncSettings ) Global . Emulator . GetSyncSettings ( ) ;
}
else
{
2014-07-14 11:48:28 +00:00
return ( ColecoVision . ColecoSyncSettings ) Global . Config . GetCoreSyncSettings < ColecoVision > ( )
? ? new ColecoVision . ColecoSyncSettings ( ) ;
2014-07-03 03:44:14 +00:00
}
}
private static void PutColecoVisionSyncSettings ( ColecoVision . ColecoSyncSettings s )
{
if ( Global . Emulator is ColecoVision )
{
GlobalWin . MainForm . PutCoreSyncSettings ( s ) ;
}
else
{
Global . Config . PutCoreSyncSettings < ColecoVision > ( s ) ;
}
}
2014-07-14 11:48:28 +00:00
2014-07-03 03:44:14 +00:00
private static Atari2600 . A2600SyncSettings GetA2600SyncSettings ( )
{
if ( Global . Emulator is Atari2600 )
{
return ( Atari2600 . A2600SyncSettings ) Global . Emulator . GetSyncSettings ( ) ;
}
else
{
2014-07-14 11:48:28 +00:00
return ( Atari2600 . A2600SyncSettings ) Global . Config . GetCoreSyncSettings < Atari2600 > ( )
? ? new Atari2600 . A2600SyncSettings ( ) ;
2014-07-03 03:44:14 +00:00
}
}
private static void PutA2600SyncSettings ( Atari2600 . A2600SyncSettings s )
{
if ( Global . Emulator is Atari2600 )
{
GlobalWin . MainForm . PutCoreSyncSettings ( s ) ;
}
else
{
Global . Config . PutCoreSyncSettings < Atari2600 > ( s ) ;
}
}
2014-07-02 14:27:12 +00:00
#endregion
2014-06-04 19:18:14 +00:00
}
}