Skip to content

Commit

Permalink
Big stuff
Browse files Browse the repository at this point in the history
- ingame particles editor
- ingame level editor
- easy injector, execute the injector.exe file without having to use external injectors
- compatibility with latest 3.1 silent update
- reorganized some of the code
  • Loading branch information
LoneDev6 committed Mar 17, 2021
1 parent 312e9aa commit 7397efd
Show file tree
Hide file tree
Showing 15 changed files with 323 additions and 98 deletions.
11 changes: 11 additions & 0 deletions devildaggers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ VisualStudioVersion = 15.0.28306.52
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devildaggers", "devildaggers\devildaggers.vcxproj", "{EA2E9B4F-EDCF-45A2-976C-477296653824}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "injector", "injector\injector.vcxproj", "{31C2ECAE-CB2A-4F7D-88C4-FB3D581F1853}"
ProjectSection(ProjectDependencies) = postProject
{EA2E9B4F-EDCF-45A2-976C-477296653824} = {EA2E9B4F-EDCF-45A2-976C-477296653824}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -21,6 +26,12 @@ Global
{EA2E9B4F-EDCF-45A2-976C-477296653824}.Release|x64.Build.0 = Release|x64
{EA2E9B4F-EDCF-45A2-976C-477296653824}.Release|x86.ActiveCfg = Release|Win32
{EA2E9B4F-EDCF-45A2-976C-477296653824}.Release|x86.Build.0 = Release|Win32
{31C2ECAE-CB2A-4F7D-88C4-FB3D581F1853}.Debug|x64.ActiveCfg = Debug|x64
{31C2ECAE-CB2A-4F7D-88C4-FB3D581F1853}.Debug|x64.Build.0 = Debug|x64
{31C2ECAE-CB2A-4F7D-88C4-FB3D581F1853}.Debug|x86.ActiveCfg = Debug|x64
{31C2ECAE-CB2A-4F7D-88C4-FB3D581F1853}.Release|x64.ActiveCfg = Release|x64
{31C2ECAE-CB2A-4F7D-88C4-FB3D581F1853}.Release|x64.Build.0 = Release|x64
{31C2ECAE-CB2A-4F7D-88C4-FB3D581F1853}.Release|x86.ActiveCfg = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
24 changes: 10 additions & 14 deletions devildaggers/GameModel.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#define HERO_PTR_ADDRESS 0x228978;
#define HERO_PTR_ADDRESS 0x227BE0;


#include <windows.h>
Expand Down Expand Up @@ -57,25 +57,21 @@ class Hero : public GameDataStructure<Hero>
float fTilesShrinkTime; //0x03BC
char pad_03C0[32]; //0x03C0
char sLevelName_2[8]; //0x03E0
char pad_03E8[152]; //0x03E8
char pad_03E8[128]; //0x03E8
int8_t iRenderParticlesEditor; //0x0468
int8_t iRenderLevelEditor; //0x0469
int8_t iRenderLevelDesc_notWorking; //0x046A
char pad_046B[21]; //0x046B
char sLeaderboardFirstUsername[32]; //0x0480
char sLeaderboardSecondUsername[32]; //0x04A0
class unk_leaderboardEntry *pLeaderboardStuff; //0x04C0
char pad_04C8[40]; //0x04C8
class unk_leaderboardEntry_2 *pLeaderboardStuff_2; //0x04F0
char pad_04F8[104]; //0x04F8
char sPlayerName4[8]; //0x0560
char pad_0568[40]; //0x0568
class DownloadMessage *pDownloadMessage; //0x0590
char pad_0598[288]; //0x0598
char sPlayerName5[8]; //0x06B8
char pad_06C0[24]; //0x06C0
class SteamStuff *pSteamStuff; //0x06D8
char pad_06E0[268]; //0x06E0
char pad_04C8[804]; //0x04C8
float fCamX; //0x07EC
float fCamY; //0x07F0
float fCamZ; //0x07F4
}; //Size: 0x07F8
char pad_07F8[112]; //0x07F8
}; //Size: 0x0868


class unk_leaderboardEntry_2
{
Expand Down
18 changes: 14 additions & 4 deletions devildaggers/OpenGLHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
wglSwapBuffers _o_wglSwapBuffers;
std::function<void(HDC)> _proxy_wglSwapBuffers;

void* wglSwapBuffers_addr;

BOOL __stdcall _trampoline_wglSwapBuffers(_In_ HDC hdc)
{
_proxy_wglSwapBuffers(hdc);
Expand All @@ -25,19 +27,27 @@ DWORD WINAPI hook_opengl(std::function<void(HDC)> proxy)
{
std::cout << "Found opengl32.dll \n";
//use GetProcAddress to find address of wglSwapBuffers in the dll
void* ptr = GetProcAddress(hMod, "wglSwapBuffers");
wglSwapBuffers_addr = GetProcAddress(hMod, "wglSwapBuffers");
MH_Initialize();
if (MH_CreateHook(ptr, _trampoline_wglSwapBuffers, reinterpret_cast<void**>(&_o_wglSwapBuffers)) != MH_OK)
if (MH_CreateHook(wglSwapBuffers_addr, _trampoline_wglSwapBuffers, reinterpret_cast<void**>(&_o_wglSwapBuffers)) != MH_OK)
{
std::cout << "MH_Initialize: failed \n";
}

if (MH_EnableHook(ptr) != MH_OK)
if (MH_EnableHook(wglSwapBuffers_addr) != MH_OK)
{
std::cout << "MH_EnableHook: failed \n";
}
}

return 1;
}
//TODO: unhookOpenGL()

void unhook_opengl()
{
if (MH_DisableHook(wglSwapBuffers_addr) != MH_OK)
{
std::cout << "MH_DisableHook: failed \n";
//maybe handle it somehow?
}
}
3 changes: 2 additions & 1 deletion devildaggers/OpenGLHook.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
#include <functional>

typedef BOOL(__stdcall * wglSwapBuffers) (_In_ HDC hdc);
DWORD WINAPI hook_opengl(std::function<void(HDC)> trampoline);
DWORD WINAPI hook_opengl(std::function<void(HDC)> trampoline);
void unhook_opengl();
17 changes: 14 additions & 3 deletions devildaggers/SetCursorPos_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
setCursorPos _o_setCursorPos;
std::function<void(int&, int&)> _proxy_setCursorPos;

void* SetCursorPos_addr;

BOOL __stdcall _trampoline__setCursorPos(_In_ int X, _In_ int Y)
{
_proxy_setCursorPos(X, Y);
Expand All @@ -25,18 +27,27 @@ DWORD WINAPI hook_setCursorPos(std::function<void(int&, int&)> proxy)
{
std::cout << "Found user32.dll \n";
//use GetProcAddress to find address of setCursorPos in the dll
void* ptr = GetProcAddress(hMod, "SetCursorPos");
SetCursorPos_addr = GetProcAddress(hMod, "SetCursorPos");
MH_Initialize();
if (MH_CreateHook(ptr, _trampoline__setCursorPos, reinterpret_cast<void**>(&_o_setCursorPos)) != MH_OK)
if (MH_CreateHook(SetCursorPos_addr, _trampoline__setCursorPos, reinterpret_cast<void**>(&_o_setCursorPos)) != MH_OK)
{
std::cout << "MH_Initialize: failed \n";
}

if (MH_EnableHook(ptr) != MH_OK)
if (MH_EnableHook(SetCursorPos_addr) != MH_OK)
{
std::cout << "MH_EnableHook: failed \n";
}
}

return 1;
}

void unhook_setCursorPos()
{
if (MH_DisableHook(SetCursorPos_addr) != MH_OK)
{
std::cout << "MH_DisableHook: failed \n";
//maybe handle it somehow?
}
}
1 change: 1 addition & 0 deletions devildaggers/SetCursorPos_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@

DWORD WINAPI hook_setCursorPos(std::function<void(int&, int&)> trampoline);
typedef BOOL(__stdcall * setCursorPos) (_In_ int X, _In_ int Y);
void unhook_setCursorPos();
8 changes: 4 additions & 4 deletions devildaggers/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

int __stdcall DllMain( const HMODULE self, const unsigned long reason_for_call, void *reserved ) {
if( reason_for_call == DLL_PROCESS_ATTACH ) {
save_dll_module(self);
DisableThreadLibraryCalls(self);
CreateThread( nullptr, 0, &main_thread, nullptr, 0, nullptr );
return 1;
HANDLE hThread = CreateThread(nullptr, 0, &main_thread, nullptr, 0, nullptr);
CloseHandle(hThread);
}
//TODO: detach
return 0;
return TRUE;
}
Loading

0 comments on commit 7397efd

Please sign in to comment.