pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
doomlegacy-devel: Update UMAPINFO support
Module Name: pkgsrc-wip
Committed By: Michael Baeuerle <micha%NetBSD.org@localhost>
Pushed By: micha
Date: Fri Aug 25 12:27:48 2023 +0200
Changeset: 27eff56333c22efd528768d591167b661a962ced
Modified Files:
doomlegacy-devel/DESCR
doomlegacy-devel/Makefile
doomlegacy-devel/TODO
doomlegacy-devel/files/umapinfo.c
Log Message:
doomlegacy-devel: Update UMAPINFO support
Memory management of libdoom-umapinfo is mapped to Doom zone memory.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=27eff56333c22efd528768d591167b661a962ced
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
doomlegacy-devel/DESCR | 2 +-
doomlegacy-devel/Makefile | 7 ++++---
doomlegacy-devel/TODO | 9 +++++++++
doomlegacy-devel/files/umapinfo.c | 42 +++++++++++++++++++++++++++++++++++----
4 files changed, 52 insertions(+), 8 deletions(-)
diffs:
diff --git a/doomlegacy-devel/DESCR b/doomlegacy-devel/DESCR
index 9e4b7d28e8..e7e8804fee 100644
--- a/doomlegacy-devel/DESCR
+++ b/doomlegacy-devel/DESCR
@@ -20,4 +20,4 @@ and the Marine's Best Friend (MBF) extensions. Legacy also has implemented
among other things 3D floors, swimmable water and other special effects using
extended linedef codes, and supports the FraggleScript scripting language.
-This package contains the SDL build of Doom Legacy.
+This package contains the SDL1 build of Doom Legacy.
diff --git a/doomlegacy-devel/Makefile b/doomlegacy-devel/Makefile
index 7d51760785..6227b9f210 100644
--- a/doomlegacy-devel/Makefile
+++ b/doomlegacy-devel/Makefile
@@ -133,12 +133,13 @@ do-install:
# Ensure that at least the shareware Episode 1 of Doom is available
DEPENDS+= doom1-[0-9]*:../../games/doom1
-BUILDLINK_API_DEPENDS.zlib+= zlib>=1.2.3
+BUILDLINK_API_DEPENDS.zlib+= zlib>=1.2.3
.include "../../devel/zlib/buildlink3.mk"
-BUILDLINK_API_DEPENDS.SDL_mixer+= SDL_mixer>=1.2.7
+BUILDLINK_API_DEPENDS.SDL_mixer+= SDL_mixer>=1.2.7
.include "../../audio/SDL_mixer/buildlink3.mk"
-BUILDLINK_API_DEPENDS.SDL+= SDL>=1.2.10
+BUILDLINK_API_DEPENDS.SDL+= SDL>=1.2.10
.include "../../devel/SDL/buildlink3.mk"
+BUILDLINK_API_DEPENDS.libdoom-umapinfo+= libdoom-umapinfo>=1.0.0rc5
.include "../../wip/libdoom-umapinfo/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/doomlegacy-devel/TODO b/doomlegacy-devel/TODO
index 45301fb740..8670ad3a8e 100644
--- a/doomlegacy-devel/TODO
+++ b/doomlegacy-devel/TODO
@@ -13,6 +13,7 @@ Part 25: Add UMAPINFO support
[X] Hook keys into game engine
=> All keys should work now, up to the limits of the engine
[X] Add support for "\n" line breaks in key "intertext".
+[X] Use Doom zone memory as libdoom-umapinfo memory manager
=> Created upstream feature request ticket #100
@@ -23,6 +24,14 @@ Part 26: Incorrect voodoo doll behaviour
Voodoo doll transfers damage to the player, but seems to not take thrust
(is not pushed away e.g. from an explosion as expected).
=> Reported upstream in ticket #688
+ No fix required. Vanilla behaviour can be configured via menu.
+
+
+Part 27: Some bossactions are not Vanilla-compatible
+====================================================
+[X] Player stuck in Atonement (map 01)
+ => Reported upstream in ticket #690
+ Proposed patch may break existing WAD files.
EOF
diff --git a/doomlegacy-devel/files/umapinfo.c b/doomlegacy-devel/files/umapinfo.c
index 698244e656..3acc6d7431 100644
--- a/doomlegacy-devel/files/umapinfo.c
+++ b/doomlegacy-devel/files/umapinfo.c
@@ -16,7 +16,9 @@
// Support for additional map information in UMAPINFO format.
//
// -----------------------------------------------------------------------------
-
+//
+// [MB] 2023-08-25: Register zone memory as libdoom-umapinfo memory manager
+//
// [MB] 2023-01-21: Support for Rev 2.2 added
// Description of UMAPINFO lump format:
// https://doomwiki.org/wiki/UMAPINFO
@@ -47,7 +49,7 @@ umapinfo_t umapinfo = { NULL, NULL, false };
// -----------------------------------------------------------------------------
-// Memory management
+// C-style API for memory management
static void *UMI_Malloc(size_t memsize)
{
@@ -55,6 +57,39 @@ static void *UMI_Malloc(size_t memsize)
}
+static void *UMI_Realloc(void *ptr_old, size_t memsize_new)
+{
+ void *ptr_new = Z_Malloc(memsize_new, PU_STATIC, 0);
+
+ if (NULL != ptr_new)
+ {
+ if (NULL != ptr_old)
+ {
+ int memsize_tmp = Z_Datasize(ptr_old);
+
+ if (0 > memsize_tmp)
+ {
+ Z_Free(ptr_new);
+ ptr_new = NULL;
+ }
+ else
+ {
+ // Data of type int must fit into size_t
+ size_t memsize_old = memsize_tmp;
+
+ if (memsize_new < memsize_old)
+ memcpy(ptr_new, ptr_old, memsize_new);
+ else
+ memcpy(ptr_new, ptr_old, memsize_old);
+ Z_Free(ptr_old);
+ }
+ }
+ }
+
+ return ptr_new;
+}
+
+
static void UMI_Free(void *ptr)
{
if (NULL != ptr)
@@ -774,8 +809,7 @@ void UMI_LoadUMapInfoLump(lumpnum_t lumpnum)
assert(0 <= len);
// libdoom-umapinfo needs a memory manager with realloc() equivalent
- // The zone memory module currently does not provide such a function
- //doom_umi1_i_register_mmanager(UMI_Realloc, UMI_Free);
+ doom_umi1_register_mmanager(UMI_Realloc, UMI_Free);
{
int retval = DOOM_UMI1_ERROR_MEMORY;
Home |
Main Index |
Thread Index |
Old Index