Пример #1
0
 //[HlePspNotImplemented]
 public int sceMpegRingbufferDestruct(SceMpegRingbuffer *ringbuffer)
 {
     ringbuffer->PacketsAvailable = ringbuffer->PacketsTotal;
     ringbuffer->PacketsRead      = 0;
     ringbuffer->PacketsWritten   = 0;
     return(0);
 }
Пример #2
0
        public int sceMpegCreate(SceMpegPointer *sceMpegPointer, void *mpegData, int mpegSize,
                                 SceMpegRingbuffer *sceMpegRingbuffer, int frameWidth, int mode, int ddrTop)
        {
            //return -1;

            var mpeg = GetMpeg(sceMpegPointer);

            if (mpegSize < sceMpegQueryMemSize(0))
            {
                throw (new SceKernelException(SceKernelErrors.ERROR_MPEG_NO_MEMORY));
            }

            // Update the ring buffer struct.
            if (sceMpegRingbuffer->PacketSize == 0)
            {
                sceMpegRingbuffer->PacketsAvailable = 0;
            }
            else
            {
                sceMpegRingbuffer->PacketsAvailable =
                    (int)((sceMpegRingbuffer->DataEnd.Address - sceMpegRingbuffer->Data.Address) /
                          sceMpegRingbuffer->PacketSize);
            }

            sceMpegRingbuffer->SceMpeg = Memory.PointerToPspPointer(sceMpegPointer);

            SceMpeg *sceMpegData = (SceMpeg *)(((byte *)mpegData) + 0x30);

            sceMpegPointer->SceMpeg = Memory.PointerToPspPointer(sceMpegData);

            PointerUtils.StoreStringOnPtr("LIBMPEG", Encoding.UTF8, sceMpegData->MagicBytes);
            PointerUtils.StoreStringOnPtr("001", Encoding.UTF8, sceMpegData->VersionBytes);
            sceMpegData->Pad = -1;
            sceMpegData->RingBufferAddress          = Memory.PointerToPspPointer(sceMpegRingbuffer);
            sceMpegData->RingBufferAddressDataUpper = sceMpegRingbuffer->DataEnd;
            sceMpegData->FrameWidth                 = frameWidth;
            sceMpegData->SceMpegAvcMode.Mode        = -1;
            sceMpegData->SceMpegAvcMode.PixelFormat = GuPixelFormats.Rgba8888;
            sceMpegData->VideoFrameCount            = 0;
            sceMpegData->AudioFrameCount            = 0;

            sceMpegRingbuffer->PacketsTotal = 0;

            mpeg.ReadPackets = numPackets => (int)HleInterop.ExecuteFunctionNow(sceMpegRingbuffer->Callback,
                                                                                sceMpegRingbuffer->Data,
                                                                                numPackets, sceMpegRingbuffer->CallbackParameter);

            mpeg._Mpeg = sceMpegPointer;
            mpeg.Data  = sceMpegData;
            mpeg.Create();

            return(0);
        }
Пример #3
0
        //[HlePspNotImplemented]
        public int sceMpegRingbufferPut(SceMpegRingbuffer *ringbuffer, int numPackets, int available)
        {
            if (numPackets < 0)
            {
                return(0);
            }

            numPackets = Math.Min(available, numPackets);

            var sceMpegPointer    = (SceMpegPointer *)ringbuffer->SceMpeg.GetPointer <SceMpegPointer>(Memory);
            var mpeg              = GetMpeg(sceMpegPointer);
            var sceMpeg           = sceMpegPointer->GetSceMpeg(Memory);
            var mpegStreamPackets = (int)MathUtils.RequiredBlocks(sceMpeg->StreamSize, ringbuffer->PacketSize);
            var remainingPackets  = Math.Max(0, mpegStreamPackets - ringbuffer->PacketsRead);

            var packetsAdded = mpeg.ReadPackets(numPackets);
            var dataLength   = (int)(packetsAdded * ringbuffer->PacketSize);

            mpeg.WriteData(ringbuffer->Data.GetPointer(Memory, dataLength), dataLength);

            //
            //NumPackets = Math.Min(NumPackets, RemainingPackets);
            //
            //var PacketsAdded = (int)HleInterop.ExecuteFunctionNow(Ringbuffer->Callback, Ringbuffer->Data, NumPackets, Ringbuffer->CallbackParameter);
            //
            //if (PacketsAdded > 0)
            //{
            //	var DataLength = (int)(PacketsAdded * Ringbuffer->PacketSize);
            //	var DataPointer = Ringbuffer->Data.GetPointer(Memory, DataLength);
            //
            //	Mpeg.WriteData(DataPointer, DataLength);
            //
            //	//if (PacketsAdded > Ringbuffer->PacketsFree)
            //	//{
            //	//	PacketsAdded = Ringbuffer->PacketsFree;
            //	//}
            //
            //	//Ringbuffer->PacketsFree -= packetsAdded;
            //	//Ringbuffer->Data.Address += (uint)(Ringbuffer->PacketSize * packetsAdded);
            //
            //	//throw(new NotImplementedException());
            //	Console.Error.WriteLine("sceMpegRingbufferPut.NotImplemented");
            //}
            //
            ////Ringbuffer->PacketsFree -= NumPackets;
            ////Ringbuffer->PacketsWritten += NumPackets;

            return(packetsAdded);
        }
Пример #4
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);
        }
Пример #5
0
 //[HlePspNotImplemented]
 public int sceMpegRingbufferAvailableSize(SceMpegRingbuffer *ringbuffer)
 {
     return(ringbuffer->PacketsAvailable);
 }
Пример #6
0
 public int sceMpegCreate(SceMpeg *Mpeg, void *pData, int iSize, SceMpegRingbuffer *Ringbuffer, int iFrameWidth, int iUnk1, int iUnk2)
 {
     //throw (new NotImplementedException());
     //Ringbuffer.iPackets = 0;
     return(-1);
 }
Пример #7
0
 public int sceMpegRingbufferConstruct(SceMpegRingbuffer *Ringbuffer, int iPackets, void *pData, int iSize, int /*sceMpegRingbufferCB*/ Callback, void *pCBparam)
 {
     //throw(new NotImplementedException());
     return(0);
 }
Пример #8
0
 public void sceMpegRingbufferDestruct(SceMpegRingbuffer *Ringbuffer)
 {
     //throw(new NotImplementedException());
 }
Пример #9
0
 public int sceMpegRingbufferPut(SceMpegRingbuffer *Ringbuffer, int iNumPackets, int iAvailable)
 {
     //throw(new NotImplementedException());
     return(0);
 }
Пример #10
0
 public int sceMpegRingbufferAvailableSize(SceMpegRingbuffer *Ringbuffer)
 {
     //throw(new NotImplementedException());
     //return -1;
     return(0);
 }