2016-06-21 18:58:22 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesen.GUI.Config;
|
|
|
|
|
using Mesen.GUI.GoogleDriveIntegration;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI.Forms.Config
|
|
|
|
|
{
|
|
|
|
|
public partial class frmEmulationConfig : BaseConfigForm
|
|
|
|
|
{
|
|
|
|
|
public frmEmulationConfig()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
2017-12-28 20:27:16 -05:00
|
|
|
|
tpgOverclocking.Enabled = !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording();
|
|
|
|
|
tpgAdvanced.Enabled = !InteropEmu.MoviePlaying() && !InteropEmu.MovieRecording();
|
|
|
|
|
|
2016-09-11 08:29:34 -04:00
|
|
|
|
ConfigManager.Config.EmulationInfo.EmulationSpeed = InteropEmu.GetEmulationSpeed();
|
2016-06-21 18:58:22 -04:00
|
|
|
|
Entity = ConfigManager.Config.EmulationInfo;
|
|
|
|
|
|
|
|
|
|
AddBinding("EmulationSpeed", nudEmulationSpeed);
|
2016-09-02 19:36:37 -04:00
|
|
|
|
AddBinding("TurboSpeed", nudTurboSpeed);
|
2017-04-28 19:54:58 -04:00
|
|
|
|
AddBinding("RewindSpeed", nudRewindSpeed);
|
2016-06-21 18:58:22 -04:00
|
|
|
|
|
|
|
|
|
AddBinding("UseAlternativeMmc3Irq", chkUseAlternativeMmc3Irq);
|
|
|
|
|
AddBinding("AllowInvalidInput", chkAllowInvalidInput);
|
|
|
|
|
AddBinding("RemoveSpriteLimit", chkRemoveSpriteLimit);
|
2017-06-08 20:00:51 -04:00
|
|
|
|
AddBinding("AdaptiveSpriteLimit", chkAdaptiveSpriteLimit);
|
2017-02-22 20:41:58 -05:00
|
|
|
|
AddBinding("DisablePpu2004Reads", chkDisablePpu2004Reads);
|
2017-02-24 21:43:42 -05:00
|
|
|
|
AddBinding("DisablePaletteRead", chkDisablePaletteRead);
|
|
|
|
|
AddBinding("DisableOamAddrBug", chkDisableOamAddrBug);
|
2017-02-24 23:06:13 -05:00
|
|
|
|
AddBinding("DisablePpuReset", chkDisablePpuReset);
|
2017-04-08 14:13:10 -04:00
|
|
|
|
AddBinding("EnableOamDecay", chkEnableOamDecay);
|
2017-02-25 10:56:38 -05:00
|
|
|
|
AddBinding("UseNes101Hvc101Behavior", chkUseNes101Hvc101Behavior);
|
2018-04-14 22:12:05 -04:00
|
|
|
|
AddBinding("EnableMapperRandomPowerOnState", chkMapperRandomPowerOnState);
|
2016-06-21 18:58:22 -04:00
|
|
|
|
|
|
|
|
|
AddBinding("OverclockRate", nudOverclockRate);
|
|
|
|
|
AddBinding("OverclockAdjustApu", chkOverclockAdjustApu);
|
|
|
|
|
|
|
|
|
|
AddBinding("PpuExtraScanlinesBeforeNmi", nudExtraScanlinesBeforeNmi);
|
|
|
|
|
AddBinding("PpuExtraScanlinesAfterNmi", nudExtraScanlinesAfterNmi);
|
2016-07-10 18:22:37 -04:00
|
|
|
|
|
2016-08-24 17:32:22 -04:00
|
|
|
|
AddBinding("ShowLagCounter", chkShowLagCounter);
|
|
|
|
|
|
|
|
|
|
AddBinding("RamPowerOnState", cboRamPowerOnState);
|
2016-06-21 18:58:22 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnFormClosed(FormClosedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
base.OnFormClosed(e);
|
|
|
|
|
EmulationInfo.ApplyConfig();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void tmrUpdateClockRate_Tick(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
decimal clockRateMultiplierNtsc = (nudOverclockRate.Value * (1 + (nudExtraScanlinesAfterNmi.Value + nudExtraScanlinesBeforeNmi.Value) / 262));
|
|
|
|
|
decimal clockRateMultiplierPal = (nudOverclockRate.Value * (1 + (nudExtraScanlinesAfterNmi.Value + nudExtraScanlinesBeforeNmi.Value) / 312));
|
2016-07-09 09:25:01 -04:00
|
|
|
|
decimal clockRateMultiplierDendy = (nudOverclockRate.Value * (1 + (nudExtraScanlinesAfterNmi.Value + nudExtraScanlinesBeforeNmi.Value) / 312));
|
2016-06-21 18:58:22 -04:00
|
|
|
|
lblEffectiveClockRateValue.Text = (1789773 * clockRateMultiplierNtsc / 100000000).ToString("#.####") + " mhz (" + ((int)clockRateMultiplierNtsc).ToString() + "%)";
|
|
|
|
|
lblEffectiveClockRateValuePal.Text = (1662607 * clockRateMultiplierPal / 100000000).ToString("#.####") + " mhz (" + ((int)clockRateMultiplierPal).ToString() + "%)";
|
2016-07-09 09:25:01 -04:00
|
|
|
|
lblEffectiveClockRateValueDendy.Text = (1773448 * clockRateMultiplierDendy / 100000000).ToString("#.####") + " mhz (" + ((int)clockRateMultiplierDendy).ToString() + "%)";
|
2016-06-21 18:58:22 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OverclockConfig_Validated(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if(string.IsNullOrWhiteSpace(nudExtraScanlinesAfterNmi.Text)) {
|
|
|
|
|
nudExtraScanlinesAfterNmi.Value = 0;
|
|
|
|
|
}
|
|
|
|
|
if(string.IsNullOrWhiteSpace(nudExtraScanlinesBeforeNmi.Text)) {
|
|
|
|
|
nudExtraScanlinesBeforeNmi.Value = 0;
|
|
|
|
|
}
|
|
|
|
|
if(string.IsNullOrWhiteSpace(nudOverclockRate.Text)) {
|
2017-09-16 22:02:05 -04:00
|
|
|
|
nudOverclockRate.Value = 100;
|
2016-06-21 18:58:22 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-07-10 18:22:37 -04:00
|
|
|
|
|
|
|
|
|
private void btnResetLagCounter_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
InteropEmu.ResetLagCounter();
|
|
|
|
|
}
|
2017-06-08 20:00:51 -04:00
|
|
|
|
|
|
|
|
|
private void chkRemoveSpriteLimit_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
chkAdaptiveSpriteLimit.Enabled = chkRemoveSpriteLimit.Checked;
|
|
|
|
|
}
|
2016-06-21 18:58:22 -04:00
|
|
|
|
}
|
|
|
|
|
}
|