NSF: Added support for history viewer

This commit is contained in:
Sour 2018-12-26 13:28:17 -05:00
parent 8c27322d85
commit de7ded3139
11 changed files with 157 additions and 138 deletions

View file

@ -274,7 +274,7 @@ uint16_t CPU::FetchOperand()
_console->BreakIfDebugging();
if(NsfMapper::GetInstance()) {
if(_console->IsNsf()) {
//Don't stop emulation on CPU crash when playing NSFs, reset cpu instead
_console->Reset(true);
return 0;

View file

@ -589,7 +589,7 @@ void Console::ResetComponents(bool softReset)
_debugHud->ClearScreen();
_memoryManager->Reset(softReset);
if(!_settings->CheckFlag(EmulationFlags::DisablePpuReset) || !softReset || NsfMapper::GetInstance()) {
if(!_settings->CheckFlag(EmulationFlags::DisablePpuReset) || !softReset || IsNsf()) {
_ppu->Reset();
}
_apu->Reset(softReset);
@ -674,7 +674,7 @@ void Console::RunSingleFrame()
}
}
_settings->DisableOverclocking(_disableOcNextFrame || NsfMapper::GetInstance());
_settings->DisableOverclocking(_disableOcNextFrame || IsNsf());
_disableOcNextFrame = false;
_systemActionManager->ProcessSystemActions();
@ -743,7 +743,7 @@ void Console::Run()
_historyViewer->ProcessEndOfFrame();
}
_rewindManager->ProcessEndOfFrame();
_settings->DisableOverclocking(_disableOcNextFrame || NsfMapper::GetInstance());
_settings->DisableOverclocking(_disableOcNextFrame || IsNsf());
_disableOcNextFrame = false;
//Update model (ntsc/pal) and get delay for next frame
@ -1315,6 +1315,11 @@ bool Console::IsRecordingTapeFile()
return false;
}
bool Console::IsNsf()
{
return std::dynamic_pointer_cast<NsfMapper>(_mapper) != nullptr;
}
void Console::CopyRewindData(shared_ptr<Console> sourceConsole)
{
sourceConsole->Pause();

View file

@ -168,6 +168,7 @@ public:
void StartRecordingTapeFile(string filepath);
void StopRecordingTapeFile();
bool IsRecordingTapeFile();
bool IsNsf();
std::thread::id GetEmulationThreadId();

View file

@ -5,25 +5,14 @@
#include "Console.h"
#include "MemoryManager.h"
NsfMapper* NsfMapper::_instance;
NsfMapper::NsfMapper()
{
_instance = this;
}
NsfMapper::~NsfMapper()
{
if(_instance == this) {
_instance = nullptr;
_console->GetSettings()->DisableOverclocking(false);
_console->GetSettings()->ClearFlags(EmulationFlags::NsfPlayerEnabled);
}
}
NsfMapper * NsfMapper::GetInstance()
{
return _instance;
_console->GetSettings()->DisableOverclocking(false);
_console->GetSettings()->ClearFlags(EmulationFlags::NsfPlayerEnabled);
}
void NsfMapper::InitMapper()

View file

@ -18,8 +18,6 @@ enum class NsfIrqType
class NsfMapper : public BaseMapper
{
private:
static NsfMapper *_instance;
enum NsfSoundChips
{
VRC6 = 0x01,
@ -121,8 +119,6 @@ public:
NsfMapper();
~NsfMapper();
static NsfMapper* GetInstance();
void SetNesModel(NesModel model) override;
ConsoleFeatures GetAvailableFeatures() override;

View file

@ -61,18 +61,18 @@
this.lblFastForward = new System.Windows.Forms.Label();
this.lblFastForwardIcon = new System.Windows.Forms.Label();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.panel4 = new System.Windows.Forms.Panel();
this.lblRewinding = new System.Windows.Forms.Label();
this.lblRewindIcon = new System.Windows.Forms.Label();
this.panel2 = new System.Windows.Forms.Panel();
this.panel1 = 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.panel2 = new System.Windows.Forms.Panel();
this.panel1 = new System.Windows.Forms.Panel();
this.tlpRepeatShuffle = new System.Windows.Forms.TableLayoutPanel();
this.picRepeat = new System.Windows.Forms.PictureBox();
this.picShuffle = new System.Windows.Forms.PictureBox();
this.tmrUpdate = new System.Windows.Forms.Timer(this.components);
this.panel4 = new System.Windows.Forms.Panel();
this.lblRewinding = new System.Windows.Forms.Label();
this.lblRewindIcon = new System.Windows.Forms.Label();
this.tlpMain.SuspendLayout();
this.tlpNsfInfo.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
@ -81,13 +81,13 @@
this.pnlBackground.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picBackground)).BeginInit();
this.tableLayoutPanel4.SuspendLayout();
this.panel3.SuspendLayout();
this.panel4.SuspendLayout();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
this.panel3.SuspendLayout();
this.tlpRepeatShuffle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picRepeat)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.picShuffle)).BeginInit();
this.panel4.SuspendLayout();
this.SuspendLayout();
//
// tlpMain
@ -535,6 +535,65 @@
this.tableLayoutPanel4.Size = new System.Drawing.Size(121, 85);
this.tableLayoutPanel4.TabIndex = 13;
//
// panel4
//
this.panel4.AutoSize = true;
this.panel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel4.Controls.Add(this.lblRewinding);
this.panel4.Controls.Add(this.lblRewindIcon);
this.panel4.Location = new System.Drawing.Point(0, 36);
this.panel4.Margin = new System.Windows.Forms.Padding(0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(71, 18);
this.panel4.TabIndex = 3;
//
// lblRewinding
//
this.lblRewinding.AutoSize = true;
this.lblRewinding.ForeColor = System.Drawing.Color.DarkOrange;
this.lblRewinding.Location = new System.Drawing.Point(14, 4);
this.lblRewinding.Margin = new System.Windows.Forms.Padding(0);
this.lblRewinding.Name = "lblRewinding";
this.lblRewinding.Size = new System.Drawing.Size(57, 13);
this.lblRewinding.TabIndex = 11;
this.lblRewinding.Text = "Rewinding";
//
// lblRewindIcon
//
this.lblRewindIcon.AutoSize = true;
this.lblRewindIcon.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblRewindIcon.ForeColor = System.Drawing.Color.DarkOrange;
this.lblRewindIcon.Location = new System.Drawing.Point(0, 0);
this.lblRewindIcon.Margin = new System.Windows.Forms.Padding(0);
this.lblRewindIcon.Name = "lblRewindIcon";
this.lblRewindIcon.Size = new System.Drawing.Size(17, 18);
this.lblRewindIcon.TabIndex = 12;
this.lblRewindIcon.Text = "«";
//
// 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);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(44, 18);
this.panel2.TabIndex = 1;
//
// 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);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(82, 18);
this.panel1.TabIndex = 0;
//
// panel3
//
this.panel3.AutoSize = true;
@ -570,30 +629,6 @@
this.lblSlowMotionIcon.TabIndex = 12;
this.lblSlowMotionIcon.Text = "«";
//
// 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);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(44, 18);
this.panel2.TabIndex = 1;
//
// 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);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(82, 18);
this.panel1.TabIndex = 0;
//
// tlpRepeatShuffle
//
this.tlpRepeatShuffle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@ -642,41 +677,6 @@
this.tmrUpdate.Interval = 250;
this.tmrUpdate.Tick += new System.EventHandler(this.tmrUpdate_Tick);
//
// panel4
//
this.panel4.AutoSize = true;
this.panel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panel4.Controls.Add(this.lblRewinding);
this.panel4.Controls.Add(this.lblRewindIcon);
this.panel4.Location = new System.Drawing.Point(0, 36);
this.panel4.Margin = new System.Windows.Forms.Padding(0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(71, 18);
this.panel4.TabIndex = 3;
//
// lblRewinding
//
this.lblRewinding.AutoSize = true;
this.lblRewinding.ForeColor = System.Drawing.Color.DarkOrange;
this.lblRewinding.Location = new System.Drawing.Point(14, 4);
this.lblRewinding.Margin = new System.Windows.Forms.Padding(0);
this.lblRewinding.Name = "lblRewinding";
this.lblRewinding.Size = new System.Drawing.Size(57, 13);
this.lblRewinding.TabIndex = 11;
this.lblRewinding.Text = "Rewinding";
//
// lblRewindIcon
//
this.lblRewindIcon.AutoSize = true;
this.lblRewindIcon.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblRewindIcon.ForeColor = System.Drawing.Color.DarkOrange;
this.lblRewindIcon.Location = new System.Drawing.Point(0, 0);
this.lblRewindIcon.Margin = new System.Windows.Forms.Padding(0);
this.lblRewindIcon.Name = "lblRewindIcon";
this.lblRewindIcon.Size = new System.Drawing.Size(17, 18);
this.lblRewindIcon.TabIndex = 12;
this.lblRewindIcon.Text = "«";
//
// ctrlNsfPlayer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -701,17 +701,17 @@
((System.ComponentModel.ISupportInitialize)(this.picBackground)).EndInit();
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.tlpRepeatShuffle.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picRepeat)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.picShuffle)).EndInit();
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.ResumeLayout(false);
}

View file

@ -122,6 +122,12 @@ namespace Mesen.GUI.Controls
NsfHeader header = InteropEmu.NsfGetHeader();
int currentTrack = InteropEmu.NsfGetCurrentTrack();
if(currentTrack != cboTrack.SelectedIndex) {
cboTrack.SelectedIndexChanged -= cboTrack_SelectedIndexChanged;
cboTrack.SelectedIndex = currentTrack;
cboTrack.SelectedIndexChanged += cboTrack_SelectedIndexChanged;
}
TimeSpan time = TimeSpan.FromSeconds((double)elapsedFrames / ((header.Flags & 0x01) == 0x01 ? 50.006978 : 60.098812));
string label = time.ToString(time.TotalHours < 1 ? @"mm\:ss" : @"hh\:mm\:ss");
@ -135,10 +141,11 @@ namespace Mesen.GUI.Controls
label += Environment.NewLine + (string.IsNullOrWhiteSpace(trackNames[currentTrack]) ? ResourceHelper.GetMessage("NsfUnnamedTrack") : trackNames[currentTrack]);
}
bool rewinding = InteropEmu.IsRewinding();
lblRecording.Visible = lblRecordingDot.Visible = InteropEmu.WaveIsRecording();
lblRewinding.Visible = lblRewindIcon.Visible = InteropEmu.IsRewinding();
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);
lblRewinding.Visible = lblRewindIcon.Visible = rewinding;
lblFastForward.Visible = lblFastForwardIcon.Visible = (InteropEmu.GetEmulationSpeed() > 100 || InteropEmu.GetEmulationSpeed() == 0 || InteropEmu.CheckFlag(EmulationFlags.Turbo)) && !rewinding;
lblSlowMotion.Visible = lblSlowMotionIcon.Visible = InteropEmu.GetEmulationSpeed() < 100 && InteropEmu.GetEmulationSpeed() > 0 && !InteropEmu.CheckFlag(EmulationFlags.Turbo) && !rewinding;
lblTime.Text = label;
}

View file

@ -33,7 +33,7 @@
this.btnPausePlay = new System.Windows.Forms.Button();
this.lblPosition = new System.Windows.Forms.Label();
this.pnlRenderer = new System.Windows.Forms.Panel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.tlpRenderer = new System.Windows.Forms.TableLayoutPanel();
this.ctrlRenderer = new System.Windows.Forms.Panel();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.lblVolume = new System.Windows.Forms.Label();
@ -47,13 +47,15 @@
this.mnuResumeGameplay = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
this.mnuClose = new System.Windows.Forms.ToolStripMenuItem();
this.picNsfIcon = new System.Windows.Forms.PictureBox();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trkPosition)).BeginInit();
this.pnlRenderer.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.tlpRenderer.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trkVolume)).BeginInit();
this.menuStrip2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picNsfIcon)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanel1
@ -74,16 +76,16 @@
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(532, 477);
this.tableLayoutPanel1.Size = new System.Drawing.Size(557, 454);
this.tableLayoutPanel1.TabIndex = 0;
//
// trkPosition
//
this.trkPosition.Dock = System.Windows.Forms.DockStyle.Top;
this.trkPosition.LargeChange = 10;
this.trkPosition.Location = new System.Drawing.Point(56, 429);
this.trkPosition.Location = new System.Drawing.Point(56, 406);
this.trkPosition.Name = "trkPosition";
this.trkPosition.Size = new System.Drawing.Size(312, 45);
this.trkPosition.Size = new System.Drawing.Size(337, 45);
this.trkPosition.TabIndex = 1;
this.trkPosition.TickFrequency = 10;
this.trkPosition.TickStyle = System.Windows.Forms.TickStyle.Both;
@ -93,7 +95,7 @@
//
this.btnPausePlay.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.btnPausePlay.Image = global::Mesen.GUI.Properties.Resources.Play;
this.btnPausePlay.Location = new System.Drawing.Point(3, 433);
this.btnPausePlay.Location = new System.Drawing.Point(3, 410);
this.btnPausePlay.Name = "btnPausePlay";
this.btnPausePlay.Size = new System.Drawing.Size(47, 36);
this.btnPausePlay.TabIndex = 2;
@ -103,7 +105,7 @@
//
this.lblPosition.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.lblPosition.AutoSize = true;
this.lblPosition.Location = new System.Drawing.Point(374, 445);
this.lblPosition.Location = new System.Drawing.Point(399, 422);
this.lblPosition.MinimumSize = new System.Drawing.Size(49, 13);
this.lblPosition.Name = "lblPosition";
this.lblPosition.Size = new System.Drawing.Size(49, 13);
@ -116,33 +118,34 @@
this.pnlRenderer.BackColor = System.Drawing.Color.Black;
this.pnlRenderer.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tableLayoutPanel1.SetColumnSpan(this.pnlRenderer, 4);
this.pnlRenderer.Controls.Add(this.tableLayoutPanel2);
this.pnlRenderer.Controls.Add(this.picNsfIcon);
this.pnlRenderer.Controls.Add(this.tlpRenderer);
this.pnlRenderer.Dock = System.Windows.Forms.DockStyle.Fill;
this.pnlRenderer.Location = new System.Drawing.Point(3, 3);
this.pnlRenderer.Name = "pnlRenderer";
this.pnlRenderer.Size = new System.Drawing.Size(526, 420);
this.pnlRenderer.Size = new System.Drawing.Size(551, 397);
this.pnlRenderer.TabIndex = 0;
//
// tableLayoutPanel2
// tlpRenderer
//
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Controls.Add(this.ctrlRenderer, 0, 0);
this.tableLayoutPanel2.Cursor = System.Windows.Forms.Cursors.Hand;
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(524, 418);
this.tableLayoutPanel2.TabIndex = 0;
this.tableLayoutPanel2.MouseClick += new System.Windows.Forms.MouseEventHandler(this.ctrlRenderer_MouseClick);
this.tlpRenderer.ColumnCount = 1;
this.tlpRenderer.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpRenderer.Controls.Add(this.ctrlRenderer, 0, 0);
this.tlpRenderer.Cursor = System.Windows.Forms.Cursors.Hand;
this.tlpRenderer.Dock = System.Windows.Forms.DockStyle.Fill;
this.tlpRenderer.Location = new System.Drawing.Point(0, 0);
this.tlpRenderer.Margin = new System.Windows.Forms.Padding(0);
this.tlpRenderer.Name = "tlpRenderer";
this.tlpRenderer.RowCount = 1;
this.tlpRenderer.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpRenderer.Size = new System.Drawing.Size(549, 395);
this.tlpRenderer.TabIndex = 0;
this.tlpRenderer.MouseClick += new System.Windows.Forms.MouseEventHandler(this.ctrlRenderer_MouseClick);
//
// ctrlRenderer
//
this.ctrlRenderer.Anchor = System.Windows.Forms.AnchorStyles.None;
this.ctrlRenderer.Location = new System.Drawing.Point(134, 89);
this.ctrlRenderer.Location = new System.Drawing.Point(146, 77);
this.ctrlRenderer.Margin = new System.Windows.Forms.Padding(0);
this.ctrlRenderer.Name = "ctrlRenderer";
this.ctrlRenderer.Size = new System.Drawing.Size(256, 240);
@ -156,7 +159,7 @@
this.tableLayoutPanel3.Controls.Add(this.lblVolume, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.trkVolume, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(429, 429);
this.tableLayoutPanel3.Location = new System.Drawing.Point(454, 406);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 2;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 31F));
@ -199,7 +202,7 @@
this.mnuFile});
this.menuStrip2.Location = new System.Drawing.Point(0, 0);
this.menuStrip2.Name = "menuStrip2";
this.menuStrip2.Size = new System.Drawing.Size(532, 24);
this.menuStrip2.Size = new System.Drawing.Size(557, 24);
this.menuStrip2.TabIndex = 1;
this.menuStrip2.Text = "menuStrip2";
//
@ -257,11 +260,24 @@
this.mnuClose.Text = "Close";
this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
//
// picNsfIcon
//
this.picNsfIcon.Anchor = System.Windows.Forms.AnchorStyles.None;
this.picNsfIcon.BackgroundImage = global::Mesen.GUI.Properties.Resources.NsfBackground;
this.picNsfIcon.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.picNsfIcon.Location = new System.Drawing.Point(199, 152);
this.picNsfIcon.Margin = new System.Windows.Forms.Padding(0);
this.picNsfIcon.MaximumSize = new System.Drawing.Size(500, 90);
this.picNsfIcon.Name = "picNsfIcon";
this.picNsfIcon.Size = new System.Drawing.Size(150, 90);
this.picNsfIcon.TabIndex = 6;
this.picNsfIcon.TabStop = false;
//
// frmHistoryViewer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(532, 501);
this.ClientSize = new System.Drawing.Size(557, 478);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.menuStrip2);
this.MinimumSize = new System.Drawing.Size(331, 384);
@ -271,12 +287,13 @@
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trkPosition)).EndInit();
this.pnlRenderer.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tlpRenderer.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trkVolume)).EndInit();
this.menuStrip2.ResumeLayout(false);
this.menuStrip2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picNsfIcon)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -298,10 +315,11 @@
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem mnuClose;
private System.Windows.Forms.ToolStripMenuItem mnuResumeGameplay;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TableLayoutPanel tlpRenderer;
private System.Windows.Forms.Panel ctrlRenderer;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Label lblVolume;
private System.Windows.Forms.TrackBar trkVolume;
private System.Windows.Forms.PictureBox picNsfIcon;
}
}

View file

@ -16,6 +16,7 @@ namespace Mesen.GUI.Forms
{
private Thread _emuThread;
private bool _paused = true;
private bool _isNsf = false;
public frmHistoryViewer()
{
@ -34,6 +35,10 @@ namespace Mesen.GUI.Forms
this.Location = ConfigManager.Config.HistoryViewerInfo.WindowLocation.Value;
}
_isNsf = InteropEmu.IsNsf();
tlpRenderer.Visible = !_isNsf;
picNsfIcon.Visible = _isNsf;
trkVolume.Value = ConfigManager.Config.HistoryViewerInfo.Volume;
}
@ -197,7 +202,7 @@ namespace Mesen.GUI.Forms
}
mnuImportMovie.Visible = false;
mnuExportMovie.Enabled = mnuExportMovie.HasDropDownItems;
mnuExportMovie.Enabled = mnuExportMovie.HasDropDownItems && !_isNsf;
}
private void btnPausePlay_Click(object sender, EventArgs e)

View file

@ -1131,7 +1131,7 @@ namespace Mesen.GUI.Forms
mnuStopMovie.Enabled = running && !netPlay && (moviePlaying || movieRecording);
mnuRecordMovie.Enabled = running && !moviePlaying && !movieRecording && !isNetPlayClient;
mnuGameConfig.Enabled = !moviePlaying && !movieRecording;
mnuHistoryViewer.Enabled = running && !InteropEmu.IsNsf() && InteropEmu.HistoryViewerEnabled();
mnuHistoryViewer.Enabled = running && InteropEmu.HistoryViewerEnabled();
bool waveRecording = InteropEmu.WaveIsRecording();
mnuWaveRecord.Enabled = running && !waveRecording;

View file

@ -670,27 +670,25 @@ namespace InteropEmu {
DllExport ConsoleFeatures __stdcall GetAvailableFeatures() { return _console->GetAvailableFeatures(); }
//NSF functions
DllExport bool __stdcall IsNsf() { return NsfMapper::GetInstance() != nullptr; }
DllExport uint32_t __stdcall NsfGetFrameCount() {
if(NsfMapper::GetInstance()) {
return _console->GetPpu()->GetFrameCount();
}
return 0;
}
DllExport bool __stdcall IsNsf() { return _console->IsNsf(); }
DllExport uint32_t __stdcall NsfGetFrameCount() { return _console->GetPpu()->GetFrameCount(); }
DllExport void __stdcall NsfSelectTrack(uint8_t trackNumber) {
if(NsfMapper::GetInstance()) {
NsfMapper::GetInstance()->SelectTrack(trackNumber);
NsfMapper* nsfMapper = dynamic_cast<NsfMapper*>(_console->GetMapper());
if(nsfMapper) {
nsfMapper->SelectTrack(trackNumber);
}
}
DllExport int32_t __stdcall NsfGetCurrentTrack() {
if(NsfMapper::GetInstance()) {
return NsfMapper::GetInstance()->GetCurrentTrack();
NsfMapper* nsfMapper = dynamic_cast<NsfMapper*>(_console->GetMapper());
if(nsfMapper) {
return nsfMapper->GetCurrentTrack();
}
return -1;
}
DllExport void __stdcall NsfGetHeader(NsfHeader* header) {
if(NsfMapper::GetInstance()) {
*header = NsfMapper::GetInstance()->GetNsfHeader();
NsfMapper* nsfMapper = dynamic_cast<NsfMapper*>(_console->GetMapper());
if(nsfMapper) {
*header = nsfMapper->GetNsfHeader();
}
}
DllExport void __stdcall NsfSetNsfConfig(int32_t autoDetectSilenceDelay, int32_t moveToNextTrackTime, bool disableApuIrqs) {