Skip to content

Commit

Permalink
Nexus notice
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaGW2 committed Mar 10, 2024
1 parent d82b960 commit adc3b64
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 6 deletions.
Binary file added mockup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 22 additions & 4 deletions src/GW2-CommandersToolkit.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand All @@ -72,17 +72,27 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\</IntDir>
<TargetName>squadmanager</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\</IntDir>
<TargetName>squadmanager</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<TargetName>squadmanager</TargetName>
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<TargetName>squadmanager</TargetName>
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand All @@ -92,11 +102,13 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>Shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
Expand All @@ -109,13 +121,15 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>Shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
Expand All @@ -127,11 +141,13 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>Shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -145,13 +161,15 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<AdditionalDependencies>Shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
92 changes: 90 additions & 2 deletions src/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,31 @@
#include "arcdps.h"
#include "imgui/imgui.h"
#include "SquadManager.h"
#include <shellapi.h>
#include <filesystem>
#include <fstream>

std::filesystem::path gameDir;
std::filesystem::path addonsDir;
std::filesystem::path selfPath;
std::filesystem::path arcPath;
HMODULE selfDll;

bool showNexusNotice = true;

/* entry */
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH: break;
case DLL_PROCESS_ATTACH: selfDll = hModule; break;
case DLL_PROCESS_DETACH: break;
case DLL_THREAD_ATTACH: break;
case DLL_THREAD_DETACH: break;
}
return TRUE;
}
extern "C" __declspec(dllexport) void* get_init_addr(char* arcversion, ImGuiContext * imguictx, void* id3dptr, HANDLE arcdll, void* mallocfn, void* freefn, uint32_t d3dversion);
extern "C" __declspec(dllexport) void* get_init_addr(char* arcversion, ImGuiContext* imguictx, void* id3dptr, HANDLE arcdll, void* mallocfn, void* freefn, uint32_t d3dversion);
extern "C" __declspec(dllexport) void* get_release_addr();

/* proto */
Expand All @@ -39,6 +50,10 @@ extern "C" __declspec(dllexport) void* get_init_addr(char* arcversion, ImGuiCont
ArcDPS::GetUISettings = (ArcDPS::Export_GetU64)GetProcAddress((HMODULE)arcdll, "e6");
ArcDPS::GetModifiers = (ArcDPS::Export_GetU64)GetProcAddress((HMODULE)arcdll, "e7");

char arcP[MAX_PATH];
GetModuleFileNameA((HMODULE)arcdll, arcP, sizeof(arcP));
arcPath = arcP;

return Initialize;
}
/* export -- arcdps looks for this exported function and calls the address it returns on client exit */
Expand All @@ -63,6 +78,26 @@ ArcDPS::PluginExports* Initialize()
ArcDPS::ArcPluginExports.WndProc = WndProc;
ArcDPS::ArcPluginExports.WndProcFiltered = WndProcFiltered;

char selfP[MAX_PATH];
GetModuleFileNameA(selfDll, selfP, sizeof(selfP));
selfPath = selfP;

char gamePath[MAX_PATH];
GetModuleFileNameA(GetModuleHandleA(NULL), gamePath, sizeof(gamePath));
gameDir = gamePath;
gameDir = gameDir.parent_path();
addonsDir = gameDir / "addons";

if (!std::filesystem::exists(addonsDir / "CommandersToolkit"))
{
std::filesystem::create_directory(addonsDir / "CommandersToolkit");
}

if (std::filesystem::exists(addonsDir / "CommandersToolkit/Settings.json"))
{
showNexusNotice = false;
}

return &ArcDPS::ArcPluginExports;
}
/* release mod -- return ignored */
Expand All @@ -78,6 +113,59 @@ uintptr_t ImGuiRender(uint32_t not_charsel_or_loading)
bool movable = ArcDPS::IsWindowMovable();
bool clickable = ArcDPS::IsWindowClickable();

if (showNexusNotice)
{
if (ImGui::Begin("Upgrade to Nexus!##Commander's Toolkit"))
{
ImGui::Text("Commander's Toolkit is moving to Nexus on March 31st, 2024!");
ImGui::Text("If you're using an auto-updater for ArcDPS plugins, Commander's Toolkit will probably break!");

ImGui::Text("");

ImGui::Text("What is Nexus?");
ImGui::Text(""); ImGui::SameLine(); ImGui::Text("Nexus is a powerful Addon Host & Framework making it as convenient as possible for players.");
ImGui::Text(""); ImGui::SameLine();
if (ImGui::TextURL("Learn more: https://raidcore.gg/Nexus", true, false))
{
ShellExecuteA(0, 0, "https://raidcore.gg/Nexus", 0, 0, SW_SHOW);
}

ImGui::Text("");

ImGui::Text("What this means for you:");
ImGui::Text(""); ImGui::SameLine(); ImGui::Text("If you're not running Nexus yet visit the link above and install it, if you want to receive new features and updates for Commander's Toolkit.");
ImGui::Text(""); ImGui::SameLine(); ImGui::Text("If you don't care about it, you can keep using this version of the addon!");
ImGui::Text("");
ImGui::Text(""); ImGui::SameLine(); ImGui::Text("If you're already running Nexus, and both ArcDPS & Commander's Toolkit are in %s, you are already set!", addonsDir.string().c_str());
ImGui::Text(""); ImGui::SameLine(); ImGui::TextDisabled("ArcDPS:"); ImGui::SameLine(); ImGui::Text(arcPath.string().c_str());
ImGui::Text(""); ImGui::SameLine(); ImGui::TextDisabled("Commander's Toolkit:"); ImGui::SameLine(); ImGui::Text(selfPath.string().c_str());
ImGui::Text("");
if (arcPath.parent_path() == addonsDir && selfPath.parent_path() == addonsDir)
{
ImGui::Text(""); ImGui::SameLine(); ImGui::TextColored(ImVec4(0, 1, 0, 1), "It looks like you're good to go!");
}
else
{
ImGui::Text(""); ImGui::SameLine(); ImGui::TextColored(ImVec4(1, 1, 0, 1), "If either of those paths aren't in %s, close the game and move them there.", addonsDir.string().c_str());
}

if (ImGui::Button("Remind me later"))
{
showNexusNotice = false;
}
ImGui::SameLine();
if (ImGui::Button("Never show this again"))
{
showNexusNotice = false;

std::ofstream file(gameDir / "addons/CommandersToolkit" / "Settings.json");
file << "null" << std::endl;
file.close();
}
}
ImGui::End();
}

if (SquadManager::Visible) { SquadManager::DrawWindow(movable, clickable); }

return 0;
Expand Down
33 changes: 33 additions & 0 deletions src/imgui_extensions.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,37 @@ namespace ImGui
{
ImGui::Tooltip([fmt] {ImGui::Text(fmt); });
}

static void AddUnderLine(ImColor col_)
{
ImVec2 min = ImGui::GetItemRectMin();
ImVec2 max = ImGui::GetItemRectMax();
min.y = max.y;
ImGui::GetWindowDrawList()->AddLine(min, max, col_, 1.0f);
}

static bool TextURL(const char* name_, bool SameLineBefore_, bool SameLineAfter_)
{
bool clicked = false;

if (true == SameLineBefore_) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); }
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered]);
ImGui::Text(name_);
ImGui::PopStyleColor();
if (ImGui::IsItemHovered())
{
if (ImGui::IsMouseClicked(0))
{
clicked = true;
}
AddUnderLine(ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered]);
}
else
{
AddUnderLine(ImGui::GetStyle().Colors[ImGuiCol_Button]);
}
if (true == SameLineAfter_) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); }

return clicked;
}
}

0 comments on commit adc3b64

Please sign in to comment.