├── Source
├── stdafx.cpp
├── GamePos.cpp
├── Skill.cpp
├── Hooker.cpp
├── Debug.cpp
├── MemoryMgr.cpp
├── GuildMgr.cpp
├── MemoryPatcher.cpp
└── CtoSMgr.cpp
├── Include
└── GWCA
│ ├── Utilities
│ ├── Macros.h
│ ├── Export.h
│ ├── MemoryPatcher.h
│ ├── Hook.h
│ ├── Scanner.h
│ ├── Hooker.h
│ └── Debug.h
│ ├── Context
│ ├── Cinematic.h
│ ├── GadgetContext.h
│ ├── PreGameContext.h
│ ├── ItemContext.h
│ ├── TradeContext.h
│ ├── PartyContext.h
│ ├── TextParser.h
│ ├── AccountContext.h
│ ├── GameContext.h
│ ├── MapContext.h
│ ├── GuildContext.h
│ ├── CharContext.h
│ └── AgentContext.h
│ ├── Managers
│ ├── Module.h
│ ├── MemoryMgr.h
│ ├── EventMgr.h
│ ├── GameThreadMgr.h
│ ├── TradeMgr.h
│ ├── CtoSMgr.h
│ ├── GuildMgr.h
│ ├── QuestMgr.h
│ ├── CameraMgr.h
│ ├── MerchantMgr.h
│ ├── FriendListMgr.h
│ ├── PlayerMgr.h
│ ├── EffectMgr.h
│ ├── RenderMgr.h
│ ├── MapMgr.h
│ ├── StoCMgr.h
│ ├── SkillbarMgr.h
│ └── PartyMgr.h
│ ├── GameEntities
│ ├── Match.h
│ ├── Player.h
│ ├── NPC.h
│ ├── Attribute.h
│ ├── Friendslist.h
│ ├── Title.h
│ ├── Hero.h
│ ├── Quest.h
│ ├── Guild.h
│ ├── Pathing.h
│ ├── Party.h
│ └── Camera.h
│ ├── GWCA.h
│ └── GameContainers
│ ├── Array.h
│ └── List.h
├── Dependencies
├── CMakeLists.txt
├── DirectX
│ ├── Lib
│ │ └── x86
│ │ │ ├── d3d9.lib
│ │ │ ├── d3dx9.lib
│ │ │ └── d3dx9d.lib
│ ├── CMakeLists.txt
│ └── Include
│ │ ├── dxsdkver.h
│ │ ├── D3DX10.h
│ │ ├── D3DX11.h
│ │ ├── d3dx9.h
│ │ ├── Dcommon.h
│ │ ├── comdecl.h
│ │ ├── DxErr.h
│ │ ├── D2DBaseTypes.h
│ │ └── D3DX11core.h
└── minhook
│ ├── AUTHORS.txt
│ ├── CMakeLists.txt
│ ├── src
│ ├── hde
│ │ ├── pstdint.h
│ │ ├── hde32.h
│ │ ├── hde64.h
│ │ ├── table32.h
│ │ └── table64.h
│ ├── buffer.h
│ └── trampoline.h
│ ├── README.md
│ └── LICENSE.txt
├── Examples
├── Teleport
│ ├── CMakeLists.txt
│ ├── Teleport.vcxproj.filters
│ ├── Teleport.sln
│ ├── main.cpp
│ └── Teleport.vcxproj
├── PacketLogger
│ ├── CMakeLists.txt
│ ├── PacketLogger.vcxproj.filters
│ ├── PacketLogger.sln
│ └── PacketLogger.vcxproj
├── WorldInformation
│ ├── ressources
│ │ ├── MissionIcon.png
│ │ ├── FactionsMissionIcon.png
│ │ ├── MissionIconPrimary.png
│ │ ├── 94px-MissionIconBonus.png
│ │ ├── MissionIconIncomplete.png
│ │ ├── 94px-HardModeMissionIcon.png
│ │ ├── 120px-NightfallMissionIcon.png
│ │ ├── 94px-HardModeMissionIcon1.png
│ │ ├── 94px-HardModeMissionIcon1b.png
│ │ ├── 94px-HardModeMissionIcon2.png
│ │ ├── FactionsMissionIconPrimary.png
│ │ ├── FactionsMissionIconIncomplete.png
│ │ ├── HardModeMissionIconIncomplete.png
│ │ ├── 94px-FactionsMissionIconExpert.png
│ │ ├── 94px-NightfallMissionIconExpert.png
│ │ ├── NightfallMissionIconIncomplete.png
│ │ ├── 120px-NightfallTormentMissionIcon.png
│ │ ├── 94px-NightfallMissionIconPrimary.png
│ │ ├── 94px-NightfallTormentMissionIconExpert.png
│ │ ├── 94px-NightfallTormentMissionIconPrimary.png
│ │ └── NightfallTormentMissionIconIncomplete.png
│ ├── CMakeLists.txt
│ ├── imgui_impl_dx9.h
│ ├── WorldInformation.vcxproj.filters
│ └── WorldInformation.sln
├── Pathing
│ ├── CMakeLists.txt
│ ├── Pathing.filters
│ └── Pathing.sln
├── CMakeLists.txt
├── GwArmory
│ ├── CMakeLists.txt
│ ├── ImGuiAddons.h
│ ├── imgui_impl_dx9.h
│ └── GwArmory.vcxproj.filters
└── Examples.sln
├── .gitignore
├── cmake
└── imgui.cmake
├── LICENSE
├── CMakeLists.txt
├── README.md
└── vc
├── MinHook.vcxproj.filters
└── GWCA.sln
/Source/stdafx.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
--------------------------------------------------------------------------------
/Include/GWCA/Utilities/Macros.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define Verify(expr) (expr)
4 |
--------------------------------------------------------------------------------
/Dependencies/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_subdirectory(minhook)
3 | add_subdirectory(DirectX)
4 |
--------------------------------------------------------------------------------
/Examples/Teleport/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | add_library(Teleport SHARED main.cpp)
2 | target_link_libraries(Teleport gwca)
3 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Lib/x86/d3d9.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Dependencies/DirectX/Lib/x86/d3d9.lib
--------------------------------------------------------------------------------
/Dependencies/DirectX/Lib/x86/d3dx9.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Dependencies/DirectX/Lib/x86/d3dx9.lib
--------------------------------------------------------------------------------
/Dependencies/DirectX/Lib/x86/d3dx9d.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Dependencies/DirectX/Lib/x86/d3dx9d.lib
--------------------------------------------------------------------------------
/Examples/PacketLogger/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(PacketLogger SHARED
3 | main.cpp)
4 | target_link_libraries(PacketLogger gwca)
5 |
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/MissionIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/MissionIcon.png
--------------------------------------------------------------------------------
/Examples/Pathing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(PathingInformation SHARED
3 | main.cpp)
4 | target_link_libraries(PathingInformation gwca imgui directx)
5 |
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/FactionsMissionIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/FactionsMissionIcon.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/MissionIconPrimary.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/MissionIconPrimary.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-MissionIconBonus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-MissionIconBonus.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/MissionIconIncomplete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/MissionIconIncomplete.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-HardModeMissionIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-HardModeMissionIcon.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/120px-NightfallMissionIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/120px-NightfallMissionIcon.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-HardModeMissionIcon1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-HardModeMissionIcon1.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-HardModeMissionIcon1b.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-HardModeMissionIcon1b.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-HardModeMissionIcon2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-HardModeMissionIcon2.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/FactionsMissionIconPrimary.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/FactionsMissionIconPrimary.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/FactionsMissionIconIncomplete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/FactionsMissionIconIncomplete.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/HardModeMissionIconIncomplete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/HardModeMissionIconIncomplete.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-FactionsMissionIconExpert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-FactionsMissionIconExpert.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-NightfallMissionIconExpert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-NightfallMissionIconExpert.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/NightfallMissionIconIncomplete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/NightfallMissionIconIncomplete.png
--------------------------------------------------------------------------------
/Examples/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_subdirectory(GwArmory)
3 | add_subdirectory(PacketLogger)
4 | add_subdirectory(Teleport)
5 | add_subdirectory(WorldInformation)
6 | add_subdirectory(Pathing)
7 |
8 |
--------------------------------------------------------------------------------
/Examples/WorldInformation/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(WorldInformation SHARED
3 | main.cpp
4 | imgui_impl_dx9.h
5 | imgui_impl_dx9.cpp)
6 | target_link_libraries(WorldInformation gwca imgui)
7 |
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/120px-NightfallTormentMissionIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/120px-NightfallTormentMissionIcon.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-NightfallMissionIconPrimary.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-NightfallMissionIconPrimary.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-NightfallTormentMissionIconExpert.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-NightfallTormentMissionIconExpert.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/94px-NightfallTormentMissionIconPrimary.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/94px-NightfallTormentMissionIconPrimary.png
--------------------------------------------------------------------------------
/Examples/WorldInformation/ressources/NightfallTormentMissionIconIncomplete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GregLando113/GWCA/HEAD/Examples/WorldInformation/ressources/NightfallTormentMissionIconIncomplete.png
--------------------------------------------------------------------------------
/Include/GWCA/Context/Cinematic.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace GW {
4 | struct Cinematic {
5 | /* +h0000 */ uint32_t h0000;
6 | /* +h0004 */ uint32_t h0004; // pointer to data
7 | // ...
8 | };
9 | }
10 |
--------------------------------------------------------------------------------
/Examples/Teleport/Teleport.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Dependencies/minhook/AUTHORS.txt:
--------------------------------------------------------------------------------
1 | Tsuda Kageyu
2 | Creator, maintainer
3 |
4 | Michael Maltsev
5 | Added "Queue" functions. A lot of bug fixes.
6 |
7 | Andrey Unis
8 | Rewrote the hook engine in plain C.
9 |
--------------------------------------------------------------------------------
/Examples/PacketLogger/PacketLogger.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(directx INTERFACE)
3 | target_include_directories(directx INTERFACE "include")
4 | target_link_libraries(directx INTERFACE
5 | "${CMAKE_CURRENT_SOURCE_DIR}/Lib/x86/d3d9.lib"
6 | "${CMAKE_CURRENT_SOURCE_DIR}/Lib/x86/d3dx9.lib")
7 |
8 |
--------------------------------------------------------------------------------
/Dependencies/minhook/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | add_library(minhook)
3 | file(GLOB SOURCES
4 | "include/*.h"
5 | "src/*.h"
6 | "src/*.c"
7 | "src/hde/*.h"
8 | "src/hde/*.c")
9 | source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES})
10 | target_sources(minhook PRIVATE ${SOURCES})
11 | target_include_directories(minhook PUBLIC "include/")
12 |
--------------------------------------------------------------------------------
/Examples/GwArmory/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | # TODO: remove those imgui files and use the updated ones directly
3 |
4 | add_library(GwArmory SHARED
5 | main.cpp
6 | ArmorsDatabase.h
7 | imgui_impl_dx9.cpp
8 | imgui_impl_dx9.h
9 | ImGuiAddons.cpp
10 | ImGuiAddons.h)
11 | # target_include_directories(GwArmory "${CMAKE_CURRENT_SOURCE_DIR}")
12 | target_link_libraries(GwArmory gwca imgui)
13 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/Module.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace GW {
4 | struct Module {
5 | const char *name;
6 | void *param;
7 |
8 | void (*init_module)();
9 | void (*exit_module)();
10 |
11 | // Call those from game thread to be safe
12 | // Do not free trampoline
13 | void (*enable_hooks)();
14 | void (*disable_hooks)();
15 | };
16 | }
17 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/GadgetContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct GadgetInfo {
7 | /* +h0000 */ uint32_t h0000;
8 | /* +h0004 */ uint32_t h0004;
9 | /* +h0008 */ uint32_t h0008;
10 | /* +h000C */ wchar_t *name_enc;
11 | };
12 |
13 | struct GadgetContext {
14 | /* +h0000 */ Array GadgetInfo;
15 | // ...
16 | };
17 | }
18 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Match.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace GW {
4 | struct ObserverMatch { // total: 0x4C/76
5 | /* +h0000 */ uint32_t match_id;
6 | /* +h0004 */ uint32_t match_id_dup;
7 | /* +h0008 */ uint32_t map_id;
8 | /* +h000C */ uint32_t age;
9 | /* +h0010 */ uint32_t h0010[14];
10 | /* +h0048 */ wchar_t *team_names;
11 | };
12 | static_assert(sizeof(ObserverMatch) == 76, "struct ObserverMatch has incorect size");
13 | }
14 |
--------------------------------------------------------------------------------
/Include/GWCA/Utilities/Export.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if defined(__clang__) || defined(__GNUC__)
4 | # define DllExport __attribute__((dllexport))
5 | # define DllImport __attribute__((dllimport))
6 | #elif defined(_MSC_VER)
7 | # define DllExport __declspec(dllexport)
8 | # define DllImport __declspec(dllimport)
9 | #endif
10 |
11 | #ifdef GWCA_BUILD_EXPORTS
12 | # define GWCA_API DllExport
13 | #else
14 | #ifdef GWCA_IMPORT
15 | # define GWCA_API DllImport
16 | #else
17 | # define GWCA_API
18 | #endif
19 | #endif
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build directories
2 | Debug/
3 | Release/
4 | *exe
5 |
6 | # Bloated Windows Databases
7 | .vs/
8 | *.db
9 | *.sdf
10 | *.suo
11 | *.opendb
12 | *.opensdf
13 |
14 | # Compiled Object files
15 | *.o
16 | *.lo
17 | *.lib
18 | *.obj
19 | *.slo
20 |
21 | # Precompiled Headers
22 | *.exp
23 | *.gch
24 | *.idb
25 | *.ilk
26 | *.pdb
27 | *.tmp
28 | *.pch
29 | *.iobj
30 | *.ipch
31 | *.ipdb
32 | dox/
33 |
34 | # Sublime Text stuff
35 | *.sublime-project*
36 | *.sublime-workspace*
37 | *.vcxproj.user
38 | build/
39 |
40 | # VSCode stuff
41 | .vscode/
42 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/dxsdkver.h:
--------------------------------------------------------------------------------
1 | /*==========================================================================;
2 | *
3 | *
4 | * File: dxsdkver.h
5 | * Content: DirectX SDK Version Include File
6 | *
7 | ****************************************************************************/
8 |
9 | #ifndef _DXSDKVER_H_
10 | #define _DXSDKVER_H_
11 |
12 | #define _DXSDK_PRODUCT_MAJOR 9
13 | #define _DXSDK_PRODUCT_MINOR 29
14 | #define _DXSDK_BUILD_MAJOR 1962
15 | #define _DXSDK_BUILD_MINOR 0
16 |
17 | #endif // _DXSDKVER_H_
18 |
19 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/MemoryMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace GW {
4 |
5 | struct MemoryMgr {
6 |
7 | // Skill timer for effects.
8 | static DWORD* SkillTimerPtr;
9 |
10 | static uintptr_t WinHandlePtr;
11 |
12 | static uintptr_t GetPersonalDirPtr;
13 |
14 | static uint32_t GetGWVersion();
15 |
16 | // Basics
17 | static bool Scan();
18 |
19 | static DWORD GetSkillTimer() {
20 | return GetTickCount() + *SkillTimerPtr;
21 | }
22 |
23 | static HWND GetGWWindowHandle() {
24 | return *reinterpret_cast(WinHandlePtr);
25 | }
26 | };
27 | }
28 |
--------------------------------------------------------------------------------
/Source/GamePos.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #include
4 |
5 | namespace GW
6 | {
7 | float GetDistance(Vec3f p1, Vec3f p2) {
8 | return sqrtf(GetSquareDistance(p1, p2));
9 | }
10 |
11 | float GetDistance(Vec2f p1, Vec2f p2) {
12 | return sqrtf(GetSquareDistance(p1, p2));
13 | }
14 |
15 | float GetNorm(Vec3f p) {
16 | return sqrtf(GetSquaredNorm(p));
17 | }
18 |
19 | float GetNorm(Vec2f p) {
20 | return sqrtf(GetSquaredNorm(p));
21 | }
22 |
23 | Vec2f Rotate(Vec2f v, float rotation) {
24 | return Rotate(v, cosf(rotation), sinf(rotation));
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/EventMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 |
8 | struct Module;
9 | extern Module EventMgrModule;
10 |
11 | namespace EventMgr {
12 | enum class EventID {
13 | kRecvPing = 0x8,
14 | kSendFriendState = 0x26,
15 | kRecvFriendState = 0x2c
16 |
17 | };
18 |
19 | typedef HookCallback EventCallback;
20 | GWCA_API void RegisterEventCallback(
21 | HookEntry *entry,
22 | EventID event_id,
23 | const EventCallback& callback,
24 | int altitude = -0x8000);
25 |
26 | GWCA_API void RemoveEventCallback(
27 | HookEntry *entry);
28 | };
29 | }
30 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/PreGameContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | struct PreGameContext;
8 | GWCA_API PreGameContext* GetPreGameContext();
9 |
10 | struct LoginCharacter {
11 | uint32_t unk0; // Some kind of function call
12 | wchar_t character_name[20];
13 | };
14 | struct PreGameContext {
15 |
16 | static PreGameContext* instance();
17 |
18 | /* +h0000 */ uint32_t frame_id;
19 | /* +h0004 */ uint32_t h0004[72];
20 | /* +h0124 */ uint32_t chosen_character_index;
21 | /* +h0128 */ uint32_t h0128[6];
22 | /* +h0140 */ uint32_t index_1;
23 | /* +h0144 */ uint32_t index_2;
24 | /* +h0148 */ GW::Array chars;
25 | };
26 | }
27 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/GameThreadMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #ifndef EXCEPT_EXPRESSION_LOOP
7 | #define EXCEPT_EXPRESSION_LOOP EXCEPTION_CONTINUE_SEARCH
8 | #endif
9 | namespace GW {
10 |
11 | struct Module;
12 | extern Module GameThreadModule;
13 |
14 | namespace GameThread {
15 | GWCA_API void ClearCalls();
16 |
17 | void Enqueue(std::function f);
18 |
19 | typedef HookCallback<> GameThreadCallback;
20 | GWCA_API void RegisterGameThreadCallback(
21 | HookEntry *entry,
22 | const GameThreadCallback& callback);
23 |
24 | GWCA_API void RemoveGameThreadCallback(
25 | HookEntry *entry);
26 |
27 | GWCA_API bool IsInGameThread();
28 | };
29 | }
30 |
--------------------------------------------------------------------------------
/Include/GWCA/Utilities/MemoryPatcher.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace GW {
4 |
5 | class MemoryPatcher {
6 | public:
7 | MemoryPatcher() = default;
8 | MemoryPatcher(const MemoryPatcher&) = delete;
9 | ~MemoryPatcher();
10 |
11 | void Reset();
12 | void SetPatch(uintptr_t addr, const char* patch, size_t size);
13 |
14 | // Use to redirect a CALL or JMP instruction to call a different function instead.
15 | bool SetRedirect(uintptr_t call_instruction_address, void* redirect_func);
16 |
17 | bool TogglePatch(bool flag);
18 | bool TogglePatch() { TogglePatch(!m_enable); };
19 |
20 | bool GetIsEnable() { return m_enable; };
21 | private:
22 | void *m_addr = nullptr;
23 | uint8_t *m_patch = nullptr;
24 | uint8_t *m_backup = nullptr;
25 | size_t m_size = 0;
26 | bool m_enable = false;
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/TradeMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct Module;
7 | extern Module TradeModule;
8 |
9 | namespace Trade {
10 |
11 | GWCA_API bool OpenTradeWindow(uint32_t agent_id);
12 | GWCA_API bool AcceptTrade();
13 | GWCA_API bool CancelTrade();
14 | GWCA_API bool ChangeOffer();
15 | GWCA_API bool SubmitOffer(uint32_t gold);
16 | GWCA_API bool RemoveItem(uint32_t slot);
17 |
18 | // Passing quantity = 0 will prompt the player for the amount
19 | GWCA_API bool OfferItem(uint32_t item_id, uint32_t quantity = 0);
20 |
21 | typedef HookCallback OfferItemCallback;
22 | GWCA_API void RegisterOfferItemCallback(
23 | HookEntry* entry,
24 | const OfferItemCallback& callback);
25 | GWCA_API void RemoveOfferItemCallback(
26 | HookEntry* entry);
27 | };
28 | }
29 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/ItemContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | struct ItemContext;
8 | GWCA_API ItemContext* GetItemContext();
9 |
10 | struct Bag;
11 | struct Item;
12 | struct Inventory;
13 |
14 | struct ItemContext { // total: 0x10C/268 BYTEs
15 |
16 | static ItemContext* instance();
17 |
18 | /* +h0000 */ Array h0000;
19 | /* +h0010 */ Array h0010;
20 | /* +h0020 */ DWORD h0020;
21 | /* +h0024 */ Array bags_array;
22 | /* +h0034 */ char h0034[12];
23 | /* +h0040 */ Array h0040;
24 | /* +h0050 */ Array h0050;
25 | /* +h0060 */ char h0060[88];
26 | /* +h00B8 */ Array- item_array;
27 | /* +h00C8 */ char h00C8[48];
28 | /* +h00F8 */ Inventory *inventory;
29 | /* +h00FC */ Array h00FC;
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/Include/GWCA/Utilities/Hook.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW
6 | {
7 | struct HookEntry {};
8 |
9 | struct HookStatus {
10 | bool blocked = false;
11 | unsigned int altitude = 0;
12 | };
13 |
14 | template
15 | using HookCallback = std::function;
16 | } // namespace GW
17 |
18 |
19 | // Usage: bind_member(this, &Class::member_function)
20 | template
21 | std::function bind_member(C* c, Ret (C::*m)(Ts...))
22 | {
23 | return [=](Args&&... args) { return (c->*m)(std::forward(args)...); };
24 | }
25 |
26 | // Usage: bind_member(this, &Class::member_function)
27 | template
28 | std::function bind_member(const C* c, Ret (C::*m)(Ts...) const)
29 | {
30 | return [=](Args&&... args) { return (c->*m)(std::forward(args)...); };
31 | }
32 |
--------------------------------------------------------------------------------
/cmake/imgui.cmake:
--------------------------------------------------------------------------------
1 | if(TARGET imgui)
2 | return()
3 | endif()
4 |
5 | include(FetchContent)
6 | FetchContent_Declare(
7 | imgui
8 | GIT_REPOSITORY https://github.com/ocornut/imgui.git
9 | GIT_TAG v1.79
10 | GIT_SHALLOW TRUE
11 | )
12 | FetchContent_MakeAvailable(imgui)
13 |
14 | add_library(imgui)
15 | set(SOURCES
16 | "${imgui_SOURCE_DIR}/imgui.h"
17 | "${imgui_SOURCE_DIR}/imgui_internal.h"
18 | "${imgui_SOURCE_DIR}/imgui.cpp"
19 | "${imgui_SOURCE_DIR}/imgui_demo.cpp"
20 | "${imgui_SOURCE_DIR}/imgui_draw.cpp"
21 | "${imgui_SOURCE_DIR}/imgui_widgets.cpp"
22 | "${imgui_SOURCE_DIR}/examples/imgui_impl_win32.h"
23 | "${imgui_SOURCE_DIR}/examples/imgui_impl_win32.cpp"
24 | "${imgui_SOURCE_DIR}/examples/imgui_impl_dx9.h"
25 | "${imgui_SOURCE_DIR}/examples/imgui_impl_dx9.cpp")
26 | source_group(TREE "${imgui_SOURCE_DIR}" FILES ${SOURCES})
27 | target_sources(imgui PRIVATE ${SOURCES})
28 | target_include_directories(imgui PUBLIC "${imgui_SOURCE_DIR}")
29 |
30 |
--------------------------------------------------------------------------------
/Source/Skill.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace GW {
8 |
9 | uint32_t SkillbarSkill::GetRecharge() const {
10 | if (recharge == 0) return 0;
11 | return recharge - MemoryMgr::GetSkillTimer();
12 | }
13 |
14 | SkillbarSkill *Skillbar::GetSkillById(Constants::SkillID skill_id, size_t* slot_out) {
15 | for (size_t i = 0; i < _countof(skills); i++) {
16 | if (skills[i].skill_id == skill_id) {
17 | if (slot_out) {
18 | *slot_out = i;
19 | }
20 | return &skills[i];
21 | }
22 |
23 | }
24 | return NULL;
25 | }
26 |
27 | DWORD Effect::GetTimeElapsed() const {
28 | return MemoryMgr::GetSkillTimer() - timestamp;
29 | }
30 |
31 | DWORD Effect::GetTimeRemaining() const {
32 | return (DWORD)(duration * 1000.f) - GetTimeElapsed();
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Permission is hereby granted, free of charge, to any person obtaining a copy
2 | of this software and associated documentation files (the "Software"), to deal
3 | in the Software without restriction, including without limitation the rights
4 | to use, copy, modify, and/or merge copies of the Software, and to permit
5 | persons to whom the Software is furnished to do so, subject to the
6 | following conditions:
7 |
8 | The above copyright notice and this permission notice shall be included in
9 | all copies or substantial portions of the Software.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17 | THE SOFTWARE.
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Player.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | typedef uint32_t PlayerID;
7 |
8 | struct Player { // total: 0x4C/76
9 | /* +h0000 */ uint32_t agent_id;
10 | /* +h0004 */ uint32_t h0004[3];
11 | /* +h0010 */ uint32_t appearance_bitmap;
12 | /* +h0014 */ uint32_t flags; // Bitwise field
13 | /* +h0018 */ uint32_t primary;
14 | /* +h001C */ uint32_t secondary;
15 | /* +h0020 */ uint32_t h0020;
16 | /* +h0024 */ wchar_t *name_enc;
17 | /* +h0028 */ wchar_t *name;
18 | /* +h002C */ uint32_t party_leader_player_number;
19 | /* +h0030 */ uint32_t active_title_tier;
20 | /* +h0034 */ uint32_t player_number;
21 | /* +h0038 */ uint32_t party_size;
22 | /* +h003C */ Array h003C;
23 |
24 | inline bool IsPvP() {
25 | return (flags & 0x800) != 0;
26 | }
27 |
28 | };
29 | static_assert(sizeof(Player) == 0x4c, "struct Player has incorect size");
30 |
31 | typedef Array PlayerArray;
32 | }
33 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/CtoSMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 |
9 | namespace GW {
10 | struct Module;
11 | extern Module CtoSModule;
12 |
13 | namespace CtoS {
14 | typedef HookCallback PacketCallback;
15 | // Send packet that uses only dword parameters, can copypaste most gwa2 sendpackets :D. Returns true if enqueued.
16 | GWCA_API bool SendPacket(uint32_t size, ...);
17 |
18 | GWCA_API void RegisterPacketCallback(
19 | HookEntry* entry,
20 | uint32_t header,
21 | const PacketCallback& callback);
22 |
23 | GWCA_API void RemoveCallback(uint32_t header, HookEntry* entry);
24 | // Send a packet with a specific struct alignment, used for more complex packets. Returns true if enqueued.
25 | GWCA_API bool SendPacket(uint32_t size, void* buffer);
26 |
27 | template
28 | inline bool SendPacket(T *packet) {
29 | return SendPacket(sizeof(T), packet);
30 | }
31 | };
32 | }
33 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/NPC.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct NPC { // total: 0x30/48
7 | /* +h0000 */ uint32_t model_file_id;
8 | /* +h0004 */ uint32_t h0004;
9 | /* +h0008 */ uint32_t scale; // I think, 2 highest order bytes are percent of size, so 0x64000000 is 100%
10 | /* +h000C */ uint32_t sex;
11 | /* +h0010 */ uint32_t npc_flags;
12 | /* +h0014 */ uint32_t primary;
13 | /* +h0018 */ uint32_t h0018;
14 | /* +h001C */ uint8_t default_level;
15 | // +h001D uint8_t padding;
16 | // +h001E uint16_t padding;
17 | /* +h0020 */ wchar_t *name_enc;
18 | /* +h0024 */ uint32_t *model_files;
19 | /* +h0028 */ uint32_t files_count; // length of ModelFile
20 | /* +h002C */ uint32_t files_capacity; // capacity of ModelFile
21 |
22 | inline bool IsHenchman() { return (npc_flags & 0x10) != 0; }
23 | inline bool IsHero() { return (npc_flags & 0x20) != 0; }
24 | };
25 | static_assert(sizeof(NPC) == 48, "struct NPC has incorect size");
26 |
27 | typedef Array NPCArray;
28 | }
29 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/TradeContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 |
8 | namespace GW {
9 |
10 | struct TradeContext {
11 | static constexpr uint32_t TRADE_CLOSED = 0;
12 | static constexpr uint32_t TRADE_INITIATED = 1;
13 | static constexpr uint32_t TRADE_OFFER_SEND = 2;
14 | static constexpr uint32_t TRADE_ACCEPTED = 4;
15 |
16 | struct Item {
17 | ItemID item_id;
18 | uint32_t quantity;
19 | };
20 |
21 | struct Trader {
22 | uint32_t gold;
23 | Array items;
24 | };
25 |
26 | /* +h0000 */ uint32_t flags; // this is actually a flags
27 | /* +h0004 */ uint32_t h0004[3]; // Seemingly 3 null dwords
28 | /* +h0010 */ Trader player;
29 | /* +h0024 */ Trader partner;
30 |
31 | // bool GetPartnerAccepted();
32 | // bool GetPartnerOfferSent();
33 |
34 | bool GetIsTradeInitiated() const { return (flags & TRADE_INITIATED) != 0; }
35 | bool GetIsTradeAccepted() const { return (flags & TRADE_ACCEPTED) != 0; }
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/Include/GWCA/GWCA.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | /**********************************************************************************\
4 |
5 | _____ _ _ _____ ___
6 | | __ \ | | / __ \ / _ \ _ _
7 | | | \/ | | | / \// /_\ \_| |_ _| |_
8 | | | __| |/\| | | | _ |_ _|_ _|
9 | | |_\ \ /\ / \__/\| | | | |_| |_|
10 | \____/\/ \/ \____/\_| |_/
11 |
12 |
13 | Created by KAOS (a.k.a. 4D 1) and HasKha for use in GWToolbox++
14 |
15 | Credits to:
16 |
17 | Sune C (a.k.a. Harboe) and ACB -
18 | Most low level ground work of API via the GWCA and GWLP:R
19 | projects as well as getting the gamerevision community rolling.
20 | Much help from following these two gentlemen's breadcrumbs.
21 |
22 | Miracle444 -
23 | GWA2, as well as helping me really understand how the game handles
24 | its memory information.
25 |
26 | d8rken -
27 | Zraw menu/api which acted as a gateway to get a grasp of cpp as well
28 | as directx.
29 |
30 | HasKha -
31 | For getting me to not make everything singletons :P
32 | \**********************************************************************************/
33 |
34 | namespace GW {
35 | bool Initialize();
36 | void DisableHooks();
37 | void Terminate();
38 | }
39 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Attribute.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | namespace Constants {
7 | enum class Attribute : uint32_t;
8 | enum class Profession;
9 | }
10 |
11 | struct Attribute { // total: 0x14/20
12 | /* +h0000 */ Constants::Attribute id; // ID of attribute
13 | /* +h0004 */ uint32_t level_base; // Level of attribute without modifiers (runes,pcons,etc)
14 | /* +h0008 */ uint32_t level; // Level with modifiers
15 | /* +h000C */ uint32_t decrement_points; // Points that you will recieve back if you decrement level.
16 | /* +h0010 */ uint32_t increment_points; // Points you will need to increment level.
17 | };
18 |
19 | struct AttributeInfo {
20 | Constants::Profession profession_id;
21 | Constants::Attribute attribute_id;
22 | uint32_t name_id;
23 | uint32_t desc_id;
24 | uint32_t is_pve;
25 | };
26 | static_assert(sizeof(AttributeInfo) == 0x14);
27 |
28 |
29 | struct PartyAttribute {
30 | uint32_t agent_id;
31 | Attribute attribute[54];
32 | };
33 | static_assert(sizeof(PartyAttribute) == 0x43c);
34 |
35 | typedef Array PartyAttributeArray;
36 | }
37 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 |
3 | project(GWCA)
4 |
5 | if(CMAKE_SIZEOF_VOID_P EQUAL 8)
6 | message(FATAL_ERROR "You are configuring a 64bit build, this is not supported. Run cmake with `-A Win32`")
7 | endif()
8 |
9 | set_property(GLOBAL PROPERTY USE_FOLDERS ON)
10 |
11 | set(GWCA_FOLDER "${CMAKE_CURRENT_LIST_DIR}/")
12 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/")
13 |
14 | add_subdirectory(Dependencies)
15 |
16 | add_library(gwca)
17 | file(GLOB SOURCES
18 | "source/stdafx.h"
19 | "source/*.cpp"
20 | "include/gwca/constants/*.h"
21 | "include/gwca/context/*.h"
22 | "include/gwca/gamecontainers/*.h"
23 | "include/gwca/gameentities/*.h"
24 | "include/gwca/managers/*.h"
25 | "include/gwca/packets/*.h"
26 | "include/gwca/utilities/*.h")
27 | source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES})
28 | target_sources(gwca PRIVATE ${SOURCES})
29 | target_compile_features(gwca PUBLIC cxx_std_17)
30 |
31 | target_precompile_headers(gwca PRIVATE "source/stdafx.h")
32 | target_include_directories(gwca PUBLIC "include/")
33 |
34 | target_link_libraries(gwca PUBLIC
35 | directx
36 | minhook)
37 |
38 | if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
39 | include(imgui)
40 | add_subdirectory(Examples)
41 | endif()
42 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/GuildMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct Guild;
7 | struct GuildContext;
8 |
9 | typedef Array GuildArray;
10 |
11 | // @Cleanup: @Fix: This should be replaced by an UUID type
12 | struct GHKey;
13 |
14 | struct Module;
15 | extern Module GuildModule;
16 |
17 | namespace GuildMgr {
18 |
19 | // Array of guilds, holds basically everything about a guild. Can get structs of all players in outpost ;)
20 | GWCA_API GuildArray* GetGuildArray();
21 |
22 | Guild* GetPlayerGuild();
23 |
24 | // Get the guild that owns the current Guild Hall that the player is in
25 | GWCA_API Guild* GetCurrentGH();
26 |
27 | GWCA_API Guild* GetGuildInfo(uint32_t guild_id);
28 |
29 | // Index in guild array of player guild.
30 | GWCA_API uint32_t GetPlayerGuildIndex();
31 |
32 | // Announcement in guild at the moment.
33 | GWCA_API wchar_t *GetPlayerGuildAnnouncement();
34 |
35 | // Name of player who last edited the announcement.
36 | GWCA_API wchar_t *GetPlayerGuildAnnouncer();
37 |
38 | GWCA_API bool TravelGH();
39 |
40 | GWCA_API bool TravelGH(GHKey key);
41 |
42 | GWCA_API bool LeaveGH();
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/PartyContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace GW {
8 | struct PartyContext;
9 | GWCA_API PartyContext* GetPartyContext();
10 |
11 | struct PartyInfo;
12 | struct PartySearch;
13 |
14 | struct PartyContext { // total: 0x58/88
15 |
16 | static PartyContext* instance();
17 |
18 | /* +h0000 */ uint32_t h0000;
19 | /* +h0004 */ Array h0004;
20 | /* +h0014 */ uint32_t flag;
21 | /* +h0018 */ uint32_t h0018;
22 | /* +h001C */ TList requests;
23 | /* +h0028 */ uint32_t requests_count;
24 | /* +h002C */ TList sending;
25 | /* +h0038 */ uint32_t sending_count;
26 | /* +h003C */ uint32_t h003C;
27 | /* +h0040 */ Array parties;
28 | /* +h0050 */ uint32_t h0050;
29 | /* +h0054 */ PartyInfo *player_party; // Players party
30 | /* +h0058 */ uint8_t h0058[104];
31 | /* +h00C0 */ Array party_search;
32 |
33 | bool InHardMode() const { return (flag & 0x10) > 0; }
34 | bool IsDefeated() const { return (flag & 0x20) > 0; }
35 | bool IsPartyLeader() const { return (flag >> 0x7) & 1; }
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Friendslist.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | enum class FriendType : uint32_t {
7 | Unknow = 0,
8 | Friend = 1,
9 | Ignore = 2,
10 | Player = 3,
11 | Trade = 4,
12 | };
13 |
14 | enum class FriendStatus : uint32_t {
15 | Offline = 0,
16 | Online = 1,
17 | DND = 2,
18 | Away = 3,
19 | Unknown = 4
20 | };
21 |
22 | struct Friend {
23 | /* +h0000 */ FriendType type;
24 | /* +h0004 */ FriendStatus status;
25 | /* +h0008 */ uint8_t uuid[16];
26 | /* +h0018 */ wchar_t alias[20];
27 | /* +h002C */ wchar_t charname[20];
28 | /* +h0040 */ uint32_t friend_id;
29 | /* +h0044 */ uint32_t zone_id;
30 | };
31 |
32 | typedef Array FriendsListArray;
33 |
34 | struct FriendList {
35 | /* +h0000 */ FriendsListArray friends;
36 | /* +h0010 */ uint8_t h0010[20];
37 | /* +h0024 */ uint32_t number_of_friend;
38 | /* +h0028 */ uint32_t number_of_ignore;
39 | /* +h002C */ uint32_t number_of_partner;
40 | /* +h0030 */ uint32_t number_of_trade;
41 | /* +h0034 */ uint8_t h0034[108];
42 | /* +h00A0 */ FriendStatus player_status;
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/Source/Hooker.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #include
4 | #include
5 |
6 | static std::atomic init_count;
7 | static std::atomic in_hook_count;
8 |
9 | void GW::HookBase::Initialize()
10 | {
11 | ++init_count;
12 | MH_Initialize();
13 | }
14 |
15 | void GW::HookBase::Deinitialize()
16 | {
17 | if (--init_count == 0)
18 | MH_Uninitialize();
19 | }
20 |
21 | void GW::HookBase::EnterHook()
22 | {
23 | ++in_hook_count;
24 | }
25 |
26 | void GW::HookBase::LeaveHook()
27 | {
28 | --in_hook_count;
29 | }
30 |
31 | int GW::HookBase::GetInHookCount()
32 | {
33 | return in_hook_count;
34 | }
35 |
36 | void GW::HookBase::EnableHooks(void *target)
37 | {
38 | if (target) {
39 | MH_EnableHook(target);
40 | } else {
41 | MH_EnableHook(MH_ALL_HOOKS);
42 | }
43 | }
44 |
45 | void GW::HookBase::DisableHooks(void *target)
46 | {
47 | if (target) {
48 | MH_DisableHook(target);
49 | } else {
50 | MH_DisableHook(MH_ALL_HOOKS);
51 | }
52 | }
53 |
54 | int GW::HookBase::CreateHook(void *target, void *detour, void **trampoline)
55 | {
56 | return target ? MH_CreateHook(target, detour, trampoline) : -1;
57 | }
58 |
59 | void GW::HookBase::RemoveHook(void *target)
60 | {
61 | if(target)
62 | MH_RemoveHook(target);
63 | }
64 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/QuestMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 |
7 | struct Quest;
8 | typedef Array QuestLog;
9 |
10 | namespace Constants {
11 | enum class QuestID : uint32_t;
12 | enum class Profession;
13 | }
14 |
15 | struct Module;
16 | extern Module QuestModule;
17 |
18 | namespace QuestMgr {
19 |
20 | GWCA_API GW::Constants::QuestID GetActiveQuestId();
21 |
22 | GWCA_API bool SetActiveQuestId(Constants::QuestID quest_id);
23 |
24 | GWCA_API Quest* GetActiveQuest();
25 |
26 | GWCA_API bool SetActiveQuest(Quest* quest);
27 |
28 | GWCA_API bool AbandonQuest(Quest* quest);
29 |
30 | GWCA_API bool AbandonQuestId(Constants::QuestID quest_id);
31 |
32 | GWCA_API QuestLog* GetQuestLog();
33 |
34 | GWCA_API Quest* GetQuest(GW::Constants::QuestID);
35 |
36 | // Find and populate a wchar_t* buffer with the encoded name of the category the quest belongs to in the quest log. Returns false on failure.
37 | GWCA_API bool GetQuestEntryGroupName(GW::Constants::QuestID quest_id, wchar_t* out, size_t out_len);
38 |
39 | GWCA_API bool RequestQuestInfo(const Quest* quest);
40 |
41 | GWCA_API bool RequestQuestInfoId(Constants::QuestID quest_id);
42 |
43 | };
44 | }
45 |
--------------------------------------------------------------------------------
/Examples/GwArmory/ImGuiAddons.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | typedef ImU32 Color;
4 |
5 | namespace ImGui {
6 | // Shows '(?)' and the helptext when hovered
7 | IMGUI_API void ShowHelp(const char* help);
8 | // Shows current text with a drop shadow
9 | IMGUI_API void TextShadowed(const char* label, ImVec2 offset = { 1, 1 }, ImVec4 shadow_color = { 0, 0, 0, 1 });
10 |
11 | IMGUI_API void SetNextWindowCenter(ImGuiWindowFlags flags);
12 |
13 | IMGUI_API bool MyCombo(const char* label, const char* preview_text, int* current_item,
14 | bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
15 |
16 | IMGUI_API bool SmallConfirmButton(const char* label, bool* confirm_bool, const char* confirm_content = "Are you sure you want to continue?");
17 |
18 | IMGUI_API bool ConfirmButton(const char* label, bool* confirm_bool, const char* confirm_content = "Are you sure you want to continue?");
19 |
20 | IMGUI_API bool IconButton(const char *str_id, ImTextureID user_texture_id, const ImVec2 &size);
21 |
22 | IMGUI_API bool ColorButtonPicker(const char*, Color*, ImGuiColorEditFlags = 0);
23 |
24 | IMGUI_API bool ColorPalette(const char* label, size_t* palette_index,
25 | ImVec4* palette, size_t count, size_t max_per_line, ImGuiColorEditFlags flags);
26 | }
27 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/CameraMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct Vec3f;
7 | struct Camera;
8 | struct Module;
9 |
10 | extern Module CameraModule;
11 |
12 | namespace CameraMgr {
13 | // ==== Camera ====
14 | GWCA_API Camera *GetCamera();
15 |
16 | GWCA_API void ForwardMovement(float amount, bool true_forward);
17 | GWCA_API void VerticalMovement(float amount);
18 | GWCA_API void RotateMovement(float angle);
19 | GWCA_API void SideMovement(float amount);
20 |
21 | // Change max zoom dist
22 | GWCA_API void SetMaxDist(float dist = 900.0f);
23 |
24 | GWCA_API void SetFieldOfView(float fov);
25 |
26 | // Manual computation of the position of the Camera. (As close as possible to the original)
27 | GWCA_API Vec3f ComputeCamPos(float dist = 0); // 2.f is the first person dist (const by gw)
28 | GWCA_API void UpdateCameraPos();
29 |
30 | GWCA_API float GetFieldOfView();
31 | GWCA_API float GetYaw();
32 | GWCA_API float GetCurrentYaw();
33 |
34 | // ==== Camera patches ====
35 | // Unlock camera & return the new state of it
36 | GWCA_API bool UnlockCam(bool flag);
37 | GWCA_API bool GetCameraUnlock();
38 |
39 | // Enable or Disable the fog & return the state of it
40 | GWCA_API bool SetFog(bool flag);
41 | };
42 | }
43 |
--------------------------------------------------------------------------------
/Examples/Pathing/Pathing.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | ImGui
8 |
9 |
10 | ImGui
11 |
12 |
13 | ImGui
14 |
15 |
16 |
17 |
18 | {810911b4-caff-4256-ac27-b728e28b5ead}
19 |
20 |
21 |
22 |
23 |
24 | ImGui
25 |
26 |
27 | ImGui
28 |
29 |
30 | ImGui
31 |
32 |
33 | ImGui
34 |
35 |
36 | ImGui
37 |
38 |
39 | ImGui
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Examples/GwArmory/imgui_impl_dx9.h:
--------------------------------------------------------------------------------
1 | // ImGui Win32 + DirectX9 binding
2 |
3 | // Implemented features:
4 | // [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
5 |
6 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
7 | // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
8 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
9 | // https://github.com/ocornut/imgui
10 |
11 | struct IDirect3DDevice9;
12 |
13 | IMGUI_API bool ImGui_ImplDX9_Init(void* hwnd, IDirect3DDevice9* device);
14 | IMGUI_API void ImGui_ImplDX9_Shutdown();
15 | IMGUI_API void ImGui_ImplDX9_NewFrame();
16 | IMGUI_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data);
17 |
18 | // Use if you want to reset your rendering device without losing ImGui state.
19 | IMGUI_API void ImGui_ImplDX9_InvalidateDeviceObjects();
20 | IMGUI_API bool ImGui_ImplDX9_CreateDeviceObjects();
21 |
22 | // Handler for Win32 messages, update mouse/keyboard data.
23 | // You may or not need this for your implementation, but it can serve as reference for handling inputs.
24 | // Commented out to avoid dragging dependencies on types. You can copy the extern declaration in your code.
25 | /*
26 | IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
27 | */
28 |
--------------------------------------------------------------------------------
/Examples/WorldInformation/imgui_impl_dx9.h:
--------------------------------------------------------------------------------
1 | // ImGui Win32 + DirectX9 binding
2 |
3 | // Implemented features:
4 | // [X] User texture binding. Use 'LPDIRECT3DTEXTURE9' as ImTextureID. Read the FAQ about ImTextureID in imgui.cpp.
5 |
6 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.
7 | // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().
8 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
9 | // https://github.com/ocornut/imgui
10 |
11 | struct IDirect3DDevice9;
12 |
13 | IMGUI_API bool ImGui_ImplDX9_Init(void* hwnd, IDirect3DDevice9* device);
14 | IMGUI_API void ImGui_ImplDX9_Shutdown();
15 | IMGUI_API void ImGui_ImplDX9_NewFrame();
16 | IMGUI_API void ImGui_ImplDX9_RenderDrawData(ImDrawData* draw_data);
17 |
18 | // Use if you want to reset your rendering device without losing ImGui state.
19 | IMGUI_API void ImGui_ImplDX9_InvalidateDeviceObjects();
20 | IMGUI_API bool ImGui_ImplDX9_CreateDeviceObjects();
21 |
22 | // Handler for Win32 messages, update mouse/keyboard data.
23 | // You may or not need this for your implementation, but it can serve as reference for handling inputs.
24 | // Commented out to avoid dragging dependencies on types. You can copy the extern declaration in your code.
25 | /*
26 | IMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
27 | */
28 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/MerchantMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 |
8 | struct Module;
9 | extern Module MerchantModule;
10 |
11 | typedef uint32_t ItemID;
12 | typedef Array MerchItemArray;
13 |
14 | namespace Merchant {
15 |
16 | struct TransactionInfo {
17 | uint32_t item_count = 0;
18 | uint32_t *item_ids = nullptr;
19 | uint32_t *item_quantities = nullptr;
20 | };
21 |
22 | struct QuoteInfo {
23 | uint32_t unknown = 0;
24 | uint32_t item_count = 0;
25 | uint32_t *item_ids = nullptr;
26 | };
27 |
28 | enum class TransactionType : uint32_t {
29 | MerchantBuy = 0x1,
30 | CollectorBuy,
31 | CrafterBuy,
32 | WeaponsmithCustomize,
33 |
34 | MerchantSell = 0xB,
35 | TraderBuy,
36 | TraderSell,
37 |
38 | UnlockRunePriestOfBalth = 0xF
39 | };
40 |
41 | GWCA_API bool TransactItems(TransactionType type,
42 | uint32_t gold_give, TransactionInfo give,
43 | uint32_t gold_recv, TransactionInfo recv
44 | );
45 |
46 | GWCA_API bool RequestQuote(TransactionType type,
47 | QuoteInfo give,
48 | QuoteInfo recv
49 | );
50 |
51 | // note: can contain pointers to random items from your inventory
52 | GWCA_API MerchItemArray* GetMerchantItemsArray();
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Title.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace GW {
8 | namespace Constants {
9 | enum class TitleID : uint32_t;
10 | }
11 | struct Title { // total: 0x28/40
12 | /* +h0000 */ uint32_t props;
13 | /* +h0004 */ uint32_t current_points;
14 | /* +h0008 */ uint32_t current_title_tier_index;
15 | /* +h000C */ uint32_t points_needed_current_rank;
16 | /* +h0010 */ uint32_t next_title_tier_index;
17 | /* +h0014 */ uint32_t points_needed_next_rank;
18 | /* +h0018 */ uint32_t max_title_rank;
19 | /* +h001C */ uint32_t max_title_tier_index;
20 | /* +h0020 */ wchar_t* h0020; // Pretty sure these are ptrs to title hash strings
21 | /* +h0024 */ wchar_t* h0024; // Pretty sure these are ptrs to title hash strings
22 |
23 | inline bool is_percentage_based() { return (props & 1) != 0; };
24 | inline bool has_tiers() { return (props & 3) == 2; };
25 |
26 | };
27 | static_assert(sizeof(Title) == 40, "struct Title has incorect size");
28 |
29 | struct TitleTier {
30 | uint32_t props;
31 | uint32_t tier_number;
32 | wchar_t* tier_name_enc;
33 | inline bool is_percentage_based() { return (props & 1) != 0; };
34 | };
35 | static_assert(sizeof(TitleTier) == 0xc, "struct TitleTier has incorect size");
36 |
37 | struct TitleClientData {
38 | uint32_t title_id;
39 | uint32_t name_id;
40 | };
41 | typedef Array TitleArray;
42 | }
43 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Hero.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | typedef uint32_t AgentID;
8 |
9 | enum class HeroBehavior : uint32_t {
10 | Fight, Guard, AvoidCombat
11 | };
12 |
13 | struct HeroFlag { // total: 0x20/36
14 | /* +h0000 */ uint32_t hero_id;
15 | /* +h0004 */ AgentID agent_id;
16 | /* +h0008 */ uint32_t level;
17 | /* +h000C */ HeroBehavior hero_behavior;
18 | /* +h0010 */ Vec2f flag;
19 | /* +h0018 */ uint32_t h0018;
20 | /* +h001C */ AgentID locked_target_id;
21 | /* +h0020 */ uint32_t h0020; // type is unknown too, added for padding
22 | };
23 | static_assert(sizeof(HeroFlag) == 0x24, "struct HeroFlag has incorect size");
24 |
25 | struct HeroInfo { // total: 0x78/120
26 | /* +h0000 */ uint32_t hero_id;
27 | /* +h0004 */ uint32_t agent_id;
28 | /* +h0008 */ uint32_t level;
29 | /* +h000C */ uint32_t primary; // Primary profession 0-10 (None,W,R,Mo,N,Me,E,A,Rt,P,D)
30 | /* +h0010 */ uint32_t secondary; // Primary profession 0-10 (None,W,R,Mo,N,Me,E,A,Rt,P,D)
31 | /* +h0014 */ uint32_t hero_file_id;
32 | /* +h0018 */ uint32_t model_file_id;
33 | /* +h001C */ uint8_t h001C[52];
34 | /* +h0050 */ wchar_t name[20];
35 | };
36 | static_assert(sizeof(HeroInfo) == 120, "struct HeroInfo has incorect size");
37 |
38 | typedef Array HeroFlagArray;
39 | typedef Array HeroInfoArray;
40 | }
41 |
--------------------------------------------------------------------------------
/Include/GWCA/Utilities/Scanner.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace GW {
4 |
5 | // class PatternScanner
6 | // 32 bit pattern scanner for x86 programs.
7 | // Credits to Zat & Midi12 @ unknowncheats.me for the functionality of this class.
8 | namespace Scanner {
9 |
10 | // Initializer to determine scan range.
11 | void Initialize(uintptr_t start, size_t size);
12 | void Initialize(const char* moduleName = NULL);
13 | void Initialize(HMODULE hModule);
14 |
15 | enum Section : unsigned char {
16 | TEXT,
17 | RDATA,
18 | DATA
19 | };
20 |
21 | // Find reference in GW memory to a specific assertion message
22 | uintptr_t FindAssertion(const char* assertion_file, const char* assertion_msg, int offset = 0);
23 |
24 | // Pattern find between a start and end address. If end is less than start, will scan backward.
25 | uintptr_t FindInRange(const char* pattern, const char* mask, int offset, DWORD start, DWORD end);
26 |
27 | // Actual pattern finder.
28 | uintptr_t Find(const char* pattern, const char* mask = 0, int offset = 0, Section section = Section::TEXT);
29 |
30 | // Check if current address is a valid pointer (usually to a data variable in DATA)
31 | bool IsValidPtr(uintptr_t address, Section section = Section::DATA);
32 |
33 | // Returns actual address of a function call given via CALL instruction e.g. *call_instruction_address = 0xE8 ?? ?? ?? 0xFF
34 | uintptr_t FunctionFromNearCall(uintptr_t call_instruction_address);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/FriendListMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 |
8 | struct Friend;
9 | struct FriendList;
10 |
11 | enum class FriendStatus : uint32_t;
12 | enum class FriendType : uint32_t;
13 |
14 | struct Module;
15 | extern Module FriendListModule;
16 |
17 | namespace FriendListMgr {
18 |
19 | GWCA_API FriendList *GetFriendList();
20 |
21 | GWCA_API Friend *GetFriend(const wchar_t *alias, const wchar_t *charname, FriendType type = (FriendType)1);
22 | GWCA_API Friend *GetFriend(uint32_t index);
23 | GWCA_API Friend *GetFriend(const uint8_t *uuid);
24 |
25 | GWCA_API uint32_t GetNumberOfFriends(FriendType = (FriendType)1);
26 | GWCA_API uint32_t GetNumberOfIgnores();
27 | GWCA_API uint32_t GetNumberOfPartners();
28 | GWCA_API uint32_t GetNumberOfTraders();
29 |
30 | GWCA_API FriendStatus GetMyStatus();
31 |
32 | GWCA_API bool SetFriendListStatus(FriendStatus status);
33 |
34 | typedef HookCallback FriendStatusCallback;
35 | GWCA_API void RegisterFriendStatusCallback(
36 | HookEntry *entry,
37 | const FriendStatusCallback& callback);
38 |
39 | GWCA_API void RemoveFriendStatusCallback(
40 | HookEntry *entry);
41 |
42 | GWCA_API bool AddFriend(const wchar_t *name, const wchar_t *alias = nullptr);
43 | GWCA_API bool AddIgnore(const wchar_t *name, const wchar_t *alias = nullptr);
44 | GWCA_API bool RemoveFriend(Friend *_friend);
45 | };
46 | }
47 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Quest.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | namespace Constants {
8 | enum class QuestID : uint32_t;
9 | enum class MapID;
10 | }
11 |
12 | struct Quest { // total: 0x34/52
13 | /* +h0000 */ GW::Constants::QuestID quest_id;
14 | /* +h0004 */ uint32_t log_state;
15 | /* +h0008 */ wchar_t* location; // quest category
16 | /* +h000C */ wchar_t* name; // quest name
17 | /* +h0010 */ wchar_t* npc; //
18 | /* +h0014 */ GW::Constants::MapID map_from;
19 | /* +h0018 */ Vec3f marker;
20 | /* +h0024 */ uint32_t h0024;
21 | /* +h0028 */ GW::Constants::MapID map_to;
22 | /* +h002C */ wchar_t* description; // namestring reward
23 | /* +h0030 */ wchar_t* objectives; // namestring objective
24 |
25 | inline bool IsCurrentMissionQuest() { return (log_state & 0x10) != 0; }
26 | inline bool IsAreaPrimary() { return (log_state & 0x40) != 0; } // e.g. "Primary Echovald Forest Quests"
27 | inline bool IsPrimary() { return (log_state & 0x20) != 0; } // e.g. "Primary Quests"
28 | };
29 | static_assert(sizeof(Quest) == 52, "struct Quest has incorect size");
30 |
31 | struct MissionObjective { // total: 0xC/12
32 | /* +h0000 */ uint32_t objective_id;
33 | /* +h0004 */ wchar_t *enc_str;
34 | /* +h0008 */ uint32_t type; // completed, bullet, etc...
35 | };
36 | static_assert(sizeof(MissionObjective) == 12, "struct MissionObjective has incorect size");
37 |
38 | typedef Array QuestLog;
39 | }
40 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/TextParser.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct TextCache {
7 | /* +h0000 */ uint32_t h0000;
8 | };
9 |
10 | struct SubStruct1 {
11 | /* +h0000 */ uint32_t h0000;
12 | };
13 |
14 | // Allocated @0078C243
15 | struct SubStructUnk { // total: 0x54/84
16 | /* +h0000 */ uint32_t AsyncDecodeStr_Callback;
17 | /* +h0004 */ uint32_t AsyncDecodeStr_Param;
18 | /* +h0008 */ uint32_t buffer_used; // if it's 1 then uses s1 & if it's 0 uses s2.
19 | /* +h000C */ Array s1;
20 | /* +h001C */ Array s2;
21 | /* +h002C */ uint32_t h002C;
22 | /* +h0030 */ uint32_t h0030; // tell us how many string will be enqueue before decoding.
23 | /* +h0034 */ uint32_t h0034; // @0078B990
24 | /* +h0038 */ uint8_t h0038[28];
25 | };
26 |
27 | struct TextParser {
28 | /* +h0000 */ uint32_t h0000[8];
29 | /* +h0020 */ wchar_t *dec_start;
30 | /* +h0024 */ wchar_t *dec_end;
31 | /* +h0028 */ uint32_t substitute_1; // related to h0020 & h0024
32 | /* +h002C */ uint32_t substitute_2; // related to h0020 & h0024
33 | /* +h0030 */ TextCache *cache;
34 | /* +h0034 */ uint32_t h0034[75];
35 | /* +h0160 */ uint32_t h0160; // @0078BEF5
36 | /* +h0164 */ uint32_t h0164;
37 | /* +h0168 */ uint32_t h0168; // set to 0 @0078BF34
38 | /* +h016C */ uint32_t h016C[5];
39 | /* +h0180 */ SubStruct1 *sub_struct;
40 | /* +h0184 */ uint32_t h0184[19];
41 | /* +h01d0 */ uint32_t language_id;
42 | };
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/AccountContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | struct AccountContext;
8 | GWCA_API AccountContext* GetAccountContext();
9 |
10 | struct AccountUnlockedCount {
11 | uint32_t id;
12 | uint32_t unk1;
13 | uint32_t unk2;
14 | };
15 |
16 | struct AccountUnlockedItemInfo {
17 | uint32_t name_id;
18 | uint32_t mod_struct_index; // Used to find mod struct in unlocked_pvp_items_mod_structs...
19 | uint32_t mod_struct_size;
20 | };
21 |
22 | struct AccountContext {
23 |
24 | static AccountContext* instance();
25 |
26 | /* +h0000 */ Array account_unlocked_counts; // e.g. number of unlocked storage panes
27 | /* +h0010 */ uint8_t h0010[0xA4];
28 | /* +h00b4 */ Array unlocked_pvp_heros; // Unused, hero battles is no more :(
29 | /* +h00c4 */ Array h00c4;// If an item is unlocked, the mod struct is stored here. Use unlocked_pvp_items_info to find the index. Idk why, chaos reigns I guess
30 | /* +h00e4 */ Array unlocked_pvp_item_info; // If an item is unlocked, the details are stored here
31 | /* +h00f4 */ Array unlocked_pvp_items; // Bitwise array of which pvp items are unlocked
32 | /* +h0104 */ uint8_t h0104[0x30]; // Some arrays, some linked lists, meh
33 | /* +h0124 */ Array unlocked_account_skills; // List of skills unlocked (but not learnt) for this account, i.e. skills that heros can use, tomes can unlock
34 | /* +h0134 */ uint32_t account_flags;
35 | };
36 | static_assert(sizeof(AccountContext) == 0x138);
37 | }
38 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/GameContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | namespace GW {
5 | struct GameContext;
6 | GWCA_API GameContext* GetGameContext();
7 |
8 | struct Cinematic;
9 | struct MapContext;
10 | struct TextParser;
11 | struct CharContext;
12 | struct ItemContext;
13 | struct AgentContext;
14 | struct GuildContext;
15 | struct PartyContext;
16 | struct TradeContext;
17 | struct WorldContext;
18 | struct GadgetContext;
19 | struct AccountContext;
20 |
21 | struct GameContext {
22 |
23 | static GameContext* instance();
24 |
25 | /* +h0000 */ void* h0000;
26 | /* +h0004 */ void* h0004;
27 | /* +h0008 */ AgentContext* agent; // Most functions that access are prefixed with Agent.
28 | /* +h000C */ void* h000C;
29 | /* +h0010 */ void* h0010;
30 | /* +h0014 */ MapContext* map; // Static object/collision data
31 | /* +h0018 */ TextParser *text_parser;
32 | /* +h001C */ void* h001C;
33 | /* +h0020 */ uint32_t some_number; // 0x30 for me at the moment.
34 | /* +h0024 */ void* h0024;
35 | /* +h0028 */ AccountContext* account;
36 | /* +h002C */ WorldContext* world; // Best name to fit it that I can think of.
37 | /* +h0030 */ Cinematic *cinematic;
38 | /* +h0034 */ void* h0034;
39 | /* +h0038 */ GadgetContext* gadget;
40 | /* +h003C */ GuildContext* guild;
41 | /* +h0040 */ ItemContext* items;
42 | /* +h0044 */ CharContext* character;
43 | /* +h0048 */ void* h0048;
44 | /* +h004C */ PartyContext* party;
45 | /* +h0050 */ void* h0050;
46 | /* +h0054 */ void* h0054;
47 | /* +h0058 */ TradeContext* trade;
48 | };
49 | }
50 |
--------------------------------------------------------------------------------
/Dependencies/minhook/src/hde/pstdint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MinHook - The Minimalistic API Hooking Library for x64/x86
3 | * Copyright (C) 2009-2017 Tsuda Kageyu. All rights reserved.
4 | *
5 | * Redistribution and use in source and binary forms, with or without
6 | * modification, are permitted provided that the following conditions
7 | * are met:
8 | *
9 | * 1. Redistributions of source code must retain the above copyright
10 | * notice, this list of conditions and the following disclaimer.
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in the
13 | * documentation and/or other materials provided with the distribution.
14 | *
15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | */
26 |
27 | #pragma once
28 |
29 | #include
30 |
31 | // Integer types for HDE.
32 | typedef INT8 int8_t;
33 | typedef INT16 int16_t;
34 | typedef INT32 int32_t;
35 | typedef INT64 int64_t;
36 | typedef UINT8 uint8_t;
37 | typedef UINT16 uint16_t;
38 | typedef UINT32 uint32_t;
39 | typedef UINT64 uint64_t;
40 |
--------------------------------------------------------------------------------
/Include/GWCA/Utilities/Hooker.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace GW {
4 |
5 | class HookBase {
6 | protected:
7 | void* _detourFunc = nullptr;
8 | void* _retourFunc = nullptr;
9 | void* _sourceFunc = nullptr;
10 |
11 | public:
12 | static void Initialize();
13 | static void Deinitialize();
14 |
15 | // static void EnqueueHook(HookBase* base);
16 | // static void RemoveHook(HookBase* base);
17 |
18 | static void EnableHooks(void *target = NULL);
19 | static void DisableHooks(void *target = NULL);
20 |
21 | static int CreateHook(void *target, void *detour, void **trampoline);
22 | static void RemoveHook(void *target);
23 |
24 | static void EnterHook();
25 | static void LeaveHook();
26 | static int GetInHookCount();
27 | };
28 |
29 | template
30 | class THook : public HookBase {
31 | public:
32 | T Original() { return (T)_retourFunc; };
33 | bool Valid() { return _retourFunc != nullptr; };
34 | bool Empty() { return _retourFunc == nullptr; };
35 |
36 | T Detour(T source, T detour, const unsigned length = 0);
37 | T Retour(bool do_cleanup = true);
38 | };
39 |
40 | typedef THook Hook; // backward compatibility
41 | }
42 |
43 | template
44 | T GW::THook::Detour(T source, T detour, const unsigned length) {
45 | if (Empty()) {
46 | _sourceFunc = (void*)source;
47 | _detourFunc = (void*)detour;
48 | HookBase::EnqueueHook(this);
49 | }
50 | return (T)_retourFunc;
51 | }
52 |
53 | template
54 | T GW::THook::Retour(bool do_cleanup) {
55 | if (Valid()) {
56 | HookBase::RemoveHook(this);
57 | }
58 | return (T)_sourceFunc;
59 | }
60 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/MapContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace GW {
8 | struct PathingMap;
9 | struct MapProp;
10 | struct PropByType;
11 | struct PropModelInfo;
12 |
13 | typedef Array PathingMapArray;
14 |
15 | struct PropsContext {
16 | /* +h0000 */ uint8_t pad1[0x6C];
17 | /* +h006C */ Array> propsByType;
18 | /* +h007C */ uint8_t h007C[0x28];
19 | /* +h00A4 */ Array propModels;
20 | /* +h00B4 */ uint8_t h00B4[0xE0];
21 | /* +h0194 */ Array propArray;
22 | };
23 | static_assert(sizeof(PropsContext) == 0x1A4, "struct PropsContext has incorect size");
24 |
25 |
26 | struct MapContext {
27 | /* +h0000 */ float map_boundaries[5];
28 | /* +h0014 */ uint8_t h0014[24];
29 | /* +h002C */ Array spawns1; // Seem to be arena spawns. struct is X,Y,unk 4 byte value,unk 4 byte value.
30 | /* +h003C */ Array spawns2; // Same as above
31 | /* +h004C */ Array spawns3; // Same as above
32 | /* +h005C */ float h005C[6]; // Some trapezoid i think.
33 | /* +h0074 */ struct sub1 {
34 | struct sub2 {
35 | uint32_t pad1[6];
36 | PathingMapArray pmaps;
37 | } *sub2;
38 | /* +h0004 */ Array pathing_map_block;
39 | /* +h0014 */ uint32_t h0014[0x13];
40 | /* +h0060 */ Array> something_else_for_props;
41 | //... Bunch of arrays and shit
42 | } *sub1;
43 | /* +h0078 */ uint8_t pad1[4];
44 | /* +h007C */ PropsContext *props;
45 | //... Player coords and shit beyond this point if they are desirable :p
46 | };
47 |
48 | GWCA_API MapContext* GetMapContext();
49 | }
50 |
--------------------------------------------------------------------------------
/Source/Debug.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #include
4 |
5 | namespace GW
6 | {
7 | // @Robustness:
8 | // Should we create a mutex arround that?
9 |
10 | static LogHandler s_LogHandler;
11 | static void* s_LogHandlerContext;
12 | static PanicHandler s_PanicHandler;
13 | static void* s_PanicHandlerContext;
14 |
15 | void RegisterLogHandler(LogHandler handler, void *context)
16 | {
17 | s_LogHandler = handler;
18 | s_LogHandlerContext = context;
19 | }
20 |
21 | void RegisterPanicHandler(PanicHandler handler, void *context)
22 | {
23 | s_PanicHandler = handler;
24 | s_PanicHandlerContext = context;
25 | }
26 |
27 | __declspec(noreturn) void FatalAssert(
28 | const char *expr,
29 | const char *file,
30 | unsigned int line,
31 | const char *function)
32 | {
33 | if (s_PanicHandler) {
34 | s_PanicHandler(s_PanicHandlerContext, expr, file, line, function);
35 | }
36 | abort();
37 | }
38 |
39 | void __cdecl LogMessage(
40 | LogLevel level,
41 | const char *file,
42 | unsigned int line,
43 | const char *function,
44 | const char *fmt,
45 | ...)
46 | {
47 | va_list args;
48 | va_start(args, fmt);
49 | GW::LogMessageV(level, file, line, function, fmt, args);
50 | va_end(args);
51 | }
52 |
53 | void __cdecl LogMessageV(
54 | LogLevel level,
55 | const char *file,
56 | unsigned int line,
57 | const char *function,
58 | const char *fmt,
59 | va_list args)
60 | {
61 | if (s_LogHandler == nullptr)
62 | return;
63 |
64 | char message[1024];
65 | vsnprintf(message, sizeof(message), fmt, args);
66 | s_LogHandler(s_LogHandlerContext, level, message, file, line, function);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Dependencies/minhook/src/buffer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MinHook - The Minimalistic API Hooking Library for x64/x86
3 | * Copyright (C) 2009-2017 Tsuda Kageyu.
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | *
10 | * 1. Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * 2. Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 |
29 | #pragma once
30 |
31 | // Size of each memory slot.
32 | #if defined(_M_X64) || defined(__x86_64__)
33 | #define MEMORY_SLOT_SIZE 64
34 | #else
35 | #define MEMORY_SLOT_SIZE 32
36 | #endif
37 |
38 | VOID InitializeBuffer(VOID);
39 | VOID UninitializeBuffer(VOID);
40 | LPVOID AllocateBuffer(LPVOID pOrigin);
41 | VOID FreeBuffer(LPVOID pBuffer);
42 | BOOL IsExecutableAddress(LPVOID pAddress);
43 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/GuildContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace GW {
8 | struct GuildContext;
9 | GWCA_API GuildContext* GetGuildContext();
10 |
11 | typedef Array GuildArray;
12 | typedef Array GuildRoster;
13 | typedef Array GuildHistory;
14 |
15 | struct GuildContext {
16 |
17 | static GuildContext* instance();
18 |
19 | /* +h0000 */ uint32_t h0000;
20 | /* +h0004 */ uint32_t h0004;
21 | /* +h0008 */ uint32_t h0008;
22 | /* +h000C */ uint32_t h000C;
23 | /* +h0010 */ uint32_t h0010;
24 | /* +h0014 */ uint32_t h0014;
25 | /* +h0018 */ uint32_t h0018;
26 | /* +h001C */ uint32_t h001C;
27 | /* +h0020 */ Array h0020;
28 | /* +h0030 */ uint32_t h0030;
29 | /* +h0034 */ wchar_t player_name[20];
30 | /* +h005C */ uint32_t h005C;
31 | /* +h0060 */ uint32_t player_guild_index;
32 | /* +h0064 */ GHKey player_gh_key;
33 | /* +h0074 */ uint32_t h0074;
34 | /* +h0078 */ wchar_t announcement[256];
35 | /* +h0278 */ wchar_t announcement_author[20];
36 | /* +h02A0 */ uint32_t player_guild_rank;
37 | /* +h02A4 */ uint32_t h02A4;
38 | /* +h02A8 */ Array factions_outpost_guilds;
39 | /* +h02B8 */ Array h02B8;
40 | /* +h02C8 */ uint32_t h02C8;
41 | /* +h02CC */ GuildHistory player_guild_history;
42 | /* +h02DC */ uint32_t h02DC[7];
43 | /* +h02F8 */ GuildArray guilds;
44 | /* +h0308 */ uint32_t h0308[4];
45 | /* +h0318 */ Array h0318;
46 | /* +h0328 */ uint32_t h0328;
47 | /* +h032C */ Array h032C;
48 | /* +h033C */ uint32_t h033C[7];
49 | /* +h0358 */ GuildRoster player_roster;
50 | //... end of what i care about
51 | };
52 | }
53 |
--------------------------------------------------------------------------------
/Source/MemoryMgr.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #include
4 | #include
5 |
6 | #include
7 |
8 | // Used to get precise skill recharge times.
9 | DWORD* GW::MemoryMgr::SkillTimerPtr = NULL;
10 |
11 | uintptr_t GW::MemoryMgr::WinHandlePtr = NULL;
12 |
13 | uintptr_t GW::MemoryMgr::GetPersonalDirPtr = NULL;
14 |
15 | namespace {
16 | typedef uint32_t(__cdecl* GetGWVersion_pt)(void);
17 | GetGWVersion_pt GetGWVersion_Func = nullptr;
18 | }
19 |
20 | bool GW::MemoryMgr::Scan() {
21 | Scanner::Initialize();
22 |
23 | uintptr_t address;
24 |
25 | // Skill timer to use for exact effect times.
26 | address = Scanner::Find("\x83\xCA\x01\x89\x15\x00\x00\x00\x00\xFF\xD6\x8B", "xxxxx????xxx", +5);
27 | if (address)
28 | SkillTimerPtr = *(DWORD**)address;
29 |
30 | address = Scanner::Find("\x83\xC4\x04\x83\x3D\x00\x00\x00\x00\x00\x75\x31", "xxxxx????xxx", -0xC);
31 | if (address)
32 | WinHandlePtr = *(uintptr_t *)address;
33 |
34 | GetPersonalDirPtr = Scanner::Find("\x75\x2E\x6A\x01\x6A\x05\x56\x6A\x00", "xxxxxxxxx", -0x53);
35 |
36 | address = Scanner::Find("\x6A\x00\x68\x00\x00\x01\x00\x89", "xxxxxxxx", 0x42);
37 | GetGWVersion_Func = (GetGWVersion_pt)Scanner::FunctionFromNearCall(address);
38 |
39 | GWCA_INFO("[SCAN] SkillTimerPtr = %08X", SkillTimerPtr);
40 | GWCA_INFO("[SCAN] WinHandlePtr = %08X", WinHandlePtr);
41 | GWCA_INFO("[SCAN] GetPersonalDirPtr = %08X", GetPersonalDirPtr);
42 | GWCA_INFO("[SCAN] GetGWVersion_Func = %p, %d", GetGWVersion_Func, GetGWVersion());
43 |
44 | #ifdef _DEBUG
45 | GWCA_ASSERT(SkillTimerPtr);
46 | GWCA_ASSERT(WinHandlePtr);
47 | GWCA_ASSERT(GetPersonalDirPtr);
48 | GWCA_ASSERT(GetGWVersion_Func);
49 | #endif
50 |
51 | return SkillTimerPtr && WinHandlePtr && GetPersonalDirPtr && GetGWVersion_Func;
52 | }
53 |
54 | uint32_t GW::MemoryMgr::GetGWVersion() {
55 | return GetGWVersion_Func ? GetGWVersion_Func() : 0;
56 | }
57 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/PlayerMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 |
7 | typedef uint32_t PlayerNumber;
8 |
9 | struct Player;
10 | struct Title;
11 | struct TitleClientData;
12 | typedef Array PlayerArray;
13 |
14 | namespace Constants {
15 | enum class TitleID : uint32_t;
16 | enum class Profession;
17 | enum class QuestID : uint32_t;
18 | }
19 |
20 | struct Module;
21 | extern Module PlayerModule;
22 |
23 | namespace PlayerMgr {
24 |
25 | GWCA_API bool SetActiveTitle(Constants::TitleID title_id);
26 |
27 | GWCA_API bool RemoveActiveTitle();
28 |
29 | GWCA_API uint32_t GetPlayerAgentId(uint32_t player_id);
30 |
31 | GWCA_API uint32_t GetAmountOfPlayersInInstance();
32 |
33 | GWCA_API PlayerArray* GetPlayerArray();
34 |
35 | // Get the player number of the currently logged in character
36 | GWCA_API PlayerNumber GetPlayerNumber();
37 |
38 | GWCA_API Player *GetPlayerByID(uint32_t player_id = 0);
39 |
40 | GWCA_API wchar_t *GetPlayerName(uint32_t player_id = 0);
41 |
42 | GWCA_API wchar_t* SetPlayerName(uint32_t player_id, const wchar_t *replace_name);
43 |
44 | GWCA_API bool ChangeSecondProfession(Constants::Profession prof, uint32_t hero_index = 0);
45 |
46 | GWCA_API Player *GetPlayerByName(const wchar_t *name);
47 |
48 | // Get the current progress of a title by id. If the title has no progress, this function will return nullptr
49 | GWCA_API Title* GetTitleTrack(Constants::TitleID title_id);
50 |
51 | GWCA_API Constants::TitleID GetActiveTitleId();
52 |
53 | GWCA_API Title* GetActiveTitle();
54 |
55 | GWCA_API TitleClientData* GetTitleData(Constants::TitleID title_id);
56 |
57 | // Donate 5000 faction points to Luxon (1) or Kurzick (0). Must be talking to faction NPC.
58 | GWCA_API bool DepositFaction(uint32_t allegiance);
59 | };
60 | }
61 |
--------------------------------------------------------------------------------
/Examples/WorldInformation/WorldInformation.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | ImGui
8 |
9 |
10 | ImGui
11 |
12 |
13 | ImGui
14 |
15 |
16 | ImGui
17 |
18 |
19 |
20 |
21 | {810911b4-caff-4256-ac27-b728e28b5ead}
22 |
23 |
24 |
25 |
26 |
27 | ImGui
28 |
29 |
30 | ImGui
31 |
32 |
33 | ImGui
34 |
35 |
36 | ImGui
37 |
38 |
39 | ImGui
40 |
41 |
42 | ImGui
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Include/GWCA/GameContainers/Array.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 |
7 | // class Array
8 | // generic game container seen throughout the games memory.
9 | // reccomended to only use references to maintain up-to-date information ( Array& )
10 |
11 | template
12 | class Array {
13 | public:
14 | typedef T* iterator;
15 | typedef const T* const_iterator;
16 |
17 | iterator begin() { return m_buffer; }
18 | const_iterator begin() const { return m_buffer; }
19 | iterator end() { return m_buffer + m_size; }
20 | const_iterator end() const { return m_buffer + m_size; }
21 |
22 | Array()
23 | : m_buffer(nullptr)
24 | , m_capacity(0)
25 | , m_size(0)
26 | , m_param(0)
27 | {}
28 |
29 | Array(const Array&) = delete;
30 | Array& operator=(const Array&) = delete;
31 |
32 | T& at(size_t index) {
33 | GWCA_ASSERT(m_buffer && index < m_size);
34 | return m_buffer[index];
35 | }
36 |
37 | const T& at(size_t index) const {
38 | GWCA_ASSERT(m_buffer && index < m_size);
39 | return m_buffer[index];
40 | }
41 |
42 | T& operator[](uint32_t index) {
43 | return at(index);
44 | }
45 |
46 | const T& operator[](uint32_t index) const {
47 | GWCA_ASSERT(m_buffer && index < m_size);
48 | return m_buffer[index];
49 | }
50 |
51 | bool valid() const { return m_buffer != nullptr; }
52 | void clear() { m_size = 0; }
53 |
54 | uint32_t size() const { return m_size; }
55 | uint32_t capacity() const { return m_capacity; }
56 |
57 | T* m_buffer; // +h0000
58 | uint32_t m_capacity; // +h0004
59 | uint32_t m_size; // +h0008
60 | uint32_t m_param; // +h000C
61 | }; // Size: 0x0010
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
Project moved to https://github.com/gwdevhub/GWCA.
2 |
3 | # GWCA++ #
4 |
5 | Another C++ API to interface with the Guild Wars client.
6 |
7 | by GWCA++ team (4D 1,gigi,reduf) initially for use in GWToolbox++
8 |
9 | ### Credits to: ###
10 |
11 | ACB,Harboe - For their work in the original GWCA project, most agentarray and ctogs functions are derived from this work
12 |
13 | ACB,_rusty,miracle44 - GWLP:R work with StoC packets, StoC handler derived form the GWLP Dumper
14 |
15 | Miracle444,TheArkanaProject - Work done in the GWA2 Project.
16 |
17 |
18 | ## Usage ##
19 |
20 | ### Including into project ###
21 |
22 | Start up a project in visual studio and init a git repo inside for it. Then use:
23 |
24 | ```
25 | git submodule add https://github.com/GregLando113/GWCA
26 | ```
27 |
28 | To clone the repo. From here, include the project (.vcxproj) in your solution using Add->Existing project, add a dependency to your main project, And add the project as a reference in your main project. Now when your main project compiles, GWCA++ will compile into it. From here just include "APIMain.h" into your main file.
29 |
30 | ### Using in code ###
31 |
32 | You must always start with calling the GWCA::Initialize() function, this function is what scans memory and places hooks, creates objects, etc. It will return a boolean on if the Initialize with sucessful.
33 |
34 | Once this has been done, create a local GWCA object in whatever function you are accessing GWCA from. **Do NOT make the GWCA object a class member, global variable, or allocate the object on heap (new operator).** With normal usage, creating this object will pause execution until the calling thread can obtain "api ownership" then it will proceed. For that functions execution, the thread will be the only one accessing the api under normal circumstances to avoid concurrency issues.
35 |
36 | From there you can retrieve different submodules such as Agents,Items,Skillbar,Effects,Map,etc. Using the -> operator on the GWCA object.
37 |
--------------------------------------------------------------------------------
/Examples/GwArmory/GwArmory.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {ff3f7ceb-7359-428a-b050-6693da9340db}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | ImGui
15 |
16 |
17 | ImGui
18 |
19 |
20 | ImGui
21 |
22 |
23 | ImGui
24 |
25 |
26 | ImGui
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | ImGui
35 |
36 |
37 | ImGui
38 |
39 |
40 | ImGui
41 |
42 |
43 | ImGui
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Examples/Teleport/Teleport.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28803.202
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Teleport", "Teleport.vcxproj", "{8B852BC5-203D-4894-B95B-F7CAB774B6C1}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GWCA", "..\..\vc\GWCA.vcxproj", "{B3359F05-68CF-4E7F-B9D6-D106F6D48A38}"
9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinHook", "..\..\vc\MinHook.vcxproj", "{AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|x86 = Debug|x86
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}.Debug|x86.ActiveCfg = Debug|Win32
19 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}.Debug|x86.Build.0 = Debug|Win32
20 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}.Release|x86.ActiveCfg = Release|Win32
21 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}.Release|x86.Build.0 = Release|Win32
22 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.ActiveCfg = Debug|Win32
23 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.Build.0 = Debug|Win32
24 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.ActiveCfg = Release|Win32
25 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.Build.0 = Release|Win32
26 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.ActiveCfg = Debug|Win32
27 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.Build.0 = Debug|Win32
28 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.ActiveCfg = Release|Win32
29 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.Build.0 = Release|Win32
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {5A2B60CC-CD42-4914-A64C-778CA61AC8E9}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/vc/MinHook.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {0c12c9c6-487f-4671-b709-8719d96ecb21}
6 |
7 |
8 | {d32fb340-b57b-4d96-8ca5-977ea49cdb51}
9 |
10 |
11 |
12 |
13 | src
14 |
15 |
16 | src
17 |
18 |
19 | src
20 |
21 |
22 | hde
23 |
24 |
25 | hde
26 |
27 |
28 |
29 |
30 | src
31 |
32 |
33 | src
34 |
35 |
36 | hde
37 |
38 |
39 | hde
40 |
41 |
42 | hde
43 |
44 |
45 | hde
46 |
47 |
48 | hde
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/D3DX10.h:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (C) Microsoft Corporation. All Rights Reserved.
4 | //
5 | // File: d3dx10.h
6 | // Content: D3DX10 utility library
7 | //
8 | //////////////////////////////////////////////////////////////////////////////
9 |
10 | #ifdef __D3DX10_INTERNAL__
11 | #error Incorrect D3DX10 header used
12 | #endif
13 |
14 | #ifndef __D3DX10_H__
15 | #define __D3DX10_H__
16 |
17 |
18 | // Defines
19 | #include
20 | #include
21 |
22 | #define D3DX10_DEFAULT ((UINT) -1)
23 | #define D3DX10_FROM_FILE ((UINT) -3)
24 | #define DXGI_FORMAT_FROM_FILE ((DXGI_FORMAT) -3)
25 |
26 | #ifndef D3DX10INLINE
27 | #ifdef _MSC_VER
28 | #if (_MSC_VER >= 1200)
29 | #define D3DX10INLINE __forceinline
30 | #else
31 | #define D3DX10INLINE __inline
32 | #endif
33 | #else
34 | #ifdef __cplusplus
35 | #define D3DX10INLINE inline
36 | #else
37 | #define D3DX10INLINE
38 | #endif
39 | #endif
40 | #endif
41 |
42 |
43 |
44 | // Includes
45 | #include "d3d10.h"
46 | #include "d3dx10.h"
47 | #include "d3dx10math.h"
48 | #include "d3dx10core.h"
49 | #include "d3dx10tex.h"
50 | #include "d3dx10mesh.h"
51 | #include "d3dx10async.h"
52 |
53 |
54 | // Errors
55 | #define _FACDD 0x876
56 | #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
57 |
58 | enum _D3DX10_ERR {
59 | D3DX10_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900),
60 | D3DX10_ERR_INVALID_MESH = MAKE_DDHRESULT(2901),
61 | D3DX10_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902),
62 | D3DX10_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903),
63 | D3DX10_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904),
64 | D3DX10_ERR_INVALID_DATA = MAKE_DDHRESULT(2905),
65 | D3DX10_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906),
66 | D3DX10_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907),
67 | D3DX10_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908),
68 | };
69 |
70 |
71 | #endif //__D3DX10_H__
72 |
73 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/D3DX11.h:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (C) Microsoft Corporation. All Rights Reserved.
4 | //
5 | // File: d3dx11.h
6 | // Content: D3DX11 utility library
7 | //
8 | //////////////////////////////////////////////////////////////////////////////
9 |
10 | #ifdef __D3DX11_INTERNAL__
11 | #error Incorrect D3DX11 header used
12 | #endif
13 |
14 | #ifndef __D3DX11_H__
15 | #define __D3DX11_H__
16 |
17 |
18 | // Defines
19 | #include
20 | #include
21 |
22 | #ifdef ALLOW_THROWING_NEW
23 | #include
24 | #endif
25 |
26 | #define D3DX11_DEFAULT ((UINT) -1)
27 | #define D3DX11_FROM_FILE ((UINT) -3)
28 | #define DXGI_FORMAT_FROM_FILE ((DXGI_FORMAT) -3)
29 |
30 | #ifndef D3DX11INLINE
31 | #ifdef _MSC_VER
32 | #if (_MSC_VER >= 1200)
33 | #define D3DX11INLINE __forceinline
34 | #else
35 | #define D3DX11INLINE __inline
36 | #endif
37 | #else
38 | #ifdef __cplusplus
39 | #define D3DX11INLINE inline
40 | #else
41 | #define D3DX11INLINE
42 | #endif
43 | #endif
44 | #endif
45 |
46 |
47 |
48 | // Includes
49 | #include "d3d11.h"
50 | #include "d3dx11.h"
51 | #include "d3dx11core.h"
52 | #include "d3dx11tex.h"
53 | #include "d3dx11async.h"
54 |
55 |
56 | // Errors
57 | #define _FACDD 0x876
58 | #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
59 |
60 | enum _D3DX11_ERR {
61 | D3DX11_ERR_CANNOT_MODIFY_INDEX_BUFFER = MAKE_DDHRESULT(2900),
62 | D3DX11_ERR_INVALID_MESH = MAKE_DDHRESULT(2901),
63 | D3DX11_ERR_CANNOT_ATTR_SORT = MAKE_DDHRESULT(2902),
64 | D3DX11_ERR_SKINNING_NOT_SUPPORTED = MAKE_DDHRESULT(2903),
65 | D3DX11_ERR_TOO_MANY_INFLUENCES = MAKE_DDHRESULT(2904),
66 | D3DX11_ERR_INVALID_DATA = MAKE_DDHRESULT(2905),
67 | D3DX11_ERR_LOADED_MESH_HAS_NO_DATA = MAKE_DDHRESULT(2906),
68 | D3DX11_ERR_DUPLICATE_NAMED_FRAGMENT = MAKE_DDHRESULT(2907),
69 | D3DX11_ERR_CANNOT_REMOVE_LAST_ITEM = MAKE_DDHRESULT(2908),
70 | };
71 |
72 |
73 | #endif //__D3DX11_H__
74 |
75 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/d3dx9.h:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (C) Microsoft Corporation. All Rights Reserved.
4 | //
5 | // File: d3dx9.h
6 | // Content: D3DX utility library
7 | //
8 | //////////////////////////////////////////////////////////////////////////////
9 |
10 | #ifdef __D3DX_INTERNAL__
11 | #error Incorrect D3DX header used
12 | #endif
13 |
14 | #ifndef __D3DX9_H__
15 | #define __D3DX9_H__
16 |
17 |
18 | // Defines
19 | #include
20 |
21 | #define D3DX_DEFAULT ((UINT) -1)
22 | #define D3DX_DEFAULT_NONPOW2 ((UINT) -2)
23 | #define D3DX_DEFAULT_FLOAT FLT_MAX
24 | #define D3DX_FROM_FILE ((UINT) -3)
25 | #define D3DFMT_FROM_FILE ((D3DFORMAT) -3)
26 |
27 | #ifndef D3DXINLINE
28 | #ifdef _MSC_VER
29 | #if (_MSC_VER >= 1200)
30 | #define D3DXINLINE __forceinline
31 | #else
32 | #define D3DXINLINE __inline
33 | #endif
34 | #else
35 | #ifdef __cplusplus
36 | #define D3DXINLINE inline
37 | #else
38 | #define D3DXINLINE
39 | #endif
40 | #endif
41 | #endif
42 |
43 |
44 |
45 | // Includes
46 | #include "d3d9.h"
47 | #include "d3dx9math.h"
48 | #include "d3dx9core.h"
49 | #include "d3dx9xof.h"
50 | #include "d3dx9mesh.h"
51 | #include "d3dx9shader.h"
52 | #include "d3dx9effect.h"
53 |
54 | #include "d3dx9tex.h"
55 | #include "d3dx9shape.h"
56 | #include "d3dx9anim.h"
57 |
58 |
59 |
60 | // Errors
61 | #define _FACDD 0x876
62 | #define MAKE_DDHRESULT( code ) MAKE_HRESULT( 1, _FACDD, code )
63 |
64 | enum _D3DXERR {
65 | D3DXERR_CANNOTMODIFYINDEXBUFFER = MAKE_DDHRESULT(2900),
66 | D3DXERR_INVALIDMESH = MAKE_DDHRESULT(2901),
67 | D3DXERR_CANNOTATTRSORT = MAKE_DDHRESULT(2902),
68 | D3DXERR_SKINNINGNOTSUPPORTED = MAKE_DDHRESULT(2903),
69 | D3DXERR_TOOMANYINFLUENCES = MAKE_DDHRESULT(2904),
70 | D3DXERR_INVALIDDATA = MAKE_DDHRESULT(2905),
71 | D3DXERR_LOADEDMESHASNODATA = MAKE_DDHRESULT(2906),
72 | D3DXERR_DUPLICATENAMEDFRAGMENT = MAKE_DDHRESULT(2907),
73 | D3DXERR_CANNOTREMOVELASTITEM = MAKE_DDHRESULT(2908),
74 | };
75 |
76 |
77 | #endif //__D3DX9_H__
78 |
79 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/EffectMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 |
7 | struct Buff;
8 | struct Effect;
9 | struct AgentEffects;
10 |
11 | typedef Array BuffArray;
12 | typedef Array EffectArray;
13 | typedef Array AgentEffectsArray;
14 |
15 | namespace Constants {
16 | enum class SkillID : uint32_t;
17 | }
18 |
19 | struct Module;
20 | extern Module EffectModule;
21 |
22 | namespace Effects {
23 | // Returns current level of intoxication, 0-5 scale.
24 | // If > 0 then skills that benefit from drunk will work.
25 | // Important: requires SetupPostProcessingEffectHook() above.
26 | GWCA_API uint32_t GetAlcoholLevel();
27 |
28 | // Have fun with this ;))))))))))
29 | GWCA_API void GetDrunkAf(uint32_t intensity, uint32_t tint);
30 |
31 | // Get full array of effects and buffs for whole party.
32 | GWCA_API AgentEffectsArray* GetPartyEffectsArray();
33 |
34 | // Get full array of effects and buffs for agent.
35 | GWCA_API AgentEffects* GetAgentEffectsArray(uint32_t agent_id);
36 |
37 | // Get full array of effects and buffs for player
38 | GWCA_API AgentEffects* GetPlayerEffectsArray();
39 |
40 | // Get array of effects on the agent.
41 | GWCA_API EffectArray* GetAgentEffects(uint32_t agent_id);
42 |
43 | // Get array of buffs on the player.
44 | GWCA_API BuffArray* GetAgentBuffs(uint32_t agent_id);
45 |
46 | // Get array of effects on the player.
47 | GWCA_API EffectArray* GetPlayerEffects();
48 |
49 | // Get array of buffs on the player.
50 | GWCA_API BuffArray* GetPlayerBuffs();
51 |
52 | // Drop buffid buff.
53 | GWCA_API bool DropBuff(uint32_t buff_id);
54 |
55 | // Gets effect struct of effect on player with SkillID, returns Effect::Nil() if no match.
56 | GWCA_API Effect * GetPlayerEffectBySkillId(Constants::SkillID skill_id);
57 |
58 | // Gets Buff struct of Buff on player with SkillID, returns Buff::Nil() if no match.
59 | GWCA_API Buff *GetPlayerBuffBySkillId(Constants::SkillID skill_id);
60 | };
61 | }
62 |
--------------------------------------------------------------------------------
/vc/GWCA.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29020.237
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GWCA_example", "Example\GWCA_example.vcxproj", "{D60712B8-DA82-45D7-9D57-3E89C13DDE35}"
7 | ProjectSection(ProjectDependencies) = postProject
8 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38} = {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}
9 | EndProjectSection
10 | EndProject
11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinHook", "MinHook\MinHook.vcxproj", "{AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}"
12 | EndProject
13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GWCA", "GWCA\GWCA.vcxproj", "{B3359F05-68CF-4E7F-B9D6-D106F6D48A38}"
14 | EndProject
15 | Global
16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
17 | Debug|x86 = Debug|x86
18 | Release|x86 = Release|x86
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {D60712B8-DA82-45D7-9D57-3E89C13DDE35}.Debug|x86.ActiveCfg = Debug|Win32
22 | {D60712B8-DA82-45D7-9D57-3E89C13DDE35}.Debug|x86.Build.0 = Debug|Win32
23 | {D60712B8-DA82-45D7-9D57-3E89C13DDE35}.Release|x86.ActiveCfg = Release|Win32
24 | {D60712B8-DA82-45D7-9D57-3E89C13DDE35}.Release|x86.Build.0 = Release|Win32
25 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.ActiveCfg = Debug|Win32
26 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.Build.0 = Debug|Win32
27 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.ActiveCfg = Release|Win32
28 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.Build.0 = Release|Win32
29 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.ActiveCfg = Debug|Win32
30 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.Build.0 = Debug|Win32
31 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.ActiveCfg = Release|Win32
32 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.Build.0 = Release|Win32
33 | EndGlobalSection
34 | GlobalSection(SolutionProperties) = preSolution
35 | HideSolutionNode = FALSE
36 | EndGlobalSection
37 | GlobalSection(ExtensibilityGlobals) = postSolution
38 | SolutionGuid = {0C41D1E0-C29F-4D9E-84C4-7DE400747109}
39 | EndGlobalSection
40 | EndGlobal
41 |
--------------------------------------------------------------------------------
/Include/GWCA/Utilities/Debug.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #define GWCA_ASSERT(expr) ((void)(!!(expr) || (GW::FatalAssert(#expr, __FILE__, (unsigned)__LINE__, __FUNCTION__), 0)))
4 |
5 | #define GWCA_TRACE(fmt, ...) GW::LogMessage(GW::LEVEL_TRACE, __FILE__, (unsigned)__LINE__, __FUNCTION__, fmt, __VA_ARGS__)
6 | #define GWCA_DEBUG(fmt, ...) GW::LogMessage(GW::LEVEL_DEBUG, __FILE__, (unsigned)__LINE__, __FUNCTION__, fmt, __VA_ARGS__)
7 | #define GWCA_INFO(fmt, ...) GW::LogMessage(GW::LEVEL_INFO, __FILE__, (unsigned)__LINE__, __FUNCTION__, fmt, __VA_ARGS__)
8 | #define GWCA_WARN(fmt, ...) GW::LogMessage(GW::LEVEL_WARN, __FILE__, (unsigned)__LINE__, __FUNCTION__, fmt, __VA_ARGS__)
9 | #define GWCA_ERR(fmt, ...) GW::LogMessage(GW::LEVEL_ERR, __FILE__, (unsigned)__LINE__, __FUNCTION__, fmt, __VA_ARGS__)
10 | #define GWCA_CRITICAL(fmt, ...) GW::LogMessage(GW::LEVEL_CRITICAL, __FILE__, (unsigned)__LINE__, __FUNCTION__, fmt, __VA_ARGS__)
11 |
12 | namespace GW
13 | {
14 | enum LogLevel {
15 | LEVEL_TRACE,
16 | LEVEL_DEBUG,
17 | LEVEL_INFO,
18 | LEVEL_WARN,
19 | LEVEL_ERR,
20 | LEVEL_CRITICAL,
21 | };
22 |
23 | typedef void (*LogHandler)(
24 | void *context,
25 | LogLevel level,
26 | const char *msg,
27 | const char *file,
28 | unsigned int line,
29 | const char *function);
30 | void RegisterLogHandler(LogHandler handler, void *context);
31 |
32 | typedef void (*PanicHandler)(
33 | void *context,
34 | const char *expr,
35 | const char *file,
36 | unsigned int line,
37 | const char *function);
38 | void RegisterPanicHandler(PanicHandler handler, void *context);
39 |
40 | __declspec(noreturn) void FatalAssert(
41 | const char *expr,
42 | const char *file,
43 | unsigned int line,
44 | const char *function);
45 |
46 | void __cdecl LogMessage(
47 | LogLevel level,
48 | const char *file,
49 | unsigned int line,
50 | const char *function,
51 | const char *fmt,
52 | ...);
53 |
54 | void __cdecl LogMessageV(
55 | LogLevel level,
56 | const char *file,
57 | unsigned int line,
58 | const char *function,
59 | const char *fmt,
60 | va_list args);
61 | }
62 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/CharContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | struct CharContext;
8 | GWCA_API CharContext* GetCharContext();
9 |
10 | struct ObserverMatch;
11 |
12 | struct ProgressBar {
13 | int pips;
14 | uint8_t color[4]; // RGBA
15 | uint8_t background[4]; // RGBA
16 | int unk[7];
17 | float progress; // 0 ... 1
18 | // possibly more
19 | };
20 |
21 | struct CharContext { // total: 0x42C
22 |
23 | static CharContext* instance();
24 |
25 | /* +h0000 */ Array h0000;
26 | /* +h0010 */ uint32_t h0010;
27 | /* +h0014 */ Array h0014;
28 | /* +h0024 */ uint32_t h0024[4];
29 | /* +h0034 */ Array h0034;
30 | /* +h0044 */ Array h0044;
31 | /* +h0054 */ uint32_t h0054[4]; // load head variables
32 | /* +h0064 */ uint32_t player_uuid[4]; // uuid
33 | /* +h0074 */ wchar_t player_name[0x14];
34 | /* +h009C */ uint32_t h009C[20];
35 | /* +h00EC */ Array h00EC;
36 | /* +h00FC */ uint32_t h00FC[37]; // 40
37 | /* +h0190 */ uint32_t world_flags;
38 | /* +h0194 */ uint32_t token1; // world id
39 | /* +h0198 */ uint32_t map_id;
40 | /* +h019C */ uint32_t is_explorable;
41 | /* +h01A0 */ uint8_t host[0x18];
42 | /* +h01B8 */ uint32_t token2; // player id
43 | /* +h01BC */ uint32_t h01BC[25];
44 | /* +h0220 */ uint32_t district_number;
45 | /* +h0224 */ int language;
46 | /* +h0228 */ uint32_t observe_map_id;
47 | /* +h022C */ uint32_t current_map_id;
48 | /* +h0230 */ uint32_t observe_map_type;
49 | /* +h0234 */ uint32_t current_map_type;
50 | /* +h0238 */ Array observer_matchs;
51 | /* +h0248 */ uint32_t h0248[22];
52 | /* +h02a0 */ uint32_t player_flags; // bitwise something
53 | /* +h02A4 */ uint32_t player_number;
54 | /* +h02A8 */ uint32_t h02A8[40];
55 | /* +h0348 */ ProgressBar *progress_bar; // seems to never be nullptr
56 | /* +h034C */ uint32_t h034C[27];
57 | /* +h03B8 */ wchar_t player_email[0x40];
58 | };
59 | static_assert(sizeof(CharContext) == 0x438, "struct CharContext has incorrect size");
60 | }
61 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/RenderMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | // forward declaration, we don't need to include the full directx header here
6 | struct IDirect3DDevice9;
7 |
8 | namespace GW {
9 |
10 | struct Module;
11 | extern Module RenderModule;
12 |
13 | namespace Render {
14 |
15 | typedef struct Mat4x3f {
16 | float _11;
17 | float _12;
18 | float _13;
19 | float _14;
20 | float _21;
21 | float _22;
22 | float _23;
23 | float _24;
24 | float _31;
25 | float _32;
26 | float _33;
27 | float _34;
28 |
29 |
30 | enum Flags {
31 | Shear = 1 << 3
32 | };
33 |
34 | uint32_t flags;
35 | } Mat4x3f;
36 |
37 | enum Transform : int {
38 | TRANSFORM_PROJECTION_MATRIX = 0,
39 | TRANSFORM_MODEL_MATRIX = 1,
40 | // TODO:
41 | TRANSFORM_COUNT = 5
42 | };
43 |
44 | // Careful, this doesn't return correct values if you have the U mission map, or other things open
45 | // prefer to calculate the transformation matrix yourself using Render::GetFieldOfView()
46 | [[deprecated]] GWCA_API Mat4x3f* GetTransform(Transform transform);
47 |
48 | // this returns the FoV used for rendering
49 | GWCA_API float GetFieldOfView();
50 |
51 | // Set up a callback for drawing on screen.
52 | // Will be called after GW render.
53 | //
54 | // Important: if you use this, you should call GW::Terminate()
55 | // or at least GW::Render::RestoreHooks() from within the callback
56 | GWCA_API void SetRenderCallback(const std::function& callback);
57 |
58 | // Set up a callback for directx device reset
59 | GWCA_API void SetResetCallback(const std::function& callback);
60 |
61 | // Check if gw is in fullscreen
62 | // Note: requires one or both callbacks to be set and called before
63 | // Note: does not update while minimized
64 | // Note: returns -1 if it doesn't know yet
65 | GWCA_API int GetIsFullscreen();
66 |
67 | GWCA_API IDirect3DDevice9* GetDevice();
68 |
69 | GWCA_API bool GetIsInRenderLoop();
70 |
71 | GWCA_API uint32_t GetViewportWidth();
72 | GWCA_API uint32_t GetViewportHeight();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/Dcommon.h:
--------------------------------------------------------------------------------
1 | //+--------------------------------------------------------------------------
2 | //
3 | // Copyright (c) Microsoft Corporation. All rights reserved.
4 | //
5 | // Abstract:
6 | // Public API definitions for DWrite and D2D
7 | //
8 | //----------------------------------------------------------------------------
9 |
10 | #ifndef DCOMMON_H_INCLUDED
11 | #define DCOMMON_H_INCLUDED
12 |
13 | //
14 | //These macros are defined in the Windows 7 SDK, however to enable development using the technical preview,
15 | //they are included here temporarily.
16 | //
17 | #ifndef DEFINE_ENUM_FLAG_OPERATORS
18 | #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
19 | extern "C++" { \
20 | inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) | ((int)b)); } \
21 | inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
22 | inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) & ((int)b)); } \
23 | inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
24 | inline ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((int)a)); } \
25 | inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) ^ ((int)b)); } \
26 | inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
27 | }
28 | #endif
29 |
30 | #ifndef __field_ecount_opt
31 | #define __field_ecount_opt(x)
32 | #endif
33 |
34 | #ifndef __range
35 | #define __range(x,y)
36 | #endif
37 |
38 | #ifndef __field_ecount
39 | #define __field_ecount(x)
40 | #endif
41 |
42 | ///
43 | /// The measuring method used for text layout.
44 | ///
45 | typedef enum DWRITE_MEASURING_MODE
46 | {
47 | ///
48 | /// Text is measured using glyph ideal metrics whose values are independent to the current display resolution.
49 | ///
50 | DWRITE_MEASURING_MODE_NATURAL,
51 |
52 | ///
53 | /// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution.
54 | ///
55 | DWRITE_MEASURING_MODE_GDI_CLASSIC,
56 |
57 | ///
58 | /// Text is measured using the same glyph display metrics as text measured by GDI using a font
59 | /// created with CLEARTYPE_NATURAL_QUALITY.
60 | ///
61 | DWRITE_MEASURING_MODE_GDI_NATURAL
62 |
63 | } DWRITE_MEASURING_MODE;
64 |
65 | #endif /* DCOMMON_H_INCLUDED */
66 |
--------------------------------------------------------------------------------
/Include/GWCA/Context/AgentContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | struct AgentContext;
8 | GWCA_API AgentContext* GetAgentContext();
9 |
10 | struct AgentMovement;
11 |
12 | struct AgentSummaryInfo {
13 | struct AgentSummaryInfoSub {
14 | /* +h0000 */ uint32_t h0000;
15 | /* +h0004 */ uint32_t h0004;
16 | /* +h0008 */ uint32_t gadget_id;
17 | /* +h000C */ uint32_t h000C;
18 | /* +h0010 */ wchar_t * gadget_name_enc;
19 | /* +h0014 */ uint32_t h0014;
20 | /* +h0018 */ uint32_t composite_agent_id; // 0x30000000 | player_id, 0x20000000 | npc_id etc
21 | };
22 |
23 | uint32_t h0000;
24 | uint32_t h0004;
25 | AgentSummaryInfoSub* extra_info_sub;
26 | };
27 |
28 | struct AgentContext {
29 |
30 | static AgentContext* instance();
31 |
32 | /* +h0000 */ Array h0000;
33 | /* +h0010 */ uint32_t h0010[5];
34 | /* +h0024 */ uint32_t h0024; // function
35 | /* +h0028 */ uint32_t h0028[2];
36 | /* +h0030 */ uint32_t h0030; // function
37 | /* +h0034 */ uint32_t h0034[2];
38 | /* +h003C */ uint32_t h003C; // function
39 | /* +h0040 */ uint32_t h0040[2];
40 | /* +h0048 */ uint32_t h0048; // function
41 | /* +h004C */ uint32_t h004C[2];
42 | /* +h0054 */ uint32_t h0054; // function
43 | /* +h0058 */ uint32_t h0058[11];
44 | /* +h0084 */ Array h0084;
45 | /* +h0094 */ uint32_t h0094; // this field and the next array are link together in a structure.
46 | /* +h0098 */ Array agent_summary_info; // elements are of size 12. {ptr, func, ptr}
47 | /* +h00A8 */ Array h00A8;
48 | /* +h00B8 */ Array h00B8;
49 | /* +h00C8 */ uint32_t rand1; // Number seems to be randomized quite a bit o.o seems to be accessed by textparser.cpp
50 | /* +h00CC */ uint32_t rand2;
51 | /* +h00D0 */ uint8_t h00D0[24];
52 | /* +h00E8 */ Array agent_movement;
53 | /* +h00F8 */ Array h00F8;
54 | /* +h0108 */ uint32_t h0108[0x11];
55 | /* +h014C */ Array agent_array1;
56 | /* +h015C */ Array agent_async_movement;
57 | /* +h016C */ uint32_t h016C[0x10];
58 | /* +h01AC */ uint32_t instance_timer;
59 | //... more but meh
60 | };
61 | }
62 |
--------------------------------------------------------------------------------
/Source/GuildMgr.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #include
14 |
15 | namespace GW {
16 |
17 | Module GuildModule{
18 | "GuildModule", // name
19 | NULL, // param
20 | NULL, // init_module
21 | NULL, // exit_module
22 | NULL, // exit_module
23 | NULL, // remove_hooks
24 | };
25 | namespace GuildMgr {
26 | wchar_t* GetPlayerGuildAnnouncer() {
27 | auto* g = GetGuildContext();
28 | return g ? g->announcement_author : nullptr;
29 | }
30 |
31 | wchar_t* GetPlayerGuildAnnouncement() {
32 | auto* g = GetGuildContext();
33 | return g ? g->announcement : nullptr;
34 | }
35 |
36 | uint32_t GetPlayerGuildIndex() {
37 | auto* g = GetGuildContext();
38 | return g ? g->player_guild_index : 0;
39 | }
40 |
41 | GuildArray* GetGuildArray() {
42 | auto* g = GetGuildContext();
43 | return g && g->guilds.valid() ? &g->guilds : nullptr;
44 | }
45 | Guild* GetPlayerGuild() {
46 | return GetGuildInfo(GetPlayerGuildIndex());
47 | }
48 |
49 | Guild* GetCurrentGH() {
50 | AreaInfo* m = Map::GetCurrentMapInfo();
51 | if (!m || m->type != GW::RegionType::GuildHall) return nullptr;
52 | GW::Array* guilds = GW::GuildMgr::GetGuildArray();
53 | if (!guilds) return nullptr;
54 | for (auto* guild : *guilds) {
55 | if (guild) return guild;
56 | }
57 | return nullptr;
58 | }
59 |
60 | Guild* GetGuildInfo(uint32_t guild_id) {
61 | auto* g = GetGuildArray();
62 | return g && guild_id < g->size() ? g->at(guild_id) : nullptr;
63 | }
64 |
65 | bool TravelGH() {
66 | auto* g = GetGuildContext();
67 | return g ? TravelGH(g->player_gh_key) : false;
68 |
69 | }
70 |
71 | bool TravelGH(GHKey key) {
72 | return UI::SendUIMessage(UI::UIMessage::kGuildHall, &key);
73 | }
74 |
75 | bool LeaveGH() {
76 | return UI::SendUIMessage(UI::UIMessage::kLeaveGuildHall);
77 | }
78 | }
79 | } // namespace GW
80 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Guild.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct GHKey { uint32_t k[4]; };
7 | struct GuildPlayer { // total: 0x174/372
8 | /* +h0000 */ void* vtable;
9 | /* +h0004 */ wchar_t *name_ptr; // ptr to invitedname, why? dunno
10 | /* +h0008 */ wchar_t invited_name[20]; // name of character that was invited in
11 | /* +h0030 */ wchar_t current_name[20]; // name of character currently being played
12 | /* +h0058 */ wchar_t inviter_name[20]; // name of character that invited player
13 | /* +h0080 */ uint32_t invite_time; // time in ms from game creation ??
14 | /* +h0084 */ wchar_t promoter_name[20]; // name of player that last modified rank
15 | /* +h00AC */ uint32_t h00AC[12];
16 | /* +h00DC */ uint32_t offline;
17 | /* +h00E0 */ uint32_t member_type;
18 | /* +h00E4 */ uint32_t status;
19 | /* +h00E8 */ uint32_t h00E8[35];
20 | };
21 | static_assert(sizeof(GuildPlayer) == 372, "struct GuildPlayer has incorect size");
22 |
23 | typedef Array GuildRoster;
24 |
25 | struct GuildHistoryEvent { // total: 0x208/520
26 | /* +h0000 */ uint32_t time1; // Guessing one of these is time in ms
27 | /* +h0004 */ uint32_t time2;
28 | /* +h0008 */ wchar_t name[256]; // Name of added/kicked person, then the adder/kicker, they seem to be in the same array
29 | };
30 | static_assert(sizeof(GuildHistoryEvent) == 520, "struct GuildHistoryEvent has incorect size");
31 |
32 | typedef Array GuildHistory;
33 |
34 | struct Guild { // total: 0xAC/172
35 | /* +h0000 */ GHKey key;
36 | /* +h0010 */ uint32_t h0010[5];
37 | /* +h0024 */ uint32_t index; // Same as PlayerGuildIndex
38 | /* +h0028 */ uint32_t rank;
39 | /* +h002C */ uint32_t features;
40 | /* +h0030 */ wchar_t name[32];
41 | /* +h0070 */ uint32_t rating;
42 | /* +h0074 */ uint32_t faction; // 0=kurzick, 1=luxon
43 | /* +h0078 */ uint32_t faction_point;
44 | /* +h007C */ uint32_t qualifier_point;
45 | /* +h0080 */ wchar_t tag[8];
46 | /* +h0090 */ uint32_t cape_bg_color;
47 | /* +h0094 */ uint32_t cape_detail_color;
48 | /* +h0098 */ uint32_t cape_emblem_color;
49 | /* +h009C */ uint32_t cape_shape;
50 | /* +h00A0 */ uint32_t cape_detail;
51 | /* +h00A4 */ uint32_t cape_emblem;
52 | /* +h00A8 */ uint32_t cape_trim;
53 | };
54 | static_assert(sizeof(Guild) == 172, "struct Guild has incorect size");
55 |
56 | typedef Array GuildArray;
57 | }
58 |
--------------------------------------------------------------------------------
/Examples/Pathing/Pathing.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28803.202
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorldInformation", "WorldInformation.vcxproj", "{6EE4C799-B9D5-4606-8973-A071D2564878}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GWCA", "..\..\vc\GWCA.vcxproj", "{B3359F05-68CF-4E7F-B9D6-D106F6D48A38}"
9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinHook", "..\..\vc\MinHook.vcxproj", "{AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|x64 = Debug|x64
15 | Debug|x86 = Debug|x86
16 | Release|x64 = Release|x64
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Debug|x64.ActiveCfg = Debug|Win32
21 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Debug|x86.ActiveCfg = Debug|Win32
22 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Debug|x86.Build.0 = Debug|Win32
23 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Release|x64.ActiveCfg = Release|Win32
24 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Release|x86.ActiveCfg = Release|Win32
25 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Release|x86.Build.0 = Release|Win32
26 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x64.ActiveCfg = Debug|Win32
27 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.ActiveCfg = Debug|Win32
28 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.Build.0 = Debug|Win32
29 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x64.ActiveCfg = Release|Win32
30 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.ActiveCfg = Release|Win32
31 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.Build.0 = Release|Win32
32 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x64.ActiveCfg = Debug|x64
33 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x64.Build.0 = Debug|x64
34 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.ActiveCfg = Debug|Win32
35 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.Build.0 = Debug|Win32
36 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x64.ActiveCfg = Release|x64
37 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x64.Build.0 = Release|x64
38 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.ActiveCfg = Release|Win32
39 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.Build.0 = Release|Win32
40 | EndGlobalSection
41 | GlobalSection(SolutionProperties) = preSolution
42 | HideSolutionNode = FALSE
43 | EndGlobalSection
44 | GlobalSection(ExtensibilityGlobals) = postSolution
45 | SolutionGuid = {C1EAB330-9527-4211-BE41-EC04397F0F44}
46 | EndGlobalSection
47 | EndGlobal
48 |
--------------------------------------------------------------------------------
/Examples/WorldInformation/WorldInformation.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28803.202
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorldInformation", "WorldInformation.vcxproj", "{6EE4C799-B9D5-4606-8973-A071D2564878}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GWCA", "..\..\vc\GWCA.vcxproj", "{B3359F05-68CF-4E7F-B9D6-D106F6D48A38}"
9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinHook", "..\..\vc\MinHook.vcxproj", "{AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|x64 = Debug|x64
15 | Debug|x86 = Debug|x86
16 | Release|x64 = Release|x64
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Debug|x64.ActiveCfg = Debug|Win32
21 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Debug|x86.ActiveCfg = Debug|Win32
22 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Debug|x86.Build.0 = Debug|Win32
23 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Release|x64.ActiveCfg = Release|Win32
24 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Release|x86.ActiveCfg = Release|Win32
25 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Release|x86.Build.0 = Release|Win32
26 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x64.ActiveCfg = Debug|Win32
27 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.ActiveCfg = Debug|Win32
28 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.Build.0 = Debug|Win32
29 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x64.ActiveCfg = Release|Win32
30 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.ActiveCfg = Release|Win32
31 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.Build.0 = Release|Win32
32 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x64.ActiveCfg = Debug|x64
33 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x64.Build.0 = Debug|x64
34 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.ActiveCfg = Debug|Win32
35 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.Build.0 = Debug|Win32
36 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x64.ActiveCfg = Release|x64
37 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x64.Build.0 = Release|x64
38 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.ActiveCfg = Release|Win32
39 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.Build.0 = Release|Win32
40 | EndGlobalSection
41 | GlobalSection(SolutionProperties) = preSolution
42 | HideSolutionNode = FALSE
43 | EndGlobalSection
44 | GlobalSection(ExtensibilityGlobals) = postSolution
45 | SolutionGuid = {C1EAB330-9527-4211-BE41-EC04397F0F44}
46 | EndGlobalSection
47 | EndGlobal
48 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/comdecl.h:
--------------------------------------------------------------------------------
1 | // comdecl.h: Macros to facilitate COM interface and GUID declarations.
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 |
4 | #ifndef _COMDECL_H_
5 | #define _COMDECL_H_
6 |
7 | #ifndef _XBOX
8 | #include // For standard COM interface macros
9 | #else
10 | #pragma warning(push)
11 | #pragma warning(disable:4061)
12 | #include // Required by xobjbase.h
13 | #include // Special definitions for Xbox build
14 | #pragma warning(pop)
15 | #endif
16 |
17 | // The DEFINE_CLSID() and DEFINE_IID() macros defined below allow COM GUIDs to
18 | // be declared and defined in such a way that clients can obtain the GUIDs using
19 | // either the __uuidof() extension or the old-style CLSID_Foo / IID_IFoo names.
20 | // If using the latter approach, the client can also choose whether to get the
21 | // GUID definitions by defining the INITGUID preprocessor constant or by linking
22 | // to a GUID library. This works in either C or C++.
23 |
24 | #ifdef __cplusplus
25 |
26 | #define DECLSPEC_UUID_WRAPPER(x) __declspec(uuid(#x))
27 | #ifdef INITGUID
28 |
29 | #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
30 | class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \
31 | EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_##className = __uuidof(className)
32 |
33 | #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
34 | interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \
35 | EXTERN_C const GUID DECLSPEC_SELECTANY IID_##interfaceName = __uuidof(interfaceName)
36 |
37 | #else // INITGUID
38 |
39 | #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
40 | class DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) className; \
41 | EXTERN_C const GUID CLSID_##className
42 |
43 | #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
44 | interface DECLSPEC_UUID_WRAPPER(l##-##w1##-##w2##-##b1##b2##-##b3##b4##b5##b6##b7##b8) interfaceName; \
45 | EXTERN_C const GUID IID_##interfaceName
46 |
47 | #endif // INITGUID
48 |
49 | #else // __cplusplus
50 |
51 | #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
52 | DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
53 |
54 | #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
55 | DEFINE_GUID(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8)
56 |
57 | #endif // __cplusplus
58 |
59 | #endif // #ifndef _COMDECL_H_
60 |
--------------------------------------------------------------------------------
/Examples/PacketLogger/PacketLogger.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28803.202
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PacketLogger", "PacketLogger.vcxproj", "{5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GWCA", "..\..\vc\GWCA.vcxproj", "{B3359F05-68CF-4E7F-B9D6-D106F6D48A38}"
9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinHook", "..\..\vc\MinHook.vcxproj", "{AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|x64 = Debug|x64
15 | Debug|x86 = Debug|x86
16 | Release|x64 = Release|x64
17 | Release|x86 = Release|x86
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Debug|x64.ActiveCfg = Debug|x64
21 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Debug|x64.Build.0 = Debug|x64
22 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Debug|x86.ActiveCfg = Debug|Win32
23 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Debug|x86.Build.0 = Debug|Win32
24 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Release|x64.ActiveCfg = Release|x64
25 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Release|x64.Build.0 = Release|x64
26 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Release|x86.ActiveCfg = Release|Win32
27 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Release|x86.Build.0 = Release|Win32
28 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x64.ActiveCfg = Debug|Win32
29 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.ActiveCfg = Debug|Win32
30 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.Build.0 = Debug|Win32
31 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x64.ActiveCfg = Release|Win32
32 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.ActiveCfg = Release|Win32
33 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.Build.0 = Release|Win32
34 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x64.ActiveCfg = Debug|x64
35 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x64.Build.0 = Debug|x64
36 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.ActiveCfg = Debug|Win32
37 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.Build.0 = Debug|Win32
38 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x64.ActiveCfg = Release|x64
39 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x64.Build.0 = Release|x64
40 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.ActiveCfg = Release|Win32
41 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.Build.0 = Release|Win32
42 | EndGlobalSection
43 | GlobalSection(SolutionProperties) = preSolution
44 | HideSolutionNode = FALSE
45 | EndGlobalSection
46 | GlobalSection(ExtensibilityGlobals) = postSolution
47 | SolutionGuid = {ECCF57D9-9563-4247-ABE5-829E249DEACF}
48 | EndGlobalSection
49 | EndGlobal
50 |
--------------------------------------------------------------------------------
/Dependencies/minhook/src/hde/hde32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 32
3 | * Copyright (c) 2006-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | * hde32.h: C/C++ header file
7 | *
8 | */
9 |
10 | #ifndef _HDE32_H_
11 | #define _HDE32_H_
12 |
13 | /* stdint.h - C99 standard header
14 | * http://en.wikipedia.org/wiki/stdint.h
15 | *
16 | * if your compiler doesn't contain "stdint.h" header (for
17 | * example, Microsoft Visual C++), you can download file:
18 | * http://www.azillionmonkeys.com/qed/pstdint.h
19 | * and change next line to:
20 | * #include "pstdint.h"
21 | */
22 | #include "pstdint.h"
23 |
24 | #define F_MODRM 0x00000001
25 | #define F_SIB 0x00000002
26 | #define F_IMM8 0x00000004
27 | #define F_IMM16 0x00000008
28 | #define F_IMM32 0x00000010
29 | #define F_DISP8 0x00000020
30 | #define F_DISP16 0x00000040
31 | #define F_DISP32 0x00000080
32 | #define F_RELATIVE 0x00000100
33 | #define F_2IMM16 0x00000800
34 | #define F_ERROR 0x00001000
35 | #define F_ERROR_OPCODE 0x00002000
36 | #define F_ERROR_LENGTH 0x00004000
37 | #define F_ERROR_LOCK 0x00008000
38 | #define F_ERROR_OPERAND 0x00010000
39 | #define F_PREFIX_REPNZ 0x01000000
40 | #define F_PREFIX_REPX 0x02000000
41 | #define F_PREFIX_REP 0x03000000
42 | #define F_PREFIX_66 0x04000000
43 | #define F_PREFIX_67 0x08000000
44 | #define F_PREFIX_LOCK 0x10000000
45 | #define F_PREFIX_SEG 0x20000000
46 | #define F_PREFIX_ANY 0x3f000000
47 |
48 | #define PREFIX_SEGMENT_CS 0x2e
49 | #define PREFIX_SEGMENT_SS 0x36
50 | #define PREFIX_SEGMENT_DS 0x3e
51 | #define PREFIX_SEGMENT_ES 0x26
52 | #define PREFIX_SEGMENT_FS 0x64
53 | #define PREFIX_SEGMENT_GS 0x65
54 | #define PREFIX_LOCK 0xf0
55 | #define PREFIX_REPNZ 0xf2
56 | #define PREFIX_REPX 0xf3
57 | #define PREFIX_OPERAND_SIZE 0x66
58 | #define PREFIX_ADDRESS_SIZE 0x67
59 |
60 | #pragma pack(push,1)
61 |
62 | typedef struct {
63 | uint8_t len;
64 | uint8_t p_rep;
65 | uint8_t p_lock;
66 | uint8_t p_seg;
67 | uint8_t p_66;
68 | uint8_t p_67;
69 | uint8_t opcode;
70 | uint8_t opcode2;
71 | uint8_t modrm;
72 | uint8_t modrm_mod;
73 | uint8_t modrm_reg;
74 | uint8_t modrm_rm;
75 | uint8_t sib;
76 | uint8_t sib_scale;
77 | uint8_t sib_index;
78 | uint8_t sib_base;
79 | union {
80 | uint8_t imm8;
81 | uint16_t imm16;
82 | uint32_t imm32;
83 | } imm;
84 | union {
85 | uint8_t disp8;
86 | uint16_t disp16;
87 | uint32_t disp32;
88 | } disp;
89 | uint32_t flags;
90 | } hde32s;
91 |
92 | #pragma pack(pop)
93 |
94 | #ifdef __cplusplus
95 | extern "C" {
96 | #endif
97 |
98 | /* __cdecl */
99 | unsigned int hde32_disasm(const void *code, hde32s *hs);
100 |
101 | #ifdef __cplusplus
102 | }
103 | #endif
104 |
105 | #endif /* _HDE32_H_ */
106 |
--------------------------------------------------------------------------------
/Source/MemoryPatcher.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | MemoryPatcher::~MemoryPatcher() {
8 | Reset();
9 | }
10 |
11 | void MemoryPatcher::Reset() {
12 | if (GetIsEnable())
13 | TogglePatch(false);
14 |
15 | if (m_patch) {
16 | delete[] m_patch;
17 | m_patch = nullptr;
18 | }
19 | if (m_backup) {
20 | delete[] m_backup;
21 | m_backup = nullptr;
22 | }
23 |
24 | m_addr = nullptr;
25 | m_size = 0;
26 | m_enable = false;
27 | }
28 |
29 | void MemoryPatcher::SetPatch(uintptr_t addr, const char *patch, size_t size) {
30 | GWCA_ASSERT(m_addr == nullptr);
31 |
32 | m_addr = reinterpret_cast(addr);
33 | m_size = size;
34 | m_enable = false;
35 |
36 | m_patch = new uint8_t[size];
37 | m_backup = new uint8_t[size];
38 | memcpy(m_patch, patch, size);
39 |
40 | DWORD old_prot;
41 | VirtualProtect(m_addr, size, PAGE_EXECUTE_READ, &old_prot);
42 | memcpy(m_backup, m_addr, size);
43 | VirtualProtect(m_addr, size, old_prot, &old_prot);
44 | }
45 |
46 | bool MemoryPatcher::SetRedirect(uintptr_t call_instruction_address, void* redirect_func) {
47 | GWCA_ASSERT(m_addr == nullptr);
48 | if (!(call_instruction_address && redirect_func))
49 | return false;
50 | if (((*(uintptr_t*)call_instruction_address) & 0x000000e8) != 0x000000e8
51 | && ((*(uintptr_t*)call_instruction_address) & 0x000000e9) != 0x000000e9)
52 | return false; // Not a near call instruction
53 |
54 | char instruction_type = (char)((*(uintptr_t*)call_instruction_address) & 0x000000ff);
55 | switch (instruction_type) {
56 | case '\xe8': // Near call
57 | case '\xe9': // Jump call
58 | break;
59 | default: // Other instructions not supported
60 | return false;
61 | }
62 | // Figure out the offset from the target address to the destination function
63 | uintptr_t call_offset = ((uintptr_t)redirect_func) - call_instruction_address - 5;
64 | const char patch[5] = { instruction_type, (char)(call_offset), (char)(call_offset >> 8), (char)(call_offset >> 16), (char)(call_offset >> 24) };
65 |
66 | // Go through usual channels to set the patch
67 | SetPatch(call_instruction_address, patch, 5);
68 | return true;
69 | }
70 |
71 | bool MemoryPatcher::TogglePatch(bool flag) {
72 | GWCA_ASSERT(m_addr != nullptr);
73 |
74 | if (m_enable == flag)
75 | return flag;
76 |
77 | DWORD old_prot;
78 | VirtualProtect(m_addr, m_size, PAGE_EXECUTE_READWRITE, &old_prot);
79 | if (flag) {
80 | memcpy(m_addr, m_patch, m_size);
81 | } else {
82 | memcpy(m_addr, m_backup, m_size);
83 | }
84 | VirtualProtect(m_addr, m_size, old_prot, &old_prot);
85 |
86 | m_enable = flag;
87 | return flag;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Dependencies/minhook/src/hde/hde64.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 64
3 | * Copyright (c) 2008-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | * hde64.h: C/C++ header file
7 | *
8 | */
9 |
10 | #ifndef _HDE64_H_
11 | #define _HDE64_H_
12 |
13 | /* stdint.h - C99 standard header
14 | * http://en.wikipedia.org/wiki/stdint.h
15 | *
16 | * if your compiler doesn't contain "stdint.h" header (for
17 | * example, Microsoft Visual C++), you can download file:
18 | * http://www.azillionmonkeys.com/qed/pstdint.h
19 | * and change next line to:
20 | * #include "pstdint.h"
21 | */
22 | #include "pstdint.h"
23 |
24 | #define F_MODRM 0x00000001
25 | #define F_SIB 0x00000002
26 | #define F_IMM8 0x00000004
27 | #define F_IMM16 0x00000008
28 | #define F_IMM32 0x00000010
29 | #define F_IMM64 0x00000020
30 | #define F_DISP8 0x00000040
31 | #define F_DISP16 0x00000080
32 | #define F_DISP32 0x00000100
33 | #define F_RELATIVE 0x00000200
34 | #define F_ERROR 0x00001000
35 | #define F_ERROR_OPCODE 0x00002000
36 | #define F_ERROR_LENGTH 0x00004000
37 | #define F_ERROR_LOCK 0x00008000
38 | #define F_ERROR_OPERAND 0x00010000
39 | #define F_PREFIX_REPNZ 0x01000000
40 | #define F_PREFIX_REPX 0x02000000
41 | #define F_PREFIX_REP 0x03000000
42 | #define F_PREFIX_66 0x04000000
43 | #define F_PREFIX_67 0x08000000
44 | #define F_PREFIX_LOCK 0x10000000
45 | #define F_PREFIX_SEG 0x20000000
46 | #define F_PREFIX_REX 0x40000000
47 | #define F_PREFIX_ANY 0x7f000000
48 |
49 | #define PREFIX_SEGMENT_CS 0x2e
50 | #define PREFIX_SEGMENT_SS 0x36
51 | #define PREFIX_SEGMENT_DS 0x3e
52 | #define PREFIX_SEGMENT_ES 0x26
53 | #define PREFIX_SEGMENT_FS 0x64
54 | #define PREFIX_SEGMENT_GS 0x65
55 | #define PREFIX_LOCK 0xf0
56 | #define PREFIX_REPNZ 0xf2
57 | #define PREFIX_REPX 0xf3
58 | #define PREFIX_OPERAND_SIZE 0x66
59 | #define PREFIX_ADDRESS_SIZE 0x67
60 |
61 | #pragma pack(push,1)
62 |
63 | typedef struct {
64 | uint8_t len;
65 | uint8_t p_rep;
66 | uint8_t p_lock;
67 | uint8_t p_seg;
68 | uint8_t p_66;
69 | uint8_t p_67;
70 | uint8_t rex;
71 | uint8_t rex_w;
72 | uint8_t rex_r;
73 | uint8_t rex_x;
74 | uint8_t rex_b;
75 | uint8_t opcode;
76 | uint8_t opcode2;
77 | uint8_t modrm;
78 | uint8_t modrm_mod;
79 | uint8_t modrm_reg;
80 | uint8_t modrm_rm;
81 | uint8_t sib;
82 | uint8_t sib_scale;
83 | uint8_t sib_index;
84 | uint8_t sib_base;
85 | union {
86 | uint8_t imm8;
87 | uint16_t imm16;
88 | uint32_t imm32;
89 | uint64_t imm64;
90 | } imm;
91 | union {
92 | uint8_t disp8;
93 | uint16_t disp16;
94 | uint32_t disp32;
95 | } disp;
96 | uint32_t flags;
97 | } hde64s;
98 |
99 | #pragma pack(pop)
100 |
101 | #ifdef __cplusplus
102 | extern "C" {
103 | #endif
104 |
105 | /* __cdecl */
106 | unsigned int hde64_disasm(const void *code, hde64s *hs);
107 |
108 | #ifdef __cplusplus
109 | }
110 | #endif
111 |
112 | #endif /* _HDE64_H_ */
113 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Pathing.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | namespace GW {
6 | struct PathingTrapezoid { // total: 0x30/48
7 | /* +h0000 */ uint32_t id;
8 | /* +h0004 */ PathingTrapezoid* adjacent[4];
9 | /* +h0014 */ uint32_t h0014;
10 | /* +h0018 */ float XTL;
11 | /* +h001C */ float XTR;
12 | /* +h0020 */ float YT;
13 | /* +h0024 */ float XBL;
14 | /* +h0028 */ float XBR;
15 | /* +h002C */ float YB;
16 | };
17 | static_assert(sizeof(PathingTrapezoid) == 48, "struct PathingTrapezoid has incorect size");
18 |
19 | struct PathingMap { // total: 0x54/84
20 | /* +h0000 */ uint32_t zplane; // ground plane = UINT_MAX, rest 0 based index
21 | /* +h0004 */ uint32_t h0004;
22 | /* +h0008 */ uint32_t h0008;
23 | /* +h000C */ uint32_t h000C;
24 | /* +h0010 */ uint32_t h0010;
25 | /* +h0014 */ uint32_t h0014;
26 | /* +h0018 */ PathingTrapezoid* trapezoids;
27 | /* +h001C */ uint32_t trapezoid_count;
28 | /* +h0020 */ uint32_t h0020[13];
29 | };
30 | static_assert(sizeof(PathingMap) == 84, "struct PathingMap has incorect size");
31 |
32 | struct PropByType {
33 | uint32_t object_id;
34 | uint32_t prop_index;
35 | };
36 |
37 | struct PropModelInfo {
38 | /* +h0000 */ uint32_t h0000;
39 | /* +h0004 */ uint32_t h0004;
40 | /* +h0008 */ uint32_t h0008;
41 | /* +h000C */ uint32_t h000C;
42 | /* +h0010 */ uint32_t h0010;
43 | /* +h0014 */ uint32_t h0014;
44 | };
45 | static_assert(sizeof(PropModelInfo) == 0x18, "struct PropModelInfo has incorect size");
46 |
47 | struct RecObject {
48 | /* +h0000 */ uint32_t h0000;
49 | /* +h0004 */ uint32_t h0004;
50 | /* +h0008 */ uint32_t accessKey; // This is used by the game to make sure the data from the DAT matches the data in game
51 | // ...
52 | };
53 | static_assert(sizeof(RecObject) == 0xC, "struct RecObject has incorect size");
54 |
55 | struct MapProp { // total: 0x54/84
56 | /* +h0000 */ uint32_t h0000[5];
57 | /* +h0014 */ uint32_t uptime_seconds; // time since spawned
58 | /* +h0018 */ uint32_t h0018;
59 | /* +h001C */ uint32_t prop_index;
60 | /* +h0020 */ Vec2f position;
61 | /* +h0028 */ float z;
62 | /* +h002C */ uint32_t model_file_id;
63 | /* +h0030 */ uint32_t h0030[2];
64 | /* +h0038 */ float rotation_angle;
65 | /* +h003C */ float rotation_cos;
66 | /* +h003C */ float rotation_sin;
67 | /* +h0040 */ uint32_t h0034[5];
68 | /* +h0058 */ RecObject* interactive_model;
69 | /* +h005C */ uint32_t h005C[4];
70 | /* +h006C */ uint32_t appearance_bitmap; // Modified when animation changes
71 | /* +h0070 */ uint32_t animation_bits;
72 | /* +h0064 */ uint32_t h0064[5];
73 | /* +h0088 */ PropByType* prop_object_info;
74 | /* +h008C */ uint32_t h008C;
75 | };
76 |
77 | static_assert(sizeof(MapProp) == 0x90, "struct MapProp has incorect size");
78 |
79 | typedef Array PathingMapArray;
80 | }
81 |
--------------------------------------------------------------------------------
/Examples/Teleport/main.cpp:
--------------------------------------------------------------------------------
1 | #define WIN32_LEAN_AND_MEAN
2 | #include
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | #include
10 |
11 | #include
12 | #include
13 | #include
14 |
15 | // We can forward declare, because we won't use it
16 | struct IDirect3DDevice9;
17 |
18 | static volatile bool running;
19 |
20 | static void CmdTeleport(const wchar_t *msg, int argc, wchar_t **argv)
21 | {
22 | if (argc != 2) {
23 | GW::Chat::WriteChat(GW::Chat::CHANNEL_MODERATOR, L"Teleport: /tp ");
24 | return;
25 | }
26 |
27 | const int MAX_MAP_ID = static_cast(GW::Constants::MapID::Ashford_Catacombs_1070_AE);
28 |
29 | int outpost_id = wcstol(argv[1], nullptr, 0);
30 | if (outpost_id < 0 || MAX_MAP_ID < outpost_id) {
31 | wchar_t buffer[512];
32 | wsprintfW(buffer, L"Teleport: The map id must be between 0 and %d", MAX_MAP_ID);
33 |
34 | GW::Chat::WriteChat(GW::Chat::CHANNEL_MODERATOR, buffer);
35 | return;
36 | }
37 |
38 | GW::Map::Travel(static_cast(outpost_id));
39 | }
40 |
41 | static void GameLoop(IDirect3DDevice9* device)
42 | {
43 | // This is call from within the game thread and all operation should be done here.
44 | // You can't freeze this thread, so no blocking operation or at your own risk.
45 | static bool initialized = false;
46 | if (!initialized) {
47 | GW::Chat::CreateCommand(L"tp", CmdTeleport);
48 | initialized = true;
49 |
50 | GW::Chat::WriteChat(GW::Chat::CHANNEL_MODERATOR, L"Teleport: Initialized");
51 | }
52 |
53 | if (GetAsyncKeyState(VK_END) & 1) {
54 | GW::Chat::WriteChat(GW::Chat::CHANNEL_MODERATOR, L"Teleport: Bye!");
55 | GW::DisableHooks();
56 | running = false;
57 | }
58 | }
59 |
60 | static DWORD WINAPI ThreadProc(LPVOID lpModule)
61 | {
62 | // This is a new thread so you should only initialize GWCA and setup the hook on the game thread.
63 | // When the game thread hook is setup (i.e. SetRenderCallback), you should do the next operations
64 | // on the game from within the game thread.
65 |
66 | HMODULE hModule = static_cast(lpModule);
67 |
68 | GW::Initialize();
69 |
70 | GW::Render::SetRenderCallback(GameLoop);
71 |
72 | running = true;
73 | while (running) {
74 | Sleep(100);
75 | }
76 |
77 | // Hooks are disable from Guild Wars thread (safely), so we just make sure we exit the last hooks
78 | while (GW::HookBase::GetInHookCount())
79 | Sleep(16);
80 |
81 | // We can't guarantee that the code in Guild Wars thread isn't still in the trampoline, but
82 | // practically a short sleep is fine.
83 | Sleep(16);
84 | GW::Terminate();
85 |
86 | FreeLibraryAndExitThread(hModule, EXIT_SUCCESS);
87 | }
88 |
89 | BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved)
90 | {
91 | DisableThreadLibraryCalls(hModule);
92 |
93 | if (dwReason == DLL_PROCESS_ATTACH) {
94 | HANDLE handle = CreateThread(0, 0, ThreadProc, hModule, 0, 0);
95 | CloseHandle(handle);
96 | }
97 |
98 | return TRUE;
99 | }
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Party.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 | typedef uint32_t AgentID;
8 | typedef uint32_t PlayerID;
9 | typedef uint32_t HeroID;
10 | typedef uint32_t Profession;
11 |
12 | struct PlayerPartyMember { // total: 0xC/12
13 | /* +h0000 */ PlayerID login_number;
14 | /* +h0004 */ AgentID calledTargetId;
15 | /* +h0008 */ uint32_t state;
16 |
17 | bool connected() const { return (state & 1) > 0; }
18 | bool ticked() const { return (state & 2) > 0; }
19 | };
20 | static_assert(sizeof(PlayerPartyMember) == 12, "struct PlayerPartyMember has incorect size");
21 |
22 | struct HeroPartyMember { // total: 0x18/24
23 | /* +h0000 */ AgentID agent_id;
24 | /* +h0004 */ PlayerID owner_player_id;
25 | /* +h0008 */ HeroID hero_id;
26 | /* +h000C */ uint32_t h000C;
27 | /* +h0010 */ uint32_t h0010;
28 | /* +h0014 */ uint32_t level;
29 | };
30 | static_assert(sizeof(HeroPartyMember) == 24, "struct HeroPartyMember has incorect size");
31 |
32 | struct HenchmanPartyMember { // total: 0x34/52
33 | /* +h0000 */ AgentID agent_id;
34 | /* +h0004 */ uint32_t h0004[10];
35 | /* +h002C */ Profession profession;
36 | /* +h0030 */ uint32_t level;
37 | };
38 | static_assert(sizeof(HenchmanPartyMember) == 52, "struct HenchmanPartyMember has incorect size");
39 |
40 | typedef Array HeroPartyMemberArray;
41 | typedef Array PlayerPartyMemberArray;
42 | typedef Array HenchmanPartyMemberArray;
43 |
44 | struct PartyInfo { // total: 0x84/132
45 |
46 | size_t GetPartySize() {
47 | return players.size() + henchmen.size() + heroes.size();
48 | }
49 |
50 | /* +h0000 */ uint32_t party_id;
51 | /* +h0004 */ Array players;
52 | /* +h0014 */ Array henchmen;
53 | /* +h0024 */ Array heroes;
54 | /* +h0034 */ Array others; // agent id of allies, minions, pets.
55 | /* +h0044 */ uint32_t h0044[14];
56 | /* +h007C */ TLink invite_link;
57 | };
58 | static_assert(sizeof(PartyInfo) == 132, "struct PartyInfo has incorect size");
59 |
60 | enum PartySearchType {
61 | PartySearchType_Hunting = 0,
62 | PartySearchType_Mission = 1,
63 | PartySearchType_Quest = 2,
64 | PartySearchType_Trade = 3,
65 | PartySearchType_Guild = 4,
66 | };
67 |
68 | struct PartySearch {
69 | /* +h0000 */ uint32_t party_search_id;
70 | /* +h0004 */ uint32_t party_search_type;
71 | /* +h0008 */ uint32_t hardmode;
72 | /* +h000C */ uint32_t district;
73 | /* +h0010 */ uint32_t language;
74 | /* +h0014 */ uint32_t party_size;
75 | /* +h0018 */ uint32_t hero_count;
76 | /* +h001C */ wchar_t message[32];
77 | /* +h005C */ wchar_t party_leader[20];
78 | /* +h0084 */ Profession primary;
79 | /* +h0088 */ Profession secondary;
80 | /* +h008C */ uint32_t level;
81 | /* +h0090 */ uint32_t timestamp;
82 | };
83 | }
84 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/MapMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | namespace GW {
9 |
10 | struct AreaInfo;
11 | struct PathingMap;
12 | struct MissionMapIcon;
13 |
14 | typedef Array PathingMapArray;
15 | typedef Array MissionMapIconArray;
16 |
17 | namespace Constants {
18 | enum class MapID;
19 | enum class District;
20 | enum class InstanceType;
21 | }
22 |
23 | enum class RegionType : uint32_t;
24 | struct MapTypeInstanceInfo {
25 | uint32_t request_instance_map_type; // Used for auth server
26 | bool is_outpost;
27 | RegionType map_region_type;
28 | };
29 | struct Module;
30 | extern Module MapModule;
31 |
32 | namespace Map {
33 | GWCA_API float QueryAltitude(const GamePos& pos, float radius, float& alt, Vec3f* terrain_normal = nullptr);
34 |
35 | GWCA_API bool GetIsMapLoaded();
36 |
37 | // Get current map ID.
38 | GWCA_API Constants::MapID GetMapID();
39 |
40 | // Get current region you are in.
41 | GWCA_API bool GetIsMapUnlocked(Constants::MapID map_id);
42 |
43 | // Get current region you are in.
44 | GWCA_API int GetRegion();
45 |
46 | // Can be used to get the instance type for auth server request
47 | GWCA_API MapTypeInstanceInfo* GetMapTypeInstanceInfo(RegionType map_type);
48 |
49 | // Get current language you are in.
50 | GWCA_API int GetLanguage();
51 |
52 | // Get whether current character is observing a match
53 | GWCA_API bool GetIsObserving();
54 |
55 | // Get the district number you are in.
56 | GWCA_API int GetDistrict();
57 |
58 | // Get time, in ms, since the instance you are residing in has been created.
59 | GWCA_API uint32_t GetInstanceTime();
60 |
61 | // Get the instance type (Outpost, Explorable or Loading)
62 | GWCA_API Constants::InstanceType GetInstanceType();
63 |
64 | // Travel to specified outpost.
65 | GWCA_API bool Travel(Constants::MapID map_id,
66 | int district = 0, int region = 0, int language = 0);
67 | GWCA_API bool Travel(Constants::MapID map_id,
68 | Constants::District district, int district_number = 0);
69 |
70 | // Returns array of icons (res shrines, quarries, traders, etc) on mission map.
71 | // Look at MissionMapIcon struct for more info.
72 | GWCA_API MissionMapIconArray* GetMissionMapIconArray();
73 |
74 | // Returns pointer of collision trapezoid array.
75 | GWCA_API PathingMapArray* GetPathingMap();
76 |
77 | GWCA_API uint32_t GetFoesKilled();
78 | GWCA_API uint32_t GetFoesToKill();
79 |
80 | GWCA_API AreaInfo *GetMapInfo(Constants::MapID map_id = (Constants::MapID)0);
81 |
82 | inline AreaInfo *GetCurrentMapInfo() {
83 | Constants::MapID map_id = GetMapID();
84 | return GetMapInfo(map_id);
85 | }
86 |
87 | GWCA_API bool GetIsInCinematic();
88 | GWCA_API bool SkipCinematic();
89 |
90 | GWCA_API bool EnterChallenge();
91 | GWCA_API bool CancelEnterChallenge();
92 | };
93 | }
94 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/DxErr.h:
--------------------------------------------------------------------------------
1 | /*==========================================================================;
2 | *
3 | *
4 | * File: dxerr.h
5 | * Content: DirectX Error Library Include File
6 | *
7 | ****************************************************************************/
8 |
9 | #ifndef _DXERR_H_
10 | #define _DXERR_H_
11 |
12 | #ifdef __cplusplus
13 | extern "C" {
14 | #endif //__cplusplus
15 |
16 | //
17 | // DXGetErrorString
18 | //
19 | // Desc: Converts a DirectX HRESULT to a string
20 | //
21 | // Args: HRESULT hr Can be any error code from
22 | // XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW
23 | //
24 | // Return: Converted string
25 | //
26 | const char* WINAPI DXGetErrorStringA(__in HRESULT hr);
27 | const WCHAR* WINAPI DXGetErrorStringW(__in HRESULT hr);
28 |
29 | #ifdef UNICODE
30 | #define DXGetErrorString DXGetErrorStringW
31 | #else
32 | #define DXGetErrorString DXGetErrorStringA
33 | #endif
34 |
35 |
36 | //
37 | // DXGetErrorDescription
38 | //
39 | // Desc: Returns a string description of a DirectX HRESULT
40 | //
41 | // Args: HRESULT hr Can be any error code from
42 | // XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW
43 | //
44 | // Return: String description
45 | //
46 | const char* WINAPI DXGetErrorDescriptionA(__in HRESULT hr);
47 | const WCHAR* WINAPI DXGetErrorDescriptionW(__in HRESULT hr);
48 |
49 | #ifdef UNICODE
50 | #define DXGetErrorDescription DXGetErrorDescriptionW
51 | #else
52 | #define DXGetErrorDescription DXGetErrorDescriptionA
53 | #endif
54 |
55 |
56 | //
57 | // DXTrace
58 | //
59 | // Desc: Outputs a formatted error message to the debug stream
60 | //
61 | // Args: CHAR* strFile The current file, typically passed in using the
62 | // __FILE__ macro.
63 | // DWORD dwLine The current line number, typically passed in using the
64 | // __LINE__ macro.
65 | // HRESULT hr An HRESULT that will be traced to the debug stream.
66 | // CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
67 | // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
68 | //
69 | // Return: The hr that was passed in.
70 | //
71 | HRESULT WINAPI DXTraceA( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const char* strMsg, __in BOOL bPopMsgBox );
72 | HRESULT WINAPI DXTraceW( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const WCHAR* strMsg, __in BOOL bPopMsgBox );
73 |
74 | #ifdef UNICODE
75 | #define DXTrace DXTraceW
76 | #else
77 | #define DXTrace DXTraceA
78 | #endif
79 |
80 |
81 | //
82 | // Helper macros
83 | //
84 | #if defined(DEBUG) | defined(_DEBUG)
85 | #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
86 | #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
87 | #define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
88 | #else
89 | #define DXTRACE_MSG(str) (0L)
90 | #define DXTRACE_ERR(str,hr) (hr)
91 | #define DXTRACE_ERR_MSGBOX(str,hr) (hr)
92 | #endif
93 |
94 |
95 | #ifdef __cplusplus
96 | }
97 | #endif //__cplusplus
98 |
99 | #endif // _DXERR_H_
100 |
--------------------------------------------------------------------------------
/Examples/Examples.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.3.32922.545
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PacketLogger", "PacketLogger\PacketLogger.vcxproj", "{5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Teleport", "Teleport\Teleport.vcxproj", "{8B852BC5-203D-4894-B95B-F7CAB774B6C1}"
9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorldInformation", "WorldInformation\WorldInformation.vcxproj", "{6EE4C799-B9D5-4606-8973-A071D2564878}"
11 | EndProject
12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GWCA", "..\vc\GWCA.vcxproj", "{B3359F05-68CF-4E7F-B9D6-D106F6D48A38}"
13 | EndProject
14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinHook", "..\vc\MinHook.vcxproj", "{AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}"
15 | EndProject
16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GwArmory", "GwArmory\GwArmory.vcxproj", "{4493B33B-F48E-40BB-85D1-C01116715C6E}"
17 | EndProject
18 | Global
19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
20 | Debug|x86 = Debug|x86
21 | Release|x86 = Release|x86
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Debug|x86.ActiveCfg = Debug|Win32
25 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Debug|x86.Build.0 = Debug|Win32
26 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Release|x86.ActiveCfg = Release|Win32
27 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}.Release|x86.Build.0 = Release|Win32
28 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}.Debug|x86.ActiveCfg = Debug|Win32
29 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}.Debug|x86.Build.0 = Debug|Win32
30 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}.Release|x86.ActiveCfg = Release|Win32
31 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}.Release|x86.Build.0 = Release|Win32
32 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Debug|x86.ActiveCfg = Debug|Win32
33 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Debug|x86.Build.0 = Debug|Win32
34 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Release|x86.ActiveCfg = Release|Win32
35 | {6EE4C799-B9D5-4606-8973-A071D2564878}.Release|x86.Build.0 = Release|Win32
36 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.ActiveCfg = Debug|Win32
37 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Debug|x86.Build.0 = Debug|Win32
38 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.ActiveCfg = Release|Win32
39 | {B3359F05-68CF-4E7F-B9D6-D106F6D48A38}.Release|x86.Build.0 = Release|Win32
40 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.ActiveCfg = Debug|Win32
41 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Debug|x86.Build.0 = Debug|Win32
42 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.ActiveCfg = Release|Win32
43 | {AC820BBA-BB5B-4D8C-96FF-EA8138CEED52}.Release|x86.Build.0 = Release|Win32
44 | {4493B33B-F48E-40BB-85D1-C01116715C6E}.Debug|x86.ActiveCfg = Debug|Win32
45 | {4493B33B-F48E-40BB-85D1-C01116715C6E}.Debug|x86.Build.0 = Debug|Win32
46 | {4493B33B-F48E-40BB-85D1-C01116715C6E}.Release|x86.ActiveCfg = Release|Win32
47 | {4493B33B-F48E-40BB-85D1-C01116715C6E}.Release|x86.Build.0 = Release|Win32
48 | EndGlobalSection
49 | GlobalSection(SolutionProperties) = preSolution
50 | HideSolutionNode = FALSE
51 | EndGlobalSection
52 | GlobalSection(ExtensibilityGlobals) = postSolution
53 | SolutionGuid = {5A2B60CC-CD42-4914-A64C-778CA61AC8E9}
54 | EndGlobalSection
55 | EndGlobal
56 |
--------------------------------------------------------------------------------
/Include/GWCA/GameEntities/Camera.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct Camera {
7 | /* +h0000 */ uint32_t look_at_agent_id;
8 | /* +h0004 */ uint32_t h0004;
9 | /* +h0008 */ float h0008;
10 | /* +h000C */ float h000C;
11 | /* +h0010 */ float max_distance;
12 | /* +h0014 */ float h0014;
13 | /* +h0018 */ float yaw; // left/right camera angle, radians w/ origin @ east
14 | /* +h001C */ float pitch; // up/down camera angle, range of [-1,1]
15 | /* +h0020 */ float distance; // current distance from players head.
16 | /* +h0024 */ uint32_t h0024[4];
17 | /* +h0034 */ float yaw_right_click;
18 | /* +h0038 */ float yaw_right_click2;
19 | /* +h003C */ float pitch_right_click;
20 | /* +h0040 */ float distance2;
21 | /* +h0044 */ float acceleration_constant;
22 | /* +h0048 */ float time_since_last_keyboard_rotation; // In seconds it seems.
23 | /* +h004C */ float time_since_last_mouse_rotation;
24 | /* +h0050 */ float time_since_last_mouse_move;
25 | /* +h0054 */ float time_since_last_agent_selection;
26 | /* +h0058 */ float time_in_the_map;
27 | /* +h005C */ float time_in_the_district;
28 | /* +h0060 */ float yaw_to_go;
29 | /* +h0064 */ float pitch_to_go;
30 | /* +h0068 */ float dist_to_go;
31 | /* +h006C */ float max_distance2;
32 | /* +h0070 */ float h0070[2];
33 | /* +h0078 */ Vec3f position;
34 | /* +h0084 */ Vec3f camera_pos_to_go;
35 | /* +h0090 */ Vec3f cam_pos_inverted;
36 | /* +h009C */ Vec3f cam_pos_inverted_to_go;
37 | /* +h00A8 */ Vec3f look_at_target;
38 | /* +h00B4 */ Vec3f look_at_to_go;
39 | /* +h00C0 */ float field_of_view;
40 | /* +h00C4 */ float field_of_view2;
41 | // ...
42 |
43 | float GetYaw() const { return yaw; }
44 | float GetPitch() const { return pitch; }
45 |
46 | /// \brief This is not the FoV that GW uses to render
47 | /// see GW::Render::GetFieldOfView()
48 | float GetFieldOfView() const { return field_of_view; }
49 |
50 | void SetYaw(float _yaw) {
51 | yaw_to_go = _yaw;
52 | yaw = _yaw;
53 | }
54 | float GetCurrentYaw() const
55 | {
56 | const Vec3f dir = position - look_at_target;
57 | const float curtan = atan2(dir.y, dir.x);
58 | constexpr float pi = 3.141592741f;
59 | float curyaw;
60 | if (curtan >= 0) {
61 | curyaw = curtan - pi;
62 | }
63 | else {
64 | curyaw = curtan + pi;
65 | }
66 | return curyaw;
67 | }
68 |
69 | void SetPitch(float _pitch) {
70 | pitch_to_go = _pitch;
71 | }
72 |
73 | float GetCameraZoom() const { return distance; }
74 | Vec3f GetLookAtTarget() const { return look_at_target; }
75 | Vec3f GetCameraPosition() const { return position; }
76 |
77 | void SetCameraPos(Vec3f newPos) {
78 | this->position.x = newPos.x;
79 | this->position.y = newPos.y;
80 | this->position.z = newPos.z;
81 | }
82 |
83 | void SetLookAtTarget(Vec3f newPos) {
84 | this->look_at_target.x = newPos.x;
85 | this->look_at_target.y = newPos.y;
86 | this->look_at_target.z = newPos.z;
87 | }
88 | };
89 | }
90 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/StoCMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | namespace GW {
7 |
8 | /*
9 | StoC Manager
10 | See https://github.com/GameRevision/GWLP-R/wiki/GStoC for some already explored packets.
11 | */
12 |
13 | namespace Packet {
14 | namespace StoC {
15 | struct PacketBase;
16 |
17 | template
18 | struct Packet;
19 | }
20 | }
21 |
22 | struct Module;
23 | extern Module StoCModule;
24 |
25 | namespace StoC {
26 | typedef HookCallback PacketCallback;
27 | // Register a function to be called when a packet is received.
28 | // An altitude of 0 or less will be triggered before the packet is processed.
29 | // An altitude greater than 0 will be triggered after the packet has been processed.
30 | GWCA_API bool RegisterPacketCallback(
31 | HookEntry *entry,
32 | uint32_t header,
33 | const PacketCallback& callback,
34 | int altitude = -0x8000);
35 |
36 | // @Deprecated: use RegisterPacketCallback with a positive altitude instead.
37 | GWCA_API bool RegisterPostPacketCallback(
38 | HookEntry* entry,
39 | uint32_t header,
40 | const PacketCallback& callback);
41 |
42 | /* Use this to add handlers to the stocmgr, primary function. */
43 | template
44 | bool RegisterPacketCallback(HookEntry *entry, const HookCallback& handler, int altitude = -0x8000) {
45 | uint32_t header = Packet::StoC::Packet::STATIC_HEADER;
46 | return RegisterPacketCallback(entry, header,
47 | [handler](HookStatus *status, Packet::StoC::PacketBase *pak) -> void {
48 | return handler(status, static_cast(pak));
49 | }, altitude);
50 | }
51 |
52 |
53 | // @Deprecated: use RegisterPacketCallback with a positive altitude instead.
54 | template
55 | bool RegisterPostPacketCallback(HookEntry* entry, const HookCallback& handler) {
56 | uint32_t header = Packet::StoC::Packet::STATIC_HEADER;
57 | return RegisterPostPacketCallback(entry, header,
58 | [handler](HookStatus* status, Packet::StoC::PacketBase* pak) -> void {
59 | return handler(status, static_cast(pak));
60 | });
61 | }
62 |
63 | GWCA_API void RemoveCallback(uint32_t header, HookEntry *entry);
64 |
65 | template
66 | void RemoveCallback(HookEntry* entry) {
67 | uint32_t header = Packet::StoC::Packet::STATIC_HEADER;
68 | RemoveCallback(header, entry);
69 | }
70 |
71 | // @Deprecated: use RegisterPacketCallback with a positive altitude instead.
72 | GWCA_API void RemovePostCallback(uint32_t header, HookEntry* entry);
73 |
74 | template
75 | void RemovePostCallback(HookEntry* entry) {
76 | uint32_t header = Packet::StoC::Packet::STATIC_HEADER;
77 | RemovePostCallback(header, entry);
78 | }
79 |
80 | GWCA_API bool EmulatePacket(Packet::StoC::PacketBase *packet);
81 |
82 | template
83 | bool EmulatePacket(Packet::StoC::Packet *packet) {
84 | packet->header = Packet::StoC::Packet::STATIC_HEADER;
85 | return EmulatePacket((Packet::StoC::PacketBase *)packet);
86 | }
87 | };
88 | }
89 |
--------------------------------------------------------------------------------
/Dependencies/minhook/src/hde/table32.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 32 C
3 | * Copyright (c) 2008-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | */
7 |
8 | #define C_NONE 0x00
9 | #define C_MODRM 0x01
10 | #define C_IMM8 0x02
11 | #define C_IMM16 0x04
12 | #define C_IMM_P66 0x10
13 | #define C_REL8 0x20
14 | #define C_REL32 0x40
15 | #define C_GROUP 0x80
16 | #define C_ERROR 0xff
17 |
18 | #define PRE_ANY 0x00
19 | #define PRE_NONE 0x01
20 | #define PRE_F2 0x02
21 | #define PRE_F3 0x04
22 | #define PRE_66 0x08
23 | #define PRE_67 0x10
24 | #define PRE_LOCK 0x20
25 | #define PRE_SEG 0x40
26 | #define PRE_ALL 0xff
27 |
28 | #define DELTA_OPCODES 0x4a
29 | #define DELTA_FPU_REG 0xf1
30 | #define DELTA_FPU_MODRM 0xf8
31 | #define DELTA_PREFIXES 0x130
32 | #define DELTA_OP_LOCK_OK 0x1a1
33 | #define DELTA_OP2_LOCK_OK 0x1b9
34 | #define DELTA_OP_ONLY_MEM 0x1cb
35 | #define DELTA_OP2_ONLY_MEM 0x1da
36 |
37 | unsigned char hde32_table[] = {
38 | 0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,
39 | 0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xac,0xaa,0xb2,0xaa,0x9f,0x9f,
40 | 0x9f,0x9f,0xb5,0xa3,0xa3,0xa4,0xaa,0xaa,0xba,0xaa,0x96,0xaa,0xa8,0xaa,0xc3,
41 | 0xc3,0x96,0x96,0xb7,0xae,0xd6,0xbd,0xa3,0xc5,0xa3,0xa3,0x9f,0xc3,0x9c,0xaa,
42 | 0xaa,0xac,0xaa,0xbf,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0x90,
43 | 0x82,0x7d,0x97,0x59,0x59,0x59,0x59,0x59,0x7f,0x59,0x59,0x60,0x7d,0x7f,0x7f,
44 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x9a,0x88,0x7d,
45 | 0x59,0x50,0x50,0x50,0x50,0x59,0x59,0x59,0x59,0x61,0x94,0x61,0x9e,0x59,0x59,
46 | 0x85,0x59,0x92,0xa3,0x60,0x60,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,
47 | 0x59,0x59,0x9f,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xcc,0x01,0xbc,0x03,0xf0,
48 | 0x10,0x10,0x10,0x10,0x50,0x50,0x50,0x50,0x14,0x20,0x20,0x20,0x20,0x01,0x01,
49 | 0x01,0x01,0xc4,0x02,0x10,0x00,0x00,0x00,0x00,0x01,0x01,0xc0,0xc2,0x10,0x11,
50 | 0x02,0x03,0x11,0x03,0x03,0x04,0x00,0x00,0x14,0x00,0x02,0x00,0x00,0xc6,0xc8,
51 | 0x02,0x02,0x02,0x02,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xca,
52 | 0x01,0x01,0x01,0x00,0x06,0x00,0x04,0x00,0xc0,0xc2,0x01,0x01,0x03,0x01,0xff,
53 | 0xff,0x01,0x00,0x03,0xc4,0xc4,0xc6,0x03,0x01,0x01,0x01,0xff,0x03,0x03,0x03,
54 | 0xc8,0x40,0x00,0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00,
55 | 0x00,0x00,0x00,0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00,
56 | 0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
57 | 0x00,0xff,0xff,0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
58 | 0x7f,0x00,0x00,0xff,0x4a,0x4a,0x4a,0x4a,0x4b,0x52,0x4a,0x4a,0x4a,0x4a,0x4f,
59 | 0x4c,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x55,0x45,0x40,0x4a,0x4a,0x4a,
60 | 0x45,0x59,0x4d,0x46,0x4a,0x5d,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,
61 | 0x4a,0x4a,0x4a,0x4a,0x4a,0x61,0x63,0x67,0x4e,0x4a,0x4a,0x6b,0x6d,0x4a,0x4a,
62 | 0x45,0x6d,0x4a,0x4a,0x44,0x45,0x4a,0x4a,0x00,0x00,0x00,0x02,0x0d,0x06,0x06,
63 | 0x06,0x06,0x0e,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x00,0x06,0x06,0x02,0x06,
64 | 0x00,0x0a,0x0a,0x07,0x07,0x06,0x02,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04,
65 | 0x04,0x04,0x00,0x00,0x00,0x0e,0x05,0x06,0x06,0x06,0x01,0x06,0x00,0x00,0x08,
66 | 0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01,
67 | 0x86,0x00,0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba,
68 | 0xf8,0xbb,0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00,
69 | 0xc4,0xff,0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00,
70 | 0x13,0x09,0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07,
71 | 0xb2,0xff,0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,
72 | 0xe7,0x08,0x00,0xf0,0x02,0x00
73 | };
74 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/D2DBaseTypes.h:
--------------------------------------------------------------------------------
1 | //---------------------------------------------------------------------------
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | //
4 | // This file is automatically generated. Please do not edit it directly.
5 | //
6 | // File name: D2DBaseTypes.h
7 | //---------------------------------------------------------------------------
8 | #pragma once
9 |
10 |
11 | #ifndef _D2DBASETYPES_INCLUDED
12 | #define _D2DBASETYPES_INCLUDED
13 |
14 | #ifndef COM_NO_WINDOWS_H
15 | #include
16 | #endif // #ifndef COM_NO_WINDOWS_H
17 |
18 | #ifndef D3DCOLORVALUE_DEFINED
19 |
20 | //+-----------------------------------------------------------------------------
21 | //
22 | // Struct:
23 | // D3DCOLORVALUE
24 | //
25 | //------------------------------------------------------------------------------
26 | typedef struct D3DCOLORVALUE
27 | {
28 | FLOAT r;
29 | FLOAT g;
30 | FLOAT b;
31 | FLOAT a;
32 |
33 | } D3DCOLORVALUE;
34 |
35 | #define D3DCOLORVALUE_DEFINED
36 | #endif
37 |
38 |
39 | //+-----------------------------------------------------------------------------
40 | //
41 | // Struct:
42 | // D2D_POINT_2U
43 | //
44 | //------------------------------------------------------------------------------
45 | typedef struct D2D_POINT_2U
46 | {
47 | UINT32 x;
48 | UINT32 y;
49 |
50 | } D2D_POINT_2U;
51 |
52 |
53 | //+-----------------------------------------------------------------------------
54 | //
55 | // Struct:
56 | // D2D_POINT_2F
57 | //
58 | //------------------------------------------------------------------------------
59 | typedef struct D2D_POINT_2F
60 | {
61 | FLOAT x;
62 | FLOAT y;
63 |
64 | } D2D_POINT_2F;
65 |
66 |
67 | //+-----------------------------------------------------------------------------
68 | //
69 | // Struct:
70 | // D2D_RECT_F
71 | //
72 | //------------------------------------------------------------------------------
73 | typedef struct D2D_RECT_F
74 | {
75 | FLOAT left;
76 | FLOAT top;
77 | FLOAT right;
78 | FLOAT bottom;
79 |
80 | } D2D_RECT_F;
81 |
82 |
83 | //+-----------------------------------------------------------------------------
84 | //
85 | // Struct:
86 | // D2D_RECT_U
87 | //
88 | //------------------------------------------------------------------------------
89 | typedef struct D2D_RECT_U
90 | {
91 | UINT32 left;
92 | UINT32 top;
93 | UINT32 right;
94 | UINT32 bottom;
95 |
96 | } D2D_RECT_U;
97 |
98 |
99 | //+-----------------------------------------------------------------------------
100 | //
101 | // Struct:
102 | // D2D_SIZE_F
103 | //
104 | //------------------------------------------------------------------------------
105 | typedef struct D2D_SIZE_F
106 | {
107 | FLOAT width;
108 | FLOAT height;
109 |
110 | } D2D_SIZE_F;
111 |
112 |
113 | //+-----------------------------------------------------------------------------
114 | //
115 | // Struct:
116 | // D2D_SIZE_U
117 | //
118 | //------------------------------------------------------------------------------
119 | typedef struct D2D_SIZE_U
120 | {
121 | UINT32 width;
122 | UINT32 height;
123 |
124 | } D2D_SIZE_U;
125 |
126 | typedef D3DCOLORVALUE D2D_COLOR_F;
127 |
128 | //+-----------------------------------------------------------------------------
129 | //
130 | // Struct:
131 | // D2D_MATRIX_3X2_F
132 | //
133 | //------------------------------------------------------------------------------
134 | typedef struct D2D_MATRIX_3X2_F
135 | {
136 | FLOAT _11;
137 | FLOAT _12;
138 | FLOAT _21;
139 | FLOAT _22;
140 | FLOAT _31;
141 | FLOAT _32;
142 |
143 | } D2D_MATRIX_3X2_F;
144 |
145 | #endif // #ifndef _D2DBASETYPES_INCLUDED
146 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/SkillbarMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | namespace GW {
8 |
9 | namespace Constants {
10 | enum class SkillID : uint32_t;
11 | enum class Attribute : uint32_t;
12 | enum class Profession;
13 | }
14 |
15 | struct Skill;
16 | struct AttributeInfo;
17 | struct Skillbar;
18 |
19 | typedef Array SkillbarArray;
20 |
21 | struct Module;
22 | extern Module SkillbarModule;
23 |
24 | namespace SkillbarMgr {
25 | struct Attribute {
26 | Constants::Attribute attribute;
27 | uint32_t points;
28 | };
29 |
30 | struct SkillTemplate {
31 | Constants::Profession primary;
32 | Constants::Profession secondary;
33 | Constants::SkillID skills[8];
34 | Attribute attributes[16];
35 | };
36 |
37 | // Get the skill slot in the player bar of the player.
38 | // Returns -1 if the skill is not there
39 | GWCA_API int GetSkillSlot(Constants::SkillID skill_id);
40 |
41 | // Use Skill in slot (Slot) on (Agent), optionally call that you are using said skill.
42 | GWCA_API bool UseSkill(uint32_t slot, uint32_t target = 0, uint32_t call_target = 0);
43 |
44 | // Send raw packet to use skill with ID (SkillID).
45 | // Same as above except the skillbar client struct will not be registered as casting.
46 | GWCA_API bool UseSkillByID(uint32_t skill_id, uint32_t target = 0, uint32_t call_target = 0);
47 |
48 | // Get skill structure of said id, houses pretty much everything you would want to know about the skill.
49 | GWCA_API Skill* GetSkillConstantData(Constants::SkillID skill_id);
50 |
51 | // Name/Description/Profession etc for an attribute by id
52 | GWCA_API AttributeInfo* GetAttributeConstantData(Constants::Attribute attribute_id);
53 |
54 | GWCA_API bool ChangeSecondProfession(Constants::Profession profession, uint32_t hero_index = 0);
55 |
56 | // Get array of skillbars, [0] = player [1-7] = heroes.
57 | GWCA_API SkillbarArray* GetSkillbarArray();
58 | GWCA_API Skillbar *GetPlayerSkillbar();
59 | GWCA_API Skill* GetHoveredSkill();
60 |
61 | // Whether this skill is unlocked at account level, not necessarily learnt by the current character
62 | GWCA_API bool GetIsSkillUnlocked(Constants::SkillID skill_id);
63 | // Whether the current character has learnt this skill
64 | GWCA_API bool GetIsSkillLearnt(Constants::SkillID skill_id);
65 |
66 | GWCA_API bool DecodeSkillTemplate(SkillTemplate *result, const char *temp);
67 | GWCA_API bool EncodeSkillTemplate(const SkillTemplate& in, char* result, size_t result_len);
68 |
69 | // @Remark:
70 | // `skill_ids` must contains at least 8 elements
71 | GWCA_API bool LoadSkillbar(Constants::SkillID *skills, size_t n_skills, uint32_t hero_index = 0);
72 |
73 | GWCA_API bool LoadSkillTemplate(const char *temp);
74 | GWCA_API bool LoadSkillTemplate(const char *temp, uint32_t hero_index);
75 |
76 | GWCA_API bool SetAttributes(uint32_t attribute_count,
77 | uint32_t *attribute_ids, uint32_t *attribute_values, uint32_t hero_index = 0);
78 | GWCA_API bool SetAttributes(Attribute *attributes, size_t n_attributes, uint32_t hero_index = 0);
79 |
80 | typedef HookCallback UseSkillCallback;
81 | GWCA_API void RegisterUseSkillCallback(
82 | HookEntry* entry,
83 | const UseSkillCallback& callback);
84 |
85 | GWCA_API void RemoveUseSkillCallback(
86 | HookEntry* entry);
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Include/GWCA/Managers/PartyMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace GW {
6 | struct GamePos;
7 | struct PartyInfo;
8 | struct PetInfo;
9 |
10 | struct Attribute;
11 | enum class HeroBehavior : uint32_t;
12 |
13 | typedef uint32_t AgentID;
14 |
15 | struct Module;
16 | extern Module PartyModule;
17 |
18 | namespace PartyMgr {
19 |
20 | // set or unset the fact that ticking will work as a toggle instead
21 | // of showing a drop-down menu
22 |
23 | GWCA_API void SetTickToggle(bool enable);
24 |
25 | // Set party ready status.
26 | GWCA_API bool Tick(bool flag = true);
27 |
28 | GWCA_API Attribute* GetAgentAttributes(uint32_t agent_id);
29 |
30 | GWCA_API PartyInfo *GetPartyInfo(uint32_t party_id = 0);
31 |
32 | GWCA_API uint32_t GetPartySize();
33 | GWCA_API uint32_t GetPartyPlayerCount();
34 | GWCA_API uint32_t GetPartyHeroCount();
35 | GWCA_API uint32_t GetPartyHenchmanCount();
36 |
37 | GWCA_API bool GetIsPartyDefeated();
38 |
39 | GWCA_API bool SetHardMode(bool flag);
40 |
41 | // When defeated, tell the client to return to outpost.
42 | GWCA_API bool ReturnToOutpost();
43 |
44 | GWCA_API bool GetIsPartyInHardMode();
45 |
46 | GWCA_API bool GetIsHardModeUnlocked();
47 |
48 | // check if the whole party is ticked
49 | GWCA_API bool GetIsPartyTicked();
50 |
51 | // check if selected party member is ticked
52 | GWCA_API bool GetIsPlayerTicked(uint32_t player_index = -1);
53 |
54 | // check if the whole party is loaded
55 | GWCA_API bool GetIsPartyLoaded();
56 |
57 | // returns if the player agent is leader
58 | GWCA_API bool GetIsLeader();
59 |
60 | // Accept or reject a party invitation via party window
61 | GWCA_API bool RespondToPartyRequest(uint32_t party_id, bool accept);
62 |
63 | GWCA_API bool LeaveParty();
64 |
65 | // hero managment
66 | GWCA_API bool AddHero(uint32_t heroid);
67 | GWCA_API bool KickHero(uint32_t heroid);
68 | GWCA_API bool KickAllHeroes();
69 | GWCA_API bool AddHenchman(uint32_t agent_id);
70 | GWCA_API bool KickHenchman(uint32_t agent_id);
71 | GWCA_API bool InvitePlayer(uint32_t player_id);
72 | GWCA_API bool InvitePlayer(wchar_t* player_name);
73 | GWCA_API bool KickPlayer(uint32_t player_id);
74 |
75 | // hero flagging
76 | GWCA_API bool FlagHero(uint32_t hero_index, GamePos pos);
77 | GWCA_API bool FlagHeroAgent(AgentID agent_id, GamePos pos);
78 | GWCA_API bool UnflagHero(uint32_t hero_index);
79 |
80 | GWCA_API bool FlagAll(GamePos pos);
81 | GWCA_API bool UnflagAll();
82 | GWCA_API bool SetHeroBehavior(uint32_t agent_id, HeroBehavior behavior);
83 | // Set pet behavior. Pass an agent_id as the second argument when in fight mode, otherwise will use current target
84 | GWCA_API bool SetPetBehavior(HeroBehavior behavior,uint32_t lock_target_id = 0);
85 |
86 | GWCA_API PetInfo* GetPetInfo(uint32_t owner_agent_id = 0);
87 |
88 | GWCA_API uint32_t GetHeroAgentID(uint32_t hero_index);
89 | GWCA_API uint32_t GetAgentHeroID(uint32_t agent_id);
90 |
91 |
92 | // Advertise your party in party search window
93 | GWCA_API bool SearchParty(uint32_t search_type, const wchar_t* advertisement = nullptr);
94 | // Cancel party advertisement
95 | GWCA_API bool SearchPartyCancel();
96 | // Accept or reject a party invitation via party search window
97 | GWCA_API bool SearchPartyReply(bool accept);
98 | };
99 | }
100 |
--------------------------------------------------------------------------------
/Dependencies/minhook/src/hde/table64.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Hacker Disassembler Engine 64 C
3 | * Copyright (c) 2008-2009, Vyacheslav Patkov.
4 | * All rights reserved.
5 | *
6 | */
7 |
8 | #define C_NONE 0x00
9 | #define C_MODRM 0x01
10 | #define C_IMM8 0x02
11 | #define C_IMM16 0x04
12 | #define C_IMM_P66 0x10
13 | #define C_REL8 0x20
14 | #define C_REL32 0x40
15 | #define C_GROUP 0x80
16 | #define C_ERROR 0xff
17 |
18 | #define PRE_ANY 0x00
19 | #define PRE_NONE 0x01
20 | #define PRE_F2 0x02
21 | #define PRE_F3 0x04
22 | #define PRE_66 0x08
23 | #define PRE_67 0x10
24 | #define PRE_LOCK 0x20
25 | #define PRE_SEG 0x40
26 | #define PRE_ALL 0xff
27 |
28 | #define DELTA_OPCODES 0x4a
29 | #define DELTA_FPU_REG 0xfd
30 | #define DELTA_FPU_MODRM 0x104
31 | #define DELTA_PREFIXES 0x13c
32 | #define DELTA_OP_LOCK_OK 0x1ae
33 | #define DELTA_OP2_LOCK_OK 0x1c6
34 | #define DELTA_OP_ONLY_MEM 0x1d8
35 | #define DELTA_OP2_ONLY_MEM 0x1e7
36 |
37 | unsigned char hde64_table[] = {
38 | 0xa5,0xaa,0xa5,0xb8,0xa5,0xaa,0xa5,0xaa,0xa5,0xb8,0xa5,0xb8,0xa5,0xb8,0xa5,
39 | 0xb8,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xac,0xc0,0xcc,0xc0,0xa1,0xa1,
40 | 0xa1,0xa1,0xb1,0xa5,0xa5,0xa6,0xc0,0xc0,0xd7,0xda,0xe0,0xc0,0xe4,0xc0,0xea,
41 | 0xea,0xe0,0xe0,0x98,0xc8,0xee,0xf1,0xa5,0xd3,0xa5,0xa5,0xa1,0xea,0x9e,0xc0,
42 | 0xc0,0xc2,0xc0,0xe6,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0xab,
43 | 0x8b,0x90,0x64,0x5b,0x5b,0x5b,0x5b,0x5b,0x92,0x5b,0x5b,0x76,0x90,0x92,0x92,
44 | 0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x6a,0x73,0x90,
45 | 0x5b,0x52,0x52,0x52,0x52,0x5b,0x5b,0x5b,0x5b,0x77,0x7c,0x77,0x85,0x5b,0x5b,
46 | 0x70,0x5b,0x7a,0xaf,0x76,0x76,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,0x5b,
47 | 0x5b,0x5b,0x86,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xd5,0x03,0xcc,0x01,0xbc,
48 | 0x03,0xf0,0x03,0x03,0x04,0x00,0x50,0x50,0x50,0x50,0xff,0x20,0x20,0x20,0x20,
49 | 0x01,0x01,0x01,0x01,0xc4,0x02,0x10,0xff,0xff,0xff,0x01,0x00,0x03,0x11,0xff,
50 | 0x03,0xc4,0xc6,0xc8,0x02,0x10,0x00,0xff,0xcc,0x01,0x01,0x01,0x00,0x00,0x00,
51 | 0x00,0x01,0x01,0x03,0x01,0xff,0xff,0xc0,0xc2,0x10,0x11,0x02,0x03,0x01,0x01,
52 | 0x01,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0x00,0x00,0xff,0xff,0xff,0xff,0x10,
53 | 0x10,0x10,0x10,0x02,0x10,0x00,0x00,0xc6,0xc8,0x02,0x02,0x02,0x02,0x06,0x00,
54 | 0x04,0x00,0x02,0xff,0x00,0xc0,0xc2,0x01,0x01,0x03,0x03,0x03,0xca,0x40,0x00,
55 | 0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00,0x00,0x00,0x00,
56 | 0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0xff,0x00,
57 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,
58 | 0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f,0x00,0x00,
59 | 0xff,0x40,0x40,0x40,0x40,0x41,0x49,0x40,0x40,0x40,0x40,0x4c,0x42,0x40,0x40,
60 | 0x40,0x40,0x40,0x40,0x40,0x40,0x4f,0x44,0x53,0x40,0x40,0x40,0x44,0x57,0x43,
61 | 0x5c,0x40,0x60,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,
62 | 0x40,0x40,0x64,0x66,0x6e,0x6b,0x40,0x40,0x6a,0x46,0x40,0x40,0x44,0x46,0x40,
63 | 0x40,0x5b,0x44,0x40,0x40,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x06,0x01,0x06,
64 | 0x06,0x02,0x06,0x06,0x00,0x06,0x00,0x0a,0x0a,0x00,0x00,0x00,0x02,0x07,0x07,
65 | 0x06,0x02,0x0d,0x06,0x06,0x06,0x0e,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04,
66 | 0x04,0x04,0x05,0x06,0x06,0x06,0x00,0x00,0x00,0x0e,0x00,0x00,0x08,0x00,0x10,
67 | 0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01,0x86,0x00,
68 | 0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba,0xf8,0xbb,
69 | 0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00,0xc4,0xff,
70 | 0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00,0x13,0x09,
71 | 0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07,0xb2,0xff,
72 | 0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf,0xe7,0x08,
73 | 0x00,0xf0,0x02,0x00
74 | };
75 |
--------------------------------------------------------------------------------
/Include/GWCA/GameContainers/List.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace GW {
4 |
5 | template
6 | struct TLink {
7 | bool IsLinked() const { return prev_link != this; }
8 |
9 | void Unlink()
10 | {
11 | RemoveFromList();
12 |
13 | next_node = reinterpret_cast(reinterpret_cast(this) + 1);
14 | prev_link = this;
15 | }
16 |
17 | T* Prev()
18 | {
19 | T* prevNode = prev_link->prev_link->next_node;
20 | if (reinterpret_cast(prevNode) & 1)
21 | return nullptr;
22 | return prevNode;
23 | }
24 |
25 | T* Next()
26 | {
27 | if (reinterpret_cast(next_node) & 1)
28 | return nullptr;
29 | return next_node;
30 | }
31 |
32 | TLink* NextLink()
33 | {
34 | const size_t offset = reinterpret_cast(this) - (reinterpret_cast(prev_link->next_node) & ~1);
35 | return reinterpret_cast((reinterpret_cast(next_node) & ~1) + offset);
36 | }
37 |
38 | TLink* PrevLink() { return prev_link; }
39 |
40 | protected:
41 | TLink* prev_link; // +h0000
42 | T* next_node; // +h0004
43 |
44 | void RemoveFromList()
45 | {
46 | NextLink()->prev_link = prev_link;
47 | prev_link->next_node = next_node;
48 | }
49 | };
50 |
51 | template
52 | struct TList {
53 | class iterator {
54 | public:
55 | using difference_type = std::ptrdiff_t;
56 | using value_type = T;
57 |
58 | iterator()
59 | : current(nullptr)
60 | , first(nullptr)
61 | {
62 | }
63 | explicit iterator(TLink* node, TLink* first = nullptr)
64 | : current(node)
65 | , first(first)
66 | {
67 | }
68 |
69 | T& operator*() { return *current->Next(); }
70 | T* operator->() { return current->Next(); }
71 | T& operator*() const { return *current->Next(); }
72 | T* operator->() const { return current->Next(); }
73 |
74 | iterator& operator++()
75 | {
76 | if (current->NextLink() == first && first != nullptr)
77 | iteration++;
78 | current = current->NextLink();
79 | return *this;
80 | }
81 |
82 | iterator operator++(int)
83 | {
84 | iterator it(current);
85 | ++*this;
86 | return it;
87 | }
88 |
89 | bool operator==(const iterator& other) const { return current == other.current && iteration == other.iteration; }
90 |
91 | bool operator!=(const iterator& other) const { return !(*this == other); }
92 |
93 | private:
94 | TLink* current;
95 | TLink* first;
96 | int iteration = 0;
97 | };
98 |
99 | iterator begin() { return iterator(&link, &link); }
100 |
101 | iterator end()
102 | {
103 | TLink* last = &link;
104 | while (last->Next() != nullptr) {
105 | if (last->NextLink() == &link) {
106 | return ++iterator(last, &link);
107 | }
108 | last = last->NextLink();
109 | }
110 | return iterator(last, &link);
111 | }
112 |
113 | [[nodiscard]] iterator begin() const { return iterator(&link); }
114 | [[nodiscard]] iterator end() const { return end(); }
115 |
116 | TLink* Get() { return &link; }
117 |
118 | protected:
119 | size_t offset{};
120 | TLink link;
121 | };
122 | }
123 |
--------------------------------------------------------------------------------
/Dependencies/minhook/src/trampoline.h:
--------------------------------------------------------------------------------
1 | /*
2 | * MinHook - The Minimalistic API Hooking Library for x64/x86
3 | * Copyright (C) 2009-2017 Tsuda Kageyu.
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | *
10 | * 1. Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * 2. Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in the
14 | * documentation and/or other materials provided with the distribution.
15 | *
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | */
28 |
29 | #pragma once
30 |
31 | #pragma pack(push, 1)
32 |
33 | // Structs for writing x86/x64 instructions.
34 |
35 | // 8-bit relative jump.
36 | typedef struct _JMP_REL_SHORT
37 | {
38 | UINT8 opcode; // EB xx: JMP +2+xx
39 | UINT8 operand;
40 | } JMP_REL_SHORT, *PJMP_REL_SHORT;
41 |
42 | // 32-bit direct relative jump/call.
43 | typedef struct _JMP_REL
44 | {
45 | UINT8 opcode; // E9/E8 xxxxxxxx: JMP/CALL +5+xxxxxxxx
46 | UINT32 operand; // Relative destination address
47 | } JMP_REL, *PJMP_REL, CALL_REL;
48 |
49 | // 64-bit indirect absolute jump.
50 | typedef struct _JMP_ABS
51 | {
52 | UINT8 opcode0; // FF25 00000000: JMP [+6]
53 | UINT8 opcode1;
54 | UINT32 dummy;
55 | UINT64 address; // Absolute destination address
56 | } JMP_ABS, *PJMP_ABS;
57 |
58 | // 64-bit indirect absolute call.
59 | typedef struct _CALL_ABS
60 | {
61 | UINT8 opcode0; // FF15 00000002: CALL [+6]
62 | UINT8 opcode1;
63 | UINT32 dummy0;
64 | UINT8 dummy1; // EB 08: JMP +10
65 | UINT8 dummy2;
66 | UINT64 address; // Absolute destination address
67 | } CALL_ABS;
68 |
69 | // 32-bit direct relative conditional jumps.
70 | typedef struct _JCC_REL
71 | {
72 | UINT8 opcode0; // 0F8* xxxxxxxx: J** +6+xxxxxxxx
73 | UINT8 opcode1;
74 | UINT32 operand; // Relative destination address
75 | } JCC_REL;
76 |
77 | // 64bit indirect absolute conditional jumps that x64 lacks.
78 | typedef struct _JCC_ABS
79 | {
80 | UINT8 opcode; // 7* 0E: J** +16
81 | UINT8 dummy0;
82 | UINT8 dummy1; // FF25 00000000: JMP [+6]
83 | UINT8 dummy2;
84 | UINT32 dummy3;
85 | UINT64 address; // Absolute destination address
86 | } JCC_ABS;
87 |
88 | #pragma pack(pop)
89 |
90 | typedef struct _TRAMPOLINE
91 | {
92 | LPVOID pTarget; // [In] Address of the target function.
93 | LPVOID pDetour; // [In] Address of the detour function.
94 | LPVOID pTrampoline; // [In] Buffer address for the trampoline and relay function.
95 |
96 | #if defined(_M_X64) || defined(__x86_64__)
97 | LPVOID pRelay; // [Out] Address of the relay function.
98 | #endif
99 | BOOL patchAbove; // [Out] Should use the hot patch area?
100 | UINT nIP; // [Out] Number of the instruction boundaries.
101 | UINT8 oldIPs[8]; // [Out] Instruction boundaries of the target function.
102 | UINT8 newIPs[8]; // [Out] Instruction boundaries of the trampoline function.
103 | } TRAMPOLINE, *PTRAMPOLINE;
104 |
105 | BOOL CreateTrampolineFunction(PTRAMPOLINE ct);
106 |
--------------------------------------------------------------------------------
/Examples/PacketLogger/PacketLogger.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | 16.0
15 | {5AFD5193-1EE6-44BA-AC97-F50BEAB30EBC}
16 | PacketLogger
17 |
18 |
19 |
20 | DynamicLibrary
21 | true
22 | v143
23 | MultiByte
24 | false
25 |
26 |
27 | DynamicLibrary
28 | false
29 | v143
30 | true
31 | MultiByte
32 | false
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Level3
50 | Disabled
51 | true
52 | true
53 | $(ProjectDir)..\..\Include\
54 | MultiThreadedDebug
55 |
56 |
57 | Console
58 |
59 |
60 |
61 |
62 | Level3
63 | MaxSpeed
64 | true
65 | true
66 | true
67 | true
68 | $(ProjectDir)..\..\Include\
69 | MultiThreaded
70 |
71 |
72 | Console
73 | true
74 | true
75 |
76 |
77 |
78 |
79 | {b3359f05-68cf-4e7f-b9d6-d106f6d48a38}
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/Examples/Teleport/Teleport.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | 16.0
15 | {8B852BC5-203D-4894-B95B-F7CAB774B6C1}
16 | Teleport
17 |
18 |
19 |
20 | DynamicLibrary
21 | true
22 | v143
23 | MultiByte
24 | false
25 |
26 |
27 | DynamicLibrary
28 | false
29 | v143
30 | true
31 | MultiByte
32 | false
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Level3
50 | Disabled
51 | true
52 | true
53 | $(ProjectDir)..\..\Include\;%(AdditionalIncludeDirectories)
54 | MultiThreadedDebug
55 |
56 |
57 | Console
58 |
59 |
60 |
61 |
62 | Level3
63 | MaxSpeed
64 | true
65 | true
66 | true
67 | true
68 | $(ProjectDir)..\..\Include\;%(AdditionalIncludeDirectories)
69 | MultiThreaded
70 |
71 |
72 | Console
73 | true
74 | true
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | {b3359f05-68cf-4e7f-b9d6-d106f6d48a38}
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/Dependencies/DirectX/Include/D3DX11core.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (C) Microsoft Corporation. All Rights Reserved.
4 | //
5 | // File: d3dx11core.h
6 | // Content: D3DX11 core types and functions
7 | //
8 | ///////////////////////////////////////////////////////////////////////////
9 |
10 | #include "d3dx11.h"
11 |
12 | #ifndef __D3DX11CORE_H__
13 | #define __D3DX11CORE_H__
14 |
15 | // Current name of the DLL shipped in the same SDK as this header.
16 |
17 |
18 | #define D3DX11_DLL_W L"d3dx11_43.dll"
19 | #define D3DX11_DLL_A "d3dx11_43.dll"
20 |
21 | #ifdef UNICODE
22 | #define D3DX11_DLL D3DX11_DLL_W
23 | #else
24 | #define D3DX11_DLL D3DX11_DLL_A
25 | #endif
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif //__cplusplus
30 |
31 | ///////////////////////////////////////////////////////////////////////////
32 | // D3DX11_SDK_VERSION:
33 | // -----------------
34 | // This identifier is passed to D3DX11CheckVersion in order to ensure that an
35 | // application was built against the correct header files and lib files.
36 | // This number is incremented whenever a header (or other) change would
37 | // require applications to be rebuilt. If the version doesn't match,
38 | // D3DX11CreateVersion will return FALSE. (The number itself has no meaning.)
39 | ///////////////////////////////////////////////////////////////////////////
40 |
41 |
42 | #define D3DX11_SDK_VERSION 43
43 |
44 |
45 | #ifdef D3D_DIAG_DLL
46 | BOOL WINAPI D3DX11DebugMute(BOOL Mute);
47 | #endif
48 | HRESULT WINAPI D3DX11CheckVersion(UINT D3DSdkVersion, UINT D3DX11SdkVersion);
49 |
50 | #ifdef __cplusplus
51 | }
52 | #endif //__cplusplus
53 |
54 |
55 |
56 | //////////////////////////////////////////////////////////////////////////////
57 | // ID3DX11ThreadPump:
58 | //////////////////////////////////////////////////////////////////////////////
59 |
60 | #undef INTERFACE
61 | #define INTERFACE ID3DX11DataLoader
62 |
63 | DECLARE_INTERFACE(ID3DX11DataLoader)
64 | {
65 | STDMETHOD(Load)(THIS) PURE;
66 | STDMETHOD(Decompress)(THIS_ void **ppData, SIZE_T *pcBytes) PURE;
67 | STDMETHOD(Destroy)(THIS) PURE;
68 | };
69 |
70 | #undef INTERFACE
71 | #define INTERFACE ID3DX11DataProcessor
72 |
73 | DECLARE_INTERFACE(ID3DX11DataProcessor)
74 | {
75 | STDMETHOD(Process)(THIS_ void *pData, SIZE_T cBytes) PURE;
76 | STDMETHOD(CreateDeviceObject)(THIS_ void **ppDataObject) PURE;
77 | STDMETHOD(Destroy)(THIS) PURE;
78 | };
79 |
80 | // {C93FECFA-6967-478a-ABBC-402D90621FCB}
81 | DEFINE_GUID(IID_ID3DX11ThreadPump,
82 | 0xc93fecfa, 0x6967, 0x478a, 0xab, 0xbc, 0x40, 0x2d, 0x90, 0x62, 0x1f, 0xcb);
83 |
84 | #undef INTERFACE
85 | #define INTERFACE ID3DX11ThreadPump
86 |
87 | DECLARE_INTERFACE_(ID3DX11ThreadPump, IUnknown)
88 | {
89 | // IUnknown
90 | STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
91 | STDMETHOD_(ULONG, AddRef)(THIS) PURE;
92 | STDMETHOD_(ULONG, Release)(THIS) PURE;
93 |
94 | // ID3DX11ThreadPump
95 | STDMETHOD(AddWorkItem)(THIS_ ID3DX11DataLoader *pDataLoader, ID3DX11DataProcessor *pDataProcessor, HRESULT *pHResult, void **ppDeviceObject) PURE;
96 | STDMETHOD_(UINT, GetWorkItemCount)(THIS) PURE;
97 |
98 | STDMETHOD(WaitForAllItems)(THIS) PURE;
99 | STDMETHOD(ProcessDeviceWorkItems)(THIS_ UINT iWorkItemCount);
100 |
101 | STDMETHOD(PurgeAllItems)(THIS) PURE;
102 | STDMETHOD(GetQueueStatus)(THIS_ UINT *pIoQueue, UINT *pProcessQueue, UINT *pDeviceQueue) PURE;
103 |
104 | };
105 |
106 | #ifdef __cplusplus
107 | extern "C" {
108 | #endif //__cplusplus
109 |
110 | HRESULT WINAPI D3DX11CreateThreadPump(UINT cIoThreads, UINT cProcThreads, ID3DX11ThreadPump **ppThreadPump);
111 |
112 | HRESULT WINAPI D3DX11UnsetAllDeviceObjects(ID3D11DeviceContext *pContext);
113 |
114 | #ifdef __cplusplus
115 | }
116 | #endif //__cplusplus
117 |
118 | ///////////////////////////////////////////////////////////////////////////
119 |
120 | #define _FACD3D 0x876
121 | #define MAKE_D3DHRESULT( code ) MAKE_HRESULT( 1, _FACD3D, code )
122 | #define MAKE_D3DSTATUS( code ) MAKE_HRESULT( 0, _FACD3D, code )
123 |
124 | #define D3DERR_INVALIDCALL MAKE_D3DHRESULT(2156)
125 | #define D3DERR_WASSTILLDRAWING MAKE_D3DHRESULT(540)
126 |
127 | #endif //__D3DX11CORE_H__
128 |
129 |
--------------------------------------------------------------------------------
/Dependencies/minhook/README.md:
--------------------------------------------------------------------------------
1 | # MinHook
2 |
3 | [](https://opensource.org/licenses/BSD-2-Clause)
4 |
5 | The Minimalistic x86/x64 API Hooking Library for Windows
6 |
7 | http://www.codeproject.com/KB/winsdk/LibMinHook.aspx
8 |
9 | ### Donation please
10 |
11 | I need some funds to continue developing this library. All contributions gratefully accepted.
12 |
13 |
14 |
15 | ### Version history
16 |
17 | - **v1.3.3 - 8 Jan 2017**
18 | * Added a helper function ```MH_CreateHookApiEx```. (Thanks to asm256)
19 | * Support Visual Studio 2017 RC.
20 |
21 | - **v1.3.2.1 - 9 Nov 2015** (Nuget package only)
22 | * Fixed an insufficient support for Visual Studio 2015.
23 |
24 | - **v1.3.2 - 1 Nov 2015**
25 | * Support Visual Studio 2015.
26 | * Support MinGW.
27 |
28 | - **v1.3.2-beta3 - 21 Jul 2015** (Nuget package only)
29 | * Support MinGW. (Experimental)
30 |
31 | - **v1.3.2-beta2 - 18 May 2015**
32 | * Fixed some subtle bugs. (Thanks to RaMMicHaeL)
33 | * Added a helper function ```MH_StatusToString```. (Thanks to Jan Klass)
34 |
35 | - **v1.3.2-beta - 12 May 2015**
36 | * Fixed a possible thread deadlock in x64 mode. (Thanks to Aleh Kazakevich)
37 | * Reduced the footprint a little more.
38 | * Support Visual Studio 2015 RC. (Experimental)
39 |
40 | - **v1.3.1.1 - 7 Apr 2015** (Nuget package only)
41 | * Support for WDK8.0 and 8.1.
42 |
43 | - **v1.3.1 - 19 Mar 2015**
44 | * No major changes from v1.3.1-beta.
45 |
46 | - **v1.3.1-beta - 11 Mar 2015**
47 | * Added a helper function ```MH_CreateHookApi```. (Thanks to uniskz).
48 | * Fixed a false memory leak reported by some tools.
49 | * Fixed a degradated compatibility issue.
50 |
51 | - **v1.3 - 13 Sep 2014**
52 | * No major changes from v1.3-beta3.
53 |
54 | - **v1.3-beta3 - 31 Jul 2014**
55 |
56 | * Fixed some small bugs.
57 | * Improved the memory management.
58 |
59 | - **v1.3-beta2 - 21 Jul 2014**
60 |
61 | * Changed the parameters to Windows-friendly types. (void* to LPVOID)
62 | * Fixed some small bugs.
63 | * Reorganized the source files.
64 | * Reduced the footprint a little more.
65 |
66 | - **v1.3-beta - 17 Jul 2014**
67 |
68 | * Rewrote in plain C to reduce the footprint and memory usage. (suggested by Andrey Unis)
69 | * Simplified the overall code base to make it more readable and maintainable.
70 | * Changed the license from 3-clause to 2-clause BSD License.
71 |
72 | - **v1.2 - 28 Sep 2013**
73 |
74 | * Removed boost dependency ([jarredholman](https://github.com/jarredholman/minhook)).
75 | * Fixed a small bug in the GetRelativeBranchDestination function ([pillbug99](http://www.codeproject.com/Messages/4058892/Small-Bug-Found.aspx)).
76 | * Added the ```MH_RemoveHook``` function, which removes a hook created with the ```MH_CreateHook``` function.
77 | * Added the following functions to enable or disable multiple hooks in one go: ```MH_QueueEnableHook```, ```MH_QueueDisableHook```, ```MH_ApplyQueued```. This is the preferred way of handling multiple hooks as every call to `MH_EnableHook` or `MH_DisableHook` suspends and resumes all threads.
78 | * Made the functions ```MH_EnableHook``` and ```MH_DisableHook``` enable/disable all created hooks when the ```MH_ALL_HOOKS``` parameter is passed. This, too, is an efficient way of handling multiple hooks.
79 | * If the target function is too small to be patched with a jump, MinHook tries to place the jump above the function. If that fails as well, the ```MH_CreateHook``` function returns ```MH_ERROR_UNSUPPORTED_FUNCTION```. This fixes an issue of hooking the LoadLibraryExW function on Windows 7 x64 ([reported by Obble](http://www.codeproject.com/Messages/4578613/Re-Bug-LoadLibraryExW-hook-fails-on-windows-2008-r.aspx)).
80 |
81 | - **v1.1 - 26 Nov 2009**
82 |
83 | * Changed the interface to create a hook and a trampoline function in one go to prevent the detour function from being called before the trampoline function is created. ([reported by xliqz](http://www.codeproject.com/Messages/3280374/Unsafe.aspx))
84 | * Shortened the function names from ```MinHook_*``` to ```MH_*``` to make them handier.
85 |
86 | - **v1.0 - 22 Nov 2009**
87 |
88 | * Initial release.
89 |
--------------------------------------------------------------------------------
/Source/CtoSMgr.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 | #include
10 | #include
11 |
12 | #define GWCA_CTOS_DISABLED 1
13 |
14 | namespace {
15 | using namespace GW;
16 |
17 | typedef void(__cdecl *SendPacket_pt)(
18 | uint32_t context, uint32_t size, void* packet);
19 | SendPacket_pt SendPacket_Func = 0;
20 | SendPacket_pt RetSendPacket = 0;
21 |
22 | std::vector> packets_callbacks;
23 | bool __cdecl CtoSHandler_Func(uint32_t context, uint32_t size, void* packet) {
24 | HookBase::EnterHook();
25 | HookStatus status;
26 | uint32_t header = *(uint32_t*)packet;
27 | if (header < packets_callbacks.size()) {
28 | for (auto& it : packets_callbacks[header]) {
29 | it.second(&status, packet);
30 | ++status.altitude;
31 | }
32 | }
33 | if (!status.blocked)
34 | RetSendPacket(context, size, packet);
35 | GW::HookBase::LeaveHook();
36 | return true;
37 | }
38 | uintptr_t game_srv_object_addr;
39 |
40 | void Init() {
41 | #ifndef GWCA_CTOS_DISABLED
42 | SendPacket_Func = (SendPacket_pt)Scanner::FindAssertion("p:\\code\\net\\msg\\msgconn.cpp", "bytes >= sizeof(dword)", -0x67);
43 | #endif
44 | uintptr_t address = Scanner::FindAssertion("p:\\code\\gw\\net\\cli\\gcgamecmd.cpp","No valid case for switch variable 'code'", -0x32);
45 | if (Verify(address))
46 | game_srv_object_addr = *(uintptr_t *)address;
47 |
48 | packets_callbacks.resize(180);
49 |
50 | GWCA_INFO("[SCAN] SendPacket = %p", SendPacket_Func);
51 | GWCA_INFO("[SCAN] CtoGSObjectPtr = %p", game_srv_object_addr);
52 |
53 | #ifdef _DEBUG
54 | #ifndef GWCA_CTOS_DISABLED
55 | GWCA_ASSERT(SendPacket_Func);
56 | #endif
57 | GWCA_ASSERT(game_srv_object_addr);
58 | #endif
59 | HookBase::CreateHook(SendPacket_Func, CtoSHandler_Func, (void**)&RetSendPacket);
60 |
61 | }
62 | void EnableHooks() {
63 | if (SendPacket_Func)
64 | HookBase::EnableHooks(SendPacket_Func);
65 | }
66 | void DisableHooks() {
67 | if (SendPacket_Func)
68 | HookBase::DisableHooks(SendPacket_Func);
69 | }
70 | void Exit() {
71 | HookBase::RemoveHook(SendPacket_Func);
72 | }
73 | }
74 |
75 |
76 | namespace GW {
77 |
78 | Module CtoSModule = {
79 | "CtoSModule", // name
80 | NULL, // param
81 | ::Init, // init_module
82 | ::Exit, // exit_module
83 | ::EnableHooks, // enable_hooks
84 | ::DisableHooks, // disable_hooks
85 | };
86 | void CtoS::RegisterPacketCallback(
87 | HookEntry* entry,
88 | uint32_t header,
89 | const PacketCallback& callback)
90 | {
91 | packets_callbacks[header].insert({ entry, callback });
92 | }
93 | void CtoS::RemoveCallback(uint32_t header, HookEntry* entry) {
94 | auto& callbacks = packets_callbacks[header];
95 | auto it = callbacks.find(entry);
96 | if (it != callbacks.end())
97 | callbacks.erase(it);
98 | }
99 | bool CtoS::SendPacket(uint32_t size, void *buffer) {
100 | if (!(Verify(SendPacket_Func && game_srv_object_addr)))
101 | return false;
102 | if (GameThread::IsInGameThread() || Render::GetIsInRenderLoop()) {
103 | // Already in game thread, don't need to worry about buffer lifecycle
104 | SendPacket_Func(*(uint32_t*)game_srv_object_addr, size, buffer);
105 | return true;
106 | }
107 | // Copy the packet and enqueue in the game thread
108 | void* buffer_cpy = malloc(size);
109 | GWCA_ASSERT(buffer_cpy != NULL);
110 | memcpy(buffer_cpy, buffer, size);
111 | GameThread::Enqueue([buffer_cpy, size]() {
112 | SendPacket_Func(*(uint32_t*)game_srv_object_addr, size, buffer_cpy);
113 | free(buffer_cpy);
114 | });
115 | return true;
116 | }
117 |
118 | bool CtoS::SendPacket(uint32_t size, ...) {
119 | uint32_t *pak = &size + 1;
120 | return SendPacket(size, pak);
121 | }
122 | } // namespace GW
123 |
--------------------------------------------------------------------------------
/Dependencies/minhook/LICENSE.txt:
--------------------------------------------------------------------------------
1 | MinHook - The Minimalistic API Hooking Library for x64/x86
2 | Copyright (C) 2009-2017 Tsuda Kageyu.
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions
7 | are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright
10 | notice, this list of conditions and the following disclaimer.
11 | 2. Redistributions in binary form must reproduce the above copyright
12 | notice, this list of conditions and the following disclaimer in the
13 | documentation and/or other materials provided with the distribution.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
27 | ================================================================================
28 | Portions of this software are Copyright (c) 2008-2009, Vyacheslav Patkov.
29 | ================================================================================
30 | Hacker Disassembler Engine 32 C
31 | Copyright (c) 2008-2009, Vyacheslav Patkov.
32 | All rights reserved.
33 |
34 | Redistribution and use in source and binary forms, with or without
35 | modification, are permitted provided that the following conditions
36 | are met:
37 |
38 | 1. Redistributions of source code must retain the above copyright
39 | notice, this list of conditions and the following disclaimer.
40 | 2. Redistributions in binary form must reproduce the above copyright
41 | notice, this list of conditions and the following disclaimer in the
42 | documentation and/or other materials provided with the distribution.
43 |
44 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
45 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
46 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
47 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
48 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
49 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
50 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
51 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
52 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
53 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
54 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 |
56 | -------------------------------------------------------------------------------
57 | Hacker Disassembler Engine 64 C
58 | Copyright (c) 2008-2009, Vyacheslav Patkov.
59 | All rights reserved.
60 |
61 | Redistribution and use in source and binary forms, with or without
62 | modification, are permitted provided that the following conditions
63 | are met:
64 |
65 | 1. Redistributions of source code must retain the above copyright
66 | notice, this list of conditions and the following disclaimer.
67 | 2. Redistributions in binary form must reproduce the above copyright
68 | notice, this list of conditions and the following disclaimer in the
69 | documentation and/or other materials provided with the distribution.
70 |
71 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
72 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
73 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
74 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
75 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
76 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
77 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
78 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
79 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
80 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
81 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
82 |
--------------------------------------------------------------------------------