mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-01-03 14:23:40 +01:00
Merge master
This commit is contained in:
commit
2951dc93ec
413 changed files with 36477 additions and 6572 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <cstdio>
|
||||
#include <filesystem>
|
||||
#include <Windows.h>
|
||||
#include <Lmcons.h>
|
||||
#include <Shlobj.h>
|
||||
#include "CoreCLR.h"
|
||||
#include "..\..\Dalamud.Boot\logging.h"
|
||||
|
|
@ -27,6 +28,64 @@ void ConsoleTeardown()
|
|||
|
||||
std::optional<CoreCLR> g_clr;
|
||||
|
||||
static wchar_t* GetRuntimePath()
|
||||
{
|
||||
int result;
|
||||
std::wstring buffer;
|
||||
wchar_t* runtime_path;
|
||||
wchar_t* _appdata;
|
||||
DWORD username_len = UNLEN + 1;
|
||||
wchar_t username[UNLEN + 1];
|
||||
|
||||
buffer.resize(0);
|
||||
result = GetEnvironmentVariableW(L"DALAMUD_RUNTIME", &buffer[0], 0);
|
||||
|
||||
if (result)
|
||||
{
|
||||
buffer.resize(result); // The first pass returns the required length
|
||||
result = GetEnvironmentVariableW(L"DALAMUD_RUNTIME", &buffer[0], result);
|
||||
return _wcsdup(buffer.c_str());
|
||||
}
|
||||
|
||||
// Detect Windows first
|
||||
result = SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_DEFAULT, nullptr, &_appdata);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
logging::E("Unable to get RoamingAppData path (err={})", result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::filesystem::path fs_app_data(_appdata);
|
||||
runtime_path = _wcsdup(fs_app_data.append("XIVLauncher").append("runtime").c_str());
|
||||
if (std::filesystem::exists(runtime_path))
|
||||
return runtime_path;
|
||||
free(runtime_path);
|
||||
|
||||
// Next XLCore on Linux
|
||||
result = GetUserNameW(username, &username_len);
|
||||
if (result != 0)
|
||||
{
|
||||
logging::E("Unable to get user name (err={})", result);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::filesystem::path homeDir = L"Z:\\home\\" + std::wstring(username);
|
||||
runtime_path = _wcsdup(homeDir.append(".xlcore").append("runtime").c_str());
|
||||
if (std::filesystem::exists(runtime_path))
|
||||
return runtime_path;
|
||||
free(runtime_path);
|
||||
|
||||
// Finally XOM
|
||||
homeDir = L"Z:\\Users\\" + std::wstring(username);
|
||||
runtime_path = _wcsdup(homeDir.append("Library").append("Application Suppor").append("XIV on Mac").append("runtime").c_str());
|
||||
if (std::filesystem::exists(runtime_path))
|
||||
return runtime_path;
|
||||
free(runtime_path);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HRESULT InitializeClrAndGetEntryPoint(
|
||||
void* calling_module,
|
||||
bool enable_etw,
|
||||
|
|
@ -41,8 +100,7 @@ HRESULT InitializeClrAndGetEntryPoint(
|
|||
|
||||
int result;
|
||||
SetEnvironmentVariable(L"DOTNET_MULTILEVEL_LOOKUP", L"0");
|
||||
SetEnvironmentVariable(L"COMPlus_legacyCorruptedStateExceptionsPolicy", L"1");
|
||||
SetEnvironmentVariable(L"DOTNET_legacyCorruptedStateExceptionsPolicy", L"1");
|
||||
|
||||
SetEnvironmentVariable(L"COMPLUS_ForceENC", L"1");
|
||||
SetEnvironmentVariable(L"DOTNET_ForceENC", L"1");
|
||||
|
||||
|
|
@ -56,31 +114,12 @@ HRESULT InitializeClrAndGetEntryPoint(
|
|||
|
||||
SetEnvironmentVariable(L"COMPlus_ETWEnabled", enable_etw ? L"1" : L"0");
|
||||
|
||||
wchar_t* dotnet_path;
|
||||
wchar_t* _appdata;
|
||||
wchar_t* dotnet_path = GetRuntimePath();
|
||||
|
||||
std::wstring buffer;
|
||||
buffer.resize(0);
|
||||
result = GetEnvironmentVariableW(L"DALAMUD_RUNTIME", &buffer[0], 0);
|
||||
|
||||
if (result)
|
||||
if (!dotnet_path || !std::filesystem::exists(dotnet_path))
|
||||
{
|
||||
buffer.resize(result); // The first pass returns the required length
|
||||
result = GetEnvironmentVariableW(L"DALAMUD_RUNTIME", &buffer[0], result);
|
||||
dotnet_path = _wcsdup(buffer.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
result = SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_DEFAULT, nullptr, &_appdata);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
logging::E("Unable to get RoamingAppData path (err={})", result);
|
||||
return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
|
||||
}
|
||||
|
||||
std::filesystem::path fs_app_data(_appdata);
|
||||
dotnet_path = _wcsdup(fs_app_data.append("XIVLauncher").append("runtime").c_str());
|
||||
logging::E("Error: Unable to find .NET runtime path");
|
||||
return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
|
||||
}
|
||||
|
||||
// =========================================================================== //
|
||||
|
|
@ -89,12 +128,6 @@ HRESULT InitializeClrAndGetEntryPoint(
|
|||
logging::I("with config_path: {}", runtimeconfig_path);
|
||||
logging::I("with module_path: {}", module_path);
|
||||
|
||||
if (!std::filesystem::exists(dotnet_path))
|
||||
{
|
||||
logging::E("Error: Unable to find .NET runtime path");
|
||||
return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND);
|
||||
}
|
||||
|
||||
get_hostfxr_parameters init_parameters
|
||||
{
|
||||
sizeof(get_hostfxr_parameters),
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 731e3ab0006ce56c4fe789aee148bc967965b914
|
||||
Subproject commit 9e7f03ed6d3d5cb9e6952f00c4779ac64427bc81
|
||||
1
lib/cimgui
Submodule
1
lib/cimgui
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 122ee16819437eea7eefe0c04398b44174106d86
|
||||
1
lib/cimguizmo
Submodule
1
lib/cimguizmo
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit dbad4fdb4d465e1f48d20c4c54a20925095297b0
|
||||
1
lib/cimplot
Submodule
1
lib/cimplot
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 939f8f36deebd895f6cda522ee4bb2b798920935
|
||||
Loading…
Add table
Add a link
Reference in a new issue