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

27
framework/dllmain.cpp Normal file
View File

@@ -0,0 +1,27 @@
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
// DLL entry point
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "il2cpp-init.h"
#include "main.h"
// DLL entry point
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
init_il2cpp();
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) Run, NULL, 0, NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

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

44
framework/helpers.h Normal file
View File

@@ -0,0 +1,44 @@
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
// Helper functions
#pragma once
#include <string>
#include <sstream>
#include <iomanip>
#include "il2cpp-metadata-version.h"
// Helper function to get the module base address
uintptr_t il2cppi_get_base_address();
// Helper function to append text to a file
void il2cppi_log_write(std::string text);
// Helper function to open a new console window and redirect stdout there
void il2cppi_new_console();
#if _MSC_VER >= 1920
// Helper function to convert Il2CppString to std::string
std::string il2cppi_to_string(Il2CppString* str);
// Helper function to convert System.String to std::string
std::string il2cppi_to_string(app::String* str);
#endif
// Helper function to check if a metadata usage pointer is initialized
template<typename T> bool il2cppi_is_initialized(T* metadataItem) {
#if __IL2CPP_METADATA_VERISON < 270
return *metadataItem != 0;
#else
// Metadata >=27 (Unity 2020.2)
return !((uintptr_t) *metadataItem & 1);
#endif
}
// Helper function to convert a pointer to hex
template<typename T> std::string to_hex_string(T i) {
std::stringstream stream;
stream << "0x" << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex << i;
return stream.str();
}

View File

@@ -0,0 +1,33 @@
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
// IL2CPP application data
#pragma once
#include <cstdint>
// Application-specific types
#include "il2cpp-types.h"
// IL2CPP API function pointers
#include "il2cpp-api-functions-ptr.h"
// IL2CPP APIs
#define DO_API(r, n, p) extern r (*n) p
#include "il2cpp-api-functions.h"
#undef DO_API
// Application-specific functions
#define DO_APP_FUNC(a, r, n, p) extern r (*n) p
#define DO_APP_FUNC_METHODINFO(a, n) extern struct MethodInfo ** n
namespace app {
#include "il2cpp-functions.h"
}
#undef DO_APP_FUNC
#undef DO_APP_FUNC_METHODINFO
// TypeInfo pointers
#define DO_TYPEDEF(a, n) extern n ## __Class** n ## __TypeInfo
namespace app {
#include "il2cpp-types-ptr.h"
}
#undef DO_TYPEDEF

55
framework/il2cpp-init.cpp Normal file
View File

@@ -0,0 +1,55 @@
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
// IL2CPP application initializer
#include "pch-il2cpp.h"
#include "il2cpp-appdata.h"
#include "il2cpp-init.h"
#include "helpers.h"
// IL2CPP APIs
#define DO_API(r, n, p) r (*n) p
#include "il2cpp-api-functions.h"
#undef DO_API
// Application-specific functions
#define DO_APP_FUNC(a, r, n, p) r (*n) p
#define DO_APP_FUNC_METHODINFO(a, n) struct MethodInfo ** n
namespace app {
#include "il2cpp-functions.h"
}
#undef DO_APP_FUNC
#undef DO_APP_FUNC_METHODINFO
// TypeInfo pointers
#define DO_TYPEDEF(a, n) n ## __Class** n ## __TypeInfo
namespace app {
#include "il2cpp-types-ptr.h"
}
#undef DO_TYPEDEF
// IL2CPP application initializer
void init_il2cpp()
{
// Get base address of IL2CPP module
uintptr_t baseAddress = il2cppi_get_base_address();
using namespace app;
// Define IL2CPP API function addresses
#define DO_API(r, n, p) n = (r (*) p)(baseAddress + n ## _ptr)
#include "il2cpp-api-functions.h"
#undef DO_API
// Define function addresses
#define DO_APP_FUNC(a, r, n, p) n = (r (*) p)(baseAddress + a)
#define DO_APP_FUNC_METHODINFO(a, n) n = (struct MethodInfo **)(baseAddress + a)
#include "il2cpp-functions.h"
#undef DO_APP_FUNC
#undef DO_APP_FUNC_METHODINFO
// Define TypeInfo variables
#define DO_TYPEDEF(a, n) n ## __TypeInfo = (n ## __Class**) (baseAddress + a);
#include "il2cpp-types-ptr.h"
#undef DO_TYPEDEF
}

7
framework/il2cpp-init.h Normal file
View File

@@ -0,0 +1,7 @@
// Generated C++ file by Il2CppInspector - http://www.djkaty.com - https://github.com/djkaty
// IL2CPP application initializer
#pragma once
// IL2CPP application initializer
void init_il2cpp();

5
framework/pch-il2cpp.cpp Normal file
View File

@@ -0,0 +1,5 @@
// pch.cpp: source file corresponding to the pre-compiled header
#include "pch-il2cpp.h"
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.

13
framework/pch-il2cpp.h Normal file
View File

@@ -0,0 +1,13 @@
// pch.h: This is a precompiled header file.
// Files listed below are compiled only once, improving build performance for future builds.
// This also affects IntelliSense performance, including code completion and many code browsing features.
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
// Do not add files here that you will be updating frequently as this negates the performance advantage.
#ifndef PCH_IL2CPP_H
#define PCH_IL2CPP_H
// add headers that you want to pre-compile here
#include "il2cpp-appdata.h"
#endif //PCH_IL2CPP_H