[Scummvm-git-logs] scummvm master -> 9d15e4cebe09395f22e0b8d50889e520a8deab02

lephilousophe noreply at scummvm.org
Wed Dec 11 20:39:51 UTC 2024


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

Summary:
6fbe181428 BACKENDS: SDL: Call ImGui callback functions when changing them
7dfe3a6389 DIRECTOR: Cleanup ImGui callbacks after running
72614ed458 QDENGINE: Cleanup ImGui callbacks after running
ecca8b4a41 TWINE: Cleanup ImGui callbacks after running
9d15e4cebe TWP: Cleanup ImGui callbacks after running


Commit: 6fbe181428168502c75f1c70b6be271ffcc8e748
    https://github.com/scummvm/scummvm/commit/6fbe181428168502c75f1c70b6be271ffcc8e748
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-11T21:39:45+01:00

Commit Message:
BACKENDS: SDL: Call ImGui callback functions when changing them

This ensures a good cleanup and init when switching.

Changed paths:
    backends/graphics/sdl/sdl-graphics.cpp
    backends/graphics/sdl/sdl-graphics.h


diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index 8de597a29e4..e2fd1e9342a 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -552,6 +552,26 @@ Common::Keymap *SdlGraphicsManager::getKeymap() {
 }
 
 #if defined(USE_IMGUI) && SDL_VERSION_ATLEAST(2, 0, 0)
+void SdlGraphicsManager::setImGuiCallbacks(const ImGuiCallbacks &callbacks) {
+	if (_imGuiInited) {
+		if (_imGuiCallbacks.cleanup) {
+			_imGuiCallbacks.cleanup();
+		}
+		_imGuiInited = false;
+	}
+
+	_imGuiCallbacks = callbacks;
+
+	if (!_imGuiReady) {
+		return;
+	}
+
+	if (_imGuiCallbacks.init) {
+		_imGuiCallbacks.init();
+	}
+	_imGuiInited = true;
+}
+
 void SdlGraphicsManager::initImGui(SDL_Renderer *renderer, void *glContext) {
 	assert(!_imGuiReady);
 	_imGuiInited = false;
@@ -613,8 +633,8 @@ void SdlGraphicsManager::initImGui(SDL_Renderer *renderer, void *glContext) {
 
 	if (_imGuiCallbacks.init) {
 		_imGuiCallbacks.init();
-		_imGuiInited = true;
 	}
+	_imGuiInited = true;
 }
 
 void SdlGraphicsManager::renderImGui() {
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index 17a3bfde115..af5d76514f6 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -210,7 +210,7 @@ private:
 
 #if defined(USE_IMGUI) && SDL_VERSION_ATLEAST(2, 0, 0)
 public:
-	void setImGuiCallbacks(const ImGuiCallbacks &callbacks) override { _imGuiCallbacks = callbacks; }
+	void setImGuiCallbacks(const ImGuiCallbacks &callbacks) override;
 
 protected:
 	ImGuiCallbacks _imGuiCallbacks;


Commit: 7dfe3a63892923890db6ecb30b724476be259419
    https://github.com/scummvm/scummvm/commit/7dfe3a63892923890db6ecb30b724476be259419
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-11T21:39:45+01:00

Commit Message:
DIRECTOR: Cleanup ImGui callbacks after running

Changed paths:
    engines/director/director.cpp


diff --git a/engines/director/director.cpp b/engines/director/director.cpp
index 97ed9d5fe27..ef49735a1bb 100644
--- a/engines/director/director.cpp
+++ b/engines/director/director.cpp
@@ -332,6 +332,10 @@ Common::Error DirectorEngine::run() {
 #endif
 	}
 
+#ifdef USE_IMGUI
+	_system->setImGuiCallbacks(ImGuiCallbacks());
+#endif
+
 	return Common::kNoError;
 }
 


Commit: 72614ed458b2d35f3c7edc44a98f6ff68a3d47f0
    https://github.com/scummvm/scummvm/commit/72614ed458b2d35f3c7edc44a98f6ff68a3d47f0
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-11T21:39:45+01:00

Commit Message:
QDENGINE: Cleanup ImGui callbacks after running

Changed paths:
    engines/qdengine/qdengine.cpp


diff --git a/engines/qdengine/qdengine.cpp b/engines/qdengine/qdengine.cpp
index 80ea714be15..02e9b69dab3 100644
--- a/engines/qdengine/qdengine.cpp
+++ b/engines/qdengine/qdengine.cpp
@@ -324,6 +324,10 @@ Common::Error QDEngineEngine::run() {
 		g_system->delayMillis(10);
 	}
 
+#ifdef USE_IMGUI
+	_system->setImGuiCallbacks(ImGuiCallbacks());
+#endif
+
 	delete _gameD;
 
 	grDispatcher::instance()->finit();


Commit: ecca8b4a413c933696a57c58632e4d566669b02c
    https://github.com/scummvm/scummvm/commit/ecca8b4a413c933696a57c58632e4d566669b02c
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-11T21:39:45+01:00

Commit Message:
TWINE: Cleanup ImGui callbacks after running

Changed paths:
    engines/twine/twine.cpp


diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 03c27e1c83d..78912b5e46c 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -337,6 +337,10 @@ Common::Error TwinEEngine::run() {
 		if (saveSlot >= 0 && saveSlot <= 999) {
 			Common::Error state = loadGameState(saveSlot);
 			if (state.getCode() != Common::kNoError) {
+#ifdef USE_IMGUI
+				_system->setImGuiCallbacks(ImGuiCallbacks());
+#endif
+
 				return state;
 			}
 		}
@@ -415,6 +419,11 @@ Common::Error TwinEEngine::run() {
 
 	_sound->stopSamples();
 	_music->stopMusic();
+
+#ifdef USE_IMGUI
+	_system->setImGuiCallbacks(ImGuiCallbacks());
+#endif
+
 	return Common::kNoError;
 }
 


Commit: 9d15e4cebe09395f22e0b8d50889e520a8deab02
    https://github.com/scummvm/scummvm/commit/9d15e4cebe09395f22e0b8d50889e520a8deab02
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-12-11T21:39:45+01:00

Commit Message:
TWP: Cleanup ImGui callbacks after running

Changed paths:
    engines/twp/twp.cpp


diff --git a/engines/twp/twp.cpp b/engines/twp/twp.cpp
index f03d6260cc0..f2d859c578b 100644
--- a/engines/twp/twp.cpp
+++ b/engines/twp/twp.cpp
@@ -1320,6 +1320,10 @@ Common::Error TwpEngine::run() {
 		}
 	}
 
+#ifdef USE_IMGUI
+	_system->setImGuiCallbacks(ImGuiCallbacks());
+#endif
+
 	return Common::kNoError;
 }
 




More information about the Scummvm-git-logs mailing list