Add keyboard handling functionality
Added function that creates settings.ini file but it creates empty file :) I will deal with it later.
This commit is contained in:
@@ -597,12 +597,12 @@ HRESULT __stdcall hookD3D11Present(IDXGISwapChain* pSwapChain, UINT SyncInterval
|
||||
return phookD3D11Present(pSwapChain, SyncInterval, Flags);
|
||||
}
|
||||
|
||||
if (GetKeyState(VK_INSERT) & 0x8000) {
|
||||
if (GetKeyDown(KeyCode::Insert)) {
|
||||
pressed = true;
|
||||
}
|
||||
|
||||
|
||||
else if (!(GetKeyState(VK_INSERT) & 0x8000) && pressed) {
|
||||
else if (!GetKeyDown(KeyCode::Insert) && pressed) {
|
||||
open_menu = !open_menu;
|
||||
pressed = false;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
|
||||
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
|
||||
// Custom injected code entry point
|
||||
|
||||
#include "pch-il2cpp.h"
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "color.hpp"
|
||||
#include "UnityCore.h"
|
||||
#include "features/misc/misc.h"
|
||||
#include "utils/utils.hpp"
|
||||
|
||||
// Set the name of your log file here
|
||||
extern const LPCWSTR LOG_FILE = L"DevourClient.txt";
|
||||
@@ -25,21 +26,21 @@ extern const LPCWSTR LOG_FILE = L"DevourClient.txt";
|
||||
HMODULE myhModule = NULL;
|
||||
bool should_unhook = 0;
|
||||
DWORD __stdcall EjectThread(LPVOID lpParameter) {
|
||||
Sleep(100);
|
||||
Sleep(100);
|
||||
il2cpp_close_console();
|
||||
DisableHooks();
|
||||
FreeLibraryAndExitThread(myhModule, 0); //Freeing the module, that's why we needed the myhModule variable
|
||||
FreeLibraryAndExitThread(myhModule, 0); //Freeing the module, that's why we needed the myhModule variable
|
||||
}
|
||||
|
||||
// Custom injected code entry point
|
||||
void Run()
|
||||
{
|
||||
// Initialize thread data - DO NOT REMOVE
|
||||
il2cpp_thread_attach(il2cpp_domain_get());
|
||||
// Initialize thread data - DO NOT REMOVE
|
||||
il2cpp_thread_attach(il2cpp_domain_get());
|
||||
|
||||
|
||||
// If you would like to output to a new console window, use il2cppi_new_console() to open one and redirect stdout
|
||||
il2cppi_new_console();
|
||||
// If you would like to output to a new console window, use il2cppi_new_console() to open one and redirect stdout
|
||||
il2cppi_new_console();
|
||||
|
||||
std::cout << dye::green("\n\tDevourClient v2.0\n\t") << __DATE__ << " - " << __TIME__ << std::endl;
|
||||
std::cout << "\tDevour Version ";
|
||||
@@ -48,7 +49,7 @@ void Run()
|
||||
std::cout << dye::light_red("v") << dye::light_red(il2cppi_to_string(app::Application_get_version(NULL))) << "\n\n";
|
||||
else
|
||||
std::cout << "Unknown\n\n";
|
||||
|
||||
|
||||
std::cout << dye::light_aqua("\tMade with < 3 by patate and Jadis0x.\n\n");
|
||||
|
||||
uint64_t steamUserID = app::SteamUser_GetSteamID(nullptr).m_SteamID;
|
||||
@@ -73,7 +74,7 @@ void Run()
|
||||
}
|
||||
|
||||
CreateHooks();
|
||||
|
||||
|
||||
if (HookDX11()) {
|
||||
il2cppi_log_write("DirectX11 hooked");
|
||||
std::cout << "[DevourClient]: " << dye::aqua("DirectX11 hooked.\n");
|
||||
@@ -85,8 +86,15 @@ void Run()
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "[DevourClient]: " << dye::light_green("Done!:)\n\n");
|
||||
// create settings.ini
|
||||
std::string filename = "settings.ini";
|
||||
std::string key = "open_menu";
|
||||
std::string defaultValue = "INSERT"; // default value
|
||||
|
||||
// null file??
|
||||
std::string keyValue = ReadValueFromIni(filename, key, defaultValue);
|
||||
|
||||
std::cout << "[DevourClient]: " << dye::light_green("Done!:)\n\n");
|
||||
|
||||
std::string scene = SceneName();
|
||||
|
||||
@@ -107,16 +115,20 @@ void Run()
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (GetAsyncKeyState(VK_END) & 0x8000 || should_unhook)
|
||||
if (GetAsyncKeyState(VK_END) & 0x8000 || should_unhook) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (settings::fullBright)
|
||||
if (settings::fullBright) {
|
||||
Misc::FullBright();
|
||||
}
|
||||
|
||||
if (settings::fly)
|
||||
if (settings::fly) {
|
||||
//Misc::Fly(settings::fly_speed);
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(700));
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
CreateThread(0, 0, EjectThread, 0, 0, 0);
|
||||
}
|
||||
@@ -1,6 +1,32 @@
|
||||
#include "pch-il2cpp.h"
|
||||
#include "pch-il2cpp.h"
|
||||
#include "utils.hpp"
|
||||
#include "helpers.h"
|
||||
#include <map>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <Windows.h>
|
||||
|
||||
int GetKey(KeyCode code)
|
||||
{
|
||||
return static_cast<int>(code);
|
||||
}
|
||||
|
||||
bool GetKeyDown(KeyCode key)
|
||||
{
|
||||
// Convert KeyCode enum value to virtual keycode
|
||||
int vkey = GetKey(key);
|
||||
|
||||
// Check key state with GetKeyState
|
||||
return (GetKeyState(vkey) & 0x8000) != 0;
|
||||
}
|
||||
|
||||
bool GetKeyDownAsync(KeyCode key) {
|
||||
// Convert KeyCode enum value to virtual keycode
|
||||
int vkey = GetKey(key);
|
||||
|
||||
// Check key state with GetAsyncKeyState
|
||||
return (GetAsyncKeyState(vkey) & 0x8000) != 0;
|
||||
}
|
||||
|
||||
std::string ToString(app::Object* object) {
|
||||
std::string type = il2cppi_to_string(app::Object_ToString(object, NULL));
|
||||
@@ -10,3 +36,35 @@ std::string ToString(app::Object* object) {
|
||||
return type;
|
||||
}
|
||||
|
||||
std::string ReadValueFromIni(const std::string& filename, const std::string& key, const std::string& defaultValue)
|
||||
{
|
||||
std::ifstream file(filename);
|
||||
std::string line, value = defaultValue;
|
||||
|
||||
if (file.is_open()) {
|
||||
while (getline(file, line)) {
|
||||
std::istringstream is_line(line);
|
||||
std::string currentKey;
|
||||
if (getline(is_line, currentKey, '=')) {
|
||||
std::string currentValue;
|
||||
if (getline(is_line, currentValue)) {
|
||||
if (currentKey == key) {
|
||||
value = currentValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
else {
|
||||
// Create if file does not exist
|
||||
std::ofstream outFile(filename);
|
||||
outFile.close();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,151 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
// https://bytetool.web.app/en/ascii/
|
||||
enum class KeyCode {
|
||||
Undefined = -1,
|
||||
Backspace = 0x08,
|
||||
Tab = 0x09,
|
||||
Clear = 0x0C,
|
||||
Enter = 0x0D,
|
||||
Shift = 0x10,
|
||||
Ctrl = 0x11,
|
||||
Alt = 0x12,
|
||||
Pause = 0x13,
|
||||
CapsLock = 0x14,
|
||||
Esc = 0x1B,
|
||||
Spacebar = 0x20,
|
||||
PageUp = 0x21,
|
||||
PageDown = 0x22,
|
||||
End = 0x23,
|
||||
Home = 0x24,
|
||||
LeftArrow = 0x25,
|
||||
UpArrow = 0x26,
|
||||
RightArrow = 0x27,
|
||||
DownArrow = 0x28,
|
||||
Select = 0x29,
|
||||
Print = 0x2A,
|
||||
Execute = 0x2B,
|
||||
PrintScreen = 0x2C,
|
||||
Insert = 0x2D,
|
||||
Delete = 0x2E,
|
||||
Help = 0x2F,
|
||||
Key0 = 0x30,
|
||||
Key1 = 0x31,
|
||||
Key2 = 0x32,
|
||||
Key3 = 0x33,
|
||||
Key4 = 0x34,
|
||||
Key5 = 0x35,
|
||||
Key6 = 0x36,
|
||||
Key7 = 0x37,
|
||||
Key8 = 0x38,
|
||||
Key9 = 0x39,
|
||||
A = 0x41,
|
||||
B = 0x42,
|
||||
C = 0x43,
|
||||
D = 0x44,
|
||||
E = 0x45,
|
||||
F = 0x46,
|
||||
G = 0x47,
|
||||
H = 0x48,
|
||||
I = 0x49,
|
||||
J = 0x4A,
|
||||
K = 0x4B,
|
||||
L = 0x4C,
|
||||
M = 0x4D,
|
||||
N = 0x4E,
|
||||
O = 0x4F,
|
||||
P = 0x50,
|
||||
Q = 0x51,
|
||||
R = 0x52,
|
||||
S = 0x53,
|
||||
T = 0x54,
|
||||
U = 0x55,
|
||||
V = 0x56,
|
||||
W = 0x57,
|
||||
X = 0x58,
|
||||
Y = 0x59,
|
||||
Z = 0x5A,
|
||||
LeftWin = 0x5B,
|
||||
RightWin = 0x5C,
|
||||
Applications = 0x5D,
|
||||
Sleep = 0x5F,
|
||||
Numpad0 = 0x60,
|
||||
Numpad1 = 0x61,
|
||||
Numpad2 = 0x62,
|
||||
Numpad3 = 0x63,
|
||||
Numpad4 = 0x64,
|
||||
Numpad5 = 0x65,
|
||||
Numpad6 = 0x66,
|
||||
Numpad7 = 0x67,
|
||||
Numpad8 = 0x68,
|
||||
Numpad9 = 0x69,
|
||||
Multiply = 0x6A,
|
||||
Add = 0x6B,
|
||||
Separator = 0x6C,
|
||||
Subtract = 0x6D,
|
||||
Decimal = 0x6E,
|
||||
Divide = 0x6F,
|
||||
F1 = 0x70,
|
||||
F2 = 0x71,
|
||||
F3 = 0x72,
|
||||
F4 = 0x73,
|
||||
F5 = 0x74,
|
||||
F6 = 0x75,
|
||||
F7 = 0x76,
|
||||
F8 = 0x77,
|
||||
F9 = 0x78,
|
||||
F10 = 0x79,
|
||||
F11 = 0x7A,
|
||||
F12 = 0x7B,
|
||||
F13 = 0x7C,
|
||||
F14 = 0x7D,
|
||||
F15 = 0x7E,
|
||||
F16 = 0x7F,
|
||||
F17 = 0x80,
|
||||
F18 = 0x81,
|
||||
F19 = 0x82,
|
||||
F20 = 0x83,
|
||||
F21 = 0x84,
|
||||
F22 = 0x85,
|
||||
F23 = 0x86,
|
||||
F24 = 0x87,
|
||||
NumLock = 0x90,
|
||||
ScrollLock = 0x91,
|
||||
LeftShift = 0xA0,
|
||||
RightShift = 0xA1,
|
||||
LeftControl = 0xA2,
|
||||
RightControl = 0xA3,
|
||||
LeftMenu = 0xA4,
|
||||
RightMenu = 0xA5,
|
||||
BrowserBack = 0xA6,
|
||||
BrowserForward = 0xA7,
|
||||
BrowserRefresh = 0xA8,
|
||||
BrowserStop = 0xA9,
|
||||
BrowserSearch = 0xAA,
|
||||
BrowserFavorites = 0xAB,
|
||||
BrowserHome = 0xAC,
|
||||
VolumeMute = 0xAD,
|
||||
VolumeDown = 0xAE,
|
||||
VolumeUp = 0xAF,
|
||||
MediaNextTrack = 0xB0,
|
||||
MediaPrevTrack = 0xB1,
|
||||
MediaStop = 0xB2,
|
||||
MediaPlayPause = 0xB3,
|
||||
LaunchMail = 0xB4,
|
||||
LaunchMediaSelect = 0xB5,
|
||||
LaunchApp1 = 0xB6,
|
||||
LaunchApp2 = 0xB7
|
||||
};
|
||||
|
||||
int GetKey(KeyCode code); // Helper function to convert from KeyCode to int
|
||||
bool GetKeyDown(KeyCode key);
|
||||
bool GetKeyDownAsync(KeyCode key);
|
||||
|
||||
|
||||
std::string ToString(app::Object* object);
|
||||
|
||||
// helper function for reading ini files
|
||||
std::string ReadValueFromIni(const std::string& filename, const std::string& key, const std::string& defaultValue);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user