From 65cd753c6e1f20d0c3ec36986591c31d3fe3d227633a92d6199711ca09f108d5 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 23 Jun 2022 21:45:21 +0000 Subject: [PATCH] - Add 0001-Revert-load-the-hex-font-as-early-as-possible.patch OBS-URL: https://build.opensuse.org/package/show/games/gzdoom?expand=0&rev=69 --- ...ad-the-hex-font-as-early-as-possible.patch | 128 ++++++++++++++++++ gzdoom.changes | 5 + gzdoom.spec | 1 + 3 files changed, 134 insertions(+) create mode 100644 0001-Revert-load-the-hex-font-as-early-as-possible.patch diff --git a/0001-Revert-load-the-hex-font-as-early-as-possible.patch b/0001-Revert-load-the-hex-font-as-early-as-possible.patch new file mode 100644 index 0000000..94463bb --- /dev/null +++ b/0001-Revert-load-the-hex-font-as-early-as-possible.patch @@ -0,0 +1,128 @@ +From e5d7224171927f5a724128ffef7004daae6dd5c8 Mon Sep 17 00:00:00 2001 +From: Jan Engelhardt +Date: Thu, 23 Jun 2022 23:41:18 +0200 +Subject: [PATCH] Revert "- load the hex font as early as possible." +References: https://github.com/coelckers/gzdoom/issues/1615 + +This reverts commit 010f41a3aad3719b1e5d4d8ce157a5d9b0077b44. +--- + src/common/fonts/hexfont.cpp | 24 +++++++----------------- + src/d_main.cpp | 17 +++++++---------- + 2 files changed, 14 insertions(+), 27 deletions(-) + +diff --git a/src/common/fonts/hexfont.cpp b/src/common/fonts/hexfont.cpp +index 8b50427f4..e2bdbff7a 100644 +--- a/src/common/fonts/hexfont.cpp ++++ b/src/common/fonts/hexfont.cpp +@@ -58,12 +58,11 @@ struct HexDataSource + // + //========================================================================== + +- void ParseDefinition(FResourceLump* font) ++ void ParseDefinition(int lumpnum) + { + FScanner sc; + +- auto data = font->Lock(); +- sc.OpenMem("newconsolefont.hex", (const char*)data, font->Size()); ++ sc.OpenLumpNum(lumpnum); + sc.SetCMode(true); + glyphdata.Push(0); // ensure that index 0 can be used as 'not present'. + while (sc.GetString()) +@@ -97,7 +96,6 @@ struct HexDataSource + lumb = i * 255 / 17; + SmallPal[i] = PalEntry(255, lumb, lumb, lumb); + } +- font->Unlock(); + } + }; + +@@ -402,7 +400,7 @@ public: + + FFont *CreateHexLumpFont (const char *fontname, int lump) + { +- assert(hexdata.FirstChar != INT_MAX); ++ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump); + return new FHexFont(fontname, lump); + } + +@@ -414,7 +412,7 @@ FFont *CreateHexLumpFont (const char *fontname, int lump) + + FFont *CreateHexLumpFont2(const char *fontname, int lump) + { +- assert(hexdata.FirstChar != INT_MAX); ++ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump); + return new FHexFont2(fontname, lump); + } + +@@ -426,7 +424,8 @@ FFont *CreateHexLumpFont2(const char *fontname, int lump) + + uint8_t* GetHexChar(int codepoint) + { +- assert(hexdata.FirstChar != INT_MAX); ++ auto lump = fileSystem.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements. ++ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump); + + if (hexdata.glyphmap[codepoint] > 0) + { +@@ -434,13 +433,4 @@ uint8_t* GetHexChar(int codepoint) + return &hexdata.glyphdata[offset]; + } + return nullptr; +-} +- +-void LoadHexFont(const char* filename) +-{ +- auto resf = FResourceFile::OpenResourceFile(filename); +- if (resf == nullptr) I_FatalError("Unable to open %s", filename); +- auto hexfont = resf->FindLump("newconsolefont.hex"); +- if (hexfont == nullptr) I_FatalError("Unable to find newconsolefont.hex in %s", filename); +- hexdata.ParseDefinition(hexfont); +-} ++} +\ No newline at end of file +diff --git a/src/d_main.cpp b/src/d_main.cpp +index e658d74a3..9b5f9cabe 100644 +--- a/src/d_main.cpp ++++ b/src/d_main.cpp +@@ -175,7 +175,6 @@ void FreeSBarInfoScript(); + void I_UpdateWindowTitle(); + void S_ParseMusInfo(); + void D_GrabCVarDefaults(); +-void LoadHexFont(const char* filename); + + // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- + +@@ -3533,15 +3532,6 @@ static int D_DoomMain_Internal (void) + std::set_new_handler(NewFailure); + const char *batchout = Args->CheckValue("-errorlog"); + +- // [RH] Make sure zdoom.pk3 is always loaded, +- // as it contains magic stuff we need. +- wad = BaseFileSearch(BASEWAD, NULL, true, GameConfig); +- if (wad == NULL) +- { +- I_FatalError("Cannot find " BASEWAD); +- } +- LoadHexFont(wad); // load hex font early so we have it during startup. +- + C_InitConsole(80*8, 25*8, false); + I_DetectOS(); + +@@ -3571,6 +3561,13 @@ static int D_DoomMain_Internal (void) + extern void D_ConfirmSendStats(); + D_ConfirmSendStats(); + ++ // [RH] Make sure zdoom.pk3 is always loaded, ++ // as it contains magic stuff we need. ++ wad = BaseFileSearch (BASEWAD, NULL, true, GameConfig); ++ if (wad == NULL) ++ { ++ I_FatalError ("Cannot find " BASEWAD); ++ } + FString basewad = wad; + + FString optionalwad = BaseFileSearch(OPTIONALWAD, NULL, true, GameConfig); +-- +2.36.1 + diff --git a/gzdoom.changes b/gzdoom.changes index dc07017..c01ab40 100644 --- a/gzdoom.changes +++ b/gzdoom.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jun 23 21:42:38 UTC 2022 - Jan Engelhardt + +- Add 0001-Revert-load-the-hex-font-as-early-as-possible.patch + ------------------------------------------------------------------- Mon Jun 6 21:22:12 UTC 2022 - Jan Engelhardt diff --git a/gzdoom.spec b/gzdoom.spec index 2496aba..732d46c 100644 --- a/gzdoom.spec +++ b/gzdoom.spec @@ -33,6 +33,7 @@ Patch4: gzdoom-sdlbug.patch Patch5: gzdoom-vulkan.patch Patch6: gzdoom-discord.patch Patch7: 0001-Resolve-build-failure-on-i686-linux.patch +Patch8: 0001-Revert-load-the-hex-font-as-early-as-possible.patch BuildRequires: cmake >= 2.8.7 BuildRequires: discord-rpc-devel BuildRequires: gcc-c++