Exemplo n.º 1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            // Find Assemblies Manually if necessary (Deprecate app.config)
            AppDomain.CurrentDomain.AssemblyResolve += AssemblyFinder.CurrentDomain_AssemblyResolve;

            /* - Initialization - */
            DoSquirrelStuff();

            // Initialize the console.
            ConsoleFunctions.Initialize();

            // Print startup information.
            Banner.PrintBanner();

            // Get Controller Order
            Controllers.PrintControllerOrder();

            // Unlock DLLs, Removes Zone Information which may prevent DLL injection if DLL was downloaded from e.g. Internet Explorer
            DllUnlocker.UnblockDlls();

            // Setup Server
            LoaderServer.SetupServer();

            // Setup libReloaded Debug Bindings
            SetuplibReloadedBindings();

            /* - Option Parsing, Linking - */

            // Parse Arguments
            ParseArguments(args);

            // Start game
            InjectByMethod(args);

            /* - Load and enter main close polling loop - */

            // Add to exited event
            _gameProcess.GetProcessFromReloadedProcess().EnableRaisingEvents = true;
            _gameProcess.GetProcessFromReloadedProcess().Exited += (sender, eventArgs) => ProcessSelfReattach(args);

            // Load modifications for the current game.
            ModLoader.LoadMods(_gameConfig, _gameProcess);

            // Stay alive in the background
            AppDomain.CurrentDomain.ProcessExit += Shutdown;
            Console.CancelKeyPress += Shutdown;

            // Sleep infinitely as much as it is necessary.
            while (true)
            {
                Console.ReadLine();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            #if DEBUG
            Debugger.Launch();
            #endif

            // Find Assemblies Manually if necessary (Deprecate app.config)
            AppDomain.CurrentDomain.AssemblyResolve += AssemblyFinder.CurrentDomain_AssemblyResolve;

            /* - Initialization - */
            IgnoreSquirrel();
            ParseArguments(args);

            LoaderConsole.Initialize();
            SetuplibReloadedBindings();
            Banner.Execute();
            Controllers.PrintControllerOrder();
            DllUnlocker.UnblockDlls();          // Removes Zone Information which may prevent DLL injection if DLL was downloaded from e.g. Internet Explorer
            LoaderServer.SetupServer();

            /* - Boot up Reloaded Assembler, Get the Game Process running/attached and with mods running. - */
            Assembler.Assemble(new string[] { "use32", "nop eax" }); // Startup Assembler (So a running instance/open handle does not bother devs working on mods)
            GetGameProcess(args);
            InjectMods(args);

            // Resume game after injection if we are NOT in attach mode.
            if (_attachTargetName == null)
            {
                _gameProcess.ResumeAllThreads();
            }

            // Stay alive in the background
            AppDomain.CurrentDomain.ProcessExit += Shutdown;
            Console.CancelKeyPress += Shutdown;

            // Wait infinitely.
            while (true)
            {
                Console.ReadLine();
            }
        }