add: SetRank and fix: crash

This commit is contained in:
ALittlePatate
2022-10-01 13:47:20 +02:00
parent 45d39d6e64
commit a61b2eb18c
8 changed files with 46 additions and 11 deletions

View File

@@ -1,12 +1,16 @@
#include "OnUpdate.hpp"
#include <iostream>
#include "../Utils/Settings/Settings.hpp"
#include "../Dependencies/IL2CPP_Resolver/il2cpp_resolver.hpp"
#include "../Utils/Players/Players.hpp"
#include <iostream>
#include "../Features/Misc/Misc.hpp"
void OnUpdate() {
if (settings::big_flashlight) {
if (settings::spoof_level) {
Misc::SetRank(settings::new_level);
}
}

View File

@@ -220,9 +220,9 @@ void DrawMiscTab() {
#if _DEBUG
ImGui::Spacing();
std::string component = "PlayerCharacterBehaviour";
ImGui::InputText("##PlayerCharacterBehaviour", &component);
if (ImGui::Button("Dump component")) {
static std::string component = "NolanBehaviour";
ImGui::InputText("##component", &component);
if (ImGui::Button("FindObjectsOfType")) {
Dump(component);
}
#endif

View File

@@ -0,0 +1,5 @@
#include "Misc.hpp"
void Misc::SetRank(int rank) {
Players::LocalPlayer->GetComponent("NolanRankController")->CallMethodSafe<void*>("SetRank", rank);
}

View File

@@ -1,3 +1,11 @@
#pragma once
//misc hacks go here
#include "../Dependencies/IL2CPP_Resolver/il2cpp_resolver.hpp"
#include "../../Utils/Players/Players.hpp"
#include "../../Utils/Settings/Settings.hpp"
#include <iostream>
namespace Misc {
void SetRank(int rank);
}

View File

@@ -1,5 +1,6 @@
#include "Hooks.hpp"
#include "../Utils/Output/Output.hpp"
#include "../Dependencies/IL2CPP_Resolver/il2cpp_resolver.hpp"
#include "../Features/Menu.hpp"
#include "../dllmain.hpp"
@@ -31,6 +32,17 @@
}
*/
void CreateHooks() {
/*
//Exemple :
MH_STATUS SceneLoadLocalDoneStatus = MH_CreateHook((LPVOID*)test_sig, &hkSceneLoadLocalDone, reinterpret_cast<LPVOID*>(&oSceneLoadLocalDone));
//We say that for every call to the test_sig address we want to redirect it to the address of the function named test_hook (& gives the pointer to it)
//We can store the original pointer to the original function into test_org if we want to call the org later --> trampoline hook
//original_sum can be NULL if we don't want to trampoline hook
*/
}
typedef HRESULT(__stdcall* D3D11PresentHook) (IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
D3D11PresentHook phookD3D11Present = NULL;

View File

@@ -10,5 +10,6 @@
bool HookDX11();
void CreateHooks();
bool InitializeHooks();
void DisableHooks();

View File

@@ -5,6 +5,7 @@ namespace Players {
Unity::CGameObject* LocalPlayer = NULL;
}
void Players::GetPlayersThread() {
/*
* Will always lop and get the players + the localplayer
@@ -16,21 +17,23 @@ void Players::GetPlayersThread() {
while (1) {
PlayerList.clear();
auto list = Unity::Object::FindObjectsOfType<Unity::CComponent>("PlayerCharacterBehaviour");
auto list = Unity::Object::FindObjectsOfType<Unity::CComponent>("NolanBehaviour");
for (int i = 0; i < list->m_uMaxLength + 1; i++)
{
if (!list->operator[](i))
continue;
Unity::CGameObject* object = list->operator[](i)->GetMemberValue<Unity::CGameObject*>("gameObject"); //SurvivalPlayer(Clone)
if (object != NULL) {
PlayerList.push_back(object);
if (!object) {
continue;
}
PlayerList.push_back(object);
Unity::CComponent* BoltEntity = object->GetComponent("BoltEntity");
if (BoltEntity)
{
if (BoltEntity->CallMethod<bool>("get_IsOwner"))//local player check
if (BoltEntity->GetMemberValue<bool>("IsOwner"))//local player check
{
LocalPlayer = object;
}

View File

@@ -57,6 +57,8 @@ DWORD WINAPI Main() {
return false;
}
CreateHooks();
print("[+] Created hooks\n");
IL2CPP::Callback::Initialize();
IL2CPP::Callback::OnUpdate::Add(OnUpdate);