Skip to content
This repository has been archived by the owner on Dec 26, 2021. It is now read-only.

Added Full CMake support + Fixed Errors #4504

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Lib/MinHook/GitHub"]
path = Lib/MinHook/GitHub
url = https://github.com/TsudaKageyu/minhook
362 changes: 28 additions & 334 deletions CMakeLists.txt

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions Horion.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<WholeProgramOptimization>false</WholeProgramOptimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /DUSING_VS %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
</ClCompile>
Expand All @@ -180,34 +180,37 @@
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<AdditionalDependencies>
</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)minhook;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>None</DebugInformationFormat>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /DUSING_VS %(AdditionalOptions)</AdditionalOptions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<WholeProgramOptimization>false</WholeProgramOptimization>
<PreprocessorDefinitions>_WINDLL;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)minhook;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='BetaConf|x64'">
<ClCompile>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DebugInformationFormat>None</DebugInformationFormat>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/Zc:__cplusplus /DUSING_VS %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>_BETA;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)minhook;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions Horion/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file(GLOB_RECURSE TargetFiles
"*.h"
"*.cpp")

target_sources(Horion PUBLIC ${TargetFiles})
11 changes: 8 additions & 3 deletions Horion/Loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ SlimUtils::SlimMem mem;
const SlimUtils::SlimModule* gameModule;
bool isRunning = true;

#if defined _M_X64
#ifdef USING_VS
#pragma comment(lib, "MinHook.x64.lib")
#elif defined _M_IX86
#pragma comment(lib, "MinHook.x86.lib")
#endif

// Shouldn't be used (breaks stuff)
// #if defined _M_X64
// #pragma comment(lib, "MinHook.x64.lib")
// #elif defined _M_IX86
// #pragma comment(lib, "MinHook.x86.lib")
// #endif

DWORD WINAPI keyThread(LPVOID lpParam) {
logF("Key thread started");

Expand Down
25 changes: 25 additions & 0 deletions Horion/Module/ModuleManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,31 @@ class ModuleManager {
}
return std::optional<std::shared_ptr<IModule>>();
}

void addModule(std::shared_ptr<IModule> mod) {
if (!mod) throw std::exception("mod was null.");
auto lock = this->lockModuleList();
for (auto& m : moduleList) {
if (m.get() == mod.get()) {
throw "Duplicate found.";
}
}
moduleList.push_back(mod);
}

void removeModule(std::shared_ptr<IModule> mod) {
if (mod.get() == nullptr) return;
auto lock = this->lockModuleList();
auto it = moduleList.begin();
for (; it != moduleList.end(); ++it) {
if (it->get() == mod.get()) {
goto remove_element;
}
}
return;
remove_element:
moduleList.erase(it);
}
};

extern ModuleManager* moduleMgr;
6 changes: 4 additions & 2 deletions Horion/Module/Modules/CrystalAura.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,10 @@ void CrystalAura::onTick(C_GameMode* gm) {
CPlace(gm, i->getPos());
else {
auto ptr = g_Data.getClientInstance()->getPointerStruct();
if (ptr->getEntity() == nullptr && ptr->rayHitType == 0)
CPlace(gm, &ptr->block.toFloatVector());
if (ptr->getEntity() == nullptr && ptr->rayHitType == 0) {
auto v = ptr->block.toFloatVector();
CPlace(gm, &v);
}
}
}
return;
Expand Down
2 changes: 1 addition & 1 deletion Horion/Module/Modules/TestModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ __forceinline unsigned __int64 rotBy(int in, unsigned int by) {
return ((mut & 0x7FFFFFui64) | ((static_cast<unsigned int>(in) >> 8u) & 0x800000u) /*copy sign bit*/) << by;
}

size_t posToHash(const vec3_ti& pos) {
static size_t posToHash(const vec3_ti& pos) {
return rotBy(pos.x, 0) | rotBy(pos.z, 24) | (static_cast<unsigned __int64>(pos.y) << 48u);
}

Expand Down
2 changes: 1 addition & 1 deletion Horion/path/JoePathFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ __forceinline unsigned __int64 rotBy(int in, unsigned int by){
return ((mut & 0x7FFFFFui64) | ((static_cast<unsigned int>(in) >> 8u) & 0x800000u)/*copy sign bit*/) << by;
}

__forceinline unsigned __int64 posToHash(const vec3_ti& pos){
static __forceinline unsigned __int64 posToHash(const vec3_ti& pos){
return rotBy(pos.x, 0) | rotBy(pos.z, 24) | (static_cast<unsigned __int64>(pos.y) << 48u);
}

Expand Down
1 change: 1 addition & 0 deletions Lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
add_subdirectory(MinHook)
3 changes: 3 additions & 0 deletions Lib/MinHook/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_subdirectory(GitHub)

target_include_directories(Horion PUBLIC "GitHub/include/")
1 change: 1 addition & 0 deletions Lib/MinHook/GitHub
Submodule GitHub added at 4a4555
5 changes: 5 additions & 0 deletions Memory/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file(GLOB_RECURSE TargetFiles
"*.h"
"*.cpp")

target_sources(Horion PUBLIC ${TargetFiles})
65 changes: 33 additions & 32 deletions Memory/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1606,44 +1606,45 @@ void prepCoolBean() {
}
if (count > 5) // we already added a server
goto end;
{
// make new one
BeansEntry* epic = new BeansEntry();
epic->nextEntry = listEnd;
epic->prevEntry = current;
epic->masterPlayer.setText("");
epic->unk = current->unk;
memcpy(epic->filler, current->filler, sizeof(BeansEntry::filler));
epic->masterPlayer2.setText("");
epic->serverName.setText("Epic");
memcpy(epic->filler2, current->filler2, sizeof(BeansEntry::filler2));

// make new one
BeansEntry* epic = new BeansEntry();
epic->nextEntry = listEnd;
epic->prevEntry = current;
epic->masterPlayer.setText("");
epic->unk = current->unk;
memcpy(epic->filler, current->filler, sizeof(BeansEntry::filler));
epic->masterPlayer2.setText("");
epic->serverName.setText("Epic");
memcpy(epic->filler2, current->filler2, sizeof(BeansEntry::filler2));

auto cT = current->start[0].get();
auto cT = current->start[0].get();

std::shared_ptr<ThirdPartyServer>* start = new std::shared_ptr<ThirdPartyServer>[1];
std::shared_ptr<ThirdPartyServer>* start = new std::shared_ptr<ThirdPartyServer>[1];

{
ThirdPartyServer* t = new ThirdPartyServer();

t->coolBoye = cT->coolBoye;
t->uuid.setText("");
t->masterPlayerAccount = cT->masterPlayerAccount;
t->lobbyDescription = cT->lobbyDescription;
t->pathToServerIcon.setText("");
t->serverName.setText("Horion Server");
t->serverName2.setText("Horion Server"); // This is the one actually displayed
t->domain.setText(".horionbeta.club");
t->serverAddress.setText("mc.horionbeta.club");
start[0] = std::shared_ptr<ThirdPartyServer>(t);
}
{
ThirdPartyServer* t = new ThirdPartyServer();

t->coolBoye = cT->coolBoye;
t->uuid.setText("");
t->masterPlayerAccount = cT->masterPlayerAccount;
t->lobbyDescription = cT->lobbyDescription;
t->pathToServerIcon.setText("");
t->serverName.setText("Horion Server");
t->serverName2.setText("Horion Server"); // This is the one actually displayed
t->domain.setText(".horionbeta.club");
t->serverAddress.setText("mc.horionbeta.club");
start[0] = std::shared_ptr<ThirdPartyServer>(t);
}

epic->start = start;
epic->end = &start[1];
epic->start = start;
epic->end = &start[1];

current->nextEntry = epic;
current->nextEntry = epic;

// increase count
*reinterpret_cast<__int64*>(g_Data.getClientInstance()->minecraftGame->getServerEntries() + 0x50) += 1;
// increase count
*reinterpret_cast<__int64*>(g_Data.getClientInstance()->minecraftGame->getServerEntries() + 0x50) += 1;
}
end:;
}
}
Expand Down
4 changes: 4 additions & 0 deletions SDK/CItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ C_Item ***ItemRegistry::lookUpByName(void *a1, void *a2, TextHolder &text) {
return ItemRegistry__lookupByNameF(a1, a2, text);
}

C_Item ***ItemRegistry::lookUpByName(void *a1, void *a2, TextHolder&& text) {
return lookUpByName(a1, a2, static_cast<TextHolder&>(text));
}

ItemDescriptor::ItemDescriptor(int id, int16_t itemData) {
using ItemDescriptor__ItemDescriptor_t = ItemDescriptor*(__fastcall *)(ItemDescriptor*,int,int16_t);
static ItemDescriptor__ItemDescriptor_t func = reinterpret_cast<ItemDescriptor__ItemDescriptor_t>(FindSignature("48 89 5C 24 ? 55 56 57 48 83 EC ? 33 ED 48 8B D9 48 89 29 41 8B F8 48 89 69 ? 8B F2 48 89 69 ? 66 89 69 ? C6 41"));
Expand Down
1 change: 1 addition & 0 deletions SDK/CItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,5 @@ class ItemRegistry {
public:
static C_Item*** getItemFromId(void* ptr, int itemId);
static C_Item*** lookUpByName(void*, void*, TextHolder&);
static C_Item*** lookUpByName(void*, void*, TextHolder&&);
};
5 changes: 5 additions & 0 deletions SDK/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file(GLOB_RECURSE TargetFiles
"*.h"
"*.cpp")

target_sources(Horion PUBLIC ${TargetFiles})