commit:     05de9a1d409e70f9075fefb93b6f21d705699ead
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  6 13:06:08 2022 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Aug  6 13:06:39 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05de9a1d

games-fps/gzdoom: Apply proper gzdoom.pk3 path issue fix

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 ...rt-load-the-hex-font-as-early-as-possible.patch | 129 ---------------------
 .../gzdoom/files/gzdoom-4.8.2-fix-gzdoom-pk3.patch |  36 ++++++
 ...{gzdoom-4.8.2.ebuild => gzdoom-4.8.2-r1.ebuild} |   2 +-
 3 files changed, 37 insertions(+), 130 deletions(-)

diff --git 
a/games-fps/gzdoom/files/0001-Revert-load-the-hex-font-as-early-as-possible.patch
 
b/games-fps/gzdoom/files/0001-Revert-load-the-hex-font-as-early-as-possible.patch
deleted file mode 100644
index 58a2f7a2b2f4..000000000000
--- 
a/games-fps/gzdoom/files/0001-Revert-load-the-hex-font-as-early-as-possible.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-From 2d00bc6b9f25ae045eecba6e198eaceee9046647 Mon Sep 17 00:00:00 2001
-From: James Le Cuirot <ch...@gentoo.org>
-Date: Wed, 6 Jul 2022 23:37:30 +0100
-Subject: [PATCH] Revert "- load the hex font as early as possible."
-
-This reverts commit 010f41a3aad3719b1e5d4d8ce157a5d9b0077b44.
-
-Bug: https://github.com/coelckers/gzdoom/issues/1615
----
- 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 b64142c07..d61807012 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 ---------------------------------------------
- 
-@@ -3535,15 +3534,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();
- 
-@@ -3573,6 +3563,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.35.1
-

diff --git a/games-fps/gzdoom/files/gzdoom-4.8.2-fix-gzdoom-pk3.patch 
b/games-fps/gzdoom/files/gzdoom-4.8.2-fix-gzdoom-pk3.patch
new file mode 100644
index 000000000000..6070d47566e0
--- /dev/null
+++ b/games-fps/gzdoom/files/gzdoom-4.8.2-fix-gzdoom-pk3.patch
@@ -0,0 +1,36 @@
+From b132d2c3fe7f9074e1c08dbab77fc1270e8736fb Mon Sep 17 00:00:00 2001
+From: Omar Polo <o...@omarpolo.com>
+Date: Mon, 11 Jul 2022 11:52:43 +0200
+Subject: [PATCH] fix gzdoom.pk3 not found error
+
+Move the initialization before BaseFileSearch is called, otherwise
+GameConfig is used not initialized and it doesn't find the gzdoom.pk3
+file.
+
+GameConfig used uninitalized was spotted by @LoneFox78.
+---
+ src/d_main.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/d_main.cpp b/src/d_main.cpp
+index b64142c07fe..005f8cf8cd5 100644
+--- a/src/d_main.cpp
++++ b/src/d_main.cpp
+@@ -3534,6 +3534,8 @@ static int D_DoomMain_Internal (void)
+       
+       std::set_new_handler(NewFailure);
+       const char *batchout = Args->CheckValue("-errorlog");
++
++      D_DoomInit();
+       
+       // [RH] Make sure zdoom.pk3 is always loaded,
+       // as it contains magic stuff we need.
+@@ -3568,8 +3570,6 @@ static int D_DoomMain_Internal (void)
+ 
+       if (!batchrun) Printf(PRINT_LOG, "%s version %s\n", GAMENAME, 
GetVersionString());
+ 
+-      D_DoomInit();
+-
+       extern void D_ConfirmSendStats();
+       D_ConfirmSendStats();
+ 

diff --git a/games-fps/gzdoom/gzdoom-4.8.2.ebuild 
b/games-fps/gzdoom/gzdoom-4.8.2-r1.ebuild
similarity index 96%
rename from games-fps/gzdoom/gzdoom-4.8.2.ebuild
rename to games-fps/gzdoom/gzdoom-4.8.2-r1.ebuild
index ab1b0da8c59c..03a5359074ef 100644
--- a/games-fps/gzdoom/gzdoom-4.8.2.ebuild
+++ b/games-fps/gzdoom/gzdoom-4.8.2-r1.ebuild
@@ -30,7 +30,7 @@ S="${WORKDIR}/${PN}-g${PV}"
 
 PATCHES=(
        "${FILESDIR}"/${PN}-4.7.1-Introduce-the-BUILD_NONFREE-option.patch
-       "${FILESDIR}"/0001-Revert-load-the-hex-font-as-early-as-possible.patch
+       "${FILESDIR}"/${P}-fix-gzdoom-pk3.patch
 )
 
 src_prepare() {

Reply via email to