public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", name); var s = file.stream; s.Position = 0x100; byte[] magic = s.read(4); if (isNCSDMagic(magic)) { info.addInfo("Detected format", "NCSD"); parseNCSD(info, file, true); } else if (isNCCHMagic(magic)) { info.addInfo("Detected format", "NCCH"); parseNCCH(info, file.stream, null); } else { s.Position = 0; magic = s.read(4); if (is3DSXMagic(magic)) { info.addInfo("Detected format", "3DSX"); parse3DSX(info, file); } } //TODO CIA https://www.3dbrew.org/wiki/CIA }
public override void addROMInfo(ROMInfo info, ROMFile file) { if ("dol".Equals(file.extension)) { //TODO Parse what little info there is out of dol (could use this for boot .dol and Wii homebrew .dol too I guess) info.addInfo("Platform", "GameCube"); return; } WrappedInputStream s = file.stream; byte[] magic = s.read(4); if (isTGCMagic(magic)) { s.Position = 8; int tgcHeaderSize = s.readIntBE(); info.addInfo("TGC header size", tgcHeaderSize, ROMInfo.FormatMode.SIZE); //What the f**k? What does Dolphin know that YAGD doesn't and didn't decide to tell the rest of the class? s.Position = 0x24; int realOffset = s.readIntBE(); s.Position = 0x34; int virtualOffset = s.readIntBE(); int fileOffset = realOffset - virtualOffset; parseGamecubeDisc(info, s, tgcHeaderSize, fileOffset, true); } else { parseGamecubeDisc(info, s, 0, 0, false); } }
public override void addROMInfo(ROMInfo info, ROMFile file) { //FIXME: Damn nothing matters anymore just refactor everything on the planet //.iso files are 2048 sectors, and since they're read as normal ROM files without any special handling in ROMScanner, we'll specify that sector size here; for cue sheets we've already read that so we just do the thing int sectorSize = 2048; if (file.cdSectorSize != 0) { sectorSize = file.cdSectorSize; } if (file.extension.Equals("img")) { sectorSize = 2352; } info.addInfo("Sector size", sectorSize); if (sectorSize == 2352) { addROMInfo(info, file, new CDInputStream(file.stream)); } else { addROMInfo(info, file, file.stream); } }
public override void addROMInfo(ROMInfo info, ROMFile file) { if ("nro".Equals(file.extension)) { addNROInfo(info, file); } }
public static void addSupercardDS2PluginInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "Supercard DSTwo"); string iconFilename = System.IO.Path.ChangeExtension(file.name, "bmp"); //The icon is actually pointed to in the .ini file, but it's in a native DS format (starts with fat1:/) so it won't be of any use unless running on an actual DSTwo. Luckily, the filename is always the same as the .plg but with a .bmp extension; and this is the kind of convention that nobody would dare break var icon = Image.FromStream(file.getSiblingFile(iconFilename)); info.addInfo("Icon", icon); string iniFilename = System.IO.Path.ChangeExtension(file.name, "ini"); using (var sr = new System.IO.StreamReader(file.getSiblingFile(iniFilename))) { while (!sr.EndOfStream) { string line = sr.ReadLine(); if (line == null) { break; } if (line.ToLowerInvariant().StartsWith("name=")) { //Once again, not really internal. I kinda want to rename this column globally, it's already kinda wordy and a mouthful and I don't like that info.addInfo("Internal name", line.Split('=')[1]); break; } } } }
public override void addROMInfo(ROMInfo info, ROMFile file) { WrappedInputStream s = file.stream; string copyrightInfo = s.read(28, Encoding.ASCII); info.addInfo("Copyright", copyrightInfo, true); //For first party games this should say that, and for third party games it should say " LICENSED BY SNK CORPORATION" info.addInfo("First party", "COPYRIGHT BY SNK CORPORATION".Equals(copyrightInfo)); byte[] entryPoint = s.read(4); info.addInfo("Entry point", entryPoint, ROMInfo.FormatMode.HEX, true); short gameNumber = s.readShortLE(); info.addInfo("Product code", gameNumber.ToString("X2")); int version = s.read(); info.addInfo("Version", version); bool isColor = s.read() == 0x10; info.addInfo("Is colour", isColor); info.addInfo("Platform", isColor ? "Neo Geo Pocket Color" : "Neo Geo Pocket"); string internalName = s.read(12, Encoding.ASCII); info.addInfo("Internal name", internalName); byte[] reserved = s.read(16); info.addInfo("Reserved", reserved, true); //Should be 0 filled }
public override void addROMInfo(ROMInfo info, ROMFile file) { if ("bin".Equals(file.extension)) { parseAPFCart(info, file.stream); } }
/// <summary> /// Loads ROM content /// </summary> /// <returns></returns> private bool LoadROM() { bool changed = false; byte[] old_rom = null; // save old rom old_rom = Rom; // load ROM Rom = new byte[MaxRomSize]; for (int i = 0; i < Rom.Length; i++) { Rom[i] = 0xff; } if (string.IsNullOrEmpty(Settings.ROMFileName)) { ROMFile.LoadMemoryFromResource("GameCard.Resources.GameCard.bin", Rom); } else { ROMFile.LoadMemoryFromFile(Settings.ROMFileName, Rom); } changed = !ROMFile.IsMemoryEqual(old_rom, Rom); return(changed); }
public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "Atari 5200"); var s = file.stream; s.Position = file.length - 3; bool skipLogo = s.read() == 0xff; //Frogger does this, maybe some others. I guess this is the second digit of the year being set to 0xff? info.addInfo("Skip BIOS", skipLogo); short entryPoint = s.readShortLE(); info.addInfo("Entry point", entryPoint, ROMInfo.FormatMode.HEX); if (!skipLogo) { s.Position = file.length - 24; //Copyright info is usually displayed on the screen, the BIOS displays a graphic from its own ROM and something like "TITLE\nCOPYRIGHT YEAR ATARI" //This can be used to get the name for our purposes, though it will be padded with @ (displays as blank I guess?) or null char to make it centred on screen string name = decodeAtari5200String(s.read(20)); info.addInfo("Internal name", name); int yearFirstDigit = s.read() - 0x50; int yearSecondDigit = s.read() - 0x50; //Nice Y2K bug m8 info.addInfo("Year", 1900 + (yearFirstDigit * 10) + yearSecondDigit); } //TODO: BIOS disassemby also mentions something about PAL carts? I wasn't aware of any PAL carts or even PAL 5200 systems, so that's interesting if that actually exists; it seems that PAL carts have something different at xFE7 }
public override void addROMInfo(ROMInfo info, ROMFile file) { if ("bin".Equals(file.extension) || "rom".Equals(file.extension) || "car".Equals(file.extension)) { byte[] magic = file.stream.read(4); if (isCARTMagic(magic)) { info.addInfo("Detected format", "CART header"); parseCART(info, file.stream); } else { //Well, nothing we can really do here, then info.addInfo("Platform", "Atari 8-bit"); info.addInfo("Detected format", "Unheadered"); } } else if ("atr".Equals(file.extension)) { addATRInfo(info, file); } else { //TODO: Floppy images info.addInfo("Platform", "Atari 8-bit"); } }
public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", name); WrappedInputStream s = file.stream; s.Seek(-544, System.IO.SeekOrigin.End); //Yeah, this one's a bit weird string title = s.read(20, MainProgram.shiftJIS).TrimEnd(' '); info.addInfo("Internal name", title); byte[] reserved = s.read(5); info.addInfo("Reserved", reserved, true); string makerCode = s.read(2, Encoding.ASCII); info.addInfo("Publisher", makerCode, NintendoCommon.LICENSEE_CODES); string productCode = s.read(4, Encoding.ASCII); info.addInfo("Product code", productCode); //I don't know what to do about the game type, since it's all V so far info.addInfo("Type", productCode[0], true); string shortTitle = productCode.Substring(1, 2); info.addInfo("Short title", shortTitle); char country = productCode[3]; info.addInfo("Country", country, NintendoCommon.COUNTRIES); int version = s.read(); info.addInfo("Version", version); }
public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "Nintendo 64"); WrappedInputStream s = file.stream; byte[] header = s.read(4); N64ROMFormat format = detectFormat(header); info.addInfo("Detected format", detectFormat(header)); if (!isDiskFormat(format) && isDiskExtension(file.extension)) { //Some kind of 64DD disk with an unknown format (might be a dev disk or something, or a bad dump with no system area) return; } else if (isDiskFormat(format)) { parse64DDDiskInfo(info, s); } else if (format == N64ROMFormat.V64) { ByteSwappedInputStream swappedInputStream = new ByteSwappedInputStream(s); parseN64ROM(swappedInputStream, info); } else { parseN64ROM(s, info); } //Haha I'm sure word swapping will be a lot of fun }
private void addNROInfo(ROMInfo info, ROMFile file) { var s = file.stream; s.Seek(16, SeekOrigin.Begin); var magic = s.read(4, Encoding.ASCII); info.addInfo("Magic", magic); if (!("NRO0".Equals(magic))) { return; } int nroFormatVersion = s.readIntLE(); //Always 0 info.addInfo("NRO format version", nroFormatVersion, true); int totalSize = s.readIntLE(); info.addInfo("ROM size", totalSize, ROMInfo.FormatMode.SIZE); //Skip over flags (unused), segmentHeader[3] (text, ro, data), bssSize, reserved (unused) s.Seek(4 + (8 * 3) + 4 + 4, SeekOrigin.Current); var buildID = s.read(32); info.addInfo("Build ID", buildID); info.addInfo("Build ID as ASCII", Encoding.ASCII.GetString(buildID)); //Skip over reserved 2 and segmentHeader2[3] (apiInfo, dynstr, dynsym) //s.Seek(8 + (8 * 3), SeekOrigin.Current); s.Seek(totalSize, SeekOrigin.Begin); var assetMagic = s.read(4, Encoding.ASCII); if ("ASET".Equals(assetMagic)) { long assetSectionStart = s.Position - 4; info.addInfo("Asset section offset", assetSectionStart, ROMInfo.FormatMode.HEX); int assetFormatVersion = s.readIntLE(); info.addInfo("Asset format version", assetFormatVersion, true); ulong iconOffset = (ulong)(s.readIntLE() | (s.readIntLE() << 4)); info.addInfo("Icon offset", iconOffset, ROMInfo.FormatMode.HEX); ulong iconSize = (ulong)(s.readIntLE() | (s.readIntLE() << 4)); info.addInfo("Icon size", iconSize, ROMInfo.FormatMode.SIZE); ulong nacpOffset = (ulong)(s.readIntLE() | (s.readIntLE() << 4)); info.addInfo(".nacp offset", nacpOffset, ROMInfo.FormatMode.HEX); ulong nacpSize = (ulong)(s.readIntLE() | (s.readIntLE() << 4)); info.addInfo(".nacp size", nacpSize, ROMInfo.FormatMode.SIZE); ulong romfsOffset = (ulong)(s.readIntLE() | (s.readIntLE() << 4)); info.addInfo("RomFS offset", romfsOffset, ROMInfo.FormatMode.HEX); ulong romfsSize = (ulong)(s.readIntLE() | (s.readIntLE() << 4)); info.addInfo("RomFS size", romfsSize, ROMInfo.FormatMode.SIZE); if (iconSize > 0) { s.Seek((long)((ulong)assetSectionStart + iconOffset), SeekOrigin.Begin); byte[] icon = s.read((int)iconSize); using (MemoryStream mem = new MemoryStream(icon)) { info.addInfo("Icon", System.Drawing.Image.FromStream(mem)); } } } }
public static void parseSMSROM(ROMInfo info, ROMFile file) { WrappedInputStream s = file.stream; long headerOffset = -1; //Supposedly the header _could_ be at 0x1ff0 or 0x3ff0 but no known software does that. But let's check it anyway just for something to do s.Position = 0x1ff0; string magic = "TMR SEGA"; if (s.read(8, Encoding.ASCII).Equals(magic)) { headerOffset = s.Position; } else { s.Position = 0x3ff0; if (s.read(8, Encoding.ASCII).Equals(magic)) { headerOffset = s.Position; } else { s.Position = 0x7ff0; if (s.read(8, Encoding.ASCII).Equals(magic)) { headerOffset = s.Position; } } } if (headerOffset != -1) { //It's entirely possible this header isn't there, since Japanese Master Systems don't check for it //and therefore Japanese Master System games aren't required to have it info.addInfo("Header position", headerOffset, true); info.addInfo("Has standard header", true); bool isGameGear = "gg".Equals(file.extension); parseSegaHeader(info, s, headerOffset, isGameGear); } else { info.addInfo("Has standard header", false); } s.Position = 0x7fe0; if (s.read(4, Encoding.ASCII).Equals("SDSC")) { info.addInfo("Has SDSC header", true); parseSDSCHeader(info, s); } else { info.addInfo("Has SDSC header", false); } //TODO Codemasters header (tricky to detect presence, and I don't have any Codemasters games anyway) }
public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "Xbox"); if ("xbe".Equals(file.extension)) { parseXBE(info, file.stream); } }
public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "Wii U"); if ("rpx".Equals(file.extension)) { addRPXInfo(info, file); } }
public override void addROMInfo(ROMInfo info, ROMFile file, WrappedInputStream stream) { Megadrive.parseMegadriveROM(info, stream, true); //There's also a "MAIN SEGAOS" at 0x3000 followed by what appears to be some kind of title. Does that mean anything? I don't know //Some more info: //https://forums.sonicretro.org/index.php?showtopic=30588 //https://segaretro.org/Sega_CD_programming_FAQ_(1998-12-06) //So 0x200 and beyond may have some kind of boot code which could then be checksummed to determine region, perhaps... }
public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "PlayStation Portable"); if ("pbp".Equals(file.extension)) { parsePBP(info, file.stream); } //.iso will be done later }
public override bool shouldSkipHeader(ROMFile rom) { //TODO: Definitely don't if it's not a cartridge file at all (just in case of false positives with disk images having CART at the beginning) try { byte[] magic = rom.stream.read(4); return(isCARTMagic(magic)); } finally { rom.stream.Position = 0; } }
private bool LoadROM() { bool memory_changed = false; byte[] old_mem_sys = m_mem_sys; byte[] old_mem_ext = m_mem_ext; // reserve space for memories m_mem_sys = new byte[SysMemLength]; m_mem_ext = new byte[ExtMemLength]; // load ROM content switch (m_settings.ROMVersion) { // custom version case 0: break; // BASIC 1.2 case 1: ROMFile.LoadMemoryFromResource("YATE.Resources.rom_1_2.bin", m_mem_sys); ROMFile.LoadMemoryFromResource("YATE.Resources.ext_1_2.bin", m_mem_ext); break; // BASIC 1.2 (RU) case 2: ROMFile.LoadMemoryFromResource("YATE.Resources.rom_1_2_ru.bin", m_mem_sys); ROMFile.LoadMemoryFromResource("YATE.Resources.ext_1_2_ru.bin", m_mem_ext); break; // BASIC 2.1 case 3: ROMFile.LoadMemoryFromResource("YATE.Resources.rom_2_1.bin", m_mem_sys); ROMFile.LoadMemoryFromResource("YATE.Resources.ext_2_1.bin", m_mem_ext); break; // BASIC 2.2 case 4: ROMFile.LoadMemoryFromResource("YATE.Resources.rom_2_2.bin", m_mem_sys); ROMFile.LoadMemoryFromResource("YATE.Resources.ext_2_2.bin", m_mem_ext); break; } if (!ROMFile.IsMemoryEqual(old_mem_sys, m_mem_sys)) { memory_changed = true; } if (!ROMFile.IsMemoryEqual(old_mem_ext, m_mem_ext)) { memory_changed = true; } return(memory_changed); }
public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "e-Reader"); if ("raw".Equals(file.extension)) { byte[] data = uninterleaveRawFile(info, file); parseUninterleavedData(info, data); return; } //Not sure how we'd handle .bin yet. However, most dumps are .raw instead, so it should be fine }
public static void addATRInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "Atari 8-bit"); var stream = file.stream; short magic = stream.readShortLE(); //Should be 0x0296 info.addInfo("Magic", magic, ROMInfo.FormatMode.HEX, true); short sizeInParagraphs = stream.readShortLE(); info.addInfo("Size in paragraphs", sizeInParagraphs, true); short sectorSize = stream.readShortLE(); info.addInfo("Sector size", sectorSize); int sectorCount = sectorSize == 0 ? 0 : (int)(file.length - 16) / sectorSize; info.addInfo("Sector count", sectorCount); //All extensions by something called APE, so might not exist int sizeHighPart = stream.read(); //TODO combine because I am one lazy f****r info.addInfo("Size in paragraphs (high byte)", sizeHighPart, true); int crc = stream.readIntLE(); info.addInfo("CRC", crc, true); int unused = stream.readIntLE(); info.addInfo("Unused", unused, true); int flags = stream.read(); info.addInfo("Flags", flags, true); info.addInfo("Write protected", (flags & 1) > 0, true); //DOS2: Sectors 1 to 3 = boot record, sector 360 = table of contents, sector 361 to 368 = directory //DOS3: Sectors 1 to 9 = boot sector, 10 to 15 = empty, 16 to 23 = directory, 18 = FAT var sectors = new List <byte[]>(); for (int i = 0; i < sectorCount; ++i) { byte[] sector = stream.read(sectorSize); sectors.Add(sector); } if (sectorSize == 0x80) { //Just guessing here. I don't really know what I'm doing. Not sure how DOS3 or SpartaDOS work. addAtariDOS2(info, sectors); } else { info.addInfo("Has files", false); } }
public override void addROMInfo(ROMInfo info, ROMFile file) { info.addInfo("Platform", "Uzebox"); var s = file.stream; s.Position = 0; string magic = s.read(6, Encoding.ASCII); //Should be UZEBOX info.addInfo("Magic", magic); if (!"UZEBOX".Equals(magic)) { //Not all ROMs have this 512-byte header //TODO: Add "has header" "skip header" etc blah stuff what am I even doing return; } int headerVersion = s.read(); info.addInfo("Header version", headerVersion); int target = s.read(); info.addInfo("Target", target, TARGETS); int programSize = s.readIntLE(); info.addInfo("ROM size", programSize, ROMInfo.FormatMode.SIZE); short year = s.readShortLE(); info.addInfo("Year", year); string name = s.read(32, Encoding.ASCII).TrimEnd('\0'); //Presumably ASCII? info.addInfo("Internal name", name); //Not really internal name, meant for display actually... string author = s.read(32, Encoding.ASCII).TrimEnd('\0'); info.addInfo("Manufacturer", author); //Supposedly never used byte[] iconData = s.read(256); info.addInfo("Icon data", iconData, true); int crc32 = s.readIntLE(); info.addInfo("Checksum", crc32, ROMInfo.FormatMode.HEX, true); bool snesMouseMarker = s.read() == 1; info.addInfo("Requires SNES mouse?", snesMouseMarker); //Supposedly unused string description = s.read(64, Encoding.ASCII).TrimEnd('\0'); info.addInfo("Description", description); }
public static void parseNCSD(ROMInfo info, ROMFile file, bool isCCI) { var s = file.stream; s.Position = 0x104; long size = (uint)s.readIntLE() * MEDIA_UNIT; info.addInfo("ROM size", size, ROMInfo.FormatMode.SIZE); byte[] mediaID = s.read(8); info.addInfo("Media ID", mediaID, true); //What does this mean? byte[] partitionTypes = s.read(8); info.addInfo("Partition types", partitionTypes, true); byte[] partitionCryptTypes = s.read(8); info.addInfo("Partition crypt types", partitionCryptTypes, true); long[] partitionOffsets = new long[8], partitionLengths = new long[8]; for (int i = 0; i < 8; ++i) { partitionOffsets[i] = (uint)s.readIntLE() * MEDIA_UNIT; partitionLengths[i] = (uint)s.readIntLE() * MEDIA_UNIT; } if (isCCI) { //There's an additional header here but ehh don't think I need it (except 8-byte flags at 0x188, flags[6] might be needed for media unit size? But that seems to always be 0) s.Position = 0x312; short version = s.readShortLE(); info.addInfo("Version", version); for (int i = 0; i < 8; ++i) { string partitionName = "Partition " + (i + 1); if (PARTITION_NAMES.ContainsKey(i)) { partitionName = PARTITION_NAMES[i]; } if (partitionLengths[i] > 0 && partitionOffsets[i] > 0) { info.addInfo(combinePrefix(partitionName, "partition offset"), partitionOffsets[i], ROMInfo.FormatMode.HEX); info.addInfo(combinePrefix(partitionName, "partition length"), partitionLengths[i], ROMInfo.FormatMode.SIZE); //We use no prefix here with "main" partition so it'll just say "Product code" or "Version" instead of "Executable content version" etc parseNCCH(info, s, i == 0 ? null : partitionName, partitionOffsets[i]); } } } }
public static void parseXEX(ROMInfo info, ROMFile file) { if (file.hasSiblingFile("ArcadeInfo.xml")) { parseArcadeInfo(info, file, file.getSiblingFile("ArcadeInfo.xml")); } var s = file.stream; s.Position = 4; uint flags = (uint)s.readIntBE(); parseXEXFlags(info, flags); s.Position = 0x14; uint headerCount = (uint)s.readIntBE(); for (uint i = 0; i < headerCount; ++i) { uint headerID = (uint)s.readIntBE(); uint headerSize = headerID & 0xff; byte[] headerData = s.read(4); if (headerSize == 0 || headerSize == 1) { addXEXInfo(info, headerID, headerData); } else { long pos = s.Position; try { uint offset = bytesToUintBE(headerData); s.Position = offset; byte[] data; if (headerSize == 0xff) { headerSize = (uint)s.readIntBE() - 4; } else { headerSize = headerSize * 4; } data = s.read((int)headerSize); addXEXInfo(info, headerID, data); } finally { s.Position = pos; } } } }
public static void readWonderswanROM(ROMInfo info, ROMFile file) { WrappedInputStream s = file.stream; s.Seek(-10, System.IO.SeekOrigin.End); int publisher = s.read(); info.addInfo("Publisher", publisher, PUBLISHERS); int deviceFlag = s.read(); bool isColor = deviceFlag == 1; info.addInfo("Is colour", isColor); info.addInfo("Device type", deviceFlag, true); //This might have more to it, but probably not int cartID = s.read(); //Last 2 digits of SKU info.addInfo("Product code", cartID); int version = s.read(); info.addInfo("Version", version); int romSize = s.read(); info.addInfo("ROM size", romSize, ROM_SIZES, ROMInfo.FormatMode.SIZE); int ramSize = s.read(); info.addInfo("Save size", ramSize, RAM_SIZES, ROMInfo.FormatMode.SIZE); info.addInfo("Save type", ramSize >= 10 ? "EEPROM" : ramSize == 0 ? "None" : "SRAM"); int flags = s.read(); info.addInfo("Flags", flags, true); //Maybe there are more flags than these three, probably not info.addInfo("ROM speed", (flags & 4) > 0 ? "3 speed" : "1 speed"); info.addInfo("Bus width (bits)", (flags & 2) > 0 ? 16 : 8); info.addInfo("Screen orientation", (flags & 1) == 1 ? "Vertical" : "Horizontal"); bool hasRTC = s.read() == 1; info.addInfo("Has RTC", hasRTC); ushort checksum = (ushort)s.readShortLE(); info.addInfo("Checksum", checksum, ROMInfo.FormatMode.HEX, true); int calculatedChecksum = calcChecksum(s); info.addInfo("Calculated checksum", calculatedChecksum, ROMInfo.FormatMode.HEX, true); info.addInfo("Checksum valid?", checksum == calculatedChecksum); }
public static void parseArcadeInfo(ROMInfo info, ROMFile file, Stream xmlFile) { var xml = XDocument.Load(xmlFile); var arcadeInfo = xml.Element("ArcadeInfo"); info.addInfo("XDK version", arcadeInfo.Attribute("xdkVersion")?.Value); info.addInfo("Project version", arcadeInfo.Attribute("projectVersion")?.Value); foreach (var titleInfo in arcadeInfo.Elements("TitleInfo")) { parseTitleInfo(info, file, titleInfo); } }
public override void addROMInfo(ROMInfo info, ROMFile file) { if (isSMD(file.stream)) { info.addInfo("Detected format", "Super Magic Drive interleaved"); parseMegadriveROM(info, decodeSMD(file.stream)); } else { info.addInfo("Detected format", "Plain"); parseMegadriveROM(info, file.stream); } }
public override bool shouldSkipHeader(ROMFile rom) { WrappedInputStream s = rom.stream; long pos = s.Position; try { //I hope this doesn't result in false positives. Might be worth checking the file size modulo 64 or something clever like that? Not sure if that works string magic = s.read(4, Encoding.ASCII); return("LYNX".Equals(magic)); } finally { s.Position = pos; } }
public override bool shouldSkipHeader(ROMFile rom) { WrappedInputStream s = rom.stream; long pos = s.Position; try { s.Position = 1; string atari7800Magic = s.read(16, Encoding.ASCII); return("ATARI7800\0\0\0\0\0\0\0".Equals(atari7800Magic)); } finally { s.Position = pos; } }
private void OpenROM(string filename) { romfile = null; try { romfile = new EBRom(filename); if (!romfile.isSupported()) romfile = new MO3Rom(filename); } catch { MessageBox.Show("Not a supported ROM."); return; } if (!romfile.isSupported()) { MessageBox.Show("Not a supported ROM."); return; } ArrangementList.Items.Clear(); curArr = 0; ComboBoxItem tmp; arrangements = romfile.getArrangements(); foreach (MultilayerArrangement arr in arrangements) { tmp = new ComboBoxItem(); tmp.Content = arr.Name; ArrangementList.Items.Add(tmp); } ArrangementList.SelectedIndex = 0; UpdateArrangement(); ArrangementList.IsEnabled = true; }