Beispiel #1
0
        public static void captureRAM(int address, int Length)
        {
            if (!captureInProgress)
            {
                VideoEngine.log_Renamed.warn("Ignoring captureRAM, capture hasn't been started");
                return;
            }

            if (!Memory.isAddressGood(address))
            {
                return;
            }

            try
            {
                // write ram fragment
                CaptureHeader header = new CaptureHeader(CaptureHeader.PACKET_TYPE_RAM);
                header.write(@out);

                CaptureRAM captureRAM = new CaptureRAM(address, Length);
                captureRAM.write(@out);
            }
            catch (Exception e)
            {
                VideoEngine.log_Renamed.error("Failed to capture RAM: " + e.Message);
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static CaptureList read(java.io.InputStream in) throws java.io.IOException
        public static CaptureList read(System.IO.Stream @in)
        {
            CaptureList list = new CaptureList();

            DataInputStream data          = new DataInputStream(@in);
            int             sizeRemaining = data.readInt();

            if (sizeRemaining >= 16)
            {
                int list_addr = data.readInt();
                sizeRemaining -= 4;
                int stall_addr = data.readInt();
                sizeRemaining -= 4;
                int cbid = data.readInt();
                sizeRemaining -= 4;
                data.skipBytes(sizeRemaining);

                list.list = new PspGeList(0);
                list.list.init(list_addr, stall_addr, cbid, null);

                CaptureHeader header     = CaptureHeader.read(@in);
                int           packetType = header.PacketType;
                if (packetType != CaptureHeader.PACKET_TYPE_RAM)
                {
                    throw new IOException("Expected CaptureRAM(" + CaptureHeader.PACKET_TYPE_RAM + ") packet, found " + packetType);
                }
                list.listBuffer = CaptureRAM.read(@in);
            }
            else
            {
                throw new IOException("Not enough bytes remaining in stream");
            }

            return(list);
        }
Beispiel #3
0
        public static void startReplay(string filename)
        {
            if (captureInProgress)
            {
                VideoEngine.log_Renamed.error("Ignoring startReplay, capture is in progress");
                return;
            }

            VideoEngine.log_Renamed.info("Starting replay: " + filename);

            try
            {
                System.IO.Stream @in = new BufferedInputStream(new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read));

                while (@in.available() > 0)
                {
                    CaptureHeader header     = CaptureHeader.read(@in);
                    int           packetType = header.PacketType;

                    switch (packetType)
                    {
                    case CaptureHeader.PACKET_TYPE_LIST:
                        CaptureList list = CaptureList.read(@in);
                        list.commit();
                        break;

                    case CaptureHeader.PACKET_TYPE_RAM:
                        CaptureRAM ramFragment = CaptureRAM.read(@in);
                        ramFragment.commit();
                        break;

                    // deprecated
                    case CaptureHeader.PACKET_TYPE_DISPLAY_DETAILS:
                        CaptureDisplayDetails displayDetails = CaptureDisplayDetails.read(@in);
                        displayDetails.commit();
                        break;

                    case CaptureHeader.PACKET_TYPE_FRAMEBUF_DETAILS:
                        // don't replay this one immediately, wait until after the list has finished executing
                        replayFrameBufDetails = CaptureFrameBufDetails.read(@in);
                        break;

                    default:
                        throw new Exception("Unknown packet type " + packetType);
                    }
                }

                @in.Close();
            }
            catch (Exception e)
            {
                VideoEngine.log_Renamed.error("Failed to start replay: " + e.Message);
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
            }
        }
Beispiel #4
0
        public static void startCapture(string filename, PspGeList list)
        {
            //public static void startCapture(int displayBufferAddress, int displayBufferWidth, int displayBufferPsm,
            //    int drawBufferAddress, int drawBufferWidth, int drawBufferPsm,
            //    int depthBufferAddress, int depthBufferWidth) {
            if (captureInProgress)
            {
                VideoEngine.log_Renamed.error("Ignoring startCapture, capture is already in progress");
                return;
            }

            // Set the VideoEngine log level to TRACE when capturing,
            // the information in the log file is also interesting
            logLevel = VideoEngine.log_Renamed.Level;
            VideoEngine.Instance.LogLevel = Level.TRACE;
            capturedImages = new HashSet <int>();

            try
            {
                VideoEngine.log_Renamed.info("Starting capture... (list=" + list.id + ")");
                @out = new BufferedOutputStream(new System.IO.FileStream(filename, System.IO.FileMode.Create, System.IO.FileAccess.Write));

                CaptureHeader header;

                /*
                 * // write render target details
                 * header = new CaptureHeader(CaptureHeader.PACKET_TYPE_DISPLAY_DETAILS);
                 * header.write(out);
                 * CaptureDisplayDetails displayDetails = new CaptureDisplayDetails();
                 * displayDetails.write(out);
                 */

                // write command buffer
                header = new CaptureHeader(CaptureHeader.PACKET_TYPE_LIST);
                header.write(@out);
                CaptureList commandList = new CaptureList(list);
                commandList.write(@out);

                captureInProgress = true;
                listExecuted      = false;
            }
            catch (Exception e)
            {
                VideoEngine.log_Renamed.error("Failed to start capture: " + e.Message);
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                Emulator.PauseEmu();
            }
        }
Beispiel #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void write(java.io.OutputStream out) throws java.io.IOException
        public virtual void write(System.IO.Stream @out)
        {
            DataOutputStream data = new DataOutputStream(@out);

            data.writeInt(packetSize);
            data.writeInt(list.list_addr);
            data.writeInt(list.StallAddr);
            data.writeInt(list.cbid);

            //VideoEngine.Console.WriteLine("CaptureList write " + (5 * 4));

            CaptureHeader header = new CaptureHeader(CaptureHeader.PACKET_TYPE_RAM);

            header.write(@out);
            listBuffer.write(@out);
        }
Beispiel #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void write(java.io.OutputStream out) throws java.io.IOException
        public virtual void write(System.IO.Stream @out)
        {
            DataOutputStream data = new DataOutputStream(@out);

            data.writeInt(packetSize);
            data.writeInt(fbp);
            data.writeInt(fbw);
            data.writeInt(zbp);
            data.writeInt(zbw);
            data.writeInt(psm);

            data.writeInt(topaddrFb);
            data.writeInt(bufferwidthFb);
            data.writeInt(pixelformatFb);
            data.writeInt(sync);

            //VideoEngine.Console.WriteLine("CaptureDisplayDetails write " + (4 + packetSize));

            if (captureRenderTargets)
            {
                // write draw buffer
                CaptureHeader header = new CaptureHeader(CaptureHeader.PACKET_TYPE_RAM);
                header.write(@out);
                drawBuffer.write(@out);

                // write depth buffer
                header = new CaptureHeader(CaptureHeader.PACKET_TYPE_RAM);
                header.write(@out);
                depthBuffer.write(@out);

                // write display buffer
                header = new CaptureHeader(CaptureHeader.PACKET_TYPE_RAM);
                header.write(@out);
                displayBuffer.write(@out);
            }
        }
Beispiel #7
0
        public static void captureFrameBufDetails()
        {
            if (!captureInProgress)
            {
                VideoEngine.log_Renamed.warn("Ignoring captureRAM, capture hasn't been started");
                return;
            }

            try
            {
                CaptureHeader header = new CaptureHeader(CaptureHeader.PACKET_TYPE_FRAMEBUF_DETAILS);
                header.write(@out);

                CaptureFrameBufDetails details = new CaptureFrameBufDetails();
                details.write(@out);
            }
            catch (Exception e)
            {
                VideoEngine.log_Renamed.error("Failed to capture frame buf details: " + e.Message);
                Console.WriteLine(e.ToString());
                Console.Write(e.StackTrace);
                Emulator.PauseEmu();
            }
        }
Beispiel #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static CaptureDisplayDetails read(java.io.InputStream in) throws java.io.IOException
        public static CaptureDisplayDetails read(System.IO.Stream @in)
        {
            CaptureDisplayDetails details = new CaptureDisplayDetails();

            DataInputStream data          = new DataInputStream(@in);
            int             sizeRemaining = data.readInt();

            if (sizeRemaining >= packetSize)
            {
                details.fbp    = data.readInt();
                sizeRemaining -= 4;
                details.fbw    = data.readInt();
                sizeRemaining -= 4;
                details.zbp    = data.readInt();
                sizeRemaining -= 4;
                details.zbw    = data.readInt();
                sizeRemaining -= 4;
                details.psm    = data.readInt();
                sizeRemaining -= 4;

                details.topaddrFb     = data.readInt();
                sizeRemaining        -= 4;
                details.bufferwidthFb = data.readInt();
                sizeRemaining        -= 4;
                details.pixelformatFb = data.readInt();
                sizeRemaining        -= 4;
                details.sync          = data.readInt();
                sizeRemaining        -= 4;

                data.skipBytes(sizeRemaining);

                if (captureRenderTargets)
                {
                    // read draw, depth and display buffers
                    CaptureHeader header     = CaptureHeader.read(@in);
                    int           packetType = header.PacketType;
                    if (packetType != CaptureHeader.PACKET_TYPE_RAM)
                    {
                        throw new IOException("Expected CaptureRAM(" + CaptureHeader.PACKET_TYPE_RAM + ") packet, found " + packetType);
                    }
                    details.drawBuffer = CaptureRAM.read(@in);

                    header     = CaptureHeader.read(@in);
                    packetType = header.PacketType;
                    if (packetType != CaptureHeader.PACKET_TYPE_RAM)
                    {
                        throw new IOException("Expected CaptureRAM(" + CaptureHeader.PACKET_TYPE_RAM + ") packet, found " + packetType);
                    }
                    details.depthBuffer = CaptureRAM.read(@in);

                    header     = CaptureHeader.read(@in);
                    packetType = header.PacketType;
                    if (packetType != CaptureHeader.PACKET_TYPE_RAM)
                    {
                        throw new IOException("Expected CaptureRAM(" + CaptureHeader.PACKET_TYPE_RAM + ") packet, found " + packetType);
                    }
                    details.displayBuffer = CaptureRAM.read(@in);
                }
            }
            else
            {
                throw new IOException("Not enough bytes remaining in stream");
            }

            return(details);
        }