initial commit of the files

This commit is contained in:
2024-04-13 11:42:25 +02:00
commit 8f161be085
25 changed files with 1661065 additions and 0 deletions

50
framework/helpers.cpp Normal file
View File

@@ -0,0 +1,50 @@
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
// Helper functions
#include "pch-il2cpp.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <string>
#include <codecvt>
#include "helpers.h"
// Log file location
extern const LPCWSTR LOG_FILE;
// Helper function to get the module base address
uintptr_t il2cppi_get_base_address() {
return (uintptr_t) GetModuleHandleW(L"GameAssembly.dll");
}
// Helper function to append text to a file
void il2cppi_log_write(std::string text) {
HANDLE hfile = CreateFileW(LOG_FILE, FILE_APPEND_DATA, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hfile == INVALID_HANDLE_VALUE)
MessageBoxW(0, L"Could not open log file", 0, 0);
DWORD written;
WriteFile(hfile, text.c_str(), (DWORD) text.length(), &written, NULL);
WriteFile(hfile, "\r\n", 2, &written, NULL);
CloseHandle(hfile);
}
// Helper function to open a new console window and redirect stdout there
void il2cppi_new_console() {
AllocConsole();
freopen_s((FILE**) stdout, "CONOUT$", "w", stdout);
}
#if _MSC_VER >= 1920
// Helper function to convert Il2CppString to std::string
std::string il2cppi_to_string(Il2CppString* str) {
std::u16string u16(reinterpret_cast<const char16_t*>(str->chars));
return std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(u16);
}
// Helper function to convert System.String to std::string
std::string il2cppi_to_string(app::String* str) {
return il2cppi_to_string(reinterpret_cast<Il2CppString*>(str));
}
#endif