Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TPF tpf2 = TPF.Read($@"{ptde}\font\english\talkfont24.tpf.bak");
- TPF tpf = TPF.Read(@"D:\_E\Demon's Souls (PS3 EUR)\BLES00932\PS3_GAME\USRDIR\font\eu\talkfont24.tpf");
- int tc = tpf.Textures.Count;
- foreach (var tex in tpf.Textures)
- tex.Bytes = tex.Headerize();
- tpf.Platform = TPF.TPFPlatform.PC;
- tpf.Textures.AddRange(tpf2.Textures);
- for (int i = 0; i < tpf.Textures.Count; i++)
- {
- var tex = tpf.Textures[i];
- tex.Name = $"{tex.Name.Substring(0, tex.Name.Length - 4)}{i:D4}";
- }
- tpf.Write($@"{ptde}\font\english\talkfont24.tpf");
- CCM ccm2 = CCM.Read($@"{ptde}\font\english\talkfont24.ccm.bak");
- CCM ccm = CCM.Read(@"D:\_E\Demon's Souls (PS3 EUR)\BLES00932\PS3_GAME\USRDIR\font\eu\talkfont24.ccm");
- ccm.Version = CCM.CCMVer.DarkSouls1;
- double ratio = ccm.FullWidth / (double)ccm2.FullWidth;
- foreach (int code in ccm2.Glyphs.Keys)
- {
- if (code > 255)
- {
- var glyph = ccm2.Glyphs[code];
- glyph.TexIndex += (short)tc;
- glyph.PreSpace = (short)Math.Round(glyph.PreSpace * ratio);
- glyph.Width = (short)Math.Round(glyph.Width * ratio);
- glyph.Advance = (short)Math.Round(glyph.Advance * ratio);
- ccm.Glyphs[code] = glyph;
- }
- }
- //ccm.Unk0E = ccm2.Unk0E;
- //ccm.Unk1C = ccm2.Unk1C;
- ccm.Unk1D = ccm2.Unk1D;
- ccm.TexCount = (byte)tpf.Textures.Count;
- ccm.Write($@"{ptde}\font\english\talkfont24.ccm");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement