Пример #1
0
        protected internal override void memcpy(int destination, int source, int Length, bool checkOverlap)
        {
            if (Length <= 0)
            {
                return;
            }

            destination &= addressMask;
            source      &= addressMask;
            Modules.sceDisplayModule.write(destination);

            if (!checkOverlap || source >= destination || !areOverlapping(destination, source, Length))
            {
                NativeMemoryUtils.memcpy(memory, destination, memory, source, Length);
            }
            else
            {
                // Source and destination are overlapping and source < destination,
                // copy from the tail.
                for (int i = Length - 1; i >= 0; i--)
                {
                    int b = NativeMemoryUtils.read8(memory, source + i);
                    NativeMemoryUtils.write8(memory, destination + i, b);
                }
            }
        }
Пример #2
0
        protected internal override void memcpy(int destination, int source, int Length, bool checkOverlap)
        {
            if (Length <= 0)
            {
                return;
            }

            destination &= addressMask;
            source      &= addressMask;
            Modules.sceDisplayModule.write(destination);

            if (!checkOverlap || source >= destination || !areOverlapping(destination, source, Length))
            {
                while (Length > 0)
                {
                    int pageLengthDestination = System.Math.Min(pageSize - (destination & pageMask), Length);
                    int pageLengthSource      = System.Math.Min(pageSize - (source & pageMask), Length);
                    int pageLength            = System.Math.Min(pageLengthDestination, pageLengthSource);
                    NativeMemoryUtils.memcpy(memory[destination >> pageShift], destination & pageMask, memory[source >> pageShift], source & pageMask, pageLength);
                    Length      -= pageLength;
                    destination += pageLength;
                    source      += pageLength;
                }
            }
            else
            {
                // Source and destination are overlapping and source < destination,
                // copy from the tail.
                for (int i = Length - 1; i >= 0; i--)
                {
                    int b = read8(source + i);
                    write8(destination + i, (sbyte)b);
                }
            }
        }