6 Commits

Author SHA1 Message Date
201f54ae36 Formatting 2024-04-16 01:28:29 +07:00
3c2609798b Add option to enable/disable hook 2024-04-16 01:27:48 +07:00
c895c275cf CRLF -> LF 2024-04-15 20:34:30 +07:00
1eceba427e re-enable LTO
it has weird build issues on my machine, so I turned it off.
2024-04-15 20:27:45 +07:00
ecfc104f0f Migrate cm/mai2/mu3 to unityhook 2024-04-15 20:27:04 +07:00
49f7189d35 unityhook: managing VFS redirection and loading assemblies 2024-04-15 20:26:25 +07:00

View File

@ -66,22 +66,21 @@ void doorstop_invoke(void* domain) {
if (mono_domain_set_config) { if (mono_domain_set_config) {
#define CONFIG_EXT L".config" #define CONFIG_EXT L".config"
wchar_t config_path[MAX_PATH]; wchar_t exe_path[MAX_PATH];
size_t config_path_len = GetModuleFileNameW(NULL, config_path, MAX_PATH); size_t exe_path_len = GetModuleFileNameW(NULL, exe_path, MAX_PATH);
wchar_t *folder_name = wcsdup(config_path); wchar_t *folder_name = wcsdup(exe_path);
PathCchRemoveFileSpec(folder_name, config_path_len + 1); PathCchRemoveFileSpec(folder_name, exe_path_len + 1);
wmemcpy(config_path + config_path_len, CONFIG_EXT, sizeof(CONFIG_EXT) / sizeof(CONFIG_EXT[0]));
char *config_path_n = narrow(config_path); char *exe_path_n = narrow(exe_path);
char *folder_name_n = narrow(folder_name); char *folder_name_n = narrow(folder_name);
dprintf("Unity: Setting config paths: base dir: %s; config path: %s\n", folder_name_n, config_path_n); dprintf("Unity: Setting config paths: base dir: %s; config path: %s\n", folder_name_n, exe_path_n);
mono_domain_set_config(domain, folder_name_n, config_path_n); mono_domain_set_config(domain, folder_name_n, exe_path_n);
free(folder_name); free(folder_name);
free(config_path_n); free(exe_path_n);
free(folder_name_n); free(folder_name_n);
#undef CONFIG_EXT #undef CONFIG_EXT