示例#1
0
        public virtual int sceDmacplusSc2MeLLI(TPointer32 dmacParameters)
        {
            int src        = dmacParameters.getValue(0);
            int dst        = dmacParameters.getValue(4);
            int next       = dmacParameters.getValue(8);
            int attributes = dmacParameters.getValue(12);

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("sceDmacplusSc2MeLLI src=0x{0:X8}, dst=0x{1:X8}, next=0x{2:X8}, attributes=0x{3:X}", src, dst, next, attributes));
            }

            return(0);
        }
示例#2
0
        public virtual int sceCccDecodeUTF16(TPointer32 srcAddrUTF16)
        {
            string srcString     = getStringUTF16(srcAddrUTF16.getValue());
            int    codePoint     = char.ConvertToUtf32(srcString, 0);
            int    codePointSize = Character.charCount(codePoint);

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("sceCccDecodeUTF16 string='{0}'(0x{1:X8}), codePoint=0x{2:X}(size={3:D})", srcString, srcAddrUTF16.getValue(), codePoint, codePointSize));
            }

            srcAddrUTF16.setValue(srcAddrUTF16.getValue() + (codePointSize << 1));

            return(codePoint);
        }
示例#3
0
        public virtual int mp4msv_AD3AF34E(TPointer32 unknown1, int unknown2, TPointer unknown3)
        {
            if (unknown1.Null)
            {
                return(4);
            }
            if (unknown1.getValue(0) == 0)
            {
                return(4);
            }
            TPointer unknown5 = unknown1.getPointer(0);

            if (unknown5.getValue32(184) == 0)
            {
                return(0x2003);
            }
            if (unknown2 == 0)
            {
                return(6);
            }
            if (unknown5.getValue32(220) == 0 || unknown5.getValue32(220) < unknown2)
            {
                return(0x2002);
            }
            int unknown4 = unknown5.getValue32(232) + 52 * (unknown2 - 1);

            unknown3.memcpy(unknown4, 40);

            return(0);
        }
示例#4
0
        public virtual int sceNpRosterGetBlockListEntryCount(int requestId, TPointer32 options)
        {
            if (options.NotNull && options.getValue() != 4)
            {
                return(-1);
            }

            return(dummyNumberBlockList);
        }
示例#5
0
        public virtual int sceMpegBaseCscAvcRange(TPointer bufferRGB, int unknown, TPointer32 rangeAddr, int bufferWidth, TPointer mp4AvcCscStructAddr)
        {
            SceMp4AvcCscStruct mp4AvcCscStruct = new SceMp4AvcCscStruct();

            mp4AvcCscStruct.read(mp4AvcCscStructAddr);

            int rangeX      = rangeAddr.getValue(0) << 4;
            int rangeY      = rangeAddr.getValue(4) << 4;
            int rangeWidth  = rangeAddr.getValue(8) << 4;
            int rangeHeight = rangeAddr.getValue(12) << 4;

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("sceMpegBaseCscAvcRange range x={0:D}, y={1:D}, width={2:D}, height={3:D}, {4}", rangeX, rangeY, rangeWidth, rangeHeight, mp4AvcCscStruct));
            }

            return(hleMpegBaseCscAvcRange(bufferRGB, unknown, bufferWidth, mp4AvcCscStruct, rangeX, rangeY, rangeWidth, rangeHeight));
        }
示例#6
0
        protected internal virtual void hleAfterReadContextCallback()
        {
            if (readMessage == null)
            {
                int size = 256;
                int mem  = Modules.sceNetIfhandleModule.hleNetMallocInternal(size);
                if (mem > 0)
                {
                    readMessage = new TPointer(Memory.Instance, mem);
                    readMessage.clear(size);
                    RuntimeContext.debugMemory(mem, size);
                }
            }

            if (readMessage != null)
            {
                // Store dummy message
                SceNetIfMessage message       = new SceNetIfMessage();
                TPointer        data          = new TPointer(Memory.Instance, readMessage.Address + message.@sizeof());
                TPointer        header        = new TPointer(data.Memory, data.Address);
                TPointer        content       = new TPointer(data.Memory, data.Address + 60);
                const int       contentLength = 8;
                // Header information:
                header.setArray(0, Wlan.MacAddress, 6);                                    // destination MAC address
                header.setArray(6, new sbyte[] { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66 }, 6); // source MAC address
                header.setValue8(48, (sbyte)1);                                            // 1 or 2
                header.setValue8(49, (sbyte)0);
                header.setValue16(50, (short)endianSwap16(12 + contentLength));            // value must be >= 12
                header.setValue16(52, (short)endianSwap16(0x22C));                         // source port
                header.setValue16(54, (short)endianSwap16(0x22C));                         // destination port
                header.setValue8(58, (sbyte)0);
                header.setValue8(59, (sbyte)0);

                // Real message content:
                content.setValue8(0, (sbyte)1);
                content.setValue8(1, (sbyte)1);
                content.setValue16(2, (short)endianSwap16(contentLength - 4)); // endian-swapped value, Length of following data
                content.setValue8(4, (sbyte)0);                                // Dummy data
                content.setValue8(5, (sbyte)0);
                content.setValue8(6, (sbyte)0);
                content.setValue8(7, (sbyte)0);

                message.dataAddr   = data.Address;
                message.dataLength = 60 + contentLength;
                message.unknown24  = 60 + contentLength;
                message.write(readMessage);

                TPointer readContext = new TPointer(Memory.Instance, readContextAddr.getValue());
                readContext.setValue32(0, readMessage.Address);
                readContext.setValue32(8, readContext.getValue32(8) + 1);
            }

            SceKernelThreadInfo thread = Modules.ThreadManForUserModule.CurrentThread;

            Modules.ThreadManForUserModule.executeCallback(thread, readCallback, null, true);
        }
示例#7
0
        public virtual TPointer32 checkPsmf(TPointer32 psmf)
        {
            int headerAddress = psmf.getValue(24);

            if (!psmfHeaderMap.ContainsKey(headerAddress))
            {
                throw new SceKernelErrorException(SceKernelErrors.ERROR_PSMF_NOT_FOUND);
            }

            return(psmf);
        }
示例#8
0
        public virtual int scePsmfPlayerStart(int psmfPlayer, TPointer32 initPlayInfoAddr, int initPts)
        {
            // Read the playback parameters.
            if (initPlayInfoAddr.NotNull)
            {
                videoCodec     = initPlayInfoAddr.getValue(0);
                videoStreamNum = initPlayInfoAddr.getValue(4);
                audioCodec     = initPlayInfoAddr.getValue(8);
                audioStreamNum = initPlayInfoAddr.getValue(12);
                playMode       = initPlayInfoAddr.getValue(16);
                playSpeed      = initPlayInfoAddr.getValue(20);

                Modules.sceMpegModule.RegisteredVideoChannel = videoStreamNum;
                Modules.sceMpegModule.RegisteredAudioChannel = audioStreamNum;

                if (log.InfoEnabled)
                {
                    Console.WriteLine(string.Format("Found play info data: videoCodec=0x{0:X}, videoStreamNum={1:D}, audioCodec=0x{2:X}, audioStreamNum={3:D}, playMode={4:D}, playSpeed={5:D}", videoCodec, videoStreamNum, audioCodec, audioStreamNum, playMode, playSpeed));
                }
            }

            this.initPts = initPts;

            // Switch to PLAYING.
            psmfPlayerStatus = PSMF_PLAYER_STATUS_PLAYING;

            lastMpegGetAtracAuResult = 0;

            return(0);
        }
示例#9
0
        public virtual int scePsmfPlayerCreate(int psmfPlayer, TPointer32 psmfPlayerDataAddr)
        {
            // The psmfDataAddr contains three fields that are manually set before
            // scePsmfPlayerCreate is called.
            displayBuffer          = psmfPlayerDataAddr.getValue(0) & Memory.addressMask; // The buffer allocated for scePsmf, which is ported into scePsmfPlayer.
            displayBufferSize      = psmfPlayerDataAddr.getValue(4);                      // The buffer's size.
            playbackThreadPriority = psmfPlayerDataAddr.getValue(8);                      // Priority of the "START" thread.
            if (log.InfoEnabled)
            {
                Console.WriteLine(string.Format("PSMF Player Data: displayBuffer=0x{0:X8}, displayBufferSize=0x{1:X}, playbackThreadPriority={2:D}", displayBuffer, displayBufferSize, playbackThreadPriority));
            }

            // Allocate memory for the MPEG structure
            Memory mem = Memory.Instance;

            mpegMem = Modules.SysMemUserForUserModule.malloc(KERNEL_PARTITION_ID, Name + "-Mpeg", PSP_SMEM_Low, MPEG_MEMSIZE, 0);
            int result = Modules.sceMpegModule.hleMpegCreate(TPointer.NULL, new TPointer(mem, mpegMem.addr), MPEG_MEMSIZE, null, Screen.width, 0, 0);

            if (result < 0)
            {
                Console.WriteLine(string.Format("scePsmfPlayerCreate: error 0x{0:X8} while calling hleMpegCreate", result));
            }

            // Allocate memory for the ringbuffer, scePsmfPlayer creates a ringbuffer with 581 packets
            const int packets = 581;

            ringbufferMem = Modules.SysMemUserForUserModule.malloc(KERNEL_PARTITION_ID, Name + "-Ringbuffer", PSP_SMEM_Low, packets * ringbufferPacketSize, 0);
            Modules.sceMpegModule.hleCreateRingbuffer(packets, ringbufferMem.addr, ringbufferMem.size);
            SceMpegRingbuffer ringbuffer = Modules.sceMpegModule.MpegRingbuffer;

            // This ringbuffer is used both for audio and video
            ringbuffer.HasAudio = true;
            ringbuffer.HasVideo = true;

            // Start with INIT.
            psmfPlayerStatus = PSMF_PLAYER_STATUS_INIT;

            return(0);
        }
示例#10
0
        public virtual int sceNetAdhocMatchingGetMembers(int matchingId, TPointer32 sizeAddr, TPointer buf)
        {
            const int matchingMemberSize = 12;

            MatchingObject           matchingObject = matchingObjects[matchingId];
            IList <pspNetMacAddress> members        = matchingObject.Members;

            int size = sizeAddr.getValue();

            sizeAddr.setValue(matchingMemberSize * members.Count);
            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("sceNetAdhocMatchingGetMembers returning size={0:D}", sizeAddr.getValue()));
            }

            if (buf.NotNull)
            {
                int offset = 0;
                foreach (pspNetMacAddress member in members)
                {
                    // Check if enough space available to write the next structure
                    if (offset + matchingMemberSize > size || member == null)
                    {
                        break;
                    }

                    //if (log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("sceNetAdhocMatchingGetMembers returning {0} at 0x{1:X8}", member, buf.Address + offset));
                    }

                    /// <summary>
                    /// Pointer to next Member structure in list: will be written later </summary>
                    offset += 4;

                    /// <summary>
                    /// MAC address </summary>
                    member.write(buf, offset);
                    offset += member.@sizeof();

                    /// <summary>
                    /// Padding </summary>
                    buf.setValue16(offset, (short)0);
                    offset += 2;
                }

                fillNextPointersInLinkedList(buf, offset, matchingMemberSize);
            }

            return(0);
        }
示例#11
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public bool pollRecv(pspsharp.HLE.TPointer srcMacAddr, pspsharp.HLE.TPointer16 portAddr, pspsharp.HLE.TPointer data, pspsharp.HLE.TPointer32 dataLengthAddr, pspsharp.HLE.kernel.types.SceKernelThreadInfo thread) throws java.io.IOException
        public virtual bool pollRecv(TPointer srcMacAddr, TPointer16 portAddr, TPointer data, TPointer32 dataLengthAddr, SceKernelThreadInfo thread)
        {
            int  Length    = dataLengthAddr.getValue();
            bool completed = false;

            if (rcvdMessages.Count == 0)
            {
                update();
            }

            if (rcvdMessages.Count > 0)
            {
                AdhocBufferMessage bufferMessage = rcvdMessages.First.Value;
                if (Length < bufferMessage.Length)
                {
                    // Buffer is too small to contain all the available data.
                    // Return the buffer size that would be required.
                    dataLengthAddr.setValue(bufferMessage.Length);
                    setReturnValue(thread, SceKernelErrors.ERROR_NET_BUFFER_TOO_SMALL);
                }
                else
                {
                    // Copy the data already received
                    dataLengthAddr.setValue(bufferMessage.Length);
                    Memory.Instance.memcpy(data.Address, buffer.addr + bufferMessage.offset, bufferMessage.Length);
                    if (srcMacAddr != null && !srcMacAddr.Null)
                    {
                        bufferMessage.macAddress.write(srcMacAddr);
                    }
                    if (portAddr != null && portAddr.NotNull)
                    {
                        portAddr.Value = bufferMessage.port;
                    }

                    removeFirstReceivedMessage();

                    //if (log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("Returned received data: {0:D} bytes from {1} on port {2:D}", dataLengthAddr.getValue(), bufferMessage.macAddress, portAddr.Value));
                        if (log.TraceEnabled)
                        {
                            log.trace(string.Format("Returned data: {0}", Utilities.getMemoryDump(data.Address, dataLengthAddr.getValue())));
                        }
                    }
                    setReturnValue(thread, 0);
                }
                completed = true;
            }

            return(completed);
        }
示例#12
0
        public virtual int sceHeapAllocHeapMemoryWithOption(TPointer heapAddr, int memSize, TPointer32 paramAddr)
        {
            int alignment = defaultAllocAlignment;

            if (paramAddr.NotNull)
            {
                int paramSize = paramAddr.getValue(0);
                if (paramSize == 8)
                {
                    alignment = paramAddr.getValue(4);
                    //if (log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("sceHeapAllocHeapMemoryWithOption options: struct size={0:D}, alignment=0x{1:X}", paramSize, alignment));
                    }
                }
                else
                {
                    Console.WriteLine(string.Format("sceHeapAllocHeapMemoryWithOption option at {0}(size={1:D})", paramAddr, paramSize));
                }
            }

            // Try to allocate memory from the heap and return it's address.
            HeapInfo heapInfo = heapMap[heapAddr.Address];

            if (heapInfo == null)
            {
                return(0);
            }

            int allocatedAddr = heapInfo.alloc(memSize, alignment);

            if (log.TraceEnabled)
            {
                log.trace(string.Format("sceHeapAllocHeapMemoryWithOption returns 0x{0:X8}, after allocation: {1}", allocatedAddr, heapInfo));
            }

            return(allocatedAddr);
        }
示例#13
0
        public virtual int sceKernelLoadExec(PspString filename, TPointer32 optionAddr)
        {
            int argSize = 0;
            int argAddr = 0;

            if (optionAddr.NotNull)
            {
                int optSize = optionAddr.getValue(0);                 // Size of the option struct.
                if (optSize >= 16)
                {
                    argSize = optionAddr.getValue(4);                     // Size of memory required for arguments.
                    argAddr = optionAddr.getValue(8);                     // Arguments (memory area of size argSize).
                    int keyAddr = optionAddr.getValue(12);                // Pointer to an encryption key (may not be used).

                    //if (log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("sceKernelLoadExec params: optSize={0:D}, argSize={1:D}, argAddr=0x{2:X8}, keyAddr=0x{3:X8}: {4}", optSize, argSize, argAddr, keyAddr, Utilities.getMemoryDump(argAddr, argSize)));
                    }
                }
            }

            return(hleKernelLoadExec(filename, argSize, argAddr));
        }
示例#14
0
        public virtual int sceNetAdhocMatchingGetHelloOpt(int matchingId, TPointer32 optLenAddr, TPointer optData)
        {
            MatchingObject matchingObject = matchingObjects[matchingId];
            int            helloOptLen    = matchingObject.HelloOptLen;

            int bufSize = optLenAddr.getValue();

            optLenAddr.setValue(helloOptLen);

            if (helloOptLen > 0 && optData.Address != 0 && bufSize > 0)
            {
                int Length = System.Math.Min(bufSize, helloOptLen);
                writeBytes(optData.Address, Length, matchingObject.HelloOptData, 0);
            }

            return(0);
        }
示例#15
0
        public virtual int sceNpRosterGetBlockListEntry(int requestId, int numEntries, int startIndex, TPointer32 countAddr, TPointer32 numberRetrieved, TPointer buffer, TPointer32 options)
        {
            if (options.NotNull && options.getValue() != 4)
            {
                return(-1);
            }

            countAddr.setValue(dummyNumberBlockList);
            numberRetrieved.setValue(dummyNumberBlockList);

            for (int i = 0; i < dummyNumberBlockList; i++)
            {
                buffer.setStringNZ(i * 36, 16, string.Format("DummyBlocked#{0:D}", i));
            }

            return(0);
        }
示例#16
0
        public virtual int sceNetApctlGetBSSDescIDListUser(TPointer32 sizeAddr, TPointer buf)
        {
            const int userInfoSize = 8;
            int       entries      = 1;
            int       size         = sizeAddr.getValue();

            // Return size required
            sizeAddr.setValue(entries * userInfoSize);

            if (buf.NotNull)
            {
                int offset = 0;
                for (int i = 0; i < entries; i++)
                {
                    // Check if enough space available to write the next structure
                    if (offset + userInfoSize > size)
                    {
                        break;
                    }

                    //if (log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("sceNetApctlGetBSSDescIDListUser returning {0:D} at 0x{1:X8}", i, buf.Address + offset));
                    }

                    /// <summary>
                    /// Pointer to next Network structure in list: will be written later </summary>
                    offset += 4;

                    /// <summary>
                    /// Entry ID </summary>
                    buf.setValue32(offset, i);
                    offset += 4;
                }

                fillNextPointersInLinkedList(buf, offset, userInfoSize);
            }

            return(0);
        }
示例#17
0
        public virtual int sceCccEncodeUTF8(TPointer32 dstAddr, int ucs4char)
        {
            char[] chars = Character.toChars(ucs4char);
            if (chars == null)
            {
                return(0);
            }

            string s = new string(chars);

            sbyte[] bytes  = s.GetBytes(charsetUTF8);
            int     addr   = dstAddr.getValue();
            int     Length = writeStringBytes(bytes, addr, 100, 0);

            dstAddr.setValue(addr + Length);

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("sceCccEncodeUTF8 encoding '{0}' into {1:D} bytes", s, Length));
            }

            return(0);
        }
示例#18
0
        private bool checkEventFlag(SceKernelEventFlagInfo @event, int bits, int wait, TPointer32 outBitsAddr)
        {
            bool matched = false;

            if (((wait & PSP_EVENT_WAITANDOR_MASK) == PSP_EVENT_WAITAND) && ((@event.currentPattern & bits) == bits))
            {
                matched = true;
            }
            else if (((wait & PSP_EVENT_WAITANDOR_MASK) == PSP_EVENT_WAITOR) && ((@event.currentPattern & bits) != 0))
            {
                matched = true;
            }

            if (matched)
            {
                // Write current pattern.
                outBitsAddr.setValue(@event.currentPattern);
                if (log.DebugEnabled && outBitsAddr.NotNull)
                {
                    Console.WriteLine(string.Format("checkEventFlag returning outBits=0x{0:X} at {1}", outBitsAddr.getValue(), outBitsAddr));
                }

                if ((wait & PSP_EVENT_WAITCLEARALL) == PSP_EVENT_WAITCLEARALL)
                {
                    @event.currentPattern = 0;
                }
                if ((wait & PSP_EVENT_WAITCLEAR) == PSP_EVENT_WAITCLEAR)
                {
                    @event.currentPattern &= ~bits;
                }
            }
            return(matched);
        }
示例#19
0
		public virtual int sceMp3Decode(int id, TPointer32 bufferAddress)
		{
			int result = getMp3Info(id).decode(bufferAddress);

			//if (log.DebugEnabled)
			{
				Console.WriteLine(string.Format("sceMp3Decode bufferAddress={0}(0x{1:X8}) returning 0x{2:X}", bufferAddress, bufferAddress.getValue(), result));
			}

			if (result >= 0)
			{
				Modules.ThreadManForUserModule.hleKernelDelayThread(mp3DecodeDelay, false);
			}

			return result;
		}
示例#20
0
		public virtual int sceMp3GetInfoToAddStreamData(int id, TPointer32 writeAddr, TPointer32 writableBytesAddr, TPointer32 readOffsetAddr)
		{
			Mp3Info info = getMp3Info(id);
			writeAddr.setValue(info.InputBuffer.WriteAddr);
			writableBytesAddr.setValue(info.WritableBytes);
			readOffsetAddr.setValue(info.InputBuffer.FilePosition);

			//if (log.DebugEnabled)
			{
				Console.WriteLine(string.Format("sceMp3GetInfoToAddStreamData returning writeAddr=0x{0:X8}, writableBytes=0x{1:X}, readOffset=0x{2:X}", writeAddr.getValue(), writableBytesAddr.getValue(), readOffsetAddr.getValue()));
			}
			return 0;
		}
示例#21
0
        public virtual int scePsmfPlayerGetVideoData(int psmfPlayer, TPointer32 videoDataAddr)
        {
            int result = 0;

            if (psmfPlayerStatus != PSMF_PLAYER_STATUS_PLAYING && psmfPlayerStatus != PSMF_PLAYER_STATUS_PLAYING_FINISHED)
            {
                return(ERROR_PSMFPLAYER_NOT_INITIALIZED);
            }

            if (playMode == PSMF_PLAYER_MODE_PAUSE)
            {
                //if (log.DebugEnabled)
                {
                    Console.WriteLine(string.Format("scePsmfPlayerGetVideoData in pause mode, returning 0x{0:X8}", result));
                }
                return(result);
            }

            if (videoDataAddr.NotNull)
            {
                videoDataFrameWidth    = videoDataAddr.getValue(0);
                videoDataDisplayBuffer = videoDataAddr.getValue(4) & Memory.addressMask;
                videoDataDisplayPts    = videoDataAddr.getValue(8);
                //if (log.DebugEnabled)
                {
                    Console.WriteLine(string.Format("scePsmfPlayerGetVideoData videoDataFrameWidth={0:D}, videoDataDisplayBuffer=0x{1:X8}, videoDataDisplayPts={2:D}", videoDataFrameWidth, videoDataDisplayBuffer, videoDataDisplayPts));
                }
            }

            // Check if there's already a valid pointer at videoDataAddr.
            // If not, use the displayBuffer from scePsmfPlayerCreate.
            if (Memory.isAddressGood(videoDataDisplayBuffer))
            {
                displayBuffer = videoDataDisplayBuffer;
            }
            else if (videoDataAddr.NotNull)
            {
                videoDataAddr.setValue(4, displayBuffer);
                // Valid frame width?
                if (videoDataFrameWidth <= 0 || videoDataFrameWidth > 512)
                {
                    videoDataFrameWidth = 512;
                    videoDataAddr.setValue(0, videoDataFrameWidth);
                }
            }

            if (CurrentAudioTimestamp > 0 && CurrentVideoTimestamp > 0 && CurrentVideoTimestamp > CurrentAudioTimestamp + MaxTimestampDifference && lastMpegGetAtracAuResult == 0)
            {
                //result = SceKernelErrors.ERROR_PSMFPLAYER_AUDIO_VIDEO_OUT_OF_SYNC;
                Modules.sceMpegModule.writeLastFrameABGR(displayBuffer, videoDataFrameWidth, videoPixelMode);
            }
            else
            {
                // Check if the ringbuffer needs additional data
                hlePsmfFillRingbuffer(Emulator.Memory);

                // Retrieve the video Au
                result = Modules.sceMpegModule.hleMpegGetAvcAu(null);
                if (result < 0)
                {
                    // We have reached the end of the file...
                    if (pmfFileDataRingbufferPosition >= pmfFileData.Length)
                    {
                        SceMpegRingbuffer ringbuffer = Modules.sceMpegModule.MpegRingbuffer;
                        ringbuffer.consumeAllPackets();
                    }
                }
                else
                {
                    // Write the video data
                    result = Modules.sceMpegModule.hleMpegAvcDecode(displayBuffer, videoDataFrameWidth, videoPixelMode, null, true, TPointer.NULL);
                }
            }

            // Do not cache the video image as a texture in the VideoEngine to allow fluid rendering
            VideoEngine.Instance.addVideoTexture(displayBuffer, displayBuffer + 272 * videoDataFrameWidth * sceDisplay.getPixelFormatBytes(videoPixelMode));

            // Return updated timestamp
            videoDataAddr.setValue(8, (int)CurrentVideoTimestamp);

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("scePsmfPlayerGetVideoData currentVideoTimestamp={0:D}, returning 0x{1:X8}", CurrentVideoTimestamp, result));
            }

            return(result);
        }
示例#22
0
        public virtual int sceParseHttpResponseHeader(TPointer header, int headerLength, PspString fieldName, TPointer32 valueAddr, TPointer32 valueLength)
        {
            IMemoryReader memoryReader = MemoryReader.getMemoryReader(header.Address, headerLength, 1);
            int           endAddress   = header.Address + headerLength;

            bool found = false;

            while (memoryReader.CurrentAddress < endAddress)
            {
                int      addr         = memoryReader.CurrentAddress;
                string   headerString = getHeaderString(memoryReader);
                string[] fields       = headerString.Split(" *: *", 2);
                if (fields != null && fields.Length == 2)
                {
                    if (fields[0].Equals(fieldName.String, StringComparison.OrdinalIgnoreCase))
                    {
                        addr += fields[0].Length;
                        Memory mem = header.Memory;
                        int    c;
                        while (true)
                        {
                            c = mem.read8(addr);
                            if (c != ' ')
                            {
                                break;
                            }
                            addr++;
                        }
                        c = mem.read8(addr++);
                        if (c == ':')
                        {
                            while (true)
                            {
                                c = mem.read8(addr);
                                if (c != ' ')
                                {
                                    break;
                                }
                                addr++;
                            }

                            valueLength.setValue(memoryReader.CurrentAddress - addr - 1);
                            valueAddr.setValue(addr);
                            found = true;
                            //if (log.DebugEnabled)
                            {
                                Console.WriteLine(string.Format("sceParseHttpResponseHeader returning valueLength=0x{0:X}: {1}", valueLength.getValue(), Utilities.getMemoryDump(valueAddr.getValue(), valueLength.getValue())));
                            }
                            break;
                        }
                    }
                }
            }

            if (!found)
            {
                valueAddr.setValue(0);
                valueLength.setValue(0);
                return(SceKernelErrors.ERROR_PARSE_HTTP_NOT_FOUND);
            }

            return(memoryReader.CurrentAddress - 1 - header.Address);
        }
示例#23
0
        public virtual int scePsmfGetCurrentStreamType(TPointer32 psmf, TPointer32 typeAddr, TPointer32 channelAddr)
        {
            PSMFHeader header = getPsmfHeader(psmf);

            typeAddr.setValue(header.CurrentStreamType);
            channelAddr.setValue(header.CurrentStreamChannel);

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("scePsmfGetCurrentStreamType returning type={0:D}, channel={1:D}", typeAddr.getValue(), channelAddr.getValue()));
            }

            return(0);
        }
示例#24
0
        private PSMFHeader getPsmfHeader(TPointer32 psmf)
        {
            int headerAddress = psmf.getValue(24);

            return(psmfHeaderMap[headerAddress]);
        }