Release 1.2.2.0
- Added embedded icons support with Windows resources - Added icon extraction from embedded DLL resources - Include PNG icons as embedded resources - Updated gitignore for build artifacts - Icons are automatically extracted to addons/GolemHelper/icons/
This commit is contained in:
parent
8684c75f21
commit
f41ab40356
8 changed files with 169 additions and 11 deletions
55
.gitignore
vendored
55
.gitignore
vendored
|
|
@ -1,34 +1,43 @@
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
|
||||||
# Compiled Object files
|
# Compiled Object files
|
||||||
*.slo
|
*.slo
|
||||||
*.lo
|
*.lo
|
||||||
*.o
|
*.o
|
||||||
*.obj
|
*.obj
|
||||||
|
|
||||||
# Precompiled Headers
|
# Precompiled Headers
|
||||||
*.gch
|
*.gch
|
||||||
*.pch
|
*.pch
|
||||||
|
|
||||||
# Linker files
|
# Linker files
|
||||||
*.ilk
|
*.ilk
|
||||||
|
|
||||||
# Debugger Files
|
# Debugger Files
|
||||||
*.pdb
|
*.pdb
|
||||||
|
|
||||||
# Compiled Dynamic libraries
|
# Compiled Dynamic libraries
|
||||||
*.so
|
*.so
|
||||||
*.dylib
|
*.dylib
|
||||||
*.dll
|
*.dll
|
||||||
|
|
||||||
# Fortran module files
|
# Fortran module files
|
||||||
*.mod
|
*.mod
|
||||||
*.smod
|
*.smod
|
||||||
|
|
||||||
# Compiled Static libraries
|
# Compiled Static libraries
|
||||||
*.lai
|
*.lai
|
||||||
*.la
|
*.la
|
||||||
*.a
|
*.a
|
||||||
*.lib
|
*.lib
|
||||||
|
|
||||||
# Executables
|
# Executables
|
||||||
*.exe
|
*.exe
|
||||||
*.out
|
*.out
|
||||||
*.app
|
*.app
|
||||||
# debug information files
|
|
||||||
|
# Debug information files
|
||||||
*.dwo
|
*.dwo
|
||||||
|
|
||||||
# Visual Studio specific files
|
# Visual Studio specific files
|
||||||
|
|
@ -45,6 +54,16 @@
|
||||||
*.svclog
|
*.svclog
|
||||||
*.scc
|
*.scc
|
||||||
|
|
||||||
|
# Visual Studio additional files
|
||||||
|
*.vcxproj.user
|
||||||
|
*.vcxproj.filters
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
*.db
|
||||||
|
*.opendb
|
||||||
|
*.idb
|
||||||
|
*.exp
|
||||||
|
|
||||||
# Build folders
|
# Build folders
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
|
|
@ -68,3 +87,37 @@ bld/
|
||||||
*.read.*
|
*.read.*
|
||||||
*.write.*
|
*.write.*
|
||||||
link-*
|
link-*
|
||||||
|
|
||||||
|
# Backup files
|
||||||
|
*.bak
|
||||||
|
*~
|
||||||
|
|
||||||
|
# OS generated files
|
||||||
|
.DS_Store
|
||||||
|
.DS_Store?
|
||||||
|
._*
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
ehthumbs.db
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*.tmp
|
||||||
|
*.temp
|
||||||
|
|
||||||
|
# IDE files
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# Package files (vcpkg, NuGet)
|
||||||
|
packages/
|
||||||
|
vcpkg_installed/
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# JetBrains IDEs
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Resource compiled files
|
||||||
|
*.aps
|
||||||
BIN
GolemHelper/GolemHelper.rc
Normal file
BIN
GolemHelper/GolemHelper.rc
Normal file
Binary file not shown.
|
|
@ -151,6 +151,7 @@
|
||||||
<ClInclude Include="Dependencies\nexus\Nexus.h" />
|
<ClInclude Include="Dependencies\nexus\Nexus.h" />
|
||||||
<ClInclude Include="framework.h" />
|
<ClInclude Include="framework.h" />
|
||||||
<ClInclude Include="pch.h" />
|
<ClInclude Include="pch.h" />
|
||||||
|
<ClInclude Include="resource.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Dependencies\imgui\imgui.cpp">
|
<ClCompile Include="Dependencies\imgui\imgui.cpp">
|
||||||
|
|
@ -196,6 +197,13 @@
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="GolemHelper.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="Resources\GOLEM_HELPER_ICON.png" />
|
||||||
|
<Image Include="Resources\GOLEM_HELPER_ICON_HOVER.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,9 @@
|
||||||
<Filter Include="Dependencies\nexus">
|
<Filter Include="Dependencies\nexus">
|
||||||
<UniqueIdentifier>{9474c716-f028-4778-8cd0-b5d8292d1586}</UniqueIdentifier>
|
<UniqueIdentifier>{9474c716-f028-4778-8cd0-b5d8292d1586}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Resources">
|
||||||
|
<UniqueIdentifier>{07fb10f3-1f9b-483c-8721-e22bfe687792}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="framework.h">
|
<ClInclude Include="framework.h">
|
||||||
|
|
@ -81,4 +84,12 @@
|
||||||
<Filter>Dependencies\imgui</Filter>
|
<Filter>Dependencies\imgui</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\GOLEM_HELPER_ICON.png">
|
||||||
|
<Filter>Resources</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="Resources\GOLEM_HELPER_ICON_HOVER.png">
|
||||||
|
<Filter>Resources</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
BIN
GolemHelper/Resources/GOLEM_HELPER_ICON.png
Normal file
BIN
GolemHelper/Resources/GOLEM_HELPER_ICON.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
GolemHelper/Resources/GOLEM_HELPER_ICON_HOVER.png
Normal file
BIN
GolemHelper/Resources/GOLEM_HELPER_ICON_HOVER.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
|
|
@ -8,6 +8,7 @@
|
||||||
#include "Dependencies/imgui/imgui.h"
|
#include "Dependencies/imgui/imgui.h"
|
||||||
#include "Dependencies/nexus/Nexus.h"
|
#include "Dependencies/nexus/Nexus.h"
|
||||||
#include "Dependencies/mumble/Mumble.h"
|
#include "Dependencies/mumble/Mumble.h"
|
||||||
|
#include "resource.h"
|
||||||
|
|
||||||
AddonAPI* g_api = nullptr;
|
AddonAPI* g_api = nullptr;
|
||||||
NexusLinkData* NexusLink = nullptr;
|
NexusLinkData* NexusLink = nullptr;
|
||||||
|
|
@ -91,10 +92,11 @@ void HandleUIToggleKeybind(const char* id, bool release);
|
||||||
void HandleDebugKeybind(const char* id, bool release);
|
void HandleDebugKeybind(const char* id, bool release);
|
||||||
void SaveCustomDelaySettings();
|
void SaveCustomDelaySettings();
|
||||||
void LoadCustomDelaySettings();
|
void LoadCustomDelaySettings();
|
||||||
|
void CopyResourceIcons();
|
||||||
void Load(AddonAPI* aApi);
|
void Load(AddonAPI* aApi);
|
||||||
void Unload();
|
void Unload();
|
||||||
|
|
||||||
std::string GetConfigFilePath() {
|
std::string GetAddonPath() {
|
||||||
char gameDir[MAX_PATH];
|
char gameDir[MAX_PATH];
|
||||||
GetModuleFileNameA(NULL, gameDir, MAX_PATH);
|
GetModuleFileNameA(NULL, gameDir, MAX_PATH);
|
||||||
|
|
||||||
|
|
@ -107,7 +109,11 @@ std::string GetConfigFilePath() {
|
||||||
std::string addonPath = gamePath + "\\addons\\GolemHelper";
|
std::string addonPath = gamePath + "\\addons\\GolemHelper";
|
||||||
CreateDirectoryA(addonPath.c_str(), NULL);
|
CreateDirectoryA(addonPath.c_str(), NULL);
|
||||||
|
|
||||||
std::string configPath = addonPath + "\\config.ini";
|
return addonPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string GetConfigFilePath() {
|
||||||
|
std::string configPath = GetAddonPath() + "\\config.ini";
|
||||||
|
|
||||||
if (g_api) {
|
if (g_api) {
|
||||||
char logBuffer[500];
|
char logBuffer[500];
|
||||||
|
|
@ -118,6 +124,69 @@ std::string GetConfigFilePath() {
|
||||||
return configPath;
|
return configPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ExtractResourceToFile(HMODULE hModule, int resourceID, const std::string& filePath) {
|
||||||
|
HRSRC hRes = FindResourceA(hModule, MAKEINTRESOURCEA(resourceID), "PNG");
|
||||||
|
if (!hRes) return false;
|
||||||
|
|
||||||
|
HGLOBAL hData = LoadResource(hModule, hRes);
|
||||||
|
if (!hData) return false;
|
||||||
|
|
||||||
|
LPVOID pData = LockResource(hData);
|
||||||
|
if (!pData) return false;
|
||||||
|
|
||||||
|
DWORD dataSize = SizeofResource(hModule, hRes);
|
||||||
|
if (!dataSize) return false;
|
||||||
|
|
||||||
|
std::ofstream file(filePath, std::ios::binary);
|
||||||
|
if (!file.is_open()) return false;
|
||||||
|
|
||||||
|
file.write(static_cast<const char*>(pData), dataSize);
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CopyResourceIcons() {
|
||||||
|
if (!g_api) return;
|
||||||
|
|
||||||
|
std::string addonPath = GetAddonPath();
|
||||||
|
std::string iconsPath = addonPath + "\\icons";
|
||||||
|
CreateDirectoryA(iconsPath.c_str(), NULL);
|
||||||
|
|
||||||
|
std::string iconDestPath = iconsPath + "\\GOLEM_HELPER_ICON.png";
|
||||||
|
std::string iconHoverDestPath = iconsPath + "\\GOLEM_HELPER_ICON_HOVER.png";
|
||||||
|
|
||||||
|
if (GetFileAttributesA(iconDestPath.c_str()) != INVALID_FILE_ATTRIBUTES &&
|
||||||
|
GetFileAttributesA(iconHoverDestPath.c_str()) != INVALID_FILE_ATTRIBUTES) {
|
||||||
|
g_api->Log(ELogLevel_INFO, "GolemHelper", "Icons already exist, skipping unpack");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HMODULE hModule = GetModuleHandleA("GolemHelper.dll");
|
||||||
|
if (!hModule) {
|
||||||
|
g_api->Log(ELogLevel_WARNING, "GolemHelper", "Failed to get module handle");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ExtractResourceToFile(hModule, IDB_PNG1, iconDestPath)) {
|
||||||
|
char logBuffer[300];
|
||||||
|
sprintf_s(logBuffer, "Extracted icon from resources: %s", iconDestPath.c_str());
|
||||||
|
g_api->Log(ELogLevel_INFO, "GolemHelper", logBuffer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
g_api->Log(ELogLevel_WARNING, "GolemHelper", "Failed to extract normal icon from resources");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ExtractResourceToFile(hModule, IDB_PNG2, iconHoverDestPath)) {
|
||||||
|
char logBuffer[300];
|
||||||
|
sprintf_s(logBuffer, "Extracted hover icon from resources: %s", iconHoverDestPath.c_str());
|
||||||
|
g_api->Log(ELogLevel_INFO, "GolemHelper", logBuffer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
g_api->Log(ELogLevel_WARNING, "GolemHelper", "Failed to extract hover icon from resources");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SaveCustomDelaySettings() {
|
void SaveCustomDelaySettings() {
|
||||||
if (!g_api) return;
|
if (!g_api) return;
|
||||||
|
|
||||||
|
|
@ -201,7 +270,7 @@ void RenderUI() {
|
||||||
|
|
||||||
if (ImGui::Begin("GolemHelper", &g_state.showUI, ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::Begin("GolemHelper", &g_state.showUI, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
|
|
||||||
ImGui::TextColored(ImVec4(0.2f, 0.8f, 1.0f, 1.0f), "GolemHelper v1.2.1.0");
|
ImGui::TextColored(ImVec4(0.2f, 0.8f, 1.0f, 1.0f), "GolemHelper v1.2.2.0");
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::Text("Status:");
|
ImGui::Text("Status:");
|
||||||
|
|
@ -826,6 +895,8 @@ void Load(AddonAPI* aApi) {
|
||||||
|
|
||||||
LoadCustomDelaySettings();
|
LoadCustomDelaySettings();
|
||||||
|
|
||||||
|
CopyResourceIcons();
|
||||||
|
|
||||||
g_api->Renderer.Register(ERenderType_Render, RenderUI);
|
g_api->Renderer.Register(ERenderType_Render, RenderUI);
|
||||||
g_api->Renderer.Register(ERenderType_OptionsRender, RenderOptions);
|
g_api->Renderer.Register(ERenderType_OptionsRender, RenderOptions);
|
||||||
|
|
||||||
|
|
@ -838,10 +909,8 @@ void Load(AddonAPI* aApi) {
|
||||||
g_api->InputBinds.RegisterWithStruct("GolemHelper.ToggleUI", HandleUIToggleKeybind, kb_empty);
|
g_api->InputBinds.RegisterWithStruct("GolemHelper.ToggleUI", HandleUIToggleKeybind, kb_empty);
|
||||||
g_api->InputBinds.RegisterWithStruct("GolemHelper.DebugMouse", HandleDebugKeybind, kb_empty);
|
g_api->InputBinds.RegisterWithStruct("GolemHelper.DebugMouse", HandleDebugKeybind, kb_empty);
|
||||||
|
|
||||||
/* COMMENTO IN ATTESA DI CUSTOM ICON
|
g_api->Textures.GetOrCreateFromFile("GOLEM_HELPER_ICON", "addons/GolemHelper/icons/GOLEM_HELPER_ICON.png");
|
||||||
g_api->Textures.GetOrCreateFromFile("GOLEM_HELPER_ICON", "addons/GolemHelper/GOLEM_HELPER_ICON.png");
|
g_api->Textures.GetOrCreateFromFile("GOLEM_HELPER_ICON_HOVER", "addons/GolemHelper/icons/GOLEM_HELPER_ICON_HOVER.png");
|
||||||
g_api->Textures.GetOrCreateFromFile("GOLEM_HELPER_ICON_HOVER", "addons/GolemHelper/GOLEM_HELPER_ICON_HOVER.png");
|
|
||||||
*/
|
|
||||||
|
|
||||||
g_api->QuickAccess.Add(
|
g_api->QuickAccess.Add(
|
||||||
"GolemHelper.ToggleUI",
|
"GolemHelper.ToggleUI",
|
||||||
|
|
@ -851,7 +920,7 @@ void Load(AddonAPI* aApi) {
|
||||||
"Toggle GolemHelper UI"
|
"Toggle GolemHelper UI"
|
||||||
);
|
);
|
||||||
|
|
||||||
g_api->Log(ELogLevel_INFO, "GolemHelper", "=== GolemHelper v1.2.1.0 Loaded ===");
|
g_api->Log(ELogLevel_INFO, "GolemHelper", "=== GolemHelper v1.2.2.0 Loaded ===");
|
||||||
g_api->Log(ELogLevel_INFO, "GolemHelper", "<c=#00ff00>GolemHelper addon</c> loaded successfully!");
|
g_api->Log(ELogLevel_INFO, "GolemHelper", "<c=#00ff00>GolemHelper addon</c> loaded successfully!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -880,7 +949,7 @@ extern "C" __declspec(dllexport) AddonDefinition* GetAddonDef() {
|
||||||
def.Signature = -424248;
|
def.Signature = -424248;
|
||||||
def.APIVersion = NEXUS_API_VERSION;
|
def.APIVersion = NEXUS_API_VERSION;
|
||||||
def.Name = "GolemHelper";
|
def.Name = "GolemHelper";
|
||||||
def.Version = { 1, 2, 1, 0 };
|
def.Version = { 1, 2, 2, 0 };
|
||||||
def.Author = "Azrub";
|
def.Author = "Azrub";
|
||||||
def.Description = "Automates the process of setting optimal boon and golem configurations in the training area";
|
def.Description = "Automates the process of setting optimal boon and golem configurations in the training area";
|
||||||
def.Load = Load;
|
def.Load = Load;
|
||||||
|
|
|
||||||
17
GolemHelper/resource.h
Normal file
17
GolemHelper/resource.h
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// File di inclusione generato con Microsoft Visual C++.
|
||||||
|
// Utilizzato da GolemHelper.rc
|
||||||
|
//
|
||||||
|
#define IDB_PNG1 104
|
||||||
|
#define IDB_PNG2 105
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
Loading…
Reference in a new issue