[Scummvm-git-logs] scummvm master -> 3dc700cb474ee127e101cab1a4a356c547e7905f
sev-
noreply at scummvm.org
Fri Feb 13 09:17:06 UTC 2026
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
3dc700cb47 SCUMM: Introduce ScummEditor
Commit: 3dc700cb474ee127e101cab1a4a356c547e7905f
https://github.com/scummvm/scummvm/commit/3dc700cb474ee127e101cab1a4a356c547e7905f
Author: Sebastien Ronsse (sronsse at gmail.com)
Date: 2026-02-13T10:17:01+01:00
Commit Message:
SCUMM: Introduce ScummEditor
Changed paths:
A engines/scumm/debugger/debugtools.cpp
A engines/scumm/debugger/debugtools.h
A engines/scumm/debugger/editor.cpp
A engines/scumm/debugger/editor.h
engines/scumm/configure.engine
engines/scumm/detection.cpp
engines/scumm/detection.h
engines/scumm/module.mk
engines/scumm/scumm.cpp
engines/scumm/scumm.h
diff --git a/engines/scumm/configure.engine b/engines/scumm/configure.engine
index 389c16636cf..9e36dfb23c0 100644
--- a/engines/scumm/configure.engine
+++ b/engines/scumm/configure.engine
@@ -1,5 +1,5 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] [components]
-add_engine scumm "SCUMM" yes "scumm_7_8 he" "v0-v6 games" "" "midi fmtowns_pc98_audio sid_audio"
+add_engine scumm "SCUMM" yes "scumm_7_8 he" "v0-v6 games" "" "midi fmtowns_pc98_audio sid_audio imgui"
add_engine scumm_7_8 "v7 & v8 games" yes
add_engine he "HE71+ games" yes "" "" "highres bink" "enet"
diff --git a/engines/scumm/debugger/debugtools.cpp b/engines/scumm/debugger/debugtools.cpp
new file mode 100644
index 00000000000..a4688d3c3b0
--- /dev/null
+++ b/engines/scumm/debugger/debugtools.cpp
@@ -0,0 +1,65 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "backends/imgui/IconsMaterialSymbols.h"
+#include "backends/imgui/imgui.h"
+#include "backends/imgui/imgui_fonts.h"
+
+#include "scumm/scumm.h"
+
+#include "scumm/debugger/editor.h"
+
+namespace Scumm {
+
+namespace Editor {
+
+ScummEditor *g_editor = nullptr;
+
+void onImGuiInit() {
+ // Add built-in default font
+ ImGuiIO &io = ImGui::GetIO();
+ io.Fonts->AddFontDefault();
+
+ // Merge icon font
+ ImFontConfig iconConfig;
+ iconConfig.MergeMode = true;
+ iconConfig.PixelSnapH = false;
+ iconConfig.OversampleH = 3;
+ iconConfig.OversampleV = 3;
+ iconConfig.GlyphOffset = {0, 4};
+ static const ImWchar iconRanges[] = {ICON_MIN_MS, ICON_MAX_MS, 0};
+ ImGui::addTTFFontFromArchive("MaterialSymbolsSharp.ttf", 16.f, &iconConfig, iconRanges);
+
+ g_editor = new ScummEditor(g_scumm);
+}
+
+void onImGuiRender() {
+ g_editor->render();
+}
+
+void onImGuiCleanup() {
+ delete g_editor;
+ g_editor = nullptr;
+}
+
+} // End of namespace Editor
+
+} // End of namespace Scumm
diff --git a/engines/scumm/debugger/debugtools.h b/engines/scumm/debugger/debugtools.h
new file mode 100644
index 00000000000..b7906589376
--- /dev/null
+++ b/engines/scumm/debugger/debugtools.h
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SCUMM_DEBUGTOOLS_H
+#define SCUMM_DEBUGTOOLS_H
+
+namespace Scumm {
+
+namespace Editor {
+
+void onImGuiInit();
+void onImGuiRender();
+void onImGuiCleanup();
+
+} // namespace Editor
+
+} // namespace Scumm
+
+#endif
diff --git a/engines/scumm/debugger/editor.cpp b/engines/scumm/debugger/editor.cpp
new file mode 100644
index 00000000000..60d6075e006
--- /dev/null
+++ b/engines/scumm/debugger/editor.cpp
@@ -0,0 +1,102 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "backends/imgui/IconsMaterialSymbols.h"
+#include "backends/imgui/imgui.h"
+
+#include "common/config-manager.h"
+#include "common/formats/json.h"
+#include "common/savefile.h"
+
+#include "scumm/scumm.h"
+
+#include "scumm/debugger/editor.h"
+
+namespace Scumm {
+
+static const char *saveStateFileName = "ImGuiSaveState.json";
+
+ScummEditor::ScummEditor(ScummEngine *engine)
+ : _engine(engine),
+ _gameName(ConfMan.get("gameid")) {
+ loadState();
+}
+
+void ScummEditor::loadState() {
+ // Read from save file
+ Common::InSaveFile *stream = g_engine->getSaveFileManager()->openForLoading(saveStateFileName);
+ if (!stream || stream->size() == 0) {
+ delete stream;
+ return;
+ }
+
+ // Parse JSON
+ char *data = (char *)malloc(stream->size() + 1);
+ data[stream->size()] = '\0';
+ stream->read(data, stream->size());
+ Common::JSONValue *state = Common::JSON::parse(data);
+ free(data);
+ delete stream;
+ if (!state)
+ return;
+
+ // Load state
+ if (state->asObject().contains("IniSettings")) {
+ const char *iniSettings = state->asObject()["IniSettings"]->asString().c_str();
+ ImGui::LoadIniSettingsFromMemory(iniSettings);
+ }
+ delete state;
+}
+
+void ScummEditor::saveState() {
+ // Save state
+ Common::JSONObject json;
+ const char *iniSettings = ImGui::SaveIniSettingsToMemory();
+ json["IniSettings"] = new Common::JSONValue(iniSettings);
+
+ // Write to save file
+ Common::JSONValue state(json);
+ Common::OutSaveFile *stream = g_engine->getSaveFileManager()->openForSaving(saveStateFileName);
+ if (stream) {
+ stream->writeString(state.stringify());
+ stream->finalize();
+ }
+ delete stream;
+}
+
+void ScummEditor::render() {
+ // Menu bar
+ if (ImGui::BeginMainMenuBar()) {
+ ImGui::Text(ICON_MS_CONSTRUCTION);
+ ImGui::TextDisabled(_gameName.c_str());
+ ImGui::Separator();
+ if (ImGui::BeginMenu("File")) {
+ if (ImGui::MenuItem("Quit"))
+ _engine->quitGame();
+ ImGui::EndMenu();
+ }
+ ImGui::EndMainMenuBar();
+ }
+
+ saveState();
+}
+
+} // End of namespace Scumm
diff --git a/engines/scumm/debugger/editor.h b/engines/scumm/debugger/editor.h
new file mode 100644
index 00000000000..dd5f47cd091
--- /dev/null
+++ b/engines/scumm/debugger/editor.h
@@ -0,0 +1,47 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SCUMM_EDITOR_H
+#define SCUMM_EDITOR_H
+
+#include "common/str.h"
+
+namespace Scumm {
+
+class ScummEngine;
+
+class ScummEditor {
+private:
+ ScummEngine *_engine;
+ Common::String _gameName;
+
+ void loadState();
+ void saveState();
+
+public:
+ ScummEditor(ScummEngine *engine);
+
+ void render();
+};
+
+} // End of namespace Scumm
+
+#endif
diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index f8f7175e5e4..a878f223801 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -65,6 +65,7 @@ static const DebugChannelDef debugFlagList[] = {
{Scumm::DEBUG_SMUSH, "SMUSH", "Track SMUSH"},
{Scumm::DEBUG_MOONBASE_AI, "MOONBASEAI", "Track Moonbase AI"},
{Scumm::DEBUG_NETWORK, "NETWORK", "Track Networking"},
+ {Scumm::DEBUG_IMGUI, "IMGUI", "Show ImGui debug window (if available)"},
DEBUG_CHANNEL_END
};
diff --git a/engines/scumm/detection.h b/engines/scumm/detection.h
index 19eaea2e458..52da1fb5d4b 100644
--- a/engines/scumm/detection.h
+++ b/engines/scumm/detection.h
@@ -280,6 +280,7 @@ enum {
DEBUG_SMUSH, // Track SMUSH
DEBUG_MOONBASE_AI, // Moonbase AI
DEBUG_NETWORK, // Track Networking
+ DEBUG_IMGUI, // Show ImGui debug window (if available)
};
} // End of namespace Scumm
diff --git a/engines/scumm/module.mk b/engines/scumm/module.mk
index fd331397d31..3448b103f82 100644
--- a/engines/scumm/module.mk
+++ b/engines/scumm/module.mk
@@ -95,6 +95,12 @@ MODULE_OBJS := \
vars.o \
verbs.o
+ifdef USE_IMGUI
+MODULE_OBJS += \
+ debugger/debugtools.o \
+ debugger/editor.o
+endif
+
ifdef USE_ARM_COSTUME_ASM
MODULE_OBJS += \
proc3ARM.o
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 9202ff34db8..ee17a31da01 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -92,6 +92,7 @@
#include "scumm/imuse/drivers/macintosh.h"
#include "scumm/imuse/drivers/midi.h"
#include "scumm/detection_steam.h"
+#include "scumm/debugger/debugtools.h"
#ifdef ENABLE_HE
#ifdef USE_ENET
@@ -2684,6 +2685,16 @@ Common::Error ScummEngine::go() {
}
#endif // ENABLE_HE
+#ifdef USE_IMGUI
+ if (debugChannelSet(-1, DEBUG_IMGUI)) {
+ ImGuiCallbacks callbacks;
+ callbacks.init = Editor::onImGuiInit;
+ callbacks.render = Editor::onImGuiRender;
+ callbacks.cleanup = Editor::onImGuiCleanup;
+ _system->setImGuiCallbacks(callbacks);
+ }
+#endif
+
while (!shouldQuit()) {
// Determine how long to wait before the next loop iteration should start
int delta = (VAR_TIMER_NEXT != 0xFF) ? VAR(VAR_TIMER_NEXT) : 4;
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 99e7660fc23..40131598084 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -520,6 +520,7 @@ class ScummEngine : public Engine, public Common::Serializable {
friend class MacV5Gui;
friend class MacV6Gui;
friend class LogicHEBasketball;
+ friend class ScummEditor;
public:
/* Put often used variables at the top.
More information about the Scummvm-git-logs
mailing list