diff --git a/Hack.Xenosaga/Process/Unpack.cs b/Hack.Xenosaga/Process/Unpack.cs index 18f755c..2938cf0 100644 --- a/Hack.Xenosaga/Process/Unpack.cs +++ b/Hack.Xenosaga/Process/Unpack.cs @@ -193,14 +193,14 @@ namespace Hack.Xenosaga.Process return size; } - private static int findFile(pathElement entry) + private static int findFile(pathElement entry, string numberFile) { // Check if the file is in the INSERT directory if (File.Exists(Variables.dirInsert + entry.Name)) return 1; // Check if the file is in the UNPACK directory - if (File.Exists(Variables.dirUnpack + entry.FullPath)) + if (File.Exists(Variables.dirUnpack + numberFile + entry.FullPath)) return 2; // Otherwise, get the file from iso files @@ -327,11 +327,12 @@ namespace Hack.Xenosaga.Process int numFileIndex; int numFileWrite = -1; int idSave = -1; + int.TryParse(Path.GetExtension(indexName).Substring(1), out numFileIndex); + string fileNameBase = Path.GetFileNameWithoutExtension(indexName); string filename = ""; + string directoryUnpackName = Variables.dirUnpack + string.Format("{0:D2}", numFileIndex); - int.TryParse(Path.GetExtension(indexName).Substring(1), out numFileIndex); - listPathElement index = new listPathElement(); Trace.Write(string.Format("Reading index ({0}) : ", indexName)); @@ -367,7 +368,7 @@ namespace Hack.Xenosaga.Process { long size = 0; - int idFile = findFile(entryPath); + int idFile = findFile(entryPath, string.Format("{0:D2}", numFileIndex)); if (idFile == 1 || idFile == 2) { @@ -381,7 +382,7 @@ namespace Hack.Xenosaga.Process { Trace.WriteLine(string.Format("From {0} : file {1}", Variables.dirUnpack, entryPath.FullPath)); - filename = Variables.dirUnpack + entryPath.FullPath; + filename = directoryUnpackName + entryPath.FullPath; } using (BinaryReader brFile = new BinaryReader(File.Open(filename, FileMode.Open)))