public static void ForceUnpackNarc(int id) { string[] narcPaths = RomInfo.narcPaths; string[] extractedNarcDirs = RomInfo.extractedNarcDirs; (string pathToPacked, string pathToExtracted) = (narcPaths[id], extractedNarcDirs[id]); Narc.Open(RomInfo.workDir + pathToPacked).ExtractToFolder(pathToExtracted); }
public static void ForceUnpackNarc(int id) { string[] narcPaths = RomInfo.narcPaths; string[] extractedNarcDirs = RomInfo.extractedNarcDirs; var tuple = Tuple.Create(narcPaths[id], extractedNarcDirs[id]); Narc.Open(workDir + tuple.Item1).ExtractToFolder(tuple.Item2); }
public static void UnpackNarc(int id) { string[] narcPaths = RomInfo.narcPaths; string[] extractedNarcDirs = RomInfo.extractedNarcDirs; (string pathToPacked, string pathToExtracted)tuple = (narcPaths[id], extractedNarcDirs[id]); DirectoryInfo di = new DirectoryInfo(tuple.Item2); if (!di.Exists || di.GetFiles().Length == 0) { Narc.Open(RomInfo.workDir + tuple.pathToPacked).ExtractToFolder(tuple.pathToExtracted); } }
public static void ForceUnpackNarcs(List <int> IDs, ToolStripProgressBar progress) { string[] narcPaths = RomInfo.narcPaths; string[] extractedNarcDirs = RomInfo.extractedNarcDirs; foreach (int id in IDs) { var tuple = Tuple.Create(narcPaths[id], extractedNarcDirs[id]); Narc.Open(workDir + tuple.Item1).ExtractToFolder(tuple.Item2); if (progress != null) { try { progress.Value++; } catch (ArgumentOutOfRangeException) { } } } }
public static void ForceUnpackNarcs(List <int> IDs, ToolStripProgressBar progress) { string[] narcPaths = RomInfo.narcPaths; string[] extractedNarcDirs = RomInfo.extractedNarcDirs; foreach (int id in IDs) { (string pathToPacked, string pathToExtracted) = (narcPaths[id], extractedNarcDirs[id]); Narc.Open(RomInfo.workDir + pathToPacked).ExtractToFolder(pathToExtracted); if (progress != null) { try { progress.Value++; } catch (ArgumentOutOfRangeException) { } } } }
private void Form6_Building_List_Load(object sender, EventArgs e) { Form2 bldEditor = new Form2(); bldEditor.Show(this); if (Form1.IsBW) { Narc.Open(Form1.workingFolder + @"data\a\2\2\9").ExtractToFolder(Form1.workingFolder + @"data\a\2\2\exBld"); Narc.Open(Form1.workingFolder + @"data\a\2\3\0").ExtractToFolder(Form1.workingFolder + @"data\a\2\3\inBld"); } else { Narc.Open(Form1.workingFolder + @"data\a\2\2\5").ExtractToFolder(Form1.workingFolder + @"data\a\2\2\exBld"); Narc.Open(Form1.workingFolder + @"data\a\2\2\6").ExtractToFolder(Form1.workingFolder + @"data\a\2\2\inBld"); } bldPath = Form1.workingFolder + @"data\a\2\2\exBld"; for (int i = 0; i < Directory.GetFiles(bldPath).Length; i++) { comboBox1.Items.Add(rm.GetString("buildingPackList") + i); } comboBox1.SelectedIndex = 0; }
public static void UnpackNarcs(List <int> IDs, ToolStripProgressBar progress) { string[] narcPaths = RomInfo.narcPaths; string[] extractedNarcDirs = RomInfo.extractedNarcDirs; foreach (int id in IDs) { (string pathToPacked, string pathToExtracted) = (narcPaths[id], extractedNarcDirs[id]); DirectoryInfo di = new DirectoryInfo(pathToExtracted); if (!di.Exists || di.GetFiles().Length == 0) { Narc.Open(RomInfo.workDir + pathToPacked).ExtractToFolder(pathToExtracted); } if (progress != null) { try { progress.Value++; } catch (ArgumentOutOfRangeException) { } } } }
private void Form3_2_Trainer_Class_Editor_Load(object sender, EventArgs e) { if (Form1.gameID == 0x45414441 || Form1.gameID == 0x45415041 || Form1.gameID == 0x53414441 || Form1.gameID == 0x53415041 || Form1.gameID == 0x46414441 || Form1.gameID == 0x46415041 || Form1.gameID == 0x49414441 || Form1.gameID == 0x49415041 || Form1.gameID == 0x44414441 || Form1.gameID == 0x44415041 || Form1.gameID == 0x4A414441 || Form1.gameID == 0x4A415041 || Form1.gameID == 0x4B414441 || Form1.gameID == 0x4B415041) { path = Form1.workingFolder + @"data\msgdata\msg\0560"; Narc.Open(Form1.workingFolder + @"data\poketool\trgra\trfgra.narc").ExtractToFolder(Form1.workingFolder + @"data\poketool\trgra\trfgra"); spritePath = Form1.workingFolder + @"data\poketool\trgra\trfgra"; } if (Form1.gameID == 0x45555043 || Form1.gameID == 0x53555043 || Form1.gameID == 0x46555043 || Form1.gameID == 0x49555043 || Form1.gameID == 0x44555043 || Form1.gameID == 0x4A555043 || Form1.gameID == 0x4B555043) { path = Form1.workingFolder + @"data\msgdata\pl_msg\0619"; Narc.Open(Form1.workingFolder + @"data\poketool\trgra\trfgra.narc").ExtractToFolder(Form1.workingFolder + @"data\poketool\trgra\trfgra"); spritePath = Form1.workingFolder + @"data\poketool\trgra\trfgra"; } if (Form1.gameID == 0x454B5049 || Form1.gameID == 0x45475049 || Form1.gameID == 0x534B5049 || Form1.gameID == 0x53475049 || Form1.gameID == 0x464B5049 || Form1.gameID == 0x46475049 || Form1.gameID == 0x494B5049 || Form1.gameID == 0x49475049 || Form1.gameID == 0x444B5049 || Form1.gameID == 0x44475049) { path = Form1.workingFolder + @"data\a\0\2\text\0730"; Narc.Open(Form1.workingFolder + @"data\a\0\5\8").ExtractToFolder(Form1.workingFolder + @"data\a\0\5\trfgra"); spritePath = Form1.workingFolder + @"data\a\0\5\trfgra"; } if (Form1.gameID == 0x4A4B5049 || Form1.gameID == 0x4A475049 || Form1.gameID == 0x4B4B5049 || Form1.gameID == 0x4B475049) { path = Form1.workingFolder + @"data\a\0\2\text\0720"; Narc.Open(Form1.workingFolder + @"data\a\0\5\8").ExtractToFolder(Form1.workingFolder + @"data\a\0\5\trfgra"); spritePath = Form1.workingFolder + @"data\a\0\5\trfgra"; } #region Read Trainer Class Names BinaryReader readText = new BinaryReader(File.OpenRead(path)); readText.BaseStream.Position = 0x0; stringClassCount = (int)readText.ReadUInt16(); initialKey = (int)readText.ReadUInt16(); int key1 = (initialKey * 0x2FD) & 0xFFFF; int key2 = 0; int realKey = 0; bool specialCharON = false; int[] currentOffset = new int[stringClassCount]; int[] currentSize = new int[stringClassCount]; int car = 0; for (int i = 0; i < stringClassCount; i++) // Reads and stores string offsets and sizes { key2 = (key1 * (i + 1) & 0xFFFF); realKey = key2 | (key2 << 16); currentOffset[i] = ((int)readText.ReadUInt32()) ^ realKey; currentSize[i] = ((int)readText.ReadUInt32()) ^ realKey; } for (int i = 0; i < stringClassCount; i++) // Adds new string { key1 = (0x91BD3 * (i + 1)) & 0xFFFF; readText.BaseStream.Position = currentOffset[i]; string pokemonText = ""; for (int j = 0; j < currentSize[i]; j++) // Adds new characters to string { car = ((int)readText.ReadUInt16()) ^ key1; #region Special Characters if (car == 0xE000 || car == 0x25BC || car == 0x25BD || car == 0xFFFE || car == 0xFFFF) { if (car == 0xE000) { pokemonText += @"\n"; } if (car == 0x25BC) { pokemonText += @"\r"; } if (car == 0x25BD) { pokemonText += @"\f"; } if (car == 0xFFFE) { pokemonText += @"\v"; specialCharON = true; } if (car == 0xFFFF) { pokemonText += ""; } } #endregion else { if (specialCharON == true) { pokemonText += car.ToString("X4"); specialCharON = false; } else { string character = getChar.GetString(car.ToString("X4")); pokemonText += character; if (character == null) { pokemonText += @"\x" + car.ToString("X4"); } } } key1 += 0x493D; key1 &= 0xFFFF; } classNames.Add(pokemonText); } readText.Close(); for (int i = 0; i < stringClassCount; i++) { comboBox1.Items.Add(i + ": " + classNames[i]); } #endregion comboBox1.SelectedIndex = 0; }