Archived
1
0
Fork 0
forked from Mirror/Ryujinx
This repository has been archived on 2024-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
jinx/Ryujinx.HLE/Utilities/FontUtils.cs
emmauss fe8fbb6fb9 Implement ContentManager and related services (#438)
* Implement contentmanager and related services

* small changes

* read system firmware version from nand

* add pfs support, write directoryentry info for romfs files

* add file check in fsp-srv:8

* add support for open fs of internal files

* fix filename when accessing pfs

* use switch style paths for contentpath

* close nca after verifying type

* removed publishing profiles, align directory entry

* fix style

* lots of style fixes

* yasf(yet another style fix)

* yasf(yet another style fix) plus symbols

* enforce path check on every fs access

* change enum type to default

* fix typo
2018-11-18 17:37:41 -02:00

37 lines
1.1 KiB
C#

using System.IO;
namespace Ryujinx.HLE.Utilities
{
public static class FontUtils
{
private static readonly uint FontKey = 0x06186249;
public static byte[] DecryptFont(Stream BFTTFStream)
{
uint KXor(uint In) => In ^ 0x06186249;
using (BinaryReader Reader = new BinaryReader(BFTTFStream))
{
using (MemoryStream TTFStream = new MemoryStream())
{
using (BinaryWriter Output = new BinaryWriter(TTFStream))
{
if (KXor(Reader.ReadUInt32()) != 0x18029a7f)
{
throw new InvalidDataException("Error: Input file is not in BFTTF format!");
}
BFTTFStream.Position += 4;
for (int i = 0; i < (BFTTFStream.Length - 8) / 4; i++)
{
Output.Write(KXor(Reader.ReadUInt32()));
}
return TTFStream.ToArray();
}
}
}
}
}
}