public byte[] CloneSaveRam() { if (Disposed) { if (DisposedSaveRam != null) { return (byte[])DisposedSaveRam.Clone(); } else { return new byte[0]; } } else { var ms = new MemoryStream(); var fp = new FilePiping(); fp.Get(ms); bool success = LibYabause.libyabause_savesaveram(fp.GetPipeNameNative()); fp.Finish(); if (!success) throw new Exception("libyabause_savesaveram() failed!"); var ret = ms.ToArray(); ms.Dispose(); return ret; } }
public byte[] CloneSaveRam() { if (Disposed) { if (DisposedSaveRam != null) { return((byte[])DisposedSaveRam.Clone()); } else { return(new byte[0]); } } else { var ms = new MemoryStream(); var fp = new FilePiping(); fp.Get(ms); bool success = LibYabause.libyabause_savesaveram(fp.GetPipeNameNative()); fp.Finish(); if (!success) { throw new Exception("libyabause_savesaveram() failed!"); } var ret = ms.ToArray(); ms.Dispose(); return(ret); } }
public void StoreSaveRam(byte[] data) { if (Disposed) { throw new Exception("It's a bit late for that"); } else { var fp = new FilePiping(); fp.Offer(data); bool success = LibYabause.libyabause_loadsaveram(fp.GetPipeNameNative()); fp.Finish(); if (!success) { throw new Exception("libyabause_loadsaveram() failed!"); } } }
private byte[] SaveCoreBinary() { var ms = new MemoryStream(); var fp = new FilePiping(); fp.Get(ms); bool succeed = LibYabause.libyabause_savestate(fp.GetPipeNameNative()); fp.Finish(); var ret = ms.ToArray(); ms.Close(); if (!succeed) { throw new Exception("libyabause_savestate() failed"); } return(ret); }
private void LoadCoreBinary(byte[] data) { var fp = new FilePiping(); fp.Offer(data); //loadstate can trigger GL work ActivateGL(); bool succeed = LibYabause.libyabause_loadstate(fp.GetPipeNameNative()); DeactivateGL(); fp.Finish(); if (!succeed) { throw new Exception("libyabause_loadstate() failed"); } }
void Init(byte[] bios) { bool GL = SyncSettings.UseGL; if (AttachedCore != null) { AttachedCore.Dispose(); AttachedCore = null; } VideoHandle = GCHandle.Alloc(VideoBuffer, GCHandleType.Pinned); SoundHandle = GCHandle.Alloc(SoundBuffer, GCHandleType.Pinned); LibYabause.CDInterface CDInt = new LibYabause.CDInterface(); CDInt.InitFunc = InitH = new LibYabause.CDInterface.Init(CD_Init); CDInt.DeInitFunc = DeInitH = new LibYabause.CDInterface.DeInit(CD_DeInit); CDInt.GetStatusFunc = GetStatusH = new LibYabause.CDInterface.GetStatus(CD_GetStatus); CDInt.ReadTOCFunc = ReadTOCH = new LibYabause.CDInterface.ReadTOC(CD_ReadTOC); CDInt.ReadSectorFADFunc = ReadSectorFADH = new LibYabause.CDInterface.ReadSectorFAD(CD_ReadSectorFAD); CDInt.ReadAheadFADFunc = ReadAheadFADH = new LibYabause.CDInterface.ReadAheadFAD(CD_ReadAheadFAD); var fp = new FilePiping(); string BiosPipe = fp.GetPipeNameNative(); fp.Offer(bios); int basetime; if (SyncSettings.RealTimeRTC) { basetime = 0; } else { basetime = (int)((SyncSettings.RTCInitialTime - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds); } if (!LibYabause.libyabause_init ( ref CDInt, BiosPipe, GL, SyncSettings.CartType, SyncSettings.SkipBios, !SyncSettings.RealTimeRTC, basetime )) { throw new Exception("libyabause_init() failed!"); } fp.Finish(); LibYabause.libyabause_setvidbuff(VideoHandle.AddrOfPinnedObject()); LibYabause.libyabause_setsndbuff(SoundHandle.AddrOfPinnedObject()); AttachedCore = this; // with or without GL, this is the guaranteed frame -1 size; (unless you do a gl resize) BufferWidth = 320; BufferHeight = 224; InitMemoryDomains(); GLMode = GL; // if in GL mode, this will trigger the initial GL resize PutSyncSettings(this.SyncSettings); }
private void LoadCoreBinary(byte[] data) { var fp = new FilePiping(); fp.Offer(data); //loadstate can trigger GL work ActivateGL(); bool succeed = LibYabause.libyabause_loadstate(fp.GetPipeNameNative()); DeactivateGL(); fp.Finish(); if (!succeed) throw new Exception("libyabause_loadstate() failed"); }
private byte[] SaveCoreBinary() { var ms = new MemoryStream(); var fp = new FilePiping(); fp.Get(ms); bool succeed = LibYabause.libyabause_savestate(fp.GetPipeNameNative()); fp.Finish(); var ret = ms.ToArray(); ms.Close(); if (!succeed) throw new Exception("libyabause_savestate() failed"); return ret; }
void Init(byte[] bios) { bool GL = SyncSettings.UseGL; if (AttachedCore != null) { AttachedCore.Dispose(); AttachedCore = null; } VideoHandle = GCHandle.Alloc(VideoBuffer, GCHandleType.Pinned); SoundHandle = GCHandle.Alloc(SoundBuffer, GCHandleType.Pinned); LibYabause.CDInterface CDInt = new LibYabause.CDInterface(); CDInt.InitFunc = InitH = new LibYabause.CDInterface.Init(CD_Init); CDInt.DeInitFunc = DeInitH = new LibYabause.CDInterface.DeInit(CD_DeInit); CDInt.GetStatusFunc = GetStatusH = new LibYabause.CDInterface.GetStatus(CD_GetStatus); CDInt.ReadTOCFunc = ReadTOCH = new LibYabause.CDInterface.ReadTOC(CD_ReadTOC); CDInt.ReadSectorFADFunc = ReadSectorFADH = new LibYabause.CDInterface.ReadSectorFAD(CD_ReadSectorFAD); CDInt.ReadAheadFADFunc = ReadAheadFADH = new LibYabause.CDInterface.ReadAheadFAD(CD_ReadAheadFAD); var fp = new FilePiping(); string BiosPipe = fp.GetPipeNameNative(); fp.Offer(bios); int basetime; if (SyncSettings.RealTimeRTC) basetime = 0; else basetime = (int)((SyncSettings.RTCInitialTime - new DateTime(1970, 1, 1).ToLocalTime()).TotalSeconds); if (!LibYabause.libyabause_init ( ref CDInt, BiosPipe, GL, SyncSettings.CartType, SyncSettings.SkipBios, !SyncSettings.RealTimeRTC, basetime )) throw new Exception("libyabause_init() failed!"); fp.Finish(); LibYabause.libyabause_setvidbuff(VideoHandle.AddrOfPinnedObject()); LibYabause.libyabause_setsndbuff(SoundHandle.AddrOfPinnedObject()); AttachedCore = this; // with or without GL, this is the guaranteed frame -1 size; (unless you do a gl resize) BufferWidth = 320; BufferHeight = 224; InitMemoryDomains(); GLMode = GL; // if in GL mode, this will trigger the initial GL resize PutSyncSettings(this.SyncSettings); }