-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46a20b2
commit 711b372
Showing
3 changed files
with
88 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#pragma once | ||
|
||
#include <format> | ||
#include "../../../Events/Listener.hpp" | ||
#include "../../../Events/Input/KeyEvent.hpp" | ||
#include "../../../../Utils/Logger/Logger.hpp" | ||
#include "../Module.hpp" | ||
#include "../../../../SDK/SDK.hpp" | ||
#include <Windows.h> | ||
|
||
class NoHurtCamListener : public Listener { | ||
Module* module; | ||
|
||
// 76 1C 66 0F 6E 00 | 40 F2 0F 11 03 8B 44 24 48 89 43 08 C6 43 0C 01 | ||
// 8B 44 24 48 89 43 08 C6 patch to 8B 44 24 48 90 90 90 C6 | ||
|
||
static inline bool patched = false; | ||
|
||
static inline uintptr_t sigOffset; | ||
static inline std::vector<uint8_t> originalCameraAngle; | ||
static inline uint8_t newCameraAngle[3] = {0x90, 0x90, 0x90}; | ||
|
||
public: | ||
|
||
static void patch() { | ||
if(patched) return; | ||
patched = true; | ||
Memory::patchBytes((LPVOID) sigOffset, newCameraAngle, 3); | ||
} | ||
|
||
static void unpatch() { | ||
if(!patched) return; | ||
patched = false; | ||
Memory::patchBytes((LPVOID) sigOffset, originalCameraAngle.data(), 3); | ||
} | ||
|
||
void onRaknetTick(RaknetTickEvent &event) override { | ||
if (module->isEnabled()) { | ||
std::string serverIP = SDK::getServerIP(); | ||
if (serverIP.find("hive") != std::string::npos) { | ||
if (!module->restricted) { | ||
FlarialGUI::Notify("Can't use No Hurt Cam on " + serverIP); // TODO: move restrictions to API | ||
module->restricted = true; | ||
} | ||
} else { | ||
module->restricted = false; | ||
} | ||
} | ||
} | ||
|
||
void onTick(TickEvent &event) override { | ||
if (module->isEnabled() && !module->restricted) { | ||
patch(); | ||
} else { | ||
unpatch(); | ||
} | ||
} | ||
|
||
NoHurtCamListener(const char string[5], Module *module) { | ||
this->name = string; | ||
this->module = module; | ||
|
||
originalCameraAngle.resize(3); | ||
|
||
sigOffset = Memory::findSig(GET_SIG("CameraAssignAngle")) + 4; | ||
|
||
memcpy(originalCameraAngle.data(), (LPVOID) sigOffset, 3); | ||
} | ||
}; |