Ejemplo n.º 1
0
        public override MethodDefinition[] patchedMethods()
        {
            TypeDefinition settingsMenu = Hooks.getTypeDef(assembly, "SettingsMenu");

            return(new MethodDefinition[] {
                Hooks.getMethDef(settingsMenu, "Init"),
                Hooks.getMethDef(settingsMenu, "OnGUI"),
                Hooks.getMethDef(settingsMenu, "OnDestroy"),
                Hooks.getMethDef(Hooks.getTypeDef(assembly, "SceneLoader"), "loadScene"),
                Hooks.getMethDef(Hooks.getTypeDef(assembly, "LobbyMenu"), "isSceneJumpValid")
            });
        }
Ejemplo n.º 2
0
        public bool safeModePatchAssembly()
        {
            String installPath = Platform.getGlobalScrollsInstallPath();

            if (installPath == null)
            {
                return(false);
            }

            try {
                //load assembly
                Hooks.loadBaseAssembly(installPath + "Assembly-CSharp.dll");
                //load self
                Hooks.loadInjectAssembly(installPath + "ScrollsModLoader.dll");
            } catch (Exception exp) {
                //something must be gone horribly wrong if it crashes here
                Console.WriteLine(exp);
                return(false);
            }

            if (!Hooks.hookStaticVoidMethodAtEnd("App.Awake", "Patcher.safeLaunch"))
            {
                return(false);
            }

            try {
                //save assembly
                Hooks.savePatchedAssembly();

                Platform.PlatformPatches(installPath);
            } catch (Exception exp) {
                //also very unlikely, but for safety
                Console.WriteLine(exp);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        public bool patchAssembly(String installPath)
        {
            if (installPath == null)
            {
                return(false);
            }
            bool writetofile = (Platform.getOS() == Platform.OS.Mac);

            if (writetofile)
            {
                Platform.ErrorLog("ModLoader Hooks:");
            }
            //"weave" the assembly
            Console.WriteLine("------------------------------");
            Console.WriteLine("ModLoader Hooks:");
            ScrollsFilter.Log();
            Console.WriteLine("------------------------------");

            if (!weaveAssembly(installPath + "Assembly-CSharp.dll"))
            {
                return(false);
            }
            Console.WriteLine("Weaved Assembly");
            if (writetofile)
            {
                Platform.ErrorLog("Weaved Assembly");
            }

            /*
             * add init hack
             */

            try {
                //load assembly
                Hooks.loadBaseAssembly(installPath + "Assembly-CSharp.dll");
                //load self
                Hooks.loadInjectAssembly(installPath + "ScrollsModLoader.dll");
            } catch (Exception exp) {
                //something must be gone horribly wrong if it crashes here
                Console.WriteLine(exp);
                return(false);
            }
            if (writetofile)
            {
                Platform.ErrorLog("loaded assembly + self");
            }

            //add hooks
            if (!Hooks.hookStaticVoidMethodAtEnd("App.Awake", "ModLoader.Init"))
            {
                return(false);
            }

            if (writetofile)
            {
                Platform.ErrorLog("added hocks");
            }

            try {
                //save assembly
                Console.WriteLine("Write back patched bytecode...");
                if (writetofile)
                {
                    Platform.ErrorLog("Write back patched bytecode...");
                }
                Hooks.savePatchedAssembly();

                Console.WriteLine("Platform specific patches...");
                if (writetofile)
                {
                    Platform.ErrorLog("Platform specific patches...");
                }
                Platform.PlatformPatches(installPath);
            } catch (Exception exp) {
                //also very unlikely, but for safety
                Console.WriteLine(exp);
                if (writetofile)
                {
                    Platform.ErrorLog(exp.ToString());
                }
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
        public override MethodDefinition[] patchedMethods()
        {
            MethodDefinition PopupOk = Hooks.getMethDef(Hooks.getTypeDef(assembly, "Login"), "PopupOk");

            return(new MethodDefinition[] { PopupOk });           //, Name};
        }