From f86885ec3911bacc2d540eb3d61e599c9f51bf53 Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Mon, 5 Sep 2022 10:18:53 +0900 Subject: [PATCH 1/3] actually make --veh-full work --- DalamudCrashHandler/DalamudCrashHandler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DalamudCrashHandler/DalamudCrashHandler.cpp b/DalamudCrashHandler/DalamudCrashHandler.cpp index e6ca46fe6..5894baf3c 100644 --- a/DalamudCrashHandler/DalamudCrashHandler.cpp +++ b/DalamudCrashHandler/DalamudCrashHandler.cpp @@ -432,6 +432,7 @@ int main() { HANDLE hPipeRead = nullptr; std::filesystem::path assetDir, logDir; std::optional> launcherArgs; + auto fullDump = false; std::vector args; if (int argc = 0; const auto argv = CommandLineToArgvW(GetCommandLineW(), &argc)) { @@ -451,6 +452,8 @@ int main() { assetDir = arg.substr(ARRAYSIZE(pwszArgPrefix) - 1); } else if (constexpr wchar_t pwszArgPrefix[] = L"--log-directory="; arg.starts_with(pwszArgPrefix)) { logDir = arg.substr(ARRAYSIZE(pwszArgPrefix) - 1); + } else if (arg == L"--veh-full") { + fullDump = true; } else if (arg == L"--") { launcherArgs.emplace(); } else { @@ -544,7 +547,7 @@ int main() { } std::unique_ptr, decltype(&CloseHandle)> hDumpFilePtr(hDumpFile, &CloseHandle); - if (!MiniDumpWriteDump(g_hProcess, dwProcessId, hDumpFile, static_cast(MiniDumpWithDataSegs | MiniDumpWithModuleHeaders), &mdmp_info, nullptr, nullptr)) { + if (!MiniDumpWriteDump(g_hProcess, dwProcessId, hDumpFile, fullDump ? MiniDumpWithFullMemory : static_cast(MiniDumpWithDataSegs | MiniDumpWithModuleHeaders), &mdmp_info, nullptr, nullptr)) { std::wcerr << (dumpError = std::format(L"MiniDumpWriteDump(0x{:x}, {}, 0x{:x}({}), MiniDumpWithFullMemory, ..., nullptr, nullptr) error: 0x{:x}", reinterpret_cast(g_hProcess), dwProcessId, reinterpret_cast(hDumpFile), dumpPath.wstring(), GetLastError())) << std::endl; break; } From b666be53f9a3eb50d50f223b9c59a4380f501398 Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Mon, 5 Sep 2022 10:20:10 +0900 Subject: [PATCH 2/3] do not call BuildLookupTable if for whatever reason a font has no glyphs --- Dalamud/Interface/GameFonts/GameFontManager.cs | 2 +- Dalamud/Interface/ImGuiHelpers.cs | 2 +- Dalamud/Interface/Internal/InterfaceManager.cs | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Dalamud/Interface/GameFonts/GameFontManager.cs b/Dalamud/Interface/GameFonts/GameFontManager.cs index af71fe67f..efa390e46 100644 --- a/Dalamud/Interface/GameFonts/GameFontManager.cs +++ b/Dalamud/Interface/GameFonts/GameFontManager.cs @@ -163,7 +163,7 @@ namespace Dalamud.Interface.GameFonts font->FrequentKerningPairs.Ref(i) /= fontScale; } - if (rebuildLookupTable) + if (rebuildLookupTable && fontPtr.Glyphs.Size > 0) fontPtr.BuildLookupTable(); } diff --git a/Dalamud/Interface/ImGuiHelpers.cs b/Dalamud/Interface/ImGuiHelpers.cs index 0ae672253..ec2236695 100644 --- a/Dalamud/Interface/ImGuiHelpers.cs +++ b/Dalamud/Interface/ImGuiHelpers.cs @@ -220,7 +220,7 @@ namespace Dalamud.Interface } } - if (rebuildLookupTable) + if (rebuildLookupTable && target.Value!.Glyphs.Size > 0) target.Value!.BuildLookupTable(); } diff --git a/Dalamud/Interface/Internal/InterfaceManager.cs b/Dalamud/Interface/Internal/InterfaceManager.cs index b1f25db9b..53bcfcf3d 100644 --- a/Dalamud/Interface/Internal/InterfaceManager.cs +++ b/Dalamud/Interface/Internal/InterfaceManager.cs @@ -816,7 +816,7 @@ namespace Dalamud.Interface.Internal for (int i = 0, i_ = ioFonts.ConfigData.Size; i < i_; i++) { var config = ioFonts.ConfigData[i]; - config.RasterizerGamma = config.RasterizerGamma * fontGamma; + config.RasterizerGamma *= fontGamma; } Log.Verbose("[FONT] ImGui.IO.Build will be called."); @@ -876,7 +876,15 @@ namespace Dalamud.Interface.Internal for (int i = 0, i_ = ioFonts.Fonts.Size; i < i_; i++) { var font = ioFonts.Fonts[i]; - font.FallbackChar = Fallback1Codepoint; + if (font.Glyphs.Size == 0) + { + Log.Warning("[FONT] Font has no glyph: {0}", font.GetDebugName()); + continue; + } + + if (font.FindGlyphNoFallback(Fallback1Codepoint).NativePtr != null) + font.FallbackChar = Fallback1Codepoint; + font.BuildLookupTable(); } From e82d95da924ea1080dc9a19b3812ab03fcbb83bc Mon Sep 17 00:00:00 2001 From: Soreepeong Date: Mon, 5 Sep 2022 10:24:31 +0900 Subject: [PATCH 3/3] make --veh-full actually do something --- DalamudCrashHandler/DalamudCrashHandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/DalamudCrashHandler/DalamudCrashHandler.cpp b/DalamudCrashHandler/DalamudCrashHandler.cpp index 5894baf3c..7cb045806 100644 --- a/DalamudCrashHandler/DalamudCrashHandler.cpp +++ b/DalamudCrashHandler/DalamudCrashHandler.cpp @@ -444,6 +444,9 @@ int main() { const auto arg = std::wstring_view(args[i]); if (launcherArgs) { launcherArgs->emplace_back(arg); + if (arg == L"--veh-full") { + fullDump = true; + } } else if (constexpr wchar_t pwszArgPrefix[] = L"--process-handle="; arg.starts_with(pwszArgPrefix)) { g_hProcess = reinterpret_cast(std::wcstoull(&arg[ARRAYSIZE(pwszArgPrefix) - 1], nullptr, 0)); } else if (constexpr wchar_t pwszArgPrefix[] = L"--exception-info-pipe-read-handle="; arg.starts_with(pwszArgPrefix)) { @@ -452,8 +455,6 @@ int main() { assetDir = arg.substr(ARRAYSIZE(pwszArgPrefix) - 1); } else if (constexpr wchar_t pwszArgPrefix[] = L"--log-directory="; arg.starts_with(pwszArgPrefix)) { logDir = arg.substr(ARRAYSIZE(pwszArgPrefix) - 1); - } else if (arg == L"--veh-full") { - fullDump = true; } else if (arg == L"--") { launcherArgs.emplace(); } else {