// 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 #include #include #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); } void il2cpp_close_console() { fclose((FILE *)stdout); FreeConsole(); } #if _MSC_VER >= 1920 // Helper function to convert Il2CppString to std::string std::string il2cppi_to_string(Il2CppString* str) { std::u16string u16(reinterpret_cast(str->chars)); return std::wstring_convert, 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(str)); } #endif