saturn emulator. for the moment, try loading any unknown .cue file. when you do so, the saturn core will attempt to load "D:\encodes\saturnimages\Castlevania SOTN.iso"

This commit is contained in:
goyuken 2013-04-30 21:28:35 +00:00
parent 65ce29ce40
commit d2fecaa172
6 changed files with 264 additions and 0 deletions

View File

@ -357,6 +357,8 @@
<Compile Include="Consoles\Sega\Genesis\Cart\RomHeader.cs" />
<Compile Include="Consoles\Sega\Genesis\Cart\SaveRAM.cs" />
<Compile Include="Consoles\Sega\Genesis\Input.cs" />
<Compile Include="Consoles\Sega\Saturn\LibYabause.cs" />
<Compile Include="Consoles\Sega\Saturn\Yabause.cs" />
<Compile Include="Consoles\Sega\SMS\MemoryMap.CodeMasters.cs" />
<Compile Include="Consoles\Sega\SMS\MemoryMap.Sega.cs" />
<Compile Include="Consoles\Sega\SMS\VDP.ModeTMS.cs" />

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace BizHawk.Emulation.Consoles.Sega.Saturn
{
public static class LibYabause
{
/// <summary>
/// set video buffer
/// </summary>
/// <param name="buff">704x512x32bit, should persist over time</param>
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void libyabause_setvidbuff(IntPtr buff);
/// <summary>
/// soft reset, or something like that
/// </summary>
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void libyabause_softreset();
/// <summary>
///
/// </summary>
/// <param name="w">width of framebuffer</param>
/// <param name="h">height of framebuffer</param>
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void libyabause_frameadvance(out int w, out int h);
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void libyabause_deinit();
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool libyabause_init();
}
}

View File

@ -0,0 +1,205 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace BizHawk.Emulation.Consoles.Sega.Saturn
{
public class Yabause : IEmulator, IVideoProvider, ISyncSoundProvider
{
public static ControllerDefinition SaturnController = new ControllerDefinition
{
Name = "Saturn Controller",
BoolButtons =
{
"Up", "Down", "Left", "Right", "Start", "Z", "Y", "X", "B", "A", "L", "R"
}
};
static Yabause AttachedCore = null;
GCHandle VideoHandle;
public Yabause(CoreComm CoreComm)
{
CoreComm.RomStatusDetails = "Yeh";
this.CoreComm = CoreComm;
Init();
}
void Init()
{
if (AttachedCore != null)
{
AttachedCore.Dispose();
AttachedCore = null;
}
VideoHandle = GCHandle.Alloc(VideoBuffer, GCHandleType.Pinned);
if (!LibYabause.libyabause_init())
throw new Exception("libyabause_init() failed!");
LibYabause.libyabause_setvidbuff(VideoHandle.AddrOfPinnedObject());
AttachedCore = this;
}
public ControllerDefinition ControllerDefinition
{
get { return SaturnController; }
}
public IController Controller { get; set; }
public void FrameAdvance(bool render, bool rendersound = true)
{
int w, h;
LibYabause.libyabause_frameadvance(out w, out h);
BufferWidth = w;
BufferHeight = h;
Frame++;
LagCount++;
}
public int Frame
{
get;
private set;
}
public int LagCount
{
get;
set;
}
public bool IsLagFrame
{
get { return true; }
}
public string SystemId
{
get { return "SAT"; }
}
public bool DeterministicEmulation
{
get { return true; }
}
public byte[] ReadSaveRam()
{
return new byte[0];
}
public void StoreSaveRam(byte[] data)
{
}
public void ClearSaveRam()
{
}
public bool SaveRamModified
{
get;
set;
}
public void ResetFrameCounter()
{
Frame = 0;
LagCount = 0;
}
public void SaveStateText(System.IO.TextWriter writer)
{
}
public void LoadStateText(System.IO.TextReader reader)
{
}
public void SaveStateBinary(System.IO.BinaryWriter writer)
{
}
public void LoadStateBinary(System.IO.BinaryReader reader)
{
}
public byte[] SaveStateBinary()
{
return new byte[0];
}
public CoreComm CoreComm { get; private set; }
public IList<MemoryDomain> MemoryDomains
{
get { throw new NotImplementedException(); }
}
public MemoryDomain MainMemory
{
get { throw new NotImplementedException(); }
}
public void Dispose()
{
LibYabause.libyabause_setvidbuff(IntPtr.Zero);
LibYabause.libyabause_deinit();
VideoHandle.Free();
}
#region IVideoProvider
public IVideoProvider VideoProvider { get { return this; } }
int[] VideoBuffer = new int[704 * 512];
public int[] GetVideoBuffer() { return VideoBuffer; }
public int VirtualWidth { get; private set; }
public int BufferWidth { get; private set; }
public int BufferHeight { get; private set; }
public int BackgroundColor { get { return unchecked((int)0xff000000); } }
#endregion
#region ISyncSoundProvider
short[] SoundBuffer = new short[735 * 2];
public void GetSamples(out short[] samples, out int nsamp)
{
nsamp = 735;
samples = SoundBuffer;
}
public void DiscardSamples()
{
}
public ISoundProvider SoundProvider
{
get { return null; }
}
public ISyncSoundProvider SyncSoundProvider
{
get { return this; }
}
public bool StartAsyncSound()
{
return false;
}
public void EndAsyncSound()
{
}
#endregion
}
}

View File

@ -1873,14 +1873,24 @@ namespace BizHawk.MultiClient
game = new GameInfo {System = "PSX", Name = Path.GetFileNameWithoutExtension(file.Name), Hash = hash};
disc.Dispose();
}
/*
else
{
game = new GameInfo {System = "PCECD", Name = Path.GetFileNameWithoutExtension(file.Name), Hash = hash};
}*/
else
{
game = new GameInfo {System = "SAT", Name = Path.GetFileNameWithoutExtension(file.Name), Hash = hash};
}
}
switch (game.System)
{
case "SAT":
var saturn = new Emulation.Consoles.Sega.Saturn.Yabause(nextComm);
nextEmulator = saturn;
break;
case "PSX":
{
var psx = new Emulation.Consoles.PSX.Octoshock(nextComm);

View File

@ -589,6 +589,10 @@ namespace BizHawk.MultiClient
{
return ""; // TODO
}
else if (ControlType == "Saturn Controller")
{
return ""; // TODO
}
StringBuilder input = new StringBuilder("|");
@ -1026,6 +1030,11 @@ namespace BizHawk.MultiClient
// TODO
return;
}
else if (ControlType == "Saturn Controller")
{
// TODO
return;
}
MnemonicChecker c = new MnemonicChecker(mnemonic);

Binary file not shown.