From a527e8cdcbd954ff1c66cfd58c9f7f957eefe1a4 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Sun, 24 May 2026 03:26:59 -0500 Subject: [PATCH 1/3] sunset the old Modules implementation not relevant since we move to in-process --- library/CMakeLists.txt | 2 - library/Core.cpp | 21 ---------- library/include/Core.h | 5 --- library/include/Module.h | 59 ----------------------------- library/include/ModuleFactory.h | 38 ------------------- library/include/modules/Materials.h | 1 - library/modules/Buildings.cpp | 1 - library/modules/Gui.cpp | 1 - library/modules/Items.cpp | 1 - library/modules/Kitchen.cpp | 1 - library/modules/MapCache.cpp | 1 - library/modules/Maps.cpp | 1 - library/modules/Materials.cpp | 1 - library/modules/Random.cpp | 1 - library/modules/Screen.cpp | 1 - library/modules/Units.cpp | 1 - 16 files changed, 136 deletions(-) delete mode 100644 library/include/Module.h delete mode 100644 library/include/ModuleFactory.h diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 6da4909968..d87e20531e 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -66,10 +66,8 @@ set(MAIN_HEADERS include/MemAccess.h include/Memory.h include/MiscUtils.h - include/Module.h include/MemAccess.h include/MemoryPatcher.h - include/ModuleFactory.h include/PluginLua.h include/PluginManager.h include/PluginStatics.h diff --git a/library/Core.cpp b/library/Core.cpp index 50c6fe5f8b..ec105a6c6b 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -40,8 +40,6 @@ distribution. #include "MemoryPatcher.h" #include "MiscUtils.h" #include "MiscUtils.h" -#include "Module.h" -#include "ModuleFactory.h" #include "PluginManager.h" #include "RemoteServer.h" #include "RemoteTools.h" @@ -1047,7 +1045,6 @@ Core::Core() : plug_mgr = nullptr; errorstate = false; vinfo = 0; - memset(&(s_mods), 0, sizeof(s_mods)); // set up hotkey capture suppress_duplicate_keyboard_events = true; @@ -1949,11 +1946,9 @@ int Core::Shutdown ( void ) plug_mgr = nullptr; } // invalidate all modules - allModules.clear(); Textures::cleanup(); DFSDL::cleanup(); DFSteam::cleanup(getConsole()); - memset(&(s_mods), 0, sizeof(s_mods)); d.reset(); return -1; } @@ -2184,19 +2179,3 @@ std::string Core::GetAliasCommand(const std::string &name, bool ignore_params) return join_strings(" ", aliases[name]); } -/******************************************************************************* - M O D U L E S -*******************************************************************************/ - -#define MODULE_GETTER(TYPE) \ -TYPE * Core::get##TYPE() \ -{ \ - if(errorstate) return nullptr;\ - if(!s_mods.p##TYPE)\ - {\ - std::unique_ptr mod = create##TYPE();\ - s_mods.p##TYPE = (TYPE *) mod.get();\ - allModules.push_back(std::move(mod));\ - }\ - return s_mods.p##TYPE;\ -} diff --git a/library/include/Core.h b/library/include/Core.h index 085dd33cf1..8b78e58097 100644 --- a/library/include/Core.h +++ b/library/include/Core.h @@ -288,11 +288,6 @@ namespace DFHack // FIXME: shouldn't be kept around like this std::unique_ptr vif; - // Module storage - struct - { - } s_mods; - std::vector> allModules; DFHack::PluginManager *plug_mgr; // Hotkey Manager diff --git a/library/include/Module.h b/library/include/Module.h deleted file mode 100644 index 7770e13970..0000000000 --- a/library/include/Module.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -https://github.com/peterix/dfhack -Copyright (c) 2009-2012 Petr Mrázek (peterix@gmail.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#pragma once - -#ifndef MODULE_H_INCLUDED -#define MODULE_H_INCLUDED - -#include "Export.h" -namespace DFHack -{ - /** - * The parent class for all DFHack modules - * \ingroup grp_modules - */ - class DFHACK_EXPORT Module - { - public: - virtual ~Module(){}; - virtual bool Start(){return true;};// default start... - virtual bool Finish() = 0;// everything should have a Finish() - /* - // should Context call Finish when Resume is called? - virtual bool OnResume() - { - Finish(); - return true; - }; - // Finish when map change is detected? - // TODO: implement - virtual bool OnMapChange() - { - return false; - }; - */ - }; -} -#endif //MODULE_H_INCLUDED diff --git a/library/include/ModuleFactory.h b/library/include/ModuleFactory.h deleted file mode 100644 index c99e7b3289..0000000000 --- a/library/include/ModuleFactory.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -https://github.com/peterix/dfhack -Copyright (c) 2009-2012 Petr Mrázek (peterix@gmail.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#pragma once - -#ifndef MODULE_FACTORY_H_INCLUDED -#define MODULE_FACTORY_H_INCLUDED - -#include - -namespace DFHack -{ - class Module; - std::unique_ptr createMaterials(); - std::unique_ptr createGraphic(); -} -#endif diff --git a/library/include/modules/Materials.h b/library/include/modules/Materials.h index 9689c7790c..1f87f548ff 100644 --- a/library/include/modules/Materials.h +++ b/library/include/modules/Materials.h @@ -30,7 +30,6 @@ distribution. * @ingroup grp_modules */ #include "Export.h" -#include "Module.h" #include "DataDefs.h" #include "df/craft_material_class.h" diff --git a/library/modules/Buildings.cpp b/library/modules/Buildings.cpp index e5a0af116b..ddedbbc1b6 100644 --- a/library/modules/Buildings.cpp +++ b/library/modules/Buildings.cpp @@ -29,7 +29,6 @@ distribution. #include "MemAccess.h" #include "Types.h" #include "Error.h" -#include "ModuleFactory.h" #include "Core.h" #include "TileTypes.h" #include "MiscUtils.h" diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 06de785a39..e7c8233ba1 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -30,7 +30,6 @@ distribution. #include "VersionInfo.h" #include "Types.h" #include "Error.h" -#include "ModuleFactory.h" #include "Core.h" #include "Debug.h" #include "PluginManager.h" diff --git a/library/modules/Items.cpp b/library/modules/Items.cpp index adce8ba8a6..6b5b3ee1d2 100644 --- a/library/modules/Items.cpp +++ b/library/modules/Items.cpp @@ -28,7 +28,6 @@ distribution. #include "Internal.h" #include "MemAccess.h" #include "MiscUtils.h" -#include "ModuleFactory.h" #include "Types.h" #include "VersionInfo.h" diff --git a/library/modules/Kitchen.cpp b/library/modules/Kitchen.cpp index be1415d90d..c9d4c7d5c6 100644 --- a/library/modules/Kitchen.cpp +++ b/library/modules/Kitchen.cpp @@ -14,7 +14,6 @@ using namespace std; #include "Types.h" #include "Error.h" #include "modules/Kitchen.h" -#include "ModuleFactory.h" #include "Core.h" using namespace DFHack; diff --git a/library/modules/MapCache.cpp b/library/modules/MapCache.cpp index c01f5bf576..603d1d0da2 100644 --- a/library/modules/MapCache.cpp +++ b/library/modules/MapCache.cpp @@ -30,7 +30,6 @@ distribution. #include "Error.h" #include "MemAccess.h" #include "MiscUtils.h" -#include "ModuleFactory.h" #include "VersionInfo.h" #include "modules/Buildings.h" diff --git a/library/modules/Maps.cpp b/library/modules/Maps.cpp index 11499a4270..2376936054 100644 --- a/library/modules/Maps.cpp +++ b/library/modules/Maps.cpp @@ -31,7 +31,6 @@ distribution. #include "Error.h" #include "MemAccess.h" #include "MiscUtils.h" -#include "ModuleFactory.h" #include "VersionInfo.h" #include "modules/Buildings.h" diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index 3351726d57..dba8a78132 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -28,7 +28,6 @@ distribution. #include "VersionInfo.h" #include "MemAccess.h" #include "Error.h" -#include "ModuleFactory.h" #include "Core.h" #include "MiscUtils.h" diff --git a/library/modules/Random.cpp b/library/modules/Random.cpp index f0d2054c9e..d6d682d921 100644 --- a/library/modules/Random.cpp +++ b/library/modules/Random.cpp @@ -35,7 +35,6 @@ using namespace std; #include "VersionInfo.h" #include "MemAccess.h" #include "Types.h" -#include "ModuleFactory.h" #include "Core.h" #include "Error.h" #include "VTableInterpose.h" diff --git a/library/modules/Screen.cpp b/library/modules/Screen.cpp index d629c4b8cf..b16a3e9b0e 100644 --- a/library/modules/Screen.cpp +++ b/library/modules/Screen.cpp @@ -28,7 +28,6 @@ distribution. #include "VersionInfo.h" #include "Types.h" #include "Error.h" -#include "ModuleFactory.h" #include "Core.h" #include "PluginManager.h" #include "LuaTools.h" diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 707437ea34..00821c11c0 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -27,7 +27,6 @@ distribution. #include "Internal.h" #include "MemAccess.h" #include "MiscUtils.h" -#include "ModuleFactory.h" #include "Types.h" #include "VersionInfo.h" From 2c164932af0c2a401e10dec54086db6c13b1a716 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Sun, 24 May 2026 03:44:51 -0500 Subject: [PATCH 2/3] missed one --- library/modules/Translation.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/library/modules/Translation.cpp b/library/modules/Translation.cpp index 38ae2c51ba..097de85cc9 100644 --- a/library/modules/Translation.cpp +++ b/library/modules/Translation.cpp @@ -27,7 +27,6 @@ distribution. #include "VersionInfo.h" #include "MemAccess.h" #include "Types.h" -#include "ModuleFactory.h" #include "Core.h" #include "Error.h" #include "DataDefs.h" From 5a8c9f3559122b0719c3d3ecc4ae9b9508a677a8 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Sun, 24 May 2026 03:45:45 -0500 Subject: [PATCH 3/3] Update Core.cpp --- library/Core.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/library/Core.cpp b/library/Core.cpp index ec105a6c6b..00419bd7ae 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -2178,4 +2178,3 @@ std::string Core::GetAliasCommand(const std::string &name, bool ignore_params) return aliases[name][0]; return join_strings(" ", aliases[name]); } -