saturn: power button, saveram. at the moment, only the internal bupram is saverammed, although it's generated separately per game, like other bizwhack consoles
This commit is contained in:
parent
e2f664d6b9
commit
299fcbcc57
|
@ -101,6 +101,13 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void libyabause_deinit();
|
||||
|
||||
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool libyabause_savesaveram(string fn);
|
||||
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern bool libyabause_loadsaveram(string fn);
|
||||
[DllImport("libyabause.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void libyabause_clearsaveram();
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
|
|
@ -154,9 +154,7 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
if (Controller["Reset"])
|
||||
LibYabause.libyabause_softreset();
|
||||
if (Controller["Power"])
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
LibYabause.libyabause_hardreset();
|
||||
|
||||
LibYabause.libyabause_setpads(p11, p12, p21, p22);
|
||||
|
||||
|
@ -177,25 +175,49 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
public string SystemId { get { return "SAT"; } }
|
||||
public bool DeterministicEmulation { get { return true; } }
|
||||
|
||||
#region saveram
|
||||
|
||||
public byte[] ReadSaveRam()
|
||||
{
|
||||
return new byte[0];
|
||||
var ms = new MemoryStream();
|
||||
var fp = new FilePiping();
|
||||
fp.Get(ms);
|
||||
bool success = LibYabause.libyabause_savesaveram(fp.GetPipeNameNative());
|
||||
var e = fp.GetResults();
|
||||
if (e != null)
|
||||
throw e;
|
||||
if (!success)
|
||||
throw new Exception("libyabause_savesaveram() failed!");
|
||||
var ret = ms.ToArray();
|
||||
ms.Dispose();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void StoreSaveRam(byte[] data)
|
||||
{
|
||||
var fp = new FilePiping();
|
||||
fp.Offer(data);
|
||||
bool success = LibYabause.libyabause_loadsaveram(fp.GetPipeNameNative());
|
||||
var e = fp.GetResults();
|
||||
if (e != null)
|
||||
throw e;
|
||||
if (!success)
|
||||
throw new Exception("libyabause_loadsaveram() failed!");
|
||||
}
|
||||
|
||||
public void ClearSaveRam()
|
||||
{
|
||||
LibYabause.libyabause_clearsaveram();
|
||||
}
|
||||
|
||||
public bool SaveRamModified
|
||||
{
|
||||
get;
|
||||
set;
|
||||
get { return true; }
|
||||
set { if (!value) throw new InvalidOperationException(); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void ResetFrameCounter()
|
||||
{
|
||||
Frame = 0;
|
||||
|
@ -295,7 +317,7 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
return ms.ToArray();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public CoreComm CoreComm { get; private set; }
|
||||
|
||||
|
@ -345,29 +367,11 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
|
|||
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()
|
||||
{
|
||||
|
||||
}
|
||||
public void DiscardSamples() { }
|
||||
public ISoundProvider SoundProvider { get { return null; } }
|
||||
public ISyncSoundProvider SyncSoundProvider { get { return this; } }
|
||||
public bool StartAsyncSound() { return false; }
|
||||
public void EndAsyncSound() { }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
Binary file not shown.
|
@ -192,6 +192,21 @@ extern "C" __declspec(dllexport) int libyabause_savestate(const char *fn)
|
|||
return !YabSaveState(fn);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) int libyabause_savesaveram(const char *fn)
|
||||
{
|
||||
return !T123Save(BupRam, 0x10000, 1, fn);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) int libyabause_loadsaveram(const char *fn)
|
||||
{
|
||||
return !T123Load(BupRam, 0x10000, 1, fn);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) void libyabause_clearsaveram()
|
||||
{
|
||||
FormatBackupRam(BupRam, 0x10000);
|
||||
}
|
||||
|
||||
extern "C" __declspec(dllexport) int libyabause_frameadvance(int *w, int *h, int *nsamp)
|
||||
{
|
||||
LagFrameFlag = 1;
|
||||
|
|
Loading…
Reference in New Issue