fix: DebugLog hooks, works now

This commit is contained in:
2024-04-13 18:07:02 +02:00
parent 435bccd6da
commit 33964e3081
5 changed files with 29 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
#include "Hooks.hpp"
#include "../features/menu.hpp"
#include "../main.h"
#include "../utils/utils.hpp"
#include <iostream>
#include "helpers.h"
@@ -39,8 +40,7 @@ TDebug_2_Log oDebug_2_Log = NULL;
TDebug_2_Log oDebug_2_Warning = NULL;
TDebug_2_Log oDebug_2_Error = NULL;
void __stdcall hDebug_Log(app::Object* message, MethodInfo* method) {
std::string log = il2cppi_to_string(app::Object_ToString(message, nullptr));
std::cout << log << "\n";
std::cout << ToString(message) << std::endl;
}
void CreateHooks() {

12
user/utils/utils.cpp Normal file
View File

@@ -0,0 +1,12 @@
#include "pch-il2cpp.h"
#include "utils.hpp"
#include "helpers.h"
std::string ToString(app::Object* object) {
std::string type = il2cppi_to_string(app::Object_ToString(object, NULL));
if (type == "System.String") {
return il2cppi_to_string((app::String*)object);
}
return type;
}

4
user/utils/utils.hpp Normal file
View File

@@ -0,0 +1,4 @@
#pragma once
#include <string>
std::string ToString(app::Object* object);