mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #997 from Soreepeong/fix/empty-fonts
Prevent BuildLookupTable crash
This commit is contained in:
commit
d7a4eed13e
4 changed files with 17 additions and 5 deletions
|
|
@ -163,7 +163,7 @@ namespace Dalamud.Interface.GameFonts
|
|||
font->FrequentKerningPairs.Ref<float>(i) /= fontScale;
|
||||
}
|
||||
|
||||
if (rebuildLookupTable)
|
||||
if (rebuildLookupTable && fontPtr.Glyphs.Size > 0)
|
||||
fontPtr.BuildLookupTable();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ namespace Dalamud.Interface
|
|||
}
|
||||
}
|
||||
|
||||
if (rebuildLookupTable)
|
||||
if (rebuildLookupTable && target.Value!.Glyphs.Size > 0)
|
||||
target.Value!.BuildLookupTable();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -432,6 +432,7 @@ int main() {
|
|||
HANDLE hPipeRead = nullptr;
|
||||
std::filesystem::path assetDir, logDir;
|
||||
std::optional<std::vector<std::wstring>> launcherArgs;
|
||||
auto fullDump = false;
|
||||
|
||||
std::vector<std::wstring> args;
|
||||
if (int argc = 0; const auto argv = CommandLineToArgvW(GetCommandLineW(), &argc)) {
|
||||
|
|
@ -443,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<HANDLE>(std::wcstoull(&arg[ARRAYSIZE(pwszArgPrefix) - 1], nullptr, 0));
|
||||
} else if (constexpr wchar_t pwszArgPrefix[] = L"--exception-info-pipe-read-handle="; arg.starts_with(pwszArgPrefix)) {
|
||||
|
|
@ -544,7 +548,7 @@ int main() {
|
|||
}
|
||||
|
||||
std::unique_ptr<std::remove_pointer_t<HANDLE>, decltype(&CloseHandle)> hDumpFilePtr(hDumpFile, &CloseHandle);
|
||||
if (!MiniDumpWriteDump(g_hProcess, dwProcessId, hDumpFile, static_cast<MINIDUMP_TYPE>(MiniDumpWithDataSegs | MiniDumpWithModuleHeaders), &mdmp_info, nullptr, nullptr)) {
|
||||
if (!MiniDumpWriteDump(g_hProcess, dwProcessId, hDumpFile, fullDump ? MiniDumpWithFullMemory : static_cast<MINIDUMP_TYPE>(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<size_t>(g_hProcess), dwProcessId, reinterpret_cast<size_t>(hDumpFile), dumpPath.wstring(), GetLastError())) << std::endl;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue