예제 #1
0
		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);
     }
 }
예제 #3
0
		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!");
				}
			}
		}
예제 #4
0
        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);
        }
예제 #5
0
파일: Yabause.cs 프로젝트: stuff2600/RAEmus
 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!");
         }
     }
 }
예제 #6
0
        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");
            }
        }
예제 #7
0
        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);
        }
예제 #8
0
		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");
		}
예제 #9
0
		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;
		}
예제 #10
0
파일: Yabause.cs 프로젝트: ddugovic/RASuite
		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);
		}