Пример #1
0
        public void ExecuteQueued(CpuThreadState BaseCpuThreadState)
        {
            if (Enabled)
            {
                HleCallback[] HleCallbackListCopy;
                lock (HleCallbackList)
                {
                    HleCallbackListCopy = HleCallbackList.ToArray();
                    HleCallbackList.Clear();
                }

                foreach (var HleCallback in HleCallbackListCopy)
                {
                    var FakeCpuThreadState = new CpuThreadState(CpuProcessor);
                    FakeCpuThreadState.CopyRegistersFrom(BaseCpuThreadState);
                    HleCallback.SetArgumentsToCpuThreadState(FakeCpuThreadState);

                    HleInterop.Execute(FakeCpuThreadState);
                    //Console.Error.WriteLine("Execute queued");

                    // Execute just one!
                    break;
                }
            }
        }
Пример #2
0
 public void ScheduleCallback(HleCallback HleCallback)
 {
     lock (this)
     {
         this.ScheduledCallbacks.Enqueue(HleCallback);
     }
 }
Пример #3
0
 public void Queue(HleCallback HleCallback)
 {
     lock (HleCallbackList)
     {
         HleCallbackList.Add(HleCallback);
     }
 }
Пример #4
0
        public int sceUmdRegisterUMDCallBack(int CallbackId)
        {
            var Callback = HleState.CallbackManager.Callbacks.Get(CallbackId);

            RegisteredCallbacks[CallbackId] = HleCallback.Create(
                "sceUmdRegisterUMDCallBack", Callback.Function,
                1, (int)(PspUmdState.PSP_UMD_READABLE | PspUmdState.PSP_UMD_READY | PspUmdState.PSP_UMD_PRESENT), Callback.Arguments[0]
                );

            HleState.CallbackManager.ScheduleCallback(RegisteredCallbacks[CallbackId]);

            return(0);
            //throw(new NotImplementedException());

            /*
             * //logWarning("Not implemented: sceUmdRegisterUMDCallBack");
             * unimplemented_notice();
             *
             * umdPspCallback = uniqueIdFactory.get!PspCallback(cbid);
             *
             * hleEmulatorState.callbacksHandler.register(CallbacksHandler.Type.Umd, umdPspCallback);
             * umdPspCallbackId = cbid;
             * triggerUmdStatusChange();
             *
             * return 0;
             */
        }
Пример #5
0
		public void ScheduleCallback(HleCallback HleCallback)
		{
			Console.WriteLine("ScheduleCallback!");
			lock (this)
			{
				this.ScheduledCallbacks.Enqueue(HleCallback);
			}
		}
Пример #6
0
 public void ScheduleCallback(HleCallback hleCallback)
 {
     Console.WriteLine("ScheduleCallback! {0}", hleCallback);
     lock (this)
     {
         _scheduledCallbacks.Enqueue(hleCallback);
     }
 }
Пример #7
0
 public void Trigger()
 {
     if (HleInterruptManager.Enabled)
     {
         foreach (var Handler in SubinterruptHandlers.Where(Handler => Handler.Enabled))
         {
             HleInterruptManager.Queue(HleCallback.Create("InterruptTrigger", Handler.Address, Handler.Index, Handler.Argument));
         }
     }
     //Console.Error.WriteLine("Trigger: " + PspInterrupt);
 }
Пример #8
0
        //[HlePspNotImplemented]
        public int scePowerRegisterCallback(int SlotIndex, int CallbackId)
        {
            CheckSlotIndex(SlotIndex, AllowMinusOne: true);

            // TODO: If cbId is invalid return PSP_POWER_ERROR_INVALID_CB.
            if (CallbackId == 0)
            {
                throw new SceKernelException(SceKernelErrors.PSP_POWER_ERROR_INVALID_CB);
            }

            if (SlotIndex == -1)
            {
                try
                {
                    SlotIndex = Callbacks.First(Slot => Slot.CallbackId == 0).Index;
                }
                catch (InvalidOperationException)
                {
                    throw new SceKernelException(SceKernelErrors.PSP_POWER_ERROR_SLOTS_FULL);
                }
            }

            if (Callbacks[SlotIndex].CallbackId != 0)
            {
                throw new SceKernelException(SceKernelErrors.PSP_POWER_ERROR_TAKEN_SLOT);
            }

            Callbacks[SlotIndex].CallbackId = CallbackId;

            var Callback           = CallbackManager.Callbacks.Get(CallbackId);
            var RegisteredCallback = HleCallback.Create(
                "scePowerRegisterCallback", Callback.Function,
                SlotIndex + 1, (int)GetPowerCallbackFlags(), Callback.Arguments[0]
                );

            CallbackManager.ScheduleCallback(RegisteredCallback);

            //throw (new NotImplementedException());
            return(SlotIndex);
        }
 public int sceKernelCreateCallback(string Name, SceKernelCallbackFunction Function, uint Argument)
 {
     return(CallbackManager.Callbacks.Create(
                HleCallback.Create(Name, (uint)Function, Argument)
                ));
 }
Пример #10
0
 public void ScheduleCallback(HleCallback HleCallback)
 {
     lock (this)
     {
         this.ScheduledCallbacks.Enqueue(HleCallback);
     }
 }
Пример #11
0
 public void Queue(HleCallback HleCallback)
 {
     lock (HleCallbackList)
     {
         HleCallbackList.Add(HleCallback);
     }
 }