Replaced FPS limit by "Emulation speed" option
This commit is contained in:
parent
3f40bb39fb
commit
f3b3a8eed5
16 changed files with 255 additions and 157 deletions
|
@ -199,11 +199,15 @@ void APU::Exec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void APU::StopAudio()
|
void APU::StopAudio(bool clearBuffer)
|
||||||
{
|
{
|
||||||
if(APU::AudioDevice) {
|
if(APU::AudioDevice) {
|
||||||
|
if(clearBuffer) {
|
||||||
|
APU::AudioDevice->Stop();
|
||||||
|
} else {
|
||||||
APU::AudioDevice->Pause();
|
APU::AudioDevice->Pause();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void APU::Reset(bool softReset)
|
void APU::Reset(bool softReset)
|
||||||
|
|
|
@ -72,5 +72,5 @@ class APU : public Snapshotable, public IMemoryHandler
|
||||||
static void ExecStatic();
|
static void ExecStatic();
|
||||||
|
|
||||||
static void StaticRun();
|
static void StaticRun();
|
||||||
static void StopAudio();
|
static void StopAudio(bool clearBuffer = false);
|
||||||
};
|
};
|
|
@ -134,6 +134,8 @@ void Console::ResetComponents(bool softReset)
|
||||||
_cpu->Reset(softReset);
|
_cpu->Reset(softReset);
|
||||||
_memoryManager->Reset(softReset);
|
_memoryManager->Reset(softReset);
|
||||||
|
|
||||||
|
_apu->StopAudio(true);
|
||||||
|
|
||||||
if(softReset) {
|
if(softReset) {
|
||||||
MessageManager::SendNotification(ConsoleNotificationType::GameReset);
|
MessageManager::SendNotification(ConsoleNotificationType::GameReset);
|
||||||
} else {
|
} else {
|
||||||
|
@ -231,7 +233,7 @@ void Console::Run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_apu->StopAudio();
|
_apu->StopAudio(true);
|
||||||
_stopLock.Release();
|
_stopLock.Release();
|
||||||
_runLock.Release();
|
_runLock.Release();
|
||||||
}
|
}
|
||||||
|
@ -239,22 +241,18 @@ void Console::Run()
|
||||||
void Console::UpdateNesModel(double &frameDelay, bool showMessage)
|
void Console::UpdateNesModel(double &frameDelay, bool showMessage)
|
||||||
{
|
{
|
||||||
NesModel model = EmulationSettings::GetNesModel();
|
NesModel model = EmulationSettings::GetNesModel();
|
||||||
int32_t fpsLimit = EmulationSettings::GetFpsLimit();
|
uint32_t emulationSpeed = EmulationSettings::GetEmulationSpeed();
|
||||||
if(model == NesModel::Auto) {
|
if(model == NesModel::Auto) {
|
||||||
model = _mapper->IsPalRom() ? NesModel::PAL : NesModel::NTSC;
|
model = _mapper->IsPalRom() ? NesModel::PAL : NesModel::NTSC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fpsLimit == -1) {
|
if(emulationSpeed == 0) {
|
||||||
frameDelay = (model == NesModel::NTSC ? 16.63926405550947 : 19.99720920217466); //60.1fps (NTSC), 50.01fps (PAL)
|
|
||||||
} else if(fpsLimit == 50) {
|
|
||||||
frameDelay = 19.99720920217466;
|
|
||||||
} else if(fpsLimit == 60) {
|
|
||||||
frameDelay = 16.63926405550947;
|
|
||||||
} else if(fpsLimit == 0) {
|
|
||||||
frameDelay = 0;
|
frameDelay = 0;
|
||||||
} else {
|
} else {
|
||||||
frameDelay = 1000.0 / fpsLimit;
|
frameDelay = (model == NesModel::NTSC ? 16.63926405550947 : 19.99720920217466); //60.1fps (NTSC), 50.01fps (PAL)
|
||||||
|
frameDelay /= (double)emulationSpeed / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ppu->SetNesModel(model);
|
_ppu->SetNesModel(model);
|
||||||
_apu->SetNesModel(model);
|
_apu->SetNesModel(model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,4 +6,4 @@ uint32_t EmulationSettings::AudioLatency = 20000;
|
||||||
double EmulationSettings::ChannelVolume[5] = { 0.5f, 0.5f, 0.5f, 0.5f, 0.5f };
|
double EmulationSettings::ChannelVolume[5] = { 0.5f, 0.5f, 0.5f, 0.5f, 0.5f };
|
||||||
NesModel EmulationSettings::Model = NesModel::Auto;
|
NesModel EmulationSettings::Model = NesModel::Auto;
|
||||||
OverscanDimensions EmulationSettings::Overscan;
|
OverscanDimensions EmulationSettings::Overscan;
|
||||||
int32_t EmulationSettings::FpsLimit = -1;
|
uint32_t EmulationSettings::EmulationSpeed = 100;
|
|
@ -54,7 +54,7 @@ private:
|
||||||
static uint32_t AudioLatency;
|
static uint32_t AudioLatency;
|
||||||
static double ChannelVolume[5];
|
static double ChannelVolume[5];
|
||||||
static NesModel Model;
|
static NesModel Model;
|
||||||
static int32_t FpsLimit;
|
static uint32_t EmulationSpeed;
|
||||||
static OverscanDimensions Overscan;
|
static OverscanDimensions Overscan;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -94,15 +94,15 @@ public:
|
||||||
AudioLatency = msLatency;
|
AudioLatency = msLatency;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-1: Auto, 0: No limit, Number: Specific FPS
|
//0: No limit, Number: % of default speed (50/60fps)
|
||||||
static void SetFpsLimit(int32_t fpsLimit)
|
static void SetEmulationSpeed(uint32_t emulationSpeed)
|
||||||
{
|
{
|
||||||
FpsLimit = fpsLimit;
|
EmulationSpeed = emulationSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t GetFpsLimit()
|
static uint32_t GetEmulationSpeed()
|
||||||
{
|
{
|
||||||
return FpsLimit;
|
return EmulationSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetOverscanDimensions(uint8_t left, uint8_t right, uint8_t top, uint8_t bottom)
|
static void SetOverscanDimensions(uint8_t left, uint8_t right, uint8_t top, uint8_t bottom)
|
||||||
|
|
|
@ -6,5 +6,6 @@ class IAudioDevice
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void PlayBuffer(int16_t *soundBuffer, uint32_t bufferSize) = 0;
|
virtual void PlayBuffer(int16_t *soundBuffer, uint32_t bufferSize) = 0;
|
||||||
|
virtual void Stop() = 0;
|
||||||
virtual void Pause() = 0;
|
virtual void Pause() = 0;
|
||||||
};
|
};
|
|
@ -45,9 +45,9 @@ ButtonState VirtualController::GetButtonState()
|
||||||
_queueSize--;
|
_queueSize--;
|
||||||
|
|
||||||
if(_queueSize.load() > _minimumBuffer) {
|
if(_queueSize.load() > _minimumBuffer) {
|
||||||
EmulationSettings::SetFpsLimit(0);
|
EmulationSettings::SetEmulationSpeed(0);
|
||||||
} else {
|
} else {
|
||||||
EmulationSettings::SetFpsLimit(-1);
|
EmulationSettings::SetEmulationSpeed(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
_writeLock.Release();
|
_writeLock.Release();
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Mesen.GUI.Config
|
||||||
{
|
{
|
||||||
public class VideoInfo
|
public class VideoInfo
|
||||||
{
|
{
|
||||||
public Int32 FpsLimit = -1;
|
public UInt32 EmulationSpeed = 100;
|
||||||
public bool ShowFPS = false;
|
public bool ShowFPS = false;
|
||||||
public UInt32 OverscanLeft = 0;
|
public UInt32 OverscanLeft = 0;
|
||||||
public UInt32 OverscanRight = 0;
|
public UInt32 OverscanRight = 0;
|
||||||
|
@ -26,7 +26,7 @@ namespace Mesen.GUI.Config
|
||||||
{
|
{
|
||||||
VideoInfo videoInfo = ConfigManager.Config.VideoInfo;
|
VideoInfo videoInfo = ConfigManager.Config.VideoInfo;
|
||||||
|
|
||||||
InteropEmu.SetFpsLimit(videoInfo.FpsLimit);
|
InteropEmu.SetEmulationSpeed(videoInfo.EmulationSpeed);
|
||||||
|
|
||||||
if(ConfigManager.Config.VideoInfo.ShowFPS) {
|
if(ConfigManager.Config.VideoInfo.ShowFPS) {
|
||||||
InteropEmu.SetFlags((UInt32)EmulationFlags.ShowFPS);
|
InteropEmu.SetFlags((UInt32)EmulationFlags.ShowFPS);
|
||||||
|
|
77
GUI.NET/Forms/Config/frmVideoConfig.Designer.cs
generated
77
GUI.NET/Forms/Config/frmVideoConfig.Designer.cs
generated
|
@ -45,8 +45,9 @@
|
||||||
this.nudOverscanRight = new System.Windows.Forms.NumericUpDown();
|
this.nudOverscanRight = new System.Windows.Forms.NumericUpDown();
|
||||||
this.chkShowFps = new System.Windows.Forms.CheckBox();
|
this.chkShowFps = new System.Windows.Forms.CheckBox();
|
||||||
this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel();
|
this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.lblFpsLimit = new System.Windows.Forms.Label();
|
this.lblEmulationSpeed = new System.Windows.Forms.Label();
|
||||||
this.cboFpsLimit = new System.Windows.Forms.ComboBox();
|
this.nudEmulationSpeed = new System.Windows.Forms.NumericUpDown();
|
||||||
|
this.lblEmuSpeedHint = new System.Windows.Forms.Label();
|
||||||
this.tlpMain.SuspendLayout();
|
this.tlpMain.SuspendLayout();
|
||||||
this.grpCropping.SuspendLayout();
|
this.grpCropping.SuspendLayout();
|
||||||
this.tableLayoutPanel1.SuspendLayout();
|
this.tableLayoutPanel1.SuspendLayout();
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
this.flowLayoutPanel2.SuspendLayout();
|
this.flowLayoutPanel2.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudOverscanRight)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudOverscanRight)).BeginInit();
|
||||||
this.flowLayoutPanel6.SuspendLayout();
|
this.flowLayoutPanel6.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudEmulationSpeed)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// baseConfigPanel
|
// baseConfigPanel
|
||||||
|
@ -88,9 +90,9 @@
|
||||||
//
|
//
|
||||||
this.grpCropping.Controls.Add(this.tableLayoutPanel1);
|
this.grpCropping.Controls.Add(this.tableLayoutPanel1);
|
||||||
this.grpCropping.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.grpCropping.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.grpCropping.Location = new System.Drawing.Point(3, 53);
|
this.grpCropping.Location = new System.Drawing.Point(3, 52);
|
||||||
this.grpCropping.Name = "grpCropping";
|
this.grpCropping.Name = "grpCropping";
|
||||||
this.grpCropping.Size = new System.Drawing.Size(356, 252);
|
this.grpCropping.Size = new System.Drawing.Size(356, 253);
|
||||||
this.grpCropping.TabIndex = 7;
|
this.grpCropping.TabIndex = 7;
|
||||||
this.grpCropping.TabStop = false;
|
this.grpCropping.TabStop = false;
|
||||||
this.grpCropping.Text = "Video Cropping";
|
this.grpCropping.Text = "Video Cropping";
|
||||||
|
@ -247,7 +249,7 @@
|
||||||
// chkShowFps
|
// chkShowFps
|
||||||
//
|
//
|
||||||
this.chkShowFps.AutoSize = true;
|
this.chkShowFps.AutoSize = true;
|
||||||
this.chkShowFps.Location = new System.Drawing.Point(3, 30);
|
this.chkShowFps.Location = new System.Drawing.Point(3, 29);
|
||||||
this.chkShowFps.Name = "chkShowFps";
|
this.chkShowFps.Name = "chkShowFps";
|
||||||
this.chkShowFps.Size = new System.Drawing.Size(76, 17);
|
this.chkShowFps.Size = new System.Drawing.Size(76, 17);
|
||||||
this.chkShowFps.TabIndex = 9;
|
this.chkShowFps.TabIndex = 9;
|
||||||
|
@ -257,42 +259,47 @@
|
||||||
// flowLayoutPanel6
|
// flowLayoutPanel6
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel6.AutoSize = true;
|
this.flowLayoutPanel6.AutoSize = true;
|
||||||
this.flowLayoutPanel6.Controls.Add(this.lblFpsLimit);
|
this.flowLayoutPanel6.Controls.Add(this.lblEmulationSpeed);
|
||||||
this.flowLayoutPanel6.Controls.Add(this.cboFpsLimit);
|
this.flowLayoutPanel6.Controls.Add(this.nudEmulationSpeed);
|
||||||
|
this.flowLayoutPanel6.Controls.Add(this.lblEmuSpeedHint);
|
||||||
this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 0);
|
this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 0);
|
||||||
this.flowLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
|
this.flowLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
|
||||||
this.flowLayoutPanel6.Name = "flowLayoutPanel6";
|
this.flowLayoutPanel6.Name = "flowLayoutPanel6";
|
||||||
this.flowLayoutPanel6.Size = new System.Drawing.Size(362, 27);
|
this.flowLayoutPanel6.Size = new System.Drawing.Size(362, 26);
|
||||||
this.flowLayoutPanel6.TabIndex = 10;
|
this.flowLayoutPanel6.TabIndex = 10;
|
||||||
//
|
//
|
||||||
// lblFpsLimit
|
// lblEmulationSpeed
|
||||||
//
|
//
|
||||||
this.lblFpsLimit.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
this.lblEmulationSpeed.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||||
this.lblFpsLimit.AutoSize = true;
|
this.lblEmulationSpeed.AutoSize = true;
|
||||||
this.lblFpsLimit.Location = new System.Drawing.Point(3, 7);
|
this.lblEmulationSpeed.Location = new System.Drawing.Point(3, 6);
|
||||||
this.lblFpsLimit.Name = "lblFpsLimit";
|
this.lblEmulationSpeed.Name = "lblEmulationSpeed";
|
||||||
this.lblFpsLimit.Size = new System.Drawing.Size(54, 13);
|
this.lblEmulationSpeed.Size = new System.Drawing.Size(90, 13);
|
||||||
this.lblFpsLimit.TabIndex = 0;
|
this.lblEmulationSpeed.TabIndex = 0;
|
||||||
this.lblFpsLimit.Text = "FPS Limit:";
|
this.lblEmulationSpeed.Text = "Emulation Speed:";
|
||||||
//
|
//
|
||||||
// cboFpsLimit
|
// nudEmulationSpeed
|
||||||
//
|
//
|
||||||
this.cboFpsLimit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.nudEmulationSpeed.Location = new System.Drawing.Point(99, 3);
|
||||||
this.cboFpsLimit.FormattingEnabled = true;
|
this.nudEmulationSpeed.Maximum = new decimal(new int[] {
|
||||||
this.cboFpsLimit.Items.AddRange(new object[] {
|
500,
|
||||||
"Auto",
|
0,
|
||||||
"No Limit",
|
0,
|
||||||
"60",
|
0});
|
||||||
"50",
|
this.nudEmulationSpeed.Name = "nudEmulationSpeed";
|
||||||
"30",
|
this.nudEmulationSpeed.Size = new System.Drawing.Size(48, 20);
|
||||||
"25",
|
this.nudEmulationSpeed.TabIndex = 1;
|
||||||
"15",
|
//
|
||||||
"12"});
|
// lblEmuSpeedHint
|
||||||
this.cboFpsLimit.Location = new System.Drawing.Point(63, 3);
|
//
|
||||||
this.cboFpsLimit.Name = "cboFpsLimit";
|
this.lblEmuSpeedHint.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||||
this.cboFpsLimit.Size = new System.Drawing.Size(89, 21);
|
this.lblEmuSpeedHint.AutoSize = true;
|
||||||
this.cboFpsLimit.TabIndex = 1;
|
this.lblEmuSpeedHint.Location = new System.Drawing.Point(153, 6);
|
||||||
|
this.lblEmuSpeedHint.Name = "lblEmuSpeedHint";
|
||||||
|
this.lblEmuSpeedHint.Size = new System.Drawing.Size(107, 13);
|
||||||
|
this.lblEmuSpeedHint.TabIndex = 2;
|
||||||
|
this.lblEmuSpeedHint.Text = "(0 = Maximum speed)";
|
||||||
//
|
//
|
||||||
// frmVideoConfig
|
// frmVideoConfig
|
||||||
//
|
//
|
||||||
|
@ -324,6 +331,7 @@
|
||||||
((System.ComponentModel.ISupportInitialize)(this.nudOverscanRight)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.nudOverscanRight)).EndInit();
|
||||||
this.flowLayoutPanel6.ResumeLayout(false);
|
this.flowLayoutPanel6.ResumeLayout(false);
|
||||||
this.flowLayoutPanel6.PerformLayout();
|
this.flowLayoutPanel6.PerformLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.nudEmulationSpeed)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -348,7 +356,8 @@
|
||||||
private System.Windows.Forms.NumericUpDown nudOverscanBottom;
|
private System.Windows.Forms.NumericUpDown nudOverscanBottom;
|
||||||
private System.Windows.Forms.NumericUpDown nudOverscanRight;
|
private System.Windows.Forms.NumericUpDown nudOverscanRight;
|
||||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel6;
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel6;
|
||||||
private System.Windows.Forms.Label lblFpsLimit;
|
private System.Windows.Forms.Label lblEmulationSpeed;
|
||||||
private System.Windows.Forms.ComboBox cboFpsLimit;
|
private System.Windows.Forms.NumericUpDown nudEmulationSpeed;
|
||||||
|
private System.Windows.Forms.Label lblEmuSpeedHint;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,14 +19,7 @@ namespace Mesen.GUI.Forms.Config
|
||||||
|
|
||||||
Entity = ConfigManager.Config.VideoInfo;
|
Entity = ConfigManager.Config.VideoInfo;
|
||||||
|
|
||||||
if(ConfigManager.Config.VideoInfo.FpsLimit == -1) {
|
AddBinding("EmulationSpeed", nudEmulationSpeed);
|
||||||
cboFpsLimit.SelectedIndex = 0;
|
|
||||||
} else if(ConfigManager.Config.VideoInfo.FpsLimit == 0) {
|
|
||||||
cboFpsLimit.SelectedIndex = 1;
|
|
||||||
} else {
|
|
||||||
cboFpsLimit.SelectedIndex = cboFpsLimit.Items.IndexOf(ConfigManager.Config.VideoInfo.FpsLimit.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
AddBinding("ShowFPS", chkShowFps);
|
AddBinding("ShowFPS", chkShowFps);
|
||||||
AddBinding("OverscanLeft", nudOverscanLeft);
|
AddBinding("OverscanLeft", nudOverscanLeft);
|
||||||
AddBinding("OverscanRight", nudOverscanRight);
|
AddBinding("OverscanRight", nudOverscanRight);
|
||||||
|
@ -34,20 +27,6 @@ namespace Mesen.GUI.Forms.Config
|
||||||
AddBinding("OverscanBottom", nudOverscanBottom);
|
AddBinding("OverscanBottom", nudOverscanBottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateConfig()
|
|
||||||
{
|
|
||||||
int fpsLimit;
|
|
||||||
if(cboFpsLimit.SelectedIndex == 0) {
|
|
||||||
fpsLimit = -1;
|
|
||||||
} else if(cboFpsLimit.SelectedIndex == 1) {
|
|
||||||
fpsLimit = 0;
|
|
||||||
} else {
|
|
||||||
fpsLimit = Int32.Parse(cboFpsLimit.SelectedItem.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
((VideoInfo)Entity).FpsLimit = fpsLimit;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnFormClosed(FormClosedEventArgs e)
|
protected override void OnFormClosed(FormClosedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnFormClosed(e);
|
base.OnFormClosed(e);
|
||||||
|
|
138
GUI.NET/Forms/frmMain.Designer.cs
generated
138
GUI.NET/Forms/frmMain.Designer.cs
generated
|
@ -51,10 +51,16 @@
|
||||||
this.mnuReset = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuReset = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuStop = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuStop = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuOptions = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuOptions = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuFpsLimit = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuEmulationSpeed = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuFpsLimitDefault = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuEmuSpeedNormal = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuFpsLimitNoLimit = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.mnuIncreaseSpeed = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.mnuDecreaseSpeed = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
|
this.mnuEmuSpeedTriple = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.mnuEmuSpeedDouble = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.mnuEmuSpeedHalf = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.mnuEmuSpeedQuarter = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.mnuShowFPS = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuShowFPS = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.mnuAudioConfig = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuAudioConfig = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
@ -88,6 +94,7 @@
|
||||||
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
|
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
|
this.mnuAbout = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.dxViewer = new Mesen.GUI.Controls.DXViewer();
|
this.dxViewer = new Mesen.GUI.Controls.DXViewer();
|
||||||
|
this.mnuEmuSpeedMaximumSpeed = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStrip.SuspendLayout();
|
this.menuStrip.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
@ -208,7 +215,7 @@
|
||||||
// mnuOptions
|
// mnuOptions
|
||||||
//
|
//
|
||||||
this.mnuOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.mnuOptions.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.mnuFpsLimit,
|
this.mnuEmulationSpeed,
|
||||||
this.mnuShowFPS,
|
this.mnuShowFPS,
|
||||||
this.toolStripMenuItem1,
|
this.toolStripMenuItem1,
|
||||||
this.mnuAudioConfig,
|
this.mnuAudioConfig,
|
||||||
|
@ -219,60 +226,110 @@
|
||||||
this.mnuOptions.Size = new System.Drawing.Size(61, 20);
|
this.mnuOptions.Size = new System.Drawing.Size(61, 20);
|
||||||
this.mnuOptions.Text = "Options";
|
this.mnuOptions.Text = "Options";
|
||||||
//
|
//
|
||||||
// mnuFpsLimit
|
// mnuEmulationSpeed
|
||||||
//
|
//
|
||||||
this.mnuFpsLimit.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
this.mnuEmulationSpeed.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
this.mnuFpsLimitNoLimit,
|
this.mnuEmuSpeedNormal,
|
||||||
this.toolStripMenuItem8,
|
this.toolStripMenuItem8,
|
||||||
this.mnuFpsLimitDefault});
|
this.mnuIncreaseSpeed,
|
||||||
this.mnuFpsLimit.Name = "mnuFpsLimit";
|
this.mnuDecreaseSpeed,
|
||||||
this.mnuFpsLimit.Size = new System.Drawing.Size(152, 22);
|
this.mnuEmuSpeedMaximumSpeed,
|
||||||
this.mnuFpsLimit.Text = "FPS Limit";
|
this.toolStripMenuItem9,
|
||||||
|
this.mnuEmuSpeedTriple,
|
||||||
|
this.mnuEmuSpeedDouble,
|
||||||
|
this.mnuEmuSpeedHalf,
|
||||||
|
this.mnuEmuSpeedQuarter});
|
||||||
|
this.mnuEmulationSpeed.Name = "mnuEmulationSpeed";
|
||||||
|
this.mnuEmulationSpeed.Size = new System.Drawing.Size(163, 22);
|
||||||
|
this.mnuEmulationSpeed.Text = "Emulation Speed";
|
||||||
//
|
//
|
||||||
// mnuFpsLimitDefault
|
// mnuEmuSpeedNormal
|
||||||
//
|
//
|
||||||
this.mnuFpsLimitDefault.Name = "mnuFpsLimitDefault";
|
this.mnuEmuSpeedNormal.Name = "mnuEmuSpeedNormal";
|
||||||
this.mnuFpsLimitDefault.Size = new System.Drawing.Size(152, 22);
|
this.mnuEmuSpeedNormal.Size = new System.Drawing.Size(182, 22);
|
||||||
this.mnuFpsLimitDefault.Tag = "";
|
this.mnuEmuSpeedNormal.Text = "Normal (100%)";
|
||||||
this.mnuFpsLimitDefault.Text = "Auto";
|
this.mnuEmuSpeedNormal.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||||
//
|
|
||||||
// mnuFpsLimitNoLimit
|
|
||||||
//
|
|
||||||
this.mnuFpsLimitNoLimit.Name = "mnuFpsLimitNoLimit";
|
|
||||||
this.mnuFpsLimitNoLimit.ShortcutKeys = System.Windows.Forms.Keys.F9;
|
|
||||||
this.mnuFpsLimitNoLimit.Size = new System.Drawing.Size(152, 22);
|
|
||||||
this.mnuFpsLimitNoLimit.Text = "No Limit";
|
|
||||||
//
|
//
|
||||||
// toolStripMenuItem8
|
// toolStripMenuItem8
|
||||||
//
|
//
|
||||||
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
|
this.toolStripMenuItem8.Name = "toolStripMenuItem8";
|
||||||
this.toolStripMenuItem8.Size = new System.Drawing.Size(149, 6);
|
this.toolStripMenuItem8.Size = new System.Drawing.Size(179, 6);
|
||||||
|
//
|
||||||
|
// mnuIncreaseSpeed
|
||||||
|
//
|
||||||
|
this.mnuIncreaseSpeed.Name = "mnuIncreaseSpeed";
|
||||||
|
this.mnuIncreaseSpeed.ShortcutKeyDisplayString = "=";
|
||||||
|
this.mnuIncreaseSpeed.Size = new System.Drawing.Size(182, 22);
|
||||||
|
this.mnuIncreaseSpeed.Text = "Increase Speed";
|
||||||
|
this.mnuIncreaseSpeed.Click += new System.EventHandler(this.mnuIncreaseSpeed_Click);
|
||||||
|
//
|
||||||
|
// mnuDecreaseSpeed
|
||||||
|
//
|
||||||
|
this.mnuDecreaseSpeed.Name = "mnuDecreaseSpeed";
|
||||||
|
this.mnuDecreaseSpeed.ShortcutKeyDisplayString = "-";
|
||||||
|
this.mnuDecreaseSpeed.Size = new System.Drawing.Size(182, 22);
|
||||||
|
this.mnuDecreaseSpeed.Text = "Decrease Speed";
|
||||||
|
this.mnuDecreaseSpeed.Click += new System.EventHandler(this.mnuDecreaseSpeed_Click);
|
||||||
|
//
|
||||||
|
// toolStripMenuItem9
|
||||||
|
//
|
||||||
|
this.toolStripMenuItem9.Name = "toolStripMenuItem9";
|
||||||
|
this.toolStripMenuItem9.Size = new System.Drawing.Size(179, 6);
|
||||||
|
//
|
||||||
|
// mnuEmuSpeedTriple
|
||||||
|
//
|
||||||
|
this.mnuEmuSpeedTriple.Name = "mnuEmuSpeedTriple";
|
||||||
|
this.mnuEmuSpeedTriple.Size = new System.Drawing.Size(182, 22);
|
||||||
|
this.mnuEmuSpeedTriple.Tag = "";
|
||||||
|
this.mnuEmuSpeedTriple.Text = "Triple (300%)";
|
||||||
|
this.mnuEmuSpeedTriple.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||||
|
//
|
||||||
|
// mnuEmuSpeedDouble
|
||||||
|
//
|
||||||
|
this.mnuEmuSpeedDouble.Name = "mnuEmuSpeedDouble";
|
||||||
|
this.mnuEmuSpeedDouble.Size = new System.Drawing.Size(182, 22);
|
||||||
|
this.mnuEmuSpeedDouble.Text = "Double (200%)";
|
||||||
|
this.mnuEmuSpeedDouble.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||||
|
//
|
||||||
|
// mnuEmuSpeedHalf
|
||||||
|
//
|
||||||
|
this.mnuEmuSpeedHalf.Name = "mnuEmuSpeedHalf";
|
||||||
|
this.mnuEmuSpeedHalf.Size = new System.Drawing.Size(182, 22);
|
||||||
|
this.mnuEmuSpeedHalf.Text = "Half (50%)";
|
||||||
|
this.mnuEmuSpeedHalf.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||||
|
//
|
||||||
|
// mnuEmuSpeedQuarter
|
||||||
|
//
|
||||||
|
this.mnuEmuSpeedQuarter.Name = "mnuEmuSpeedQuarter";
|
||||||
|
this.mnuEmuSpeedQuarter.Size = new System.Drawing.Size(182, 22);
|
||||||
|
this.mnuEmuSpeedQuarter.Text = "Quarter (25%)";
|
||||||
|
this.mnuEmuSpeedQuarter.Click += new System.EventHandler(this.mnuEmulationSpeedOption_Click);
|
||||||
//
|
//
|
||||||
// mnuShowFPS
|
// mnuShowFPS
|
||||||
//
|
//
|
||||||
this.mnuShowFPS.CheckOnClick = true;
|
this.mnuShowFPS.CheckOnClick = true;
|
||||||
this.mnuShowFPS.Name = "mnuShowFPS";
|
this.mnuShowFPS.Name = "mnuShowFPS";
|
||||||
this.mnuShowFPS.ShortcutKeys = System.Windows.Forms.Keys.F10;
|
this.mnuShowFPS.ShortcutKeys = System.Windows.Forms.Keys.F10;
|
||||||
this.mnuShowFPS.Size = new System.Drawing.Size(152, 22);
|
this.mnuShowFPS.Size = new System.Drawing.Size(163, 22);
|
||||||
this.mnuShowFPS.Text = "Show FPS";
|
this.mnuShowFPS.Text = "Show FPS";
|
||||||
this.mnuShowFPS.Click += new System.EventHandler(this.mnuShowFPS_Click);
|
this.mnuShowFPS.Click += new System.EventHandler(this.mnuShowFPS_Click);
|
||||||
//
|
//
|
||||||
// toolStripMenuItem1
|
// toolStripMenuItem1
|
||||||
//
|
//
|
||||||
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
|
||||||
this.toolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
|
this.toolStripMenuItem1.Size = new System.Drawing.Size(160, 6);
|
||||||
//
|
//
|
||||||
// mnuAudioConfig
|
// mnuAudioConfig
|
||||||
//
|
//
|
||||||
this.mnuAudioConfig.Name = "mnuAudioConfig";
|
this.mnuAudioConfig.Name = "mnuAudioConfig";
|
||||||
this.mnuAudioConfig.Size = new System.Drawing.Size(152, 22);
|
this.mnuAudioConfig.Size = new System.Drawing.Size(163, 22);
|
||||||
this.mnuAudioConfig.Text = "Audio";
|
this.mnuAudioConfig.Text = "Audio";
|
||||||
this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click);
|
this.mnuAudioConfig.Click += new System.EventHandler(this.mnuAudioConfig_Click);
|
||||||
//
|
//
|
||||||
// mnuInput
|
// mnuInput
|
||||||
//
|
//
|
||||||
this.mnuInput.Name = "mnuInput";
|
this.mnuInput.Name = "mnuInput";
|
||||||
this.mnuInput.Size = new System.Drawing.Size(152, 22);
|
this.mnuInput.Size = new System.Drawing.Size(163, 22);
|
||||||
this.mnuInput.Text = "Input";
|
this.mnuInput.Text = "Input";
|
||||||
this.mnuInput.Click += new System.EventHandler(this.mnuInput_Click);
|
this.mnuInput.Click += new System.EventHandler(this.mnuInput_Click);
|
||||||
//
|
//
|
||||||
|
@ -283,7 +340,7 @@
|
||||||
this.mnuRegionNtsc,
|
this.mnuRegionNtsc,
|
||||||
this.mnuRegionPal});
|
this.mnuRegionPal});
|
||||||
this.mnuRegion.Name = "mnuRegion";
|
this.mnuRegion.Name = "mnuRegion";
|
||||||
this.mnuRegion.Size = new System.Drawing.Size(152, 22);
|
this.mnuRegion.Size = new System.Drawing.Size(163, 22);
|
||||||
this.mnuRegion.Text = "Region";
|
this.mnuRegion.Text = "Region";
|
||||||
//
|
//
|
||||||
// mnuRegionAuto
|
// mnuRegionAuto
|
||||||
|
@ -310,7 +367,7 @@
|
||||||
// mnuVideoConfig
|
// mnuVideoConfig
|
||||||
//
|
//
|
||||||
this.mnuVideoConfig.Name = "mnuVideoConfig";
|
this.mnuVideoConfig.Name = "mnuVideoConfig";
|
||||||
this.mnuVideoConfig.Size = new System.Drawing.Size(152, 22);
|
this.mnuVideoConfig.Size = new System.Drawing.Size(163, 22);
|
||||||
this.mnuVideoConfig.Text = "Video";
|
this.mnuVideoConfig.Text = "Video";
|
||||||
this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click);
|
this.mnuVideoConfig.Click += new System.EventHandler(this.mnuVideoConfig_Click);
|
||||||
//
|
//
|
||||||
|
@ -500,6 +557,14 @@
|
||||||
this.dxViewer.Size = new System.Drawing.Size(1024, 960);
|
this.dxViewer.Size = new System.Drawing.Size(1024, 960);
|
||||||
this.dxViewer.TabIndex = 1;
|
this.dxViewer.TabIndex = 1;
|
||||||
//
|
//
|
||||||
|
// mnuEmuSpeedMaximumSpeed
|
||||||
|
//
|
||||||
|
this.mnuEmuSpeedMaximumSpeed.Name = "mnuEmuSpeedMaximumSpeed";
|
||||||
|
this.mnuEmuSpeedMaximumSpeed.ShortcutKeys = System.Windows.Forms.Keys.F9;
|
||||||
|
this.mnuEmuSpeedMaximumSpeed.Size = new System.Drawing.Size(182, 22);
|
||||||
|
this.mnuEmuSpeedMaximumSpeed.Text = "Maximum Speed";
|
||||||
|
this.mnuEmuSpeedMaximumSpeed.Click += new System.EventHandler(this.mnuEmuSpeedMaximumSpeed_Click);
|
||||||
|
//
|
||||||
// frmMain
|
// frmMain
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
@ -530,7 +595,7 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuReset;
|
private System.Windows.Forms.ToolStripMenuItem mnuReset;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuStop;
|
private System.Windows.Forms.ToolStripMenuItem mnuStop;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuOptions;
|
private System.Windows.Forms.ToolStripMenuItem mnuOptions;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuFpsLimit;
|
private System.Windows.Forms.ToolStripMenuItem mnuEmulationSpeed;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuShowFPS;
|
private System.Windows.Forms.ToolStripMenuItem mnuShowFPS;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
|
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuInput;
|
private System.Windows.Forms.ToolStripMenuItem mnuInput;
|
||||||
|
@ -570,9 +635,16 @@
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuRegionAuto;
|
private System.Windows.Forms.ToolStripMenuItem mnuRegionAuto;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuRegionNtsc;
|
private System.Windows.Forms.ToolStripMenuItem mnuRegionNtsc;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuRegionPal;
|
private System.Windows.Forms.ToolStripMenuItem mnuRegionPal;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuFpsLimitDefault;
|
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedTriple;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem8;
|
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem8;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuFpsLimitNoLimit;
|
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedNormal;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuIncreaseSpeed;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuDecreaseSpeed;
|
||||||
|
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem9;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedDouble;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedHalf;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedQuarter;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuEmuSpeedMaximumSpeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ namespace Mesen.GUI.Forms
|
||||||
private Thread _renderThread;
|
private Thread _renderThread;
|
||||||
private frmDebugger _debugger;
|
private frmDebugger _debugger;
|
||||||
private bool _stop = false;
|
private bool _stop = false;
|
||||||
private List<ToolStripMenuItem> _fpsLimitOptions = new List<ToolStripMenuItem>();
|
|
||||||
|
|
||||||
public frmMain()
|
public frmMain()
|
||||||
{
|
{
|
||||||
|
@ -39,10 +38,10 @@ namespace Mesen.GUI.Forms
|
||||||
_notifListener = new InteropEmu.NotificationListener();
|
_notifListener = new InteropEmu.NotificationListener();
|
||||||
_notifListener.OnNotification += _notifListener_OnNotification;
|
_notifListener.OnNotification += _notifListener_OnNotification;
|
||||||
|
|
||||||
UpdateVideoSettings();
|
InitializeEmulationSpeedMenu();
|
||||||
|
|
||||||
|
UpdateVideoSettings();
|
||||||
InitializeEmu();
|
InitializeEmu();
|
||||||
InitializeFpsLimitMenu();
|
|
||||||
|
|
||||||
UpdateMenus();
|
UpdateMenus();
|
||||||
UpdateRecentFiles();
|
UpdateRecentFiles();
|
||||||
|
@ -65,48 +64,78 @@ namespace Mesen.GUI.Forms
|
||||||
UpdateEmulationFlags();
|
UpdateEmulationFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitializeFpsLimitMenu()
|
private void InitializeEmulationSpeedMenu()
|
||||||
{
|
{
|
||||||
int[] fpsValues = new int[] { 120, 100, 60, 50 , 30, 25, 15, 12 };
|
mnuEmuSpeedNormal.Tag = 100;
|
||||||
mnuFpsLimitDefault.Tag = -1;
|
mnuEmuSpeedTriple.Tag = 300;
|
||||||
mnuFpsLimitNoLimit.Tag = 0;
|
mnuEmuSpeedDouble.Tag = 200;
|
||||||
_fpsLimitOptions.Add(mnuFpsLimitDefault);
|
mnuEmuSpeedHalf.Tag = 50;
|
||||||
_fpsLimitOptions.Add(mnuFpsLimitNoLimit);
|
mnuEmuSpeedQuarter.Tag = 25;
|
||||||
foreach(int fpsValue in fpsValues) {
|
mnuEmuSpeedMaximumSpeed.Tag = 0;
|
||||||
ToolStripMenuItem item = (ToolStripMenuItem)mnuFpsLimit.DropDownItems.Add(fpsValue.ToString());
|
|
||||||
item.Tag = fpsValue;
|
UpdateEmulationSpeedMenu();
|
||||||
_fpsLimitOptions.Add(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(ToolStripMenuItem item in _fpsLimitOptions) {
|
private void UpdateEmulationSpeedMenu()
|
||||||
item.Click += mnuFpsLimitValue_Click;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateFpsLimitMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UpdateFpsLimitMenu()
|
|
||||||
{
|
{
|
||||||
foreach(ToolStripMenuItem item in _fpsLimitOptions) {
|
foreach(ToolStripMenuItem item in new ToolStripMenuItem[] { mnuEmuSpeedDouble, mnuEmuSpeedHalf, mnuEmuSpeedNormal, mnuEmuSpeedQuarter, mnuEmuSpeedTriple, mnuEmuSpeedMaximumSpeed }) {
|
||||||
item.Checked = ((int)item.Tag == ConfigManager.Config.VideoInfo.FpsLimit);
|
item.Checked = ((int)item.Tag == ConfigManager.Config.VideoInfo.EmulationSpeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void mnuFpsLimitValue_Click(object sender, EventArgs e)
|
private void SetEmulationSpeed(uint emulationSpeed)
|
||||||
{
|
{
|
||||||
int fpsLimit;
|
if(emulationSpeed == 0) {
|
||||||
if(sender == mnuFpsLimitNoLimit) {
|
InteropEmu.DisplayMessage("Emulation Speed", "Maximum speed");
|
||||||
fpsLimit = mnuFpsLimitNoLimit.Checked ? -1 : 0;
|
|
||||||
} else {
|
} else {
|
||||||
fpsLimit = (int)((ToolStripItem)sender).Tag;
|
InteropEmu.DisplayMessage("Emulation Speed", emulationSpeed + "%");
|
||||||
}
|
}
|
||||||
ConfigManager.Config.VideoInfo.FpsLimit = fpsLimit;
|
ConfigManager.Config.VideoInfo.EmulationSpeed = emulationSpeed;
|
||||||
ConfigManager.ApplyChanges();
|
ConfigManager.ApplyChanges();
|
||||||
UpdateFpsLimitMenu();
|
UpdateEmulationSpeedMenu();
|
||||||
|
|
||||||
VideoInfo.ApplyConfig();
|
VideoInfo.ApplyConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void mnuIncreaseSpeed_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(ConfigManager.Config.VideoInfo.EmulationSpeed > 0) {
|
||||||
|
if(ConfigManager.Config.VideoInfo.EmulationSpeed < 100) {
|
||||||
|
SetEmulationSpeed(ConfigManager.Config.VideoInfo.EmulationSpeed + 25);
|
||||||
|
} else if(ConfigManager.Config.VideoInfo.EmulationSpeed < 450) {
|
||||||
|
SetEmulationSpeed(ConfigManager.Config.VideoInfo.EmulationSpeed + 50);
|
||||||
|
} else {
|
||||||
|
SetEmulationSpeed(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mnuDecreaseSpeed_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(ConfigManager.Config.VideoInfo.EmulationSpeed == 0) {
|
||||||
|
SetEmulationSpeed(450);
|
||||||
|
} else if(ConfigManager.Config.VideoInfo.EmulationSpeed <= 100) {
|
||||||
|
if(ConfigManager.Config.VideoInfo.EmulationSpeed > 25) {
|
||||||
|
SetEmulationSpeed(ConfigManager.Config.VideoInfo.EmulationSpeed - 25);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SetEmulationSpeed(ConfigManager.Config.VideoInfo.EmulationSpeed - 50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mnuEmuSpeedMaximumSpeed_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(ConfigManager.Config.VideoInfo.EmulationSpeed == 0) {
|
||||||
|
SetEmulationSpeed(100);
|
||||||
|
} else {
|
||||||
|
SetEmulationSpeed(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mnuEmulationSpeedOption_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
SetEmulationSpeed((uint)((ToolStripItem)sender).Tag);
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateEmulationFlags()
|
void UpdateEmulationFlags()
|
||||||
{
|
{
|
||||||
ConfigManager.Config.VideoInfo.ShowFPS = mnuShowFPS.Checked;
|
ConfigManager.Config.VideoInfo.ShowFPS = mnuShowFPS.Checked;
|
||||||
|
@ -118,7 +147,7 @@ namespace Mesen.GUI.Forms
|
||||||
void UpdateVideoSettings()
|
void UpdateVideoSettings()
|
||||||
{
|
{
|
||||||
mnuShowFPS.Checked = ConfigManager.Config.VideoInfo.ShowFPS;
|
mnuShowFPS.Checked = ConfigManager.Config.VideoInfo.ShowFPS;
|
||||||
UpdateFpsLimitMenu();
|
UpdateEmulationSpeedMenu();
|
||||||
dxViewer.Size = VideoInfo.GetViewerSize();
|
dxViewer.Size = VideoInfo.GetViewerSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +209,7 @@ namespace Mesen.GUI.Forms
|
||||||
mnuConnect.Enabled = !netPlay;
|
mnuConnect.Enabled = !netPlay;
|
||||||
mnuDisconnect.Enabled = !mnuConnect.Enabled && !InteropEmu.IsServerRunning();
|
mnuDisconnect.Enabled = !mnuConnect.Enabled && !InteropEmu.IsServerRunning();
|
||||||
|
|
||||||
mnuFpsLimit.Enabled = !InteropEmu.IsConnected();
|
mnuEmulationSpeed.Enabled = !InteropEmu.IsConnected();
|
||||||
|
|
||||||
bool moviePlaying = InteropEmu.MoviePlaying();
|
bool moviePlaying = InteropEmu.MoviePlaying();
|
||||||
bool movieRecording = InteropEmu.MovieRecording();
|
bool movieRecording = InteropEmu.MovieRecording();
|
||||||
|
@ -278,6 +307,12 @@ namespace Mesen.GUI.Forms
|
||||||
if(keyData == Keys.Escape && _emuThread != null && mnuPause.Enabled) {
|
if(keyData == Keys.Escape && _emuThread != null && mnuPause.Enabled) {
|
||||||
PauseEmu();
|
PauseEmu();
|
||||||
return true;
|
return true;
|
||||||
|
} else if(keyData == Keys.Oemplus) {
|
||||||
|
mnuIncreaseSpeed.PerformClick();
|
||||||
|
return true;
|
||||||
|
} else if(keyData == Keys.OemMinus) {
|
||||||
|
mnuDecreaseSpeed.PerformClick();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return base.ProcessCmdKey(ref msg, keyData);
|
return base.ProcessCmdKey(ref msg, keyData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace Mesen.GUI
|
||||||
[DllImport(DLLPath)] public static extern void SetChannelVolume(UInt32 channel, double volume);
|
[DllImport(DLLPath)] public static extern void SetChannelVolume(UInt32 channel, double volume);
|
||||||
[DllImport(DLLPath)] public static extern void SetAudioLatency(UInt32 msLatency);
|
[DllImport(DLLPath)] public static extern void SetAudioLatency(UInt32 msLatency);
|
||||||
[DllImport(DLLPath)] public static extern void SetNesModel(NesModel model);
|
[DllImport(DLLPath)] public static extern void SetNesModel(NesModel model);
|
||||||
[DllImport(DLLPath)] public static extern void SetFpsLimit(Int32 fpsLimit);
|
[DllImport(DLLPath)] public static extern void SetEmulationSpeed(UInt32 emulationSpeed);
|
||||||
[DllImport(DLLPath)] public static extern void SetOverscanDimensions(UInt32 left, UInt32 right, UInt32 top, UInt32 bottom);
|
[DllImport(DLLPath)] public static extern void SetOverscanDimensions(UInt32 left, UInt32 right, UInt32 top, UInt32 bottom);
|
||||||
|
|
||||||
[DllImport(DLLPath)] public static extern void DebugInitialize();
|
[DllImport(DLLPath)] public static extern void DebugInitialize();
|
||||||
|
|
|
@ -167,7 +167,7 @@ namespace InteropEmu {
|
||||||
DllExport void __stdcall SetAudioLatency(uint32_t msLatency) { EmulationSettings::SetAudioLatency(msLatency); }
|
DllExport void __stdcall SetAudioLatency(uint32_t msLatency) { EmulationSettings::SetAudioLatency(msLatency); }
|
||||||
DllExport void __stdcall SetNesModel(uint32_t model) { EmulationSettings::SetNesModel((NesModel)model); }
|
DllExport void __stdcall SetNesModel(uint32_t model) { EmulationSettings::SetNesModel((NesModel)model); }
|
||||||
DllExport void __stdcall SetOverscanDimensions(uint32_t left, uint32_t right, uint32_t top, uint32_t bottom) { EmulationSettings::SetOverscanDimensions(left, right, top, bottom); }
|
DllExport void __stdcall SetOverscanDimensions(uint32_t left, uint32_t right, uint32_t top, uint32_t bottom) { EmulationSettings::SetOverscanDimensions(left, right, top, bottom); }
|
||||||
DllExport void __stdcall SetFpsLimit(int32_t fpsLimit) { EmulationSettings::SetFpsLimit(fpsLimit); }
|
DllExport void __stdcall SetEmulationSpeed(uint32_t emulationSpeed) { EmulationSettings::SetEmulationSpeed(emulationSpeed); }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -153,22 +153,22 @@ void SoundManager::Pause()
|
||||||
_secondaryBuffer->Stop();
|
_secondaryBuffer->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::Play()
|
void SoundManager::Stop()
|
||||||
{
|
|
||||||
_secondaryBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SoundManager::Reset()
|
|
||||||
{
|
{
|
||||||
_secondaryBuffer->Stop();
|
_secondaryBuffer->Stop();
|
||||||
ClearSecondaryBuffer();
|
ClearSecondaryBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SoundManager::Play()
|
||||||
|
{
|
||||||
|
_secondaryBuffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||||
|
}
|
||||||
|
|
||||||
void SoundManager::PlayBuffer(int16_t *soundBuffer, uint32_t soundBufferSize)
|
void SoundManager::PlayBuffer(int16_t *soundBuffer, uint32_t soundBufferSize)
|
||||||
{
|
{
|
||||||
int32_t byteLatency = (int32_t)((float)(APU::SampleRate * EmulationSettings::GetAudioLatency()) / 1000.0f * (APU::BitsPerSample / 8));
|
int32_t byteLatency = (int32_t)((float)(APU::SampleRate * EmulationSettings::GetAudioLatency()) / 1000.0f * (APU::BitsPerSample / 8));
|
||||||
if(byteLatency != _previousLatency) {
|
if(byteLatency != _previousLatency) {
|
||||||
Reset();
|
Stop();
|
||||||
_previousLatency = byteLatency;
|
_previousLatency = byteLatency;
|
||||||
}
|
}
|
||||||
DWORD status;
|
DWORD status;
|
||||||
|
|
|
@ -13,7 +13,7 @@ public:
|
||||||
void PlayBuffer(int16_t *soundBuffer, uint32_t bufferSize);
|
void PlayBuffer(int16_t *soundBuffer, uint32_t bufferSize);
|
||||||
void Play();
|
void Play();
|
||||||
void Pause();
|
void Pause();
|
||||||
void Reset();
|
void Stop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool InitializeDirectSound(HWND);
|
bool InitializeDirectSound(HWND);
|
||||||
|
|
Loading…
Add table
Reference in a new issue