Skip to content

Commit

Permalink
Update to 1.19.63
Browse files Browse the repository at this point in the history
  • Loading branch information
szerookii committed Feb 27, 2023
1 parent ac875de commit 3be3acd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
8 changes: 4 additions & 4 deletions AutoSprint/AutoSprint.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down
30 changes: 23 additions & 7 deletions AutoSprint/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,32 @@
#include <filesystem>
#include <fstream>
#include <sstream>
#include <Shlobj.h>

#pragma warning(disable : 4996)

#include "lib/MinHook.h"

std::wstring acFolderPath;
std::wofstream modLog;

#define INRANGE(x,a,b) (x >= a && x <= b)
#define GET_BYTE( x ) (GET_BITS(x[0]) << 4 | GET_BITS(x[1]))
#define GET_BITS( x ) (INRANGE((x&(~0x20)),'A','F') ? ((x&(~0x20)) - 'A' + 0xa) : (INRANGE(x,'0','9') ? x - '0' : 0))

uintptr_t findSig(const char* szSignature) {
const char* pattern = szSignature;
uintptr_t firstMatch = 0;

static const uintptr_t rangeStart = (uintptr_t)GetModuleHandleA("Minecraft.Windows.exe");
static MODULEINFO miModInfo;
static bool init = false;

if (!init) {
init = true;
GetModuleInformation(GetCurrentProcess(), (HMODULE)rangeStart, &miModInfo, sizeof(MODULEINFO));
}

static const uintptr_t rangeEnd = rangeStart + miModInfo.SizeOfImage;

BYTE patByte = GET_BYTE(pattern);
Expand Down Expand Up @@ -84,17 +91,19 @@ struct Vec3 {

class Player {
public:
Vec3 velocity() {
return *(Vec3*)((uintptr_t)(this) + 0x4f0);
Vec3 position() {
return *(Vec3*)((uintptr_t)(this) + 0x7BC);
}

void setSprinting(bool value) {
using setSprinting = void(*)(void*, bool);
static uintptr_t setSprintingAddr = NULL;

if (setSprintingAddr == NULL)
setSprintingAddr = findSig("48 89 5C 24 ? 57 48 83 EC ? 48 8B 81 ? ? ? ? 0F B6 DA");

if (setSprintingAddr == NULL) {
setSprintingAddr = findSig("48 89 74 24 20 57 48 83 EC 30 48 8B 01 0F B6 F2 BA 03 00 00 00");
return;
}

((setSprinting)setSprintingAddr)(this, value);
}
};
Expand All @@ -114,7 +123,7 @@ void** getVtable(void* obj) {
void(*oGameMode_tick)(GameMode*);
void hGameMode_tick(GameMode* gm) {
if (gm->player != nullptr) {
if (gm->player->velocity().magnitudexz() > 0.05f) {
if (gm->player->position().magnitudexz() > 0.05f) {
gm->player->setSprinting(true);
}
}
Expand All @@ -125,7 +134,14 @@ void hGameMode_tick(GameMode* gm) {
void Inject(HINSTANCE hModule) {
MH_Initialize();

uintptr_t sigAddr = findSig("48 8D 05 ? ? ? ? 48 8B D9 48 89 01 8B FA 48 8B 89 ? ? ? ? 48 85 C9 74 ? 48 8B 01 BA ? ? ? ? FF 10 48 8B 8B");
PWSTR pAppDataPath;
SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &pAppDataPath);
acFolderPath = pAppDataPath;
CoTaskMemFree(pAppDataPath);

modLog.open(acFolderPath + L"\\AutoSprint.txt");

uintptr_t sigAddr = findSig("48 8D ? ? ? ? ? 48 8B D9 48 89 01 48 8B 89 B0 00 00 00 48 85 C9 74 11 48 8B 01 BA 01 00 00 00 48 8B 00 FF 15 ? ? ? ? 48 8B 8B A8 00 00 00 48 85 C9 74 17 48 8B 01 BA 01 00 00 00 48 8B 00 48 83 C4 20 5B 48 FF 25 ? ? ? ? 48 83 C4 20 5B C3 CC CC CC CC CC CC CC 48 89 5C 24 10 48 89 74 24 18 48 89 7C 24 20 55 41 56 41 57 48 8D 6C 24 A0 48 81 EC 60 01 00 00 48 8B ? ? ? ? ? 48 33 C4 48 89 45 50");

if (!sigAddr)
return;
Expand Down

0 comments on commit 3be3acd

Please sign in to comment.