hooked: debug warning

This commit is contained in:
Jadis0x
2024-06-07 21:56:02 +03:00
parent 0b90598356
commit b644ca0fc4
2 changed files with 18 additions and 4 deletions

View File

@@ -44,10 +44,19 @@ bool open_menu = false;
} }
*/ */
// debug log
typedef void(__stdcall* TDebug_2_Log)(app::Object*, MethodInfo*); typedef void(__stdcall* TDebug_2_Log)(app::Object*, MethodInfo*);
TDebug_2_Log oDebug_2_Log = NULL; TDebug_2_Log oDebug_2_Log = NULL;
void __stdcall hDebug_Log(app::Object* message, MethodInfo* method) { void __stdcall hDebug_Log(app::Object* message, MethodInfo* method) {
std::cout << "[DevourClient]: " << ToString(message) << std::endl; std::cout << "[Log][DevourClient]: " << ToString(message) << std::endl;
il2cppi_log_write(ToString(message));
}
// LogWarning
typedef void(__stdcall* TDebug_2_LogWarning)(app::Object*, MethodInfo*);
TDebug_2_LogWarning oDebug_2_LogWarning = NULL;
void __stdcall hDebug_LogWarning(app::Object* message, MethodInfo* method) {
std::cout << "[Warning][DevourClient]: " << ToString(message) << std::endl;
il2cppi_log_write(ToString(message)); il2cppi_log_write(ToString(message));
} }
@@ -437,13 +446,20 @@ void CreateHooks() {
//original_sum can be NULL if we don't want to trampoline hook //original_sum can be NULL if we don't want to trampoline hook
*/ */
// DEBUG LOOK // DEBUG NORMAL
MH_STATUS status_Debug_Log = MH_CreateHook((LPVOID*)app::Debug_2_Log, &hDebug_Log, reinterpret_cast<LPVOID*>(&oDebug_2_Log)); MH_STATUS status_Debug_Log = MH_CreateHook((LPVOID*)app::Debug_2_Log, &hDebug_Log, reinterpret_cast<LPVOID*>(&oDebug_2_Log));
if (status_Debug_Log != MH_OK) { if (status_Debug_Log != MH_OK) {
std::cout << "Failed to create Debug_Log hook: " << MH_StatusToString(status_Debug_Log) << std::endl; std::cout << "Failed to create Debug_Log hook: " << MH_StatusToString(status_Debug_Log) << std::endl;
return; return;
} }
// DEBUG WARNING
MH_STATUS status_Debug_LogWarning = MH_CreateHook((LPVOID*)app::Debug_2_LogWarning, &hDebug_LogWarning, reinterpret_cast<LPVOID*>(&oDebug_2_LogWarning));
if (status_Debug_LogWarning != MH_OK) {
std::cout << "Failed to create Debug_LogWarning hook: " << MH_StatusToString(status_Debug_LogWarning) << std::endl;
return;
}
// UV HOOK // UV HOOK
MH_STATUS status_uv = MH_CreateHook((LPVOID*)app::NolanBehaviour_OnAttributeUpdateValue, &hNolanBehaviour_OnAttributeUpdateValue, reinterpret_cast<LPVOID*>(&oNolanBehaviour_OnAttributeUpdateValue)); MH_STATUS status_uv = MH_CreateHook((LPVOID*)app::NolanBehaviour_OnAttributeUpdateValue, &hNolanBehaviour_OnAttributeUpdateValue, reinterpret_cast<LPVOID*>(&oNolanBehaviour_OnAttributeUpdateValue));
if (status_uv != MH_OK) { if (status_uv != MH_OK) {

View File

@@ -15,6 +15,4 @@ bool InitializeHooks();
void DisableHooks(); void DisableHooks();
void hDebug_Log(app::Object* message, MethodInfo* method); void hDebug_Log(app::Object* message, MethodInfo* method);
void hDebug_LogError(app::Object* message, MethodInfo* method);
void hDebug_LogException(app::Exception* exception, MethodInfo* method);
void hDebug_LogWarning(app::Object* message, MethodInfo* method); void hDebug_LogWarning(app::Object* message, MethodInfo* method);