From 4e6a063c65623c9261019b5c0b2f90678d09a62c Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 30 Apr 2017 01:16:33 -0400 Subject: [PATCH] NSF: Added icons for recording/fast forward/slow motion + fixed a couple of UI bugs --- Core/Console.cpp | 2 +- GUI.NET/Controls/ctrlNsfPlayer.Designer.cs | 157 +++++++++++++++++++++ GUI.NET/Controls/ctrlNsfPlayer.cs | 8 +- GUI.NET/Dependencies/resources.es.xml | 3 + GUI.NET/Dependencies/resources.fr.xml | 3 + GUI.NET/Dependencies/resources.ja.xml | 3 + GUI.NET/Dependencies/resources.pt.xml | 3 + GUI.NET/Dependencies/resources.ru.xml | 3 + GUI.NET/Dependencies/resources.uk.xml | 3 + GUI.NET/Forms/frmMain.cs | 1 + GUI.NET/InteropEmu.cs | 3 + InteropDLL/ConsoleWrapper.cpp | 1 + 12 files changed, 188 insertions(+), 2 deletions(-) diff --git a/Core/Console.cpp b/Core/Console.cpp index a0fa58a5..faed6c52 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -346,7 +346,7 @@ void Console::Run() uint32_t currentFrameNumber = PPU::GetFrameCount(); if(currentFrameNumber != lastFrameNumber) { _rewindManager->ProcessEndOfFrame(); - EmulationSettings::DisableOverclocking(_disableOcNextFrame); + EmulationSettings::DisableOverclocking(_disableOcNextFrame || NsfMapper::GetInstance()); _disableOcNextFrame = false; lastFrameNumber = PPU::GetFrameCount(); diff --git a/GUI.NET/Controls/ctrlNsfPlayer.Designer.cs b/GUI.NET/Controls/ctrlNsfPlayer.Designer.cs index e47f9bc0..bad70bc6 100644 --- a/GUI.NET/Controls/ctrlNsfPlayer.Designer.cs +++ b/GUI.NET/Controls/ctrlNsfPlayer.Designer.cs @@ -55,12 +55,26 @@ this.lblTime = new System.Windows.Forms.Label(); this.tmrFastForward = new System.Windows.Forms.Timer(this.components); this.toolTip = new System.Windows.Forms.ToolTip(this.components); + this.lblRecording = new System.Windows.Forms.Label(); + this.lblRecordingDot = new System.Windows.Forms.Label(); + this.lblFastForward = new System.Windows.Forms.Label(); + this.lblFastForwardIcon = new System.Windows.Forms.Label(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.panel2 = new System.Windows.Forms.Panel(); + this.panel3 = new System.Windows.Forms.Panel(); + this.lblSlowMotion = new System.Windows.Forms.Label(); + this.lblSlowMotionIcon = new System.Windows.Forms.Label(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.picBackground)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.trkVolume)).BeginInit(); this.flowLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.panel1.SuspendLayout(); + this.panel2.SuspendLayout(); + this.panel3.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 @@ -432,11 +446,136 @@ this.tmrFastForward.Interval = 500; this.tmrFastForward.Tick += new System.EventHandler(this.tmrFastForward_Tick); // + // lblRecording + // + this.lblRecording.AutoSize = true; + this.lblRecording.ForeColor = System.Drawing.Color.Red; + this.lblRecording.Location = new System.Drawing.Point(15, 4); + this.lblRecording.Margin = new System.Windows.Forms.Padding(0); + this.lblRecording.Name = "lblRecording"; + this.lblRecording.Size = new System.Drawing.Size(29, 13); + this.lblRecording.TabIndex = 9; + this.lblRecording.Text = "REC"; + // + // lblRecordingDot + // + this.lblRecordingDot.AutoSize = true; + this.lblRecordingDot.BackColor = System.Drawing.Color.Transparent; + this.lblRecordingDot.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblRecordingDot.ForeColor = System.Drawing.Color.Red; + this.lblRecordingDot.Location = new System.Drawing.Point(1, 0); + this.lblRecordingDot.Margin = new System.Windows.Forms.Padding(0); + this.lblRecordingDot.Name = "lblRecordingDot"; + this.lblRecordingDot.Size = new System.Drawing.Size(17, 18); + this.lblRecordingDot.TabIndex = 10; + this.lblRecordingDot.Text = "●"; + // + // lblFastForward + // + this.lblFastForward.AutoSize = true; + this.lblFastForward.ForeColor = System.Drawing.Color.RoyalBlue; + this.lblFastForward.Location = new System.Drawing.Point(14, 4); + this.lblFastForward.Margin = new System.Windows.Forms.Padding(0); + this.lblFastForward.Name = "lblFastForward"; + this.lblFastForward.Size = new System.Drawing.Size(68, 13); + this.lblFastForward.TabIndex = 11; + this.lblFastForward.Text = "Fast Forward"; + // + // lblFastForwardIcon + // + this.lblFastForwardIcon.AutoSize = true; + this.lblFastForwardIcon.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblFastForwardIcon.ForeColor = System.Drawing.Color.RoyalBlue; + this.lblFastForwardIcon.Location = new System.Drawing.Point(0, 0); + this.lblFastForwardIcon.Margin = new System.Windows.Forms.Padding(0); + this.lblFastForwardIcon.Name = "lblFastForwardIcon"; + this.lblFastForwardIcon.Size = new System.Drawing.Size(17, 18); + this.lblFastForwardIcon.TabIndex = 12; + this.lblFastForwardIcon.Text = "»"; + // + // tableLayoutPanel4 + // + this.tableLayoutPanel4.ColumnCount = 1; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Controls.Add(this.panel3, 0, 2); + this.tableLayoutPanel4.Controls.Add(this.panel2, 0, 0); + this.tableLayoutPanel4.Controls.Add(this.panel1, 0, 1); + this.tableLayoutPanel4.Location = new System.Drawing.Point(5, 5); + this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 4; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel4.Size = new System.Drawing.Size(121, 60); + this.tableLayoutPanel4.TabIndex = 13; + // + // panel1 + // + this.panel1.AutoSize = true; + this.panel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.panel1.Controls.Add(this.lblFastForward); + this.panel1.Controls.Add(this.lblFastForwardIcon); + this.panel1.Location = new System.Drawing.Point(0, 18); + this.panel1.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(82, 18); + this.panel1.TabIndex = 0; + // + // panel2 + // + this.panel2.AutoSize = true; + this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.panel2.Controls.Add(this.lblRecordingDot); + this.panel2.Controls.Add(this.lblRecording); + this.panel2.Location = new System.Drawing.Point(0, 0); + this.panel2.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(44, 18); + this.panel2.TabIndex = 1; + // + // panel3 + // + this.panel3.AutoSize = true; + this.panel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.panel3.Controls.Add(this.lblSlowMotion); + this.panel3.Controls.Add(this.lblSlowMotionIcon); + this.panel3.Location = new System.Drawing.Point(0, 36); + this.panel3.Margin = new System.Windows.Forms.Padding(0); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(79, 18); + this.panel3.TabIndex = 2; + // + // lblSlowMotion + // + this.lblSlowMotion.AutoSize = true; + this.lblSlowMotion.ForeColor = System.Drawing.Color.DarkOrange; + this.lblSlowMotion.Location = new System.Drawing.Point(14, 4); + this.lblSlowMotion.Margin = new System.Windows.Forms.Padding(0); + this.lblSlowMotion.Name = "lblSlowMotion"; + this.lblSlowMotion.Size = new System.Drawing.Size(65, 13); + this.lblSlowMotion.TabIndex = 11; + this.lblSlowMotion.Text = "Slow Motion"; + // + // lblSlowMotionIcon + // + this.lblSlowMotionIcon.AutoSize = true; + this.lblSlowMotionIcon.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblSlowMotionIcon.ForeColor = System.Drawing.Color.DarkOrange; + this.lblSlowMotionIcon.Location = new System.Drawing.Point(0, 0); + this.lblSlowMotionIcon.Margin = new System.Windows.Forms.Padding(0); + this.lblSlowMotionIcon.Name = "lblSlowMotionIcon"; + this.lblSlowMotionIcon.Size = new System.Drawing.Size(17, 18); + this.lblSlowMotionIcon.TabIndex = 12; + this.lblSlowMotionIcon.Text = "«"; + // // ctrlNsfPlayer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; + this.Controls.Add(this.tableLayoutPanel4); this.Controls.Add(this.tableLayoutPanel1); this.Name = "ctrlNsfPlayer"; this.Size = new System.Drawing.Size(371, 281); @@ -451,6 +590,14 @@ ((System.ComponentModel.ISupportInitialize)(this.trkVolume)).EndInit(); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel4.PerformLayout(); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); this.ResumeLayout(false); } @@ -484,5 +631,15 @@ private System.Windows.Forms.Label lblTime; private System.Windows.Forms.Timer tmrFastForward; private System.Windows.Forms.ToolTip toolTip; + private System.Windows.Forms.Label lblRecording; + private System.Windows.Forms.Label lblRecordingDot; + private System.Windows.Forms.Label lblFastForward; + private System.Windows.Forms.Label lblFastForwardIcon; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Label lblSlowMotion; + private System.Windows.Forms.Label lblSlowMotionIcon; } } diff --git a/GUI.NET/Controls/ctrlNsfPlayer.cs b/GUI.NET/Controls/ctrlNsfPlayer.cs index a132a842..4adfd526 100644 --- a/GUI.NET/Controls/ctrlNsfPlayer.cs +++ b/GUI.NET/Controls/ctrlNsfPlayer.cs @@ -33,7 +33,9 @@ namespace Mesen.GUI.Controls private void Child_KeyUp(object sender, KeyEventArgs e) { - StopFastForward(); + if((e.KeyCode == Keys.Right || e.KeyCode == Keys.Control) && _fastForwarding) { + StopFastForward(); + } } public void UpdateVolume() @@ -78,6 +80,10 @@ namespace Mesen.GUI.Controls label += Environment.NewLine + (string.IsNullOrWhiteSpace(trackNames[currentTrack]) ? ResourceHelper.GetMessage("NsfUnnamedTrack") : trackNames[currentTrack]); } + lblRecording.Visible = lblRecordingDot.Visible = InteropEmu.WaveIsRecording(); + lblFastForward.Visible = lblFastForwardIcon.Visible = InteropEmu.GetEmulationSpeed() > 100 || InteropEmu.GetEmulationSpeed() == 0 || InteropEmu.CheckFlag(EmulationFlags.Turbo); + lblSlowMotion.Visible = lblSlowMotionIcon.Visible = InteropEmu.GetEmulationSpeed() < 100 && InteropEmu.GetEmulationSpeed() > 0 && !InteropEmu.CheckFlag(EmulationFlags.Turbo); + lblTime.Text = label; } diff --git a/GUI.NET/Dependencies/resources.es.xml b/GUI.NET/Dependencies/resources.es.xml index 0a8f3961..ed78bb48 100644 --- a/GUI.NET/Dependencies/resources.es.xml +++ b/GUI.NET/Dependencies/resources.es.xml @@ -102,6 +102,9 @@ Artista Copyright Chip de audio + REC + Slow Motion + Fast Forward
Cerrar diff --git a/GUI.NET/Dependencies/resources.fr.xml b/GUI.NET/Dependencies/resources.fr.xml index e69a68c0..b7d61cc7 100644 --- a/GUI.NET/Dependencies/resources.fr.xml +++ b/GUI.NET/Dependencies/resources.fr.xml @@ -102,6 +102,9 @@ Artiste Copyright Puces audio + ENR + Ralenti + Avance rapide
Fermer diff --git a/GUI.NET/Dependencies/resources.ja.xml b/GUI.NET/Dependencies/resources.ja.xml index 2a471e95..d4e47b8a 100644 --- a/GUI.NET/Dependencies/resources.ja.xml +++ b/GUI.NET/Dependencies/resources.ja.xml @@ -102,6 +102,9 @@ 作者 コピーライト 音源チップ + 録音中 + スローモーション + 早送り
閉じる diff --git a/GUI.NET/Dependencies/resources.pt.xml b/GUI.NET/Dependencies/resources.pt.xml index e21020b1..d8d22112 100644 --- a/GUI.NET/Dependencies/resources.pt.xml +++ b/GUI.NET/Dependencies/resources.pt.xml @@ -102,6 +102,9 @@ Artista Copyright Chip de áudio + REC + Slow Motion + Fast Forward
Encerrar diff --git a/GUI.NET/Dependencies/resources.ru.xml b/GUI.NET/Dependencies/resources.ru.xml index 9993c910..e77416d1 100644 --- a/GUI.NET/Dependencies/resources.ru.xml +++ b/GUI.NET/Dependencies/resources.ru.xml @@ -102,6 +102,9 @@ Автор Copyright Звуковые чипы + REC + Slow Motion + Fast Forward
Закрыть diff --git a/GUI.NET/Dependencies/resources.uk.xml b/GUI.NET/Dependencies/resources.uk.xml index 89e7b3cf..4fa4bcfc 100644 --- a/GUI.NET/Dependencies/resources.uk.xml +++ b/GUI.NET/Dependencies/resources.uk.xml @@ -102,6 +102,9 @@ Автор Copyright Звукові чіпи + REC + Slow Motion + Fast Forward
Закрити diff --git a/GUI.NET/Forms/frmMain.cs b/GUI.NET/Forms/frmMain.cs index b43171f3..b454cd54 100644 --- a/GUI.NET/Forms/frmMain.cs +++ b/GUI.NET/Forms/frmMain.cs @@ -687,6 +687,7 @@ namespace Mesen.GUI.Forms bool aviRecording = InteropEmu.AviIsRecording(); mnuAviRecord.Enabled = _emuThread != null && !aviRecording; mnuAviStop.Enabled = _emuThread != null && aviRecording; + mnuVideoRecorder.Enabled = !_isNsfPlayerMode; bool testRecording = InteropEmu.RomTestRecording(); mnuTestRun.Enabled = !netPlay && !moviePlaying && !movieRecording; diff --git a/GUI.NET/InteropEmu.cs b/GUI.NET/InteropEmu.cs index f515e95e..a562af73 100644 --- a/GUI.NET/InteropEmu.cs +++ b/GUI.NET/InteropEmu.cs @@ -128,6 +128,7 @@ namespace Mesen.GUI [DllImport(DLLPath)] public static extern void SetCheats([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]InteropCheatInfo[] cheats, UInt32 length); + [DllImport(DLLPath)] public static extern bool CheckFlag(EmulationFlags flag); [DllImport(DLLPath)] private static extern void SetFlags(EmulationFlags flags); [DllImport(DLLPath)] private static extern void ClearFlags(EmulationFlags flags); [DllImport(DLLPath)] public static extern void SetRamPowerOnState(RamPowerOnState state); @@ -983,7 +984,9 @@ namespace Mesen.GUI UseNes101Hvc101Behavior = 0x100000000, + Turbo = 0x2000000000, InBackground = 0x4000000000, + NsfPlayerEnabled = 0x8000000000, DisplayMovieIcons = 0x10000000000, HidePauseOverlay = 0x20000000000, diff --git a/InteropDLL/ConsoleWrapper.cpp b/InteropDLL/ConsoleWrapper.cpp index 5af1c531..2ee59b9b 100644 --- a/InteropDLL/ConsoleWrapper.cpp +++ b/InteropDLL/ConsoleWrapper.cpp @@ -361,6 +361,7 @@ namespace InteropEmu { DllExport void __stdcall SetCheats(CheatInfo cheats[], uint32_t length) { CheatManager::SetCheats(cheats, length); } + DllExport bool __stdcall CheckFlag(EmulationFlags flags) { return EmulationSettings::CheckFlag(flags); } DllExport void __stdcall SetFlags(EmulationFlags flags) { EmulationSettings::SetFlags(flags); } DllExport void __stdcall ClearFlags(EmulationFlags flags) { EmulationSettings::ClearFlags(flags); } DllExport void __stdcall SetRamPowerOnState(RamPowerOnState state) { EmulationSettings::SetRamPowerOnState(state); }