This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit c267a6c328410623881ffff52d6e87e5eb7a60f7
Author: Matteo Golin <[email protected]>
AuthorDate: Fri Oct 16 16:09:04 2026 -0400

    games/NXDoom: allow choice of allocation implementation
    
    Allow the user to choose which memory allocation implementation is used
    for DOOM.
    
    Signed-off-by: Matteo Golin <[email protected]>
---
 games/NXDoom/Kconfig  | 18 ++++++++++++++++++
 games/NXDoom/Makefile |  9 +++++++++
 2 files changed, 27 insertions(+)

diff --git a/games/NXDoom/Kconfig b/games/NXDoom/Kconfig
index 1f0f97c88..b1fe44ff8 100644
--- a/games/NXDoom/Kconfig
+++ b/games/NXDoom/Kconfig
@@ -266,4 +266,22 @@ config GAMES_NXDOOM_STATIC_SCRNBUF
                costs 64000 bytes of RAM whether DOOM runs or not, so it is only
                worth it when internal RAM is plentiful and the heap is not.
 
+choice # Memory allocation implementaiton
+       prompt "Memory allocation implementation"
+       default GAMES_NXDOOM_ALLOC_ZNATIVE
+
+       config GAMES_NXDOOM_ALLOC_ZNATIVE
+               bool "z_native"
+               ---help---
+                       Use the `z_native` allocator, which relies on NuttX's 
implementation
+                       of `malloc()` and `free()` to handle memory allocation.
+
+       config GAMES_NXDOOM_ALLOC_ZZONE
+               bool "z_zone"
+               ---help---
+                       Use the `z_zone` allocator, which is DOOM's 
implementation that acts
+                       on an up-front allocated chunk of memory given by 
`i_zone_base()`.
+       
+endchoice # Memory allocation implementaiton
+
 endif # GAMES_NXDOOM
diff --git a/games/NXDoom/Makefile b/games/NXDoom/Makefile
index b22390654..fa44b9166 100644
--- a/games/NXDoom/Makefile
+++ b/games/NXDoom/Makefile
@@ -22,7 +22,16 @@ CFLAGS += -I$(PCSOUNDSRCDIR)
 # Source files
 
 COMMONSRCS = i_system.c m_argv.c m_misc.c # Excluding i_main.c
+
+# Choose memory allocation method
+
+ifeq ($(CONFIG_GAMES_NXDOOM_ALLOC_ZNATIVE),y)
 COMMONSRCS += z_native.c # Native memory allocation
+endif
+
+ifeq ($(CONFIG_GAMES_NXDOOM_ALLOC_ZZONE),y)
+COMMONSRCS += z_zone.c # DOOM memory allocation
+endif
 
 DEHACKEDSRCS = deh_io.c deh_main.c deh_mapping.c deh_text.c
 

Reply via email to