internal static Stream InjectEnglishVoicesToWiiNub(Config config, FileFetcher _fc, string name, DuplicatableStream wstream, DuplicatableStream jstream, DuplicatableStream ustream) { NubInfo nub = Nubs.Where(x => x.Name == Path.GetFileNameWithoutExtension(name)).FirstOrDefault(); string nubdir = Path.Combine(config.EnglishVoiceProcessingDir, nub.Name); return(RebuildNubStream(wstream, nubdir, nub.WiiType, x => x.ToString("D8"))); }
public static Dictionary <string, MappingData> GetFileMappings(FileFetcher _fc, bool patchVoices) { var files = new Dictionary <string, MappingData>(); files.Add(@"rootR.cpk/str/ja/CharName.bin", new MappingData(c: true)); GetFileMappingsMap0(_fc, files); GetFileMappingsMap1(_fc, files); GetFileMappingsRoot(_fc, files); files.Add("boot.elf", new MappingData(c: true)); GetFileMappingsWiiV0(files); GetFileMappingsAreaNameTextures(files); if (patchVoices) { GetFileMappingsVoices(files); } return(files); }
public static Stream ProcessAreaNameTexture(FileFetcher _fc, string name, DuplicatableStream jstream, DuplicatableStream ustream) { DuplicatableStream wstream = _fc.GetFile(name, Version.W); FPS4 wani = new FPS4(wstream.Duplicate()); FPS4 uani = new FPS4(new HyoutaTools.Tales.tlzc.TlzcDecompressor().Decompress(ustream.Duplicate())); var clgfileinfo = wani.Files.Where(x => x.FileName.EndsWith(".CLG")).First(); string clgname = clgfileinfo.FileName; FPS4 waniclg = new FPS4(wani.GetChildByName(clgname).AsFile.DataStream); FPS4 uaniclg = new FPS4(uani.GetChildByName(clgname).AsFile.DataStream); DuplicatableStream wtexstream = waniclg.GetChildByIndex(1).AsFile.DataStream; DuplicatableStream utexstream = uaniclg.GetChildByIndex(1).AsFile.DataStream; Stream wtexstreammod = ProcessTexture(name + "/" + clgname, utexstream, wtexstream); long injectOffset = clgfileinfo.Location.Value + waniclg.Files[1].Location.Value; Stream wstreammod = wstream.CopyToMemory(); wstreammod.Position = injectOffset; wtexstreammod.Position = 0; StreamUtils.CopyStream(wtexstreammod, wstreammod, wtexstreammod.Length); wstreammod.Position = 0; return(wstreammod); }
public static Stream ProcessTexture(FileFetcher _fc, string name, DuplicatableStream jstream, DuplicatableStream ustream) { DuplicatableStream wstream = _fc.GetFile(name, Version.W); return(ProcessTexture(name, ustream, wstream)); }
public static (DuplicatableStream metrics, DuplicatableStream texture, Dictionary <char, (int w1, int w2)> charToWidthMap) Run(FileFetcher _fc, Config config) { bool debug = config.DebugFontOutputPath != null; bool adjustMetrics = debug; DuplicatableStream metricsWiiStream = _fc.GetFile("rootR.cpk/sys/FontBinary2.bin", Version.W); DuplicatableStream textureWiiStream = _fc.GetFile("rootR.cpk/sys/FontTexture2.tex", Version.W); DuplicatableStream texturePs3Stream = _fc.GetFile("rootR.cpk/sys/FontTexture2.tex", Version.U); FPS4 metricsWiiFps4 = new FPS4(metricsWiiStream); DuplicatableStream metricsWiiData = metricsWiiFps4.GetChildByIndex(1).AsFile.DataStream; FPS4 textureWiiFps4 = new FPS4(textureWiiStream); FPS4 texturePs3Fps4 = new FPS4(texturePs3Stream); TXM textureWiiTxm = new TXM(textureWiiFps4.GetChildByIndex(0).AsFile.DataStream); TXV textureWiiTxv = new TXV(textureWiiTxm, textureWiiFps4.GetChildByIndex(1).AsFile.DataStream, false); TXM texturePs3Txm = new TXM(texturePs3Fps4.GetChildByIndex(0).AsFile.DataStream); TXV texturePs3Txv = new TXV(texturePs3Txm, texturePs3Fps4.GetChildByIndex(1).AsFile.DataStream, false); Bitmap bitmapWii = textureWiiTxv.textures[0].GetBitmaps()[0]; Bitmap bitmapPs3 = texturePs3Txv.textures[0].GetBitmaps()[0]; if (debug) { Directory.CreateDirectory(config.DebugFontOutputPath); bitmapWii.Save(Path.Combine(config.DebugFontOutputPath, "wii.png")); bitmapPs3.Save(Path.Combine(config.DebugFontOutputPath, "ps3.png")); } var img_wii = bitmapWii; var img_ps3 = bitmapPs3; const int tile_extent_in_image = 25; const int tile_extent_actual = 24; int tiles_x = (img_wii.Width + 1) / tile_extent_in_image; int tiles_y = (img_wii.Height + 1) / tile_extent_in_image; const int ps3_tile_extent_in_image = 37; const int ps3_tile_extent_actual = 36; int ps3_tiles_x = (img_ps3.Width + 1) / ps3_tile_extent_in_image; int ps3_tiles_y = (img_ps3.Height + 1) / ps3_tile_extent_in_image; // split into individual tiles and extract source colors HashSet <Color> colors = new HashSet <Color>(); List <Bitmap> tiles_wii = new List <Bitmap>(); List <Bitmap> tiles_ps3 = new List <Bitmap>(); for (int ty = 0; ty < tiles_y; ++ty) { for (int tx = 0; tx < tiles_x; ++tx) { var bmp = new Bitmap(tile_extent_actual, tile_extent_actual); for (int y = 0; y < tile_extent_actual; ++y) { for (int x = 0; x < tile_extent_actual; ++x) { var px = img_wii.GetPixel(tx * tile_extent_in_image + x, ty * tile_extent_in_image + y); colors.Add(px); bmp.SetPixel(x, y, px); } } tiles_wii.Add(bmp); } } for (int ty = 0; ty < ps3_tiles_y; ++ty) { for (int tx = 0; tx < ps3_tiles_x; ++tx) { var bmp = new Bitmap(ps3_tile_extent_actual, ps3_tile_extent_actual); for (int y = 0; y < ps3_tile_extent_actual; ++y) { for (int x = 0; x < ps3_tile_extent_actual; ++x) { var px = img_ps3.GetPixel(tx * ps3_tile_extent_in_image + x, ty * ps3_tile_extent_in_image + y); bmp.SetPixel(x, y, px); } } tiles_ps3.Add(bmp); } } // inject ps3 tiles over wii tiles List <(int where, int ps3where, string chars)> charsets = new List <(int where, int ps3where, string chars)>(); charsets.Add((0, 0, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")); charsets.Add((243, 74, ",.")); charsets.Add((246, 77, ":;?!_")); charsets.Add((254, 83, "/\\~|…")); charsets.Add((260, 118, "‘")); charsets.Add((261, 118, "’")); charsets.Add((262, 119, "“")); charsets.Add((263, 119, "”")); charsets.Add((264, 93, "()[]{}")); charsets.Add((276, 105, "+")); charsets.Add((277, 82, "-")); // copy the dash minus instead of the math minus, looks better in text flow charsets.Add((278, 107, "±×÷=≠<>≤≥")); charsets.Add((289, 118, "'\"")); charsets.Add((293, 122, "$%#&*@")); Dictionary <char, (int w1, int w2)> charToWidthMap = new Dictionary <char, (int w1, int w2)>(); byte[] metrics = new byte[metricsWiiData.Length]; metricsWiiData.Read(metrics, 0, metrics.Length); foreach (var charset in charsets) { int where = charset.where; int ps3where = charset.ps3where; foreach (char ch in charset.chars) { var wiitile = tiles_wii[where]; var averagescaled = DownscaleTileFromPs3ToWiiWithUnweightedAverageScaling(tiles_ps3[ps3where]); //var downscaled = DownscaleTileFromPs3ToWiiWithWeightedScaling(tiles_ps3[ps3where]); var downscaled = averagescaled; PosterizeImage(wiitile, downscaled, colors, tile_extent_actual); PosterizeImage(averagescaled, averagescaled, colors, tile_extent_actual); if (debug) { wiitile.Save(Path.Combine(config.DebugFontOutputPath, string.Format("wii_new_{0:D4}.png", where))); } int cutoff_1 = 180; int cutoff_2 = 220; int leftwhere = where * 8 + 0; int rightwhere = where * 8 + 1; int leftwhere2 = where * 8 + 4; int rightwhere2 = where * 8 + 5; // forcing vertical extents to be the same for all, because text looks *really weird* in english if lines have different heights // for digits, forcing horizontal extents to be the same as well so they look nice in vertical lists bool isDigit = ch == '0' || ch == '1' || ch == '2' || ch == '3' || ch == '4' || ch == '5' || ch == '6' || ch == '7' || ch == '8' || ch == '9'; if (isDigit) { metrics[leftwhere] = ch == '1' ? (byte)(6) : ch == '2' ? (byte)(6) : (byte)(7); metrics[rightwhere] = ch == '1' ? (byte)(8) : ch == '2' ? (byte)(8) : (byte)(7); //metrics[leftwhere2] = ch == '1' ? (byte)(7) : ch == '2' ? (byte)(7) : (byte)(8); //metrics[rightwhere2] = ch == '1' ? (byte)(9) : ch == '2' ? (byte)(9) : (byte)(8); } else { metrics[leftwhere] = (byte)MeasureAlphaFromLeft(averagescaled, cutoff_1); metrics[rightwhere] = (byte)MeasureAlphaFromRight(averagescaled, cutoff_1); //metrics[leftwhere2] = (byte)MeasureAlphaFromLeft(averagescaled, cutoff_2); //metrics[rightwhere2] = (byte)MeasureAlphaFromRight(averagescaled, cutoff_2); } switch (ch) { case 'j': case ';': metrics[leftwhere] += 1; break; case 'A': case 'P': case 'Q': case 'T': case 'Y': case 'W': case 'f': case 's': case 'w': case 'y': case '[': metrics[rightwhere] += 1; break; case 't': metrics[leftwhere] += 1; metrics[rightwhere] += 1; break; default: break; } metrics[leftwhere2] = metrics[leftwhere]; metrics[rightwhere2] = metrics[rightwhere]; switch (ch) { case '.': case ',': metrics[leftwhere2] += 1; metrics[rightwhere] += 1; break; default: break; } metrics[where * 8 + 2] = 0; //(byte)MeasureAlphaFromTop(test, cutoff_1); metrics[where * 8 + 3] = 4; //(byte)MeasureAlphaFromBottom(test, cutoff_1); metrics[where * 8 + 6] = 0; //(byte)MeasureAlphaFromTop(test, cutoff_2); metrics[where * 8 + 7] = 4; //(byte)MeasureAlphaFromBottom(test, cutoff_2); int width1 = tile_extent_actual - (metrics[leftwhere] + metrics[rightwhere]); int width2 = tile_extent_actual - (metrics[leftwhere2] + metrics[rightwhere2]); charToWidthMap.Add(ch, (width1, width2)); ++where; ++ps3where; } } // manually generate good metrics for space; see also code patches in main.dol metrics[0x6F70] = 10; metrics[0x6F71] = 10; metrics[0x6F72] = 0; metrics[0x6F73] = 4; metrics[0x6F74] = 10; metrics[0x6F75] = 10; metrics[0x6F76] = 0; metrics[0x6F77] = 4; charToWidthMap.Add(' ', (tile_extent_actual - 20, tile_extent_actual - 20)); // write out visual representation of font metrics for adjustments if (adjustMetrics) { foreach (var charset in charsets) { int where = charset.where; foreach (char ch in charset.chars) { int factor = 10; var test = PointScale(tiles_wii[where], factor); for (int metricsset = 0; metricsset < 2; ++metricsset) { Color col = metricsset == 0 ? Color.Red : Color.Yellow; int xl = (metrics[where * 8 + metricsset * 4] - 1) * factor + factor - 1; int xr = (tiles_wii[where].Width - metrics[where * 8 + metricsset * 4 + 1]) * factor; int yt = (metrics[where * 8 + metricsset * 4 + 2] - 1) * factor + factor - 1; int yb = (tiles_wii[where].Width - metrics[where * 8 + metricsset * 4 + 3]) * factor; for (int y = 0; y < test.Height; ++y) { if (xl >= 0 && xl < test.Width) { test.SetPixel(xl, y, col); } if (xr >= 0 && xr < test.Width) { test.SetPixel(xr, y, col); } } for (int x = 0; x < test.Width; ++x) { if (yt >= 0 && yt < test.Height) { test.SetPixel(x, yt, col); } if (yb >= 0 && yb < test.Height) { test.SetPixel(x, yb, col); } } } PointScale(test, 3).Save(Path.Combine(config.DebugFontOutputPath, string.Format("metrics_view_{0:D4}.png", where))); ++where; } } } // join indvidiual tiles back into full texture int idx = 0; for (int ty = 0; ty < tiles_y; ++ty) { for (int tx = 0; tx < tiles_x; ++tx) { var bmp = tiles_wii[idx]; for (int y = 0; y < tile_extent_actual; ++y) { for (int x = 0; x < tile_extent_actual; ++x) { var px = bmp.GetPixel(x, y); img_wii.SetPixel(tx * tile_extent_in_image + x, ty * tile_extent_in_image + y, px); } } ++idx; } } if (debug) { img_wii.Save(Path.Combine(config.DebugFontOutputPath, "wii_new.png")); } // inject metrics DuplicatableStream outputMetricsStream; { Stream stream = metricsWiiStream.Duplicate().CopyToMemory(); stream.Position = 0x43E0; stream.Write(metrics); stream.Position = 0; byte[] data = new byte[stream.Length]; stream.Read(data, 0, data.Length); outputMetricsStream = new HyoutaUtils.Streams.DuplicatableByteArrayStream(data); } // encode texture DuplicatableStream outputTextureStream; { Stream stream = textureWiiStream.Duplicate().CopyToMemory(); stream.Position = 0x80100; List <(int idx, ushort v)> stuff = new List <(int idx, ushort v)>(); for (int i = 0; i < 16; ++i) { stuff.Add((i, stream.ReadUInt16().FromEndian(EndianUtils.Endianness.BigEndian))); } stream.Position = 0x100; var pxit = new HyoutaTools.Textures.PixelOrderIterators.TiledPixelOrderIterator(img_wii.Width, img_wii.Height, 8, 8); byte storage = 0; bool even = false; foreach (var px in pxit) { if (px.X < img_wii.Width && px.Y < img_wii.Height) { Color col = img_wii.GetPixel(px.X, px.Y); ushort value = HyoutaTools.Textures.ColorFetchingIterators.ColorFetcherGrey8Alpha8.ColorToGrey8Alpha8(col); var colidx = stuff.First(x => x.v == value).idx; if (!even) { storage = (byte)colidx; } else { storage = (byte)(storage << 4 | (byte)colidx); stream.WriteByte(storage); } even = !even; } } stream.Position = 0; byte[] data = new byte[stream.Length]; stream.Read(data, 0, data.Length); outputTextureStream = new HyoutaUtils.Streams.DuplicatableByteArrayStream(data); } return(outputMetricsStream, outputTextureStream, charToWidthMap); }
private static void GetFileMappingsRoot(FileFetcher _fc, Dictionary <string, MappingData> files) { files.Add(@"rootR.cpk/btl/acf/bin000.acf", new MappingData(c: true, w: new W().Sys(0).Sys(13).R(33, 33).Un(259).Un(260))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC001.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC002.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC003.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC004.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC005.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC006.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC007.scs", new MappingData(c: true, u: new M().Merge(15, 16, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC008.scs", new MappingData(c: true, u: new M().Merge(24, 25, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC009.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC010.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC011.scs", new MappingData(c: true, j: new M().A(33, -2), u: new M().Merge(15, 16, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC012.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC013.scs", new MappingData(c: true, j: new M().A(23, 20))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC014.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC015.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC016.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC017.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC018.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC019.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC020.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC021.scs", new MappingData(c: true, u: new M().Merge(17, 18, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC022.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC023.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC024.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC025.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC026.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC027.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC028.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC029.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC030.scs", new MappingData(c: true, j: new M().A(20, 14).A(29, 28, 28, 28, 28))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC031.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC032.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC033.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC034.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC035.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC036.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC037.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC038.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC039.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC040.scs", new MappingData(c: true, j: new M().A(20, 17))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC041.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC042.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC043.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC044.scs", new MappingData(c: true, j: new M().A(28, 15))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC045.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC046.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC047.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC048.scs", new MappingData(c: true, j: new M().A(32, 31))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC049.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC050.scs", new MappingData(c: true, j: new M().A(22, 21))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC051.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC052.scs", new MappingData(c: true, j: new M().A(19, 18))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC053.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC054.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC055.scs", new MappingData(c: true, u: new M().Merge(16, 17, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC056.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC057.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC058.scs", new MappingData(c: true, u: new M().Merge(30, 31, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC059.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC060.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC061.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC062.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC063.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC064.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC065.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC066.scs", new MappingData(c: true, j: new M().A(26, 25))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC067.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC068.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC069.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC070.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC071.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC072.scs", new MappingData(c: true, u: new M().Merge(20, 21, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC073.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC074.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC075.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC076.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DC077.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL001.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL002.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL003.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL004.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL005.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL006.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL007.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL008.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL009.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL010.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL011.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL012.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL013.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL014.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL016.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL017.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL018.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL019.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_DL021.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS001.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS002.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS003.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS004.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS005.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS006.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS007.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n", new List <int>() { 0, 2, 3 }, new List <int>() { 152 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS008.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS009.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS010.scs", new MappingData(c: true, j: new M().A(21, 13), multiplyOutSkit: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS011.scs", new MappingData(c: true, j: new M().A(19, 13).A(20, 13), multiplyOutSkit: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS012.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS013.scs", new MappingData(c: true, u: new M().Merge(15, 16, "\n", new List <int>() { 0, 2, 3 }, new List <int>() { 126 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS014.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS015.scs", new MappingData(c: true, j: new M().A(20, 19, 19))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS016.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS017.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS018.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS019.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS020.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS021.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS022.scs", new MappingData(c: true, u: new M().Merge(16, 17, "\n", new List <int>() { 0, 1, 3 }, new List <int>() { 57 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS023.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS024.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS025.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS026.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS027.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS028.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS029.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS030.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS031.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS032.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS033.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n", new List <int>() { 2 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS034.scs", new MappingData(c: true, u: new M().Merge(17, 18, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS035.scs", new MappingData(c: true, u: new M().Merge(16, 17, "\n", new List <int>() { 1, 2 }, new List <int>() { 110 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS036.scs", new MappingData(c: true, u: new M().Merge(16, 17, "\n", new List <int>() { 0, 2 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS037.scs", new MappingData(c: true, u: new M().Merge(24, 25, "\n", new List <int>() { 2 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS038.scs", new MappingData(c: true, u: new M().Merge(14, 15, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 54, 100 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS039.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS040.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS041.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS042.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS043.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS044.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS045.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS046.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS047.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS048.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS049.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS050.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS051.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS052.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS053.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS054.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS055.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS056.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS057.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS058.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS059.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS060.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS061.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS062.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS063.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS064.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS065.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS066.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS067.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS068.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 69, 140 }).Merge(22, 23, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 70, 140 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS069.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS070.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS071.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS072.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS073.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS074.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS075.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n", new List <int>() { 0 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS076.scs", new MappingData(c: true, u: new M().Merge(13, 14, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 55, 121 }), w: new W().P(17, (o, r) => r.RemoveMultispace()))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS077.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS078.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS079.scs", new MappingData(c: true, u: new M().Merge(17, 18, "\n", new List <int>() { 0, 2, 4 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS080.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS081.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS082.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS083.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS084.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS085.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS086.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS087.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS088.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS089.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS090.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS091.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS092.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 62 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS093.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS094.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS095.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS096.scs", new MappingData(c: true, j: new M().A(21, 13), u: new M().Merge(17, 18, "\n", new List <int>() { 0, 2 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS097.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS098.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS099.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS100.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS101.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS102.scs", new MappingData(c: true, u: new M().Merge(20, 21, "\n", new List <int>() { 2 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS103.scs", new MappingData(c: true, j: new M().A(20, 13))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS104.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS105.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS106.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS107.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS108.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n", new List <int>() { 0, 2, 3 }, new List <int>() { 137 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS109.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS110.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS111.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS112.scs", new MappingData(c: true, u: new M().Merge(17, 18, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS113.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n", new List <int>() { 0, 2 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS114.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS115.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS116.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS117.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS118.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS119.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS120.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS121.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS122.scs", new MappingData(c: true, j: new M().A(31, 27).A(37, 17), multiplyOutSkit: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS123.scs", new MappingData(c: true, j: new M().A(20, 14), multiplyOutSkit: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS124.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS125.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS126.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 55, 114 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS127.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS128.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS129.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS130.scs", new MappingData(c: true, j: new M().A(23, 15), multiplyOutSkit: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS131.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS132.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS133.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS134.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS135.scs", new MappingData(c: true, u: new M().Merge(20, 21, "\n", new List <int>() { 0, 1, 3 }, new List <int>() { 54 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS136.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS137.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS138.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS139.scs", new MappingData(c: true, u: new M().Merge(17, 18, 19, "\n", new List <int>() { 0, 2, 3, 4, 5 }, new List <int>() { 156, 235 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS140.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS141.scs", new MappingData(c: true, j: new M().A(16, 15))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS142.scs", new MappingData(c: true, u: new M().Merge(21, 22, "\n", new List <int>() { 0, 1 }, new List <int>() { 56 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS143.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS144.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS145.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS146.scs", new MappingData(c: true, u: new M().Merge(16, 17, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 54, 110 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS147.scs", new MappingData(c: true, j: new M().A(26, 25))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS148.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS149.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS150.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS151.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS152.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS153.scs", new MappingData(c: true, u: new M().Merge(21, 22, "\n", new List <int>() { 0, 1, 2, 3 }, new List <int>() { 75, 148 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS154.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS155.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS156.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS157.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS158.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS159.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n", new List <int>() { 0, 1, 3 }, new List <int>() { 63 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS160.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS161.scs", new MappingData(c: true, u: new M().Merge(13, 14, "\n", new List <int>() { 0, 2 }, new List <int>() { 115 }), w: new W().R(17, 20))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS162.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS163.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS164.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS165.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS166.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS167.scs", new MappingData(c: true, u: new M().Merge(20, 21, "\n", new List <int>() { 0, 2 }, new List <int>() { 122 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS168.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS169.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS170.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS171.scs", new MappingData(c: true, u: new M().Merge(14, 15, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 56, 115 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS172.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS173.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS174.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS175.scs", new MappingData(c: true, u: new M().Merge(14, 15, "\n", new List <int>() { 0 }).Merge(17, 18, 19, "\n", new List <int>() { 0, 1, 2, 3, 4 }, new List <int>() { 73, 150 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS176.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS177.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS178.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS179.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS180.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS181.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS182.scs", new MappingData(c: true, u: new M().Merge(16, 17, "\n", new List <int>() { 0, 1 }, new List <int>() { 60 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS183.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS184.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS185.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS186.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS187.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS188.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS189.scs", new MappingData(c: true, u: new M().Merge(15, 16, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS190.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS191.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS192.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS193.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS194.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS195.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS196.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS197.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS198.scs", new MappingData(c: true, u: new M().Merge(23, 24, "\n", new List <int>() { 0, 1, 3 }, new List <int>() { 50 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS199.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS200.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS201.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS202.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 72, 143 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS203.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n", new List <int>() { 0, 1, 2 }, new List <int>() { 79 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS204.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n").Merge(21, 22, "\n", new List <int>() { 1, 2 }, new List <int>() { 115 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS205.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS206.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS207.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS208.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS209.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS210.scs", new MappingData(c: true, u: new M().Merge(17, 18, "\n", new List <int>() { 0 }).Merge(23, 24, "\n", new List <int>() { 0, 2, 3 }, new List <int>() { 142 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS211.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS212.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n", new List <int>() { 0, 2, 3 }, new List <int>() { 145 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS213.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS214.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS215.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS216.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS217.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS218.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS219.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS220.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS221.scs", new MappingData(c: true, u: new M().Merge(19, 20, "\n", new List <int>() { 0, 2 }, new List <int>() { 109 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS222.scs", new MappingData(c: true, u: new M().Merge(16, 17, "\n", new List <int>() { 0, 2 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS223.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS224.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS225.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS226.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS227.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS228.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS229.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS230.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS231.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS232.scs", new MappingData(c: true, u: new M().Merge(17, 18, "\n", new List <int>() { 1, 2 }, new List <int>() { 108 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS233.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS234.scs", new MappingData(c: true, u: new M().Merge(20, 21, 22, "\n", new List <int>() { 0, 1, 2, 3, 4 }, new List <int>() { 73, 150, 226 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS235.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS236.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS237.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS238.scs", new MappingData(c: true, u: new M().Merge(31, 32, "\n", new List <int>() { 1, 2 }, new List <int>() { 109 }).A(35, -1), w: new W().Sys(32))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS239.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS240.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS241.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_MS242.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_PR001.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_PR002.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_PR003.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_PR004.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_PR005.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_PR006.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_PR007.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB001.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB002.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB003.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB004.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB005.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB006.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB007.scs", new MappingData(c: true, j: new M().A(26, 25, 25, 25, 25))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB008.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB009.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB010.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB011.scs", new MappingData(c: true, j: new M().A(20, -1))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB012.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB013.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB014.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB015.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB016.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB017.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB018.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB019.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB020.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB021.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB022.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB023.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB024.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB025.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB026.scs", new MappingData(c: true, j: new M().A(17, -1).A(24, -2))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB027.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB028.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB029.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB030.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB031.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB032.scs", new MappingData(c: true, j: new M().A(18, 17).A(25, 24, 24).A(27, 26, 26))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB033.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB034.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB035.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB036.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB037.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB038.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB039.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB040.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB041.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB042.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB043.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB044.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB045.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB046.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB047.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB048.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB049.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB050.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB051.scs", new MappingData(c: true, j: new M().A(13, -1))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB052.scs", new MappingData(c: true, u: new M().Merge(21, 22, 23, "\n", new List <int>() { 0, 1, 2, 3, 4 }, new List <int>() { 73, 145 }))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB053.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB054.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB055.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB056.scs", new MappingData(c: true, u: new M().Merge(18, 19, "\n"))); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB057.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB058.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB059.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB060.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB061.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB062.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB063.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB064.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB065.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB066.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB067.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB068.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB069.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB070.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB071.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/CHT_SB072.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/debug_00.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/chat/scs/JA/debug_02.scs", new MappingData(c: true)); files.Add(@"rootR.cpk/mg/tex/karuta.tex", new MappingData(c: true, skipTextMapping: true)); files.Add(@"rootR.cpk/mnu/tex/main.tex", new MappingData(c: true, skipTextMapping: true)); files.Add(@"rootR.cpk/mnu/tex/shop.tex", new MappingData(c: true, skipTextMapping: true)); files.Add(@"rootR.cpk/mnu/tex/skill.tex", new MappingData(c: true, skipTextMapping: true)); files.Add(@"rootR.cpk/mnu/tex/snd_test.tex", new MappingData(c: true, skipTextMapping: true)); files.Add(@"rootR.cpk/movie/str/ja/TOG_S01.bin", new MappingData(c: true, u: new M().A(0, -1).EnableEmptyStrings())); files.Add(@"rootR.cpk/movie/str/ja/TOG_S02.bin", new MappingData(c: true, u: new M().A(0, -1).A(2, new List <int>() { -1, -1 }).A(13, new List <int>() { -1, -1 }).A(14, new List <int>() { -1, -1, -1, -1 }).A(15, -1).A(16, -1).EnableEmptyStrings())); files.Add(@"rootR.cpk/movie/str/ja/TOG_S03.bin", new MappingData(c: true)); files.Add(@"rootR.cpk/movie/str/ja/TOG_S04.bin", new MappingData(c: true, u: new M().A(3, -1).A(10, new List <int>() { -1, -1, -1 }).A(14, -1).A(17, -1).EnableEmptyStrings())); files.Add(@"rootR.cpk/movie/str/ja/TOG_S05.bin", new MappingData(c: true, u: new M().A(0, new List <int>() { -1, -1 }).A(1, -1).A(2, new List <int>() { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }).A(3, -1).A(4, -1).EnableEmptyStrings())); files.Add(@"rootR.cpk/movie/str/ja/TOG_S06.bin", new MappingData(c: true, u: new M().A(6, -1).EnableEmptyStrings())); files.Add(@"rootR.cpk/movie/str/ja/TOG_S07.bin", new MappingData(c: true)); files.Add(@"rootR.cpk/movie/str/ja/TOG_S08.bin", new MappingData(c: true)); files.Add(@"rootR.cpk/movie/str/ja/TOG_S09.bin", new MappingData(c: true)); files.Add(@"rootR.cpk/movie/str/ja/TOG_S10.bin", new MappingData(c: true)); files.Add(@"rootR.cpk/movie/str/ja/TOG_S11.bin", new MappingData(c: true)); files.Add(@"rootR.cpk/str/ja/ActInfo.bin", new MappingData(c: true, w: new W().Un(4).Un(5).Un(6).Un(8).Un(12).Un(13).Un(15).Un(21))); files.Add(@"rootR.cpk/str/ja/MapName.bin", new MappingData(c: true, w: new W().RP(431, 439, (o, r) => r.Substring(0, 11) + o.Substring(6)).RP(433, 439, (o, r) => r.Substring(0, 11) + o.Substring(6)).RP(435, 439, (o, r) => r.Substring(0, 11) + o.Substring(6)))); files.Add(@"rootR.cpk/str/ja/Navigation.bin", new MappingData(c: true)); files.Add(@"rootR.cpk/SysSub/JA/TitleTexture.tex", new MappingData(c: true, skipTextMapping: true)); files.Add(@"rootR.cpk/SysSub/JA/TOG_SS_ChatName.dat", new MappingData(c: true)); files.Add(@"rootR.cpk/sys/ja/SysString.bin", new MappingData(c: true, j: new M().A(141, -601), w: new W().R(34, 34).R(35, 35).R(36, 36).Sys(45).Sys(46).Sys(47).R(50, 76).Sys(53).Sys(54).Sys(55).P(56, (o, r) => r.Substring(0, 5) + r.Substring(11)).R(87, 87).R(90, "").Un(105).Un(107).Un(116).Un(122).Un(123))); files.Add(@"rootR.cpk/sys/FontBinary2.bin", new MappingData(c: true, skipTextMapping: true)); files.Add(@"rootR.cpk/sys/FontTexture2.tex", new MappingData(c: true, skipTextMapping: true)); }
internal static Stream InjectEnglishContainedVoice(Config config, FileFetcher _fc, string name, DuplicatableStream wstream, DuplicatableStream jstream, DuplicatableStream ustream, ContainedVoiceInfo cvi, SkitTexCache skitTexCache) { var fps4 = new HyoutaTools.Tales.Vesperia.FPS4.FPS4(wstream.Duplicate()); var se3stream = fps4.GetChildByIndex(cvi.SE3Index).AsFile.DataStream; var se3 = new HyoutaTools.Tales.Vesperia.SE3.SE3(se3stream.Duplicate(), EndianUtils.Endianness.BigEndian, TextUtils.GameTextEncoding.ASCII); var se3ms = se3.ExtractSe3HeaderStream(); var nubms = se3.ExtractNubStream(); var nubstream = new DuplicatableByteArrayStream(nubms.CopyToByteArrayAndDispose()); var newnubstream = RebuildNubStream(nubstream, Path.Combine(config.EnglishVoiceProcessingDir, "other"), cvi.WiiType, x => Path.GetFileNameWithoutExtension(name)); var newse3stream = new MemoryStream(); se3ms.Position = 0; newnubstream.Position = 0; StreamUtils.CopyStream(se3ms, newse3stream); StreamUtils.CopyStream(newnubstream, newse3stream); if (cvi.IsSkit) { using (var texIdStream = fps4.GetChildByIndex(3).AsFile.DataStream.Duplicate().CopyToByteArrayStreamAndDispose()) { int idx = 4; uint[] texIds = texIdStream.ReadUInt32Array(texIdStream.Length / 4, EndianUtils.Endianness.BigEndian); foreach (uint texId in texIds) { skitTexCache.AddTextureIfNotExists(texId, fps4.GetChildByIndex(idx).AsFile.DataStream.Duplicate().CopyToByteArrayStreamAndDispose()); ++idx; } } } newse3stream.Position = 0; MemoryStream newfps4stream = new MemoryStream(); using (var ufps4 = new HyoutaTools.Tales.Vesperia.FPS4.FPS4(ustream.Duplicate())) { uint[] utexIds = null; if (cvi.IsSkit) { using (var texIdStream = ufps4.GetChildByIndex(3).AsFile.DataStream.Duplicate().CopyToByteArrayStreamAndDispose()) { utexIds = texIdStream.ReadUInt32Array(texIdStream.Length / 4, EndianUtils.Endianness.BigEndian); } } List <HyoutaTools.Tales.Vesperia.FPS4.PackFileInfo> packFileInfos = new List <HyoutaTools.Tales.Vesperia.FPS4.PackFileInfo>(fps4.Files.Count); for (int i = 0; i < (cvi.IsSkit ? ufps4 : fps4).Files.Count - 1; ++i) { var pf = new HyoutaTools.Tales.Vesperia.FPS4.PackFileInfo(); pf.Name = (cvi.IsSkit ? ufps4 : fps4).Files[i].FileName; if (i == cvi.SE3Index) { pf.DataStream = new DuplicatableByteArrayStream(newse3stream.CopyToByteArrayAndDispose()); } else if (cvi.IsSkit && (i == 0 || i == 2 || i == 3)) { // copy over the actual skit script/timing from the EN version so the voice timing and lipsync matches with the skit pf.DataStream = ufps4.GetChildByIndex(i).AsFile.DataStream.Duplicate(); } else if (cvi.IsSkit && i >= 4) { uint texId = NormalizePs3SkitTextureIdForWii(utexIds[i - 4]); try { pf.DataStream = skitTexCache.GetTextureStream(texId); } catch (Exception ex) { Console.WriteLine("ERROR: Failed to get skit texture with ID 0x" + texId.ToString("x4")); Console.WriteLine(" tex name: " + new SkitTexCache.SkitTex() { Stream = ufps4.GetChildByIndex(i).AsFile.DataStream.Duplicate() }.ToString()); throw ex; } } else { pf.DataStream = fps4.GetChildByIndex(i).AsFile.DataStream.Duplicate(); } pf.Length = pf.DataStream.Length; packFileInfos.Add(pf); } packFileInfos = HyoutaTools.Tales.Vesperia.FPS4.FPS4.DetectDuplicates(packFileInfos); HyoutaTools.Tales.Vesperia.FPS4.FPS4.Pack(packFileInfos, newfps4stream, fps4.ContentBitmask, EndianUtils.Endianness.BigEndian, fps4.Unknown2, cvi.IsSkit ? null : wstream.Duplicate(), fps4.ArchiveName, fps4.FirstFileStart, 0x20); } //using (var fs = new FileStream(Path.Combine(@"c:\__graces\______fps4repacktest\", name.Replace("/", "_") + "_old.fps4"), FileMode.Create)) { // using (var wcpy = wstream.Duplicate()) { // wcpy.Position = 0; // StreamUtils.CopyStream(wcpy, fs); // } //} //using (var fs = new FileStream(Path.Combine(@"c:\__graces\______fps4repacktest\", name.Replace("/", "_") + "_new.fps4"), FileMode.Create)) { // newfps4stream.Position = 0; // StreamUtils.CopyStream(newfps4stream, fs); //} newfps4stream.Position = 0; return(newfps4stream); }
public static void Setup(Config config, string targetpath) { Directory.CreateDirectory(targetpath); var _fc = new FileFetcher(config); var rootW = _fc.TryGetContainer("rootR.cpk", Version.W); var rootU = _fc.TryGetContainer("rootR.cpk", Version.U); StringBuilder sb = new StringBuilder(); var defstreamW = rootW.GetChildByName("snd/init/StrConfig.stp").AsFile.DataStream; var defstreamU = rootU.GetChildByName("snd/init/StrConfig.stp").AsFile.DataStream; var defW = new SPKD(defstreamW); var defU = new SPKD(defstreamU); List <SPKD.SpkdPackFileData> defWPack = defW.GetPackData(); SHBP hashVobtletcU = null; iPck lipVobtletcU = null; NUB nubVobtletcU = null; foreach (NubInfo nubInfo in Nubs) { var hashStreamW = defW.GetChildByName(nubInfo.Name + ".1")?.AsFile.DataStream; var hashStreamU = defU.GetChildByName(nubInfo.Name + ".1")?.AsFile.DataStream; var lipStreamU = defU.GetChildByName(nubInfo.Name + ".2")?.AsFile.DataStream; DuplicatableStream lipStreamUDec = null; if (lipStreamU != null) { MemoryStream ms = new MemoryStream(); compto.complib.DecodeStream(lipStreamU, ms, 0, 0, true); lipStreamUDec = ms.CopyToByteArrayStreamAndDispose(); lipStreamUDec.Position = 0; } var nubStreamU = rootU.GetChildByName("snd/strpck/" + nubInfo.Name + ".nub").AsFile.DataStream; var hashW = hashStreamW != null ? new SHBP(hashStreamW) : null; var hashU = hashStreamU != null ? new SHBP(hashStreamU) : null; var lipU = lipStreamUDec != null ? new iPck(lipStreamUDec) : null; var nubU = new NUB(nubStreamU, EndianUtils.Endianness.BigEndian); if (nubInfo.Name == "VOBTLETC") { // the Wii VOBTL was split into two files VOBTL and VOBTLETC in PS3, so we need to do some stuff to put them back together hashVobtletcU = hashU; lipVobtletcU = lipU; nubVobtletcU = nubU; continue; } Console.WriteLine("Extracting files for " + nubInfo.Name + "..."); List <NubFileRef> filesToExtract = new List <NubFileRef>(); if (hashW != null && hashU != null) { Dictionary <uint, NubFileRef> hashToNubfileMap = new Dictionary <uint, NubFileRef>(); for (int i = 0; i < hashU.Hashes.Count; ++i) { uint hash = hashU.Hashes[i]; NubFileRef nfr = new NubFileRef() { Nub = nubU, Index = i, Lipsync = lipU.Data[i] }; if (hashToNubfileMap.ContainsKey(hash)) { throw new Exception("duplicate hash key"); } hashToNubfileMap.Add(hash, nfr); } if (nubInfo.Name == "VOBTL") { for (int i = 0; i < hashVobtletcU.Hashes.Count; ++i) { uint hash = hashVobtletcU.Hashes[i]; NubFileRef nfr = new NubFileRef() { Nub = nubVobtletcU, Index = i, Lipsync = lipVobtletcU.Data[i] }; if (hashToNubfileMap.ContainsKey(hash)) { throw new Exception("duplicate hash key"); } hashToNubfileMap.Add(hash, nfr); } } for (int i = 0; i < hashW.Hashes.Count; ++i) { uint hash = hashW.Hashes[i]; filesToExtract.Add(hashToNubfileMap[hash]); } } else { for (int i = 0; i < nubU.EntryCount; ++i) { filesToExtract.Add(new NubFileRef() { Nub = nubU, Index = i }); } } List <byte[]> lipData = lipU != null ? new List <byte[]>() : null; string dir = Path.Combine(targetpath, nubInfo.Name); Directory.CreateDirectory(dir); for (int i = 0; i < filesToExtract.Count; ++i) { var nfr = filesToExtract[i]; if (lipData != null) { lipData.Add(nfr.Lipsync); } using (var audiofilestream = nfr.Nub.GetChildByIndex(nfr.Index).AsFile.DataStream.Duplicate()) { string path = Path.Combine(dir, string.Format("{0:D8}.{1}", i, nubInfo.EngType)); using (var fs = new FileStream(path, FileMode.Create)) { audiofilestream.Position = 0; StreamUtils.CopyStream(audiofilestream, fs); } } GenerateConversion(sb, nubInfo.Name, i.ToString("D8"), nubInfo.EngType, nubInfo.WiiType, nubInfo.WiiSampleRate); } if (lipData != null) { using (var newlipstream = new iPck(lipData).WriteToStream(EndianUtils.Endianness.BigEndian)) { newlipstream.Position = 0; using (MemoryStream ms = new MemoryStream()) { compto.complib.EncodeStream(newlipstream, ms, 0, 1, true); defWPack.First(x => x.Name == nubInfo.Name).File2 = ms.CopyToByteArrayStreamAndDispose(); } } } } using (var newspkd = SPKD.Pack(defWPack)) using (var fs = new FileStream(Path.Combine(targetpath, "StrConfig.stp"), FileMode.Create)) { newspkd.Position = 0; StreamUtils.CopyStream(newspkd, fs); } string otherdir = Path.Combine(targetpath, "other"); Directory.CreateDirectory(otherdir); foreach (var cvi in ContainedVoices) { for (int i = cvi.StartNumber; i <= cvi.EndNumber; ++i) { string path = string.Format(cvi.BaseName, i); Console.WriteLine("Extracting " + path + "..."); string fname = Path.GetFileNameWithoutExtension(path); var fps4stream = rootU.GetChildByName(path).AsFile.DataStream; var fps4 = new HyoutaTools.Tales.Vesperia.FPS4.FPS4(fps4stream); var se3stream = fps4.GetChildByIndex(cvi.SE3Index).AsFile.DataStream; var ms = new HyoutaTools.Tales.Vesperia.SE3.SE3(se3stream.Duplicate(), EndianUtils.Endianness.BigEndian, TextUtils.GameTextEncoding.ASCII).ExtractNubStream(); var nub = new NUB(ms.CopyToByteArrayStreamAndDispose(), EndianUtils.Endianness.BigEndian); using (var audiofilestream = nub.GetChildByIndex(0).AsFile.DataStream.Duplicate()) { string otherpath = Path.Combine(otherdir, string.Format("{0}.{1}", fname, cvi.EngType)); using (var fs = new FileStream(otherpath, FileMode.Create)) { audiofilestream.Position = 0; StreamUtils.CopyStream(audiofilestream, fs); } } GenerateConversion(sb, "other", fname, cvi.EngType, cvi.WiiType, cvi.WiiSampleRate); } } File.WriteAllText(Path.Combine(targetpath, "convert_voices.bat"), sb.ToString()); return; }