Skip to content

Commit

Permalink
add unofficial extras support
Browse files Browse the repository at this point in the history
  • Loading branch information
DeltaGW2 committed Apr 16, 2024
1 parent 0fdcc3f commit 21d7e1b
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "src/nexus"]
path = src/nexus
url = https://github.com/RaidcoreGG/RCGG-lib-nexus-api
url = https://github.com/RaidcoreGG/RCGG-lib-nexus-api
[submodule "src/unofficial_extras"]
path = src/unofficial_extras
url = https://github.com/Krappa322/arcdps_unofficial_extras_releases
8 changes: 8 additions & 0 deletions GW2Nexus-ArcDPSBridge.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -84,6 +85,7 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -99,10 +101,16 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\entry.cpp" />
<ClCompile Include="src\unofficial_extras\KeyBindHelper.cpp" />
<ClCompile Include="src\unofficial_extras\KeyBindsTranslation.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ArcDPS.h" />
<ClInclude Include="src\nexus\Nexus.h" />
<ClInclude Include="src\unofficial_extras\Definitions.h" />
<ClInclude Include="src\unofficial_extras\KeyBindHelper.h" />
<ClInclude Include="src\unofficial_extras\KeyBindsTranslation.h" />
<ClInclude Include="src\unofficial_extras\KeyBindStructs.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
21 changes: 21 additions & 0 deletions GW2Nexus-ArcDPSBridge.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,20 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="unofficial_extras">
<UniqueIdentifier>{3ffae431-27b1-4979-98cc-64d6122af344}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\entry.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\unofficial_extras\KeyBindHelper.cpp">
<Filter>unofficial_extras</Filter>
</ClCompile>
<ClCompile Include="src\unofficial_extras\KeyBindsTranslation.cpp">
<Filter>unofficial_extras</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\ArcDPS.h">
Expand All @@ -26,5 +35,17 @@
<ClInclude Include="src\nexus\Nexus.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\unofficial_extras\KeyBindStructs.h">
<Filter>unofficial_extras</Filter>
</ClInclude>
<ClInclude Include="src\unofficial_extras\KeyBindsTranslation.h">
<Filter>unofficial_extras</Filter>
</ClInclude>
<ClInclude Include="src\unofficial_extras\KeyBindHelper.h">
<Filter>unofficial_extras</Filter>
</ClInclude>
<ClInclude Include="src\unofficial_extras\Definitions.h">
<Filter>unofficial_extras</Filter>
</ClInclude>
</ItemGroup>
</Project>
48 changes: 47 additions & 1 deletion src/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "nexus/Nexus.h"
#include "ArcDPS.h"
#include "unofficial_extras/Definitions.h"

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
Expand Down Expand Up @@ -137,4 +138,49 @@ uintptr_t mod_combat(const char* channel, cbtevent* ev, ag* src, ag* dst, char*
}

return 0;
}
}

struct SquadUpdate_t
{
UserInfo* UserInfo;
uint64_t UsersCount;
};

void SquadUpdate(const UserInfo* pUpdatedUsers, uint64_t pUpdatedUsersCount)
{
SquadUpdate_t sqUpdate{
const_cast<UserInfo*>(pUpdatedUsers),
pUpdatedUsersCount
};

APIDefs->RaiseEvent("EV_UNOFFICIAL_EXTRAS_SQUAD_UPDATE", (void*)&sqUpdate);
}

void LanguageChanged(Language pNewLanguage)
{
APIDefs->RaiseEvent("EV_UNOFFICIAL_EXTRAS_LANGUAGE_CHANGED", (void*)&pNewLanguage);
}

void KeyBindChanged(KeyBinds::KeyBindChanged pChangedKeyBind)
{
APIDefs->RaiseEvent("EV_UNOFFICIAL_EXTRAS_KEYBIND_CHANGED", (void*)&pChangedKeyBind);
}

void ChatMessage(const ChatMessageInfo* pChatMessage)
{
APIDefs->RaiseEvent("EV_UNOFFICIAL_EXTRAS_CHAT_MESSAGE", (void*)pChatMessage);
}

extern "C" __declspec(dllexport) void arcdps_unofficial_extras_subscriber_init(const ExtrasAddonInfo* pExtrasInfo, void* pSubscriberInfo) {
// MaxInfoVersion has to be higher to have enough space to hold this object
if (pExtrasInfo->ApiVersion == 2 && pExtrasInfo->MaxInfoVersion >= 2)
{
const auto subscriber_info = static_cast<ExtrasSubscriberInfoV2*>(pSubscriberInfo);
subscriber_info->InfoVersion = 2;
subscriber_info->SubscriberName = "Nexus ArcDPS Bridge";
subscriber_info->SquadUpdateCallback = SquadUpdate;
subscriber_info->LanguageChangedCallback = LanguageChanged;
subscriber_info->KeyBindChangedCallback = KeyBindChanged;
subscriber_info->ChatMessageCallback = ChatMessage;
}
}
1 change: 1 addition & 0 deletions src/unofficial_extras
Submodule unofficial_extras added at 2cb56d

0 comments on commit 21d7e1b

Please sign in to comment.