diff --git a/.gitignore b/.gitignore
index 24e5a61..9abee01 100644
--- a/.gitignore
+++ b/.gitignore
@@ -35,3 +35,15 @@ H3.Plugin.Template/bin/Release/H3.Plugin.Template.vsix
H3API/lib/h3api/Backups/
H3API/lib/h3api/H3Development/
H3API/lib/h3api/H3_Development.hpp
+*.nupkg
+*.p7s
+packages/Microsoft.VSSDK.VsixSignTool.16.2.29116.78/tools/vssdk/vsixsigntool.exe
+*.vstman
+H3.Plugin.Template/obj/Release/ProjectTemplates/H3Plugin.Template/SRC/framework.cpp
+H3.Plugin.Template/obj/Release/ProjectTemplates/H3Plugin.Template/SRC/dllmain.cpp
+H3.Plugin.Template/obj/Release/ProjectTemplates/H3Plugin.Template/PluginTemplate.vcxproj.filters
+H3.Plugin.Template/obj/Release/ProjectTemplates/H3Plugin.Template/PluginTemplate.vcxproj
+H3.Plugin.Template/obj/Release/ProjectTemplates/H3Plugin.Template/MyTemplate.vstemplate
+H3.Plugin.Template/obj/Release/ProjectTemplates/H3Plugin.Template/INCLUDE/framework.hpp
+H3.Plugin.Template/obj/Release/H3.Plugin.Template.csproj.VsixDeployedFileListAbsolute.txt
+H3.Plugin.Template/obj/Release/H3.Plugin.Template.csproj.FileListAbsolute.txt
diff --git a/AssetLoader/AssetLoader.vcxproj b/AssetLoader/AssetLoader.vcxproj
new file mode 100644
index 0000000..849acca
--- /dev/null
+++ b/AssetLoader/AssetLoader.vcxproj
@@ -0,0 +1,125 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ 16.0
+ Win32Proj
+ {b68120c1-a317-4518-9c80-6ac239d3b8f8}
+ AssetLoader
+ 7.0
+
+
+
+ DynamicLibrary
+ true
+ v141_xp
+ NotSet
+
+
+ DynamicLibrary
+ false
+ v141_xp
+ true
+ NotSet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+
+ Level3
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;_DEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ /Zc:threadSafeInit- %(AdditionalOptions)
+
+
+ Windows
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;NDEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ MultiThreaded
+ /Zc:threadSafeInit- %(AdditionalOptions)
+ true
+
+
+ Windows
+ true
+ true
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+
+
+
+
+
+
+
+ {405b8023-d064-492d-a0df-89b070b26923}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AssetLoader/AssetLoader.vcxproj.filters b/AssetLoader/AssetLoader.vcxproj.filters
new file mode 100644
index 0000000..3135f4f
--- /dev/null
+++ b/AssetLoader/AssetLoader.vcxproj.filters
@@ -0,0 +1,30 @@
+
+
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+
+
+ src
+
+
+ src
+
+
+
+
+ include
+
+
+
\ No newline at end of file
diff --git a/AssetLoader/include/AssetLoader.hpp b/AssetLoader/include/AssetLoader.hpp
new file mode 100644
index 0000000..9205c78
--- /dev/null
+++ b/AssetLoader/include/AssetLoader.hpp
@@ -0,0 +1,64 @@
+#pragma once
+
+#define _H3API_PLUGINS_
+#include
+#include
+
+/**
+ * Uncomment to show an error message when failing to link up with patcher_x86
+ */
+//#define SHOW_ERROR_MESSAGE_ON_FAIL
+
+/**
+ * @brief A derived Plugin that constructs itself
+ */
+class AssetLoaderPlugin : public Plugin
+{
+public:
+ AssetLoaderPlugin() : Plugin()
+ {
+ Status status = Init("H3.AssetLoader");
+ if (status == Status::Success)
+ Start();
+#ifdef SHOW_ERROR_MESSAGE_ON_FAIL
+ else
+ ShowError("H3.AssetLoader", status);
+#endif
+ }
+
+ static AssetLoaderPlugin& GetPlugin();
+
+private:
+ void Start();
+
+public:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can be accessed from anywhere using the plugin.
+ //
+ //======================================================================================
+
+ h3::H3String m_errorMessage;
+
+ h3::H3LoadedPcx* LoadPcxFromFile(LPCSTR const filepath, LPCSTR const h3name);
+ h3::H3WavFile* LoadWavFromFile(LPCSTR const filepath, LPCSTR const h3name);
+ h3::H3LoadedDef* LoadDefFromFile(LPCSTR const filePath, LPCSTR const h3name);
+ int DefFromFile(HookContext& c);
+private:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can only be accessed from within the plugin.
+ //
+ //======================================================================================
+ LPCSTR m_defPath;
+ LoHook* m_defHook;
+
+ bool ValidateParameters(LPCSTR const filepath, LPCSTR const h3name);
+ PUINT8 GetFileBuffer(LPCSTR const filepath, DWORD& fileSize);
+
+ static constexpr CHAR MissingPath[] = "Path not provided.";
+ static constexpr CHAR MissingFileName[] = "File name not provided.";
+ static constexpr CHAR ErrorReadingFile[] = "Could not read file at provided path.";
+ static constexpr CHAR MemoryAllocation[] = "Could not allocate memory.";
+ static constexpr CHAR AlreadyExists[] = "An asset already exists with the provided name.";
+};
\ No newline at end of file
diff --git a/AssetLoader/src/AssetLoader.cpp b/AssetLoader/src/AssetLoader.cpp
new file mode 100644
index 0000000..0c6bf19
--- /dev/null
+++ b/AssetLoader/src/AssetLoader.cpp
@@ -0,0 +1,265 @@
+#include "AssetLoader.hpp"
+
+using namespace h3;
+
+AssetLoaderPlugin AssetLoader;
+
+AssetLoaderPlugin& AssetLoaderPlugin::GetPlugin()
+{
+ return AssetLoader;
+}
+
+//===================================================================================
+//
+// ADDITIONAL METHODS AND STRUCTURES
+//
+//===================================================================================
+
+class TempPatch
+{
+ Patch* p;
+public:
+ TempPatch(Patch* patch) :
+ p(patch)
+ {
+ if (patch)
+ patch->Apply();
+ }
+ ~TempPatch()
+ {
+ if (p)
+ p->Undo();
+ }
+};
+
+static class H3AssetLoaderInternal : public H3Plugin::AssetLoader::H3AssetLoader
+{
+ DWORD m_assetsLoaded;
+public:
+ virtual INT NumberAdded() override;
+ virtual LPCSTR GetLastError() override;
+ virtual H3LoadedPcx* LoadPcxFromFile(LPCSTR const filepath, LPCSTR const h3name) override;
+ virtual H3WavFile* LoadWavFromFile(LPCSTR const filepath, LPCSTR const h3name) override;
+ virtual H3LoadedDef* LoadDefFromFile(LPCSTR const filepath, LPCSTR const h3name) override;
+}InternalAssetLoader;
+
+INT H3AssetLoaderInternal::NumberAdded()
+{
+ return m_assetsLoaded;
+}
+
+LPCSTR H3AssetLoaderInternal::GetLastError()
+{
+ return AssetLoader.m_errorMessage.String();
+}
+
+H3LoadedPcx* H3AssetLoaderInternal::LoadPcxFromFile(LPCSTR const filepath, LPCSTR const h3name)
+{
+ H3LoadedPcx* pcx = AssetLoader.LoadPcxFromFile(filepath, h3name);
+ if (pcx)
+ ++m_assetsLoaded;
+ return pcx;
+}
+
+H3WavFile* H3AssetLoaderInternal::LoadWavFromFile(LPCSTR const filepath, LPCSTR const h3name)
+{
+ H3WavFile* wav = AssetLoader.LoadWavFromFile(filepath, h3name);
+ if (wav)
+ ++m_assetsLoaded;
+ return wav;
+}
+
+H3LoadedDef* H3AssetLoaderInternal::LoadDefFromFile(LPCSTR const filepath, LPCSTR const h3name)
+{
+ H3LoadedDef* def = AssetLoader.LoadDefFromFile(filepath, h3name);
+ if (def)
+ ++m_assetsLoaded;
+ return def;
+}
+
+
+H3Plugin::AssetLoader::H3AssetLoader* GetAssetLoader_()
+{
+#pragma _H3API_EXPORT_
+ return &InternalAssetLoader;
+}
+
+//===================================================================================
+//
+// HOOKS
+//
+//===================================================================================
+
+bool AssetLoaderPlugin::ValidateParameters(LPCSTR const filepath, LPCSTR const h3name)
+{
+ if (!filepath)
+ {
+ m_errorMessage.AssignA(MissingPath);
+ return FALSE;
+ }
+
+ if (!h3name)
+ {
+ m_errorMessage.AssignA(MissingFileName);
+ return FALSE;
+ }
+
+ if (!H3Path::IsFile(filepath))
+ {
+ m_errorMessage.AssignA(ErrorReadingFile);
+ return FALSE;
+ }
+
+ if (P_ResourceManager()->FindItem(h3name))
+ {
+ m_errorMessage.AssignA(AlreadyExists);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
+PUINT8 AssetLoaderPlugin::GetFileBuffer(LPCSTR const filepath, DWORD& fileSize)
+{
+ H3File f;
+ if (!f.Open(filepath) || !f.ReadToBuffer())
+ {
+ m_errorMessage.AssignA(ErrorReadingFile);
+ return nullptr;
+ }
+
+ fileSize = f.Size();
+ return f.ReleaseBuffer();
+}
+
+H3LoadedPcx* AssetLoaderPlugin::LoadPcxFromFile(LPCSTR const filepath, LPCSTR const h3name)
+{
+ H3SEHandler seh;
+ try
+ {
+ if (!ValidateParameters(filepath, h3name))
+ return nullptr;
+
+ auto& pcxAlloc = H3ObjectAllocator();
+ H3LoadedPcx* pcx = pcxAlloc.allocate();
+ if (pcx == nullptr)
+ {
+ m_errorMessage.AssignA(MemoryAllocation);
+ return nullptr;
+ }
+ pcxAlloc.construct(pcx, h3name);
+
+ int status = THISCALL_8(int, 0x44F710, pcx, filepath,
+ IntAt(0x69E5DC), IntAt(0x69E5E4), IntAt(0x69E5D0),
+ IntAt(0x69E5E0), IntAt(0x69E5F0), IntAt(0x69E5D8));
+ if (status == 1)
+ {
+ m_errorMessage.AssignA(ErrorReadingFile);
+ pcxAlloc.deallocate(pcx);
+ return nullptr;
+ }
+ if (status == 2)
+ {
+ m_errorMessage.AssignA(MemoryAllocation);
+ pcxAlloc.deallocate(pcx);
+ return nullptr;
+ }
+ pcx->AddToResourceManager();
+ pcx->IncreaseReferences();
+ return pcx;
+ }
+ catch (const H3Exception& e)
+ {
+ m_errorMessage = e.what();
+ return nullptr;
+ }
+}
+
+H3WavFile* AssetLoaderPlugin::LoadWavFromFile(LPCSTR const filepath, LPCSTR const h3name)
+{
+ H3SEHandler seh;
+ try
+ {
+ if (!ValidateParameters(filepath, h3name))
+ return nullptr;
+
+ DWORD fileSize;
+ PUINT8 fileBuffer = GetFileBuffer(filepath, fileSize);
+ if (fileBuffer == nullptr)
+ return nullptr;
+
+ auto& wavAlloc = H3ObjectAllocator();
+ H3WavFile* wav = wavAlloc.allocate();
+ if (wav == nullptr)
+ {
+ F_delete(fileBuffer);
+ m_errorMessage.AssignA(MemoryAllocation);
+ return nullptr;
+ }
+ wavAlloc.construct(wav, h3name, fileBuffer, fileSize);
+
+ wav->AddToResourceManager();
+ wav->IncreaseReferences();
+ return wav;
+ }
+ catch (const H3Exception& e)
+ {
+ m_errorMessage = e.what();
+ return nullptr;
+ }
+}
+
+H3LoadedDef* AssetLoaderPlugin::LoadDefFromFile(LPCSTR const filePath, LPCSTR const h3name)
+{
+ H3SEHandler seh;
+ try
+ {
+ if (!ValidateParameters(filePath, h3name))
+ return nullptr;
+
+ m_defPath = filePath;
+
+ // * applies DefHook for the duration of this scope
+ TempPatch tlh(m_defHook);
+ H3LoadedDef* def = H3LoadedDef::Load(h3name);
+
+ // * since H3LoadedDef::Load() is used, reference is already increased
+ return def;
+ }
+ catch (const H3Exception& e)
+ {
+ m_errorMessage = e.what();
+ return nullptr;
+ }
+}
+
+int AssetLoaderPlugin::DefFromFile(HookContext& c)
+{
+ DWORD file_size;
+ PUINT8 fileBuffer = GetFileBuffer(m_defPath, file_size);
+ if (fileBuffer == nullptr)
+ return EXEC_DEFAULT;
+
+ c.Local(8) = fileBuffer;
+ c.Edi(fileBuffer);
+ c.return_address = 0x55CB64;
+ return NO_EXEC_DEFAULT;
+}
+
+_LHF_(DefFromFile)
+{
+ return AssetLoader.DefFromFile(*c);
+}
+
+/**
+ * @brief This member function is used to install all your hooks.
+ * e.g. Hook(0x123456, MyHook);
+ * writes a hook at 0x123456 to access MyHook (LoHook or H3NakedFunction, depending on MyHook)
+ * e.g. Hook(0x123456, Call, Thiscall, MyHook);
+ * writes a HiHook at 0x123456, on a CALL instruction with convention __thiscall, and default hook type EXTENDED_
+ */
+void AssetLoaderPlugin::Start()
+{
+ m_defHook = Create(0x55CA26, ::DefFromFile);
+}
\ No newline at end of file
diff --git a/AssetLoader/src/AssetLoaderMain.cpp b/AssetLoader/src/AssetLoaderMain.cpp
new file mode 100644
index 0000000..66924aa
--- /dev/null
+++ b/AssetLoader/src/AssetLoaderMain.cpp
@@ -0,0 +1,17 @@
+//====================================================================================
+//
+// A HoMM III plugin using the H3API library.
+//
+// Created with the H3Plugin Template.
+// Title: AssetLoader
+// Creation: 1/15/2021 5:50:31 PM
+//
+//====================================================================================
+
+#define WIN32_LEAN_AND_MEAN
+#include
+
+BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID)
+{
+ return TRUE;
+}
\ No newline at end of file
diff --git a/Battlefields/Battlefields.vcxproj b/Battlefields/Battlefields.vcxproj
new file mode 100644
index 0000000..c955af4
--- /dev/null
+++ b/Battlefields/Battlefields.vcxproj
@@ -0,0 +1,125 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ 16.0
+ Win32Proj
+ {ca4f8ee5-fcd0-4ce5-af36-db586b37e13a}
+ Battlefields
+ 7.0
+
+
+
+ DynamicLibrary
+ true
+ v141_xp
+ NotSet
+
+
+ DynamicLibrary
+ false
+ v141_xp
+ true
+ NotSet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+
+ Level3
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;_DEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ /Zc:threadSafeInit- %(AdditionalOptions)
+
+
+ Windows
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;NDEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ MultiThreaded
+ /Zc:threadSafeInit- %(AdditionalOptions)
+ true
+
+
+ Windows
+ true
+ true
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+
+
+
+
+
+
+
+ {405b8023-d064-492d-a0df-89b070b26923}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Battlefields/Battlefields.vcxproj.filters b/Battlefields/Battlefields.vcxproj.filters
new file mode 100644
index 0000000..0079a4f
--- /dev/null
+++ b/Battlefields/Battlefields.vcxproj.filters
@@ -0,0 +1,30 @@
+
+
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+
+
+ src
+
+
+ src
+
+
+
+
+ include
+
+
+
\ No newline at end of file
diff --git a/Battlefields/include/Battlefields.hpp b/Battlefields/include/Battlefields.hpp
new file mode 100644
index 0000000..88b2e39
--- /dev/null
+++ b/Battlefields/include/Battlefields.hpp
@@ -0,0 +1,82 @@
+#pragma once
+
+#include
+#include
+
+/**
+ * Uncomment to show an error message when failing to link up with patcher_x86
+ */
+//#define SHOW_ERROR_MESSAGE_ON_FAIL
+
+/**
+ * @brief A derived Plugin that constructs itself
+ */
+class BattlefieldsPlugin : public Plugin
+{
+public:
+ BattlefieldsPlugin() : Plugin()
+ {
+ Status status = Init("H3.Battlefields");
+ if (status == Status::Success)
+ Start();
+#ifdef SHOW_ERROR_MESSAGE_ON_FAIL
+ else
+ ShowError("H3.Battlefields", status);
+#endif
+ }
+
+ static BattlefieldsPlugin& GetPlugin();
+
+private:
+ void Start();
+
+public:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can be accessed from anywhere using the plugin.
+ //
+ //======================================================================================
+
+ int NewBattleGrounds(HookContext& c);
+
+private:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can only be accessed from within the plugin.
+ //
+ //======================================================================================
+ static constexpr UINT SCENE_COUNT = 20;
+ INT32 m_minScene;
+
+ struct CombatScenes
+ {
+ INT32 count;
+ LPCSTR name;
+ }m_customScenes[SCENE_COUNT] =
+ {
+ { 0, "Lava" },
+ { 0, "Subterra" },
+ { 0, "Rough" },
+ { 0, "Swamp" },
+ { 0, "Snow" },
+ { 0, "Grass" },
+ { 0, "Desert" },
+ { 0, "Dirt" },
+ { 0, "Clouds" },
+ { 0, "Rocklands" },
+ { 0, "Fiery" },
+ { 0, "Lucid" },
+ { 0, "Clover" },
+ { 0, "EvilFog" },
+ { 0, "Holy" },
+ { 0, "Cursed" },
+ { 0, "Magic" },
+ { 0, "Coast" },
+ { 0, "Deck" },
+ { 0, "Boat" },
+ };
+
+ CHAR m_buffer[32];
+
+ bool ReadIni();
+};
\ No newline at end of file
diff --git a/Battlefields/src/Battlefields.cpp b/Battlefields/src/Battlefields.cpp
new file mode 100644
index 0000000..c8fa54e
--- /dev/null
+++ b/Battlefields/src/Battlefields.cpp
@@ -0,0 +1,221 @@
+#include "Battlefields.hpp"
+
+using namespace h3;
+
+BattlefieldsPlugin Battlefields;
+
+BattlefieldsPlugin& BattlefieldsPlugin::GetPlugin()
+{
+ return Battlefields;
+}
+
+//===================================================================================
+//
+// ADDITIONAL METHODS AND STRUCTURES
+//
+//===================================================================================
+
+// * default background addresses
+enum eCombatBackgrounds
+{
+ CmBkLava_pcx = 0x66D048, // Lava
+ CmBkSub_pcx = 0x66D058, // Subterranean
+ CmBkRgh_pcx = 0x66D064, // Rough
+ CmBkSwmp_pcx = 0x66D070, // Swamp
+ CmBkSnMt_pcx = 0x66D080, // Snow
+ CmBkSnTr_pcx = 0x66D090, // Snow
+ CmBkGrMt_pcx = 0x66D0A0, // Grass
+ CmBkGrTr_pcx = 0x66D0B0, // Grass
+ CmBkDes_pcx = 0x66D0C0, // Sand
+ CmBkDrTr_pcx = 0x66D0CC, // Dirt
+ CmBkDrMt_pcx = 0x66D0DC, // Dirt
+ CmBkDrDd_pcx = 0x66D0EC, // Dirt
+ CmBkMC_pcx = 0x66D0FC, // Magic Clouds
+ CmBkRK_pcx = 0x66D108, // Rocklands
+ CmBkFF_pcx = 0x66D114, // Fiery Field
+ CmBkLP_pcx = 0x66D120, // Lucid Pools
+ CmBkCF_pcx = 0x66D12C, // Clover field
+ CmBkEF_pcx = 0x66D138, // Evil Fog
+ CmBkHG_pcx = 0x66D144, // Holy Grounds
+ CmBkCur_pcx = 0x66D150, // Cursed ground
+ CmBkMag_pcx = 0x66D15C, // Magic Plains
+ CmBkBch_pcx = 0x66FF40, // Coast
+ CmBkDeck_pcx = 0x66FF4C, // Land vs Boat
+ CmBkBoat_pcx = 0x66FF5C, // Boat v Boat
+};
+
+// * index value of terrains used here
+enum eTerrainIndex
+{
+ TI_LAVA,
+ TI_SUBTERRA,
+ TI_ROUGH,
+ TI_SWAMP,
+ TI_SNOW,
+ TI_GRASS,
+ TI_DESERT,
+ TI_DIRT,
+ TI_CLOUDS,
+ TI_ROCKLANDS,
+ TI_FIERY,
+ TI_LUCID,
+ TI_CLOVER,
+ TI_EVILFOG,
+ TI_HOLY,
+ TI_CURSED,
+ TI_MAGIC,
+ TI_COAST,
+ TI_DECK,
+ TI_BOAT,
+};
+
+bool BattlefieldsPlugin::ReadIni()
+{
+ H3SEHandler seh;
+ try
+ {
+ H3Ini ini;
+ if (!ini.Open("Battlefields.ini"))
+ return false;
+
+ auto options = ini["options"];
+ if (options == ini.end())
+ return false;
+
+ // * By default, we will use original backgrounds
+ m_minScene = 1 - options["default"]->GetBool(true);
+
+ // * load ini data to $CustomScenes
+ for (UINT i = 0; i < SCENE_COUNT; i++)
+ m_customScenes[i].count = options[m_customScenes[i].name]->GetInteger(0);
+
+ return true;
+ }
+ catch (const H3Exception& e)
+ {
+ e.ShowMessagebox();
+ }
+ return false;
+}
+
+
+//===================================================================================
+//
+// HOOKS
+//
+//===================================================================================
+
+int BattlefieldsPlugin::NewBattleGrounds(HookContext& c)
+{
+ INT scene_id;
+
+ using cb = eCombatBackgrounds;
+ using ti = eTerrainIndex;
+
+ // * extract scene type
+ switch (c.eax)
+ {
+ case cb::CmBkLava_pcx:
+ scene_id = ti::TI_LAVA;
+ break;
+ case cb::CmBkSub_pcx:
+ scene_id = ti::TI_SUBTERRA;
+ break;
+ case cb::CmBkRgh_pcx:
+ scene_id = ti::TI_ROUGH;
+ break;
+ case cb::CmBkSwmp_pcx:
+ scene_id = ti::TI_SWAMP;
+ break;
+ case cb::CmBkSnMt_pcx:
+ case cb::CmBkSnTr_pcx:
+ scene_id = ti::TI_SNOW;
+ break;
+ case cb::CmBkGrMt_pcx:
+ case cb::CmBkGrTr_pcx:
+ scene_id = ti::TI_GRASS;
+ break;
+ case cb::CmBkDes_pcx:
+ scene_id = ti::TI_DESERT;
+ break;
+ case cb::CmBkDrTr_pcx:
+ case cb::CmBkDrMt_pcx:
+ case cb::CmBkDrDd_pcx:
+ scene_id = ti::TI_DIRT;
+ break;
+ case cb::CmBkMC_pcx:
+ scene_id = ti::TI_CLOUDS;
+ break;
+ case cb::CmBkRK_pcx:
+ scene_id = ti::TI_ROCKLANDS;
+ break;
+ case cb::CmBkFF_pcx:
+ scene_id = ti::TI_FIERY;
+ break;
+ case cb::CmBkLP_pcx:
+ scene_id = ti::TI_LUCID;
+ break;
+ case cb::CmBkCF_pcx:
+ scene_id = ti::TI_CLOVER;
+ break;
+ case cb::CmBkEF_pcx:
+ scene_id = ti::TI_EVILFOG;
+ break;
+ case cb::CmBkHG_pcx:
+ scene_id = ti::TI_HOLY;
+ break;
+ case cb::CmBkCur_pcx:
+ scene_id = ti::TI_CURSED;
+ break;
+ case cb::CmBkMag_pcx:
+ scene_id = ti::TI_MAGIC;
+ break;
+ case cb::CmBkBch_pcx:
+ scene_id = ti::TI_COAST;
+ break;
+ case cb::CmBkDeck_pcx:
+ scene_id = ti::TI_DECK;
+ break;
+ case cb::CmBkBoat_pcx:
+ scene_id = ti::TI_BOAT;
+ break;
+ default:
+ return EXEC_DEFAULT;
+ }
+
+ // * only trigger if there is a custom background
+ if (INT max_scene = m_customScenes[scene_id].count)
+ {
+ // * pick a random scene (or not, depends on user choice)
+ INT rand_scene = H3Random::RandBetween(m_minScene, max_scene);
+ // * the scene is not default
+ if (rand_scene)
+ {
+ F_sprintfbuffer(m_buffer, "%s%02d.pcx", m_customScenes[scene_id].name, rand_scene);
+ c.Eax(m_buffer);
+ }
+ }
+
+ return EXEC_DEFAULT;
+}
+
+_LHF_(NewBattleGrounds)
+{
+ return Battlefields.NewBattleGrounds(*c);
+}
+
+/**
+ * @brief This member function is used to install all your hooks.
+ * e.g. Hook(0x123456, MyHook);
+ * writes a hook at 0x123456 to access MyHook (LoHook or H3NakedFunction, depending on MyHook)
+ * e.g. Hook(0x123456, Call, Thiscall, MyHook);
+ * writes a HiHook at 0x123456, on a CALL instruction with convention __thiscall, and default hook type EXTENDED_
+ */
+void BattlefieldsPlugin::Start()
+{
+ if (!ReadIni())
+ return;
+
+ H3Random::SetRandomSeed();
+ Hook(0x463833_h3,::NewBattleGrounds);
+}
\ No newline at end of file
diff --git a/Battlefields/src/BattlefieldsMain.cpp b/Battlefields/src/BattlefieldsMain.cpp
new file mode 100644
index 0000000..7567d40
--- /dev/null
+++ b/Battlefields/src/BattlefieldsMain.cpp
@@ -0,0 +1,17 @@
+//====================================================================================
+//
+// A HoMM III plugin using the H3API library.
+//
+// Created with the H3Plugin Template.
+// Title: Battlefields
+// Creation: 1/15/2021 1:43:51 PM
+//
+//====================================================================================
+
+#define WIN32_LEAN_AND_MEAN
+#include
+
+BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID)
+{
+ return TRUE;
+}
\ No newline at end of file
diff --git a/CombatAnimation/CombatAnimation.vcxproj b/CombatAnimation/CombatAnimation.vcxproj
new file mode 100644
index 0000000..934ba6b
--- /dev/null
+++ b/CombatAnimation/CombatAnimation.vcxproj
@@ -0,0 +1,125 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ 16.0
+ Win32Proj
+ {ebaa9181-f764-4700-9547-2817054a3df6}
+ CombatAnimation
+ 7.0
+
+
+
+ DynamicLibrary
+ true
+ v141_xp
+ NotSet
+
+
+ DynamicLibrary
+ false
+ v141_xp
+ true
+ NotSet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+
+ Level3
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;_DEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ /Zc:threadSafeInit- %(AdditionalOptions)
+
+
+ Windows
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;NDEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ MultiThreaded
+ /Zc:threadSafeInit- %(AdditionalOptions)
+ true
+
+
+ Windows
+ true
+ true
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+
+
+
+
+
+
+
+ {405b8023-d064-492d-a0df-89b070b26923}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CombatAnimation/CombatAnimation.vcxproj.filters b/CombatAnimation/CombatAnimation.vcxproj.filters
new file mode 100644
index 0000000..fca1bcb
--- /dev/null
+++ b/CombatAnimation/CombatAnimation.vcxproj.filters
@@ -0,0 +1,30 @@
+
+
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+
+
+ src
+
+
+ src
+
+
+
+
+ include
+
+
+
\ No newline at end of file
diff --git a/CombatAnimation/include/CombatAnimation.hpp b/CombatAnimation/include/CombatAnimation.hpp
new file mode 100644
index 0000000..c17f8c8
--- /dev/null
+++ b/CombatAnimation/include/CombatAnimation.hpp
@@ -0,0 +1,48 @@
+#pragma once
+
+#include
+#include
+
+/**
+ * Uncomment to show an error message when failing to link up with patcher_x86
+ */
+//#define SHOW_ERROR_MESSAGE_ON_FAIL
+
+/**
+ * @brief A derived Plugin that constructs itself
+ */
+class CombatAnimationPlugin : public Plugin
+{
+public:
+ CombatAnimationPlugin() : Plugin()
+ {
+ Status status = Init("H3.CombatAnimation");
+ if (status == Status::Success)
+ Start();
+#ifdef SHOW_ERROR_MESSAGE_ON_FAIL
+ else
+ ShowError("H3.CombatAnimation", status);
+#endif
+ }
+
+ static CombatAnimationPlugin& GetPlugin();
+
+private:
+ void Start();
+
+public:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can be accessed from anywhere using the plugin.
+ //
+ //======================================================================================
+
+
+private:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can only be accessed from within the plugin.
+ //
+ //======================================================================================
+
+};
\ No newline at end of file
diff --git a/CombatAnimation/src/CombatAnimation.cpp b/CombatAnimation/src/CombatAnimation.cpp
new file mode 100644
index 0000000..96115f2
--- /dev/null
+++ b/CombatAnimation/src/CombatAnimation.cpp
@@ -0,0 +1,108 @@
+#include "CombatAnimation.hpp"
+
+using namespace h3;
+
+CombatAnimationPlugin CombatAnimation;
+
+CombatAnimationPlugin& CombatAnimationPlugin::GetPlugin()
+{
+ return CombatAnimation;
+}
+
+//===================================================================================
+//
+// ADDITIONAL METHODS AND STRUCTURES
+//
+//===================================================================================
+
+
+//===================================================================================
+//
+// HOOKS
+//
+//===================================================================================
+
+// * milliseconds
+constexpr INT TIME_BETWEEN_ANIMATION = 95;
+
+int __stdcall _HH_CycleCombatScreen(HiHook* h, H3CombatManager* combat)
+{
+ // can't use the default creature time reference
+ // it would prevent random animations
+ static DWORD last_animations[2][21];
+
+ for (int side = 0; side < 2; ++side)
+ {
+ // only consider creatures on battlefield
+ for (int i = 0; i < combat->heroMonCount[side] && i < 20; ++i)
+ {
+ auto mon = &combat->stacks[side][i];
+ // under these conditions, a creature should not be animated
+ if (mon->type == NH3Creatures::ARROW_TOWER
+ || mon->info.flags.cannotMove
+ || mon->activeSpellsDuration[H3Spell::eSpells::BLIND]
+ || mon->activeSpellsDuration[H3Spell::eSpells::PARALYZE]
+ || mon->activeSpellsDuration[H3Spell::eSpells::STONE]
+ || mon->numberAlive == 0
+ )
+ continue;
+
+ // if undergoing a current animation
+ if (mon->animation != H3LoadedDef::CG_STANDING)
+ continue;
+
+ auto def = mon->def;
+ if (!def)
+ continue;
+
+ if (def->groupsCount <= 1)
+ continue;
+ // check the standing defgroup is loaded...
+ if (!def->activeGroups[H3LoadedDef::CG_STANDING])
+ continue;
+ // ... and exists
+ auto standing = def->groups[H3LoadedDef::CG_STANDING];
+ if (!standing)
+ continue;
+
+ // check that enough time has elapsed since last animation
+ DWORD time = F_GetTime();
+ DWORD& last_animation = last_animations[side][i];
+ if (time - last_animation < TIME_BETWEEN_ANIMATION)
+ continue;
+
+ // indicate that this creature's frame should be redrawn
+ combat->redrawCreatureFrame[side][i] = TRUE;
+ // increase this creature's current frame animation
+ ++mon->animationFrame %= standing->count;
+ // add a bit of randomness for the next animation time reference
+ // helps to prevent syncing of similar creature stacks
+ last_animation = time + F_MultiplayerRNG(0, 10);
+ }
+ }
+ // draw and refresh creature animations
+ combat->RefreshCreatures();
+ combat->Refresh();
+
+ return THISCALL_1(int, h->GetDefaultFunc(), combat);
+}
+
+_LHF_(ResetDrawingRequest)
+{
+ auto& cmb = P_CombatMgr();
+ F_memset(cmb->redrawCreatureFrame, 0, sizeof(cmb->redrawCreatureFrame) + sizeof(cmb->heroAnimation) + sizeof(cmb->heroFlagAnimation));
+ return EXEC_DEFAULT;
+}
+
+/**
+ * @brief This member function is used to install all your hooks.
+ * e.g. Hook(0x123456, MyHook);
+ * writes a hook at 0x123456 to access MyHook (LoHook or H3NakedFunction, depending on MyHook)
+ * e.g. Hook(0x123456, Call, Thiscall, MyHook);
+ * writes a HiHook at 0x123456, on a CALL instruction with convention __thiscall, and default hook type EXTENDED_
+ */
+void CombatAnimationPlugin::Start()
+{
+ Hook(0x495C50, Splice, Thiscall, _HH_CycleCombatScreen);
+ Hook(0x4631E6, ResetDrawingRequest);
+}
diff --git a/CombatAnimation/src/CombatAnimationMain.cpp b/CombatAnimation/src/CombatAnimationMain.cpp
new file mode 100644
index 0000000..ab5d566
--- /dev/null
+++ b/CombatAnimation/src/CombatAnimationMain.cpp
@@ -0,0 +1,17 @@
+//====================================================================================
+//
+// A HoMM III plugin using the H3API library.
+//
+// Created with the H3Plugin Template.
+// Title: CombatAnimation
+// Creation: 1/15/2021 12:04:02 AM
+//
+//====================================================================================
+
+#define WIN32_LEAN_AND_MEAN
+#include
+
+BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID)
+{
+ return TRUE;
+}
\ No newline at end of file
diff --git a/DataLoader/DataLoader.vcxproj b/DataLoader/DataLoader.vcxproj
new file mode 100644
index 0000000..2c66579
--- /dev/null
+++ b/DataLoader/DataLoader.vcxproj
@@ -0,0 +1,125 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ 16.0
+ Win32Proj
+ {46d87bb3-d382-4920-8f52-5e3e604a3f7c}
+ DataLoader
+ 7.0
+
+
+
+ DynamicLibrary
+ true
+ v141_xp
+ NotSet
+
+
+ DynamicLibrary
+ false
+ v141_xp
+ true
+ NotSet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+
+ Level3
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;_DEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ /Zc:threadSafeInit- %(AdditionalOptions)
+
+
+ Windows
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;NDEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ MultiThreaded
+ /Zc:threadSafeInit- %(AdditionalOptions)
+ true
+
+
+ Windows
+ true
+ true
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+
+
+
+
+
+
+
+ {405b8023-d064-492d-a0df-89b070b26923}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/H3.DataLoader/H3.DataLoader.vcxproj.filters b/DataLoader/DataLoader.vcxproj.filters
similarity index 62%
rename from H3.DataLoader/H3.DataLoader.vcxproj.filters
rename to DataLoader/DataLoader.vcxproj.filters
index e200b21..0c46176 100644
--- a/H3.DataLoader/H3.DataLoader.vcxproj.filters
+++ b/DataLoader/DataLoader.vcxproj.filters
@@ -1,30 +1,30 @@
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
-
{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
-
- Source Files
+
+ src
-
- Source Files
+
+ src
-
- Header Files
+
+ include
\ No newline at end of file
diff --git a/DataLoader/include/DataLoader.hpp b/DataLoader/include/DataLoader.hpp
new file mode 100644
index 0000000..8133561
--- /dev/null
+++ b/DataLoader/include/DataLoader.hpp
@@ -0,0 +1,48 @@
+#pragma once
+
+#include
+#include
+
+/**
+ * Uncomment to show an error message when failing to link up with patcher_x86
+ */
+//#define SHOW_ERROR_MESSAGE_ON_FAIL
+
+/**
+ * @brief A derived Plugin that constructs itself
+ */
+class DataLoaderPlugin : public Plugin
+{
+public:
+ DataLoaderPlugin() : Plugin()
+ {
+ Status status = Init("H3.DataLoader");
+ if (status == Status::Success)
+ Start();
+#ifdef SHOW_ERROR_MESSAGE_ON_FAIL
+ else
+ ShowError("H3.DataLoader", status);
+#endif
+ }
+
+ static DataLoaderPlugin& GetPlugin();
+
+private:
+ void Start();
+
+public:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can be accessed from anywhere using the plugin.
+ //
+ //======================================================================================
+
+
+private:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can only be accessed from within the plugin.
+ //
+ //======================================================================================
+
+};
\ No newline at end of file
diff --git a/DataLoader/src/DataLoader.cpp b/DataLoader/src/DataLoader.cpp
new file mode 100644
index 0000000..84ace16
--- /dev/null
+++ b/DataLoader/src/DataLoader.cpp
@@ -0,0 +1,103 @@
+#include "DataLoader.hpp"
+
+using namespace h3;
+
+DataLoaderPlugin DataLoader;
+
+DataLoaderPlugin& DataLoaderPlugin::GetPlugin()
+{
+ return DataLoader;
+}
+
+//===================================================================================
+//
+// ADDITIONAL METHODS AND STRUCTURES
+//
+//===================================================================================
+
+BOOL OpenFileFromDataDir(LPCSTR name, h3::H3File& file)
+{
+ if (!name)
+ return FALSE;
+ h3::H3String path(*P_DataPath() + name);
+ if (!file.Open(path.String()))
+ return FALSE;
+ return TRUE;
+}
+
+//===================================================================================
+//
+// HOOKS
+//
+//===================================================================================
+
+_LHF_(DefFromDataFolder)
+{
+ h3::H3File file;
+ if (!OpenFileFromDataDir(LPCSTR(c->ebx), file) || !file.ReadToBuffer())
+ return EXEC_DEFAULT;
+
+ PBYTE buffer = file.ReleaseBuffer();
+ c->Local(8) = buffer;
+ c->Edi(buffer);
+ c->return_address = 0x55CB64;
+ return NO_EXEC_DEFAULT;
+}
+
+_LHF_(MskFromDataFolder_NewGame) // 55D160
+{
+ H3File file;
+ H3Msk msk;
+ if (!OpenFileFromDataDir(LPCSTR(c->ecx), file) || !file.Read(msk))
+ return EXEC_DEFAULT;
+
+ H3Msk::Msk passability, entrances;
+ auto& strm = c->Arg(1);
+ if (!strm.Read(passability) || !strm.Read(entrances))
+ {
+ c->return_address = 0x5040A6; // failed to read
+ return NO_EXEC_DEFAULT;
+ }
+
+ auto& oa = *c->Edi();
+ oa.width = msk.width;
+ oa.height = msk.height;
+ msk.colorMask >> oa.colors;
+ passability >> oa.passability;
+ msk.shadowMask >> oa.shadows;
+ entrances >> oa.entrances;
+
+ c->return_address = 0x504131;
+ return NO_EXEC_DEFAULT;
+}
+
+_LHF_(MskFromDataFolder_LoadTxt)
+{
+ H3File file;
+ H3Msk msk;
+ if (!OpenFileFromDataDir(LPCSTR(c->ecx), file) || !file.Read(msk))
+ return EXEC_DEFAULT;
+
+ h3::H3LoadedMsk& mask = *(h3::H3LoadedMsk*)c->ebx;
+ mask = msk;
+ // skip whole bitfield setting, doing it manually
+ c->return_address = 0x514AC1_h3;
+ return NO_EXEC_DEFAULT;
+}
+
+/**
+ * @brief This member function is used to install all your hooks.
+ * e.g. Hook(0x123456, MyHook);
+ * writes a hook at 0x123456 to access MyHook (LoHook or H3NakedFunction, depending on MyHook)
+ * e.g. Hook(0x123456, Call, Thiscall, MyHook);
+ * writes a HiHook at 0x123456, on a CALL instruction with convention __thiscall, and default hook type EXTENDED_
+ */
+void DataLoaderPlugin::Start()
+{
+ auto h = Create(0x55CA26, ::DefFromDataFolder);
+ // apply last, allowing HDmod hooks to be executed first
+ if (h)
+ h->ApplyInsert(-1);
+ Hook(0x503E8D, ::MskFromDataFolder_NewGame);
+ Hook(0x514A15, ::MskFromDataFolder_LoadTxt);
+}
diff --git a/DataLoader/src/DataLoaderMain.cpp b/DataLoader/src/DataLoaderMain.cpp
new file mode 100644
index 0000000..01a7dbc
--- /dev/null
+++ b/DataLoader/src/DataLoaderMain.cpp
@@ -0,0 +1,17 @@
+//====================================================================================
+//
+// A HoMM III plugin using the H3API library.
+//
+// Created with the H3Plugin Template.
+// Title: DataLoader
+// Creation: 1/15/2021 5:36:40 PM
+//
+//====================================================================================
+
+#define WIN32_LEAN_AND_MEAN
+#include
+
+BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID)
+{
+ return TRUE;
+}
\ No newline at end of file
diff --git a/DisableHWrules/DisableHWrules.vcxproj b/DisableHWrules/DisableHWrules.vcxproj
new file mode 100644
index 0000000..c19e911
--- /dev/null
+++ b/DisableHWrules/DisableHWrules.vcxproj
@@ -0,0 +1,125 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ 16.0
+ Win32Proj
+ {b2efa480-5793-4953-ad9e-519fd390f34a}
+ DisableHWrules
+ 7.0
+
+
+
+ DynamicLibrary
+ true
+ v141_xp
+ NotSet
+
+
+ DynamicLibrary
+ false
+ v141_xp
+ true
+ NotSet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+
+ Level3
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;_DEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ /Zc:threadSafeInit- %(AdditionalOptions)
+
+
+ Windows
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;NDEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ MultiThreaded
+ /Zc:threadSafeInit- %(AdditionalOptions)
+ true
+
+
+ Windows
+ true
+ true
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+
+
+
+
+
+
+
+ {405b8023-d064-492d-a0df-89b070b26923}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/H3.CombatAnimation/H3.CombatAnimation.vcxproj.filters b/DisableHWrules/DisableHWrules.vcxproj.filters
similarity index 61%
rename from H3.CombatAnimation/H3.CombatAnimation.vcxproj.filters
rename to DisableHWrules/DisableHWrules.vcxproj.filters
index 95a86b3..e9044e2 100644
--- a/H3.CombatAnimation/H3.CombatAnimation.vcxproj.filters
+++ b/DisableHWrules/DisableHWrules.vcxproj.filters
@@ -1,30 +1,30 @@
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
-
{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
-
- Source Files
+
+ src
-
- Source Files
+
+ src
-
- Source Files
+
+ include
\ No newline at end of file
diff --git a/DisableHWrules/include/DisableHWrules.hpp b/DisableHWrules/include/DisableHWrules.hpp
new file mode 100644
index 0000000..c1b76b0
--- /dev/null
+++ b/DisableHWrules/include/DisableHWrules.hpp
@@ -0,0 +1,48 @@
+#pragma once
+
+#include
+#include
+
+/**
+ * Uncomment to show an error message when failing to link up with patcher_x86
+ */
+//#define SHOW_ERROR_MESSAGE_ON_FAIL
+
+/**
+ * @brief A derived Plugin that constructs itself
+ */
+class DisableHWrulesPlugin : public Plugin
+{
+public:
+ DisableHWrulesPlugin() : Plugin()
+ {
+ Status status = Init("H3.DisableHWrules");
+ if (status == Status::Success)
+ Start();
+#ifdef SHOW_ERROR_MESSAGE_ON_FAIL
+ else
+ ShowError("H3.DisableHWrules", status);
+#endif
+ }
+
+ static DisableHWrulesPlugin& GetPlugin();
+
+private:
+ void Start();
+
+public:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can be accessed from anywhere using the plugin.
+ //
+ //======================================================================================
+
+
+private:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can only be accessed from within the plugin.
+ //
+ //======================================================================================
+
+};
\ No newline at end of file
diff --git a/DisableHWrules/src/DisableHWrules.cpp b/DisableHWrules/src/DisableHWrules.cpp
new file mode 100644
index 0000000..125820e
--- /dev/null
+++ b/DisableHWrules/src/DisableHWrules.cpp
@@ -0,0 +1,44 @@
+#include "DisableHWrules.hpp"
+
+using namespace h3;
+
+DisableHWrulesPlugin DisableHWrules;
+
+DisableHWrulesPlugin& DisableHWrulesPlugin::GetPlugin()
+{
+ return DisableHWrules;
+}
+
+//===================================================================================
+//
+// ADDITIONAL METHODS AND STRUCTURES
+//
+//===================================================================================
+
+
+//===================================================================================
+//
+// HOOKS
+//
+//===================================================================================
+
+_LHF_(DisableHeroesWorldRulesPlugin)
+{
+ auto wzx = DisableHWrules.GetInstance("wzx_HW");
+ if (wzx)
+ wzx->UndoAll();
+ return EXEC_DEFAULT;
+}
+
+
+/**
+ * @brief This member function is used to install all your hooks.
+ * e.g. Hook(0x123456, MyHook);
+ * writes a hook at 0x123456 to access MyHook (LoHook or H3NakedFunction, depending on MyHook)
+ * e.g. Hook(0x123456, Call, Thiscall, MyHook);
+ * writes a HiHook at 0x123456, on a CALL instruction with convention __thiscall, and default hook type EXTENDED_
+ */
+void DisableHWrulesPlugin::Start()
+{
+ Hook(0x4F823F, DisableHeroesWorldRulesPlugin);
+}
\ No newline at end of file
diff --git a/DisableHWrules/src/DisableHWrulesMain.cpp b/DisableHWrules/src/DisableHWrulesMain.cpp
new file mode 100644
index 0000000..7271012
--- /dev/null
+++ b/DisableHWrules/src/DisableHWrulesMain.cpp
@@ -0,0 +1,17 @@
+//====================================================================================
+//
+// A HoMM III plugin using the H3API library.
+//
+// Created with the H3Plugin Template.
+// Title: DisableHWrules
+// Creation: 1/15/2021 4:47:43 PM
+//
+//====================================================================================
+
+#define WIN32_LEAN_AND_MEAN
+#include
+
+BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID)
+{
+ return TRUE;
+}
\ No newline at end of file
diff --git a/Documentation/H3.TextColor.txt b/Documentation/H3.TextColor.txt
index ecec341..c48ab95 100644
--- a/Documentation/H3.TextColor.txt
+++ b/Documentation/H3.TextColor.txt
@@ -6,178 +6,184 @@ Any of the listed colors is placed inside a tag {~} to indicate the start of a c
The end of a color is designated by the end tag } as normally used in Heroes III, otherwise it continues until the end of current text.
For example:
-{~H3Red}The quick brown fox} jumped over the {~g}lazy} {~b}dog}.
+{~H3Red}The quick brown fox} jumped over the {~g}lazy} {~b}dog}.
+{~#FF00FF}Now supports #}{~#FF0000}RR}{~#FF00}GG}{~#FF}BB} tags!
"The quick brown fox" is colored red #F80000;
-"jumped over the" is not colored;
-"lazy" is colored green #00FC00;
-"dog" is colored blue #0000F8;
-"." is not colored.
+"jumped over the" is not colored;
+"lazy" is colored green #00FC00;
+"dog" is colored blue #0000F8;
+"." is not colored;
+"Now supports #" is colored #FF00FF;
+"RR" is colored #FF0000;
+"GG" is colored #00FF00;
+"BB" is colored #0000FF;
+" tags!" is not colored.
-{~Color} R G B
-r F80000
-g 00FC00
-b 0000F8
-y F8FC00
-o F88000
-p F800F8
-c 00FCF8
-k 000000
-w FFFFFF
-Regular F8F0D8
-Highlight E8D478
-H3Red F80000
-H3Cyan 00FCF8
-H3Green 00FC00
-H3Blue 0000F8
-H3Yellow F8FC00
-H3Orange F88000
-H3Purple F800F8
-H3Pink C07888
-AliceBlue F0F8FF
-AntiqueWhite FAEBD7
-Aqua 00FFFF
-Aquamarine 7FFFD4
-Azure F0FFFF
-Beige F5F5DC
-Bisque FFE4C4
-Black 000000
-BlanchedAlmond FFEBCD
-Blue 0000FF
-BlueViolet 8A2BE2
-Brown A52A2A
-BurlyWood DEB887
-CadetBlue 5F9EA0
-Chartreuse 7FFF00
-Chocolate D2691E
-Coral FF7F50
-CornflowerBlue 6495ED
-Cornsilk FFF8DC
-Crimson DC143C
-Cyan 00FFFF
-DarkBlue 00008B
-DarkCyan 008B8B
-DarkGoldenRod B8860B
-DarkGray A9A9A9
-DarkGrey A9A9A9
-DarkGreen A9A9A9
-DarkKhaki 006400
-DarkMagenta 8B008B
-DarkOliveGreen 556B2F
-Darkorange FF8C00
-DarkOrchid 9932CC
-DarkRed 8B0000
-DarkSalmon E9967A
-DarkSeaGreen 8FBC8F
-DarkSlateBlue 483D8B
-DarkSlateGray 2F4F4F
-DarkSlateGrey 2F4F4F
-DarkTurquoise 00CED1
-DarkViolet 9400D3
-DeepPink FF1493
-DeepSkyBlue 00BFFF
-DimGray 696969
-DimGrey 696969
-DodgerBlue 1E90FF
-FireBrick B22222
-FloralWhite FFFAF0
-ForestGreen 228B22
-Fuchsia FF00FF
-Gainsboro DCDCDC
-GhostWhite F8F8FF
-Gold FFD700
-GoldenRod DAA520
-Gray 808080
-Grey 808080
-Green 008000
-GreenYellow ADFF2F
-HoneyDew F0FFF0
-HotPink FF69B4
-IndianRed CD5C5C
-Indigo 4B0082
-Ivory FFFFF0
-Khaki F0E68C
-Lavender E6E6FA
-LavenderBlush FFF0F5
-LawnGreen 7CFC00
-LemonChiffon FFFACD
-LightBlue ADD8E6
-LightCoral F08080
-LightCyan E0FFFF
+{~Color} RRGGBB
+r F80000
+g 00FC00
+b 0000F8
+y F8FC00
+o F88000
+p F800F8
+c 00FCF8
+k 000000
+w FFFFFF
+Regular F8F0D8
+Highlight E8D478
+H3Red F80000
+H3Cyan 00FCF8
+H3Green 00FC00
+H3Blue 0000F8
+H3Yellow F8FC00
+H3Orange F88000
+H3Purple F800F8
+H3Pink C07888
+AliceBlue F0F8FF
+AntiqueWhite FAEBD7
+Aqua 00FFFF
+Aquamarine 7FFFD4
+Azure F0FFFF
+Beige F5F5DC
+Bisque FFE4C4
+Black 000000
+BlanchedAlmond FFEBCD
+Blue 0000FF
+BlueViolet 8A2BE2
+Brown A52A2A
+BurlyWood DEB887
+CadetBlue 5F9EA0
+Chartreuse 7FFF00
+Chocolate D2691E
+Coral FF7F50
+CornflowerBlue 6495ED
+Cornsilk FFF8DC
+Crimson DC143C
+Cyan 00FFFF
+DarkBlue 00008B
+DarkCyan 008B8B
+DarkGoldenRod B8860B
+DarkGray A9A9A9
+DarkGrey A9A9A9
+DarkGreen A9A9A9
+DarkKhaki 006400
+DarkMagenta 8B008B
+DarkOliveGreen 556B2F
+Darkorange FF8C00
+DarkOrchid 9932CC
+DarkRed 8B0000
+DarkSalmon E9967A
+DarkSeaGreen 8FBC8F
+DarkSlateBlue 483D8B
+DarkSlateGray 2F4F4F
+DarkSlateGrey 2F4F4F
+DarkTurquoise 00CED1
+DarkViolet 9400D3
+DeepPink FF1493
+DeepSkyBlue 00BFFF
+DimGray 696969
+DimGrey 696969
+DodgerBlue 1E90FF
+FireBrick B22222
+FloralWhite FFFAF0
+ForestGreen 228B22
+Fuchsia FF00FF
+Gainsboro DCDCDC
+GhostWhite F8F8FF
+Gold FFD700
+GoldenRod DAA520
+Gray 808080
+Grey 808080
+Green 008000
+GreenYellow ADFF2F
+HoneyDew F0FFF0
+HotPink FF69B4
+IndianRed CD5C5C
+Indigo 4B0082
+Ivory FFFFF0
+Khaki F0E68C
+Lavender E6E6FA
+LavenderBlush FFF0F5
+LawnGreen 7CFC00
+LemonChiffon FFFACD
+LightBlue ADD8E6
+LightCoral F08080
+LightCyan E0FFFF
LightGoldenRodYellow FAFAD2
-LightGray D3D3D3
-LightGrey D3D3D3
-LightGreen 90EE90
-LightPink FFB6C1
-LightSalmon FFA07A
-LightSeaGreen 20B2AA
-LightSkyBlue 87CEFA
-LightSlateGray 778899
-LightSlateGrey 778899
-LightSteelBlue B0C4DE
-LightYellow FFFFE0
-Lime 00FF00
-LimeGreen 32CD32
-Linen FAF0E6
-Magenta FF00FF
-Maroon 800000
-MediumAquaMarine 66CDAA
-MediumBlue 0000CD
-MediumOrchid BA55D3
-MediumPurple 9370D8
-MediumSeaGreen 3CB371
-MediumSlateBlue 7B68EE
-MediumSpringGreen 00FA9A
-MediumTurquoise 48D1CC
-MediumVioletRed C71585
-MidnightBlue 191970
-MintCream F5FFFA
-MistyRose FFE4E1
-Moccasin FFE4B5
-NavajoWhite FFDEAD
-Navy 000080
-OldLace FDF5E6
-Olive 808000
-OliveDrab 6B8E23
-Orange FFA500
-OrangeRed FF4500
-Orchid DA70D6
-PaleGoldenRod EEE8AA
-PaleGreen 98FB98
-PaleTurquoise AFEEEE
-PaleVioletRed D87093
-PapayaWhip FFEFD5
-PeachPuff FFDAB9
-Peru CD853F
-Pink FFC0CB
-Plum DDA0DD
-PowderBlue B0E0E6
-Purple 800080
-Red FF0000
-RosyBrown BC8F8F
-RoyalBlue 4169E1
-SaddleBrown 8B4513
-Salmon FA8072
-SandyBrown F4A460
-SeaGreen 2E8B57
-SeaShell FFF5EE
-Sienna A0522D
-Silver C0C0C0
-SkyBlue 87CEEB
-SlateBlue 6A5ACD
-SlateGray 708090
-SlateGrey 708090
-Snow FFFAFA
-SpringGreen 00FF7F
-SteelBlue 4682B4
-Tan D2B48C
-Teal 008080
-Thistle D8BFD8
-Tomato FF6347
-Turquoise 40E0D0
-Violet EE82EE
-Wheat F5DEB3
-White FFFFFF
-WhiteSmoke F5F5F5
-Yellow FFFF00
-YellowGreen 9ACD32
\ No newline at end of file
+LightGray D3D3D3
+LightGrey D3D3D3
+LightGreen 90EE90
+LightPink FFB6C1
+LightSalmon FFA07A
+LightSeaGreen 20B2AA
+LightSkyBlue 87CEFA
+LightSlateGray 778899
+LightSlateGrey 778899
+LightSteelBlue B0C4DE
+LightYellow FFFFE0
+Lime 00FF00
+LimeGreen 32CD32
+Linen FAF0E6
+Magenta FF00FF
+Maroon 800000
+MediumAquaMarine 66CDAA
+MediumBlue 0000CD
+MediumOrchid BA55D3
+MediumPurple 9370D8
+MediumSeaGreen 3CB371
+MediumSlateBlue 7B68EE
+MediumSpringGreen 00FA9A
+MediumTurquoise 48D1CC
+MediumVioletRed C71585
+MidnightBlue 191970
+MintCream F5FFFA
+MistyRose FFE4E1
+Moccasin FFE4B5
+NavajoWhite FFDEAD
+Navy 000080
+OldLace FDF5E6
+Olive 808000
+OliveDrab 6B8E23
+Orange FFA500
+OrangeRed FF4500
+Orchid DA70D6
+PaleGoldenRod EEE8AA
+PaleGreen 98FB98
+PaleTurquoise AFEEEE
+PaleVioletRed D87093
+PapayaWhip FFEFD5
+PeachPuff FFDAB9
+Peru CD853F
+Pink FFC0CB
+Plum DDA0DD
+PowderBlue B0E0E6
+Purple 800080
+Red FF0000
+RosyBrown BC8F8F
+RoyalBlue 4169E1
+SaddleBrown 8B4513
+Salmon FA8072
+SandyBrown F4A460
+SeaGreen 2E8B57
+SeaShell FFF5EE
+Sienna A0522D
+Silver C0C0C0
+SkyBlue 87CEEB
+SlateBlue 6A5ACD
+SlateGray 708090
+SlateGrey 708090
+Snow FFFAFA
+SpringGreen 00FF7F
+SteelBlue 4682B4
+Tan D2B48C
+Teal 008080
+Thistle D8BFD8
+Tomato FF6347
+Turquoise 40E0D0
+Violet EE82EE
+Wheat F5DEB3
+White FFFFFF
+WhiteSmoke F5F5F5
+Yellow FFFF00
+YellowGreen 9ACD32
\ No newline at end of file
diff --git a/DoubleClickShowcase/DoubleClickShowcase.vcxproj b/DoubleClickShowcase/DoubleClickShowcase.vcxproj
new file mode 100644
index 0000000..4866b86
--- /dev/null
+++ b/DoubleClickShowcase/DoubleClickShowcase.vcxproj
@@ -0,0 +1,125 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ 16.0
+ Win32Proj
+ {b657cdac-e9c5-4a73-8881-3e8e664b1f11}
+ DoubleClickShowcase
+ 7.0
+
+
+
+ DynamicLibrary
+ true
+ v141_xp
+ NotSet
+
+
+ DynamicLibrary
+ false
+ v141_xp
+ true
+ NotSet
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ $(SolutionDir)bin\$(Configuration)\
+ $(SolutionDir)bin\intermediates\$(ProjectName)\$(Configuration)\
+ H3.$(ProjectName)
+
+
+ false
+ false
+
+
+ false
+ false
+
+
+
+ Level3
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;_DEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ /Zc:threadSafeInit- %(AdditionalOptions)
+
+
+ Windows
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+ Level3
+ true
+ true
+ true
+ _H3API_EXCEPTION_;_H3API_LIBRARY_;WIN32;NDEBUG;PLUGINTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ false
+ $(SolutionDir);$(SolutionDir)H3API\lib;$(ProjectDir)include
+ Async
+ MultiThreaded
+ /Zc:threadSafeInit- %(AdditionalOptions)
+ true
+
+
+ Windows
+ true
+ true
+ true
+ false
+ $(SolutionDir)bin\$(ConfigurationName)\msvc $(VisualStudioVersion)
+ H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+
+
+
+
+
+
+
+
+
+
+
+ {405b8023-d064-492d-a0df-89b070b26923}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DoubleClickShowcase/DoubleClickShowcase.vcxproj.filters b/DoubleClickShowcase/DoubleClickShowcase.vcxproj.filters
new file mode 100644
index 0000000..a7fdb88
--- /dev/null
+++ b/DoubleClickShowcase/DoubleClickShowcase.vcxproj.filters
@@ -0,0 +1,30 @@
+
+
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+
+
+ src
+
+
+ src
+
+
+
+
+ include
+
+
+
\ No newline at end of file
diff --git a/DoubleClickShowcase/include/DoubleClickShowcase.hpp b/DoubleClickShowcase/include/DoubleClickShowcase.hpp
new file mode 100644
index 0000000..f213805
--- /dev/null
+++ b/DoubleClickShowcase/include/DoubleClickShowcase.hpp
@@ -0,0 +1,50 @@
+#pragma once
+
+#include
+#include
+
+/**
+ * Uncomment to show an error message when failing to link up with patcher_x86
+ */
+//#define SHOW_ERROR_MESSAGE_ON_FAIL
+
+/**
+ * @brief A derived Plugin that constructs itself
+ */
+class DoubleClickShowcasePlugin : public Plugin
+{
+public:
+ DoubleClickShowcasePlugin() : Plugin()
+ {
+ Status status = Init("H3.DoubleClickShowcase");
+ if (status == Status::Success)
+ Start();
+#ifdef SHOW_ERROR_MESSAGE_ON_FAIL
+ else
+ ShowError("H3.DoubleClickShowcase", status);
+#endif
+ }
+
+ static DoubleClickShowcasePlugin& GetPlugin();
+
+private:
+ void Start();
+
+public:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can be accessed from anywhere using the plugin.
+ //
+ //======================================================================================
+
+ int __stdcall _HH_CheckDoubleClick(HiHook* h, h3::H3InputManager* This, int* a2);
+
+private:
+ //======================================================================================
+ //
+ // Data or methods can be added here which can only be accessed from within the plugin.
+ //
+ //======================================================================================
+ static constexpr INT MT_DOUBLE_CLICK = 0x80;
+ bool m_doubleClicked;
+};
\ No newline at end of file
diff --git a/DoubleClickShowcase/src/DoubleClickShowcase.cpp b/DoubleClickShowcase/src/DoubleClickShowcase.cpp
new file mode 100644
index 0000000..a8e0f76
--- /dev/null
+++ b/DoubleClickShowcase/src/DoubleClickShowcase.cpp
@@ -0,0 +1,56 @@
+#include "DoubleClickShowcase.hpp"
+
+using namespace h3;
+
+DoubleClickShowcasePlugin DoubleClickShowcase;
+
+DoubleClickShowcasePlugin& DoubleClickShowcasePlugin::GetPlugin()
+{
+ return DoubleClickShowcase;
+}
+
+//===================================================================================
+//
+// ADDITIONAL METHODS AND STRUCTURES
+//
+//===================================================================================
+
+
+//===================================================================================
+//
+// HOOKS
+//
+//===================================================================================
+
+int __stdcall DoubleClickShowcasePlugin::_HH_CheckDoubleClick(HiHook* h, h3::H3InputManager* This, int* a2)
+{
+ auto& msg = This->GetCurrentMessage();
+ if (msg.message != MT_DOUBLE_CLICK)
+ m_doubleClicked = false;
+ else
+ {
+ msg.message = H3InputManager::eMessageType::MT_LBUTTON_DBLCLK; // reset to h3 default value
+ m_doubleClicked = true;
+ F_MessageBox("Double-click detected!");
+ }
+
+ return THISCALL_2(int, h->GetDefaultFunc(), This, a2);
+}
+
+int __stdcall _HH_CheckDoubleClick(HiHook* h, H3InputManager* This, int* a2)
+{
+ return DoubleClickShowcase._HH_CheckDoubleClick(h, This, a2);
+}
+
+/**
+ * @brief This member function is used to install all your hooks.
+ * e.g. Hook(0x123456, MyHook);
+ * writes a hook at 0x123456 to access MyHook (LoHook or H3NakedFunction, depending on MyHook)
+ * e.g. Hook(0x123456, Call, Thiscall, MyHook);
+ * writes a HiHook at 0x123456, on a CALL instruction with convention __thiscall, and default hook type EXTENDED_
+ */
+void DoubleClickShowcasePlugin::Start()
+{
+ DwordPatch(0x4EC3F2 + 2, MT_DOUBLE_CLICK);
+ Hook(0x4EC660, Splice, Thiscall, ::_HH_CheckDoubleClick);
+}
diff --git a/DoubleClickShowcase/src/DoubleClickShowcaseMain.cpp b/DoubleClickShowcase/src/DoubleClickShowcaseMain.cpp
new file mode 100644
index 0000000..b092a6a
--- /dev/null
+++ b/DoubleClickShowcase/src/DoubleClickShowcaseMain.cpp
@@ -0,0 +1,17 @@
+//====================================================================================
+//
+// A HoMM III plugin using the H3API library.
+//
+// Created with the H3Plugin Template.
+// Title: DoubleClickShowcase
+// Creation: 1/15/2021 4:05:15 PM
+//
+//====================================================================================
+
+#define WIN32_LEAN_AND_MEAN
+#include
+
+BOOL APIENTRY DllMain(HMODULE, DWORD, LPVOID)
+{
+ return TRUE;
+}
\ No newline at end of file
diff --git a/H3.AssetLoader/H3.AssetLoader.vcxproj b/H3.AssetLoader/H3.AssetLoader.vcxproj
deleted file mode 100644
index 60584a8..0000000
--- a/H3.AssetLoader/H3.AssetLoader.vcxproj
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {f66148b3-06a1-4bfc-b8df-2b8933ac6464}
- Win32Proj
- H3_AssetLoader
- 10.0.17763.0
-
-
-
- DynamicLibrary
- true
- v141_xp
- Unicode
-
-
- DynamicLibrary
- false
- v141_xp
- true
- Unicode
-
-
- DynamicLibrary
- true
- v141
- Unicode
-
-
- DynamicLibrary
- false
- v141
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
-
-
- false
-
-
-
- Level3
- MaxSpeed
- true
- true
- _H3API_PATCHER_X86_;_H3API_EXCEPTION_;_H3API_LIBRARY_;PLUGIN_NAME="$(ProjectName)";WIN32;NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)H3API\lib
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
- Async
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- PLUGIN_NAME="$(ProjectName)";WIN32;_DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)Headers\;
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
-
-
- true
- Windows
-
-
-
-
- Level3
- Disabled
- _DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- true
- true
- Windows
-
-
-
-
-
-
-
-
-
-
-
- {405b8023-d064-492d-a0df-89b070b26923}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/H3.AssetLoader/include/Hooks.hpp b/H3.AssetLoader/include/Hooks.hpp
deleted file mode 100644
index eb09103..0000000
--- a/H3.AssetLoader/include/Hooks.hpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _HOOKS_HPP_
-#define _HOOKS_HPP_
-
-#define _H3API_PLUGINS_
-#include "H3API.hpp"
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-extern h3::H3String AssetLoaderError;
-extern LPCSTR defPath;
-extern LoHook* DefHook;
-
-void hooks_init(PatcherInstance* pi);
-
-extern "C" __declspec(dllexport) h3::H3Plugin::AssetLoader::H3AssetLoader* GetAssetLoader_();
-
-#endif
\ No newline at end of file
diff --git a/H3.AssetLoader/src/Hooks.cpp b/H3.AssetLoader/src/Hooks.cpp
deleted file mode 100644
index c54323f..0000000
--- a/H3.AssetLoader/src/Hooks.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-#include "Hooks.hpp"
-
-
-using namespace h3;
-
-constexpr CHAR MissingPath[] = "Path not provided.";
-constexpr CHAR MissingFileName[] = "File name not provided.";
-constexpr CHAR ErrorReadingFile[] = "Could not read file at provided path.";
-constexpr CHAR MemoryAllocation[] = "Could not allocate memory.";
-constexpr CHAR AlreadyExists[] = "An asset already exists with the provided name.";
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Custom structures and functions
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-class TempLoHook
-{
- LoHook* lh;
-public:
- TempLoHook(LoHook* h) :
- lh(h)
- {
- if (lh)
- lh->Apply();
- }
- ~TempLoHook()
- {
- if (lh)
- lh->Undo();
- }
-};
-
-BOOL ValidateParameters(LPCSTR const filepath, LPCSTR const h3name)
-{
- if (!filepath)
- {
- AssetLoaderError = MissingPath;
- return FALSE;
- }
-
- if (!h3name)
- {
- AssetLoaderError = MissingFileName;
- return FALSE;
- }
-
- if (!H3Path::IsFile(filepath))
- {
- AssetLoaderError = ErrorReadingFile;
- return FALSE;
- }
-
- if (P_ResourceManager()->FindItem(h3name))
- {
- AssetLoaderError = AlreadyExists;
- return FALSE;
- }
-
- return TRUE;
-}
-
-PUINT8 GetFileBuffer(LPCSTR const filepath, DWORD& fileSize)
-{
- H3File f;
- if (!f.Open(filepath) || !f.ReadToBuffer())
- {
- AssetLoaderError = ErrorReadingFile;
- return nullptr;
- }
-
- fileSize = f.Size();
- return f.ReleaseBuffer();
-}
-
-H3LoadedPcx* LoadPcxFromFile(LPCSTR const filepath, LPCSTR const h3name)
-{
- H3SEHandler seh;
- try
- {
- if (!ValidateParameters(filepath, h3name))
- return nullptr;
-
- auto& pcxAlloc = H3ObjectAllocator();
- H3LoadedPcx *pcx = pcxAlloc.allocate();
- if (pcx == nullptr)
- {
- AssetLoaderError = MemoryAllocation;
- return nullptr;
- }
- pcxAlloc.construct(pcx, h3name);
-
- int status = THISCALL_8(int, 0x44F710, pcx, filepath,
- IntAt(0x69E5DC), IntAt(0x69E5E4), IntAt(0x69E5D0),
- IntAt(0x69E5E0), IntAt(0x69E5F0), IntAt(0x69E5D8));
- if (status == 1)
- {
- AssetLoaderError = ErrorReadingFile;
- pcxAlloc.deallocate(pcx);
- return nullptr;
- }
- if (status == 2)
- {
- AssetLoaderError = MemoryAllocation;
- pcxAlloc.deallocate(pcx);
- return nullptr;
- }
- pcx->AddToResourceManager();
- pcx->IncreaseReferences();
- return pcx;
- }
- catch (H3Exception& e)
- {
- AssetLoaderError = e.what();
- return nullptr;
- }
-}
-
-H3WavFile* LoadWavFromFile(LPCSTR const filepath, LPCSTR const h3name)
-{
- H3SEHandler seh;
- try
- {
- if (!ValidateParameters(filepath, h3name))
- return nullptr;
-
- DWORD fileSize;
- PUINT8 fileBuffer = GetFileBuffer(filepath, fileSize);
- if (fileBuffer == nullptr)
- return nullptr;
-
- auto& wavAlloc = H3ObjectAllocator();
- H3WavFile* wav = wavAlloc.allocate();
- if (wav == nullptr)
- {
- F_delete(fileBuffer);
- AssetLoaderError = MemoryAllocation;
- return nullptr;
- }
- wavAlloc.construct(wav, h3name, fileBuffer, fileSize);
-
- wav->AddToResourceManager();
- wav->IncreaseReferences();
- return wav;
- }
- catch (H3Exception& e)
- {
- AssetLoaderError = e.what();
- return nullptr;
- }
-}
-
-_LHF_(DefFromFile)
-{
- DWORD fileSize;
- PUINT8 fileBuffer = GetFileBuffer(defPath, fileSize);
- if (fileBuffer == nullptr)
- return EXEC_DEFAULT;
-
- c->Local(8) = fileBuffer;
- c->edi = int(fileBuffer);
- c->return_address = 0x55CB64;
- return NO_EXEC_DEFAULT;
-}
-
-H3LoadedDef* LoadDefFromFile(LPCSTR const filePath, LPCSTR const h3name)
-{
- H3SEHandler seh;
- try
- {
- if (!ValidateParameters(filePath, h3name))
- return nullptr;
-
- defPath = filePath;
-
- // * applies DefHook for the duration of this scope
- TempLoHook tlh(DefHook);
- H3LoadedDef* def = H3LoadedDef::Load(h3name);
-
- // * since H3LoadedDef::Load() is used, reference is already increased
- //def->IncreaseReferences();
- return def;
- }
- catch (H3Exception& e)
- {
- AssetLoaderError = e.what();
- return nullptr;
- }
-}
-
-static class H3AssetLoaderInternal : public H3Plugin::AssetLoader::H3AssetLoader
-{
- DWORD m_assetsLoaded;
-public:
- virtual INT NumberAdded() override;
- virtual LPCSTR GetLastError() override;
- virtual H3LoadedPcx* LoadPcxFromFile(LPCSTR const filepath, LPCSTR const h3name) override;
- virtual H3WavFile* LoadWavFromFile(LPCSTR const filepath, LPCSTR const h3name) override;
- virtual H3LoadedDef* LoadDefFromFile(LPCSTR const filepath, LPCSTR const h3name) override;
-}InternalAssetLoader;
-
-INT H3AssetLoaderInternal::NumberAdded()
-{
- return m_assetsLoaded;
-}
-
-LPCSTR H3AssetLoaderInternal::GetLastError()
-{
- return AssetLoaderError.String();
-}
-
-H3LoadedPcx * H3AssetLoaderInternal::LoadPcxFromFile(LPCSTR const filepath, LPCSTR const h3name)
-{
- H3LoadedPcx* pcx = ::LoadPcxFromFile(filepath, h3name);
- if (pcx)
- ++m_assetsLoaded;
- return pcx;
-}
-
-H3WavFile * H3AssetLoaderInternal::LoadWavFromFile(LPCSTR const filepath, LPCSTR const h3name)
-{
- H3WavFile* wav = ::LoadWavFromFile(filepath, h3name);
- if (wav)
- ++m_assetsLoaded;
- return wav;
-}
-
-H3LoadedDef * H3AssetLoaderInternal::LoadDefFromFile(LPCSTR const filepath, LPCSTR const h3name)
-{
- H3LoadedDef* def = ::LoadDefFromFile(filepath, h3name);
- if (def)
- ++m_assetsLoaded;
- return def;
-}
-
-
-H3Plugin::AssetLoader::H3AssetLoader * GetAssetLoader_()
-{
- return &InternalAssetLoader;
-}
-
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-H3String AssetLoaderError;
-LPCSTR defPath;
-LoHook* DefHook;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Hooks
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-
-void hooks_init(PatcherInstance* pi)
-{
- // * only create, do not apply
- DefHook = pi->CreateLoHook(0x55CA26, DefFromFile);
-}
-
-
diff --git a/H3.AssetLoader/src/Main.cpp b/H3.AssetLoader/src/Main.cpp
deleted file mode 100644
index 5db9364..0000000
--- a/H3.AssetLoader/src/Main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Created with the H3Plugin Template
- * A HoMM III plugin using the H3API library.
- */
-
-#include "Hooks.hpp"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = FALSE;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
-
- Patcher *p = _P = GetPatcher();
- if (!p)
- break;
-
- // * make sure this plugin only installs once
- if (!p->GetInstance(PLUGIN_NAME))
- {
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
- if (!pi)
- break;
- hooks_init(pi);
- }
- }
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- default:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.Battlefields/H3.Battlefields.vcxproj.filters b/H3.Battlefields/H3.Battlefields.vcxproj.filters
deleted file mode 100644
index d2f2d5a..0000000
--- a/H3.Battlefields/H3.Battlefields.vcxproj.filters
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Source Files
-
-
- Source Files
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
-
\ No newline at end of file
diff --git a/H3.Battlefields/H3.Battlefields.vcxproj.user b/H3.Battlefields/H3.Battlefields.vcxproj.user
deleted file mode 100644
index baf2417..0000000
--- a/H3.Battlefields/H3.Battlefields.vcxproj.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- false
-
-
\ No newline at end of file
diff --git a/H3.Battlefields/include/Hooks.h b/H3.Battlefields/include/Hooks.h
deleted file mode 100644
index 9e3caf7..0000000
--- a/H3.Battlefields/include/Hooks.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _HOOKS_H_
-#define _HOOKS_H_
-
-#pragma once
-
-#define _H3API_PATCHER_X86_
-#include "H3API.hpp"
-
-// * 20 valid scenes
-constexpr UINT SCENE_COUNT = 20;
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-// * should default scenes be considered
-// * when randomly selecting?
-extern INT minScene;
-
-// * simple struc to contain number of scenes
-// * and prefix of custom background
-struct H3CombatScenes
-{
- INT32 count;
- PCHAR name;
-};
-
-// * structure to hold all custom data
-extern H3CombatScenes CustomScenes[SCENE_COUNT];
-
-// * installs all TextColor hooks
-void Hooks_init(PatcherInstance *pi);
-
-
-#endif /* #define _HOOKS_H_ */
\ No newline at end of file
diff --git a/H3.Battlefields/include/Ini.h b/H3.Battlefields/include/Ini.h
deleted file mode 100644
index 7ddf4ba..0000000
--- a/H3.Battlefields/include/Ini.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _INI_H_
-#define _INI_H_
-
-#pragma once
-
-int Read_Ini();
-
-#endif /* #define _INI_H_ */
\ No newline at end of file
diff --git a/H3.Battlefields/src/Hooks.cpp b/H3.Battlefields/src/Hooks.cpp
deleted file mode 100644
index dd61bb6..0000000
--- a/H3.Battlefields/src/Hooks.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-#include "Hooks.h"
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-
-INT minScene;
-
-// * a text buffer to print the scene name
-CHAR sceneBuff[32];
-
-// * default background addresses
-enum eCombatBackgrounds
-{
- CmBkLava_pcx = 0x66D048, // Lava
- CmBkSub_pcx = 0x66D058, // Subterranean
- CmBkRgh_pcx = 0x66D064, // Rough
- CmBkSwmp_pcx = 0x66D070, // Swamp
- CmBkSnMt_pcx = 0x66D080, // Snow
- CmBkSnTr_pcx = 0x66D090, // Snow
- CmBkGrMt_pcx = 0x66D0A0, // Grass
- CmBkGrTr_pcx = 0x66D0B0, // Grass
- CmBkDes_pcx = 0x66D0C0, // Sand
- CmBkDrTr_pcx = 0x66D0CC, // Dirt
- CmBkDrMt_pcx = 0x66D0DC, // Dirt
- CmBkDrDd_pcx = 0x66D0EC, // Dirt
- CmBkMC_pcx = 0x66D0FC, // Magic Clouds
- CmBkRK_pcx = 0x66D108, // Rocklands
- CmBkFF_pcx = 0x66D114, // Fiery Field
- CmBkLP_pcx = 0x66D120, // Lucid Pools
- CmBkCF_pcx = 0x66D12C, // Clover field
- CmBkEF_pcx = 0x66D138, // Evil Fog
- CmBkHG_pcx = 0x66D144, // Holy Grounds
- CmBkCur_pcx = 0x66D150, // Cursed ground
- CmBkMag_pcx = 0x66D15C, // Magic Plains
- CmBkBch_pcx = 0x66FF40, // Coast
- CmBkDeck_pcx = 0x66FF4C, // Land vs Boat
- CmBkBoat_pcx = 0x66FF5C, // Boat v Boat
-};
-
-// * index value of terrains used here
-enum eTerrainIndex
-{
- TI_LAVA,
- TI_SUBTERRA,
- TI_ROUGH,
- TI_SWAMP,
- TI_SNOW,
- TI_GRASS,
- TI_DESERT,
- TI_DIRT,
- TI_CLOUDS,
- TI_ROCKLANDS,
- TI_FIERY,
- TI_LUCID,
- TI_CLOVER,
- TI_EVILFOG,
- TI_HOLY,
- TI_CURSED,
- TI_MAGIC,
- TI_COAST,
- TI_DECK,
- TI_BOAT,
-};
-
-// * structure to hold all custom data
-H3CombatScenes CustomScenes[SCENE_COUNT] =
-{
- { 0, "Lava" },
- { 0, "Subterra" },
- { 0, "Rough" },
- { 0, "Swamp" },
- { 0, "Snow" },
- { 0, "Grass" },
- { 0, "Desert" },
- { 0, "Dirt" },
- { 0, "Clouds" },
- { 0, "Rocklands" },
- { 0, "Fiery" },
- { 0, "Lucid" },
- { 0, "Clover" },
- { 0, "EvilFog" },
- { 0, "Holy" },
- { 0, "Cursed" },
- { 0, "Magic" },
- { 0, "Coast" },
- { 0, "Deck" },
- { 0, "Boat" },
-};
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Hooks
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-_LHF_(NewBattleGrounds)
-{
- INT sceneID;
-
- using cb = eCombatBackgrounds;
- using ti = eTerrainIndex;
-
- // * extract scene type
- switch (c->eax)
- {
- case cb::CmBkLava_pcx:
- sceneID = ti::TI_LAVA;
- break;
- case cb::CmBkSub_pcx:
- sceneID = ti::TI_SUBTERRA;
- break;
- case cb::CmBkRgh_pcx:
- sceneID = ti::TI_ROUGH;
- break;
- case cb::CmBkSwmp_pcx:
- sceneID = ti::TI_SWAMP;
- break;
- case cb::CmBkSnMt_pcx:
- case cb::CmBkSnTr_pcx:
- sceneID = ti::TI_SNOW;
- break;
- case cb::CmBkGrMt_pcx:
- case cb::CmBkGrTr_pcx:
- sceneID = ti::TI_GRASS;
- break;
- case cb::CmBkDes_pcx:
- sceneID = ti::TI_DESERT;
- break;
- case cb::CmBkDrTr_pcx:
- case cb::CmBkDrMt_pcx:
- case cb::CmBkDrDd_pcx:
- sceneID = ti::TI_DIRT;
- break;
- case cb::CmBkMC_pcx:
- sceneID = ti::TI_CLOUDS;
- break;
- case cb::CmBkRK_pcx:
- sceneID = ti::TI_ROCKLANDS;
- break;
- case cb::CmBkFF_pcx:
- sceneID = ti::TI_FIERY;
- break;
- case cb::CmBkLP_pcx:
- sceneID = ti::TI_LUCID;
- break;
- case cb::CmBkCF_pcx:
- sceneID = ti::TI_CLOVER;
- break;
- case cb::CmBkEF_pcx:
- sceneID = ti::TI_EVILFOG;
- break;
- case cb::CmBkHG_pcx:
- sceneID = ti::TI_HOLY;
- break;
- case cb::CmBkCur_pcx:
- sceneID = ti::TI_CURSED;
- break;
- case cb::CmBkMag_pcx:
- sceneID = ti::TI_MAGIC;
- break;
- case cb::CmBkBch_pcx:
- sceneID = ti::TI_COAST;
- break;
- case cb::CmBkDeck_pcx:
- sceneID = ti::TI_DECK;
- break;
- case cb::CmBkBoat_pcx:
- sceneID = ti::TI_BOAT;
- break;
- default:
- return EXEC_DEFAULT;
- }
-
- // * only trigger if there is a custom background
- if (INT maxValue = CustomScenes[sceneID].count)
- {
- // * pick a random scene (or not, depends on user choice)
- INT randScene = h3::H3Random::RandBetween(minScene, maxValue);
- // * the scene is not default
- if (randScene)
- {
- sprintf(sceneBuff, "%s%02d.pcx", CustomScenes[sceneID].name, randScene);
- c->eax = (int)sceneBuff;
- }
- }
-
- return EXEC_DEFAULT;
-}
-
-void Hooks_init(PatcherInstance *pi)
-{
- // * not using h3's random function in order
- // * to avoid contaminating battle rng seed
- h3::H3Random::SetRandomSeed();
- pi->WriteLoHook(0x463833, NewBattleGrounds);
-}
\ No newline at end of file
diff --git a/H3.Battlefields/src/Ini.cpp b/H3.Battlefields/src/Ini.cpp
deleted file mode 100644
index 9451200..0000000
--- a/H3.Battlefields/src/Ini.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "Ini.h"
-#include "Hooks.h"
-#include
-
-// * returns 0 if failed
-int Read_Ini()
-{
- h3::H3SEHandler seh;
- try
- {
- h3::H3Ini ini;
- if (!ini.Open("Battlefields.ini"))
- return 0;
-
- auto options = ini["options"];
- if (options == ini.end())
- return 0;
-
- // * By default, we will use original backgrounds
- minScene = 1 - options["default"]->GetBool(true);
-
- // * load ini data to $CustomScenes
- for (UINT i = 0; i < SCENE_COUNT; i++)
- CustomScenes[i].count = options[CustomScenes[i].name]->GetInteger(0);
-
- return 1;
- }
- catch (h3::H3Exception& e)
- {
- e.ShowMessagebox();
- }
- return 0;
-}
\ No newline at end of file
diff --git a/H3.Battlefields/src/Main.Battlefields.cpp b/H3.Battlefields/src/Main.Battlefields.cpp
deleted file mode 100644
index 05e3206..0000000
--- a/H3.Battlefields/src/Main.Battlefields.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-*
-* This plugin adds the ability to have custom battlefields
-* when using SoD. It is inspired from the MornBattlefields
-* mod by Salamandre, using the beautiful backgrounds
-* by the original author, Morn.
-*
-* http://heroescommunity.com/viewthread.php3?TID=39062
-* http://heroescommunity.com/viewthread.php3?TID=22924
-*
-*/
-
-#include "Hooks.h"
-#include "Ini.h"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = 0;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
-
- if (Read_Ini())
- {
- Patcher *p = _P = GetPatcher();
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
- Hooks_init(pi);
- }
- else
- h3::H3Error::ShowErrorW(L"An error occured while trying to read 'Battlefields.ini'.\n\nThe Plugin will not be loaded.");
- }
- break;
-
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.CombatAnimation/H3.CombatAnimation.vcxproj b/H3.CombatAnimation/H3.CombatAnimation.vcxproj
deleted file mode 100644
index f0ee7cd..0000000
--- a/H3.CombatAnimation/H3.CombatAnimation.vcxproj
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
-
-
-
-
-
-
-
-
- {405b8023-d064-492d-a0df-89b070b26923}
-
-
-
- 15.0
- {02B7E3A4-24C2-4DED-9D51-29521DA8769A}
- Win32Proj
- H3CombatAnimation
- 7.0
-
-
-
- DynamicLibrary
- true
- v141_xp
- NotSet
-
-
- DynamicLibrary
- false
- v141_xp
- true
- NotSet
-
-
- DynamicLibrary
- true
- v141_xp
- NotSet
-
-
- DynamicLibrary
- false
- v141_xp
- true
- NotSet
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
-
-
- false
-
-
-
- Level3
- MaxSpeed
- true
- true
- PLUGIN_NAME="$(ProjectName)";WIN32;NDEBUG;H3COMBATANIMATION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- MultiThreaded
- Async
- $(SolutionDir)H3API\lib;$(ProjectDir)include;$(ProjectDir)src
- /Zc:threadSafeInit- %(AdditionalOptions)
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- PLUGIN_NAME="$(ProjectName)";WIN32;_DEBUG;H3COMBATANIMATION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- $(SolutionDir)H3API\lib;$(ProjectDir)include;$(ProjectDir)src
- MultiThreaded
- /Zc:threadSafeInit- %(AdditionalOptions)
-
-
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- _DEBUG;H3COMBATANIMATION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- $(SolutionDir)H3API\lib;$(ProjectDir)include;$(ProjectDir)src
-
-
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- NDEBUG;H3COMBATANIMATION_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- $(SolutionDir)H3API\lib;$(ProjectDir)include;$(ProjectDir)src
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
-
-
\ No newline at end of file
diff --git a/H3.CombatAnimation/H3.CombatAnimation.vcxproj.user b/H3.CombatAnimation/H3.CombatAnimation.vcxproj.user
deleted file mode 100644
index 0b0f24d..0000000
--- a/H3.CombatAnimation/H3.CombatAnimation.vcxproj.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- true
-
-
\ No newline at end of file
diff --git a/H3.CombatAnimation/include/Hooks.h b/H3.CombatAnimation/include/Hooks.h
deleted file mode 100644
index cc1ba6e..0000000
--- a/H3.CombatAnimation/include/Hooks.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _HOOKS_H_
-#define _HOOKS_H_
-
-#pragma once
-
-#define _H3API_PATCHER_X86_
-#include "H3API.hpp"
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-// * installs all hooks
-void Hooks_init(PatcherInstance *pi);
-
-#endif /* #define _HOOKS_H_ */
\ No newline at end of file
diff --git a/H3.CombatAnimation/src/Hooks.cpp b/H3.CombatAnimation/src/Hooks.cpp
deleted file mode 100644
index faf8291..0000000
--- a/H3.CombatAnimation/src/Hooks.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "Hooks.h"
-
-using namespace h3;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Hooks
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-// * milliseconds
-constexpr INT TIME_BETWEEN_ANIMATION = 95;
-
-int __stdcall _HH_CycleCombatScreen(HiHook *h, H3CombatManager *combat)
-{
- // can't use the default creature time reference
- // it would prevent random animations
- static DWORD last_animations[2][21];
-
- for (int side = 0; side < 2; ++side)
- {
- // only consider creatures on battlefield
- for (int i = 0; i < combat->heroMonCount[side] && i < 20; ++i)
- {
- auto mon = &combat->stacks[side][i];
- // under these conditions, a creature should not be animated
- if (mon->type == NH3Creatures::ARROW_TOWER
- || mon->info.flags.cannotMove
- || mon->activeSpellsDuration[H3Spell::eSpells::BLIND]
- || mon->activeSpellsDuration[H3Spell::eSpells::PARALYZE]
- || mon->activeSpellsDuration[H3Spell::eSpells::STONE]
- || mon->numberAlive == 0
- )
- continue;
-
- // if undergoing a current animation
- if (mon->animation != H3LoadedDef::CG_STANDING)
- continue;
-
- auto def = mon->def;
- if (!def)
- continue;
-
- if (def->groupsCount <= 1)
- continue;
- // check the standing defgroup is loaded...
- if (!def->activeGroups[H3LoadedDef::CG_STANDING])
- continue;
- // ... and exists
- auto standing = def->groups[H3LoadedDef::CG_STANDING];
- if (!standing)
- continue;
-
- // check that enough time has elapsed since last animation
- DWORD time = F_GetTime();
- DWORD &last_animation = last_animations[side][i];
- if (time - last_animation < TIME_BETWEEN_ANIMATION)
- continue;
-
- // indicate that this creature's frame should be redrawn
- combat->redrawCreatureFrame[side][i] = TRUE;
- // increase this creature's current frame animation
- ++mon->animationFrame %= standing->count;
- // add a bit of randomness for the next animation time reference
- // helps to prevent syncing of similar creature stacks
- last_animation = time + F_MultiplayerRNG(0, 10);
- }
- }
- // draw and refresh creature animations
- combat->RefreshCreatures();
- combat->Refresh();
-
- return THISCALL_1(int, h->GetDefaultFunc(), combat);
-}
-
-_LHF_(ResetDrawingRequest)
-{
- auto& cmb = P_CombatMgr();
- F_memset(cmb->redrawCreatureFrame, 0, sizeof(cmb->redrawCreatureFrame) + sizeof(cmb->heroAnimation) + sizeof(cmb->heroFlagAnimation));
- return EXEC_DEFAULT;
-}
-
-void Hooks_init(PatcherInstance *pi)
-{
- pi->WriteHiHook(0x495C50, SPLICE_, THISCALL_, _HH_CycleCombatScreen);
- pi->WriteLoHook(0x4631E6, ResetDrawingRequest);
-}
\ No newline at end of file
diff --git a/H3.CombatAnimation/src/Main.CombatAnimation.cpp b/H3.CombatAnimation/src/Main.CombatAnimation.cpp
deleted file mode 100644
index 7f3d48b..0000000
--- a/H3.CombatAnimation/src/Main.CombatAnimation.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * This plugin cycles through combat creature's
- * standing animation frames instead of being
- * idle while waiting for the 9000 ms interval
- * semi-random mouse-over animation.
- *
- */
-
-#include "Hooks.h"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = 0;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
-
- // * not to be used outside SoD
- h3::H3Version game;
- if (!game.sod())
- return TRUE;
-
- Patcher *p = _P = GetPatcher();
-
- // * make sure this plugin only installs once
- if (!p->GetInstance(PLUGIN_NAME))
- {
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
-
- Hooks_init(pi);
- }
- }
- break;
-
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.DataLoader/H3.DataLoader.vcxproj b/H3.DataLoader/H3.DataLoader.vcxproj
deleted file mode 100644
index 0fde99b..0000000
--- a/H3.DataLoader/H3.DataLoader.vcxproj
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {f408d879-375c-48a1-afa1-fe6a96a5ad0c}
- Win32Proj
- H3_DataLoader
- 10.0.17763.0
-
-
-
- DynamicLibrary
- true
- v141_xp
- Unicode
-
-
- DynamicLibrary
- false
- v141_xp
- true
- Unicode
-
-
- DynamicLibrary
- true
- v141
- Unicode
-
-
- DynamicLibrary
- false
- v141
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
-
-
- false
-
-
-
- Level3
- MaxSpeed
- true
- true
- _H3API_DONT_USE_MACROS_;_H3API_PATCHER_X86_;_H3API_EXCEPTION_;_H3API_LIBRARY_;PLUGIN_NAME="$(ProjectName)";WIN32;NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)H3API\lib
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
- Async
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- _H3API_DONT_USE_MACROS_;PLUGIN_NAME="$(ProjectName)";WIN32;_DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)Headers\;
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
-
-
- true
- Windows
-
-
-
-
- Level3
- Disabled
- _DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- true
- true
- Windows
-
-
-
-
-
-
-
-
-
-
-
- {405b8023-d064-492d-a0df-89b070b26923}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/H3.DataLoader/include/Hooks.hpp b/H3.DataLoader/include/Hooks.hpp
deleted file mode 100644
index cdb68a8..0000000
--- a/H3.DataLoader/include/Hooks.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _HOOKS_HPP_
-#define _HOOKS_HPP_
-
-#include "patcher_x86.hpp"
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-void hooks_init(PatcherInstance* pi);
-
-#endif
\ No newline at end of file
diff --git a/H3.DataLoader/src/Hooks.cpp b/H3.DataLoader/src/Hooks.cpp
deleted file mode 100644
index f2d3e3a..0000000
--- a/H3.DataLoader/src/Hooks.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-#include "Hooks.hpp"
-#include "H3API.hpp"
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Custom structures and functions
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-BOOL OpenFileFromDataDir(LPCSTR name, h3::H3File& file)
-{
- if (!name)
- return FALSE;
- h3::H3String path(*h3::P_DataPath() + name);
- if (!file.Open(path.String()))
- return FALSE;
- return TRUE;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Hooks
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-_LHF_(DefFromDataFolder)
-{
- h3::H3File file;
- if (!OpenFileFromDataDir(LPCSTR(c->ebx), file) || !file.ReadToBuffer())
- return EXEC_DEFAULT;
-
- PBYTE buffer = file.ReleaseBuffer();
- c->Local(8) = buffer;
- c->edi = int(buffer);
- c->return_address = 0x55CB64;
- return NO_EXEC_DEFAULT;
-}
-
-_LHF_(MskFromDataFolder_NewGame) // 55D160
-{
- h3::H3File file;
- h3::H3Msk msk;
- if (!OpenFileFromDataDir(LPCSTR(c->ecx), file) || !file.Read(msk))
- return EXEC_DEFAULT;
-
- h3::H3Msk::Msk passability, entrances;
- h3::H3ZStream& strm = c->Arg(1);
- if (!strm.Read(passability) || !strm.Read(entrances))
- {
- c->return_address = 0x5040A6; // failed to read
- return NO_EXEC_DEFAULT;
- }
-
- h3::H3ObjectAttributes& oa = *(h3::H3ObjectAttributes*)c->edi;
- oa.width = msk.width;
- oa.height = msk.height;
- msk.colorMask >> oa.colors;
- passability >> oa.passability;
- msk.shadowMask >> oa.shadows;
- entrances >> oa.entrances;
-
- c->return_address = 0x504131;
- return NO_EXEC_DEFAULT;
-}
-
-_LHF_(MskFromDataFolder_LoadTxt)
-{
- h3::H3File file;
- h3::H3Msk msk;
- if (!OpenFileFromDataDir(LPCSTR(c->ecx), file) || !file.Read(msk))
- return EXEC_DEFAULT;
-
- h3::H3LoadedMsk& mask = *(h3::H3LoadedMsk*)c->ebx;
- mask = msk;
- // skip whole bitfield setting, doing it manually
- c->return_address = 0x514AC1;
- return NO_EXEC_DEFAULT;
-}
-
-void hooks_init(PatcherInstance* pi)
-{
- LoHook* h = pi->CreateLoHook(0x55CA26, DefFromDataFolder);
- // apply last, allowing HDmod hooks to be executed first
- if (h)
- h->ApplyInsert(-1);
- pi->WriteLoHook(0x503E8D, MskFromDataFolder_NewGame);
- pi->WriteLoHook(0x514A15, MskFromDataFolder_LoadTxt);
-}
\ No newline at end of file
diff --git a/H3.DataLoader/src/Main.cpp b/H3.DataLoader/src/Main.cpp
deleted file mode 100644
index 5db9364..0000000
--- a/H3.DataLoader/src/Main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Created with the H3Plugin Template
- * A HoMM III plugin using the H3API library.
- */
-
-#include "Hooks.hpp"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = FALSE;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
-
- Patcher *p = _P = GetPatcher();
- if (!p)
- break;
-
- // * make sure this plugin only installs once
- if (!p->GetInstance(PLUGIN_NAME))
- {
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
- if (!pi)
- break;
- hooks_init(pi);
- }
- }
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- default:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.DisableHWrules/H3.DisableHWrules.vcxproj b/H3.DisableHWrules/H3.DisableHWrules.vcxproj
deleted file mode 100644
index bff0e83..0000000
--- a/H3.DisableHWrules/H3.DisableHWrules.vcxproj
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {53d52494-c9d5-4af7-b6e9-6da4fed900c0}
- Win32Proj
- H3_DisableHWrules
- 10.0.17763.0
-
-
-
- DynamicLibrary
- true
- v141_xp
- Unicode
-
-
- DynamicLibrary
- false
- v141_xp
- true
- Unicode
-
-
- DynamicLibrary
- true
- v141
- Unicode
-
-
- DynamicLibrary
- false
- v141
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
-
-
- false
-
-
-
- Level3
- MaxSpeed
- true
- true
- _H3API_PATCHER_X86_;_H3API_EXCEPTION_;_H3API_LIBRARY_;PLUGIN_NAME="$(ProjectName)";WIN32;NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)H3API\lib
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
- Async
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- PLUGIN_NAME="$(ProjectName)";WIN32;_DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)Headers\;
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
-
-
- true
- Windows
-
-
-
-
- Level3
- Disabled
- _DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- true
- true
- Windows
-
-
-
-
-
-
-
-
-
-
-
- {405b8023-d064-492d-a0df-89b070b26923}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/H3.DisableHWrules/include/Hooks.hpp b/H3.DisableHWrules/include/Hooks.hpp
deleted file mode 100644
index cdb68a8..0000000
--- a/H3.DisableHWrules/include/Hooks.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _HOOKS_HPP_
-#define _HOOKS_HPP_
-
-#include "patcher_x86.hpp"
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-void hooks_init(PatcherInstance* pi);
-
-#endif
\ No newline at end of file
diff --git a/H3.DisableHWrules/src/Hooks.cpp b/H3.DisableHWrules/src/Hooks.cpp
deleted file mode 100644
index 7aa4405..0000000
--- a/H3.DisableHWrules/src/Hooks.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include "Hooks.hpp"
-#include "H3API.hpp"
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Custom structures and functions
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Hooks
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-_LHF_(DisableHWrules)
-{
- auto wzx = _P->GetInstance("wzx_HW");
- if (wzx)
- wzx->UndoAll();
- return EXEC_DEFAULT;
-}
-
-void hooks_init(PatcherInstance* pi)
-{
- pi->WriteLoHook(0x4F823F, DisableHWrules);
-}
\ No newline at end of file
diff --git a/H3.DisableHWrules/src/Main.cpp b/H3.DisableHWrules/src/Main.cpp
deleted file mode 100644
index 5db9364..0000000
--- a/H3.DisableHWrules/src/Main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Created with the H3Plugin Template
- * A HoMM III plugin using the H3API library.
- */
-
-#include "Hooks.hpp"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = FALSE;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
-
- Patcher *p = _P = GetPatcher();
- if (!p)
- break;
-
- // * make sure this plugin only installs once
- if (!p->GetInstance(PLUGIN_NAME))
- {
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
- if (!pi)
- break;
- hooks_init(pi);
- }
- }
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- default:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.DoubleClickShowcase/H3.DoubleClickShowcase.vcxproj b/H3.DoubleClickShowcase/H3.DoubleClickShowcase.vcxproj
deleted file mode 100644
index 0c8918b..0000000
--- a/H3.DoubleClickShowcase/H3.DoubleClickShowcase.vcxproj
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {a35bb743-b246-4b07-b174-92314ff3c933}
- Win32Proj
- H3_DoubleClickShowcase
- 10.0.17763.0
-
-
-
- DynamicLibrary
- true
- v141_xp
- Unicode
-
-
- DynamicLibrary
- false
- v141_xp
- true
- Unicode
-
-
- DynamicLibrary
- true
- v141
- Unicode
-
-
- DynamicLibrary
- false
- v141
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
-
-
- false
-
-
-
- Level3
- MaxSpeed
- true
- true
- _H3API_PATCHER_X86_;_H3API_EXCEPTION_;_H3API_LIBRARY_;PLUGIN_NAME="$(ProjectName)";WIN32;NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)H3API\lib
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
- Async
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- PLUGIN_NAME="$(ProjectName)";WIN32;_DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)Headers\;
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
-
-
- true
- Windows
-
-
-
-
- Level3
- Disabled
- _DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- true
- true
- Windows
-
-
-
-
-
-
-
-
-
-
-
- {405b8023-d064-492d-a0df-89b070b26923}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/H3.DoubleClickShowcase/include/Hooks.hpp b/H3.DoubleClickShowcase/include/Hooks.hpp
deleted file mode 100644
index cdb68a8..0000000
--- a/H3.DoubleClickShowcase/include/Hooks.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _HOOKS_HPP_
-#define _HOOKS_HPP_
-
-#include "patcher_x86.hpp"
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-void hooks_init(PatcherInstance* pi);
-
-#endif
\ No newline at end of file
diff --git a/H3.DoubleClickShowcase/src/Hooks.cpp b/H3.DoubleClickShowcase/src/Hooks.cpp
deleted file mode 100644
index aa195d6..0000000
--- a/H3.DoubleClickShowcase/src/Hooks.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include "Hooks.hpp"
-#include "H3API.hpp"
-
-using namespace h3;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Custom structures and functions
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Hooks
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-BOOL8 GDoubleClicked;
-constexpr INT MT_DOUBLECLICK = 0x80;
-int __stdcall _HH_CheckDoubleClick(HiHook* h, H3InputManager* This, int* a2)
-{
- auto& msg = This->GetCurrentMessage();
- if (msg.message != MT_DOUBLECLICK)
- GDoubleClicked = false;
- else
- {
- msg.message = H3InputManager::eMessageType::MT_LBUTTON_DBLCLK; // reset to h3 default value
- GDoubleClicked = true;
- F_MessageBox("Double-click detected!");
- }
-
- return THISCALL_2(int, h->GetDefaultFunc(), This, a2);
-}
-
-void hooks_init(PatcherInstance* pi)
-{
- H3Patcher::DwordPatch(0x4EC3F2 + 2, MT_DOUBLECLICK);
- pi->WriteHiHook(0x4EC660, SPLICE_, THISCALL_, _HH_CheckDoubleClick);
-}
\ No newline at end of file
diff --git a/H3.DoubleClickShowcase/src/Main.cpp b/H3.DoubleClickShowcase/src/Main.cpp
deleted file mode 100644
index 5db9364..0000000
--- a/H3.DoubleClickShowcase/src/Main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Created with the H3Plugin Template
- * A HoMM III plugin using the H3API library.
- */
-
-#include "Hooks.hpp"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = FALSE;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
-
- Patcher *p = _P = GetPatcher();
- if (!p)
- break;
-
- // * make sure this plugin only installs once
- if (!p->GetInstance(PLUGIN_NAME))
- {
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
- if (!pi)
- break;
- hooks_init(pi);
- }
- }
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- default:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.FromTemplate/H3.FromTemplate.vcxproj b/H3.FromTemplate/H3.FromTemplate.vcxproj
deleted file mode 100644
index 0521c2f..0000000
--- a/H3.FromTemplate/H3.FromTemplate.vcxproj
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {26c73e16-c8a1-4456-96df-84246055622d}
- Win32Proj
- H3_FromTemplate
- 10.0.17763.0
-
-
-
- DynamicLibrary
- true
- v141_xp
- Unicode
-
-
- DynamicLibrary
- false
- v141_xp
- true
- Unicode
-
-
- DynamicLibrary
- true
- v141
- Unicode
-
-
- DynamicLibrary
- false
- v141
- true
- Unicode
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
-
-
- false
-
-
-
- Level3
- MaxSpeed
- true
- true
- _H3API_PATCHER_X86_;_H3API_EXCEPTION_;_H3API_LIBRARY_;PLUGIN_NAME="$(ProjectName)";WIN32;NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)H3API\lib
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
- Async
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- PLUGIN_NAME="$(ProjectName)";WIN32;_DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)Headers\;
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
-
-
- true
- Windows
-
-
-
-
- Level3
- Disabled
- _DEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- Windows
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- NDEBUG;PROJECTTEMPLATE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
-
-
- true
- true
- true
- Windows
-
-
-
-
-
-
-
-
-
-
-
- {405b8023-d064-492d-a0df-89b070b26923}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/H3.FromTemplate/H3.FromTemplate.vcxproj.filters b/H3.FromTemplate/H3.FromTemplate.vcxproj.filters
deleted file mode 100644
index e200b21..0000000
--- a/H3.FromTemplate/H3.FromTemplate.vcxproj.filters
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Source Files
-
-
- Source Files
-
-
-
-
- Header Files
-
-
-
\ No newline at end of file
diff --git a/H3.FromTemplate/H3.FromTemplate.vcxproj.user b/H3.FromTemplate/H3.FromTemplate.vcxproj.user
deleted file mode 100644
index be25078..0000000
--- a/H3.FromTemplate/H3.FromTemplate.vcxproj.user
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/H3.FromTemplate/include/Hooks.hpp b/H3.FromTemplate/include/Hooks.hpp
deleted file mode 100644
index cdb68a8..0000000
--- a/H3.FromTemplate/include/Hooks.hpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _HOOKS_HPP_
-#define _HOOKS_HPP_
-
-#include "patcher_x86.hpp"
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-void hooks_init(PatcherInstance* pi);
-
-#endif
\ No newline at end of file
diff --git a/H3.FromTemplate/src/Hooks.cpp b/H3.FromTemplate/src/Hooks.cpp
deleted file mode 100644
index f5dcd4e..0000000
--- a/H3.FromTemplate/src/Hooks.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "Hooks.hpp"
-#include "H3API.hpp"
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Custom structures and functions
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Hooks
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-
-void hooks_init(PatcherInstance* pi)
-{
-
-}
\ No newline at end of file
diff --git a/H3.FromTemplate/src/Main.cpp b/H3.FromTemplate/src/Main.cpp
deleted file mode 100644
index 5db9364..0000000
--- a/H3.FromTemplate/src/Main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Created with the H3Plugin Template
- * A HoMM III plugin using the H3API library.
- */
-
-#include "Hooks.hpp"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = FALSE;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
-
- Patcher *p = _P = GetPatcher();
- if (!p)
- break;
-
- // * make sure this plugin only installs once
- if (!p->GetInstance(PLUGIN_NAME))
- {
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
- if (!pi)
- break;
- hooks_init(pi);
- }
- }
- break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- default:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.ImageLoader/H3.ImageLoader.vcxproj b/H3.ImageLoader/H3.ImageLoader.vcxproj
deleted file mode 100644
index d8d7a77..0000000
--- a/H3.ImageLoader/H3.ImageLoader.vcxproj
+++ /dev/null
@@ -1,184 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
- Debug
- x64
-
-
- Release
- x64
-
-
-
- 15.0
- {6E8B343B-C214-4B7D-9E5B-81AC0ACCEEE3}
- Win32Proj
- H3ImageLoader
- 7.0
-
-
-
- DynamicLibrary
- true
- v141_xp
- NotSet
-
-
- DynamicLibrary
- false
- v141_xp
- true
- NotSet
-
-
- DynamicLibrary
- true
- v141_xp
- NotSet
-
-
- DynamicLibrary
- false
- v141_xp
- true
- NotSet
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- false
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
- $(SolutionDir)bin\$(Platform)\$(Configuration)\
- $(SolutionDir)bin\intermediates\$(ProjectName)\$(Platform)\$(Configuration)\
-
-
- true
-
-
- false
-
-
-
- Level3
- MaxSpeed
- true
- true
- PLUGIN_NAME="$(ProjectName)";WIN32;NDEBUG;H3IMAGELOADER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- Async
- MultiThreaded
- true
- $(SolutionDir)H3API\lib;$(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)ThirdParty\
- /Zc:threadSafeInit- %(AdditionalOptions)
-
-
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- PLUGIN_NAME="$(ProjectName)";WIN32;_DEBUG;H3IMAGELOADER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- false
- $(SolutionDir)H3API\lib;$(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)ThirdParty\
- /Zc:threadSafeInit- %(AdditionalOptions)
- MultiThreaded
-
-
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- Disabled
- _DEBUG;H3IMAGELOADER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- $(SolutionDir)H3API\lib;$(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)ThirdParty\
- MultiThreaded
-
-
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
- MaxSpeed
- true
- true
- NDEBUG;H3IMAGELOADER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
- true
- $(SolutionDir)H3API\lib;$(ProjectDir)include;$(ProjectDir)src;$(SolutionDir)ThirdParty\
- MultiThreaded
-
-
- true
- true
- true
- Windows
- $(SolutionDir)bin\msvc $(VisualStudioVersion)
- H3API.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
-
-
-
-
-
-
-
-
-
- {405b8023-d064-492d-a0df-89b070b26923}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/H3.ImageLoader/H3.ImageLoader.vcxproj.filters b/H3.ImageLoader/H3.ImageLoader.vcxproj.filters
deleted file mode 100644
index a29d785..0000000
--- a/H3.ImageLoader/H3.ImageLoader.vcxproj.filters
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Source Files
-
-
-
-
- Source Files
-
-
-
-
- Source Files
-
-
-
\ No newline at end of file
diff --git a/H3.ImageLoader/H3.ImageLoader.vcxproj.user b/H3.ImageLoader/H3.ImageLoader.vcxproj.user
deleted file mode 100644
index 0b0f24d..0000000
--- a/H3.ImageLoader/H3.ImageLoader.vcxproj.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- true
-
-
\ No newline at end of file
diff --git a/H3.ImageLoader/include/Hooks.h b/H3.ImageLoader/include/Hooks.h
deleted file mode 100644
index 00234cc..0000000
--- a/H3.ImageLoader/include/Hooks.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _HOOKS_H_
-#define _HOOKS_H_
-
-#pragma once
-
-#define _H3API_PATCHER_X86_
-#define _H3API_PLUGINS_
-#include "H3API.hpp"
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-// * installs all TextColor hooks
-void Hooks_init(PatcherInstance *pi);
-
-extern "C" __declspec(dllexport) h3::H3Plugin::ImageLoader::H3ImageLoader *GetImageLoader_();
-
-#endif /* #define _HOOKS_H_ */
\ No newline at end of file
diff --git a/H3.ImageLoader/src/Hooks.cpp b/H3.ImageLoader/src/Hooks.cpp
deleted file mode 100644
index 6e4638d..0000000
--- a/H3.ImageLoader/src/Hooks.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-#include "Hooks.h"
-#define STB_IMAGE_IMPLEMENTATION
-
-#include "stb_image.h"
-#define STB_IMAGE_RESIZE_IMPLEMENTATION
-#include "stb_image_resize.h"
-
-using namespace h3;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Third party handler
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-class ImageLoaderPcx16
-{
- int m_w;
- int m_h;
- int m_comp;
- stbi_uc *m_pixels;
- BOOL m_state;
-
- H3LoadedPcx16 *pcx16;
-
-public:
- ImageLoaderPcx16(LPCSTR filepath);
- ~ImageLoaderPcx16();
- BOOL Valid() { return m_state; }
- int Width() { return m_w; }
- int Height() { return m_h; }
- VOID Resize(int w, int h);
- H3LoadedPcx16* CreatePcx16(LPCSTR h3name);
- VOID RGB_to_BGR();
-};
-
-ImageLoaderPcx16::ImageLoaderPcx16(LPCSTR filepath)
-{
- m_pixels = stbi_load(filepath, &m_w, &m_h, &m_comp, STBI_rgb);
- m_state = m_pixels != nullptr;
-}
-
-ImageLoaderPcx16::~ImageLoaderPcx16()
-{
- if (m_pixels)
- stbi_image_free(m_pixels);
-}
-
-VOID ImageLoaderPcx16::Resize(int w, int h)
-{
- unsigned char* output = nullptr;
- stbir_resize_uint8(m_pixels, m_w, m_h, 0, output, w, h, 0, STBI_rgb);
- if (output)
- {
- m_pixels = output;
- m_w = w;
- m_h = h;
- }
- else
- {
- stbi__g_failure_reason = "Could not resize image.";
- m_pixels = nullptr;
- }
-}
-
-H3LoadedPcx16 * ImageLoaderPcx16::CreatePcx16(LPCSTR h3name)
-{
- H3LoadedPcx24 pcx24;
- pcx24.width = m_w;
- pcx24.height = m_h;
- pcx24.buffer = m_pixels;
-
- pcx16 = H3LoadedPcx16::Create(h3name, m_w, m_h);
- if (!pcx16)
- {
- stbi__g_failure_reason = "Could not create PCX16.";
- return nullptr;
- }
-
- // * use game assets to convert into pcx16 format
- pcx24.DrawToPcx16(0, 0, pcx16);
-
- pcx16->AddToResourceManager();
-
- // * so that it stays in the binary tree after use
- pcx16->IncreaseReferences();
-
- return pcx16;
-}
-
-VOID ImageLoaderPcx16::RGB_to_BGR()
-{
- stbi_uc * img = m_pixels;
-
- for (int j = 0; j < m_h; ++j)
- for (int i = 0; i < m_w; ++i)
- {
- stbi_uc b = img[2];
- img[2] = img[0];
- img[0] = b;
-
- img += STBI_rgb;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Custom structures and functions
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-using namespace H3Plugin::ImageLoader;
-
-static class H3ImageLoaderInternal : public H3ImageLoader
-{
- DWORD m_images_added;
-public:
- // * the number of images added by the plugin so far
- virtual INT NumberAdded() override;
-
- // * returns the last error
- virtual LPCSTR GetLastError() override;
-
- // * DOES NOT SUPPORT TRANSPARENCY
- // * @filepath - the complete path to the image you are looking to load
- // * @h3name - the name to use within the H3 assets (to recuperate the image later)
- // * @width and @height are optional, but can be used to resize the image
- virtual H3LoadedPcx16* LoadImageToPcx16(LPCSTR filepath, LPCSTR h3name, INT width = -1, INT height = -1) override;
-}InternalImageLoader;
-
-H3Plugin::ImageLoader::H3ImageLoader * GetImageLoader_()
-{
- return &InternalImageLoader;
-}
-
-INT H3ImageLoaderInternal::NumberAdded()
-{
- return m_images_added;
-}
-
-LPCSTR H3ImageLoaderInternal::GetLastError()
-{
- return stbi_failure_reason();
-}
-
-H3LoadedPcx16 * H3ImageLoaderInternal::LoadImageToPcx16(LPCSTR filepath, LPCSTR h3name, INT width, INT height)
-{
- if (!filepath)
- {
- stbi__g_failure_reason = "No filepath provided.";
- return nullptr;
- }
-
- if (!h3name)
- {
- stbi__g_failure_reason = "No h3name provided.";
- return nullptr;
- }
-
- if (P_ResourceManager()->FindItem(h3name))
- {
- stbi__g_failure_reason = "An asset already exists with the provided name.";
- return nullptr;
- }
-
- ImageLoaderPcx16 image(filepath);
- if (!image.Valid())
- return nullptr;
-
- UINT32 req_width = width > 0 ? width : image.Width();
- UINT32 req_height = height > 0 ? height : image.Height();
-
- // * no use making something too large
- req_width = std::min(req_width, *P_GameWidth());
- req_height = std::min(req_height, *P_GameHeight());
-
- if (req_width <= 0 || req_height <= 0)
- {
- stbi__g_failure_reason = "Invalid image size.";
- return nullptr;
- }
-
- if (req_width != image.Width() || req_height != image.Height())
- {
- image.Resize(req_width, req_height);
- if (!image.Valid())
- return nullptr;
- }
-
- // * swap blue and red for h3 format
- image.RGB_to_BGR();
-
- H3LoadedPcx16 *pcx = image.CreatePcx16(h3name);
- if (pcx)
- ++m_images_added;
- return pcx;
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-
-void Hooks_init(PatcherInstance *pi)
-{
- // * nothing here!
-}
-
diff --git a/H3.ImageLoader/src/Main.ImageLoader.cpp b/H3.ImageLoader/src/Main.ImageLoader.cpp
deleted file mode 100644
index 3984979..0000000
--- a/H3.ImageLoader/src/Main.ImageLoader.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "Hooks.h"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = 0;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
- Patcher *p = _P = GetPatcher();
-
- // * make sure this plugin only installs once
- if (!p->GetInstance(PLUGIN_NAME))
- {
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
-
- Hooks_init(pi);
- }
- }
- break;
-
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.LodTable/H3.LodTable.vcxproj.filters b/H3.LodTable/H3.LodTable.vcxproj.filters
deleted file mode 100644
index 564ae99..0000000
--- a/H3.LodTable/H3.LodTable.vcxproj.filters
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
-
-
-
-
- Source Files
-
-
- Source Files
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
-
\ No newline at end of file
diff --git a/H3.LodTable/H3.LodTable.vcxproj.user b/H3.LodTable/H3.LodTable.vcxproj.user
deleted file mode 100644
index 0b0f24d..0000000
--- a/H3.LodTable/H3.LodTable.vcxproj.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- true
-
-
\ No newline at end of file
diff --git a/H3.LodTable/include/Hooks.h b/H3.LodTable/include/Hooks.h
deleted file mode 100644
index 6542c27..0000000
--- a/H3.LodTable/include/Hooks.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef _HOOKS_H_
-#define _HOOKS_H_
-
-#pragma once
-
-#define _H3API_PATCHER_X86_
-#include "H3API.hpp"
-
-// * Global Patcher
-extern Patcher *_P;
-// * Global Patcher Instance
-extern PatcherInstance *_PI;
-
-// * the number of LODs that can be loaded
-constexpr INT LOD_COUNT = 1000;
-
-// * default LoD values
-#define h3_SoDLodTable 0x69D8A8
-#define LodTableCheck PtrAt(0x55944C + 1)
-
-// * new Lod table
-extern h3::H3Lod LodTable[LOD_COUNT];
-// * the number of LODs existing, 8 by default
-extern INT lastLod;
-
-// * initiates LodTable variables
-void Variables_init(Patcher *p);
-// * installs all LodTable hooks
-void Hooks_init(PatcherInstance *pi);
-
-#endif /* #define _HOOKS_H_ */
\ No newline at end of file
diff --git a/H3.LodTable/include/LodBase.h b/H3.LodTable/include/LodBase.h
deleted file mode 100644
index f024ed2..0000000
--- a/H3.LodTable/include/LodBase.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef _LODBASE_H_
-#define _LODBASE_H_
-
-#pragma once
-
-#include "Hooks.h"
-
-#pragma pack(push, 1)
-
-// * the format of data used when creating a LOD
-struct H3LodBase
-{
- INT index;
- INT loadStatus;
- CHAR name[32];
-
- // * loads lod data to custom table
- H3LodBase *Create(LPCSTR lodName, LPCSTR lodPath);
- // * adds lod to memory
- BOOL LoadItem(LPCSTR lodPath);
-};
-
-
-// * internal data relevant to LODs
-struct H3LodTypes
-{
- static struct LodTypesTable
- {
- INT number;
- INT *index;
- } table[4][3];
-
- static INT sequence[4][3][LOD_COUNT];
- static BOOL AddToList(INT ind);
- static BOOL DeleleteFromList(INT ind);
-};
-
-// * new Lod table
-extern h3::H3Lod LodTable[LOD_COUNT];
-// * the number of LODs existing, 8 by default
-extern INT lastLod;
-
-#pragma pack(pop)
-
-#endif /* #define _LODBASE_H_ */
\ No newline at end of file
diff --git a/H3.LodTable/src/Hooks.cpp b/H3.LodTable/src/Hooks.cpp
deleted file mode 100644
index 5dc7031..0000000
--- a/H3.LodTable/src/Hooks.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-#include "Hooks.h"
-#include "LodBase.h"
-
-using namespace h3;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Global variables
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-Patcher *_P;
-PatcherInstance *_PI;
-
-// * new Lod table
-H3Lod LodTable[LOD_COUNT];
-// * the number of LODs existing, 8 by default
-INT lastLod = 8;
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Functions
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-BOOL LoadCustomLod(LPCSTR lodName, LPCSTR lodPath)
-{
- H3LodBase newLod;
- return NULL != newLod.Create(lodName, lodPath);
-}
-
-DECLSPEC_NOINLINE int __stdcall LoadLodsFromFolder(LPCSTR path)
-{
- if (!path)
- return 0;
-
- H3Path dir(path);
- if (!dir.IsDirectory())
- return 0;
-
- int lodCount = 0;
-
- for (auto& it : dir)
- {
- if (it.IsDirectory())
- continue;
- LPCSTR ext = it.Extension();
- if (!ext)
- continue;
- if (!(F_strnicmp(ext, "lod", 3) == 0 || F_strnicmp(ext, "pac", 3) == 0))
- continue;
-
- H3String filePath(std::move(it.FilePath()));
- if (filePath.Empty())
- continue;
-
- lodCount += LoadCustomLod(it.FileName(), filePath.String());
- }
-
- return lodCount; // return number of successfully loaded LODs
-}
-
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-//
-// Hooks
-//
-//////////////////////////////////////////////////////////////////////////////////
-//////////////////////////////////////////////////////////////////////////////////
-
-// * set to occur after game path is created
-_LHF_(FindAndLoadLODs)
-{
- constexpr CHAR HD_PACKS_FOLDER[] = "_HD3_Data\\Packs\\";
-
- HDIni *hdini = _P->VarGetValue("HD.Ini.Main", NULL); // get HD.ini stored file data
- if (!hdini)
- return EXEC_DEFAULT;
-
- auto& packs = hdini->FindEntry("Packs"); // find entry
- if (packs == hdini->end() || packs->entryCount == 0)
- return EXEC_DEFAULT;
-
- const UINT num = packs->entryCount;
- H3String packPath(h3_GamePath); // set game path
- packPath.AppendA(HD_PACKS_FOLDER); // add plugins general path
- UINT len = packPath.Length(); // backup current length, for quick reset of packs directory
-
- for (UINT i = 0; i < num; i++)
- {
- packPath += packs[i]->GetText(); // add pack name to ...\_HD3_Data\Packs\ path
- packPath += '\\';
- LoadLodsFromFolder(packPath.String()); // load all LODs and PACs from this folder
- packPath.Truncate(len); // remove current pack name
- }
-
- return EXEC_DEFAULT;
-}
-
-void Variables_init(Patcher *p)
-{
- // * if you have a custom LOD folder, you can use this
- // * patcher_x86 variable to recuperate the folder loading function.
- // *
- // * Code example
- // *
- // * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // *
- // * Patcher *_P;
- // * PatcherInstance *_PI;
- // * UINT32 LoadingFunction = _P->VarGetValue("LodTable.Function", NULL);
- // * _PI->WriteLoHook(0x4EEA81, LoadCustomLODPath);
- // *
- // * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // *
- // * LoHook LoadCustomLODPath @ 0x4EEA81
- // *
- // * PCHAR path = "C:\\MyFolderName\\"
- // * INT numLoaded = 0;
- // * if (LoadingFunction)
- // * numLoaded = STDCALL_1(INT, LoadingFunction, path);
- // * return EXEC_DEFAULT;
- // *
- p->VarInit("LodTable.Function", (UINT)LoadLodsFromFolder);
-}
-
-void Hooks_init(PatcherInstance *pi)
-{
- // * checks for all active HDmod packs and loads LOD, PAC from these folders
- pi->WriteLoHook(0x4EEA79, FindAndLoadLODs);
-
- // * replace all LOD references to custom table
- pi->WriteDword(0x559395 + 1, (UINT)(&LodTable[0]));
- pi->WriteDword(0x5593A4 + 1, (UINT)(&LodTable[1]));
- pi->WriteDword(0x5593B3 + 1, (UINT)(&LodTable[2]));
- pi->WriteDword(0x5593C2 + 1, (UINT)(&LodTable[3]));
- pi->WriteDword(0x5593D1 + 1, (UINT)(&LodTable[4]));
- pi->WriteDword(0x5593E0 + 1, (UINT)(&LodTable[5]));
- pi->WriteDword(0x5593EF + 1, (UINT)(&LodTable[6]));
- pi->WriteDword(0x5593FE + 1, (UINT)(&LodTable[7]));
-
- pi->WriteDword(0x55944C + 1, (UINT)(LodTable));
- pi->WriteDword(0x55A571 + 2, (UINT)(LodTable));
- pi->WriteDword(0x55A629 + 2, (UINT)(LodTable));
-
- pi->WriteDword(0x55A577 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55A62F + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55A726 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55A7D8 + 1, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55ABB8 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55ABE1 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55AC3D + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55AC6A + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55AFC6 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55AFEF + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B04A + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B077 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B40D + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B436 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B492 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B4BF + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B7D0 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B7F9 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B852 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55B879 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55BBE3 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55BC0C + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55BC68 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55BC95 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55BEF8 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55BF21 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55C1C8 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55C1F1 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55CA54 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55CA7D + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55CAD7 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55CB00 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55D197 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55D1C0 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55D227 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55D250 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55D2A8 + 2, (UINT)(&LodTable[0].filePosition));
- pi->WriteDword(0x55D2C7 + 2, (UINT)(&LodTable[0].filePosition));
-
- // * copy existing LOD to custom LodTable
- // * this step is required as HDmod loads plugins after regular LOD table is populated
- F_memcpy((void*)LodTable, (void*)h3_SoDLodTable, (size_t)(sizeof(H3Lod) * 8));
-
- // * replace static table references
- pi->WriteDword(0x55A548 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55ABA3 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55AC28 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55AFB1 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55B035 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55B3F8 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55B47D + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55B7BB + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55B840 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55BBCE + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55BC53 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55BEE3 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55C1B3 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55C43F + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55CA38 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55CA3F + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55CABB + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55CAC2 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55D17B + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55D212 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55D296 + 3, (UINT)(H3LodTypes::table));
- pi->WriteDword(0x55CA31 + 3, (UINT)(&H3LodTypes::table[0][0].index));
- pi->WriteDword(0x55CAB4 + 3, (UINT)(&H3LodTypes::table[0][0].index));
- pi->WriteDword(0x55D174 + 3, (UINT)(&H3LodTypes::table[0][0].index));
- pi->WriteDword(0x55AB9C + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55AC21 + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55AFAA + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55B02E + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55B3F1 + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55B476 + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55B7B4 + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55B839 + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55BBC7 + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55BC4C + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55BEDC + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55C1AC + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55D20B + 3, (UINT)(&H3LodTypes::table[0][1]));
- pi->WriteDword(0x55AB95 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55AC1A + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55AFA3 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55B027 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55B3EA + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55B46F + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55B7AD + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55B832 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55BBC0 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55BC45 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55BED5 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55C1A5 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55D204 + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55D28F + 3, (UINT)(&H3LodTypes::table[0][1].index));
- pi->WriteDword(0x55C438 + 3, (UINT)(&H3LodTypes::table[0][2]));
-}
\ No newline at end of file
diff --git a/H3.LodTable/src/LodBase.cpp b/H3.LodTable/src/LodBase.cpp
deleted file mode 100644
index b392e16..0000000
--- a/H3.LodTable/src/LodBase.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "LodBase.h"
-
-// * existing H3LodType sequence, with room to add
-INT H3LodTypes::sequence[4][3][LOD_COUNT] =
-{
- { { 5, 1 }, { 4, 0 }, { 1, 0 } },
- { { 7, 3, 1 }, { 6, 2, 0 }, { 2, 1, 0 } },
- { { 1 }, { 0 }, { 1, 0 } },
- { { 1, 3 }, { 0, 2 }, { 1, 0 } }
-};
-
-// * the existing lod sequences
-H3LodTypes::LodTypesTable H3LodTypes::table[4][3] =
-{
- { { 2, sequence[0][0] }, { 2, sequence[0][1] }, { 2, sequence[0][2] } },
- { { 3, sequence[1][0] }, { 3, sequence[1][1] }, { 3, sequence[1][2] } },
- { { 1, sequence[2][0] }, { 1, sequence[2][1] }, { 2, sequence[2][2] } },
- { { 2, sequence[3][0] }, { 2, sequence[3][1] }, { 2, sequence[3][2] } }
-};
-
-H3LodBase * H3LodBase::Create(LPCSTR lodName, LPCSTR lodPath)
-{
- if (!lodName || !lodPath || lastLod >= LOD_COUNT)
- return NULL;
-
- h3::F_strncpy(this->name, lodName, 31);
- this->name[31] = 0;
- this->index = lastLod + 1;
- memset(&LodTable[this->index], 0, sizeof(h3::H3Lod));
- LodTable[this->index].Create(this->name);
- this->LoadItem(lodPath);
-
- return this;
-}
-
-BOOL H3LodBase::LoadItem(LPCSTR lodPath)
-{
- int r = FALSE;
- if (this->index < 0)
- return r;
-
- if ((&LodTable[this->index])->Load(lodPath))
- return r;
- r = TRUE;
- lastLod++;
- H3LodTypes::AddToList(this->index);
- return r;
-}
-
-BOOL H3LodTypes::DeleleteFromList(INT ind)
-{
- BOOL r = FALSE;
- if (ind >= 8 && ind < LOD_COUNT)
- {
- for (int i = 0; i < 4; i++)
- {
- for (int j = 0; j < 2; j++)
- {
- int n = table[i][j].number;
- int *t = table[i][j].index;
- for (int k = 0; k < n; k++)
- {
- if (t[k] == ind)
- {
- for (int l = k + 1; l < n; l++)
- t[l - 1] = t[l];
- t[n - 1] = 0;
- table[i][j].number -= 1;
- break;
- }
- }
- }
- }
- r = TRUE;
- }
- return r;
-}
-
-BOOL H3LodTypes::AddToList(INT ind)
-{
- BOOL r = FALSE;
- if (ind >= 8 && ind < LOD_COUNT)
- {
- for (int i = 0; i < 4; i++)
- {
- for (int j = 0; j < 2; j++)
- {
- int n = table[i][j].number;
- int *t = table[i][j].index;
-
- if (n >= LOD_COUNT)
- {
- DeleleteFromList(ind);
- return r;
- }
-
- for (int k = LOD_COUNT - 1; k > 0; k--)
- t[k] = t[k - 1];
- t[0] = ind;
- table[i][j].number += 1;
- }
- }
- r = TRUE;
- }
- return r;
-}
\ No newline at end of file
diff --git a/H3.LodTable/src/Main.LodTable.cpp b/H3.LodTable/src/Main.LodTable.cpp
deleted file mode 100644
index 423af62..0000000
--- a/H3.LodTable/src/Main.LodTable.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * This plugin was inspired from WoG's implementation
- * of additional LOD tables. The source code is
- * available at:
- *
- * https://github.com/GrayFace/wog/blob/master/T1/lod.cpp
- * https://github.com/GrayFace/wog/blob/master/T1/lod.h
- *
- * Many thanks to WoG team!
- *
- */
-
-#include "Hooks.h"
-
-BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
-{
- static BOOL pluginOn = 0;
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- if (!pluginOn)
- {
- pluginOn = TRUE;
-
- // * make sure this plugin only installs once, not to be used outside SoD
- h3::H3Version game;
-
- if (!game.sod() || LodTableCheck != h3_SoDLodTable)
- return TRUE;
-
- Patcher *p = _P = GetPatcher();
-
- _PI = p->CreateInstance(PLUGIN_NAME);
- PatcherInstance *pi = _PI;
-
- Hooks_init(pi);
- Variables_init(p);
-
-
- }
- break;
-
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
-}
\ No newline at end of file
diff --git a/H3.Plugin.Template/H3.Plugin.Template.csproj b/H3.Plugin.Template/H3.Plugin.Template.csproj
index 3c9ef2d..2a9b1bc 100644
--- a/H3.Plugin.Template/H3.Plugin.Template.csproj
+++ b/H3.Plugin.Template/H3.Plugin.Template.csproj
@@ -13,8 +13,8 @@
{77266006-7574-422B-9CA6-B2CD5C30E736}
Library
Properties
- H3.Plugin.Template
- H3.Plugin.Template
+ H3Plugin.Template
+ H3Plugin.Template
v4.6.1
false
false
@@ -47,15 +47,16 @@
-
+
Always
true
-
+
Always
true
-
+
+
Always
true
@@ -67,6 +68,7 @@
+