Beispiel #1
0
        public void Init()
        {
            while (true)
            {
                UnityExecutables = GetUnityExecutablePath().Select(p => new UnityBinary(p));
                bool quitRequested = false;
                var  choices       = UnityExecutables.Select(e => new ConsoleChoice {
                    ChoiceDescription = e.ExecutableVersionString, ChoiceAction = () => UnityExecutable = e
                }).ToList();
                ConsoleHelpers.MultipleChoice(choices, () => quitRequested = true);
                if (quitRequested)
                {
                    break;
                }


                //replace with FindRegion here
                UnityVersionContainer currentVersion = FindRegionBytesByVersion(UnityExecutable.ExecutableVersion);

                //RegionBytes = UnityExecutable.ExecutableVersion >= UnityBinaryVersion.UNITY_2018_3_0 ? RegionBytes_2018_3 : RegionBytes_Pre2018_3;
                //JumpInstructionOffset = UnityExecutable.ExecutableVersion >= UnityBinaryVersion.UNITY_2018_3_0 ? JumpInstructionOffsetVersionB : JumpInstructionOffsetVersionA;
                PatchableByteAddress = BinaryHelpers.FindJumpInstructionAddress(UnityExecutable.ExecutablePath, currentVersion.RegionByteArray, currentVersion.InstructionOffset);
                PatchableByteValue   = GetPatchableByteValue(currentVersion);
                if (PatchableByteValue == currentVersion.DarkSkinIndicator)
                {
                    ConsoleHelpers.YesNoChoice("Revert to light skin?", () => PatchExecutable(currentVersion.LightSkinIndicator));
                }
                else
                {
                    ConsoleHelpers.YesNoChoice("Apply dark skin patch?", () => PatchExecutable(currentVersion.DarkSkinIndicator));
                }
            }
        }