Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using Server GC #1716

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dalamud.Boot/DalamudStartInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ void from_json(const nlohmann::json& json, DalamudStartInfo& config) {
config.BootVehEnabled = json.value("BootVehEnabled", config.BootVehEnabled);
config.BootVehFull = json.value("BootVehFull", config.BootVehFull);
config.BootEnableEtw = json.value("BootEnableEtw", config.BootEnableEtw);
config.BootEnableGcServer = json.value("BootEnableGcServer", config.BootEnableGcServer);
config.BootDotnetOpenProcessHookMode = json.value("BootDotnetOpenProcessHookMode", config.BootDotnetOpenProcessHookMode);
if (const auto it = json.find("BootEnabledGameFixes"); it != json.end() && it->is_array()) {
config.BootEnabledGameFixes.clear();
Expand All @@ -133,6 +134,7 @@ void DalamudStartInfo::from_envvars() {
BootVehEnabled = utils::get_env<bool>(L"DALAMUD_IS_VEH");
BootVehFull = utils::get_env<bool>(L"DALAMUD_IS_VEH_FULL");
BootEnableEtw = utils::get_env<bool>(L"DALAMUD_ENABLE_ETW");
BootEnableGcServer = utils::get_env<bool>(L"DALAMUD_ENABLE_GCSERVER");
BootDotnetOpenProcessHookMode = static_cast<DotNetOpenProcessHookMode>(utils::get_env<int>(L"DALAMUD_DOTNET_OPENPROCESS_HOOKMODE"));
for (const auto& item : utils::get_env_list<std::string>(L"DALAMUD_GAMEFIX_LIST"))
BootEnabledGameFixes.insert(unicode::convert<std::string>(item, &unicode::lower));
Expand Down
1 change: 1 addition & 0 deletions Dalamud.Boot/DalamudStartInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct DalamudStartInfo {
bool BootVehEnabled = false;
bool BootVehFull = false;
bool BootEnableEtw = false;
bool BootEnableGcServer = false;
DotNetOpenProcessHookMode BootDotnetOpenProcessHookMode = DotNetOpenProcessHookMode::ImportHooks;
std::set<std::string> BootEnabledGameFixes{};
std::set<std::string> BootUnhookDlls{};
Expand Down
1 change: 1 addition & 0 deletions Dalamud.Boot/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ HRESULT WINAPI InitializeImpl(LPVOID lpParam, HANDLE hMainThreadContinue) {
const auto result = InitializeClrAndGetEntryPoint(
g_hModule,
g_startInfo.BootEnableEtw,
g_startInfo.BootEnableGcServer,
runtimeconfig_path,
module_path,
L"Dalamud.EntryPoint, Dalamud",
Expand Down
5 changes: 5 additions & 0 deletions Dalamud.Common/DalamudStartInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ public DalamudStartInfo()
/// </summary>
public bool BootEnableEtw { get; set; }

/// <summary>
/// Gets or sets a value indicating whether or not GC Server should be enabled.
/// </summary>
public bool BootEnableGcServer { get; set; }

/// <summary>
/// Gets or sets a value choosing the OpenProcess hookmode.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Dalamud.Injector.Boot/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ int wmain(int argc, wchar_t** argv)
const auto result = InitializeClrAndGetEntryPoint(
GetModuleHandleW(nullptr),
false,
false,
runtimeconfig_path,
module_path,
L"Dalamud.Injector.EntryPoint, Dalamud.Injector",
Expand Down
1 change: 1 addition & 0 deletions Dalamud.Injector/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ private static DalamudStartInfo ExtractAndInitializeStartInfoFromArguments(Dalam
// Set boot defaults
startInfo.BootShowConsole = args.Contains("--console");
startInfo.BootEnableEtw = args.Contains("--etw");
startInfo.BootEnableGcServer = args.Contains("--gc-server");
startInfo.BootLogPath = GetLogPath(startInfo.LogPath, "dalamud.boot", startInfo.LogName);
startInfo.BootEnabledGameFixes = new()
{
Expand Down
2 changes: 2 additions & 0 deletions lib/CoreCLR/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ std::optional<CoreCLR> g_clr;
HRESULT InitializeClrAndGetEntryPoint(
void* calling_module,
bool enable_etw,
bool enable_gcServer,
std::wstring runtimeconfig_path,
std::wstring module_path,
std::wstring entrypoint_assembly_name,
Expand All @@ -55,6 +56,7 @@ HRESULT InitializeClrAndGetEntryPoint(
SetEnvironmentVariable(L"DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP3SUPPORT", L"0");

SetEnvironmentVariable(L"COMPlus_ETWEnabled", enable_etw ? L"1" : L"0");
SetEnvironmentVariable(L"DOTNET_gcServer", enable_gcServer ? L"1" : L"0");

wchar_t* dotnet_path;
wchar_t* _appdata;
Expand Down
1 change: 1 addition & 0 deletions lib/CoreCLR/boot.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ void ConsoleTeardown();
HRESULT InitializeClrAndGetEntryPoint(
void* calling_module,
bool enable_etw,
bool enable_gcServer,
std::wstring runtimeconfig_path,
std::wstring module_path,
std::wstring entrypoint_assembly_name,
Expand Down
Loading