Exemple #1
0
        public int sceUtilityGetSystemParamString(PSP_SYSTEMPARAM_ID id, byte *str, int len)
        {
            var Value = _sceUtilityGetSystemParamString(id);

            PointerUtils.StoreStringOnPtr(Value, Encoding.ASCII, str, len);
            return(0);
        }
Exemple #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);
        }
Exemple #3
0
        public int sceNetEtherNtostr(byte *MacAddress, char *OutputString)
        {
            var Parts = new string[6];

            for (int n = 0; n < 6; n++)
            {
                Parts[n] = "%02X".Sprintf((uint)MacAddress[n]);
            }
            PointerUtils.StoreStringOnPtr(string.Join(":", Parts), Encoding.UTF8, (byte *)OutputString);

            return(0);
            //throw (new NotImplementedException());
        }
Exemple #4
0
        public unsafe int IoDread(HleIoDrvFileArg HleIoDrvFileArg, HleIoDirent *IoDirent)
        {
            var Enumerator = (DirectoryEnumerator <IsoNode>)HleIoDrvFileArg.FileArgument;

            // More items.
            if (Enumerator.MoveNext())
            {
                //Console.Error.WriteLine("'{0}'", Enumerator.Current.ToString());
                var IsoNode = Enumerator.Current;
                {
                    PointerUtils.StoreStringOnPtr(IsoNode.Name, Encoding.UTF8, IoDirent->Name);
                    _IoGetstat(IsoNode, &IoDirent->Stat);
                }
            }
            // No more items.
            else
            {
            }

            return(Enumerator.GetLeft());
        }
        public unsafe int IoDread(HleIoDrvFileArg HleIoDrvFileArg, HleIoDirent *IoDirent)
        {
            var Enumerator = (DirectoryEnumerator <FileSystemInfo>)HleIoDrvFileArg.FileArgument;

            // More items.
            if (Enumerator.MoveNext())
            {
                //Console.Error.WriteLine("'{0}'", Enumerator.Current.ToString());
                var FileSystemInfo = Enumerator.Current;
                var FileInfo       = (FileSystemInfo as FileInfo);
                var DirectoryInfo  = (FileSystemInfo as DirectoryInfo);
                {
                    PointerUtils.StoreStringOnPtr(FileSystemInfo.Name, Encoding.UTF8, IoDirent->Name);
                    IoDirent->Stat.Size = (FileInfo != null) ? FileInfo.Length : 0;
                    //IoDirent->Stat.Mode = SceMode

                    if (DirectoryInfo != null)
                    {
                        IoDirent->Stat.Mode       = SceMode.Directory | (SceMode)0777;
                        IoDirent->Stat.Attributes = IOFileModes.Directory;
                    }
                    else
                    {
                        IoDirent->Stat.Mode       = SceMode.File | (SceMode)0777;
                        IoDirent->Stat.Attributes = IOFileModes.File | IOFileModes.CanRead | IOFileModes.CanWrite | IOFileModes.CanExecute;
                    }

                    IoDirent->Stat.DeviceDependentData0 = 10;
                }
            }
            // No more items.
            else
            {
            }

            return(Enumerator.GetLeft());
        }
Exemple #6
0
 public int sceUtilityGetNetParam(int conf, int param, NetData *data)
 {
     PointerUtils.StoreStringOnPtr("Temp", Encoding.UTF8, data[0].asString, 128);
     //throw(new NotImplementedException());
     return(0);
 }