Esempio n. 1
0
        public RomHeader getRomHeader()
        {
            serialPort.PortName = port;
            bytesToReceive      = 0;
            bytesStream.Clear();
            //operation = MegaDumperOperation.Header;

            serialPort.Open();


            lock (transmissionOverLock)//waits N seconds for a condition variable
            {
                serialPort.Write("i");

                if (!Monitor.Wait(transmissionOverLock, 3000))
                {
                    //timeout
                }
                else
                {
                    //business as normal
                }
            }



            serialPort.Close();

            RomHeader header = new RomHeader();

            header.parse(bytesStream.ToArray());
            return(header);
        }
Esempio n. 2
0
        private void refreshInfo(Cart c)
        {
            RomHeader h = c.Header;

            txtGameTitle.Text    = h.DomesticGameTitle;
            txtCopyright.Text    = h.Copyright;
            txtRomSize.Text      = ((h.RomAddressEnd - h.RomAddressStart + 1) / 1024).ToString() + " kbytes";
            txtRegion.Text       = h.Region;
            txtSerialNumber.Text = h.SerialNumber;
            txtSave.Text         = ((h.SaveChip.EndAddress - h.SaveChip.StartAddress + 1) / 1024).ToString() + " kbytes";
        }
Esempio n. 3
0
        private string generateFileName(RomHeader h)
        {
            string filename = txtFilenameFormat.Text.Trim();

            //perform replacements
            filename = filename.Replace("%T", h.DomesticGameTitle);
            filename = filename.Replace("%R", h.Region);
            filename = filename.Replace("%S", h.SerialNumber);
            filename = filename.Replace("%C", h.Copyright);

            //remove illegal filename characters before returning
            return(string.Concat(filename.Split(Path.GetInvalidFileNameChars())));
        }
Esempio n. 4
0
        public MegaDumper()
        {
            serialPort     = new SerialPort();
            bytesStream    = new List <byte>();
            port           = "";
            bytesToReceive = 0;
            operation      = MegaDumperOperation.None;

            this.WorkerReportsProgress = true;

            transmissionOverLock  = new Object();
            transmissionAliveLock = new Object();

            romHeader = new RomHeader();

            serialPort.BaudRate      = 460800;
            serialPort.Parity        = Parity.None;
            serialPort.DataBits      = 8;
            serialPort.StopBits      = StopBits.One;
            serialPort.ReadTimeout   = 500;
            serialPort.WriteTimeout  = 500;
            serialPort.DataReceived += new SerialDataReceivedEventHandler(serialPort_DataReceived);
        }
Esempio n. 5
0
 public void SetHeaderFromRawData(byte[] data)
 {
     header = new RomHeader();
     header.parse(data);
 }
Esempio n. 6
0
 public Cart()
 {
     header = null;
     raw    = null;
 }