Beispiel #1
0
 /// <summary>
 /// Sets up the print function shorthands.
 /// </summary>
 private static void SetuplibReloadedBindings()
 {
     Bindings.PrintError   += delegate(string message) { LoaderConsole.PrintFormattedMessage(message, LoaderConsole.PrintErrorMessage); };
     Bindings.PrintWarning += delegate(string message) { LoaderConsole.PrintFormattedMessage(message, LoaderConsole.PrintWarningMessage); };
     Bindings.PrintInfo    += delegate(string message) { LoaderConsole.PrintFormattedMessage(message, LoaderConsole.PrintInfoMessage); };
     Bindings.PrintText    += delegate(string message) { LoaderConsole.PrintFormattedMessage(message, LoaderConsole.PrintMessage); };
 }
Beispiel #2
0
        /// <summary>
        /// Retrieves the game instance we are going to be hacking as a ReloadedProcess
        /// </summary>
        private static void GetGameProcess(string[] originalArguments)
        {
            // Fast return if soft reboot (game process killed and restarted itself)
            if (_gameProcess != null)
            {
                return;
            }

            // Attach if specified by the user.
            if (_attachTargetName != null)
            {
                // Grab current already running game.
                _gameProcess = ReloadedProcess.GetProcessByName(_attachTargetName);

                // Check if gameProcess successfully returned.
                if (_gameProcess == null && !_autoAttach)
                {
                    LoaderConsole.PrintFormattedMessage("Error: An active running game instance was not found.", LoaderConsole.PrintErrorMessage);
                    Console.ReadLine();
                    Shutdown(null, null);
                }

                // Wait for new process with autoattach if not found.
                if (_autoAttach && _gameProcess == null)
                {
                    Bindings.PrintWarning("Process not running. Waiting in Auto-Attach Mode.");
                    do
                    {
                        _gameProcess = ReloadedProcess.GetProcessByName(_attachTargetName); Thread.Sleep(2);
                    }while (_gameProcess == null);
                }
            }

            // Otherwise start process suspended in Reloaded, hook it, exploit it and resume the intended way.
            else
            {
                _gameProcess = new ReloadedProcess($"{Path.Combine(_gameConfig.GameDirectory, _gameConfig.ExecutableLocation)}", _gameConfig.CommandLineArgs.Split(' '));

                // The process handle is 0 if the process failed to initialize.
                if ((int)_gameProcess.ProcessHandle == 0)
                {
                    // libReloaded will already print the error message.
                    Console.ReadLine();
                    Shutdown(null, null);
                }

                // Check if the game should run normally to toggle the shim.
                CheckSteamHack(originalArguments);
            }

            // Set binding for target process for memory IO
            Bindings.TargetProcess = _gameProcess;

            // Obtain the process start time.
            if (_gameProcess != null)
            {
                _processStartTime = _gameProcess.GetProcessFromReloadedProcess().StartTime;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Removes Zone Information from dynamic link libraries downloaded from the internet such
        /// that certain users of Microsoft Windows would not be denied loading of our own arbitrary code.
        /// </summary>
        /// <remarks>
        /// Only affects files downloaded via very specific certain outdated programs such as
        /// Internet Explorer
        /// </remarks>
        public static void UnblockDlls()
        {
            // Print Info Message about Unlocking DLLs
            LoaderConsole.PrintFormattedMessage("Removing Zone Identifiers from Files (DLL Unlocking)", LoaderConsole.PrintInfoMessage);

            // Search all DLLs under loader directories.
            // Normally I'd restrict this to mod directories, but the loader's own libraries might also be worth checking.
            string[] dllFiles = Directory.GetFiles(LoaderPaths.GetModLoaderDirectory(), "*.dll", SearchOption.AllDirectories);

            // Unblock new file.
            foreach (string dllFile in dllFiles)
            {
                FileUnblocker.Unblock(dllFile);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Displays a warning about how to use the mod loader.
        /// </summary>
        public static void DisplayWarning()
        {
            // Print
            LoaderConsole.PrintFormattedMessage("No game to launch has been specified.", LoaderConsole.PrintErrorMessage);
            LoaderConsole.PrintInfoMessage
            (
                "\nCommand Line Reloaded Mod Loader Usage Instructions:\n" +
                "Reloaded-Loader.exe <Arguments>\n\n" +

                "Arguments List:\n" +
                $"{Strings.Common.LoaderSettingConfig} <GAME_CONFIGURATION_PATH> | Specifies the game configuration to run.\n" +
                $"{Strings.Common.LoaderSettingAttach} <EXECUTABLE_NAME> | Attaches to an already running game/executable.\n\n" +
                $"{Strings.Common.LoaderSettingSteamShim} | If this is set to true; the loader will not reattach.\n\n" +
                $"{Strings.Common.LoaderSettingAutoAttach} | Waits until the game executable spawns then attaches to it. This is a flag you specify WITH {Strings.Common.LoaderSettingAttach}\n\n" +

                "Examples:\n" +
                $"Reloaded-Loader.exe {Strings.Common.LoaderSettingConfig} D:/Reloaded/Reloaded-Config/Games/Sonic-Heroes\n" +
                $"Reloaded-Loader.exe {Strings.Common.LoaderSettingConfig} D:/Reloaded/Reloaded-Config/Games/Sonic-Heroes {Strings.Common.LoaderSettingAttach} Tsonic_win_custom.exe\n\n"
            );
            Console.ReadLine();
            Environment.Exit(0);
        }