Move interfaces and base implemenations from emulation to emulation.common
This commit is contained in:
parent
026072ee68
commit
9751fd5a1a
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class CoreFileProvider : ICoreFileProvider
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class SaveSlotManager
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
|
||||
using LuaInterface;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class MemoryLuaLibrary : LuaLibraryBase
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using System.IO;
|
||||
using System.Globalization;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class Movie
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class MovieSession
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
|
|
@ -5,6 +5,8 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class CheatList : IEnumerable<Cheat>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public abstract class Watch
|
||||
|
|
|
@ -5,6 +5,8 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.Common
|
||||
{
|
||||
public class WatchList : IEnumerable<Watch>
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
//some helpful p/invoke from http://www.codeproject.com/KB/audio-video/Motion_Detection.aspx?msg=1142967
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Text;
|
|||
using System.Diagnostics;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.IO;
|
|||
using System.Drawing;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
public interface IVideoWriter : IDisposable
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Text;
|
|||
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
|
||||
using ICSharpCode.SharpZipLib.Zip.Compression;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -13,6 +13,7 @@ using System.Drawing.Imaging;
|
|||
//using d3d=SlimDX.Direct3D9;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
|
|
@ -3,12 +3,13 @@ using System.Drawing;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Consoles.Calculator;
|
||||
using BizHawk.Emulation.Consoles.GB;
|
||||
using BizHawk.Emulation.Consoles.Nintendo.SNES;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
partial class MainForm
|
||||
|
|
|
@ -7,6 +7,7 @@ using SlimDX.Multimedia;
|
|||
#endif
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Drawing;
|
|||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
|
|
@ -2,13 +2,14 @@
|
|||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Consoles.GB;
|
||||
using BizHawk.Emulation.Consoles.Nintendo.SNES;
|
||||
using BizHawk.Emulation.Consoles.Sega;
|
||||
using BizHawk.Emulation.Consoles.Nintendo;
|
||||
using BizHawk.Emulation.Consoles.Coleco;
|
||||
using BizHawk.Emulation.Consoles.Nintendo.N64;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -10,6 +10,7 @@ using System.IO;
|
|||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Text;
|
|||
using System.Globalization;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Windows.Forms;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Windows.Forms;
|
|||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Client.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Text;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Windows.Forms;
|
||||
|
||||
using BizHawk.Client.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
|
|
|
@ -44,6 +44,15 @@
|
|||
<Compile Include="Database\Database.cs" />
|
||||
<Compile Include="Database\FirmwareDatabase.cs" />
|
||||
<Compile Include="Database\GameInfo.cs" />
|
||||
<Compile Include="Interfaces\Base Implementations\NullController.cs" />
|
||||
<Compile Include="Interfaces\Base Implementations\NullEmulator.cs" />
|
||||
<Compile Include="Interfaces\CoreComms.cs" />
|
||||
<Compile Include="Interfaces\IController.cs" />
|
||||
<Compile Include="Interfaces\ICoreFileProvider.cs" />
|
||||
<Compile Include="Interfaces\IEmulator.cs" />
|
||||
<Compile Include="Interfaces\ISoundProvider.cs" />
|
||||
<Compile Include="Interfaces\ISyncSoundProvider.cs" />
|
||||
<Compile Include="Interfaces\IVideoProvider.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
namespace BizHawk
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public class NullController : IController
|
||||
{
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using BizHawk.Common;
|
||||
|
||||
namespace BizHawk
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public class NullEmulator : IEmulator, IVideoProvider, ISoundProvider
|
||||
{
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
namespace BizHawk
|
||||
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public class CoreComm
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BizHawk
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
// doesn't do what is desired
|
||||
// http://connect.microsoft.com/VisualStudio/feedback/details/459307/extension-add-methods-are-not-considered-in-c-collection-initializers
|
|
@ -1,6 +1,6 @@
|
|||
using System.IO;
|
||||
|
||||
namespace BizHawk
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public interface ICoreFileProvider
|
||||
{
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace BizHawk
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public interface IEmulator : IDisposable
|
||||
{
|
|
@ -0,0 +1,9 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public interface ISoundProvider
|
||||
{
|
||||
void GetSamples(short[] samples);
|
||||
void DiscardSamples();
|
||||
int MaxVolume { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
namespace BizHawk
|
||||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public interface ISyncSoundProvider
|
||||
{
|
|
@ -0,0 +1,13 @@
|
|||
namespace BizHawk.Emulation.Common
|
||||
{
|
||||
public interface IVideoProvider
|
||||
{
|
||||
int[] GetVideoBuffer();
|
||||
|
||||
int VirtualWidth { get; } // Used for controlling aspect ratio. Just return BufferWidth if you dont know what to do with this.
|
||||
|
||||
int BufferWidth { get; }
|
||||
int BufferHeight { get; }
|
||||
int BackgroundColor { get; }
|
||||
}
|
||||
}
|
|
@ -452,11 +452,6 @@
|
|||
<Compile Include="CPUs\Z80\Registers.cs" />
|
||||
<Compile Include="CPUs\Z80\Tables.cs" />
|
||||
<Compile Include="CPUs\Z80\Z80A.cs" />
|
||||
<Compile Include="Interfaces\Base Implementations\NullController.cs" />
|
||||
<Compile Include="Interfaces\Base Implementations\NullEmulator.cs" />
|
||||
<Compile Include="Interfaces\CoreComms.cs" />
|
||||
<Compile Include="Interfaces\ICoreFileProvider.cs" />
|
||||
<Compile Include="Interfaces\ISyncSoundProvider.cs" />
|
||||
<Compile Include="Properties\svnrev.cs" />
|
||||
<Compile Include="Sound\CDAudio.cs" />
|
||||
<Compile Include="Sound\MMC5Audio.cs" />
|
||||
|
@ -467,10 +462,6 @@
|
|||
<Compile Include="Sound\Utilities\SpeexResampler.cs" />
|
||||
<Compile Include="Sound\Utilities\BufferedAsync.cs" />
|
||||
<Compile Include="Sound\Utilities\Metaspu.cs" />
|
||||
<Compile Include="Interfaces\IController.cs" />
|
||||
<Compile Include="Interfaces\IEmulator.cs" />
|
||||
<Compile Include="Interfaces\ISoundProvider.cs" />
|
||||
<Compile Include="Interfaces\IVideoProvider.cs" />
|
||||
<Compile Include="Consoles\PC Engine\Input.cs" />
|
||||
<Compile Include="Consoles\PC Engine\MemoryMap.cs" />
|
||||
<Compile Include="Consoles\PC Engine\MemoryMap.SF2.cs" />
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
using BizHawk.Emulation.Computers.Commodore64.Cartridge;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Computers.Commodore64.Cartridge;
|
||||
using BizHawk.Emulation.Computers.Commodore64.Disk;
|
||||
using BizHawk.Emulation.Computers.Commodore64.MOS;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Reflection;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64
|
||||
{
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
|
||||
{
|
||||
sealed public partial class Sid
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
#pragma warning disable 649 //adelikat: Disable dumb warnings until this file is complete
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System.Drawing;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Computers.Commodore64.MOS
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Atari
|
||||
{
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
|
||||
using EMU7800.Core;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation
|
||||
{
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Emulation.Consoles.Coleco
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Coleco
|
||||
{
|
||||
public partial class ColecoVision
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.CPUs.Z80;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Coleco
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Intellivision
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Nintendo.GBA
|
||||
{
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.Sound;
|
||||
|
||||
//http://wiki.nesdev.com/w/index.php/APU_Mixer_Emulation
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
//simplifications/approximations:
|
||||
//* "Note that no commercial games rely on this mirroring -- therefore you can take the easy way out and simply give all MMC5 games 64k PRG-RAM."
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Runtime.CompilerServices;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.CPUs.M6502;
|
||||
|
||||
#pragma warning disable 162
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Nintendo
|
||||
{
|
||||
|
|
|
@ -490,9 +490,9 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
|||
get
|
||||
{
|
||||
if (api.snes_get_region() == LibsnesApi.SNES_REGION.NTSC)
|
||||
return BizHawk.DisplayType.NTSC;
|
||||
return DisplayType.NTSC;
|
||||
else
|
||||
return BizHawk.DisplayType.PAL;
|
||||
return DisplayType.PAL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Globalization;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.TurboGrafx
|
||||
{
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Emulation.Consoles.TurboGrafx
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.TurboGrafx
|
||||
{
|
||||
public partial class PCEngine
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.CPUs.H6280;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.TurboGrafx
|
||||
|
@ -46,7 +47,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
public bool SpriteCollisionInterruptEnabled { get { return (Registers[CR] & 0x01) != 0; } }
|
||||
public bool Sprite4ColorModeEnabled { get { return (Registers[MWR] & 0x0C) == 4; } }
|
||||
|
||||
public int BatWidth { get { switch((Registers[MWR] >> 4) & 3) { case 0: return 32; case 1: return 64; default: return 128; } } }
|
||||
public int BatWidth { get { switch ((Registers[MWR] >> 4) & 3) { case 0: return 32; case 1: return 64; default: return 128; } } }
|
||||
public int BatHeight { get { return ((Registers[MWR] & 0x40) == 0) ? 32 : 64; } }
|
||||
|
||||
public int RequestedFrameWidth { get { return ((Registers[HDR] & 0x3F) + 1) * 8; } }
|
||||
|
@ -125,7 +126,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
else if (port == MSB)
|
||||
{
|
||||
Registers[RegisterLatch] &= 0x00FF;
|
||||
Registers[RegisterLatch] |= (ushort) (value << 8);
|
||||
Registers[RegisterLatch] |= (ushort)(value << 8);
|
||||
CompleteMSBWrite(RegisterLatch);
|
||||
}
|
||||
}
|
||||
|
@ -141,8 +142,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
if (Registers[MAWR] < VramSize) // Several games attempt to write past the end of VRAM
|
||||
{
|
||||
VRAM[Registers[MAWR]] = Registers[VWR];
|
||||
UpdatePatternData((ushort) (Registers[MAWR] & 0x7FFF));
|
||||
UpdateSpriteData((ushort) (Registers[MAWR] & 0x7FFF));
|
||||
UpdatePatternData((ushort)(Registers[MAWR] & 0x7FFF));
|
||||
UpdateSpriteData((ushort)(Registers[MAWR] & 0x7FFF));
|
||||
}
|
||||
Registers[MAWR] += IncrementWidth;
|
||||
break;
|
||||
|
@ -194,13 +195,13 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
case 1: // unused
|
||||
return 0;
|
||||
case 2: // LSB
|
||||
return (byte) ReadBuffer;
|
||||
return (byte)ReadBuffer;
|
||||
case 3: // MSB
|
||||
retval = (byte)(ReadBuffer >> 8);
|
||||
if (RegisterLatch == VRR)
|
||||
{
|
||||
Registers[MARR] += IncrementWidth;
|
||||
ReadBuffer = VRAM[Registers[MARR]&0x7FFF];
|
||||
ReadBuffer = VRAM[Registers[MARR] & 0x7FFF];
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
@ -216,7 +217,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
int advanceDest = (Registers[DCR] & 8) == 0 ? +1 : -1;
|
||||
int wordsDone = 0;
|
||||
|
||||
for (;Registers[LENR]<0xFFFF;Registers[LENR]--,wordsDone++)
|
||||
for (; Registers[LENR] < 0xFFFF; Registers[LENR]--, wordsDone++)
|
||||
{
|
||||
VRAM[Registers[DESR] & 0x7FFF] = VRAM[Registers[SOUR] & 0x7FFF];
|
||||
UpdatePatternData(Registers[DESR]);
|
||||
|
@ -266,10 +267,10 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
|
||||
for (int x = 0; x < 8; x++)
|
||||
{
|
||||
byte pixel = (byte) ((bitplane01 >> x) & 1);
|
||||
pixel |= (byte) (((bitplane01 >> (x + 8)) & 1) << 1);
|
||||
pixel |= (byte) (((bitplane23 >> x) & 1) << 2);
|
||||
pixel |= (byte) (((bitplane23 >> (x + 8)) & 1) << 3);
|
||||
byte pixel = (byte)((bitplane01 >> x) & 1);
|
||||
pixel |= (byte)(((bitplane01 >> (x + 8)) & 1) << 1);
|
||||
pixel |= (byte)(((bitplane23 >> x) & 1) << 2);
|
||||
pixel |= (byte)(((bitplane23 >> (x + 8)) & 1) << 3);
|
||||
PatternBuffer[patternBufferBase + (7 - x)] = pixel;
|
||||
}
|
||||
}
|
||||
|
@ -278,15 +279,15 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
{
|
||||
int tileNo = addr >> 6;
|
||||
int tileOfs = addr & 0x3F;
|
||||
int bitplane = tileOfs/16;
|
||||
int bitplane = tileOfs / 16;
|
||||
int line = addr & 0x0F;
|
||||
|
||||
int ofs = (tileNo*256) + (line*16) + 15;
|
||||
int ofs = (tileNo * 256) + (line * 16) + 15;
|
||||
ushort value = VRAM[addr];
|
||||
byte bitAnd = (byte) (~(1 << bitplane));
|
||||
byte bitOr = (byte) (1 << bitplane);
|
||||
byte bitAnd = (byte)(~(1 << bitplane));
|
||||
byte bitOr = (byte)(1 << bitplane);
|
||||
|
||||
for (int i=0; i<16; i++)
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
|
||||
if ((value & 1) == 1)
|
||||
|
@ -300,7 +301,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
|
||||
public void SaveStateText(TextWriter writer, int vdcNo)
|
||||
{
|
||||
writer.WriteLine("[VDC"+vdcNo+"]");
|
||||
writer.WriteLine("[VDC" + vdcNo + "]");
|
||||
writer.Write("VRAM ");
|
||||
VRAM.SaveAsHex(writer);
|
||||
writer.Write("SAT ");
|
||||
|
@ -321,7 +322,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
writer.WriteLine("RCRCounter {0}", RCRCounter);
|
||||
writer.WriteLine("ActiveLine {0}", ActiveLine);
|
||||
|
||||
writer.WriteLine("[/VDC"+vdcNo+"]\n");
|
||||
writer.WriteLine("[/VDC" + vdcNo + "]\n");
|
||||
}
|
||||
|
||||
public void LoadStateText(TextReader reader, int vdcNo)
|
||||
|
@ -330,7 +331,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
{
|
||||
string[] args = reader.ReadLine().Split(' ');
|
||||
if (args[0].Trim() == "") continue;
|
||||
if (args[0] == "[/VDC"+vdcNo+"]") break;
|
||||
if (args[0] == "[/VDC" + vdcNo + "]") break;
|
||||
if (args[0] == "VRAM")
|
||||
VRAM.ReadFromHex(args[1]);
|
||||
else if (args[0] == "SAT")
|
||||
|
@ -376,9 +377,9 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
|
||||
public void SaveStateBinary(BinaryWriter writer)
|
||||
{
|
||||
for (int i=0; i < VRAM.Length; i++)
|
||||
for (int i = 0; i < VRAM.Length; i++)
|
||||
writer.Write(VRAM[i]);
|
||||
for (int i=0; i < SpriteAttributeTable.Length; i++)
|
||||
for (int i = 0; i < SpriteAttributeTable.Length; i++)
|
||||
writer.Write(SpriteAttributeTable[i]);
|
||||
for (int i = 0; i < Registers.Length; i++)
|
||||
writer.Write(Registers[i]);
|
||||
|
@ -398,15 +399,15 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
|
||||
public void LoadStateBinary(BinaryReader reader)
|
||||
{
|
||||
for (ushort i=0; i < VRAM.Length; i++)
|
||||
for (ushort i = 0; i < VRAM.Length; i++)
|
||||
{
|
||||
VRAM[i] = reader.ReadUInt16();
|
||||
UpdatePatternData(i);
|
||||
UpdateSpriteData(i);
|
||||
}
|
||||
for (int i=0; i < SpriteAttributeTable.Length; i++)
|
||||
for (int i = 0; i < SpriteAttributeTable.Length; i++)
|
||||
SpriteAttributeTable[i] = reader.ReadUInt16();
|
||||
for (int i=0; i < Registers.Length; i++)
|
||||
for (int i = 0; i < Registers.Length; i++)
|
||||
Registers[i] = reader.ReadUInt16();
|
||||
RegisterLatch = reader.ReadByte();
|
||||
ReadBuffer = reader.ReadUInt16();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.CPUs.H6280;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.TurboGrafx
|
||||
|
@ -20,7 +21,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
public VCE VCE;
|
||||
public HuC6280 CPU;
|
||||
|
||||
public byte[] Registers = {0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
public byte[] Registers = { 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
public int Window1Width { get { return ((Registers[3] & 3) << 8) | Registers[2]; } }
|
||||
public int Window2Width { get { return ((Registers[5] & 3) << 8) | Registers[4]; } }
|
||||
|
@ -73,7 +74,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
|||
case 0x0D: Registers[5] = value; break;
|
||||
case 0x0E:
|
||||
// CPU Store Immediate VDC Select
|
||||
CPU.WriteVDC = (value & 1) == 0 ? (Action<int,byte>) VDC1.WriteVDC : VDC2.WriteVDC;
|
||||
CPU.WriteVDC = (value & 1) == 0 ? (Action<int, byte>)VDC1.WriteVDC : VDC2.WriteVDC;
|
||||
Registers[6] = value;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Runtime.InteropServices;
|
|||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
#pragma warning disable 649 //adelikat: Disable dumb warnings until this file is complete
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.PSX
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.IO;
|
|||
using System.Globalization;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Sega
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
|
||||
public byte[] PatternBuffer = new byte[0x20000];
|
||||
public int[] Palette = new int[64];
|
||||
public int[] FrameBuffer = new int[320*224];
|
||||
public int[] FrameBuffer = new int[320 * 224];
|
||||
public int FrameWidth = 320;
|
||||
public int FrameHeight = 224;
|
||||
|
||||
|
@ -120,27 +121,31 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
if ((data & 0xC000) == 0x8000)
|
||||
{
|
||||
int reg = (data >> 8) & 0x1F;
|
||||
byte value = (byte) (data & 0xFF);
|
||||
byte value = (byte)(data & 0xFF);
|
||||
WriteVdpRegister(reg, value);
|
||||
VdpDataCode = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlWordPending = true;
|
||||
VdpDataAddr &= 0xC000;
|
||||
VdpDataAddr |= (ushort) (data & 0x3FFF);
|
||||
VdpDataAddr |= (ushort)(data & 0x3FFF);
|
||||
VdpDataCode &= 0x3C;
|
||||
VdpDataCode |= (byte) (data >> 14);
|
||||
VdpDataCode |= (byte)(data >> 14);
|
||||
//Console.WriteLine("Address = {0:X4}", VdpDataAddr);
|
||||
//Console.WriteLine("Code = {0:X2}", VdpDataCode);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlWordPending = false;
|
||||
|
||||
// Update data address and code
|
||||
VdpDataAddr &= 0x3FFF;
|
||||
VdpDataAddr |= (ushort) ((data & 0x03) << 14);
|
||||
VdpDataAddr |= (ushort)((data & 0x03) << 14);
|
||||
//Console.WriteLine("Address = {0:X4}", VdpDataAddr);
|
||||
VdpDataCode &= 0x03;
|
||||
VdpDataCode |= (byte) ((data >> 2) & 0x3C);
|
||||
VdpDataCode |= (byte)((data >> 2) & 0x3C);
|
||||
//Log.Note("VDP", "Code = {0:X2}", VdpDataCode);
|
||||
|
||||
if ((VdpDataCode & 0x20) != 0 && DmaEnabled) // DMA triggered
|
||||
|
@ -192,8 +197,8 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
switch (VdpDataCode & 0xF)
|
||||
{
|
||||
case CommandVramWrite: // VRAM Write
|
||||
VRAM[VdpDataAddr & 0xFFFE] = (byte) data;
|
||||
VRAM[(VdpDataAddr & 0xFFFE) + 1] = (byte) (data >> 8);
|
||||
VRAM[VdpDataAddr & 0xFFFE] = (byte)data;
|
||||
VRAM[(VdpDataAddr & 0xFFFE) + 1] = (byte)(data >> 8);
|
||||
//if (VdpDebug)
|
||||
Log.Note("VDP", "VRAM[{0:X4}] = {1:X4}", VdpDataAddr, data);
|
||||
UpdatePatternBuffer(VdpDataAddr & 0xFFFE);
|
||||
|
@ -204,7 +209,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
CRAM[(VdpDataAddr / 2) % 64] = data;
|
||||
//if (VdpDebug)
|
||||
Log.Note("VDP", "CRAM[{0:X2}] = {1:X4}", (VdpDataAddr / 2) % 64, data);
|
||||
ProcessPalette((VdpDataAddr/2)%64);
|
||||
ProcessPalette((VdpDataAddr / 2) % 64);
|
||||
VdpDataAddr += Registers[0x0F];
|
||||
break;
|
||||
case CommandVsramWrite: // VSRAM write
|
||||
|
@ -214,7 +219,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
VdpDataAddr += Registers[0x0F];
|
||||
break;
|
||||
default:
|
||||
Log.Error("VPD","VDP DATA WRITE WITH UNHANDLED CODE!!! {0}", VdpDataCode & 7);
|
||||
Log.Error("VPD", "VDP DATA WRITE WITH UNHANDLED CODE!!! {0}", VdpDataCode & 7);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -226,14 +231,14 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
|
||||
public ushort ReadVdpData()
|
||||
{
|
||||
int orig_addr = VdpDataAddr;
|
||||
int orig_addr = VdpDataAddr;
|
||||
ushort retval = 0xBEEF;
|
||||
switch (VdpDataCode & 0x0F)
|
||||
{
|
||||
case CommandVramRead:
|
||||
//if ((VdpDataAddr & 1) != 0) throw new Exception("VRAM read is not word-aligned. what do?");
|
||||
//if ((VdpDataAddr & 1) != 0) throw new Exception("VRAM read is not word-aligned. what do?");
|
||||
retval = VRAM[VdpDataAddr & 0xFFFE];
|
||||
retval |= (ushort) (VRAM[(VdpDataAddr & 0xFFFE) + 1] << 8);
|
||||
retval |= (ushort)(VRAM[(VdpDataAddr & 0xFFFE) + 1] << 8);
|
||||
VdpDataAddr += Registers[0x0F];
|
||||
break;
|
||||
case CommandVsramRead:
|
||||
|
@ -248,7 +253,7 @@ int orig_addr = VdpDataAddr;
|
|||
throw new Exception("VRAM read with unexpected code!!! " + (VdpDataCode & 0x0F));
|
||||
}
|
||||
|
||||
Log.Note("VDP","VDP Data Read from {0:X4} returning {1:X4}", orig_addr, retval);
|
||||
Log.Note("VDP", "VDP Data Read from {0:X4} returning {1:X4}", orig_addr, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -265,7 +270,7 @@ int orig_addr = VdpDataAddr;
|
|||
int hcounter = (488 - Native68000.Musashi.GetCyclesRemaining()) * 255 / 488;
|
||||
// FIXME: totally utterly wrong.
|
||||
|
||||
ushort res = (ushort) ((vcounter << 8) | (hcounter & 0xFF));
|
||||
ushort res = (ushort)((vcounter << 8) | (hcounter & 0xFF));
|
||||
//Console.WriteLine("READ HVC: V={0:X2} H={1:X2} ret={2:X4}", vcounter, hcounter, res);
|
||||
|
||||
return res;
|
||||
|
@ -294,25 +299,25 @@ int orig_addr = VdpDataAddr;
|
|||
break;
|
||||
|
||||
case 0x02: // Name Table Address for Layer A
|
||||
NameTableAddrA = (ushort) ((data & 0x38) << 10);
|
||||
NameTableAddrA = (ushort)((data & 0x38) << 10);
|
||||
//if (VdpDebug)
|
||||
//Log.Note("VDP", "SET NTa A = {0:X4}", NameTableAddrA);
|
||||
break;
|
||||
|
||||
case 0x03: // Name Table Address for Window
|
||||
NameTableAddrWindow = (ushort) ((data & 0x3E) << 10);
|
||||
NameTableAddrWindow = (ushort)((data & 0x3E) << 10);
|
||||
//if (VdpDebug)
|
||||
//Log.Note("VDP", "SET NTa W = {0:X4}", NameTableAddrWindow);
|
||||
break;
|
||||
|
||||
case 0x04: // Name Table Address for Layer B
|
||||
NameTableAddrB = (ushort) (data << 13);
|
||||
NameTableAddrB = (ushort)(data << 13);
|
||||
//if (VdpDebug)
|
||||
//Log.Note("VDP", "SET NTa B = {0:X4}", NameTableAddrB);
|
||||
break;
|
||||
|
||||
case 0x05: // Sprite Attribute Table Address
|
||||
SpriteAttributeTableAddr = (ushort) (data << 9);
|
||||
SpriteAttributeTableAddr = (ushort)(data << 9);
|
||||
//if (VdpDebug)
|
||||
//Log.Note("VDP", "SET SAT attr = {0:X4}", SpriteAttributeTableAddr);
|
||||
break;
|
||||
|
@ -348,18 +353,20 @@ int orig_addr = VdpDataAddr;
|
|||
// Display is 32 cells wide
|
||||
if (DisplayWidth != 32)
|
||||
{
|
||||
FrameBuffer = new int[256*224];
|
||||
FrameBuffer = new int[256 * 224];
|
||||
FrameWidth = 256;
|
||||
DisplayWidth = 32;
|
||||
SpriteLimit = 64;
|
||||
SpritePerLineLimit = 16;
|
||||
DotsPerLineLimit = 256;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Display is 40 cells wide
|
||||
if (DisplayWidth != 40)
|
||||
{
|
||||
FrameBuffer = new int[320*224];
|
||||
FrameBuffer = new int[320 * 224];
|
||||
FrameWidth = 320;
|
||||
DisplayWidth = 40;
|
||||
SpriteLimit = 80;
|
||||
|
@ -370,7 +377,7 @@ int orig_addr = VdpDataAddr;
|
|||
break;
|
||||
|
||||
case 0x0D: // H Scroll Table Address
|
||||
HScrollTableAddr = (ushort) (data << 10);
|
||||
HScrollTableAddr = (ushort)(data << 10);
|
||||
//if (VdpDebug)
|
||||
//Log.Note("VDP", "SET HScrollTab attr = {0:X4}", HScrollTableAddr);
|
||||
break;
|
||||
|
@ -388,7 +395,7 @@ int orig_addr = VdpDataAddr;
|
|||
case 2: NameTableWidth = 32; break; // invalid setting
|
||||
case 3: NameTableWidth = 128; break;
|
||||
}
|
||||
switch ((data>>4) & 0x03)
|
||||
switch ((data >> 4) & 0x03)
|
||||
{
|
||||
case 0: NameTableHeight = 32; break;
|
||||
case 1: NameTableHeight = 64; break;
|
||||
|
@ -448,8 +455,8 @@ int orig_addr = VdpDataAddr;
|
|||
|
||||
void UpdatePatternBuffer(int addr)
|
||||
{
|
||||
PatternBuffer[(addr*2) + 1] = (byte) (VRAM[addr^1] & 0x0F);
|
||||
PatternBuffer[(addr*2) + 0] = (byte) (VRAM[addr^1] >> 4);
|
||||
PatternBuffer[(addr * 2) + 1] = (byte)(VRAM[addr ^ 1] & 0x0F);
|
||||
PatternBuffer[(addr * 2) + 0] = (byte)(VRAM[addr ^ 1] >> 4);
|
||||
}
|
||||
|
||||
public int[] GetVideoBuffer()
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Emulation.Consoles.Sega
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Sega
|
||||
{
|
||||
partial class Genesis
|
||||
{
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
namespace BizHawk.Emulation.Consoles.Sega
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Sega
|
||||
{
|
||||
public partial class SMS
|
||||
{
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.CPUs.Z80;
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.DiscSystem;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
||||
|
|
|
@ -4,6 +4,8 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Sony.PSP
|
||||
{
|
||||
public class PSP : IEmulator, IVideoProvider, ISyncSoundProvider
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
namespace BizHawk
|
||||
{
|
||||
public interface ISoundProvider
|
||||
{
|
||||
void GetSamples(short[] samples);
|
||||
void DiscardSamples();
|
||||
int MaxVolume { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
namespace BizHawk
|
||||
{
|
||||
public interface IVideoProvider
|
||||
{
|
||||
int[] GetVideoBuffer();
|
||||
|
||||
int VirtualWidth { get; } // Used for controlling aspect ratio. Just return BufferWidth if you dont know what to do with this.
|
||||
|
||||
int BufferWidth { get; }
|
||||
int BufferHeight { get; }
|
||||
int BackgroundColor { get; }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
using BizHawk.Emulation.DiscSystem;
|
||||
|
||||
// The state of the cd player is quantized to the frame level.
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Globalization;
|
|||
using System.IO;
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Sound
|
||||
{
|
||||
|
@ -47,7 +48,7 @@ namespace BizHawk.Emulation.Sound
|
|||
{
|
||||
MaxVolume = short.MaxValue;
|
||||
Waves.InitWaves();
|
||||
for (int i=0; i<8; i++)
|
||||
for (int i = 0; i < 8; i++)
|
||||
Channels[i] = new PSGChannel();
|
||||
}
|
||||
|
||||
|
@ -68,7 +69,7 @@ namespace BizHawk.Emulation.Sound
|
|||
|
||||
public void WritePSG(byte register, byte value, long cycles)
|
||||
{
|
||||
commands.Enqueue(new QueuedCommand { Register = register, Value = value, Time = cycles-frameStartTime });
|
||||
commands.Enqueue(new QueuedCommand { Register = register, Value = value, Time = cycles - frameStartTime });
|
||||
}
|
||||
|
||||
public void WritePSGImmediate(int register, byte value)
|
||||
|
@ -77,11 +78,11 @@ namespace BizHawk.Emulation.Sound
|
|||
switch (register)
|
||||
{
|
||||
case 0: // Set Voice Latch
|
||||
VoiceLatch = (byte) (value & 7);
|
||||
VoiceLatch = (byte)(value & 7);
|
||||
break;
|
||||
case 1: // Global Volume select;
|
||||
MainVolumeLeft = (byte) ((value >> 4) & 0x0F);
|
||||
MainVolumeRight = (byte) (value & 0x0F);
|
||||
MainVolumeLeft = (byte)((value >> 4) & 0x0F);
|
||||
MainVolumeRight = (byte)(value & 0x0F);
|
||||
break;
|
||||
case 2: // Frequency LSB
|
||||
Channels[VoiceLatch].Frequency &= 0xFF00;
|
||||
|
@ -93,7 +94,7 @@ namespace BizHawk.Emulation.Sound
|
|||
Channels[VoiceLatch].Frequency &= 0x0FFF;
|
||||
break;
|
||||
case 4: // Voice Volume
|
||||
Channels[VoiceLatch].Volume = (byte) (value & 0x1F);
|
||||
Channels[VoiceLatch].Volume = (byte)(value & 0x1F);
|
||||
Channels[VoiceLatch].Enabled = (value & 0x80) != 0;
|
||||
Channels[VoiceLatch].DDA = (value & 0x40) != 0;
|
||||
if (Channels[VoiceLatch].Enabled == false && Channels[VoiceLatch].DDA)
|
||||
|
@ -105,9 +106,11 @@ namespace BizHawk.Emulation.Sound
|
|||
case 6: // Wave data
|
||||
if (Channels[VoiceLatch].DDA == false)
|
||||
{
|
||||
Channels[VoiceLatch].Wave[WaveTableWriteOffset++] = (short) ((value*2047) - 32767);
|
||||
Channels[VoiceLatch].Wave[WaveTableWriteOffset++] = (short)((value * 2047) - 32767);
|
||||
WaveTableWriteOffset &= 31;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Channels[VoiceLatch].DDAValue = (short)((value * 2047) - 32767);
|
||||
}
|
||||
break;
|
||||
|
@ -115,7 +118,7 @@ namespace BizHawk.Emulation.Sound
|
|||
Channels[VoiceLatch].NoiseChannel = ((value & 0x80) != 0) && VoiceLatch >= 4;
|
||||
if ((value & 0x1F) == 0x1F)
|
||||
value &= 0xFE;
|
||||
Channels[VoiceLatch].NoiseFreq = (ushort) (PsgBase/(64*(0x1F - (value & 0x1F))));
|
||||
Channels[VoiceLatch].NoiseFreq = (ushort)(PsgBase / (64 * (0x1F - (value & 0x1F))));
|
||||
break;
|
||||
case 8: // LFO
|
||||
// TODO: implement LFO
|
||||
|
@ -125,7 +128,8 @@ namespace BizHawk.Emulation.Sound
|
|||
{
|
||||
Console.WriteLine("**************** LFO ON !!!!!!!!!! *****************");
|
||||
Channels[1].Enabled = false;
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
Channels[1].Enabled = true;
|
||||
}
|
||||
|
@ -136,12 +140,12 @@ namespace BizHawk.Emulation.Sound
|
|||
public void DiscardSamples() { }
|
||||
public void GetSamples(short[] samples)
|
||||
{
|
||||
int elapsedCycles = (int) (frameStopTime - frameStartTime);
|
||||
int elapsedCycles = (int)(frameStopTime - frameStartTime);
|
||||
int start = 0;
|
||||
while (commands.Count > 0)
|
||||
{
|
||||
var cmd = commands.Dequeue();
|
||||
int pos = (int) ((cmd.Time * samples.Length) / elapsedCycles) & ~1;
|
||||
int pos = (int)((cmd.Time * samples.Length) / elapsedCycles) & ~1;
|
||||
MixSamples(samples, start, pos - start);
|
||||
start = pos;
|
||||
WritePSGImmediate(cmd.Register, cmd.Value);
|
||||
|
@ -167,9 +171,13 @@ namespace BizHawk.Emulation.Sound
|
|||
{
|
||||
wave = Waves.NoiseWave;
|
||||
freq = channel.NoiseFreq;
|
||||
} else if (channel.DDA) {
|
||||
}
|
||||
else if (channel.DDA)
|
||||
{
|
||||
freq = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (channel.Frequency <= 1) return;
|
||||
freq = PsgBase / (32 * ((int)channel.Frequency));
|
||||
}
|
||||
|
@ -188,14 +196,14 @@ namespace BizHawk.Emulation.Sound
|
|||
if (volumeRight < 0)
|
||||
volumeRight = 0;
|
||||
|
||||
float adjustedWaveLengthInSamples = SampleRate / (channel.NoiseChannel ? freq/(float)(channel.Wave.Length*128) : freq);
|
||||
float adjustedWaveLengthInSamples = SampleRate / (channel.NoiseChannel ? freq / (float)(channel.Wave.Length * 128) : freq);
|
||||
float moveThroughWaveRate = wave.Length / adjustedWaveLengthInSamples;
|
||||
|
||||
int end = start + len;
|
||||
for (int i=start; i<end;)
|
||||
for (int i = start; i < end; )
|
||||
{
|
||||
channel.SampleOffset %= wave.Length;
|
||||
short value = channel.DDA ? channel.DDAValue : wave[(int) channel.SampleOffset];
|
||||
short value = channel.DDA ? channel.DDAValue : wave[(int)channel.SampleOffset];
|
||||
|
||||
samples[i++] += (short)(value * LogScale[volumeLeft] / 255f / 6f * MaxVolume / short.MaxValue);
|
||||
samples[i++] += (short)(value * LogScale[volumeRight] / 255f / 6f * MaxVolume / short.MaxValue);
|
||||
|
@ -215,24 +223,24 @@ namespace BizHawk.Emulation.Sound
|
|||
writer.WriteLine("WaveTableWriteOffset {0:X2}", WaveTableWriteOffset);
|
||||
writer.WriteLine();
|
||||
|
||||
for (int i = 0; i<6; i++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
writer.WriteLine("[Channel{0}]",i+1);
|
||||
writer.WriteLine("[Channel{0}]", i + 1);
|
||||
writer.WriteLine("Frequency {0:X4}", Channels[i].Frequency);
|
||||
writer.WriteLine("Panning {0:X2}", Channels[i].Panning);
|
||||
writer.WriteLine("Volume {0:X2}", Channels[i].Volume);
|
||||
writer.WriteLine("Enabled {0}", Channels[i].Enabled);
|
||||
if (i.In(4,5))
|
||||
if (i.In(4, 5))
|
||||
{
|
||||
writer.WriteLine("NoiseChannel {0}", Channels[i].NoiseChannel);
|
||||
writer.WriteLine("NoiseFreq {0:X4}", Channels[i].NoiseFreq);
|
||||
}
|
||||
writer.WriteLine("DDA {0}",Channels[i].DDA);
|
||||
writer.WriteLine("DDA {0}", Channels[i].DDA);
|
||||
writer.WriteLine("DDAValue {0:X4}", Channels[i].DDAValue);
|
||||
writer.WriteLine("SampleOffset {0}", Channels[i].SampleOffset);
|
||||
writer.Write("Wave ");
|
||||
Channels[i].Wave.SaveAsHex(writer);
|
||||
writer.WriteLine("[/Channel{0}]\n",i+1);
|
||||
writer.WriteLine("[/Channel{0}]\n", i + 1);
|
||||
}
|
||||
|
||||
writer.WriteLine("[/PSG]\n");
|
||||
|
@ -276,7 +284,7 @@ namespace BizHawk.Emulation.Sound
|
|||
{
|
||||
string[] args = reader.ReadLine().Split(' ');
|
||||
if (args[0].Trim() == "") continue;
|
||||
if (args[0] == "[/Channel"+(channel+1)+"]") break;
|
||||
if (args[0] == "[/Channel" + (channel + 1) + "]") break;
|
||||
if (args[0] == "Frequency")
|
||||
Channels[channel].Frequency = ushort.Parse(args[1], NumberStyles.HexNumber);
|
||||
else if (args[0] == "Panning")
|
||||
|
@ -332,7 +340,7 @@ namespace BizHawk.Emulation.Sound
|
|||
VoiceLatch = reader.ReadByte();
|
||||
WaveTableWriteOffset = reader.ReadByte();
|
||||
|
||||
for (int i=0; i<6; i++)
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
Channels[i].Frequency = reader.ReadUInt16();
|
||||
Channels[i].Panning = reader.ReadByte();
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
// Emulates a Texas Instruments SN76489
|
||||
// TODO the freq->note translation should be moved to a separate utility class.
|
||||
|
||||
|
@ -57,7 +59,7 @@ namespace BizHawk.Emulation.Sound
|
|||
{
|
||||
MaxVolume = short.MaxValue * 2 / 3;
|
||||
Waves.InitWaves();
|
||||
for (int i=0; i<4; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Channels[i] = new Channel();
|
||||
switch (i)
|
||||
|
@ -104,7 +106,7 @@ namespace BizHawk.Emulation.Sound
|
|||
|
||||
public void WritePsgData(byte value, int cycles)
|
||||
{
|
||||
commands.Enqueue(new QueuedCommand {Value = value, Time = cycles-frameStartTime});
|
||||
commands.Enqueue(new QueuedCommand { Value = value, Time = cycles - frameStartTime });
|
||||
}
|
||||
|
||||
void UpdateNoiseType(int value)
|
||||
|
@ -155,16 +157,18 @@ namespace BizHawk.Emulation.Sound
|
|||
PsgLatch = value;
|
||||
break;
|
||||
default:
|
||||
byte channel = (byte) ((PsgLatch & 0x60) >> 5);
|
||||
byte channel = (byte)((PsgLatch & 0x60) >> 5);
|
||||
if ((PsgLatch & 16) == 0) // Tone latched
|
||||
{
|
||||
int f = PsgBase/(((value & 0x03F)*16) + (PsgLatch & 0x0F) + 1);
|
||||
int f = PsgBase / (((value & 0x03F) * 16) + (PsgLatch & 0x0F) + 1);
|
||||
if (f > 15000)
|
||||
f = 0; // upper bound of playable frequency
|
||||
Channels[channel].Frequency = (ushort) f;
|
||||
Channels[channel].Frequency = (ushort)f;
|
||||
if ((Channels[3].NoiseType & 3) == 3 && channel == 2)
|
||||
Channels[3].Frequency = (ushort) f;
|
||||
} else { // volume latched
|
||||
Channels[3].Frequency = (ushort)f;
|
||||
}
|
||||
else
|
||||
{ // volume latched
|
||||
Channels[channel].Volume = (byte)(~value & 15);
|
||||
}
|
||||
break;
|
||||
|
@ -429,8 +433,8 @@ namespace BizHawk.Emulation.Sound
|
|||
while (commands.Count > 0)
|
||||
{
|
||||
var cmd = commands.Dequeue();
|
||||
int pos = ((cmd.Time*samples.Length)/elapsedCycles) & ~1;
|
||||
GetSamplesImmediate(samples, start, pos-start);
|
||||
int pos = ((cmd.Time * samples.Length) / elapsedCycles) & ~1;
|
||||
GetSamplesImmediate(samples, start, pos - start);
|
||||
start = pos;
|
||||
WritePsgDataImmediate(cmd.Value);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Sound
|
||||
{
|
||||
// Generates SEMI-synchronous sound, or "buffered asynchronous" sound.
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Sound.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Sound
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Sound
|
||||
{
|
||||
|
|
|
@ -4,6 +4,8 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Sound.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
// TODO This should eventually be replaced, due to 1) uncertain licensing terms 2) This is not a native C# implementation, but a naive port.
|
||||
|
||||
using BizHawk.Common;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Sound
|
||||
{
|
||||
|
|
|
@ -3,6 +3,8 @@ using System.Diagnostics;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Emulation.Sound
|
||||
{
|
||||
// ======================================================================
|
||||
|
|
Loading…
Reference in New Issue