Example #1
0
        public int sceKernelAllocateFplCB(FixedPool FixedPool, PspPointer* DataPointer, uint* Timeout)
        {
            FixedPool.Allocate(DataPointer, Timeout, HandleCallbacks: true);

            //Console.WriteLine("Allocated: Address: 0x{0:X}", DataPointer->Address);
            return 0;
        }
Example #2
0
			public void Allocate(CpuThreadState CpuThreadState, int Size, PspPointer* AddressPointer, uint* Timeout, bool HandleCallbacks)
			{
				if (!TryAllocate(CpuThreadState, Size, AddressPointer))
				{
					bool TimedOut = false;

					ThreadManForUser.ThreadManager.Current.SetWaitAndPrepareWakeUp(HleThread.WaitType.Semaphore, "_sceKernelAllocateVplCB", this, (WakeUp) =>
					{
						ThreadManForUser.PspRtc.RegisterTimeout(Timeout, () =>
						{
							TimedOut = true;
							WakeUp();
						});
						WaitList.Add(new WaitVariablePoolItem()
						{
							RequiredSize = Size,
							WakeUp = () => {
								WakeUp();
								Allocate(CpuThreadState, Size, AddressPointer, Timeout, HandleCallbacks);
							},
						});
					}, HandleCallbacks: HandleCallbacks);

					if (TimedOut) throw(new SceKernelException(SceKernelErrors.ERROR_KERNEL_WAIT_TIMEOUT));
				}
			}
 public int sceKernelSetVTimerHandler(VirtualTimer VirtualTimer, SceKernelSysClock *Time,
                                      PspPointer HandlerCallback, PspPointer HandlerArgument)
 {
     VirtualTimer.SetHandler(Time: Time->MicroSeconds, HandlerCallback: HandlerCallback,
                             HandlerArgument: HandlerArgument, HandlerIsWide: false);
     return(0);
 }
 public int sceKernelSetVTimerHandlerWide(VirtualTimer VirtualTimer, long Time, PspPointer HandlerCallback,
                                          PspPointer HandlerArgument)
 {
     VirtualTimer.SetHandler(Time: Time, HandlerCallback: HandlerCallback, HandlerArgument: HandlerArgument,
                             HandlerIsWide: true);
     return(0);
 }
Example #5
0
        public int sceMpegAvcDecode(SceMpegPointer* SceMpegPointer, SceMpegAu* MpegAccessUnit, int FrameWidth, PspPointer* OutputBufferPointer, PspPointer* Init)
        {
            //if (*Init == 1)
            //{
            //	throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
            //}

            var SceMpegData = GetSceMpegData(SceMpegPointer);
            var Mpeg = GetMpeg(SceMpegPointer);

            // Dummy
            var VideoPacket = new VideoPacket();

            //Console.Error.WriteLine("0x{0:X}", PspMemory.PointerToPspAddress(OutputBuffer));
            //Console.WriteLine("{0:X8}", (*OutputBufferPointer).Address);
            Mpeg.AvcDecode(
                MpegAccessUnit,
                FrameWidth,
                SceMpegData->SceMpegAvcMode.PixelFormat,
                (*OutputBufferPointer)
            );

            SceMpegData->AvcFrameStatus = 1;
            //Init = SceMpegData->AvcFrameStatus;

            //throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
            return 0;
        }
Example #6
0
 public int sceMpegGetAtracAu(SceMpegPointer* SceMpegPointer, StreamId StreamId, out SceMpegAu MpegAccessUnit, out PspPointer Atrac3PlusPointer)
 {
     var Mpeg = GetMpeg(SceMpegPointer);
     if (!Mpeg.HasData) throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
     MpegAccessUnit = Mpeg.GetAtracAu(StreamId);
     Atrac3PlusPointer.Address = 0;
     return 0;
 }
Example #7
0
        public int sceKernelAllocateFpl(PoolId PoolId, PspPointer* DataPointer, uint* Timeout)
        {
            var FixedPool = FixedPoolList.Get(PoolId);
            FixedPool.Allocate(DataPointer, Timeout, HandleCallbacks: false);

            //Console.WriteLine("Allocated: Address: 0x{0:X}", DataPointer->Address);
            return 0;
        }
 public int Send(PspPointer Message)
 {
     lock (this)
     {
         Messages.AddLast(Message);
         CheckQueue();
         return(0);
     }
 }
Example #9
0
			public int Send(PspPointer Message)
			{
				lock (this)
				{
					Messages.AddLast(Message);
					CheckQueue();
					return 0;
				}
			}
Example #10
0
 public void SetHandler(long Time, PspPointer HandlerCallback, PspPointer HandlerArgument, bool HandlerIsWide)
 {
     lock (Timer)
     {
         this.HandlerTime     = Time;
         this.HandlerCallback = HandlerCallback;
         this.HandlerArgument = HandlerArgument;
         this.HandlerIsWide   = HandlerIsWide;
         this.HandlerEnabled  = true;
         UpdateHandlerTime();
     }
 }
Example #11
0
        public int sceMpegGetAtracAu(SceMpegPointer *SceMpegPointer, StreamId StreamId, out SceMpegAu MpegAccessUnit,
                                     out PspPointer Atrac3PlusPointer)
        {
            var Mpeg = GetMpeg(SceMpegPointer);

            if (!Mpeg.HasData)
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
            }
            MpegAccessUnit            = Mpeg.GetAtracAu(StreamId);
            Atrac3PlusPointer.Address = 0;
            return(0);
        }
Example #12
0
			public void Receive(PspPointer* PointerToMessage, WakeUpCallbackDelegate WakeUpCallback)
			{
				lock (this)
				{
					Action Extract = () =>
					{
						*PointerToMessage = Messages.Last.Value;
						Messages.RemoveLast();
						if (WakeUpCallback != null) WakeUpCallback();
					};
					ExtractQueue.Enqueue(Extract);
					CheckQueue();
				}
			}
Example #13
0
			public bool TryAllocate(CpuThreadState CpuThreadState, int Size, PspPointer* AddressPointer)
			{
				if (Size > Info.PoolSize) throw(new SceKernelException((SceKernelErrors)(-1)));
				try
				{
					var AllocatedSegment = MemoryPartition.Allocate(Size, InternalMemoryAnchor);
					AddressPointer->Address = AllocatedSegment.GetAnchoredAddress(InternalMemoryAnchor);
					return true;
				}
				catch (MemoryPartitionNoMemoryException)
				{
					//AddressPointer->Address = 0;
					return false;
				}
			}
Example #14
0
			public bool Poll(PspPointer* PointerToMessage)
			{
				lock (this)
				{
					if (Messages.Any())
					{
						Receive(PointerToMessage, null);
						return true;
					}
					else
					{
						return false;
					}
				}
			}
Example #15
0
            public void Free(CpuThreadState CpuThreadState, PspPointer Address)
            {
                MemoryPartition.DeallocateAnchoredAddress(Address, InternalMemoryAnchorReturn);

                var TotalFreeSize = MemoryPartition.TotalFreeSize;

                foreach (var Item in WaitList.ToArray())
                {
                    if (TotalFreeSize >= Item.RequiredSize)
                    {
                        WaitList.Remove(Item);
                        Item.WakeUp();
                        break;
                    }
                }
            }
            public void Free(PspPointer DataPointer)
            {
                if (!UsedBlocks.Contains(DataPointer))
                {
                    throw new SceKernelException(SceKernelErrors.ERROR_KERNEL_ILLEGAL_MEMBLOCK);
                }
                UsedBlocks.Remove(DataPointer);
                FreeBlocks.Add(DataPointer);

                foreach (var WaitItem in WaitItemList.ToArray())
                {
                    //Console.Error.WriteLine("Free!");
                    WaitItemList.Remove(WaitItem);
                    WaitItem.WakeUp();
                    ThreadManForUser.ThreadManager.Current.CpuThreadState.Yield();
                    break;
                }
            }
Example #17
0
        //[HlePspNotImplemented]
        public int sceMpegRingbufferConstruct(SceMpegRingbuffer *ringbuffer, int packets, PspPointer data, int size,
                                              PspPointer callback, PspPointer callbackParam)
        {
            ringbuffer->PacketsTotal      = packets;
            ringbuffer->PacketsRead       = 0;
            ringbuffer->PacketsWritten    = 0;
            ringbuffer->PacketsAvailable  = 0; // set later
            ringbuffer->PacketSize        = RingBufferPacketSize;
            ringbuffer->Data              = data;
            ringbuffer->DataEnd           = (uint)(data + ringbuffer->PacketsTotal * ringbuffer->PacketSize);
            ringbuffer->Callback          = callback;
            ringbuffer->CallbackParameter = callbackParam;
            ringbuffer->SemaId            = -1;
            ringbuffer->SceMpeg           = 0;

            if (ringbuffer->DataEnd > ringbuffer->Data + size)
            {
                throw (new InvalidOperationException());
            }

            return(0);
        }
Example #18
0
		public int sceMpegRingbufferConstruct(SceMpegRingbuffer* Ringbuffer, int Packets, PspPointer Data, int Size, PspPointer Callback, PspPointer CallbackParam)
		{
			//return -1;
			//throw(new NotImplementedException());
			Ringbuffer->Packets = Packets;
			Ringbuffer->PacketsRead = 0;
			Ringbuffer->PacketsWritten = 0;
			Ringbuffer->PacketsFree = 0; // set later
			Ringbuffer->PacketSize = RingBufferPacketSize;
			Ringbuffer->Data = Data;
			Ringbuffer->DataUpperBound = (uint)(Data + Ringbuffer->Packets * Ringbuffer->PacketSize);
			Ringbuffer->Callback = Callback;
			Ringbuffer->CallbackParameter = CallbackParam;
			Ringbuffer->SemaId = -1;
			Ringbuffer->SceMpeg = 0;

			if (Ringbuffer->DataUpperBound > Ringbuffer->Data + Size)
			{
				throw(new InvalidOperationException());
			}

			return 0;
		}
Example #19
0
        public int sceMpegAvcDecode(SceMpegPointer* Mpeg, SceMpegAu* MpegAccessUnit, int FrameWidth, PspPointer* OutputBufferPointer, int* Init)
        {
            CheckEnabledMpeg();

            if (*Init == 1)
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
            }
            var SceMpegData = GetSceMpegData(Mpeg);

            //Console.Error.WriteLine("0x{0:X}", PspMemory.PointerToPspAddress(OutputBuffer));

            var OutputBuffer = (byte*)PspMemory.PspAddressToPointerSafe(OutputBufferPointer->Address);

            for (int n = 0; n < FrameWidth * 272 * 4; n++)
            {
                OutputBuffer[n] = 0xFF;
            }

            SceMpegData->AvcFrameStatus = 1;
            *Init = SceMpegData->AvcFrameStatus;
            //throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_DATA));
            return 0;
        }
Example #20
0
		public void AvcDecode(SceMpegAu* MpegAccessUnit, int FrameWidth, GuPixelFormats GuPixelFormat, PspPointer OutputBuffer)
		{
			if (MpegAccessUnit != null) *MpegAccessUnit = GetAvcAu(StreamId.Avc);

			while (MpegPsDemuxer.HasMorePackets)
			{
				if (!DecodePsPacket()) return;
			}

			if (VideoStream.Length <= 0) return;

			// Buffer 1MB
			//if (VideoStream.Length <= 1 * 1024 * 1024) return;

			try
			{
				//if (H264FrameDecoder.HasMorePackets)
				{
					//Console.WriteLine("VideoStream.Length: {0}", VideoStream.Length);
					var Frame = H264FrameDecoder.DecodeFrame();

					ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.DarkGreen, () => { Console.WriteLine("DecodedFrame: {0}", FrameIndex); });

					var Bitmap = FrameUtils.imageFromFrameWithoutEdges(Frame, FrameWidth, 272);

					var TempBuffer = new byte[PixelFormatDecoder.GetPixelsSize(GuPixelFormat, Bitmap.Width * Bitmap.Height)];
					fixed (byte* TempBufferPtr = TempBuffer)
					{
						var TempBufferPtr2 = TempBufferPtr;
						Bitmap.LockBitsUnlock(PixelFormat.Format32bppArgb, (BitmapData) =>
						{
							var InputBuffer = (OutputPixel*)BitmapData.Scan0.ToPointer();
							int Count = Bitmap.Width * Bitmap.Height;

							for (int n = 0; n < Count; n++)
							{
								var Color = InputBuffer[n];
								InputBuffer[n].R = Color.B;
								InputBuffer[n].G = Color.G;
								InputBuffer[n].B = Color.R;
								InputBuffer[n].A = 0xFF;
							}

							PixelFormatDecoder.Encode(GuPixelFormat, InputBuffer, TempBufferPtr2, Bitmap.Width * Bitmap.Height);
							PixelFormatDecoder.Encode(PspDisplay.CurrentInfo.PixelFormat, InputBuffer, (byte*)Memory.PspAddressToPointerSafe(PspDisplay.CurrentInfo.FrameAddress), 512, Bitmap.Width, Bitmap.Height);
							PspDisplay.CurrentInfo.PlayingVideo = true;
						});
						PspDisplay.CurrentInfo.PlayingVideo = true;
						Memory.WriteBytes(OutputBuffer.Address, TempBufferPtr, TempBuffer.Length);
						GpuImpl.InvalidateCache(OutputBuffer.Address, TempBuffer.Length);
					}

					if (SaveBitmapFrame) Bitmap.Save(@"c:\temp\frame" + (FrameIndex) + ".png");
					FrameIndex++;
				}
				//PixelFormat

				return;
			}
			catch (EndOfStreamException)
			{
				ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.Red, () => { Console.WriteLine("H264FrameDecoder.DecodeFrame: EndOfStreamException"); });
			}
		}
Example #21
0
		public int sceAtracGetStreamDataInfo(int AtracId, out PspPointer WritePointerPointer, out int AvailableBytes, out int ReadOffset)
		{
			var Atrac = AtracList.Get(AtracId);

			//throw (new NotImplementedException());
			WritePointerPointer = Atrac.PrimaryBuffer.Low; // @FIXME!!
			AvailableBytes = Atrac.PrimaryBuffer.Size;
			ReadOffset = Atrac.PrimaryBufferReaded;

			return 0;
		}
 public int sceKernelSetVTimerHandlerWide(VirtualTimer VirtualTimer, long Time, PspPointer HandlerCallback, PspPointer HandlerArgument)
 {
     VirtualTimer.SetHandler(Time: Time, HandlerCallback: HandlerCallback, HandlerArgument: HandlerArgument, HandlerIsWide: true);
     return 0;
 }
Example #23
0
 public void Allocate(PspPointer* DataPointer, uint* Timeout, bool HandleCallbacks)
 {
     if (!TryAllocate(DataPointer))
     {
         if (Timeout != null) throw (new NotImplementedException());
         var CurrentThread = ThreadManForUser.ThreadManager.Current;
         CurrentThread.SetWaitAndPrepareWakeUp(HleThread.WaitType.Semaphore, "_sceKernelAllocateVplCB", this, (WakeUp) =>
         {
             WaitItemList.Add(new WaitItem()
             {
                 Thread = CurrentThread,
                 WakeUp = () =>
                 {
                     WakeUp();
                     Allocate(DataPointer, Timeout, HandleCallbacks);
                 },
             });
         }, HandleCallbacks: HandleCallbacks);
     }
 }
Example #24
0
 public int sceKernelAllocateVpl(CpuThreadState CpuThreadState, VariablePool VariablePool, int Size, PspPointer* AddressPointer, uint* Timeout)
 {
     VariablePool.Allocate(CpuThreadState, Size, AddressPointer, Timeout, HandleCallbacks: false);
     return 0;
 }
Example #25
0
 public int sceKernelSetVTimerHandler(int VirtualTimerId, SceKernelSysClock* Time, PspPointer HandlerCallback, PspPointer HandlerArgument)
 {
     var VirtualTimer = VirtualTimerPool.Get(VirtualTimerId);
     VirtualTimer.SetHandler(Time: Time->MicroSeconds, HandlerCallback: HandlerCallback, HandlerArgument: HandlerArgument, HandlerIsWide: false);
     return 0;
 }
 public int sceKernelFreeFpl(FixedPool FixedPool, PspPointer DataPointer)
 {
     //if (!FixedPoolList.Contains(FixedPool)) throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_ILLEGAL_MEMBLOCK));
     FixedPool.Free(DataPointer);
     return(0);
 }
Example #27
0
		public int sceKernelTryAllocateVpl(CpuThreadState CpuThreadState, VariablePoolId VariablePoolId, int Size, PspPointer* AddressPointer)
		{
			var VariablePool = VariablePoolList.Get(VariablePoolId);
			if (VariablePool.TryAllocate(CpuThreadState, Size, AddressPointer))
			{
				return 0;
			}
			else
			{
				return (int)SceKernelErrors.ERROR_KERNEL_NO_MEMORY;
			}
		}
Example #28
0
		public int sceKernelAllocateVplCB(CpuThreadState CpuThreadState, VariablePoolId VariablePoolId, int Size, PspPointer* AddressPointer, uint* Timeout)
		{
			var VariablePool = VariablePoolList.Get(VariablePoolId);
			VariablePool.Allocate(CpuThreadState, Size, AddressPointer, Timeout, HandleCallbacks: true);
			return 0;
		}
Example #29
0
 public int sceKernelFreeFpl(PoolId PoolId, PspPointer DataPointer)
 {
     var FixedPool = FixedPoolList.Get(PoolId);
     FixedPool.Free(DataPointer);
     return 0;
 }
Example #30
0
            public bool TryAllocate(PspPointer* DataPointer)
            {
                if (FreeBlocks.Count > 0)
                {
                    var AllocatedBlock = FreeBlocks.First();
                    FreeBlocks.Remove(AllocatedBlock);
                    UsedBlocks.Add(AllocatedBlock);
                    //Console.Error.WriteLine("TryAllocate(0x{0:X})", AllocatedBlock);
                    DataPointer->Address = AllocatedBlock;

                    return true;
                }
                else
                {
                    return false;
                }
            }
Example #31
0
            public void Free(PspPointer DataPointer)
            {
                if (!UsedBlocks.Contains(DataPointer))
                {
                    throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_ILLEGAL_MEMBLOCK));
                }
                UsedBlocks.Remove(DataPointer);
                FreeBlocks.Add(DataPointer);

                foreach (var WaitItem in WaitItemList.ToArray())
                {
                    //Console.Error.WriteLine("Free!");
                    WaitItemList.Remove(WaitItem);
                    WaitItem.WakeUp();
                    ThreadManForUser.ThreadManager.Current.CpuThreadState.Yield();
                    break;
                }
            }
Example #32
0
 /// <summary>
 /// Set the timer handler (wide mode)
 /// </summary>
 /// <param name="VirtualTimerId">UID of the vtimer</param>
 /// <param name="Time">Time to call the handler?</param>
 /// <param name="HandlerCallback">The timer handler</param>
 /// <param name="HandlerArgument">Common pointer</param>
 /// <returns>0 on success, less than 0 on error</returns>
 public int sceKernelSetVTimerHandlerWide(int VirtualTimerId, long Time, PspPointer HandlerCallback, PspPointer HandlerArgument)
 {
     var VirtualTimer = VirtualTimerPool.Get(VirtualTimerId);
     VirtualTimer.SetHandler(Time: Time, HandlerCallback: HandlerCallback, HandlerArgument: HandlerArgument, HandlerIsWide: true);
     return 0;
 }
Example #33
0
 public void SetHandler(long Time, PspPointer HandlerCallback, PspPointer HandlerArgument, bool HandlerIsWide)
 {
     lock (Timer)
     {
         this.HandlerTime = Time;
         this.HandlerCallback = HandlerCallback;
         this.HandlerArgument = HandlerArgument;
         this.HandlerIsWide = HandlerIsWide;
         this.HandlerEnabled = true;
         UpdateHandlerTime();
     }
 }
Example #34
0
 public int sceKernelSendMbx(int MessageBoxId, PspPointer Message)
 {
     var MessageBox = MessageBoxList.Get(MessageBoxId);
     return MessageBox.Send(Message);
 }
Example #35
0
        public int sceKernelReceiveMbx(int MessageBoxId, PspPointer* PointerToMessage, uint* Timeout)
        {
            var CurrentThread = ThreadManager.Current;
            var MessageBox = MessageBoxList.Get(MessageBoxId);
            bool TimedOut = false;
            CurrentThread.SetWaitAndPrepareWakeUp(HleThread.WaitType.None, "sceKernelReceiveMbx", MessageBox, WakeUpCallback =>
            {
                if (Timeout != null)
                {
                    PspRtc.RegisterTimerInOnce(TimeSpanUtils.FromMicroseconds(*Timeout), () =>
                    {
                        TimedOut = true;
                        WakeUpCallback();
                    });
                }
                MessageBox.Receive(PointerToMessage, WakeUpCallback);
            }, HandleCallbacks: false);

            if (TimedOut)
            {
                return (int)SceKernelErrors.ERROR_KERNEL_WAIT_TIMEOUT;
            }
            else
            {
                //if (Timeout)
                //return MessageBox.Receive(Message);
                return 0;
            }
        }
Example #36
0
			public void Free(CpuThreadState CpuThreadState, PspPointer Address)
			{
				MemoryPartition.DeallocateAnchoredAddress(Address, InternalMemoryAnchor);

				var TotalFreeSize = MemoryPartition.TotalFreeSize;
				foreach (var Item in WaitList.ToArray())
				{
					if (TotalFreeSize >= Item.RequiredSize)
					{
						WaitList.Remove(Item);
						Item.WakeUp();
						break;
					}
				}
			}
Example #37
0
        public int sceKernelPollMbx(int MessageBoxId, PspPointer* PointerToMessage)
        {
            var MessageBox = MessageBoxList.Get(MessageBoxId);
            if (!MessageBox.Poll(PointerToMessage))
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_MESSAGEBOX_NO_MESSAGE));
            }

            return 0;
        }
Example #38
0
        public void AvcDecode(SceMpegAu *MpegAccessUnit, int FrameWidth, GuPixelFormats GuPixelFormat,
                              PspPointer OutputBuffer)
        {
            if (MpegAccessUnit != null)
            {
                *MpegAccessUnit = GetAvcAu(StreamId.Avc);
            }

            while (MpegPsDemuxer.HasMorePackets)
            {
                if (!DecodePsPacket())
                {
                    return;
                }
            }

            if (VideoStream.Length <= 0)
            {
                return;
            }

            // Buffer 1MB
            //if (VideoStream.Length <= 1 * 1024 * 1024) return;

            try
            {
                //if (H264FrameDecoder.HasMorePackets)
                {
                    //Console.WriteLine("VideoStream.Length: {0}", VideoStream.Length);
                    var Frame = H264FrameDecoder.DecodeFrame();

                    ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.DarkGreen,
                                                         () => { Console.WriteLine("DecodedFrame: {0}", FrameIndex); });

                    var Bitmap = FrameUtils.imageFromFrameWithoutEdges(Frame, FrameWidth, 272);

                    var TempBuffer =
                        new byte[PixelFormatDecoder.GetPixelsSize(GuPixelFormat, Bitmap.Width * Bitmap.Height)];
                    fixed(byte *TempBufferPtr = TempBuffer)
                    {
                        var TempBufferPtr2 = TempBufferPtr;

                        Bitmap.LockBitsUnlock(PixelFormat.Format32bppArgb, (BitmapData) =>
                        {
                            var InputBuffer = (OutputPixel *)BitmapData.Scan0.ToPointer();
                            int Count       = Bitmap.Width * Bitmap.Height;

                            for (int n = 0; n < Count; n++)
                            {
                                var Color        = InputBuffer[n];
                                InputBuffer[n].R = Color.B;
                                InputBuffer[n].G = Color.G;
                                InputBuffer[n].B = Color.R;
                                InputBuffer[n].A = 0xFF;
                            }

                            PixelFormatDecoder.Encode(GuPixelFormat, InputBuffer, TempBufferPtr2,
                                                      Bitmap.Width * Bitmap.Height);
                            PixelFormatDecoder.Encode(PspDisplay.CurrentInfo.PixelFormat, InputBuffer,
                                                      (byte *)Memory.PspAddressToPointerSafe(PspDisplay.CurrentInfo.FrameAddress), 512,
                                                      Bitmap.Width, Bitmap.Height);
                            PspDisplay.CurrentInfo.PlayingVideo = true;
                        });
                        PspDisplay.CurrentInfo.PlayingVideo = true;
                        Memory.WriteBytes(OutputBuffer.Address, TempBufferPtr, TempBuffer.Length);
                        GpuImpl.InvalidateCache(OutputBuffer.Address, TempBuffer.Length);
                    }

                    if (SaveBitmapFrame)
                    {
                        Bitmap.Save(@"c:\temp\frame" + (FrameIndex) + ".png");
                    }
                    FrameIndex++;
                }
                //PixelFormat

                return;
            }
            catch (EndOfStreamException)
            {
                ConsoleUtils.SaveRestoreConsoleColor(ConsoleColor.Red,
                                                     () => { Console.WriteLine("H264FrameDecoder.DecodeFrame: EndOfStreamException"); });
            }
        }
Example #39
0
		public int sceKernelFreeVpl(CpuThreadState CpuThreadState, VariablePoolId VariablePoolId, PspPointer Data)
		{
			var VariablePool = VariablePoolList.Get(VariablePoolId);
			VariablePool.Free(CpuThreadState, Data);
			return 0;
		}
Example #40
0
        public int sceKernelTryAllocateFpl(PoolId PoolId, PspPointer* DataPointer)
        {
            var FixedPool = FixedPoolList.Get(PoolId);
            if (!FixedPool.TryAllocate(DataPointer))
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_KERNEL_NO_MEMORY));
            }

            return 0;
        }
 public int sceKernelSendMbx(MessageBox MessageBox, PspPointer Message)
 {
     return(MessageBox.Send(Message));
 }
Example #42
0
 public int sceKernelFreeVpl(CpuThreadState CpuThreadState, VariablePool VariablePool, PspPointer Data)
 {
     VariablePool.Free(CpuThreadState, Data);
     return(0);
 }