NSF EPSG Support

This commit is contained in:
Perkka2 2021-01-30 15:12:39 +01:00
parent 5203ff1217
commit 85586aaa35
5 changed files with 41 additions and 5 deletions

View file

@ -87,9 +87,12 @@ void NsfLoader::InitializeFromHeader(RomData &romData)
if(header.SoundChips & 0x10) {
chips.push_back("Namco 163");
}
if(header.SoundChips & 0x20) {
if (header.SoundChips & 0x20) {
chips.push_back("Sunsoft 5B");
}
if (header.SoundChips & 0x40) {
chips.push_back("EPSG");
}
if(chips.empty()) {
chips.push_back("<none>");
}

View file

@ -27,6 +27,7 @@ void NsfMapper::InitMapper()
_fdsAudio.reset(new FdsAudio(_console));
_namcoAudio.reset(new Namco163Audio(_console));
_sunsoftAudio.reset(new Sunsoft5bAudio(_console));
_epsgAudio.reset(new EPSGAudio(_console));
SetCpuMemoryMapping(0x3F00, 0x3FFF, PrgMemoryType::WorkRam, 0x2000, MemoryAccessType::Read);
memcpy(GetWorkRam() + 0x2000, _nsfBios, 0x100);
@ -107,6 +108,10 @@ void NsfMapper::InitMapper(RomData& romData)
if(_nsfHeader.SoundChips & NsfSoundChips::FDS) {
AddRegisterRange(0x4040, 0x4092, MemoryOperation::Any);
}
if(_nsfHeader.SoundChips & NsfSoundChips::EPSG) {
AddRegisterRange(0x4016, 0x4016, MemoryOperation::Write);
}
}
void NsfMapper::Reset(bool softReset)
@ -272,6 +277,9 @@ void NsfMapper::ProcessCpuClock()
if(_nsfHeader.SoundChips & NsfSoundChips::FDS) {
_fdsAudio->Clock();
}
if (_nsfHeader.SoundChips & NsfSoundChips::EPSG) {
_epsgAudio->Clock();
}
}
uint8_t NsfMapper::ReadRegister(uint16_t addr)
@ -400,6 +408,10 @@ void NsfMapper::WriteRegister(uint16_t addr, uint8_t value)
_vrc7Audio->WriteRegister(addr, value);
break;
case 0x4016:
_epsgAudio->WriteRegister(addr, value);
break;
}
}
}
@ -478,10 +490,11 @@ void NsfMapper::StreamState(bool saving)
SnapshotInfo fdsAudio { _fdsAudio.get() };
SnapshotInfo namcoAudio { _namcoAudio.get() };
SnapshotInfo sunsoftAudio { _sunsoftAudio.get() };
SnapshotInfo epsgAudio{ _epsgAudio.get() };
Stream(
_model, _needInit, _irqEnabled, _irqReloadValue, _irqCounter, _irqStatus, _debugIrqStatus, _mmc5MultiplierValues[0], _mmc5MultiplierValues[1],
_trackEndCounter, _trackFadeCounter, _fadeLength, _silenceDetectDelay, _trackEnded, _allowSilenceDetection, _hasBankSwitching, _ntscSpeed,
_palSpeed, _dendySpeed, _songNumber, mmc5Audio, vrc6Audio, vrc7Audio, fdsAudio, namcoAudio, sunsoftAudio
_palSpeed, _dendySpeed, _songNumber, mmc5Audio, vrc6Audio, vrc7Audio, fdsAudio, namcoAudio, sunsoftAudio, epsgAudio
);
}

View file

@ -6,6 +6,7 @@
#include "FdsAudio.h"
#include "Namco163Audio.h"
#include "Sunsoft5bAudio.h"
#include "EPSGAudio.h"
enum class NsfIrqType
{
@ -25,7 +26,8 @@ private:
FDS = 0x04,
MMC5 = 0x08,
Namco = 0x10,
Sunsoft = 0x20
Sunsoft = 0x20,
EPSG = 0x40
};
NesModel _model;
@ -37,6 +39,7 @@ private:
unique_ptr<FdsAudio> _fdsAudio;
unique_ptr<Namco163Audio> _namcoAudio;
unique_ptr<Sunsoft5bAudio> _sunsoftAudio;
unique_ptr<EPSGAudio> _epsgAudio;
bool _needInit = false;
bool _irqEnabled = false;

View file

@ -46,6 +46,7 @@
this.lblSunsoft = new System.Windows.Forms.Label();
this.lblVrc6 = new System.Windows.Forms.Label();
this.lblVrc7 = new System.Windows.Forms.Label();
this.lblEpsg = new System.Windows.Forms.Label();
this.lblSoundChips = new System.Windows.Forms.Label();
this.trkVolume = new System.Windows.Forms.TrackBar();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
@ -253,7 +254,7 @@
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 6;
this.tableLayoutPanel3.ColumnCount = 7;
this.tlpNsfInfo.SetColumnSpan(this.tableLayoutPanel3, 2);
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
@ -267,6 +268,7 @@
this.tableLayoutPanel3.Controls.Add(this.lblSunsoft, 3, 0);
this.tableLayoutPanel3.Controls.Add(this.lblVrc6, 4, 0);
this.tableLayoutPanel3.Controls.Add(this.lblVrc7, 5, 0);
this.tableLayoutPanel3.Controls.Add(this.lblEpsg, 6, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(101, 66);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
@ -355,6 +357,19 @@
this.lblVrc7.TabIndex = 3;
this.lblVrc7.Text = "VRC7";
//
// lblEpsg
//
this.lblEpsg.AutoSize = true;
this.lblEpsg.BackColor = System.Drawing.Color.Transparent;
this.lblEpsg.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblEpsg.ForeColor = System.Drawing.Color.White;
this.lblEpsg.Location = new System.Drawing.Point(220, 0);
this.lblEpsg.Margin = new System.Windows.Forms.Padding(0);
this.lblEpsg.Name = "lblEpsg";
this.lblEpsg.Size = new System.Drawing.Size(35, 13);
this.lblEpsg.TabIndex = 3;
this.lblEpsg.Text = "EPSG";
//
// lblSoundChips
//
this.lblSoundChips.AutoSize = true;
@ -728,6 +743,7 @@
private System.Windows.Forms.Label lblSunsoft;
private System.Windows.Forms.Label lblVrc6;
private System.Windows.Forms.Label lblVrc7;
private System.Windows.Forms.Label lblEpsg;
private System.Windows.Forms.Label lblMmc5;
private System.Windows.Forms.Label lblNamco;
private System.Windows.Forms.Label lblFds;

View file

@ -274,8 +274,9 @@ namespace Mesen.GUI.Controls
lblMmc5.ForeColor = (header.SoundChips & 0x08) == 0x08 ? Color.White : Color.Gray;
lblNamco.ForeColor = (header.SoundChips & 0x10) == 0x10 ? Color.White : Color.Gray;
lblSunsoft.ForeColor = (header.SoundChips & 0x20) == 0x20 ? Color.White : Color.Gray;
lblEpsg.ForeColor = (header.SoundChips & 0x40) == 0x40 ? Color.White : Color.Gray;
if(InteropEmu.IsPaused()) {
if (InteropEmu.IsPaused()) {
btnPause.Image = Properties.Resources.Play;
} else {
btnPause.Image = Properties.Resources.Pause;