Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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();
            }
        }