commodore64: simplification and performance increase: VIC implements IVideoProvider, SID implements ISoundProvider
This commit is contained in:
parent
fef2e394e3
commit
a54df87b02
|
@ -90,7 +90,9 @@
|
|||
<Compile Include="Computers\Commodore64\PRGFile.cs" />
|
||||
<Compile Include="Computers\Commodore64\MemBus.cs" />
|
||||
<Compile Include="Computers\Commodore64\Sid.cs" />
|
||||
<Compile Include="Computers\Commodore64\SidSoundProvider.cs" />
|
||||
<Compile Include="Computers\Commodore64\VicII.cs" />
|
||||
<Compile Include="Computers\Commodore64\VicIIVideoProvider.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Atari2600.Core.cs" />
|
||||
<Compile Include="Consoles\Atari\2600\Mappers\m3Fe.cs" />
|
||||
|
|
|
@ -81,8 +81,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
videoProvider = new MyVideoProvider(vic);
|
||||
}
|
||||
|
||||
public byte PeekMemory(ushort addr)
|
||||
|
|
|
@ -37,8 +37,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
public void ClearSaveRam() { }
|
||||
public bool SaveRamModified { get; set; }
|
||||
public void Dispose() { }
|
||||
public IVideoProvider VideoProvider { get { return videoProvider; } }
|
||||
public ISoundProvider SoundProvider { get { return soundProvider; } }
|
||||
public IVideoProvider VideoProvider { get { return vic; } }
|
||||
public ISoundProvider SoundProvider { get { return sid; } }
|
||||
public void ResetFrameCounter()
|
||||
{
|
||||
_frame = 0;
|
||||
|
@ -73,23 +73,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
}
|
||||
};
|
||||
|
||||
class MySoundProvider : ISoundProvider
|
||||
{
|
||||
Atari7800 emu;
|
||||
public MySoundProvider(Atari7800 emu)
|
||||
{
|
||||
this.emu = emu;
|
||||
}
|
||||
public int MaxVolume { get { return 0; } set { } }
|
||||
public void DiscardSamples()
|
||||
{
|
||||
}
|
||||
|
||||
public void GetSamples(short[] samples)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void FrameAdvance(bool render, bool rendersound)
|
||||
{
|
||||
_frame++;
|
||||
|
@ -125,50 +108,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
{
|
||||
LagCount++;
|
||||
}
|
||||
|
||||
videoProvider.FillFrameBuffer();
|
||||
}
|
||||
|
||||
/*******************************/
|
||||
|
||||
private MySoundProvider soundProvider;
|
||||
private MyVideoProvider videoProvider;
|
||||
|
||||
class MyVideoProvider : IVideoProvider
|
||||
{
|
||||
public int top;
|
||||
public int bottom;
|
||||
public int left;
|
||||
public int right;
|
||||
|
||||
VicII vic;
|
||||
public MyVideoProvider(VicII vic)
|
||||
{
|
||||
this.vic = vic;
|
||||
|
||||
buffer = new int[vic.visibleWidth * vic.visibleHeight];
|
||||
top = 0;
|
||||
bottom = vic.visibleHeight - 1;
|
||||
left = 0;
|
||||
right = vic.visibleWidth - 1;
|
||||
}
|
||||
|
||||
int[] buffer;
|
||||
|
||||
public void FillFrameBuffer()
|
||||
{
|
||||
Array.Copy(vic.buffer, buffer, buffer.Length);
|
||||
}
|
||||
|
||||
public int[] GetVideoBuffer()
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public int VirtualWidth { get { return BufferWidth; } }
|
||||
public int BufferWidth { get { return right - left + 1; } }
|
||||
public int BufferHeight { get { return bottom - top + 1; } }
|
||||
public int BackgroundColor { get { return 0; } }
|
||||
}
|
||||
|
||||
private void SetupMemoryDomains()
|
||||
|
|
|
@ -256,7 +256,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
|
||||
}
|
||||
|
||||
public class Sid
|
||||
public partial class Sid : ISoundProvider
|
||||
{
|
||||
private int[] envRateIndex = {
|
||||
9, 32, 63, 95,
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
public partial class Sid : ISoundProvider
|
||||
{
|
||||
public void GetSamples(short[] samples)
|
||||
{
|
||||
}
|
||||
|
||||
public void DiscardSamples()
|
||||
{
|
||||
}
|
||||
|
||||
public int MaxVolume
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -451,7 +451,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
|||
DramRefresh
|
||||
}
|
||||
|
||||
public class VicII
|
||||
public partial class VicII : IVideoProvider
|
||||
{
|
||||
// graphics buffer
|
||||
public int[] buffer;
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
public partial class VicII : IVideoProvider
|
||||
{
|
||||
public int[] GetVideoBuffer()
|
||||
{
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public int VirtualWidth
|
||||
{
|
||||
get { return visibleWidth; }
|
||||
}
|
||||
|
||||
public int BufferWidth
|
||||
{
|
||||
get { return visibleWidth; }
|
||||
}
|
||||
|
||||
public int BufferHeight
|
||||
{
|
||||
get { return visibleHeight; }
|
||||
}
|
||||
|
||||
public int BackgroundColor
|
||||
{
|
||||
get { return Colors.ARGB(0, 0, 0); }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue