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); }
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"; }
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()))); }
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); }
public void SetHeaderFromRawData(byte[] data) { header = new RomHeader(); header.parse(data); }
public Cart() { header = null; raw = null; }