// Scan for Landtables static void ScanLandtable(LandTableFormat landfmt) { CurrentStep++; CurrentScanData = "Landtables " + landfmt.ToString(); ByteConverter.BigEndian = BigEndian; Console.WriteLine("Step {0}: Scanning for {1} landtables", CurrentStep, landfmt.ToString()); string landtable_extension = ".sa1lvl"; int count = 0; switch (landfmt) { case LandTableFormat.SA1: landtable_extension = ".sa1lvl"; break; case LandTableFormat.SADX: default: landtable_extension = ".sa1lvl"; break; case LandTableFormat.SA2: landtable_extension = ".sa2lvl"; break; case LandTableFormat.SA2B: landtable_extension = ".sa2blvl"; break; } if (!SingleOutputFolder) { Directory.CreateDirectory(Path.Combine(OutputFolder, "levels")); } for (uint address = StartAddress; address < EndAddress; address += 1) { if (CancelScan) { break; } if (ConsoleMode && address % 1000 == 0) { Console.Write("\r{0} ", address.ToString("X8")); } CurrentAddress = address; string fileOutputPath = Path.Combine(OutputFolder, "levels", address.ToString("X8")); if (SingleOutputFolder) { fileOutputPath = Path.Combine(OutputFolder, address.ToString("X8")); } if (!CheckLandTable(address, landfmt)) { continue; } try { //Console.WriteLine("Try {0}", address.ToString("X")); LandTable land = new LandTable(datafile, (int)address, ImageBase, landfmt); if (land.COL.Count > 3) { land.SaveToFile(fileOutputPath + landtable_extension, landfmt, NoMeta); count++; switch (landfmt) { case LandTableFormat.SA1: FoundSA1Landtables++; break; case LandTableFormat.SADX: default: FoundSADXLandtables++; break; case LandTableFormat.SA2: FoundSA2Landtables++; break; case LandTableFormat.SA2B: FoundSA2BLandtables++; break; } landtablelist.Add(address); Console.WriteLine("\rLandtable {0} at {1}", landfmt.ToString(), address.ToString("X8")); addresslist.Add(address, "landtable_" + landfmt.ToString()); address += (uint)LandTable.Size(landfmt) - 1; } } catch (Exception) { continue; } } Console.WriteLine("\r{0} landtables found", count); }