pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
woof: Fix segfaults with extended nodes on big endian machines
Module Name: pkgsrc-wip
Committed By: Michael Baeuerle <michael.baeuerle%stz-e.de@localhost>
Pushed By: micha
Date: Thu Apr 23 16:18:26 2020 +0200
Changeset: 995c2b4b90c64ae2103bf5462dc6e012677ae4c0
Modified Files:
woof/TODO
woof/distinfo
Added Files:
woof/patches/patch-Source_p__extnodes.c
Log Message:
woof: Fix segfaults with extended nodes on big endian machines
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=995c2b4b90c64ae2103bf5462dc6e012677ae4c0
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
woof/TODO | 25 ++++++
woof/distinfo | 1 +
woof/patches/patch-Source_p__extnodes.c | 143 ++++++++++++++++++++++++++++++++
3 files changed, 169 insertions(+)
diffs:
diff --git a/woof/TODO b/woof/TODO
index 0b38900aa7..8f1f0ebaf9 100644
--- a/woof/TODO
+++ b/woof/TODO
@@ -1 +1,26 @@
[X] Add ${PREFIX}/share/doom directory to search list
+[ ] QUERZ keyboard layout does not work
+[X] Fix crashes on big endian machines
+
+$ uname
+Linux
+$ uname -m
+ppc
+$ woof -iwad doom2.wad -file Avactor.wad -warp 9
+[...]
+D_CheckNetGame: Checking network game status.
+startskill 2 deathmatch: 0 startmap: 9 startepisode: 1
+player 1 of 1 (1 nodes)
+S_Init: Setting up sound.
+HU_Init: Setting up heads up display.
+ST_Init: Init status bar.
+Segmentation fault
+$ woof -iwad doom2.wad -file Eviternity.wad -warp 32
+[...]
+D_CheckNetGame: Checking network game status.
+startskill 2 deathmatch: 0 startmap: 32 startepisode: 1
+player 1 of 1 (1 nodes)
+S_Init: Setting up sound.
+HU_Init: Setting up heads up display.
+ST_Init: Init status bar.
+Segmentation fault
diff --git a/woof/distinfo b/woof/distinfo
index ea6b521c6f..1ce1ca5623 100644
--- a/woof/distinfo
+++ b/woof/distinfo
@@ -5,3 +5,4 @@ RMD160 (woof_1.2.0.tar.gz) = 92a74545a0e5e7c5272783450a678e347a20305c
SHA512 (woof_1.2.0.tar.gz) = 9672f6d2326eea8cc0027583489ad4cb817105e8a6a567e51ef49b777ca900099fb0f20357e86613532c6dd85dda81c138a421f47ac3a8442658f9642e1f66ff
Size (woof_1.2.0.tar.gz) = 1875308 bytes
SHA1 (patch-Source_d__iwad.c) = fc897f508e31653495bfed26152a7e6d70021089
+SHA1 (patch-Source_p__extnodes.c) = 34a23011cf12e7e1b98a375a706d919f7e1971de
diff --git a/woof/patches/patch-Source_p__extnodes.c b/woof/patches/patch-Source_p__extnodes.c
new file mode 100644
index 0000000000..dfb91b4f10
--- /dev/null
+++ b/woof/patches/patch-Source_p__extnodes.c
@@ -0,0 +1,143 @@
+$NetBSD$
+
+Fix endianess for import of extended nodes.
+
+--- Source/p_extnodes.c.orig 2020-04-14 06:39:44.000000000 +0000
++++ Source/p_extnodes.c
+@@ -152,10 +152,15 @@ void P_LoadSegs_DeePBSP (int lump)
+
+ int side, linedef;
+ line_t *ldef;
++ int vn1, vn2;
++
++ // [MB] 2020-04-22: Fix endianess for DeePBSDP V4 nodes
++ vn1 = LONG(ml->v1);
++ vn2 = LONG(ml->v2);
+
+ // [FG] extended nodes
+- li->v1 = &vertexes[ml->v1];
+- li->v2 = &vertexes[ml->v2];
++ li->v1 = &vertexes[vn1];
++ li->v2 = &vertexes[vn2];
+
+ li->angle = (SHORT(ml->angle))<<16;
+ li->offset = (SHORT(ml->offset))<<16;
+@@ -189,8 +194,9 @@ void P_LoadSubsectors_DeePBSP (int lump)
+
+ for (i=0; i<numsubsectors; i++)
+ {
+- subsectors[i].numlines = (int)data[i].numsegs;
+- subsectors[i].firstline = (int)data[i].firstseg;
++ // [MB] 2020-04-22: Fix endianess for DeePBSDP V4 nodes
++ subsectors[i].numlines = (unsigned short)SHORT(data[i].numsegs);
++ subsectors[i].firstline = LONG(data[i].firstseg);
+ }
+
+ Z_Free (data);
+@@ -222,7 +228,8 @@ void P_LoadNodes_DeePBSP (int lump)
+ for (j=0 ; j<2 ; j++)
+ {
+ int k;
+- no->children[j] = (unsigned int)(mn->children[j]);
++ // [MB] 2020-04-22: Fix endianess for DeePBSDP V4 nodes
++ no->children[j] = LONG(mn->children[j]);
+
+ for (k=0 ; k<4 ; k++)
+ no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS;
+@@ -241,6 +248,8 @@ void P_LoadNodes_DeePBSP (int lump)
+ // - added support for compressed ZDBSP nodes
+ // - added support for flipped levels
+
++// [MB] 2020-04-22: Fix endianess for ZDoom extended nodes
++
+ void P_LoadNodes_ZDBSP (int lump, boolean compressed)
+ {
+ byte *data;
+@@ -312,10 +321,10 @@ void P_LoadNodes_ZDBSP (int lump, boolea
+
+ // 1. Load new vertices added during node building
+
+- orgVerts = *((unsigned int*)data);
++ orgVerts = LONG(*((unsigned int*)data));
+ data += sizeof(orgVerts);
+
+- newVerts = *((unsigned int*)data);
++ newVerts = LONG(*((unsigned int*)data));
+ data += sizeof(newVerts);
+
+ if (orgVerts + newVerts == (unsigned int)numvertexes)
+@@ -332,11 +341,11 @@ void P_LoadNodes_ZDBSP (int lump, boolea
+ for (i = 0; i < newVerts; i++)
+ {
+ newvertarray[i + orgVerts].r_x =
+- newvertarray[i + orgVerts].x = *((unsigned int*)data);
++ newvertarray[i + orgVerts].x = LONG(*((unsigned int*)data));
+ data += sizeof(newvertarray[0].x);
+
+ newvertarray[i + orgVerts].r_y =
+- newvertarray[i + orgVerts].y = *((unsigned int*)data);
++ newvertarray[i + orgVerts].y = LONG(*((unsigned int*)data));
+ data += sizeof(newvertarray[0].y);
+ }
+
+@@ -355,7 +364,7 @@ void P_LoadNodes_ZDBSP (int lump, boolea
+
+ // 2. Load subsectors
+
+- numSubs = *((unsigned int*)data);
++ numSubs = LONG(*((unsigned int*)data));
+ data += sizeof(numSubs);
+
+ if (numSubs < 1)
+@@ -369,15 +378,15 @@ void P_LoadNodes_ZDBSP (int lump, boolea
+ mapsubsector_zdbsp_t *mseg = (mapsubsector_zdbsp_t*) data + i;
+
+ subsectors[i].firstline = currSeg;
+- subsectors[i].numlines = mseg->numsegs;
+- currSeg += mseg->numsegs;
++ subsectors[i].numlines = LONG(mseg->numsegs);
++ currSeg += LONG(mseg->numsegs);
+ }
+
+ data += numsubsectors * sizeof(mapsubsector_zdbsp_t);
+
+ // 3. Load segs
+
+- numSegs = *((unsigned int*)data);
++ numSegs = LONG(*((unsigned int*)data));
+ data += sizeof(numSegs);
+
+ // The number of stored segs should match the number of segs used by subsectors
+@@ -396,9 +405,12 @@ void P_LoadNodes_ZDBSP (int lump, boolea
+ unsigned char side;
+ seg_t *li = segs + i;
+ mapseg_zdbsp_t *ml = (mapseg_zdbsp_t *) data + i;
++ unsigned int v1, v2;
+
+- li->v1 = &vertexes[ml->v1];
+- li->v2 = &vertexes[ml->v2];
++ v1 = LONG(ml->v1);
++ v2 = LONG(ml->v2);
++ li->v1 = &vertexes[v1];
++ li->v2 = &vertexes[v2];
+
+ linedef = (unsigned short)SHORT(ml->linedef);
+ ldef = &lines[linedef];
+@@ -430,7 +442,7 @@ void P_LoadNodes_ZDBSP (int lump, boolea
+
+ // 4. Load nodes
+
+- numNodes = *((unsigned int*)data);
++ numNodes = LONG(*((unsigned int*)data));
+ data += sizeof(numNodes);
+
+ numnodes = numNodes;
+@@ -449,7 +461,7 @@ void P_LoadNodes_ZDBSP (int lump, boolea
+
+ for (j = 0; j < 2; j++)
+ {
+- no->children[j] = (unsigned int)(mn->children[j]);
++ no->children[j] = LONG(mn->children[j]);
+
+ for (k = 0; k < 4; k++)
+ no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS;
Home |
Main Index |
Thread Index |
Old Index