In this tutorial, we will provide you with code snippets that will allow you to call the patch executable from code or certain game development engines.
You should always test and check your code before releasing. These are boilerplate example snippets that you should use as a ‘base’ for your game. You may need to modify or adapt it to cater for your specific game setup.
Note: You need to replace the API and License Keys with your own keys which can be found in your Dashboard.
Game Launcher Creator V3 (Custom Launcher)
To launch lboost.exe with the specified command line arguments from within Game Launcher Creator V3, you can simply use the Action ‘Launch a Local File’ and then type in the filename followed by the API Key and License Key arguments. Your setup should look like this.
Click the image to see a bigger version.
Unity (C#)
To launch lboost.exe with specific command line arguments from within a Unity application using C#, you can employ the System.Diagnostics.Process class. This approach involves creating a method that your Unity application can call, which in turn constructs and executes the lboost.exe process with the provided API key and license key as arguments.
Here’s a breakdown of the steps, followed by a C# script example:
- Method Definition: Define a method, say LaunchLboost, which takes two parameters: apiKey and licenseKey.
- Process Setup: Utilize System.Diagnostics.ProcessStartInfo to set up the lboost.exe process. This includes specifying the executable’s path and constructing the command line arguments string with the provided apiKey and licenseKey.
- Starting the Process: Use System.Diagnostics.Process to start the process based on the setup provided by ProcessStartInfo.
- Error Handling: Include error handling to manage scenarios where launching the process might fail, e.g., if lboost.exe is not found.
Here’s an illustrative C# script:
using System.Diagnostics; using UnityEngine; public class LboostLauncher : MonoBehaviour { // Method to launch lboost.exe with the provided API and license keys public void LaunchLboost(string apiKey, string licenseKey) { // Construct the command line arguments string string args = $"-A{apiKey} -L{licenseKey}"; // Setup the process start information ProcessStartInfo startInfo = new ProcessStartInfo { FileName = "lboost.exe", // Ensure this path is correct Arguments = args, UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true }; // Try to start the process try { using (Process process = Process.Start(startInfo)) { // Read the output (if any) string output = process.StandardOutput.ReadToEnd(); string error = process.StandardError.ReadToEnd(); process.WaitForExit(); // Wait for the process to exit if (!string.IsNullOrEmpty(output)) { Debug.Log($"lboost Output: {output}"); } if (!string.IsNullOrEmpty(error)) { Debug.LogError($"lboost Error: {error}"); } } } catch (System.Exception e) { // Handle exceptions (e.g., lboost.exe not found) Debug.LogError($"Failed to launch lboost.exe: {e.Message}"); } } }
This will launch lboost.exe (the patching executable) provided it is in the same location as your game executable, with the command line arguments.
Unreal Engine (C++)
In Unreal Engine, you can achieve a similar functionality by utilizing the FPlatformProcess class to create and manage external processes. Here’s how you can encapsulate the logic to launch lboost.exe with command line arguments within an Unreal Engine C++ class:
- Include Headers: Ensure you include the necessary headers for process management and logging.
- Define a Method: Create a method, say LaunchLboost, that takes two FString parameters for the API key and the license key.
- Launch the Process: Use FPlatformProcess::CreateProc to start lboost.exe with the provided arguments.
- Check Process Launch Success: Verify if the process was started successfully and log the result.
Below is a sample C++ code snippet that demonstrates this process in an Unreal Engine context:
#include "Misc/Paths.h" #include "Misc/FeedbackContext.h" #include "HAL/PlatformProcess.h" class FLboostLauncher { public: // Method to launch lboost.exe with API and License keys static void LaunchLboost(const FString& ApiKey, const FString& LicenseKey) { // Construct the command line arguments FString CmdArgs = FString::Printf(TEXT("-A%s -L%s"), *ApiKey, *LicenseKey); // Specify the path to lboost.exe - adjust the path as necessary FString ExecutablePath = FPaths::Combine(FPaths::ProjectDir(), TEXT("lboost.exe")); // Launch the process FProcHandle ProcHandle = FPlatformProcess::CreateProc(*ExecutablePath, *CmdArgs, true, false, false, nullptr, 0, nullptr, nullptr); if (ProcHandle.IsValid()) { GLog->Log("lboost.exe launched successfully."); // Optionally, you can wait for the process to finish and capture the return code // FPlatformProcess::WaitForProc(ProcHandle); // int32 ReturnCode; // FPlatformProcess::GetProcReturnCode(ProcHandle, &ReturnCode); } else { GLog->Log("Failed to launch lboost.exe."); } } };
This will launch lboost.exe (the patching executable) provided it is in the same location as your game executable, with the command line arguments.
Java
In Java, you can launch an external application like lboost.exe with command-line arguments using the ProcessBuilder class. This class provides a more convenient way to manage system processes compared to using Runtime.getRuntime().exec().
Here’s a step-by-step guide followed by an example code snippet:
- Import Classes: Import the necessary Java classes for handling processes and I/O.
- Define a Method: Create a method, e.g., launchLboost, that takes two String parameters for the API key and the license key.
- Configure ProcessBuilder: Instantiate a ProcessBuilder with the command and its arguments. Set the working directory if needed.
- Start the Process: Start the process and obtain a Process instance.
- Handle I/O Streams: Optionally, read the process’s output and error streams to handle its output and errors.
- Wait for Completion: Wait for the process to complete and check the exit value.
Here’s an illustrative Java class demonstrating these steps
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class LboostLauncher { public static void launchLboost(String apiKey, String licenseKey) { // Command and arguments String command = "lboost.exe"; // Adjust the path to your lboost.exe String args = String.format("-A%s -L%s", apiKey, licenseKey); try { ProcessBuilder builder = new ProcessBuilder(command, args.split(" ")); builder.redirectErrorStream(true); // Redirect error stream to the output stream // Start the process Process process = builder.start(); // Read the output of the process try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { String line; while ((line = reader.readLine()) != null) { System.out.println(line); // Print the process output } } // Wait for the process to terminate and check the exit value int exitCode = process.waitFor(); System.out.println("lboost exited with code: " + exitCode); } catch (IOException | InterruptedException e) { e.printStackTrace(); // Handle exceptions } } public static void main(String[] args) { // Example usage launchLboost("A58gfdfdfdeeree473d7bff3d9707c62c66595a1", "82938-392392-2938394"); } }
Remember to replace the apiKe and licenseKey with your own keys.
GameMaker (GML)
In GameMaker Language (GML), launching an external executable like lboost.exe with specific command-line arguments can be achieved using the shell_execute or game_save function. This allows your GameMaker application to interact with external applications or scripts.
Here’s how you can use shell_execute to launch lboost.exe with the two required command-line arguments:
- Prepare lboost.exe: Ensure lboost.exe is placed in an accessible location relative to your GameMaker project. If it’s in the same directory as your compiled game, you can refer to it directly by name. Otherwise, provide a relative or absolute path.
- Use shell_execute in a Script or Event: You can call shell_execute from any event or script where you need to launch lboost.exe. Commonly, this might be tied to a button press or another game event.
- Construct Command-Line Arguments: Combine your API key and license key into a single string with the appropriate flags (-A and -L).
Here is some example code:
// Command and path to lboost.exe var exePath = "lboost.exe"; // Adjust this path as needed // Command-line arguments var apiKey = "A58gfdfdfdeeree473d7bff3d9707c62c66595a1"; var licenseKey = "82938-392392-2938394"; var arguments = "-A" + apiKey + " -L" + licenseKey; // Launch lboost.exe with arguments shell_execute(exePath, arguments, "", "", 1);
Godot (GDscript)
In Godot Engine, you can launch an external executable like lboost.exe with command-line arguments using the OS.execute method. This method allows you to run a process, optionally wait for it to complete, and capture its output.
Here’s a step-by-step guide on how to do this:
- Access the OS Shell: Use Godot’s OS singleton to access system-level operations such as executing a file.
- Prepare the Command and Arguments: The OS.execute method requires the path to the executable, the arguments as an array, and an option to wait for the process to finish.
- Execute the Command: Call OS.execute with the path to lboost.exe, passing in the API key and license key as arguments.
func launch_lboost(api_key: String, license_key: String) -> void: var executable_path: String = "lboost.exe" # Update this to the correct path var arguments: PoolStringArray = ["-A" + api_key, "-L" + license_key] # Execute the command without waiting for it to complete # stdout will contain the output if wait is true, and exit_code will hold the process's exit code var output: Array = [] var exit_code: int = OS.execute(executable_path, arguments, false, output) # Optional: Check the exit code and handle output if exit_code == 0: print("lboost executed successfully") else: print("lboost failed to execute, exit code: ", exit_code) # If you captured output by setting wait to true, you can process it here # for line in output: # print(line)
- Replace “path/to/lboost.exe” with the actual path to your lboost.exe file.
- The launch_lboost function takes two parameters: api_key and license_key, which are your command-line arguments.
- The OS.execute method is called with the path to the executable, the arguments array, and a boolean indicating whether to wait for the process to complete. In this example, it’s set to false to not wait, but if you set it to true, you can also capture the process’s output in the output array.
- After execution, you can check the exit_code to see if the process completed successfully (exit_code is 0) or if there was an error.
You should double-check all your code is working before releasing.
LUA
In Lua, launching an external executable like lboost.exe with command-line arguments can be achieved using the os.execute function. This function allows you to run commands in the underlying operating system’s shell. Here’s how you can use it to launch lboost.exe with the required arguments:
function launchLboost(apiKey, licenseKey) -- Construct the command with arguments local command = "lboost.exe -A" .. apiKey .. " -L" .. licenseKey -- Execute the command local success, exitType, exitCode = os.execute(command) -- Check if the command was executed successfully if success and exitType == "exit" and exitCode == 0 then print("lboost executed successfully") else print("Failed to execute lboost. Exit code:", exitCode) end end -- Example usage launchLboost("A58gfdfdfdeeree473d7bff3d9707c62c66595a1", "82938-392392-2938394")
- The launchLboost function is defined to take two parameters, apiKey and licenseKey, which are the command-line arguments for lboost.exe.
- The command string is constructed using Lua’s string concatenation operator (..), including the executable name (lboost.exe) and the two arguments prefixed with -A and -L.
- The os.execute function runs the constructed command. It returns three values:
- success: A boolean indicating whether the command was successfully launched.
- exitType: A string describing how the process ended (e.g., “exit” or “signal”).
- exitCode: The exit code of the process. An exit code of 0 typically indicates success.
- The function checks these return values to determine if lboost.exe was executed successfully and prints the result.
Please note that the behavior of os.execute can vary between different Lua environments and operating systems. Ensure that the path to lboost.exe is correct and accessible from the environment where your Lua script is executed. If lboost.exe resides in a different directory, you might need to specify the full path to the executable in the command string.
Batch Script (Batch File)
To create a Batch script that launches lboost.exe with the required command-line arguments, you can follow these steps and use the code snippet provided below.
- Open Notepad or any text editor: This is where you’ll write your Batch script.
- Write the Batch Script: Enter the command to run lboost.exe with the -A and -L flags, followed by the respective values for the API key and the license key.
- Save the File: Save the file with a .bat extension, e.g., launch_lboost.bat. Make sure to select “All Files” in the “Save as type” dropdown if you’re using Notepad, to avoid saving it with a .txt extension by accident.
- Run the Batch File: Double-click the .bat file to execute the script, or run it from the command line.
Here is some example code.
@echo off REM Change the directory to where lboost.exe is located if necessary REM cd "path\to\lboost\directory" cd /d "%~dp0" REM Launch lboost.exe with the API and license keys lboost.exe -A"A58gfdfdfdeeree473d7bff3d9707c62c66595a1" -L"82938-392392-2938394" REM Pause the script to view any output before the window closes (optional) pause
This will launch lboost.exe if the batch file is in the same directory. If it isn’t, use the cd “path\to” section instead.
Python
To run lboost.exe with the required command-line arguments in Python, you can use the subprocess module, which allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes.
import subprocess def run_lboost(api_key, license_key): # Construct the command command = ["lboost.exe", f"-A{api_key}", f"-L{license_key}"] # Run the command try: result = subprocess.run(command, check=True, capture_output=True, text=True) print(f"lboost executed successfully:\n{result.stdout}") except subprocess.CalledProcessError as e: print(f"An error occurred while executing lboost:\n{e.stderr}") # Example usage run_lboost("A58gfdfdfdeeree473d7bff3d9707c62c66595a1", "82938-392392-2938394")
- The run_lboost function is defined to take two parameters, api_key and license_key, which are the command-line arguments for lboost.exe.
- The command list contains the path to lboost.exe followed by the two arguments. Replace “path/to/lboost.exe” with the actual path to your lboost.exe file. If lboost.exe is in the same directory as your Python script and you have added that directory to your system’s PATH environment variable, you can just use “lboost.exe”.
- The subprocess.run() function executes the command. The check=True parameter causes an exception to be raised if lboost.exe exits with a non-zero status (indicating an error). The capture_output=True parameter captures the standard output and standard error of the command, and text=True ensures that the output is captured as a string rather than bytes.
- If the command is executed successfully, its standard output is printed. If an error occurs, the error message is printed instead.
Remember to test your code before release.
Visual Basic (VB.NET)
To run lboost.exe with the required command-line arguments in Visual Basic (using VB.NET), you can utilize the Process.Start method from the System.Diagnostics namespace. This approach allows you to start a new process, such as an executable file, and pass in arguments as needed.
Imports System.IO Imports System.Reflection Imports System.Diagnostics Module Module1 Sub Main() ' Get the current directory of the executing assembly Dim currentDirectory As String = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ' Construct the full path to lboost.exe assuming it's in the same directory as the application Dim exePath As String = Path.Combine(currentDirectory, "lboost.exe") Dim apiKey As String = "A58gfdfdfdeeree473d7bff3d9707c62c66595a1" Dim licenseKey As String = "82938-392392-2938394" Dim arguments As String = $"-A{apiKey} -L{licenseKey}" Try ' Start the process with the given arguments Using process As Process = Process.Start(exePath, arguments) Console.WriteLine("lboost.exe launched successfully.") process.WaitForExit() ' Wait for the process to exit if needed Console.WriteLine($"lboost.exe exited with code {process.ExitCode}.") End Using Catch ex As Exception ' Handle any errors that might occur Console.WriteLine($"An error occurred: {ex.Message}") End Try End Sub End Module
Remember, always test your code before release.