[Scummvm-git-logs] scummvm master -> fefe3d5ca956f101c1be80a4b116278ef5c04649

lephilousophe noreply at scummvm.org
Sun Oct 12 17:09:14 UTC 2025


This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
edde6449ff COMMON: Don't allocate static pool for HashMap on low-end platforms
56e386117a ANDROID: This platform has plenty of memory now
afe1d300d9 DS: Fix build when text console is enabled
26fe67b8c0 DS: Setup VBlank IRQ when all pointers are initialized
565af3574b DS: Port to libnds2 and calico
c377109a16 DS: Ensure that __NDS__ is defined
fefe3d5ca9 DS: Flush data cache before running DMA transfers


Commit: edde6449ff831067d76e9ee89d66842d07d248c1
    https://github.com/scummvm/scummvm/commit/edde6449ff831067d76e9ee89d66842d07d248c1
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-10-12T19:09:06+02:00

Commit Message:
COMMON: Don't allocate static pool for HashMap on low-end platforms

When HashMaps are allocated on stack this may overflow.

Changed paths:
    common/hashmap.h
    common/memorypool.h


diff --git a/common/hashmap.h b/common/hashmap.h
index 70f00d9930f..44f43b227e6 100644
--- a/common/hashmap.h
+++ b/common/hashmap.h
@@ -109,7 +109,11 @@ private:
 		HASHMAP_LOADFACTOR_NUMERATOR = 2,
 		HASHMAP_LOADFACTOR_DENOMINATOR = 3,
 
+#ifdef REDUCE_MEMORY_USAGE
+		HASHMAP_MEMORYPOOL_SIZE = 0
+#else
 		HASHMAP_MEMORYPOOL_SIZE = HASHMAP_MIN_CAPACITY * HASHMAP_LOADFACTOR_NUMERATOR / HASHMAP_LOADFACTOR_DENOMINATOR
+#endif
 	};
 
 #ifdef USE_HASHMAP_MEMORY_POOL
diff --git a/common/memorypool.h b/common/memorypool.h
index c12f01bfdf3..8e5d29e20b9 100644
--- a/common/memorypool.h
+++ b/common/memorypool.h
@@ -125,9 +125,13 @@ public:
 	}
 };
 
-// Ensure NUM_INTERNAL_CHUNKS == 0 results in a compile error
+/*
+ * This is the degenerate case of FixedSizeMemoryPool with 0 chunks.
+ * It's a MemoryPool with static chunk size.
+ * This is useful for ObjectPool users (HashMap)
+ */
 template<size_t CHUNK_SIZE>
-class FixedSizeMemoryPool<CHUNK_SIZE,0> : public MemoryPool {
+class FixedSizeMemoryPool<CHUNK_SIZE, 0> : public MemoryPool {
 public:
 	FixedSizeMemoryPool() : MemoryPool(CHUNK_SIZE) {}
 };


Commit: 56e386117aa071065774c2f0d5d164c931643e1a
    https://github.com/scummvm/scummvm/commit/56e386117aa071065774c2f0d5d164c931643e1a
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-10-12T19:09:06+02:00

Commit Message:
ANDROID: This platform has plenty of memory now

Changed paths:
    configure


diff --git a/configure b/configure
index 09209a0b239..58a1191435d 100755
--- a/configure
+++ b/configure
@@ -4113,7 +4113,6 @@ case $_backend in
 	3ds)
 		;;
 	android)
-		append_var DEFINES "-DREDUCE_MEMORY_USAGE"
 		append_var DEFINES "-DNONSTANDARD_PORT"
 		append_var DEFINES "-DANDROID_BACKEND"
 		append_var INCLUDES '-I$(srcdir)/backends/platform/'$_backend


Commit: afe1d300d9489fd46bca40fc3edc40cd3c9e98c1
    https://github.com/scummvm/scummvm/commit/afe1d300d9489fd46bca40fc3edc40cd3c9e98c1
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-10-12T19:09:06+02:00

Commit Message:
DS: Fix build when text console is enabled

Changed paths:
    backends/platform/ds/ds-graphics.cpp


diff --git a/backends/platform/ds/ds-graphics.cpp b/backends/platform/ds/ds-graphics.cpp
index 338f8bce98e..e4b8e405915 100644
--- a/backends/platform/ds/ds-graphics.cpp
+++ b/backends/platform/ds/ds-graphics.cpp
@@ -397,10 +397,12 @@ OSystem::TransactionError OSystem_DS::endGFXTransaction() {
 	}
 
 	bool bannerChanged = false;
+#ifdef DISABLE_TEXT_CONSOLE
 	if (  (!_engineRunning && (_banner == NULL))
 	    || (_engineRunning && (_banner != NULL))) {
 		bannerChanged = true;
 	}
+#endif
 
 	if (setupNewGameScreen) {
 		bool swScale = ((_currentState.graphicsMode == GFX_SWSCALE) && (_currentState.width == 320));


Commit: 26fe67b8c0f1f9dd850a66041c020a535dd0033b
    https://github.com/scummvm/scummvm/commit/26fe67b8c0f1f9dd850a66041c020a535dd0033b
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-10-12T19:09:06+02:00

Commit Message:
DS: Setup VBlank IRQ when all pointers are initialized

Without this, VBlank handler can be called with _screen and _subScreen
not yet initialized.

Changed paths:
    backends/platform/ds/ds-graphics.cpp


diff --git a/backends/platform/ds/ds-graphics.cpp b/backends/platform/ds/ds-graphics.cpp
index e4b8e405915..92ffc042fef 100644
--- a/backends/platform/ds/ds-graphics.cpp
+++ b/backends/platform/ds/ds-graphics.cpp
@@ -162,10 +162,6 @@ void initHardware() {
 	subScTargetX = 0;
 	subScTargetY = 0;
 
-	//irqs are nice
-	irqSet(IRQ_VBLANK, VBlankHandler);
-	irqEnable(IRQ_VBLANK);
-
 #ifdef DISABLE_TEXT_CONSOLE
 	videoSetModeSub(MODE_3_2D | DISPLAY_BG3_ACTIVE);
 
@@ -200,6 +196,10 @@ void OSystem_DS::initGraphics() {
 #ifndef DISABLE_TEXT_CONSOLE
 	_keyboard->init(0, 21, 1, false);
 #endif
+
+	// Setup VBlank IRQ only when we are ready to handle it
+	irqSet(IRQ_VBLANK, DS::VBlankHandler);
+	irqEnable(IRQ_VBLANK);
 }
 
 void OSystem_DS::setMainScreen(int32 x, int32 y, int32 sx, int32 sy) {


Commit: 565af3574b48e3f48bf17cfcd995fd1834621a32
    https://github.com/scummvm/scummvm/commit/565af3574b48e3f48bf17cfcd995fd1834621a32
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-10-12T19:09:06+02:00

Commit Message:
DS: Port to libnds2 and calico

- Use new compilation and linking flags
- libnds deprecates intXX in their headers: avoid this as we define our
  own versions.
- Setup missing graphics settings which are not set anymore by libnds2
  (banks, background clearing)
- Update MaxMod mixer to new API
- Use pmMainLoop as required by calico and handle reset events

Changed paths:
    backends/events/ds/ds-events.cpp
    backends/events/ds/ds-events.h
    backends/mixer/maxmod/maxmod-mixer.cpp
    backends/platform/ds/background.cpp
    backends/platform/ds/ds-graphics.cpp
    backends/platform/ds/ds.mk
    backends/platform/ds/dsmain.cpp
    backends/platform/ds/keyboard.cpp
    backends/platform/ds/osystem_ds.cpp
    backends/platform/ds/portdefs.h
    configure


diff --git a/backends/events/ds/ds-events.cpp b/backends/events/ds/ds-events.cpp
index 8a3e2df3c6d..930c9379cf1 100644
--- a/backends/events/ds/ds-events.cpp
+++ b/backends/events/ds/ds-events.cpp
@@ -19,11 +19,26 @@
  *
  */
 
+#include <portdefs.h> // Protect uintXX typedefs
 #include <nds.h>
 
 #include "backends/events/ds/ds-events.h"
 #include "backends/platform/ds/osystem_ds.h"
 
+bool DSEventManager::pollEvent(Common::Event &event) {
+	// Power events
+	if (!pmMainLoop() && !_dsReset) {
+		_dsReset = true;
+
+		event = Common::Event();
+		event.type = Common::EVENT_QUIT;
+
+		return true;
+	}
+
+	return DefaultEventManager::pollEvent(event);
+}
+
 bool DSEventSource::pollEvent(Common::Event &event) {
 	// Ensure the mixer and timers are updated frequently
 	g_system->delayMillis(0);
diff --git a/backends/events/ds/ds-events.h b/backends/events/ds/ds-events.h
index f7d5e914064..c85e3b5c066 100644
--- a/backends/events/ds/ds-events.h
+++ b/backends/events/ds/ds-events.h
@@ -24,6 +24,20 @@
 
 #include "common/events.h"
 
+#include "backends/events/default/default-events.h"
+
+/**
+ * The Nintendo DS event manager.
+ * Used to handle power events and force quitting.
+ */
+class DSEventManager : public DefaultEventManager {
+	bool _dsReset;
+public:
+	DSEventManager(Common::EventSource *boss) : DefaultEventManager(boss), _dsReset(false) {}
+	bool pollEvent(Common::Event &event) override;
+	int shouldQuit() const override { return _dsReset || DefaultEventManager::shouldQuit(); }
+};
+
 /**
  * The Nintendo DS event source.
  */
diff --git a/backends/mixer/maxmod/maxmod-mixer.cpp b/backends/mixer/maxmod/maxmod-mixer.cpp
index e4050c8897a..839b9e4dabb 100644
--- a/backends/mixer/maxmod/maxmod-mixer.cpp
+++ b/backends/mixer/maxmod/maxmod-mixer.cpp
@@ -63,15 +63,15 @@ void MaxModMixerManager::init() {
 	sys.mod_count 			= 0;
 	sys.samp_count			= 0;
 	sys.mem_bank			= 0;
-	sys.fifo_channel		= FIFO_MAXMOD;
 	mmInit( &sys );
 
 	_stream.sampling_rate = _freq;
 	_stream.buffer_length = _bufSize / 4;
 	_stream.callback = on_stream_request;
 	_stream.format = MM_STREAM_16BIT_STEREO;
-	_stream.timer = MM_TIMER2;
-	_stream.manual = 1;
+	_stream.thread_stack_size = 0;
+	// Don't create a thread
+	_stream.minus_thread_prio = 1;
 
 	mmStreamOpen( &_stream );
 
diff --git a/backends/platform/ds/background.cpp b/backends/platform/ds/background.cpp
index 95f8a9135c3..2b0bfce8477 100644
--- a/backends/platform/ds/background.cpp
+++ b/backends/platform/ds/background.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include <portdefs.h> // Protect uintXX typedefs
 #include <nds.h>
 
 #include "backends/platform/ds/background.h"
diff --git a/backends/platform/ds/ds-graphics.cpp b/backends/platform/ds/ds-graphics.cpp
index 92ffc042fef..c6ae445c21d 100644
--- a/backends/platform/ds/ds-graphics.cpp
+++ b/backends/platform/ds/ds-graphics.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include <portdefs.h> // Protect uintXX typedefs
 #include <nds.h>
 
 #include "backends/platform/ds/osystem_ds.h"
@@ -146,7 +147,7 @@ void VBlankHandler(void) {
 }
 
 void initHardware() {
-	powerOn(POWER_ALL);
+	pmPowerOn(POWCNT_ALL);
 
 	videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE);
 	vramSetBankA(VRAM_A_MAIN_BG_0x06000000);
@@ -186,6 +187,7 @@ void OSystem_DS::initGraphics() {
 
 	_overlay.create(256, 192, _pfABGR1555);
 	_overlayScreen = new DS::Background(&_overlay, 2, false, 0, false);
+	_overlayScreen->reset();
 	_screen = nullptr;
 #ifdef DISABLE_TEXT_CONSOLE
 	_subScreen = nullptr;
@@ -199,7 +201,6 @@ void OSystem_DS::initGraphics() {
 
 	// Setup VBlank IRQ only when we are ready to handle it
 	irqSet(IRQ_VBLANK, DS::VBlankHandler);
-	irqEnable(IRQ_VBLANK);
 }
 
 void OSystem_DS::setMainScreen(int32 x, int32 y, int32 sx, int32 sy) {
diff --git a/backends/platform/ds/ds.mk b/backends/platform/ds/ds.mk
index d618938d85f..8a2e10e72fd 100644
--- a/backends/platform/ds/ds.mk
+++ b/backends/platform/ds/ds.mk
@@ -28,7 +28,7 @@ dsdist: scummvm.nds $(DIST_FILES_DOCS)
 .PHONY: dsclean dsdist
 
 %.nds: %.elf romfs
-	$(NDSTOOL) -c $@ -9 $< -b $(srcdir)/backends/platform/ds/logo.bmp "$(@F);ScummVM $(VERSION);$(DESCRIPTION)" -d romfs
+	$(NDSTOOL) -c $@ -9 $< -7 $(DEVKITPRO)/calico/bin/ds7_maine.elf -b $(srcdir)/backends/platform/ds/logo.bmp "$(@F);ScummVM calico $(VERSION);$(DESCRIPTION)" -d romfs
 
 romfs: $(DIST_FILES_THEMES) $(DIST_FILES_ENGINEDATA) $(DIST_FILES_NETWORKING) $(DIST_FILES_VKEYBD) $(PLUGINS)
 	@rm -rf romfs
diff --git a/backends/platform/ds/dsmain.cpp b/backends/platform/ds/dsmain.cpp
index 912358845b7..bfbcc4bb334 100644
--- a/backends/platform/ds/dsmain.cpp
+++ b/backends/platform/ds/dsmain.cpp
@@ -64,6 +64,7 @@
 // - Memory size for ite
 // - Try discworld?
 
+#include <portdefs.h> // Protect uintXX typedefs
 #include <nds.h>
 
 #include "backends/platform/ds/osystem_ds.h"
@@ -105,6 +106,7 @@ void fastRamReset() {
 int main(int argc, char **argv) {
 #ifndef DISABLE_TEXT_CONSOLE
 	videoSetModeSub(MODE_0_2D);
+	vramSetBankC(VRAM_C_SUB_BG_0x06200000);
 	consoleInit(NULL, 1, BgType_Text4bpp, BgSize_T_256x256, 30, 0, false, true);
 #endif
 
diff --git a/backends/platform/ds/keyboard.cpp b/backends/platform/ds/keyboard.cpp
index 4d20aa03bdd..a1bcf6a8ef8 100644
--- a/backends/platform/ds/keyboard.cpp
+++ b/backends/platform/ds/keyboard.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include <portdefs.h> // Protect uintXX typedefs
 #include <nds.h>
 
 #include "backends/platform/ds/keyboard.h"
diff --git a/backends/platform/ds/osystem_ds.cpp b/backends/platform/ds/osystem_ds.cpp
index e491a5b0db8..5d9050fa9dd 100644
--- a/backends/platform/ds/osystem_ds.cpp
+++ b/backends/platform/ds/osystem_ds.cpp
@@ -22,6 +22,7 @@
 #define FORBIDDEN_SYMBOL_EXCEPTION_time_h
 #define FORBIDDEN_SYMBOL_EXCEPTION_printf
 
+#include <portdefs.h> // Protect uintXX typedefs
 #include <nds.h>
 #include <filesystem.h>
 
@@ -83,7 +84,7 @@ void OSystem_DS::initBackend() {
 	ConfMan.setBool("FM_medium_quality", true);
 
 	_eventSource = new DSEventSource();
-	_eventManager = new DefaultEventManager(_eventSource);
+	_eventManager = new DSEventManager(_eventSource);
 
 	_savefileManager = new DefaultSaveFileManager();
 	_timerManager = new DefaultTimerManager();
diff --git a/backends/platform/ds/portdefs.h b/backends/platform/ds/portdefs.h
index 84a7a890599..0ba37e0142e 100644
--- a/backends/platform/ds/portdefs.h
+++ b/backends/platform/ds/portdefs.h
@@ -22,9 +22,31 @@
 #ifndef _PORTDEFS_H_
 #define _PORTDEFS_H_
 
-// Include ndstypes.h for uint16 etc. typedefs
+/**
+ * Include ndstypes.h for uint16 etc. typedefs
+ * These are deprecated so they clash with our typedefs
+ * Mask them by renaming them when including the header
+ */
+#define uint8  __nds_uint8
+#define uint16 __nds_uint16
+#define uint32 __nds_uint32
+#define uint64 __nds_uint64
+#define int8  __nds_int8
+#define int16 __nds_int16
+#define int32 __nds_int32
+#define int64 __nds_int64
+
 #include "nds/ndstypes.h"
 
+#undef uint8
+#undef uint16
+#undef uint32
+#undef uint64
+#undef int8
+#undef int16
+#undef int32
+#undef int64
+
 // Include required headers
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/configure b/configure
index 58a1191435d..1648f5811ac 100755
--- a/configure
+++ b/configure
@@ -3245,6 +3245,7 @@ EOF
 		append_var DEFINES "-DARM9"
 		append_var DEFINES "-DARM"
 		append_var DEFINES "-DNONSTANDARD_PORT"
+		append_var CXXFLAGS "-I $DEVKITPRO/calico/include"
 		append_var CXXFLAGS "-isystem $DEVKITPRO/libnds/include"
 		append_var CXXFLAGS "-isystem $DEVKITPRO/portlibs/nds/include"
 		append_var CXXFLAGS "-isystem $DEVKITPRO/portlibs/armv5te/include"
@@ -3264,14 +3265,16 @@ EOF
 		append_var LDFLAGS "-mthumb-interwork"
 		append_var LDFLAGS "-mfloat-abi=soft"
 		append_var LDFLAGS "-Wl,-Map,map.txt"
+		append_var LDFLAGS "-L$DEVKITPRO/calico/lib"
 		append_var LDFLAGS "-L$DEVKITPRO/libnds/lib"
 		append_var LDFLAGS "-L$DEVKITPRO/portlibs/nds/lib"
 		append_var LDFLAGS "-L$DEVKITPRO/portlibs/armv5te/lib"
-		append_var LIBS "-specs=ds_arm9.specs"
+		append_var LDFLAGS "-specs=$DEVKITPRO/calico/share/ds9.specs"
 		append_var LIBS "-lfilesystem"
 		append_var LIBS "-lfat"
 		append_var LIBS "-lmm9"
 		append_var LIBS "-lnds9"
+		append_var LIBS "-lcalico_ds9"
 		;;
 	emscripten)
 		append_var DEFINES "-DEMSCRIPTEN"


Commit: c377109a16e93ffbd7dc4f581918b0f3334d1a30
    https://github.com/scummvm/scummvm/commit/c377109a16e93ffbd7dc4f581918b0f3334d1a30
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-10-12T19:09:06+02:00

Commit Message:
DS: Ensure that __NDS__ is defined

Changed paths:
    configure


diff --git a/configure b/configure
index 1648f5811ac..4da461c8d04 100755
--- a/configure
+++ b/configure
@@ -3241,7 +3241,7 @@ EOF
 	ds)
 		_optimization_level=-Os
 		append_var DEFINES "-D__DS__"
-		append_var DEFINES "-DNDS"
+		append_var DEFINES "-D__NDS__"
 		append_var DEFINES "-DARM9"
 		append_var DEFINES "-DARM"
 		append_var DEFINES "-DNONSTANDARD_PORT"


Commit: fefe3d5ca956f101c1be80a4b116278ef5c04649
    https://github.com/scummvm/scummvm/commit/fefe3d5ca956f101c1be80a4b116278ef5c04649
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-10-12T19:09:06+02:00

Commit Message:
DS: Flush data cache before running DMA transfers

Changed paths:
    backends/platform/ds/background.cpp
    backends/platform/ds/ds-graphics.cpp


diff --git a/backends/platform/ds/background.cpp b/backends/platform/ds/background.cpp
index 2b0bfce8477..036cbeff521 100644
--- a/backends/platform/ds/background.cpp
+++ b/backends/platform/ds/background.cpp
@@ -114,6 +114,7 @@ Background::Background(Graphics::Surface *surface, int layer, bool isSub, int ma
 static void dmaBlit(uint16 *dst, const uint dstPitch, const uint16 *src, const uint srcPitch,
 					const uint w, const uint h, const uint bytesPerPixel) {
 	if (dstPitch == srcPitch && ((w * bytesPerPixel) == dstPitch)) {
+		DC_FlushRange(src, dstPitch * h);
 		dmaCopy(src, dst, dstPitch * h);
 		return;
 	}
@@ -230,6 +231,7 @@ void TiledBackground::update() {
 	if (_bg < 0)
 		return;
 
+	// Tiles come from code memory: they don't need to be flushed
 	dmaCopy(_tiles, bgGetGfxPtr(_bg), _tilesLen);
 	dmaCopy(_map, bgGetMapPtr(_bg), _mapLen);
 }
diff --git a/backends/platform/ds/ds-graphics.cpp b/backends/platform/ds/ds-graphics.cpp
index c6ae445c21d..d260b563a1e 100644
--- a/backends/platform/ds/ds-graphics.cpp
+++ b/backends/platform/ds/ds-graphics.cpp
@@ -170,6 +170,7 @@ void initHardware() {
 
 	/* The extended palette data can only be accessed in LCD mode. */
 	vramSetBankH(VRAM_H_LCD);
+	// bannerPal comes from code memory: it doesn't need to be flushed
 	dmaCopy(bannerPal, &VRAM_H_EXT_PALETTE[1][0], bannerPalLen);
 	vramSetBankH(VRAM_H_SUB_BG_EXT_PALETTE);
 #endif
@@ -529,6 +530,7 @@ void OSystem_DS::updateScreen() {
 	oamUpdate(&oamMain);
 
 	if (_paletteDirty) {
+		DC_FlushRange(_palette, 256 * 2);
 		dmaCopyHalfWords(3, _palette, BG_PALETTE, 256 * 2);
 #ifdef DISABLE_TEXT_CONSOLE
 		if (_subScreen && _subScreenActive)




More information about the Scummvm-git-logs mailing list