Class PackKeySlot¶
Namespace: Apogee.Export
Assembly: Apogee.Export.dll
A reserved place in the engine's executable for the key of the game's packs, so that an exported game opens its packs without the environment variable. The executable holds
key XOR SHA-256(salt + magic) (the same salt and bytes in all). The running game reads it back with
There is normally one copy, but a compiler may emit the data twice (the NativeAOT compiler does in the arm64 macOS executable), and the game reads whichever copy its code refers to: so every copy is patched.
This is obfuscation, not protection. The key is in the file, one XOR from anyone who reads this code or finds the magic; and a running game has the key in memory. It keeps the key out of
strings, out of a quick look in a hex editor, and out of the packs' reach, nothing more. It stops nobody who wants the game's files.
public static class PackKeySlot
Inheritance¶
Inherited Members¶
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods¶
TryRead()¶
The key an export wrote into this executable, or null when it has none (the program was not exported with a key: a development run, or an export without one).
public static PackKey? TryRead()
Returns¶
Exceptions¶
The slot holds a key in a format this version does not know.
Write(string, PackKey)¶
Writes key into every copy of the slot of the executable at executable, the same masked bytes (and salt) in each: the running game reads whichever copy
its code refers to.
public static int Write(string executable, PackKey key)
Parameters¶
executable string
key PackKey
Returns¶
How many copies of the slot were written (at least one).
Exceptions¶
The file has no slot, or more than