Esempio n. 1
0
        /// <summary>
        /// Gets the value of the patch byte in the Unity executable.
        /// </summary>
        /// <param name="currentVersion"></param>
        /// <returns>The value of the patch byte.</returns>
        private byte GetPatchableByteValue(UnityVersionContainer currentVersion)
        {
            ConsoleHelpers.Write("Patch status: ");
            var jumpInstructionByte = BinaryHelpers.ReadByteAtAddress(UnityExecutable.ExecutablePath, PatchableByteAddress);

            if (jumpInstructionByte == currentVersion.LightSkinIndicator)
            {
                ConsoleHelpers.WriteLine($"Light skin (unpatched) [0x{jumpInstructionByte:X} @ 0x{PatchableByteAddress:X}]", ConsoleColor.Blue);
            }
            else if (jumpInstructionByte == currentVersion.DarkSkinIndicator)
            {
                ConsoleHelpers.WriteLine($"Dark skin (patched) [0x{jumpInstructionByte:X} @ 0x{PatchableByteAddress:X}]", ConsoleColor.Green);
            }
            else
            {
                ConsoleHelpers.WriteLine($"Unknown status [0x{jumpInstructionByte:X} @ 0x{PatchableByteAddress:X}]", ConsoleColor.Red);
                ConsoleHelpers.ExitOnInput();
            }
            return(jumpInstructionByte);
        }