APU_MMC5移植完成,nes20db.xml移到工程根目录,避免打包
This commit is contained in:
parent
8952b842b1
commit
d668f7d8df
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31d7b6b33f06e3d468b409ab9e71bf1f
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,5 +1,6 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using UnityEngine;
|
||||
using VirtualNes.Core;
|
||||
@ -74,8 +75,8 @@ namespace AxibugEmuOnline.Client
|
||||
var db = Resources.Load<RomDB>("NES/ROMDB");
|
||||
db.Clear();
|
||||
|
||||
var dbFile = Resources.Load<TextAsset>("NES/nes20db");
|
||||
var xml = XDocument.Parse(dbFile.text);
|
||||
var xmlStr = File.ReadAllText("nes20db.xml");
|
||||
var xml = XDocument.Parse(xmlStr);
|
||||
var games = xml.Element("nes20db").Elements("game");
|
||||
foreach (var game in games)
|
||||
{
|
||||
@ -84,9 +85,11 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
var mapper = int.Parse($"{game.Element("pcb").Attribute("mapper").Value}");
|
||||
|
||||
if (mapper > 255) continue;
|
||||
db.AddInfo(new RomDB.RomInfo { CRC = crc, Mapper = mapper });
|
||||
}
|
||||
|
||||
UnityEditor.EditorUtility.SetDirty(db);
|
||||
UnityEditor.AssetDatabase.SaveAssets();
|
||||
}
|
||||
#endif
|
||||
|
@ -7,6 +7,12 @@ namespace VirtualNes.Core
|
||||
private FDSSOUND fds = new FDSSOUND();
|
||||
private FDSSOUND fds_sync = new FDSSOUND();
|
||||
|
||||
public APU_FDS()
|
||||
{
|
||||
fds.ZeroMemory();
|
||||
fds_sync.ZeroMemory();
|
||||
}
|
||||
|
||||
public override void Reset(float fClock, int nRate)
|
||||
{
|
||||
//todo : 实现
|
||||
@ -94,6 +100,36 @@ namespace VirtualNes.Core
|
||||
public int now_volume;
|
||||
public int now_freq;
|
||||
public int output;
|
||||
|
||||
public void ZeroMemory()
|
||||
{
|
||||
Array.Clear(reg, 0, reg.Length);
|
||||
volenv_mode = 0;
|
||||
volenv_gain = 0;
|
||||
volenv_decay = 0;
|
||||
volenv_phaseacc = 0.0;
|
||||
swpenv_mode = 0;
|
||||
swpenv_gain = 0;
|
||||
swpenv_decay = 0;
|
||||
swpenv_phaseacc = 0.0;
|
||||
envelope_enable = 0;
|
||||
envelope_speed = 0;
|
||||
wave_setup = 0;
|
||||
master_volume = 0;
|
||||
Array.Clear(main_wavetable, 0, main_wavetable.Length);
|
||||
main_enable = 0;
|
||||
main_frequency = 0;
|
||||
main_addr = 0;
|
||||
Array.Clear(lfo_wavetable, 0, lfo_wavetable.Length);
|
||||
lfo_enable = 0;
|
||||
lfo_frequency = 0;
|
||||
lfo_addr = 0;
|
||||
lfo_phaseacc = 0.0;
|
||||
sweep_bias = 0;
|
||||
now_volume = 0;
|
||||
now_freq = 0;
|
||||
output = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,6 +270,35 @@ namespace VirtualNes.Core
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override int GetFreq(int channel)
|
||||
{
|
||||
if (channel == 0 || channel == 1)
|
||||
{
|
||||
RECTANGLE ch = null;
|
||||
if (channel == 0) ch = ch0;
|
||||
else ch = ch1;
|
||||
|
||||
if (ch.enable == 0 || ch.vbl_length <= 0)
|
||||
return 0;
|
||||
if (ch.freq < INT2FIX(8))
|
||||
return 0;
|
||||
if (ch.fixed_envelope != 0)
|
||||
{
|
||||
if (ch.volume == 0)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((0x0F - ch.env_vol) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int)(256.0f * cpu_clock / (FIX2INT(ch.freq) * 16.0f));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int RectangleRender(RECTANGLE ch)
|
||||
{
|
||||
if (ch.enable == 0 || ch.vbl_length <= 0)
|
||||
|
Loading…
Reference in New Issue
Block a user