public UconResult ScanGame(string gamepath, SystemType systemType) { UconResult u = new UconResult(); string options = UconExePath + GetForceSystemString(systemType) + '"' + gamepath + '"'; string result = RunCommand(options); u.RawOutput = result.Replace("Create: NTUSER.idx", "") .Replace("WARNING: \"NTUSER.DAT\" is meant for a console unknown to uCON64", "") .Replace("\r\n\r\n\r\n\r\n\r\n", "\r\n"); u.Data.systemType = systemType; u.Data.RomPath = gamepath; ParseOutput(u); /* * if (u.Data.IsChecksumValid == true) * u.Status = "Detected Checksum is valid"; * else if (u.Data.IsChecksumValid == false) * u.Status = "Detected Checksum is invalid"; * else * u.Status = "Checksum could not be determined"; * */ return(u); }
public UconResult ProcessSMD(string gamepath, string outputFolder) { if (outputFolder != null) { OutputFolder = outputFolder; } GamePath = gamepath; // do initial scan UconResult u = ScanGame(gamepath, SystemType.Genesis); if (u.Data.IsChecksumValid) { // we can proceed if (u.Data.IsInterleaved == true) { // genesis ROM is interleaved - attempt to convert ConvertSMDToBin(u); } else { // genesis ROM is NOT interleaved - this should work fine with no modifications u.ConvertedPath = u.Data.RomPath; } } else { // checksum not valid - do nothing return(null); } return(u); }
public UconResult InterrogateSMD() { UconResult u = new UconResult(); string result = RunCommand("--gen " + GamePath); return(u); }
public UconResult ConvertSMDToBin(UconResult input) { string options = UconExePath + GetForceSystemString(SystemType.Genesis) + "--bin " + "-o=\"" + OutputFolder + "\" " + "\"" + input.Data.RomPath + "\""; string result = RunCommand(options); input.RawOutput = result; ParseOutput(input); return(input); }
public UconResult ParseOutput(UconResult resultObj) { string raw = resultObj.RawOutput; string[] arr = raw.Split(new string[] { "\r\n" }, StringSplitOptions.None); // iterate through result string array bool dataStarted = false; int gameInfoCounter = 0; for (int i = 0; i < arr.Length; i++) { // skip intro lines if (dataStarted == false) { // check for rompath line if (arr[i].StartsWith(resultObj.Data.RomPath)) { dataStarted = true; } //continue; } /* now we should be into the actual data we want */ // header detection if (arr[i].StartsWith("0000")) { resultObj.Data.Header += arr[i] + "\n"; } // rom format if (IsRomFormat(arr[i]) == true) { resultObj.Data.DetectedRomType = arr[i]; resultObj.Data.romType = GetRomType(arr[i]); } // system type if (IsSystemType(arr[i]) == true) { resultObj.Data.systemType = GetSystemType(arr[i]); resultObj.Data.DetectedSystemType = arr[i]; // start game info counter (next 4 lines are information about the rom) gameInfoCounter++; if (arr[i].Trim() == "PC-Engine (CD Unit/Core Grafx(II)/Shuttle/GT/LT/Super CDROM/DUO(-R(X)))") { // pcengine system name takes up two lines i++; } continue; } switch (gameInfoCounter) { case 1: // detected game name resultObj.Data.DetectedGameName = arr[i]; gameInfoCounter++; break; case 2: // detected publisher resultObj.Data.DetectedPublisher = arr[i]; gameInfoCounter++; break; case 3: // detected region data resultObj.Data.DetectedRegion = arr[i]; gameInfoCounter++; break; case 4: // detected size data resultObj.Data.DetectedSize = arr[i]; gameInfoCounter++; break; default: // do nothing break; } // Interleaved if (arr[i].StartsWith("Interleaved/Swapped")) { string[] inters = arr[i].Split(':'); if (inters[1].Trim() == "Yes") { resultObj.Data.IsInterleaved = true; } else { resultObj.Data.IsInterleaved = false; } } // checksum comprison if (arr[i].StartsWith("Checksum:")) { string[] chks = arr[i].Split(':'); string dChks = chks[1]; if (dChks.Contains(" OK")) { resultObj.Data.IsChecksumValid = true; } else { resultObj.Data.IsChecksumValid = false; } resultObj.Data.DetectedChecksumComparison = dChks; } if (arr[i].StartsWith("Checksum (CRC32):")) { string crc = arr[i].Replace("Checksum (CRC32): ", "").Trim(); resultObj.Data.CRC32 = crc; } // output rom path if (arr[i].StartsWith("Wrote output to ")) { string path = arr[i].Replace("Wrote output to ", "").Trim(); resultObj.ConvertedPath = path; } // year if (arr[i].StartsWith("Date:")) { string[] dates = arr[i].Split(':'); string date = dates[1]; resultObj.Data.DetectedYear = date.Trim(); } // version if (arr[i].StartsWith("Version:")) { string[] versions = arr[i].Split(':'); string version = versions[1]; resultObj.Data.DetectedVersion = version.Trim(); } // padding if (arr[i].StartsWith("Padded:")) { string[] pads = arr[i].Split(':'); string pad = pads[1]; resultObj.Data.DetectedPadding = pad.Trim(); } } return(resultObj); }