add: file logging, console output for dumper
also started walkinlobby but this is dumb i swear
This commit is contained in:
@@ -5,5 +5,13 @@ void Misc::SetRank(int rank) {
|
||||
}
|
||||
|
||||
void Misc::WalkInlobby(bool walk) {
|
||||
Players::LocalPlayer->GetComponent("UltimateCharacterLocomotionHandler")->GetGameObject()->SetActive(walk);
|
||||
if (!Players::LocalPlayer->GetComponent("UltimateCharacterLocomotionHandler")) {
|
||||
Unity::il2cppClass* Character = IL2CPP::Class::Find("Opsive.UltimateCharacterController.Character::UltimateCharacterLocomotionHandler");
|
||||
Unity::CGameObject* UltimateCharacterLocomotionHandler =
|
||||
if (!UltimateCharacterLocomotionHandler) {
|
||||
return;
|
||||
}
|
||||
|
||||
Players::LocalPlayer->AddComponent(UltimateCharacterLocomotionHandler);
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,8 @@ std::vector<Unity::il2cppMethodInfo*> Dumper::DumpMethods(std::string component,
|
||||
|
||||
std::vector<std::string> Dumper::DumpMethodsString(std::string component, std::string classname) {
|
||||
std::vector<std::string> methods_to_return;
|
||||
print("\nDumping methods of %s...\n", classname.c_str());
|
||||
|
||||
std::vector<Unity::il2cppMethodInfo*> methods = Dumper::DumpMethods(component, classname);
|
||||
|
||||
for (Unity::il2cppMethodInfo* method : methods) {
|
||||
@@ -30,7 +32,9 @@ std::vector<std::string> Dumper::DumpMethodsString(std::string component, std::s
|
||||
return methods_to_return;
|
||||
}
|
||||
|
||||
methods_to_return.push_back(method->m_pName);
|
||||
std::string name = method->m_pName;
|
||||
methods_to_return.push_back(name);
|
||||
print("--> %s\n", name.c_str());
|
||||
}
|
||||
|
||||
return methods_to_return;
|
||||
@@ -59,6 +63,7 @@ std::vector<Unity::CComponent*> Dumper::DumpClasses(std::string component) {
|
||||
|
||||
std::vector<std::string> Dumper::DumpClassesString(std::string component) {
|
||||
std::vector<std::string> classes_to_return;
|
||||
print("\nDumping classes of %s...\n",component.c_str());
|
||||
|
||||
std::vector<Unity::CComponent*> classes = Dumper::DumpClasses(component);
|
||||
for (Unity::CComponent* class_obj : classes)
|
||||
@@ -66,7 +71,9 @@ std::vector<std::string> Dumper::DumpClassesString(std::string component) {
|
||||
if (!class_obj)
|
||||
continue;
|
||||
|
||||
classes_to_return.push_back(std::string(class_obj->m_Object.m_pClass->m_pNamespace) + "::" + std::string(class_obj->m_Object.m_pClass->m_pName));
|
||||
std::string name = std::string(class_obj->m_Object.m_pClass->m_pNamespace) + "::" + std::string(class_obj->m_Object.m_pClass->m_pName);
|
||||
classes_to_return.push_back(name);
|
||||
print("--> %s\n", name.c_str());
|
||||
}
|
||||
return classes_to_return;
|
||||
}
|
||||
@@ -87,6 +94,7 @@ std::vector<Unity::CComponent*> Dumper::DumpComponents() {
|
||||
|
||||
std::vector<std::string> Dumper::DumpComponentsString() {
|
||||
std::vector<std::string> compenents_to_return;
|
||||
print("\nDumping components...\n");
|
||||
|
||||
std::vector<Unity::CComponent*> components = Dumper::DumpComponents();
|
||||
for (Unity::CComponent* component : components)
|
||||
@@ -95,7 +103,9 @@ std::vector<std::string> Dumper::DumpComponentsString() {
|
||||
continue;
|
||||
|
||||
Unity::CGameObject* object = component->GetMemberValue<Unity::CGameObject*>("gameObject");
|
||||
compenents_to_return.push_back(object->GetName()->ToString());
|
||||
std::string name = object->GetName()->ToString();
|
||||
compenents_to_return.push_back(name);
|
||||
}
|
||||
|
||||
return compenents_to_return;
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include "Output.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#define LOG
|
||||
#define TO_FILE
|
||||
constexpr auto LOGS_FILENAME = "DevourClient-dev.log";
|
||||
|
||||
#if _DEBUG //We'll need fp to write into the console, using it on debug builds only
|
||||
FILE* fp;
|
||||
@@ -22,6 +24,10 @@ bool OpenConsole() {
|
||||
Else we return false
|
||||
The booleans are used for the debug_mode variable, this can be usefull probably
|
||||
*/
|
||||
#ifdef TO_FILE
|
||||
std::remove(LOGS_FILENAME);
|
||||
#endif
|
||||
|
||||
#if _DEBUG
|
||||
AllocConsole();
|
||||
freopen_s(&fp, "CONOUT$", "w", stdout); // output only
|
||||
@@ -34,11 +40,27 @@ bool print(const char* fmt, ...) {
|
||||
/*
|
||||
Just a wrapper for std::cout, this skips the whole if _DEBUG thing
|
||||
*/
|
||||
#if _DEBUG
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
#ifdef TO_FILE
|
||||
FILE* f;
|
||||
fopen_s(&f, LOGS_FILENAME, "a");
|
||||
if (f)
|
||||
{
|
||||
vfprintf(f, fmt, args);
|
||||
fclose(f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _DEBUG
|
||||
vprintf(fmt, args);
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
|
||||
#if _DEBUG
|
||||
return true;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user