commodore64: more savestate work, volume register in SID now actually affects volume level

This commit is contained in:
saxxonpike 2012-11-19 21:18:16 +00:00
parent fddbf1197b
commit 6bf640c4bc
2 changed files with 30 additions and 18 deletions

View File

@ -11,23 +11,37 @@ namespace BizHawk.Emulation.Computers.Commodore64
public void ClearSaveRam()
{
}
public void LoadStateBinary(BinaryReader br)
{
}
public void LoadStateText(TextReader reader)
{
Dictionary<string, StateParameters> state = new Dictionary<string, StateParameters>();
}
public byte[] ReadSaveRam()
{
return null;
}
// TODO: when disk support is finished, set this flag according to if any writes to disk were done
public bool SaveRamModified
{
get;
set;
get
{
return false;
}
set
{
}
}
public void SaveStateBinary(BinaryWriter bw)
{
}
public void SaveStateText(TextWriter writer)
{
@ -37,13 +51,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
}
}
public class State
{
private Dictionary<string, StateParameters> paramList = new Dictionary<string, StateParameters>();
}
public class StateParameters
{
private Dictionary<string, int> integerList = new Dictionary<string, int>();
@ -109,10 +116,11 @@ namespace BizHawk.Emulation.Computers.Commodore64
public void ImportText(Stream source)
{
StreamReader reader = new StreamReader(source);
string line = "";
while (!reader.EndOfStream)
while (!reader.EndOfStream && !(line.Contains("[") && line.Contains("]")))
{
string line = reader.ReadLine();
line = reader.ReadLine();
int equalsIndex = line.IndexOf("=");
if (equalsIndex >= 0 && equalsIndex < (line.Length - 1))

View File

@ -9,6 +9,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
{
private short[] sampleBuffer;
private int sampleBufferCapacity;
private int sampleBufferCount;
private int sampleBufferIndex;
private int sampleBufferReadIndex;
private int sampleCounter;
@ -21,15 +22,16 @@ namespace BizHawk.Emulation.Computers.Commodore64
public short[] GetAllSamples()
{
List<short> samples = new List<short>();
while (sampleBufferReadIndex != sampleBufferIndex)
if (sampleBufferCount > 0)
{
samples.Add(sampleBuffer[sampleBufferReadIndex]);
sampleBufferReadIndex++;
if (sampleBufferReadIndex == sampleBufferCapacity)
sampleBufferReadIndex = 0;
short[] samples = new short[sampleBufferCount];
GetSamples(samples);
return samples;
}
else
{
return new short[] { };
}
return samples.ToArray();
}
public void GetSamples(short[] samples)
@ -49,6 +51,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
// catch buffer up
sampleBufferReadIndex = sampleBufferIndex;
sampleBufferCount = 0;
}
private void InitSound(int initSampleRate)
@ -106,6 +109,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
for (int i = 0; i < 2; i++)
{
sampleBufferIndex++;
sampleBufferCount++;
if (sampleBufferIndex == sampleBufferCapacity)
sampleBufferIndex = 0;
sampleBuffer[sampleBufferIndex] = output;