some helper functions added

-
This commit is contained in:
Jadis0x
2024-04-14 22:28:12 +03:00
parent db2dc7b321
commit aefdecc823
6 changed files with 59 additions and 3 deletions

View File

@@ -1,6 +1,9 @@
#include "pch-il2cpp.h"
#include "helpers.h"
#include "ClientHelper.h"
#include "wrapper.h"
bool IsSinglePlayer()
{
@@ -17,3 +20,42 @@ bool IsHost()
return app::BoltNetwork_get_IsServer(NULL);
}
app::Menu* get_HorrorMenu() {
Wrapper wrapper;
const Il2CppImage* image = wrapper.GetImage("Assembly-CSharp.dll");
// DO_APP_FUNC(0x0065B240, void, Menu_OnLobbyStartButtonClick, (Menu * __this, MethodInfo * method));
// menu.OnLobbyStartButtonClick();
Il2CppObject* object = wrapper.GetObjectFromClass(image, "Horror", "Menu");
if (object != nullptr) {
app::Object_1* Horror_MenuObject = app::Object_1_FindObjectOfType(reinterpret_cast<app::Type*>(object), nullptr);
if (Horror_MenuObject) {
app::Menu* HorrorMenu = reinterpret_cast<app::Menu*>(Horror_MenuObject);
if (HorrorMenu) {
return HorrorMenu;
}
}
}
return nullptr;
}
std::string get_SceneName()
{
app::SaveHelpers* SaveHelper = app::SaveHelpers_get_singleton(nullptr);
if (SaveHelper) {
std::string str = il2cppi_to_string(SaveHelper->fields.sceneName);
return str;
}
return std::string("unknown");
}

View File

@@ -1,5 +1,9 @@
#pragma once
#include <string>
bool IsSinglePlayer();
bool IsOnline();
bool IsHost();
app::Menu* get_HorrorMenu();
std::string get_SceneName();

View File

@@ -21,12 +21,10 @@ Wrapper::Wrapper()
if (assembly) {
const char* assemblyName = il2cpp_image_get_name(assembly->image);
assemblyMap[assemblyName] = assembly;
std::cout << "\t- " << assemblyName << std::endl;
}
}
}
const Il2CppAssembly* Wrapper::GetAssembly(const char* _assembly) {
for (const auto& entry : assemblyMap) {
if (strcmp(entry.first, _assembly) == 0) {

View File

@@ -3,6 +3,8 @@
#include "../main.h"
#include "../settings/settings.hpp"
#include "misc/misc.h"
#include <string>
#include <vector>
@@ -187,7 +189,7 @@ void DrawMapSpecificTab() {
}
if (ImGui::Button("Force start game")) {
//Misc::ForceStart();
Misc::ForceStart();
}
if (ImGui::Button("Knock out everyone")) {

View File

@@ -1,6 +1,7 @@
#include "pch-il2cpp.h"
#include "misc.h"
#include "ClientHelper.h"
void Misc::SetRank(int rank)
{
@@ -9,4 +10,12 @@ void Misc::SetRank(int rank)
void Misc::SetSteamName(std::string& name)
{
get_HorrorMenu()->fields.steamName = reinterpret_cast<app::String*>(il2cpp_string_new("0x"));
}
void Misc::ForceStart()
{
if (IsHost()) {
app::Menu_OnLobbyStartButtonClick(get_HorrorMenu(), nullptr);
}
}

View File

@@ -7,4 +7,5 @@
namespace Misc {
void SetRank(int rank);
void SetSteamName(std::string& name);
void ForceStart();
}