102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
launcher.c File Reference
#include <dttr_config.h>
#include <dttr_crashdump.h>
#include <dttr_errors.h>
#include <dttr_imgui.h>
#include <dttr_loader.h>
#include <dttr_loader_ui.h>
#include <dttr_log.h>
#include <dttr_path.h>
#include <sds.h>
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <gen/packed_sdb.h>

Go to the source code of this file.

Enumerations

enum  { PATH_ENV_BUFFER_SIZE = 1u << 15 }

Functions

static bool set_env (const char *name, const char *value)
static bool resolve_modules_dir (char *out, size_t out_size)
static bool resolve_loader_dir (char *out, size_t out_size)
static void resolve_config_path (int argc, char *argv[])
static FILE * open_log_file (int log_level)
static bool terminate_child (PROCESS_INFORMATION *child_info, DWORD exit_code)
static void close_child_handles (PROCESS_INFORMATION *child_info)
static void prepend_modules_to_path ()
int dttr_launcher_main (int argc, char *argv[])

Variables

static const char *const MODULES_DIR_NAME = "modules"
static char config_path_buf [MAX_PATH]
const char * dttr_config_path = DTTR_CONFIG_FILENAME

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PATH_ENV_BUFFER_SIZE 

Definition at line 18 of file launcher.c.

Function Documentation

◆ close_child_handles()

void close_child_handles ( PROCESS_INFORMATION * child_info)
static

Definition at line 110 of file launcher.c.

Referenced by dttr_launcher_main().

◆ dttr_launcher_main()

◆ open_log_file()

FILE * open_log_file ( int log_level)
static

◆ prepend_modules_to_path()

void prepend_modules_to_path ( )
static

◆ resolve_config_path()

void resolve_config_path ( int argc,
char * argv[] )
static

◆ resolve_loader_dir()

bool resolve_loader_dir ( char * out,
size_t out_size )
static

Definition at line 39 of file launcher.c.

References DTTR_Path_CopySds(), DTTR_Path_ModuleDir(), and NULL.

Referenced by dttr_launcher_main(), and open_log_file().

◆ resolve_modules_dir()

bool resolve_modules_dir ( char * out,
size_t out_size )
static

Definition at line 32 of file launcher.c.

References DTTR_Path_CopySds(), DTTR_Path_ModuleSibling(), MODULES_DIR_NAME, and NULL.

Referenced by prepend_modules_to_path().

◆ set_env()

bool set_env ( const char * name,
const char * value )
static

Definition at line 23 of file launcher.c.

References DTTR_LOG_ERROR.

Referenced by dttr_launcher_main(), and prepend_modules_to_path().

◆ terminate_child()

bool terminate_child ( PROCESS_INFORMATION * child_info,
DWORD exit_code )
static

Definition at line 89 of file launcher.c.

References DTTR_LOG_ERROR, and DWORD.

Referenced by dttr_launcher_main().

Variable Documentation

◆ config_path_buf

char config_path_buf[MAX_PATH]
static

Definition at line 20 of file launcher.c.

Referenced by resolve_config_path().

◆ dttr_config_path

const char* dttr_config_path = DTTR_CONFIG_FILENAME

Definition at line 21 of file launcher.c.

Referenced by dttr_launcher_main(), resolve_config_path(), and save_selected_path().

◆ MODULES_DIR_NAME

const char* const MODULES_DIR_NAME = "modules"
static

Definition at line 16 of file launcher.c.

Referenced by resolve_modules_dir().