Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-fps/gzdoom/, games-fps/gzdoom/files/
Date: Sat, 06 Aug 2022 13:06:56
Message-Id: 1659791199.05de9a1d409e70f9075fefb93b6f21d705699ead.chewi@gentoo
1 commit: 05de9a1d409e70f9075fefb93b6f21d705699ead
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Sat Aug 6 13:06:08 2022 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 6 13:06:39 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05de9a1d
7
8 games-fps/gzdoom: Apply proper gzdoom.pk3 path issue fix
9
10 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
11
12 ...rt-load-the-hex-font-as-early-as-possible.patch | 129 ---------------------
13 .../gzdoom/files/gzdoom-4.8.2-fix-gzdoom-pk3.patch | 36 ++++++
14 ...{gzdoom-4.8.2.ebuild => gzdoom-4.8.2-r1.ebuild} | 2 +-
15 3 files changed, 37 insertions(+), 130 deletions(-)
16
17 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
18 deleted file mode 100644
19 index 58a2f7a2b2f4..000000000000
20 --- a/games-fps/gzdoom/files/0001-Revert-load-the-hex-font-as-early-as-possible.patch
21 +++ /dev/null
22 @@ -1,129 +0,0 @@
23 -From 2d00bc6b9f25ae045eecba6e198eaceee9046647 Mon Sep 17 00:00:00 2001
24 -From: James Le Cuirot <chewi@g.o>
25 -Date: Wed, 6 Jul 2022 23:37:30 +0100
26 -Subject: [PATCH] Revert "- load the hex font as early as possible."
27 -
28 -This reverts commit 010f41a3aad3719b1e5d4d8ce157a5d9b0077b44.
29 -
30 -Bug: https://github.com/coelckers/gzdoom/issues/1615
31 ----
32 - src/common/fonts/hexfont.cpp | 24 +++++++-----------------
33 - src/d_main.cpp | 17 +++++++----------
34 - 2 files changed, 14 insertions(+), 27 deletions(-)
35 -
36 -diff --git a/src/common/fonts/hexfont.cpp b/src/common/fonts/hexfont.cpp
37 -index 8b50427f4..e2bdbff7a 100644
38 ---- a/src/common/fonts/hexfont.cpp
39 -+++ b/src/common/fonts/hexfont.cpp
40 -@@ -58,12 +58,11 @@ struct HexDataSource
41 - //
42 - //==========================================================================
43 -
44 -- void ParseDefinition(FResourceLump* font)
45 -+ void ParseDefinition(int lumpnum)
46 - {
47 - FScanner sc;
48 -
49 -- auto data = font->Lock();
50 -- sc.OpenMem("newconsolefont.hex", (const char*)data, font->Size());
51 -+ sc.OpenLumpNum(lumpnum);
52 - sc.SetCMode(true);
53 - glyphdata.Push(0); // ensure that index 0 can be used as 'not present'.
54 - while (sc.GetString())
55 -@@ -97,7 +96,6 @@ struct HexDataSource
56 - lumb = i * 255 / 17;
57 - SmallPal[i] = PalEntry(255, lumb, lumb, lumb);
58 - }
59 -- font->Unlock();
60 - }
61 - };
62 -
63 -@@ -402,7 +400,7 @@ public:
64 -
65 - FFont *CreateHexLumpFont (const char *fontname, int lump)
66 - {
67 -- assert(hexdata.FirstChar != INT_MAX);
68 -+ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump);
69 - return new FHexFont(fontname, lump);
70 - }
71 -
72 -@@ -414,7 +412,7 @@ FFont *CreateHexLumpFont (const char *fontname, int lump)
73 -
74 - FFont *CreateHexLumpFont2(const char *fontname, int lump)
75 - {
76 -- assert(hexdata.FirstChar != INT_MAX);
77 -+ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump);
78 - return new FHexFont2(fontname, lump);
79 - }
80 -
81 -@@ -426,7 +424,8 @@ FFont *CreateHexLumpFont2(const char *fontname, int lump)
82 -
83 - uint8_t* GetHexChar(int codepoint)
84 - {
85 -- assert(hexdata.FirstChar != INT_MAX);
86 -+ auto lump = fileSystem.CheckNumForFullName("newconsolefont.hex", 0); // This is always loaded from gzdoom.pk3 to prevent overriding it with incomplete replacements.
87 -+ if (hexdata.FirstChar == INT_MAX) hexdata.ParseDefinition(lump);
88 -
89 - if (hexdata.glyphmap[codepoint] > 0)
90 - {
91 -@@ -434,13 +433,4 @@ uint8_t* GetHexChar(int codepoint)
92 - return &hexdata.glyphdata[offset];
93 - }
94 - return nullptr;
95 --}
96 --
97 --void LoadHexFont(const char* filename)
98 --{
99 -- auto resf = FResourceFile::OpenResourceFile(filename);
100 -- if (resf == nullptr) I_FatalError("Unable to open %s", filename);
101 -- auto hexfont = resf->FindLump("newconsolefont.hex");
102 -- if (hexfont == nullptr) I_FatalError("Unable to find newconsolefont.hex in %s", filename);
103 -- hexdata.ParseDefinition(hexfont);
104 --}
105 -+}
106 -\ No newline at end of file
107 -diff --git a/src/d_main.cpp b/src/d_main.cpp
108 -index b64142c07..d61807012 100644
109 ---- a/src/d_main.cpp
110 -+++ b/src/d_main.cpp
111 -@@ -175,7 +175,6 @@ void FreeSBarInfoScript();
112 - void I_UpdateWindowTitle();
113 - void S_ParseMusInfo();
114 - void D_GrabCVarDefaults();
115 --void LoadHexFont(const char* filename);
116 -
117 - // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
118 -
119 -@@ -3535,15 +3534,6 @@ static int D_DoomMain_Internal (void)
120 - std::set_new_handler(NewFailure);
121 - const char *batchout = Args->CheckValue("-errorlog");
122 -
123 -- // [RH] Make sure zdoom.pk3 is always loaded,
124 -- // as it contains magic stuff we need.
125 -- wad = BaseFileSearch(BASEWAD, NULL, true, GameConfig);
126 -- if (wad == NULL)
127 -- {
128 -- I_FatalError("Cannot find " BASEWAD);
129 -- }
130 -- LoadHexFont(wad); // load hex font early so we have it during startup.
131 --
132 - C_InitConsole(80*8, 25*8, false);
133 - I_DetectOS();
134 -
135 -@@ -3573,6 +3563,13 @@ static int D_DoomMain_Internal (void)
136 - extern void D_ConfirmSendStats();
137 - D_ConfirmSendStats();
138 -
139 -+ // [RH] Make sure zdoom.pk3 is always loaded,
140 -+ // as it contains magic stuff we need.
141 -+ wad = BaseFileSearch (BASEWAD, NULL, true, GameConfig);
142 -+ if (wad == NULL)
143 -+ {
144 -+ I_FatalError ("Cannot find " BASEWAD);
145 -+ }
146 - FString basewad = wad;
147 -
148 - FString optionalwad = BaseFileSearch(OPTIONALWAD, NULL, true, GameConfig);
149 ---
150 -2.35.1
151 -
152
153 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
154 new file mode 100644
155 index 000000000000..6070d47566e0
156 --- /dev/null
157 +++ b/games-fps/gzdoom/files/gzdoom-4.8.2-fix-gzdoom-pk3.patch
158 @@ -0,0 +1,36 @@
159 +From b132d2c3fe7f9074e1c08dbab77fc1270e8736fb Mon Sep 17 00:00:00 2001
160 +From: Omar Polo <op@××××××××.com>
161 +Date: Mon, 11 Jul 2022 11:52:43 +0200
162 +Subject: [PATCH] fix gzdoom.pk3 not found error
163 +
164 +Move the initialization before BaseFileSearch is called, otherwise
165 +GameConfig is used not initialized and it doesn't find the gzdoom.pk3
166 +file.
167 +
168 +GameConfig used uninitalized was spotted by @LoneFox78.
169 +---
170 + src/d_main.cpp | 4 ++--
171 + 1 file changed, 2 insertions(+), 2 deletions(-)
172 +
173 +diff --git a/src/d_main.cpp b/src/d_main.cpp
174 +index b64142c07fe..005f8cf8cd5 100644
175 +--- a/src/d_main.cpp
176 ++++ b/src/d_main.cpp
177 +@@ -3534,6 +3534,8 @@ static int D_DoomMain_Internal (void)
178 +
179 + std::set_new_handler(NewFailure);
180 + const char *batchout = Args->CheckValue("-errorlog");
181 ++
182 ++ D_DoomInit();
183 +
184 + // [RH] Make sure zdoom.pk3 is always loaded,
185 + // as it contains magic stuff we need.
186 +@@ -3568,8 +3570,6 @@ static int D_DoomMain_Internal (void)
187 +
188 + if (!batchrun) Printf(PRINT_LOG, "%s version %s\n", GAMENAME, GetVersionString());
189 +
190 +- D_DoomInit();
191 +-
192 + extern void D_ConfirmSendStats();
193 + D_ConfirmSendStats();
194 +
195
196 diff --git a/games-fps/gzdoom/gzdoom-4.8.2.ebuild b/games-fps/gzdoom/gzdoom-4.8.2-r1.ebuild
197 similarity index 96%
198 rename from games-fps/gzdoom/gzdoom-4.8.2.ebuild
199 rename to games-fps/gzdoom/gzdoom-4.8.2-r1.ebuild
200 index ab1b0da8c59c..03a5359074ef 100644
201 --- a/games-fps/gzdoom/gzdoom-4.8.2.ebuild
202 +++ b/games-fps/gzdoom/gzdoom-4.8.2-r1.ebuild
203 @@ -30,7 +30,7 @@ S="${WORKDIR}/${PN}-g${PV}"
204
205 PATCHES=(
206 "${FILESDIR}"/${PN}-4.7.1-Introduce-the-BUILD_NONFREE-option.patch
207 - "${FILESDIR}"/0001-Revert-load-the-hex-font-as-early-as-possible.patch
208 + "${FILESDIR}"/${P}-fix-gzdoom-pk3.patch
209 )
210
211 src_prepare() {