diff --git a/src/VERSIONINFO.rc b/src/VERSIONINFO.rc index e82868b..e2e4ef1 100644 --- a/src/VERSIONINFO.rc +++ b/src/VERSIONINFO.rc @@ -13,8 +13,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,36,0,0 - PRODUCTVERSION 1,36,0,0 + FILEVERSION 1,37,0,0 + PRODUCTVERSION 1,37,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -30,20 +30,20 @@ BEGIN BLOCK "000004b0" BEGIN VALUE "FileDescription", "Localization patch for Umamusume" - VALUE "FileVersion", "1.36.0.0" + VALUE "FileVersion", "1.37.0.0" VALUE "InternalName", "umamusume-localify" VALUE "LegalCopyright", "Copyright ⓒ Ji O Kim" VALUE "ProductName", "Umamusume Localify" - VALUE "ProductVersion", "1.36.0.0" + VALUE "ProductVersion", "1.37.0.0" END BLOCK "041204b0" BEGIN VALUE "FileDescription", "우마무스메 현지화 패치" - VALUE "FileVersion", "1.36.0.0" + VALUE "FileVersion", "1.37.0.0" VALUE "InternalName", "umamusume-localify" VALUE "LegalCopyright", "Copyright ⓒ Ji O Kim" VALUE "ProductName", "Umamusume Localify" - VALUE "ProductVersion", "1.36.0.0" + VALUE "ProductVersion", "1.37.0.0" END END BLOCK "VarFileInfo" diff --git a/src/config/config.cpp b/src/config/config.cpp index 3dfb686..fbccb6a 100644 --- a/src/config/config.cpp +++ b/src/config/config.cpp @@ -50,6 +50,7 @@ namespace config bool champions_live_show_text = false; int champions_live_resource_id = 1; int champions_live_year = 2023; + bool live_slider_always_show = false; /* * ModeNormal 0 * Mode60FPS 1 @@ -74,7 +75,7 @@ namespace config wstring text_id_dict; - WDocument code_map; + rapidjson::Document code_map; bool has_json_parse_error = false; wstring json_parse_error_msg; @@ -85,6 +86,13 @@ namespace config WDocument config_document; WDocument backup_document; + namespace runtime + { + bool useDefaultFPS = false; + float ratioVertical = 0.5625f; + float ratioHorizontal = 1.7777778f; + } + void read_config_init() { wifstream config_stream{ "config.json" }; @@ -269,6 +277,8 @@ if (document.HasMember(L##_name_) && document[L##_name_].Is##_type_())\ GetValue("characterSystemTextCaptionPositionY", Float, character_system_text_caption_position_y); + GetValue("liveSliderAlwaysShow", Bool, live_slider_always_show); + GetValue("championsLiveShowText", Bool, champions_live_show_text); GetValue("championsLiveResourceId", Int, champions_live_resource_id, @@ -297,12 +307,11 @@ if (document.HasMember(L##_name_) && document[L##_name_].Is##_type_())\ GetValue("textIdDict", String, text_id_dict); GetValue("codeMapPath", String, auto path, - wifstream code_map_stream{ path }; - code_map_stream.imbue(locale(".UTF-8")); + ifstream code_map_stream{ path }; if (code_map_stream.is_open()) { - rapidjson::WIStreamWrapper wrapper{ code_map_stream }; + rapidjson::IStreamWrapper wrapper{ code_map_stream }; code_map.ParseStream(wrapper); code_map_stream.close(); diff --git a/src/config/config.hpp b/src/config/config.hpp index 3dba91b..ad69610 100644 --- a/src/config/config.hpp +++ b/src/config/config.hpp @@ -9,6 +9,8 @@ #include #include +#define RAPIDJSON_HAS_STDSTRING 1 + #include #include #include @@ -78,6 +80,7 @@ namespace config extern bool champions_live_show_text; extern int champions_live_resource_id; extern int champions_live_year; + extern bool live_slider_always_show; /* * ModeNormal 0 * Mode60FPS 1 @@ -102,7 +105,7 @@ namespace config extern wstring text_id_dict; - extern WDocument code_map; + extern rapidjson::Document code_map; extern bool has_json_parse_error; extern wstring json_parse_error_msg; @@ -113,6 +116,13 @@ namespace config extern WDocument config_document; extern WDocument backup_document; + namespace runtime + { + extern bool useDefaultFPS; + extern float ratioVertical; + extern float ratioHorizontal; + } + void read_config_init(); bool read_config(); void write_config(); diff --git a/src/dllproxy/proxy.cpp b/src/dllproxy/proxy.cpp index 6bf09dc..96baad1 100644 --- a/src/dllproxy/proxy.cpp +++ b/src/dllproxy/proxy.cpp @@ -1,5 +1,7 @@ #include +#include "proxy.hpp" + extern "C" { void* GetFileVersionInfoA_Original = nullptr; @@ -23,7 +25,7 @@ extern "C" using namespace std; -namespace +namespace proxy { class version_init { @@ -46,25 +48,25 @@ namespace // Loading version.dll from another path is prohibited. //auto original_dll = LoadLibraryW(dll_path.data()); - auto original_dll = LoadLibraryW(L"version.win.dll"); + version = LoadLibraryW(L"version.win.dll"); - GetFileVersionInfoA_Original = GetProcAddress(original_dll, "GetFileVersionInfoA"); - GetFileVersionInfoByHandle_Original = GetProcAddress(original_dll, "GetFileVersionInfoByHandle"); - GetFileVersionInfoExA_Original = GetProcAddress(original_dll, "GetFileVersionInfoExA"); - GetFileVersionInfoExW_Original = GetProcAddress(original_dll, "GetFileVersionInfoExW"); - GetFileVersionInfoSizeA_Original = GetProcAddress(original_dll, "GetFileVersionInfoSizeA"); - GetFileVersionInfoSizeExA_Original = GetProcAddress(original_dll, "GetFileVersionInfoSizeExA"); - GetFileVersionInfoSizeExW_Original = GetProcAddress(original_dll, "GetFileVersionInfoSizeExW"); - GetFileVersionInfoSizeW_Original = GetProcAddress(original_dll, "GetFileVersionInfoSizeW"); - GetFileVersionInfoW_Original = GetProcAddress(original_dll, "GetFileVersionInfoW"); - VerFindFileA_Original = GetProcAddress(original_dll, "VerFindFileA"); - VerFindFileW_Original = GetProcAddress(original_dll, "VerFindFileW"); - VerInstallFileA_Original = GetProcAddress(original_dll, "VerInstallFileA"); - VerInstallFileW_Original = GetProcAddress(original_dll, "VerInstallFileW"); - VerLanguageNameA_Original = GetProcAddress(original_dll, "VerLanguageNameA"); - VerLanguageNameW_Original = GetProcAddress(original_dll, "VerLanguageNameW"); - VerQueryValueA_Original = GetProcAddress(original_dll, "VerQueryValueA"); - VerQueryValueW_Original = GetProcAddress(original_dll, "VerQueryValueW"); + GetFileVersionInfoA_Original = GetProcAddress(version, "GetFileVersionInfoA"); + GetFileVersionInfoByHandle_Original = GetProcAddress(version, "GetFileVersionInfoByHandle"); + GetFileVersionInfoExA_Original = GetProcAddress(version, "GetFileVersionInfoExA"); + GetFileVersionInfoExW_Original = GetProcAddress(version, "GetFileVersionInfoExW"); + GetFileVersionInfoSizeA_Original = GetProcAddress(version, "GetFileVersionInfoSizeA"); + GetFileVersionInfoSizeExA_Original = GetProcAddress(version, "GetFileVersionInfoSizeExA"); + GetFileVersionInfoSizeExW_Original = GetProcAddress(version, "GetFileVersionInfoSizeExW"); + GetFileVersionInfoSizeW_Original = GetProcAddress(version, "GetFileVersionInfoSizeW"); + GetFileVersionInfoW_Original = GetProcAddress(version, "GetFileVersionInfoW"); + VerFindFileA_Original = GetProcAddress(version, "VerFindFileA"); + VerFindFileW_Original = GetProcAddress(version, "VerFindFileW"); + VerInstallFileA_Original = GetProcAddress(version, "VerInstallFileA"); + VerInstallFileW_Original = GetProcAddress(version, "VerInstallFileW"); + VerLanguageNameA_Original = GetProcAddress(version, "VerLanguageNameA"); + VerLanguageNameW_Original = GetProcAddress(version, "VerLanguageNameW"); + VerQueryValueA_Original = GetProcAddress(version, "VerQueryValueA"); + VerQueryValueW_Original = GetProcAddress(version, "VerQueryValueW"); }; }; diff --git a/src/dllproxy/proxy.hpp b/src/dllproxy/proxy.hpp new file mode 100644 index 0000000..8a3931f --- /dev/null +++ b/src/dllproxy/proxy.hpp @@ -0,0 +1,4 @@ +namespace proxy +{ + static HMODULE version; +} diff --git a/src/hook.cpp b/src/hook.cpp index 873115c..b92850e 100644 --- a/src/hook.cpp +++ b/src/hook.cpp @@ -16,6 +16,8 @@ #include #include +#include + #include #include @@ -69,6 +71,48 @@ #include "smtc/SystemMediaTransportControlsManager.hpp" +#include "scripts/mscorlib/System/Boolean.hpp" +#include "scripts/mscorlib/System/Enum.hpp" +#include "scripts/mscorlib/System/Int32.hpp" +#include "scripts/mscorlib/System/Collections/Generic/Dictionary.hpp" + +#include "scripts/CriMw.CriWare.Runtime/CriWare/CriAtomEx.hpp" +#include "scripts/CriMw.CriWare.Runtime/CriWare/CriAtomExPlayback.hpp" + +#include "scripts/Cute.Cri.Assembly/Cute/Cri/AudioPlayback.hpp" +#include "scripts/Cute.Cri.Assembly/Cute/Cri/MoviePlayerHandle.hpp" + +#include "scripts/UnityEngine.CoreModule/UnityEngine/Application.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Object.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/GameObject.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/RectTransform.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Vector2.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Vector3.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Vector2Int.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Rect.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Resolution.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Screen.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/ScreenOrientation.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/Scene.hpp" +#include "scripts/UnityEngine.TextRenderingModule/UnityEngine/TextGenerationSettings.hpp" + +#include "scripts/umamusume/Gallop/DialogCommonBase.hpp" +#include "scripts/umamusume/Gallop/UIManager.hpp" +#include "scripts/umamusume/Gallop/LiveViewController.hpp" +#include "scripts/umamusume/Gallop/RaceCameraManager.hpp" +#include "scripts/umamusume/Gallop/LowResolutionCameraUtil.hpp" +#ifdef _MSC_VER +#include "scripts/umamusume/Gallop/StandaloneWindowResize.hpp" +#endif + +#include "scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredBool.hpp" +#include "scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredInt.hpp" +#include "scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredLong.hpp" + +#include "string_utils.hpp" + +#include "dllproxy/proxy.hpp" + using namespace std; using namespace Microsoft::WRL; @@ -116,29 +160,6 @@ namespace printf("\n\n"); } - void Exit() - { - if (Game::CurrentGameRegion == Game::Region::KOR) - { - auto module_path = filesystem::current_path(); - auto uncheater_path_new = module_path.string().append("\\umamusume_Data\\StreamingAssets\\_Uncheater"s).data(); - auto uncheater_path = module_path.string().append("\\umamusume_Data\\StreamingAssets\\Uncheater"s).data(); - if (filesystem::exists(uncheater_path_new)) - { - try - { - filesystem::rename(uncheater_path_new, uncheater_path); - } - catch (exception& e) - { - cout << "Uncheater rename error: " << e.what() << endl; - } - } - } - - TerminateProcess(GetCurrentProcess(), 0); - } - void* InitializeApplication_orig = nullptr; void InitializeApplication_hook() { @@ -155,31 +176,6 @@ namespace void PrintStackTrace(); - void* Application_Quit_orig; - - void Application_Quit_hook(int exitCode) - { - if (Game::CurrentGameRegion == Game::Region::KOR) - { - auto StackTrace = il2cpp_symbols::get_class("mscorlib.dll", "System.Diagnostics", "StackFrame"); - auto trace = il2cpp_object_new(StackTrace); - il2cpp_class_get_method_from_name_type(trace->klass, ".ctor", 2)->methodPointer(trace, 0, false); - - auto methodRef = il2cpp_class_get_method_from_name_type(trace->klass, "GetMethod", 0)->methodPointer(trace); - - auto method = il2cpp_method_get_from_reflection(methodRef); - - if (string(method->klass->name).find("Uncheater") != string::npos || - string(method->klass->name).find("Boot") != string::npos || - string(method->name).find("Uncheater") != string::npos) - { - return; - } - } - - Exit(); - } - void* UpdateDispatcher_Initialize_orig = nullptr; void UpdateDispatcher_Initialize_hook() { @@ -196,6 +192,7 @@ namespace void init_il2cpp(bool attachIl2CppThread = false) { il2cpp_symbols::init_defaults(); + il2cpp_symbols::call_init_callbacks(); Il2CppThread* t = nullptr; @@ -208,10 +205,6 @@ namespace MH_CreateHook(InitializeApplication, InitializeApplication_hook, &InitializeApplication_orig); MH_EnableHook(InitializeApplication); - auto Application_Quit = il2cpp_resolve_icall("UnityEngine.Application::Quit(System.Int32)"); - MH_CreateHook(Application_Quit, Application_Quit_hook, &Application_Quit_orig); - MH_EnableHook(Application_Quit); - auto UpdateDispatcher_Initialize_addr = il2cpp_symbols::get_method_pointer("Cute.Core.Assembly.dll", "Cute.Core", "UpdateDispatcher", "Initialize", IgnoreNumberOfArguments); MH_CreateHook(UpdateDispatcher_Initialize_addr, UpdateDispatcher_Initialize_hook, &UpdateDispatcher_Initialize_orig); MH_EnableHook(UpdateDispatcher_Initialize_addr); @@ -270,7 +263,6 @@ namespace bool isRequiredInitNotification = true; - FieldInfo* il2cpp_class_get_field_from_name_wrap(Il2CppClass* klass, const char* name); Il2CppObject* GetSingletonInstance(Il2CppClass* klass); bool (*uobject_IsNativeObjectAlive)(Il2CppObject* uObject); @@ -296,8 +288,7 @@ namespace void ShowUINotification(Il2CppString* text) { - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - il2cpp_class_get_method_from_name_type(uiManager->klass, "ShowNotification", 1)->methodPointer(uiManager, text); + Gallop::UIManager::Instance().ShowNotification(text); } void ShowNotification(Il2CppString* text) @@ -486,12 +477,12 @@ namespace auto canvasGroupTransform = il2cpp_class_get_method_from_name_type(canvasGroup->klass, "get_transform", 0)->methodPointer(canvasGroup); - auto position = il2cpp_class_get_method_from_name_type(canvasGroupTransform->klass, "get_position", 0)->methodPointer(canvasGroupTransform); + auto position = il2cpp_class_get_method_from_name_type(canvasGroupTransform->klass, "get_position", 0)->methodPointer(canvasGroupTransform); position.x = x; position.y = y; - il2cpp_class_get_method_from_name_type(canvasGroupTransform->klass, "set_position", 1)->methodPointer(canvasGroupTransform, position); + il2cpp_class_get_method_from_name_type(canvasGroupTransform->klass, "set_position", 1)->methodPointer(canvasGroupTransform, position); } void ShowCaptionByNotification(Il2CppObject* audioManager, Il2CppObject* elem) @@ -536,9 +527,9 @@ namespace return; } - auto u8Text = local::wide_u8(text->chars); - replaceAll(u8Text, "\n\n", " "); - replaceAll(u8Text, "\n", " "); + auto wText = wstring(text->chars); + replaceAll(wText, L"\n\n", L" "); + replaceAll(wText, L"\n", L" "); if (notification && wstring(cueSheet->chars).find(L"_home_") == string::npos && wstring(cueSheet->chars).find(L"_tc_") == string::npos && wstring(cueSheet->chars).find(L"_title_") == string::npos && @@ -587,7 +578,7 @@ namespace SetNotificationDisplayTime(length); - ShowNotification(LineHeadWrap(il2cpp_string_new(u8Text.data()), config::character_system_text_caption_line_char_count)); + ShowNotification(LineHeadWrap(il2cpp_string_new16(wText.data()), config::character_system_text_caption_line_char_count)); } } @@ -617,7 +608,7 @@ namespace } void* criAtomExAcb_GetCueInfoById_orig = nullptr; - bool criAtomExAcb_GetCueInfoById_hook(void* acb_hn, int id, CueInfo* info) + bool criAtomExAcb_GetCueInfoById_hook(void* acb_hn, int id, CriWare::CriAtomEx::CueInfo* info) { auto result = reinterpret_cast(criAtomExAcb_GetCueInfoById_orig)(acb_hn, id, info); @@ -628,7 +619,7 @@ namespace const regex r(R"(_(?:9)*(\d{4})(?:\d{2})*_(\d{4})*_*(\d{2})*(?:\d{2})*$)"); smatch stringMatch; const auto cueSheet = string(info->name); - const auto cueSheet16 = local::u8_wide(cueSheet); + const auto cueSheet16 = u8_wide(cueSheet); regex_search(cueSheet, stringMatch, r); if (!stringMatch.empty()) { @@ -683,7 +674,7 @@ namespace } void* criAtomExAcb_GetCueInfoByName_orig = nullptr; - bool criAtomExAcb_GetCueInfoByName_hook(void* acb_hn, char* name, CueInfo* info) + bool criAtomExAcb_GetCueInfoByName_hook(void* acb_hn, char* name, CriWare::CriAtomEx::CueInfo* info) { auto result = reinterpret_cast(criAtomExAcb_GetCueInfoByName_orig)(acb_hn, name, info); @@ -695,7 +686,7 @@ namespace const regex r(R"((\d{4})(?:\d{2})*_(\d{4})*_*(\d{2})*(?:\d{2})*$)"); smatch stringMatch; const auto cueSheet = string(info->name); - const auto cueSheet16 = local::u8_wide(cueSheet); + const auto cueSheet16 = u8_wide(cueSheet); regex_search(cueSheet, stringMatch, r); if (!stringMatch.empty()) { @@ -854,12 +845,12 @@ namespace { splited.emplace_back(segment); } - auto fileName = local::u8_wide(splited.back()); + auto fileName = u8_wide(splited.back()); if (config::replace_assets.find(fileName) != config::replace_assets.end()) { auto& replaceAsset = config::replace_assets.at(fileName); - reinterpret_cast(CriMana_SetFileNew_orig)(player_id, binder, local::wide_u8(replaceAsset.path).data()); + reinterpret_cast(CriMana_SetFileNew_orig)(player_id, binder, wide_u8(replaceAsset.path).data()); return; } @@ -878,12 +869,12 @@ namespace { splited.emplace_back(segment); } - auto fileName = local::u8_wide(splited.back()); + auto fileName = u8_wide(splited.back()); if (config::replace_assets.find(fileName) != config::replace_assets.end()) { auto& replaceAsset = config::replace_assets.at(fileName); - return reinterpret_cast(CriMana_SetFileAppend_orig)(player_id, binder, local::wide_u8(replaceAsset.path).data(), repeat); + return reinterpret_cast(CriMana_SetFileAppend_orig)(player_id, binder, wide_u8(replaceAsset.path).data(), repeat); } return reinterpret_cast(CriMana_SetFileAppend_orig)(player_id, binder, path, repeat); @@ -978,13 +969,6 @@ namespace } )), NULL); - /*auto hWnd = FindWindowA("UnityWndClass", local::wide_acp(title).data()); - - if (!hWnd) - { - hWnd = FindWindowA("UnityWndClass", local::wide_acp(L"umamusume").data()); - }*/ - return hWndFound; } @@ -1036,7 +1020,7 @@ namespace void* KGInterfaceBrokerRequest_orig = nullptr; LPCWSTR KGInterfaceBrokerRequest_hook(const wchar_t* request) { - auto text = local::wide_u8(request); + auto text = wide_u8(request); #ifdef _DEBUG replaceAll(text, "gameWeb", "googlePlay"); @@ -1072,7 +1056,7 @@ namespace } } - auto data = reinterpret_cast(KGInterfaceBrokerRequest_orig)(local::u8_wide(text).data()); + auto data = reinterpret_cast(KGInterfaceBrokerRequest_orig)(u8_wide(text).data()); return data; } @@ -1277,101 +1261,17 @@ namespace return reinterpret_cast(load_library_w_orig)(lpLibFileName); } - FieldInfo* il2cpp_class_get_field_from_name_wrap(Il2CppClass* klass, const char* name) - { - if (config::code_map.IsNull() || config::code_map.HasParseError()) - { - return il2cpp_class_get_field_from_name(klass, name); - } - auto className = local::u8_wide(string(klass->namespaze).append(".").append(klass->name)); - auto nameW = local::u8_wide(name); - - if (config::code_map.HasMember(L"!common")) - { - auto commonMap = config::code_map[L"!common"].GetObjectW(); - if (commonMap.HasMember(nameW)) - { - auto field = il2cpp_class_get_field_from_name(klass, local::wide_u8(commonMap[nameW].GetString()).data()); - if (field) - { - return field; - } - } - } - - if (!config::code_map.HasMember(className.data())) - { - return il2cpp_class_get_field_from_name(klass, name); - } - - auto classMap = config::code_map[className.data()].GetObjectW(); - - if (classMap.HasMember(nameW)) - { - auto field = il2cpp_class_get_field_from_name(klass, local::wide_u8(classMap[nameW].GetString()).data()); - if (field) - { - return field; - } - } - - if (classMap.HasMember((nameW + L".index"s).data())) - { - void* iter = nullptr; - int i = 0; - int index = classMap[(nameW + L".index"s).data()].GetInt(); - while (FieldInfo* field = il2cpp_class_get_fields(klass, &iter)) - { - if (index == i) - { - return field; - } - i++; - } - } - - if (classMap.HasMember(L"!extends")) - { - auto parentName = classMap[L"!extends"].GetString(); - auto parentMap = config::code_map[parentName].GetObjectW(); - auto parentClass = klass->parent; - - if (parentMap.HasMember((nameW + L".index"s).data())) - { - void* iter = nullptr; - int i = 0; - int index = parentMap[(nameW + L".index"s).data()].GetInt(); - while (FieldInfo* field = il2cpp_class_get_fields(parentClass, &iter)) - { - if (index == i) - { - return field; - } - i++; - } - } - } - - return il2cpp_class_get_field_from_name(klass, name);; - } - Il2CppObject* fontAssets = nullptr; vector replaceAssets; - vector replaceAssetNames; + vector replaceAssetNames; Il2CppObject* (*load_from_file)(Il2CppString* path); Il2CppObject* (*load_asset)(Il2CppObject* _this, Il2CppString* name, Il2CppObject* runtimeType); - Il2CppArraySize* (*get_all_asset_names)(Il2CppObject* _this); - - Il2CppString* (*uobject_get_name)(Il2CppObject* uObject); - - Il2CppString* (*uobject_set_name)(Il2CppObject* uObject, Il2CppString* name); - - Il2CppString* (*get_unityVersion)(); + Il2CppArraySize_t* (*get_all_asset_names)(Il2CppObject* _this); void PrintStackTrace() { @@ -1729,7 +1629,6 @@ namespace return instance; } - Il2CppObject* GetSingletonInstanceByMethod(Il2CppClass* klass) { if (!klass || !klass->parent) @@ -1744,26 +1643,9 @@ namespace return nullptr; } - Boolean GetBoolean(bool value) - { - return il2cpp_symbols::get_method_pointer( - "mscorlib.dll", "System", "Boolean", "Parse", 1)( - il2cpp_string_new(value ? "true" : "false")); - } - Il2CppObject* GetInt32Instance(int value) { - auto int32Class = il2cpp_symbols::get_class("mscorlib.dll", "System", "Int32"); - auto instance = il2cpp_object_new(int32Class); - il2cpp_runtime_object_init(instance); - auto m_value = il2cpp_class_get_field_from_name_wrap(int32Class, "m_value"); - il2cpp_field_set_value(instance, m_value, &value); - return instance; - } - - Il2CppString* il2cpp_string_new16(const wchar_t* value) - { - return il2cpp_string_new_utf16(value, wcslen(value)); + return il2cpp_value_box(il2cpp_defaults.int32_class, &value); } Il2CppObject* ParseEnum(Il2CppObject* runtimeType, const wstring& name) @@ -1861,12 +1743,12 @@ namespace string GetUnityVersion() { - string version(local::wide_u8(get_unityVersion()->chars)); + string version(wide_u8(UnityEngine::Application::unityVersion()->chars)); return version; } void* populate_with_errors_orig = nullptr; - bool populate_with_errors_hook(Il2CppObject* _this, Il2CppString* str, TextGenerationSettings_t* settings, void* context) + bool populate_with_errors_hook(Il2CppObject* _this, Il2CppString* str, UnityEngine::TextGenerationSettings* settings, void* context) { return reinterpret_cast(populate_with_errors_orig) ( _this, local::get_localized_string(str), settings, context @@ -1902,7 +1784,7 @@ namespace } void* get_preferred_width_orig = nullptr; - float get_preferred_width_hook(void* _this, Il2CppString* str, TextGenerationSettings_t* settings) + float get_preferred_width_hook(void* _this, Il2CppString* str, UnityEngine::TextGenerationSettings* settings) { return reinterpret_cast(get_preferred_width_orig) ( _this, local::get_localized_string(str), settings @@ -2033,7 +1915,7 @@ namespace { if (MasterDB::replacementMasterDB) { - text_queries.emplace(stmtPtr, new SQLite::Statement(*MasterDB::replacementMasterDB, local::wide_u8(ssql))); + text_queries.emplace(stmtPtr, new SQLite::Statement(*MasterDB::replacementMasterDB, wide_u8(ssql))); } else { @@ -2173,7 +2055,7 @@ namespace auto stmt = text_queries.at(stmtPtr); if (stmt) { - stmt->bind(idx, local::wide_u8(text->chars)); + stmt->bind(idx, wide_u8(text->chars)); } } catch (exception& e) @@ -2315,7 +2197,7 @@ namespace { cueId = query_getint(_this, 2); cueId1 = stmt->getColumn(2).getInt(); - cueSheet = local::wide_u8( + cueSheet = wide_u8( reinterpret_cast(query_gettext_orig)(_this, 1)->chars ); cueSheet1 = stmt->getColumn(1).getString(); @@ -2324,7 +2206,7 @@ namespace { cueId = query_getint(_this, 3); cueId1 = stmt->getColumn(3).getInt(); - cueSheet = local::wide_u8( + cueSheet = wide_u8( reinterpret_cast(query_gettext_orig)(_this, 2)->chars ); cueSheet1 = stmt->getColumn(2).getString(); @@ -2385,7 +2267,7 @@ namespace int voiceId1 = stmt->getColumn(0).getInt(); int cueId = query_getint(query, 3); int cueId1 = stmt->getColumn(3).getInt(); - string cueSheet = local::wide_u8( + string cueSheet = wide_u8( reinterpret_cast(query_gettext_orig)(query, 2)->chars ); string cueSheet1 = stmt->getColumn(2).getString(); @@ -2554,23 +2436,12 @@ namespace bool useDefaultFPS = false; - void* set_fps_orig = nullptr; - void set_fps_hook(int value) - { - reinterpret_cast(set_fps_orig)(useDefaultFPS ? value : config::max_fps); - } - - bool (*is_virt)() = nullptr; - int (*get_rendering_width)(Il2CppObject* _this); int (*get_rendering_height)(Il2CppObject* _this); - const float ratio_16_9 = 1.778f; - const float ratio_9_16 = 0.563f; - - float ratio_vertical = 0.5625f; - float ratio_horizontal = 1.7777778f; + constexpr float ratio_16_9 = 1.778f; + constexpr float ratio_9_16 = 0.563f; int last_display_width = 0, last_display_height = 0; int last_virt_window_width = 0, last_virt_window_height = 0; @@ -2579,11 +2450,11 @@ namespace bool fullScreenFl = false; bool fullScreenFlOverride = false; - void (*get_resolution)(Resolution_t* buffer); + void (*get_resolution)(UnityEngine::Resolution* buffer); void (*set_resolution)(int width, int height, bool fullscreen); - void get_resolution_stub(Resolution_t* r) + void get_resolution_stub(UnityEngine::Resolution* r) { get_resolution(r); @@ -2594,34 +2465,6 @@ namespace r->height = width; } - void* get_virt_size_orig = nullptr; - Vector3_t* get_virt_size_hook(Vector3_t* pVec3, int width, int height) - { - auto size = reinterpret_cast(get_virt_size_orig)(pVec3, width, height); - - height = width * config::aspect_ratio; - - size->x = width; - size->y = height; - size->z = config::aspect_ratio; - - return size; - } - - void* get_hori_size_orig = nullptr; - Vector3_t* get_hori_size_hook(Vector3_t* pVec3, int width, int height) - { - auto size = reinterpret_cast(get_hori_size_orig)(pVec3, width, height); - - width = height * config::aspect_ratio; - - size->x = width; - size->y = height; - size->z = config::aspect_ratio; - - return size; - } - void* gallop_get_screenheight_orig; int gallop_get_screenheight_hook() { @@ -2629,10 +2472,10 @@ namespace { int w = max(last_display_width, last_display_height), h = min(last_display_width, last_display_height); - return is_virt() ? w : h; + return Gallop::StandaloneWindowResize::IsVirt() ? w : h; } - return il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + return UnityEngine::Screen::height(); } void* gallop_get_screenwidth_orig; @@ -2642,19 +2485,19 @@ namespace { int w = max(last_display_width, last_display_height), h = min(last_display_width, last_display_height); - return is_virt() ? h : w; + return Gallop::StandaloneWindowResize::IsVirt() ? h : w; } - return il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); + return UnityEngine::Screen::width(); } void (*set_scale_factor)(void*, float); void* canvas_scaler_setres_orig; - void canvas_scaler_setres_hook(Il2CppObject* _this, Vector2_t res) + void canvas_scaler_setres_hook(Il2CppObject* _this, UnityEngine::Vector2 res) { - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); res.x = width; res.y = height; @@ -2663,12 +2506,12 @@ namespace { if (width < height) { - float scale = min(config::freeform_ui_scale_portrait, max(1.0f, height * ratio_vertical) * config::freeform_ui_scale_portrait); + float scale = min(config::freeform_ui_scale_portrait, max(1.0f, height * config::runtime::ratioVertical) * config::freeform_ui_scale_portrait); set_scale_factor(_this, scale); } else { - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, width / ratio_horizontal) * config::freeform_ui_scale_landscape); + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, width / config::runtime::ratioHorizontal) * config::freeform_ui_scale_landscape); set_scale_factor(_this, scale); } } @@ -2677,12 +2520,12 @@ namespace // set scale factor to make ui bigger on hi-res screen if (width < height) { - float scale = min(config::ui_scale, max(1.0f, height * ratio_vertical) * config::ui_scale); + float scale = min(config::ui_scale, max(1.0f, height * config::runtime::ratioVertical) * config::ui_scale); set_scale_factor(_this, scale); } else { - float scale = min(config::ui_scale, max(1.0f, width / ratio_horizontal) * config::ui_scale); + float scale = min(config::ui_scale, max(1.0f, width / config::runtime::ratioHorizontal) * config::ui_scale); set_scale_factor(_this, scale); } } @@ -2696,7 +2539,7 @@ namespace { auto display = display_get_main(); canvas_scaler_setres_hook( - canvasScaler, Vector2_t{ static_cast(get_system_width(display)), static_cast(get_system_height(display)) }); + canvasScaler, UnityEngine::Vector2{ static_cast(get_system_width(display)), static_cast(get_system_height(display)) }); reinterpret_cast( UIManager_UpdateCanvasScaler_orig)(canvasScaler); } @@ -2704,12 +2547,12 @@ namespace void* BGManager_CalcBgScale_orig = nullptr; float BGManager_CalcBgScale_hook(Il2CppObject* _this, int width, int height, int renderTextureWidth, int renderTextureHeight) { - int width1 = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height1 = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width1 = UnityEngine::Screen::width(); + int height1 = UnityEngine::Screen::height(); float ratio1 = (float)width1 / (float)height1; float bgCanvasScalerBaseScale = il2cpp_class_get_method_from_name_type(_this->klass, "GetBgCanvasScalerBaseScale", 2)->methodPointer(_this, renderTextureWidth, renderTextureHeight); - if (is_virt()) + if (Gallop::StandaloneWindowResize::IsVirt()) { return max((float)renderTextureHeight / (float)height, (float)height / (float)renderTextureHeight) * (config::freeform_window ? 2 : 1) / bgCanvasScalerBaseScale; } @@ -2729,16 +2572,16 @@ namespace { auto transform = il2cpp_class_get_method_from_name_type(_mainBg->klass, "get_transform", 0)->methodPointer(_mainBg); - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); if (width > height) { - auto pos = il2cpp_class_get_method_from_name_type(transform->klass, "get_localPosition", 0)->methodPointer(transform); + auto pos = il2cpp_class_get_method_from_name_type(transform->klass, "get_localPosition", 0)->methodPointer(transform); if (pos.y == 0) { - il2cpp_class_get_method_from_name_type(transform->klass, "set_localPosition", 1)->methodPointer(transform, Vector3_t{ 0, 0, 0 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_localPosition", 1)->methodPointer(transform, UnityEngine::Vector3{ 0, 0, 0 }); } } } @@ -2763,13 +2606,12 @@ namespace Il2CppArraySize_t* miniDirectors; if (Game::CurrentGameRegion == Game::Region::KOR) { - miniDirectors = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "MiniDirector"), 1, 0); + miniDirectors = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "MiniDirector"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - miniDirectors = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("umamusume.dll", "Gallop", "MiniDirector"), true); + miniDirectors = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("umamusume.dll", "Gallop", "MiniDirector"), true); } if (miniDirectors) @@ -2791,7 +2633,7 @@ namespace { il2cpp_class_get_method_from_name_type(DirectorUI->klass, "ResetTextureSize", 0)->methodPointer(DirectorUI); - auto TextureResolution = il2cpp_class_get_method_from_name_type(DirectorUI->klass, "get_TextureResolution", 0)->methodPointer(DirectorUI); + auto TextureResolution = il2cpp_class_get_method_from_name_type(DirectorUI->klass, "get_TextureResolution", 0)->methodPointer(DirectorUI); auto _cameraField = il2cpp_class_get_field_from_name_wrap(cameraController->klass, "_camera"); Il2CppObject* _camera; @@ -2799,7 +2641,7 @@ namespace if (_camera) { - il2cpp_class_get_method_from_name_type(cameraController->klass, "ResizeRenderTexture", 1)->methodPointer(cameraController, TextureResolution); + il2cpp_class_get_method_from_name_type(cameraController->klass, "ResizeRenderTexture", 1)->methodPointer(cameraController, TextureResolution); auto _renderTextureField = il2cpp_class_get_field_from_name_wrap(cameraController->klass, "_renderTexture"); Il2CppObject* _renderTexture; @@ -2814,133 +2656,11 @@ namespace } } - Il2CppArraySize_t* (*UIManager_GetCanvasScalerList)(Il2CppObject* _this); - - void* UIManager_ChangeResizeUIForPC_orig = nullptr; - void UIManager_ChangeResizeUIForPC_hook(Il2CppObject* _this, int width, int height) - { - if (!config::unlock_size && !config::freeform_window) - { - reinterpret_cast(UIManager_ChangeResizeUIForPC_orig)(_this, width, height); - return; - } - - Il2CppArraySize_t* scalers; - if (Game::CurrentGameRegion == Game::Region::KOR) - { - scalers = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "CanvasScaler"), 1, 0); - } - else - { - scalers = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "CanvasScaler"), true); - } - - // auto scalers = UIManager_GetCanvasScalerList(_this); - for (int i = 0; i < scalers->max_length; i++) - { - auto scaler = scalers->vector[i]; - if (scaler) - { - auto gameObject = il2cpp_class_get_method_from_name_type(scaler->klass, "get_gameObject", 0)->methodPointer(scaler); - - bool keepActive = il2cpp_class_get_method_from_name_type(gameObject->klass, "get_activeSelf", 0)->methodPointer(gameObject); - - il2cpp_class_get_method_from_name_type(gameObject->klass, "SetActive", 1)->methodPointer(gameObject, true); - - auto scaleMode = il2cpp_class_get_method_from_name_type(scaler->klass, "get_uiScaleMode", 0)->methodPointer(scaler); - - if (uobject_get_name(scaler)->chars == L"SystemCanvas"s || - uobject_get_name(scaler)->chars == L"GameCanvas"s || - uobject_get_name(scaler)->chars == L"NoImageEffectGameCanvas"s) - { - il2cpp_class_get_method_from_name_type(scaler->klass, "set_uiScaleMode", 1)->methodPointer(scaler, 0); - - scaleMode = 0; - } - - if (config::freeform_window) - { - if (scaleMode == 1) - { - if (width < height) - { - float scale = min(config::freeform_ui_scale_portrait, max(1.0f, height * ratio_vertical) * config::freeform_ui_scale_portrait); - il2cpp_class_get_method_from_name_type(scaler->klass, "set_referenceResolution", 1)->methodPointer(scaler, Vector2_t{ static_cast(width / scale), static_cast(height / scale) }); - } - else - { - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, width / ratio_horizontal) * config::freeform_ui_scale_landscape); - il2cpp_class_get_method_from_name_type(scaler->klass, "set_referenceResolution", 1)->methodPointer(scaler, Vector2_t{ static_cast(width / scale), static_cast(height / scale) }); - - } - } - - if (scaleMode == 0) - { - if (width < height) - { - float scale = min(config::freeform_ui_scale_portrait, max(1.0f, height * ratio_vertical) * config::freeform_ui_scale_portrait); - il2cpp_class_get_method_from_name_type(scaler->klass, "set_scaleFactor", 1)->methodPointer(scaler, scale); - } - else - { - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, width / ratio_horizontal) * config::freeform_ui_scale_landscape); - il2cpp_class_get_method_from_name_type(scaler->klass, "set_scaleFactor", 1)->methodPointer(scaler, scale); - } - } - } - else - { - if (scaleMode == 1) - { - if (width < height) - { - float scale = min(config::ui_scale, max(1.0f, height * ratio_vertical) * config::ui_scale); - il2cpp_class_get_method_from_name_type(scaler->klass, "set_referenceResolution", 1)->methodPointer(scaler, Vector2_t{ static_cast(width / scale), static_cast(height / scale) }); - } - else - { - float scale = min(config::ui_scale, max(1.0f, width / ratio_horizontal) * config::ui_scale); - il2cpp_class_get_method_from_name_type(scaler->klass, "set_referenceResolution", 1)->methodPointer(scaler, Vector2_t{ static_cast(width / scale), static_cast(height / scale) }); - } - } - if (scaleMode == 0) - { - // set scale factor to make ui bigger on hi-res screen - if (width < height) - { - float scale = min(config::ui_scale, max(1.0f, height * ratio_vertical) * config::ui_scale); - il2cpp_class_get_method_from_name_type(scaler->klass, "set_scaleFactor", 1)->methodPointer(scaler, scale); - } - else - { - float scale = min(config::ui_scale, max(1.0f, width / ratio_horizontal) * config::ui_scale); - il2cpp_class_get_method_from_name_type(scaler->klass, "set_scaleFactor", 1)->methodPointer(scaler, scale); - } - } - } - - // il2cpp_class_get_method_from_name_type(scaler->klass, "set_uiScaleMode", 1)->methodPointer(scaler, 0); - - // il2cpp_class_get_method_from_name_type(scaler->klass, "set_screenMatchMode", 1)->methodPointer(scaler, 0); - - il2cpp_class_get_method_from_name_type(gameObject->klass, "SetActive", 1)->methodPointer(gameObject, keepActive); - } - } - - if (config::unlock_size || config::freeform_window) - { - SetBGCanvasScalerSize(); - } - } - void* GetLimitSize_orig = nullptr; - Vector2_t GetLimitSize_hook() + UnityEngine::Vector2 GetLimitSize_hook() { auto orig = reinterpret_cast(GetLimitSize_orig)(); - Resolution_t r; + UnityEngine::Resolution r; get_resolution(&r); orig.x = r.width; orig.y = r.height; @@ -2987,7 +2707,7 @@ namespace void RemakeTextures() { - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); auto graphicSettings = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "GraphicSettings")); il2cpp_class_get_method_from_name_type(graphicSettings->klass, "Update3DRenderTexture", 0)->methodPointer(graphicSettings); @@ -2995,13 +2715,12 @@ namespace Il2CppArraySize_t* renders; if (Game::CurrentGameRegion == Game::Region::KOR) { - renders = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "CutInImageEffectPostRender"), 1, 0); + renders = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "CutInImageEffectPostRender"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - renders = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("umamusume.dll", "Gallop", "CutInImageEffectPostRender"), true); + renders = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("umamusume.dll", "Gallop", "CutInImageEffectPostRender"), true); } if (renders) @@ -3024,13 +2743,12 @@ namespace Il2CppArraySize_t* cuts; if (Game::CurrentGameRegion == Game::Region::KOR) { - cuts = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "LimitBreakCut"), 1, 0); + cuts = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "LimitBreakCut"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - cuts = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("umamusume.dll", "Gallop", "LimitBreakCut"), true); + cuts = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("umamusume.dll", "Gallop", "LimitBreakCut"), true); } if (cuts) @@ -3056,13 +2774,12 @@ namespace Il2CppArraySize_t* raceEffect; if (Game::CurrentGameRegion == Game::Region::KOR) { - raceEffect = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "RaceImageEffect"), 1, 0); + raceEffect = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "RaceImageEffect"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - raceEffect = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("umamusume.dll", "Gallop", "RaceImageEffect"), true); + raceEffect = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("umamusume.dll", "Gallop", "RaceImageEffect"), true); } if (raceEffect) @@ -3104,13 +2821,12 @@ namespace Il2CppArraySize_t* storyEffect; if (Game::CurrentGameRegion == Game::Region::KOR) { - storyEffect = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "StoryImageEffect"), 1, 0); + storyEffect = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "StoryImageEffect"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - storyEffect = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("umamusume.dll", "Gallop", "StoryImageEffect"), true); + storyEffect = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("umamusume.dll", "Gallop", "StoryImageEffect"), true); } if (storyEffect) @@ -3133,13 +2849,12 @@ namespace Il2CppArraySize_t* lowResCameras; if (Game::CurrentGameRegion == Game::Region::KOR) { - lowResCameras = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "LowResolutionCameraBase"), 1, 0); + lowResCameras = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "LowResolutionCameraBase"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - lowResCameras = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("umamusume.dll", "Gallop", "LowResolutionCameraBase"), true); + lowResCameras = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("umamusume.dll", "Gallop", "LowResolutionCameraBase"), true); } if (lowResCameras) @@ -3162,13 +2877,12 @@ namespace Il2CppArraySize_t* liveTheaterCharaSelects; if (Game::CurrentGameRegion == Game::Region::KOR) { - liveTheaterCharaSelects = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "LiveTheaterCharaSelect"), 1, 0); + liveTheaterCharaSelects = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "LiveTheaterCharaSelect"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - liveTheaterCharaSelects = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("umamusume.dll", "Gallop", "LiveTheaterCharaSelect"), true); + liveTheaterCharaSelects = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("umamusume.dll", "Gallop", "LiveTheaterCharaSelect"), true); } if (liveTheaterCharaSelects) @@ -3215,13 +2929,12 @@ namespace Il2CppArraySize_t* miniDirectors; if (Game::CurrentGameRegion == Game::Region::KOR) { - miniDirectors = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "MiniDirector"), 1, 0); + miniDirectors = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "MiniDirector"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - miniDirectors = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("umamusume.dll", "Gallop", "MiniDirector"), true); + miniDirectors = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("umamusume.dll", "Gallop", "MiniDirector"), true); } if (miniDirectors && miniDirectors->max_length) @@ -3300,7 +3013,7 @@ namespace if (_resultCamera) { - auto texture = il2cpp_class_get_method_from_name_type(uiManager->klass, "get_UITexture", 0)->methodPointer(uiManager); + auto texture = uiManager.UITexture(); il2cpp_class_get_method_from_name_type(_resultCamera->klass, "set_targetTexture", 1)->methodPointer(_resultCamera, texture); } } @@ -3334,7 +3047,7 @@ namespace } } - void MoviePlayerForUI_AdjustScreenSize_hook(Il2CppObject* _this, Vector2_t dispRectWH, bool isPanScan); + void MoviePlayerForUI_AdjustScreenSize_hook(Il2CppObject* _this, UnityEngine::Vector2 dispRectWH, bool isPanScan); void ResizeMoviePlayer() { @@ -3349,7 +3062,7 @@ namespace if (playerDic) { auto entriesField = il2cpp_class_get_field_from_name_wrap(playerDic->klass, "entries"); - Il2CppArraySize_t>* entries; + Il2CppArraySize_t::Entry>* entries; il2cpp_field_get_value(playerDic, entriesField, &entries); if (entries) @@ -3377,7 +3090,7 @@ namespace auto parentGameObject = il2cpp_class_get_method_from_name_type(parent->klass, "get_gameObject", 0)->methodPointer(parent); auto getComponents = il2cpp_class_get_method_from_name_type(parentGameObject->klass, "GetComponentsInternal", 6)->methodPointer; - if (uobject_get_name(parent)->chars == L"MainCanvas"s) + if (UnityEngine::Object::Name(parent)->chars == L"MainCanvas"s) { auto array1 = getComponents(parentGameObject, reinterpret_cast(GetRuntimeType( "umamusume.dll", "Gallop", "StoryMovieView")), true, true, false, false, nullptr); @@ -3390,7 +3103,7 @@ namespace auto _handleField = il2cpp_class_get_field_from_name_wrap(fullPlayer->klass, "_handle"); il2cpp_field_set_value(fullPlayer, _handleField, &entry.key); - il2cpp_class_get_method_from_name_type(fullPlayer->klass, "AdjustMovieSize", 1)->methodPointer(fullPlayer, is_virt() ? 0 : 1); + il2cpp_class_get_method_from_name_type(fullPlayer->klass, "AdjustMovieSize", 1)->methodPointer(fullPlayer, Gallop::StandaloneWindowResize::IsVirt() ? 0 : 1); return; } @@ -3422,7 +3135,7 @@ namespace int CurrentDisplayMode; il2cpp_field_static_get_value(CurrentDisplayModeField, &CurrentDisplayMode); - if (CurrentDisplayMode == 3 && !is_virt()) + if (CurrentDisplayMode == 3 && !Gallop::StandaloneWindowResize::IsVirt()) { int tmpMode = 2; il2cpp_field_static_get_value(CurrentDisplayModeField, &tmpMode); @@ -3437,7 +3150,7 @@ namespace } } - auto newSize = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "MovieScreenSizeHelper", "GetMovieTargetCanvasSize", IgnoreNumberOfArguments)(); + auto newSize = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "MovieScreenSizeHelper", "GetMovieTargetCanvasSize", IgnoreNumberOfArguments)(); auto criPlayer = il2cpp_class_get_method_from_name_type(player->klass, "get_Player", 0)->methodPointer(player); @@ -3467,9 +3180,9 @@ namespace il2cpp_symbols::get_method_pointer("mscorlib.dll", "System", "Array", "GetValue", 1)(array, j); if (!obj) continue; - auto newSize = il2cpp_class_get_method_from_name_type(obj->klass, "CalcMovieRectSize", 0)->methodPointer(obj); + auto newSize = il2cpp_class_get_method_from_name_type(obj->klass, "CalcMovieRectSize", 0)->methodPointer(obj); - il2cpp_class_get_method_from_name_type(parent->klass, "set_sizeDelta", 1)->methodPointer(parent, newSize); + il2cpp_class_get_method_from_name_type(parent->klass, "set_sizeDelta", 1)->methodPointer(parent, newSize); auto criPlayer = il2cpp_class_get_method_from_name_type(player->klass, "get_Player", 0)->methodPointer(player); @@ -3502,7 +3215,7 @@ namespace { try { - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "MonoBehaviourExtension", "WaitForEndFrame", 2)(uiManager, CreateDelegateStatic(fn)); } catch (const Il2CppExceptionWrapper& e) @@ -3515,7 +3228,7 @@ namespace { try { - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); auto delegate = &CreateUnityAction(target, fn)->delegate; il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "MonoBehaviourExtension", "WaitForEndFrame", 2)(uiManager, delegate); } @@ -3615,9 +3328,10 @@ namespace Il2CppObject* SCREEN_ORIENTATION_CATEGORIES; il2cpp_field_static_get_value(SCREEN_ORIENTATION_CATEGORIES_Field, &SCREEN_ORIENTATION_CATEGORIES); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Clear", 0)->methodPointer(SCREEN_ORIENTATION_CATEGORIES); + if (lastWidth < lastHeight) { - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Clear", 0)->methodPointer(SCREEN_ORIENTATION_CATEGORIES); il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, 1, 1); il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, 2, 1); il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, 3, 1); @@ -3626,7 +3340,6 @@ namespace } else { - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Clear", 0)->methodPointer(SCREEN_ORIENTATION_CATEGORIES); il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, 1, 3); il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, 2, 3); il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, 3, 3); @@ -3634,8 +3347,8 @@ namespace il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, 5, 3); } - int unityWidth = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int unityHeight = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int unityWidth = UnityEngine::Screen::width(); + int unityHeight = UnityEngine::Screen::height(); if (unityWidth < unityHeight) { @@ -3654,11 +3367,11 @@ namespace auto tapEffectController = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "TapEffectController")); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); if (uiManager) { - //auto loadingCanvas = il2cpp_class_get_method_from_name_type(uiManager->klass, "get_LoadingCanvas", IgnoreNumberOfArguments)->methodPointer(); + //auto loadingCanvas = il2cpp_class_get_method_from_name_type(uiManager, "get_LoadingCanvas", IgnoreNumberOfArguments)->methodPointer(); //if (loadingCanvas) //{ // auto canvas = il2cpp_class_get_method_from_name_type(loadingCanvas->klass, "get_Canvas", 0)->methodPointer(loadingCanvas); @@ -3698,7 +3411,7 @@ namespace // { // auto id = reinterpret_cast(ids->vector[i]); // cout << "Layer Id: " << id << endl; - // cout << "Layer name: " << local::wide_u8(il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "SortingLayer", "IDToName", 1)(id)->chars) << endl; + // cout << "Layer name: " << wide_u8(il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "SortingLayer", "IDToName", 1)(id)->chars) << endl; // } // auto _activeHorseShoeParticleField = il2cpp_class_get_field_from_name_wrap(nowLoading->klass, isPortrait ? "_horseShoeParticleVertical" : "_horseShoeParticleHorizontal"); @@ -3737,7 +3450,7 @@ namespace il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "Screen", "InitializeChangeScaleForPC", 2)(isPortrait, &_bgCameraSettings); il2cpp_field_static_set_value(_bgCameraSettingsField, &_bgCameraSettings);*/ - /*auto _bgCameraField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_bgCamera"); + /*auto _bgCameraField = il2cpp_class_get_field_from_name_wrap(uiManager, "_bgCamera"); Il2CppObject* _bgCamera; il2cpp_field_get_value(uiManager, _bgCameraField, &_bgCamera); @@ -3747,7 +3460,7 @@ namespace il2cpp_class_get_method_from_name_type(tapEffectController->klass, "Disable", 0)->methodPointer(tapEffectController); - il2cpp_class_get_method_from_name_type(uiManager->klass, "SetCameraSizeByOrientation", 1)->methodPointer(uiManager, ScreenOrientation::Portrait); + uiManager.SetCameraSizeByOrientation(UnityEngine::ScreenOrientation::Portrait); } auto anRootManager = GetSingletonInstance(il2cpp_symbols::get_class("Plugins.dll", "AnimateToUnity", "AnRootManager")); @@ -3761,23 +3474,23 @@ namespace if (uiManager) { - // il2cpp_class_get_method_from_name_type(uiManager->klass, "ChangeResizeUIForPC", 2)->methodPointer(uiManager, lastWidth, lastHeight); + // il2cpp_class_get_method_from_name_type(uiManager, "ChangeResizeUIForPC", 2)->methodPointer(uiManager, lastWidth, lastHeight); // AutoRotation // il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "set_orientation", 1)(5); - auto gameObject = il2cpp_class_get_method_from_name_type(uiManager->klass, "get_gameObject", 0)->methodPointer(uiManager); + auto gameObject = uiManager.gameObject(); - auto transform = il2cpp_class_get_method_from_name_type(gameObject->klass, "get_transform", 0)->methodPointer(gameObject); + auto transform = il2cpp_class_get_method_from_name_type(gameObject, "get_transform", 0)->methodPointer(gameObject); - il2cpp_class_get_method_from_name_type(transform->klass, "set_localScale", 1)->methodPointer(transform, Vector3_t{ 1, 1, 1 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_localScale", 1)->methodPointer(transform, UnityEngine::Vector3{ 1, 1, 1 }); // auto _bgCameraSettingsField = il2cpp_class_get_field_from_name_wrap(GallopScreen, "_bgCameraSettings"); // Il2CppObject* _bgCameraSettings; // il2cpp_field_static_get_value(_bgCameraSettingsField, &_bgCameraSettings); - // il2cpp_class_get_method_from_name_type(uiManager->klass, "EndOrientation", 1)->methodPointer(uiManager, &_bgCameraSettings); + // il2cpp_class_get_method_from_name_type(uiManager, "EndOrientation", 1)->methodPointer(uiManager, &_bgCameraSettings); // il2cpp_field_static_set_value(_bgCameraSettingsField, &_bgCameraSettings); @@ -3789,15 +3502,14 @@ namespace Il2CppArraySize_t* canvasScalerList; if (Game::CurrentGameRegion == Game::Region::KOR) { - canvasScalerList = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "CanvasScaler"), 1, 0); + canvasScalerList = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "CanvasScaler"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - canvasScalerList = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( - GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "CanvasScaler"), true); + canvasScalerList = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "CanvasScaler"), true); } - // auto canvasScalerList = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*)>(uiManager->klass, "GetCanvasScalerList", 0)->methodPointer(uiManager); + // auto canvasScalerList = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*)>(uiManager, "GetCanvasScalerList", 0)->methodPointer(uiManager); for (int i = 0; i < canvasScalerList->max_length; i++) { @@ -3812,13 +3524,13 @@ namespace /*if (isPortrait) { - float scale = min(config::freeform_ui_scale_portrait, max(1.0f, contentHeight * ratio_vertical) * config::freeform_ui_scale_portrait); - il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, Vector2_t{ static_cast(contentWidth / scale), static_cast(contentHeight / scale) }); + float scale = min(config::freeform_ui_scale_portrait, max(1.0f, contentHeight * config::runtime::ratioVertical) * config::freeform_ui_scale_portrait); + il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, UnityEngine::Vector2{ static_cast(contentWidth / scale), static_cast(contentHeight / scale) }); } else { - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, contentWidth / ratio_horizontal) * config::freeform_ui_scale_landscape); - il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, Vector2_t{ static_cast(contentWidth / scale), static_cast(contentHeight / scale) }); + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, contentWidth / config::runtime::ratioHorizontal) * config::freeform_ui_scale_landscape); + il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, UnityEngine::Vector2{ static_cast(contentWidth / scale), static_cast(contentHeight / scale) }); }*/ // il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_uiScaleMode", 1)->methodPointer(canvasScaler, 0); @@ -3833,13 +3545,13 @@ namespace { if (isPortrait) { - float scale = min(config::freeform_ui_scale_portrait, max(1.0f, contentHeight * ratio_vertical) * config::freeform_ui_scale_portrait); - il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, Vector2_t{ static_cast(contentWidth / scale), static_cast(contentHeight / scale) }); + float scale = min(config::freeform_ui_scale_portrait, max(1.0f, contentHeight * config::runtime::ratioVertical) * config::freeform_ui_scale_portrait); + il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, UnityEngine::Vector2{ static_cast(contentWidth / scale), static_cast(contentHeight / scale) }); } else { - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, contentWidth / ratio_horizontal) * config::freeform_ui_scale_landscape); - il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, Vector2_t{ static_cast(contentWidth / scale), static_cast(contentHeight / scale) }); + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, contentWidth / config::runtime::ratioHorizontal) * config::freeform_ui_scale_landscape); + il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, UnityEngine::Vector2{ static_cast(contentWidth / scale), static_cast(contentHeight / scale) }); } } @@ -3847,12 +3559,12 @@ namespace { if (isPortrait) { - float scale = min(config::freeform_ui_scale_portrait, max(1.0f, contentHeight * ratio_vertical) * config::freeform_ui_scale_portrait); + float scale = min(config::freeform_ui_scale_portrait, max(1.0f, contentHeight * config::runtime::ratioVertical) * config::freeform_ui_scale_portrait); il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_scaleFactor", 1)->methodPointer(canvasScaler, scale); } else { - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, contentWidth / ratio_horizontal) * config::freeform_ui_scale_landscape); + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, contentWidth / config::runtime::ratioHorizontal) * config::freeform_ui_scale_landscape); il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_scaleFactor", 1)->methodPointer(canvasScaler, scale); } } @@ -3888,22 +3600,19 @@ namespace auto _originalScreenHeight_Field = il2cpp_class_get_field_from_name_wrap(GallopScreen, "_originalScreenHeight"); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); if (uiManager) { - il2cpp_class_get_method_from_name_type(uiManager->klass, "AdjustSafeArea", 0)->methodPointer(uiManager); - auto _bgManagerField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_bgManager"); - Il2CppObject* _bgManager; - il2cpp_field_get_value(uiManager, _bgManagerField, &_bgManager); + uiManager.AdjustSafeArea(); + Il2CppObject* _bgManager = uiManager._bgManager(); if (_bgManager) { il2cpp_class_get_method_from_name_type(_bgManager->klass, "OnChangeResolutionByGraphicsSettings", 0)->methodPointer(_bgManager); } - il2cpp_class_get_method_from_name_type(uiManager->klass, "CheckUIToFrameBufferBlitInstance", 0)->methodPointer(uiManager); - il2cpp_class_get_method_from_name_type(uiManager->klass, "ReleaseRenderTexture", 0)->methodPointer(uiManager); - + uiManager.CheckUIToFrameBufferBlitInstance(); + uiManager.ReleaseRenderTexture(); auto renderTexture = il2cpp_object_new(il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "RenderTexture")); il2cpp_class_get_method_from_name_type(renderTexture->klass, ".ctor", 3)->methodPointer(renderTexture, contentWidth, contentHeight, 24); @@ -3911,32 +3620,23 @@ namespace il2cpp_class_get_method_from_name_type(renderTexture->klass, "set_useMipMap", 1)->methodPointer(renderTexture, false); il2cpp_class_get_method_from_name_type(renderTexture->klass, "set_antiAliasing", 1)->methodPointer(renderTexture, 1); - auto _uiTextureField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_uiTexture"); - il2cpp_field_set_value(uiManager, _uiTextureField, renderTexture); + uiManager.UITexture(renderTexture); if (!il2cpp_class_get_method_from_name_type(renderTexture->klass, "Create", 0)->methodPointer(renderTexture)) { - il2cpp_class_get_method_from_name_type(uiManager->klass, "ReleaseRenderTexture", 0)->methodPointer(uiManager); + uiManager.ReleaseRenderTexture(); } - auto _uiToFrameBufferRenderCameraDataField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_uiToFrameBufferRenderCameraData"); - if (_uiToFrameBufferRenderCameraDataField) + Il2CppObject* _uiToFrameBufferRenderCameraData = uiManager._uiToFrameBufferRenderCameraData(); + if (_uiToFrameBufferRenderCameraData) { - Il2CppObject* _uiToFrameBufferRenderCameraData; - il2cpp_field_get_value(uiManager, _uiToFrameBufferRenderCameraDataField, &_uiToFrameBufferRenderCameraData); - il2cpp_class_get_method_from_name_type(_uiToFrameBufferRenderCameraData->klass, "set_ScreenTexture", 1)->methodPointer(_uiToFrameBufferRenderCameraData, renderTexture); } else { // Deprecated behavior - auto _uiCommandBufferField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_uiCommandBuffer"); - Il2CppObject* _uiCommandBuffer; - il2cpp_field_get_value(uiManager, _uiCommandBufferField, &_uiCommandBuffer); - - auto _blitToFrameMaterialField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_blitToFrameMaterial"); - Il2CppObject* _blitToFrameMaterial; - il2cpp_field_get_value(uiManager, _blitToFrameMaterialField, &_blitToFrameMaterial); + Il2CppObject* _uiCommandBuffer = uiManager._uiCommandBuffer(); + Il2CppObject* _blitToFrameMaterial = uiManager._blitToFrameMaterial(); if (_uiCommandBuffer) { @@ -3946,21 +3646,11 @@ namespace } } - auto _uiCameraField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_uiCamera"); - Il2CppObject* _uiCamera; - il2cpp_field_get_value(uiManager, _uiCameraField, &_uiCamera); + Il2CppObject* _uiCamera = uiManager._uiCamera(); + Il2CppObject* _bgCamera = uiManager._bgCamera(); - auto _bgCameraField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_bgCamera"); - Il2CppObject* _bgCamera; - il2cpp_field_get_value(uiManager, _bgCameraField, &_bgCamera); - - auto _noImageEffectUICameraField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_noImageEffectUICamera"); - Il2CppObject* _noImageEffectUICamera; - il2cpp_field_get_value(uiManager, _noImageEffectUICameraField, &_noImageEffectUICamera); - - auto _uiToFrameBufferBlitCameraField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_uiToFrameBufferBlitCamera"); - Il2CppObject* _uiToFrameBufferBlitCamera; - il2cpp_field_get_value(uiManager, _uiToFrameBufferBlitCameraField, &_uiToFrameBufferBlitCamera); + Il2CppObject* _noImageEffectUICamera = uiManager._noImageEffectUICamera(); + Il2CppObject* _uiToFrameBufferBlitCamera = uiManager._uiToFrameBufferBlitCamera(); if (_uiCamera) { @@ -3983,10 +3673,10 @@ namespace RemakeTextures(); - auto raceCameraManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "RaceCameraManager")); + auto raceCameraManager = Gallop::RaceCameraManager::Instance(); if (raceCameraManager) { - il2cpp_class_get_method_from_name_type(raceCameraManager->klass, "SetupOrientation", 1)->methodPointer(raceCameraManager, isPortrait ? 7 : 6); + raceCameraManager.SetupOrientation(isPortrait ? Gallop::LowResolutionCameraUtil::DrawDirection::Portrait : Gallop::LowResolutionCameraUtil::DrawDirection::Landscape); } auto director = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop.Live", "Director")); @@ -4010,18 +3700,18 @@ namespace { if (contentWidth < contentHeight) { - float scale = min(config::freeform_ui_scale_portrait, max(1.0f, contentHeight * ratio_vertical) * config::freeform_ui_scale_portrait); - il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, Vector2_t{ ratio_16_9 * static_cast(contentHeight / scale), static_cast(contentHeight / scale) }); + float scale = min(config::freeform_ui_scale_portrait, max(1.0f, contentHeight * config::runtime::ratioVertical) * config::freeform_ui_scale_portrait); + il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, UnityEngine::Vector2{ ratio_16_9 * static_cast(contentHeight / scale), static_cast(contentHeight / scale) }); } else { - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, contentWidth / ratio_horizontal) * config::freeform_ui_scale_landscape); - il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, Vector2_t{ ratio_16_9 * static_cast(contentHeight / scale), static_cast(contentHeight / scale) }); + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, contentWidth / config::runtime::ratioHorizontal) * config::freeform_ui_scale_landscape); + il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, UnityEngine::Vector2{ ratio_16_9 * static_cast(contentHeight / scale), static_cast(contentHeight / scale) }); } } else { - il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, Vector2_t{ ratio_16_9 * static_cast(contentHeight), static_cast(contentHeight) }); + il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, UnityEngine::Vector2{ ratio_16_9 * static_cast(contentHeight), static_cast(contentHeight) }); } } } @@ -4033,18 +3723,16 @@ namespace if (uiManager) { - il2cpp_class_get_method_from_name_type(uiManager->klass, "AdjustMissionClearContentsRootRect", 0)->methodPointer(uiManager); - il2cpp_class_get_method_from_name_type(uiManager->klass, "AdjustSafeAreaToAnnounceRect", 0)->methodPointer(uiManager); + uiManager.AdjustMissionClearContentsRootRect(); + uiManager.AdjustSafeAreaToAnnounceRect(); - auto _bgCameraField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_bgCamera"); - Il2CppObject* _bgCamera; - il2cpp_field_get_value(uiManager, _bgCameraField, &_bgCamera); + /*Il2CppObject* _bgCamera = uiManager._bgCamera(); if (_bgCamera) { - /*il2cpp_class_get_method_from_name_type(_bgCamera->klass, "set_backgroundColor", 1)->methodPointer(_bgCamera, - il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Color", "get_clear", IgnoreNumberOfArguments)());*/ - } + il2cpp_class_get_method_from_name_type(_bgCamera->klass, "set_backgroundColor", 1)->methodPointer(_bgCamera, + il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Color", "get_clear", IgnoreNumberOfArguments)()); + }*/ } if (isPortrait) @@ -4089,22 +3777,17 @@ namespace IsRunChangeScene = il2cpp_class_get_method_from_name_type(sceneManager->klass, "get_IsRunChangeScene", 0)->methodPointer(sceneManager); } - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); if (uiManager) { - auto _noImageEffectCanvasField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_noImageEffectCanvas"); - if (_noImageEffectCanvasField) - { - Il2CppObject* _noImageEffectCanvas; - il2cpp_field_get_value(uiManager, _noImageEffectCanvasField, &_noImageEffectCanvas); + Il2CppObject* _noImageEffectCanvas = uiManager._noImageEffectCanvas(); - if (_noImageEffectCanvas) + if (_noImageEffectCanvas) + { + auto camera = il2cpp_class_get_method_from_name_type(_noImageEffectCanvas->klass, "get_worldCamera", 0)->methodPointer(_noImageEffectCanvas); + if (camera) { - auto camera = il2cpp_class_get_method_from_name_type(_noImageEffectCanvas->klass, "get_worldCamera", 0)->methodPointer(_noImageEffectCanvas); - if (camera) - { - return IsRunChangeView || IsRunChangeScene || il2cpp_class_get_method_from_name_type(camera->klass, "get_enabled", 0)->methodPointer(camera); - } + return IsRunChangeView || IsRunChangeScene || il2cpp_class_get_method_from_name_type(camera->klass, "get_enabled", 0)->methodPointer(camera); } } } @@ -4115,7 +3798,7 @@ namespace void* Camera_set_orthographicSize_orig = nullptr; void Camera_set_orthographicSize_hook(Il2CppObject* _this, float value) { - if (wstring(uobject_get_name(_this)->chars).find(L"UICamera") != wstring::npos) + if (wstring(UnityEngine::Object::Name(_this)->chars).find(L"UICamera") != wstring::npos) { auto callback = CreateDelegateWithClass(il2cpp_symbols::get_class("DOTween.dll", "DG.Tweening", "TweenCallback"), _this, *([](Il2CppObject* _this) { @@ -4135,19 +3818,21 @@ namespace } void* RectTransform_get_rect_Injected_orig = nullptr; - void RectTransform_get_rect_Injected_hook(Il2CppObject* _this, Rect_t* rect) + void RectTransform_get_rect_Injected_hook(Il2CppObject* _this, UnityEngine::Rect* rect) { reinterpret_cast(RectTransform_get_rect_Injected_orig)(_this, rect); - if (isRequestChangeResolution && il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "GameSystem", "IsExecutingSoftwareReset", IgnoreNumberOfArguments)()) + if (il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "GameSystem", "IsExecutingSoftwareReset", IgnoreNumberOfArguments)()) { - float tmp = rect->height; - rect->height = rect->width; - rect->width = tmp; + if (isRequestChangeResolution || config::freeform_window && Gallop::StandaloneWindowResize::IsVirt()) + { + float tmp = rect->height; + rect->height = rect->width; + rect->width = tmp; + } return; } - auto sceneManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "SceneManager")); if (sceneManager) { @@ -4186,7 +3871,7 @@ namespace { if (width < 72) { - if (is_virt()) + if (Gallop::StandaloneWindowResize::IsVirt()) { width = 72; } @@ -4198,7 +3883,7 @@ namespace if (height < 72) { - if (is_virt()) + if (Gallop::StandaloneWindowResize::IsVirt()) { height = 128; } @@ -4223,14 +3908,14 @@ namespace return; } - Resolution_t r; + UnityEngine::Resolution r; get_resolution(&r); bool reqVirt = width < height; bool unlockSize = config::unlock_size || config::freeform_window; - if (is_virt() && fullScreenFl) + if (Gallop::StandaloneWindowResize::IsVirt() && fullScreenFl) { fullScreenFl = false; fullScreenFlOverride = false; @@ -4241,7 +3926,7 @@ namespace else { r.height *= 0.825f; - r.width = r.height * ratio_vertical; + r.width = r.height * config::runtime::ratioVertical; reinterpret_cast(set_resolution_orig)(r.width, r.height, 3, perferredRefreshRate); } return; @@ -4260,7 +3945,7 @@ namespace else { r.height *= 0.825f; - r.width = r.height * ratio_vertical; + r.width = r.height * config::runtime::ratioVertical; reinterpret_cast(set_resolution_orig)(r.width, r.height, 3, perferredRefreshRate); } return; @@ -4274,11 +3959,11 @@ namespace ratio *= 1000; ratio = roundf(ratio) / 1000; - if (is_virt() && ratio == ratio_9_16) + if (Gallop::StandaloneWindowResize::IsVirt() && ratio == ratio_9_16) { need_fullscreen = true; } - else if (!is_virt() && ratio == ratio_16_9) + else if (!Gallop::StandaloneWindowResize::IsVirt() && ratio == ratio_16_9) { need_fullscreen = true; } @@ -4293,7 +3978,7 @@ namespace if (need_fullscreen && (!last_hriz_window_width || !last_hriz_window_height)) { last_hriz_window_width = r.width - 400; - last_hriz_window_height = last_hriz_window_width * ratio_horizontal; + last_hriz_window_height = last_hriz_window_width * config::runtime::ratioHorizontal; } } else @@ -4320,10 +4005,10 @@ namespace ratio *= 1000; ratio = roundf(ratio) / 1000; - auto round_ratio_vertical = ratio_vertical * 1000; + auto round_ratio_vertical = config::runtime::ratioVertical * 1000; round_ratio_vertical = roundf(round_ratio_vertical) / 1000; - auto round_ratio_horizontal = ratio_horizontal * 1000; + auto round_ratio_horizontal = config::runtime::ratioHorizontal * 1000; round_ratio_horizontal = roundf(round_ratio_horizontal) / 1000; if (reqVirt && ratio != round_ratio_vertical) @@ -4337,23 +4022,23 @@ namespace if (config::initial_width < config::initial_height) { last_virt_window_height = get_system_width(display) - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; if (last_virt_window_height >= get_system_height(display)) { last_virt_window_height = get_system_height(display) - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; } } else { last_virt_window_height = get_system_height(display) - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; if (last_virt_window_height >= get_system_height(display)) { last_virt_window_height = get_system_height(display) - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; } } } @@ -4374,23 +4059,23 @@ namespace if (config::initial_width < config::initial_height) { last_hriz_window_width = get_system_height(display) - 400; - last_hriz_window_height = last_hriz_window_width / ratio_horizontal; + last_hriz_window_height = last_hriz_window_width / config::runtime::ratioHorizontal; if (last_hriz_window_height >= get_system_height(display)) { last_hriz_window_height = get_system_height(display) - 400; - last_hriz_window_width = last_hriz_window_height * ratio_horizontal; + last_hriz_window_width = last_hriz_window_height * config::runtime::ratioHorizontal; } } else { last_hriz_window_width = get_system_width(display) - 400; - last_hriz_window_height = last_hriz_window_width / ratio_horizontal; + last_hriz_window_height = last_hriz_window_width / config::runtime::ratioHorizontal; if (last_hriz_window_height >= get_system_height(display)) { last_hriz_window_height = get_system_height(display) - 400; - last_hriz_window_width = last_hriz_window_height * ratio_horizontal; + last_hriz_window_width = last_hriz_window_height * config::runtime::ratioHorizontal; } } } @@ -4435,7 +4120,7 @@ namespace CreateDelegateStatic(*[]() { isExitOpened = false; - Exit(); + UnityEngine::Application::Exit(0); }), GetTextIdByName(L"Common0004"), GetTextIdByName(L"Common0003"), @@ -4550,12 +4235,12 @@ namespace auto FormTypeField = il2cpp_class_get_field_from_name_wrap(_data->klass, "FormType"); - DialogCommonFormType type = WITHOUT_FRAME; + Gallop::DialogCommonBase::FormType type = Gallop::DialogCommonBase::FormType::WITHOUT_FRAME; il2cpp_field_get_value(_data, FormTypeField, &type); - bool isOneButton = type == DialogCommonFormType::SMALL_ONE_BUTTON || type == DialogCommonFormType::MIDDLE_ONE_BUTTON || type == DialogCommonFormType::BIG_ONE_BUTTON; - bool isTwoButton = type == DialogCommonFormType::SMALL_TWO_BUTTON || type == DialogCommonFormType::MIDDLE_TWO_BUTTON || type == DialogCommonFormType::BIG_TWO_BUTTON; - bool isThreeButton = type == DialogCommonFormType::SMALL_THREE_BUTTON || type == DialogCommonFormType::MIDDLE_THREE_BUTTON || type == DialogCommonFormType::BIG_THREE_BUTTON; + bool isOneButton = type == Gallop::DialogCommonBase::FormType::SMALL_ONE_BUTTON || type == Gallop::DialogCommonBase::FormType::MIDDLE_ONE_BUTTON || type == Gallop::DialogCommonBase::FormType::BIG_ONE_BUTTON; + bool isTwoButton = type == Gallop::DialogCommonBase::FormType::SMALL_TWO_BUTTON || type == Gallop::DialogCommonBase::FormType::MIDDLE_TWO_BUTTON || type == Gallop::DialogCommonBase::FormType::BIG_TWO_BUTTON; + bool isThreeButton = type == Gallop::DialogCommonBase::FormType::SMALL_THREE_BUTTON || type == Gallop::DialogCommonBase::FormType::MIDDLE_THREE_BUTTON || type == Gallop::DialogCommonBase::FormType::BIG_THREE_BUTTON; auto _currentDialogObjField = il2cpp_class_get_field_from_name_wrap(dialog->klass, "_currentDialogObj"); @@ -5098,7 +4783,7 @@ namespace if (wParam == VK_RETURN) { - auto enabledObscured = il2cpp_class_get_method_from_name_type(selectedMenu->klass, "get_IsEnable", 0)->methodPointer(selectedMenu); + auto enabledObscured = il2cpp_class_get_method_from_name_type(selectedMenu->klass, "get_IsEnable", 0)->methodPointer(selectedMenu); auto enabled = enabledObscured.GetDecrypted(); if (enabled) @@ -5134,7 +4819,7 @@ namespace if (selectedMenu == trainingMenu) { - auto enabledObscured = il2cpp_class_get_method_from_name_type(selectedMenu->klass, "get_IsEnable", 0)->methodPointer(selectedMenu); + auto enabledObscured = il2cpp_class_get_method_from_name_type(selectedMenu->klass, "get_IsEnable", 0)->methodPointer(selectedMenu); auto enabled = enabledObscured.GetDecrypted(); if (enabled) @@ -5428,7 +5113,7 @@ namespace { altEnterPressed = true; - Resolution_t r; + UnityEngine::Resolution r; get_resolution(&r); auto display = display_get_main(); @@ -5441,7 +5126,7 @@ namespace system_ratio *= 1000; system_ratio = roundf(system_ratio) / 1000; - if ((!is_virt() && rendering_ratio == system_ratio) || + if ((!Gallop::StandaloneWindowResize::IsVirt() && rendering_ratio == system_ratio) || config::freeform_window) { if (!fullScreenFlOverride) @@ -5495,7 +5180,7 @@ namespace else if (!fullScreenFl) { r.width *= 0.825f; - r.height = r.width / ratio_horizontal; + r.height = r.width / config::runtime::ratioHorizontal; } reinterpret_cast(set_resolution_orig)(r.width, r.height, fullScreenFl ? 1 : 3, 0); @@ -5505,8 +5190,8 @@ namespace } if (config::max_fps > -1 && wParam == 'F' && altDown) { - useDefaultFPS = !useDefaultFPS; - set_fps_hook(30); + config::runtime::useDefaultFPS = !config::runtime::useDefaultFPS; + UnityEngine::Application::targetFrameRate(30); return TRUE; } } @@ -5589,15 +5274,10 @@ namespace { case SIZE_RESTORED: { - - auto StartCoroutine = il2cpp_symbols::find_method("UnityEngine.CoreModule.dll", "UnityEngine", "MonoBehaviour", [](const MethodInfo* method) - { - return method->name == "StartCoroutine"s && method->parameters[0].parameter_type->type == IL2CPP_TYPE_CLASS; - }); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); if (uiManager) { - StartCoroutine(uiManager, il2cpp_class_get_method_from_name_type(StandaloneWindowResize->klass, "ClearStopFlagAfterWhile", 0)->methodPointer()); + uiManager.StartCoroutineManaged2(il2cpp_class_get_method_from_name_type(StandaloneWindowResize->klass, "ClearStopFlagAfterWhile", 0)->methodPointer()); } break; } @@ -5743,8 +5423,8 @@ namespace il2cpp_field_static_set_value(lastWidthField, &lastWidth); il2cpp_field_static_set_value(lastHeightField, &lastHeight); - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); il2cpp_class_get_method_from_name_type(StandaloneWindowResize, "SaveChangedWidth", 2)->methodPointer(width, height); @@ -5771,16 +5451,16 @@ namespace { RECT* rect = reinterpret_cast(lParam); - float ratio = is_virt() ? ratio_vertical : ratio_horizontal; + float ratio = Gallop::StandaloneWindowResize::IsVirt() ? config::runtime::ratioVertical : config::runtime::ratioHorizontal; auto StandaloneWindowResize = il2cpp_symbols::get_class("umamusume.dll", "Gallop", "StandaloneWindowResize"); - if (is_virt() && ratio != (9.0 / 16.0)) + if (Gallop::StandaloneWindowResize::IsVirt() && ratio != (9.0 / 16.0)) { il2cpp_class_get_method_from_name_type(StandaloneWindowResize, "set_IsPreventReShape", 1)->methodPointer(true); } - if (!is_virt() && ratio != (16.0 / 9.0)) + if (!Gallop::StandaloneWindowResize::IsVirt() && ratio != (16.0 / 9.0)) { il2cpp_class_get_method_from_name_type(StandaloneWindowResize, "set_IsPreventReShape", 1)->methodPointer(true); } @@ -5868,18 +5548,18 @@ namespace il2cpp_field_static_set_value(_aspectRatioField, &_aspectRatio); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); if (uiManager) { bool isVirt = width < height; if (config::unlock_size) { - UIManager_ChangeResizeUIForPC_hook(uiManager, isVirt ? min(last_display_width, last_display_height) : max(last_display_width, last_display_height), + uiManager.ChangeResizeUIForPC(isVirt ? min(last_display_width, last_display_height) : max(last_display_width, last_display_height), isVirt ? max(last_display_width, last_display_height) : min(last_display_width, last_display_height)); } else { - UIManager_ChangeResizeUIForPC_hook(uiManager, isVirt ? 1080 : 1920, isVirt ? 1920 : 1080); + uiManager.ChangeResizeUIForPC(isVirt ? 1080 : 1920, isVirt ? 1920 : 1080); } } @@ -5901,7 +5581,7 @@ namespace { if (isExitOpened) { - Exit(); + UnityEngine::Application::Exit(0); return TRUE; } @@ -5960,16 +5640,16 @@ namespace void* Screen_IsCurrentOrientation_orig = nullptr; - bool Screen_IsCurrentOrientation_hook(ScreenOrientation target) + bool Screen_IsCurrentOrientation_hook(UnityEngine::ScreenOrientation target) { return true; } void* GallopInput_mousePosition_orig = nullptr; - Vector3_t GallopInput_mousePosition_hook() + UnityEngine::Vector3 GallopInput_mousePosition_hook() { - return il2cpp_symbols::get_method_pointer("UnityEngine.InputLegacyModule.dll", "UnityEngine", "Input", "get_mousePosition", IgnoreNumberOfArguments)(); + return il2cpp_symbols::get_method_pointer("UnityEngine.InputLegacyModule.dll", "UnityEngine", "Input", "get_mousePosition", IgnoreNumberOfArguments)(); } vector frameBuffers; @@ -6040,7 +5720,7 @@ namespace if (config::replace_to_custom_font) { auto font = text_get_font(_this); - Il2CppString* name = uobject_get_name(font); + Il2CppString* name = UnityEngine::Object::Name(font); if (config::font_asset_name.find(name->chars) == string::npos) { text_set_font(_this, GetCustomFont()); @@ -6125,7 +5805,7 @@ namespace il2cpp_field_get_value(customFont, customFontMaterialField, &customFontMaterial); auto SetFloat = il2cpp_class_get_method_from_name_type(customFontMaterial->klass, "SetFloat", 2)->methodPointer; - auto SetColor = il2cpp_class_get_method_from_name_type(customFontMaterial->klass, "SetColor", 2)->methodPointer; + auto SetColor = il2cpp_class_get_method_from_name_type(customFontMaterial->klass, "SetColor", 2)->methodPointer; auto origOutlineWidth = il2cpp_class_get_method_from_name_type(_this->klass, "get_outlineWidth", 0)->methodPointer(_this); @@ -6151,8 +5831,8 @@ namespace color32 = color; break; } - auto enumName = local::wide_u8(GetEnumName(colorType, colorEnum)->chars); - if (enumName == "White"s || enumName == "Black"s) + auto enumName = GetEnumName(colorType, colorEnum)->chars; + if (enumName == L"White"s || enumName == L"Black"s) { color32 = color; break; @@ -6163,7 +5843,7 @@ namespace float b = ((color32 & 0xFF0000) >> 16) / static_cast(0xff); float g = ((color32 & 0xFF00) >> 8) / static_cast(0xff); float r = (color32 & 0xFF) / static_cast(0xff); - auto origOutlineColor = Color_t{ r, g, b, a }; + auto origOutlineColor = UnityEngine::Color{ r, g, b, a }; SetFloat(customFontMaterial, il2cpp_string_new("_OutlineWidth"), origOutlineWidth); SetColor(customFontMaterial, il2cpp_string_new("_OutlineColor"), origOutlineColor); @@ -6189,20 +5869,14 @@ namespace reinterpret_cast(load_zekken_composite_resource_orig)(_this); } - void* wait_resize_ui_orig = nullptr; - Il2CppObject* wait_resize_ui_hook(Il2CppObject* _this, bool isPortrait, bool isShowOrientationGuide) - { - return reinterpret_cast(wait_resize_ui_orig)(_this, isPortrait, config::ui_loading_show_orientation_guide ? false : isShowOrientationGuide); - } - void* get_modified_string_orig = nullptr; Il2CppString* get_modified_string_hook(Il2CppString* text, Il2CppObject* input, bool allowNewLine) { if (!allowNewLine) { - auto u8str = local::wide_u8(text->chars); - replaceAll(u8str, "\n", ""); - return il2cpp_string_new(u8str.data()); + auto str = wstring(text->chars); + replaceAll(str, L"\n", L""); + return il2cpp_string_new16(str.data()); } return text; } @@ -6294,12 +5968,12 @@ namespace } } void* GraphicSettings_GetVirtualResolution_orig = nullptr; - Vector2Int_t GraphicSettings_GetVirtualResolution_hook(Il2CppObject* _this) + UnityEngine::Vector2Int GraphicSettings_GetVirtualResolution_hook(Il2CppObject* _this) { if (config::freeform_window) { - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); auto GallopScreen = il2cpp_symbols::get_class("umamusume.dll", "Gallop", "Screen"); @@ -6315,22 +5989,22 @@ namespace if (width < height) { - return Vector2Int_t{ number1080, number1920 }; + return UnityEngine::Vector2Int{ number1080, number1920 }; } - return Vector2Int_t{ number1920, number1080 }; + return UnityEngine::Vector2Int{ number1920, number1080 }; } return reinterpret_cast(GraphicSettings_GetVirtualResolution_orig)(_this); } void* GraphicSettings_GetVirtualResolution3D_orig = nullptr; - Vector2Int_t GraphicSettings_GetVirtualResolution3D_hook(Il2CppObject* _this, bool isForcedWideAspect) + UnityEngine::Vector2Int GraphicSettings_GetVirtualResolution3D_hook(Il2CppObject* _this, bool isForcedWideAspect) { if (config::freeform_window) { - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); auto GallopScreen = il2cpp_symbols::get_class("umamusume.dll", "Gallop", "Screen"); @@ -6349,30 +6023,30 @@ namespace if (width < height) { - return Vector2Int_t{ number1080, number1920 }; + return UnityEngine::Vector2Int{ number1080, number1920 }; } - return Vector2Int_t{ number1920, number1080 }; + return UnityEngine::Vector2Int{ number1920, number1080 }; } auto resolution = reinterpret_cast(GraphicSettings_GetVirtualResolution3D_orig)(_this, isForcedWideAspect); if (config::unlock_size) { - Resolution_t res; + UnityEngine::Resolution res; get_resolution(&res); - if (resolution.x > resolution.y) + if (resolution.m_X > resolution.m_Y) { - resolution.x = res.width; - resolution.y = res.height; + resolution.m_X = res.width; + resolution.m_Y = res.height; } else { - resolution.x = res.height; - resolution.y = res.width; + resolution.m_X = res.height; + resolution.m_Y = res.width; } } - resolution.x *= config::resolution_3d_scale; - resolution.y *= config::resolution_3d_scale; + resolution.m_X *= config::resolution_3d_scale; + resolution.m_Y *= config::resolution_3d_scale; return resolution; } @@ -6433,9 +6107,9 @@ namespace auto texture = Material_GetTextureImpl_hook(material, Shader_PropertyToID(property)); if (texture) { - auto uobject_name = uobject_get_name(texture); - // cout << "Material " << local::wide_u8(property->chars) << " " << local::wide_u8(uobject_name->chars) << endl; - if (!local::wide_u8(uobject_name->chars).empty()) + auto uobject_name = UnityEngine::Object::Name(texture); + // cout << "Material " << wide_u8(property->chars) << " " << wide_u8(uobject_name->chars) << endl; + if (!wstring(uobject_name->chars).empty()) { auto newTexture = GetReplacementAssets( uobject_name, @@ -6494,7 +6168,7 @@ namespace if (obj) { - // cout << "AssetHolder: " << i << " " << obj->klass->name << " " << local::wide_u8(uobject_get_name(obj)->chars) << endl; + // cout << "AssetHolder: " << i << " " << obj->klass->name << " " << wide_u8(UnityEngine::Object::Name(obj)->chars) << endl; if (obj->klass->name == "GameObject"s && uobject_IsNativeObjectAlive(obj)) { // auto getComponent = il2cpp_class_get_method_from_name_type(component->klass, "GetComponent", 1)->methodPointer; @@ -6527,8 +6201,8 @@ namespace } if (obj->klass->name == "Texture2D"s) { - auto uobject_name = uobject_get_name(obj); - if (!local::wide_u8(uobject_name->chars).empty()) + auto uobject_name = UnityEngine::Object::Name(obj); + if (!wstring(uobject_name->chars).empty()) { auto newTexture = GetReplacementAssets( uobject_name, @@ -6562,10 +6236,10 @@ namespace if (texture) { - auto uobject_name = uobject_get_name(texture); + auto uobject_name = UnityEngine::Object::Name(texture); if (uobject_name) { - auto nameU8 = local::wide_u8(uobject_name->chars); + auto nameU8 = wide_u8(uobject_name->chars); if (!nameU8.empty()) { do @@ -6640,8 +6314,8 @@ namespace if (textureSetColor) { - auto uobject_name = uobject_get_name(textureSetColor); - if (!local::wide_u8(uobject_name->chars).empty()) + auto uobject_name = UnityEngine::Object::Name(textureSetColor); + if (!wstring(uobject_name->chars).empty()) { auto newTexture = GetReplacementAssets( uobject_name, @@ -6657,8 +6331,8 @@ namespace if (textureSetAlpha) { - auto uobject_name = uobject_get_name(textureSetAlpha); - if (!local::wide_u8(uobject_name->chars).empty()) + auto uobject_name = UnityEngine::Object::Name(textureSetAlpha); + if (!wstring(uobject_name->chars).empty()) { auto newTexture = GetReplacementAssets( uobject_name, @@ -6694,8 +6368,8 @@ namespace if (textureColor) { - auto uobject_name = uobject_get_name(textureColor); - if (!local::wide_u8(uobject_name->chars).empty()) + auto uobject_name = UnityEngine::Object::Name(textureColor); + if (!wstring(uobject_name->chars).empty()) { auto newTexture = GetReplacementAssets( uobject_name, @@ -6711,8 +6385,8 @@ namespace if (textureAlpha) { - auto uobject_name = uobject_get_name(textureAlpha); - if (!local::wide_u8(uobject_name->chars).empty()) + auto uobject_name = UnityEngine::Object::Name(textureAlpha); + if (!wstring(uobject_name->chars).empty()) { auto newTexture = GetReplacementAssets( uobject_name, @@ -6757,7 +6431,7 @@ namespace // auto gameObject = il2cpp_class_get_method_from_name_type(child->klass, "get_gameObject", 0)->methodPointer(child); - // cout << "Transform gameObject " << local::wide_u8(uobject_get_name(gameObject)->chars) << endl; + // cout << "Transform gameObject " << wide_u8(UnityEngine::Object::Name(gameObject)->chars) << endl; ReplaceTransformTextures(child); } @@ -6992,15 +6666,15 @@ namespace void* assetbundle_LoadFromFile_orig = nullptr; Il2CppObject* assetbundle_LoadFromFile_hook(Il2CppString* path, uint32_t crc, uint64_t offset) { - stringstream pathStream(local::wide_u8(path->chars)); - string segment; - vector splited; - while (getline(pathStream, segment, '\\')) + wstringstream pathStream(path->chars); + wstring segment; + vector splited; + while (getline(pathStream, segment, L'\\')) { splited.emplace_back(segment); } - auto name = local::u8_wide(splited.back()); + auto name = splited.back(); if (config::replace_assets.find(name) != config::replace_assets.end()) { @@ -7015,7 +6689,7 @@ namespace { auto name = reinterpret_cast(names->vector[i]); if (!name) continue; - stringstream pathStream(local::wide_u8(name->chars)); + stringstream pathStream(wide_u8(name->chars)); string segment; vector splited; while (getline(pathStream, segment, '/')) @@ -7037,7 +6711,7 @@ namespace // if (!obj) continue; // if (obj && obj->klass && obj->klass->name != "Transform"s) // { - // stringstream pathStream(local::wide_u8(uobject_get_name(obj)->chars)); + // stringstream pathStream(wide_u8(UnityEngine::Object::Name(obj)->chars)); // string segment; // vector splited; // while (getline(pathStream, segment, '/')) @@ -7062,20 +6736,20 @@ namespace Il2CppObject* assetbundle_load_asset_hook(Il2CppObject* _this, Il2CppString* name, const Il2CppType* type) { - stringstream pathStream(local::wide_u8(name->chars)); - string segment; - vector splited; - while (getline(pathStream, segment, '/')) + wstringstream pathStream(name->chars); + wstring segment; + vector splited; + while (getline(pathStream, segment, L'/')) { splited.emplace_back(segment); } auto& fileName = splited.back(); - if (find_if(replaceAssetNames.begin(), replaceAssetNames.end(), [fileName](const string& item) + if (find_if(replaceAssetNames.begin(), replaceAssetNames.end(), [fileName](const wstring& item) { - return item.find(fileName) != string::npos; + return item.find(fileName) != wstring::npos; }) != replaceAssetNames.end()) { - return GetReplacementAssets(il2cpp_string_new(fileName.data()), type); + return GetReplacementAssets(il2cpp_string_new16(fileName.data()), type); } auto obj = reinterpret_cast(assetbundle_load_asset_orig)(_this, name, type); @@ -7106,20 +6780,20 @@ namespace Il2CppObject* assetbundle_load_asset_async_hook(Il2CppObject* _this, Il2CppString* name, const Il2CppType* type) { - stringstream pathStream(local::wide_u8(name->chars)); - string segment; - vector splited; - while (getline(pathStream, segment, '/')) + wstringstream pathStream(name->chars); + wstring segment; + vector splited; + while (getline(pathStream, segment, L'/')) { splited.emplace_back(segment); } auto& fileName = splited.back(); - if (find_if(replaceAssetNames.begin(), replaceAssetNames.end(), [fileName](const string& item) + if (find_if(replaceAssetNames.begin(), replaceAssetNames.end(), [fileName](const wstring& item) { return item.find(fileName) != string::npos; }) != replaceAssetNames.end()) { - return GetReplacementAssetsAsync(il2cpp_string_new(fileName.data()), type); + return GetReplacementAssetsAsync(il2cpp_string_new16(fileName.data()), type); } return reinterpret_cast(assetbundle_load_asset_async_orig)(_this, name, type); } @@ -7143,9 +6817,9 @@ namespace auto obj = reinterpret_cast(AssetBundleRequest_GetResult_orig)(_this); if (obj) { - auto name = uobject_get_name(obj); - auto u8Name = local::wide_u8(name->chars); - if (find(replaceAssetNames.begin(), replaceAssetNames.end(), u8Name) != replaceAssetNames.end()) + auto name = UnityEngine::Object::Name(obj); + wstring wName = name->chars; + if (find(replaceAssetNames.begin(), replaceAssetNames.end(), wName) != replaceAssetNames.end()) { return GetReplacementAssets(name, il2cpp_class_get_type(obj->klass)); } @@ -7185,11 +6859,7 @@ namespace Il2CppObject* CreateGameObject() { - auto gameObjectClass = il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject"); - auto gameObject = il2cpp_object_new(gameObjectClass); - il2cpp_runtime_object_init(gameObject); - - return gameObject; + return UnityEngine::GameObject(); } Il2CppObject* AddComponent(Il2CppObject* gameObject, Il2CppObject* componentType) @@ -7279,7 +6949,7 @@ namespace auto optionItemOnOff = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - uobject_set_name(optionItemOnOff, il2cpp_string_new(name)); + UnityEngine::Object::Name(optionItemOnOff, il2cpp_string_new(name)); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(optionItemOnOff->klass, "GetComponentsInternal", 6)->methodPointer; auto array = getComponents(optionItemOnOff, reinterpret_cast(GetRuntimeType( @@ -7299,7 +6969,7 @@ namespace auto optionItemOnOff = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - uobject_set_name(optionItemOnOff, il2cpp_string_new(name)); + UnityEngine::Object::Name(optionItemOnOff, il2cpp_string_new(name)); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(optionItemOnOff->klass, "GetComponentsInternal", 6)->methodPointer; auto array = getComponents(optionItemOnOff, reinterpret_cast(GetRuntimeType( @@ -7353,7 +7023,7 @@ namespace auto optionItemButton = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - uobject_set_name(optionItemButton, il2cpp_string_new(name)); + UnityEngine::Object::Name(optionItemButton, il2cpp_string_new(name)); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(optionItemButton->klass, "GetComponentsInternal", 6)->methodPointer; auto array1 = getComponents(optionItemButton, reinterpret_cast(GetRuntimeType( @@ -7463,11 +7133,11 @@ namespace auto optionItemSimple = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - uobject_set_name(optionItemSimple, il2cpp_string_new((name + "_simple"s).data())); + UnityEngine::Object::Name(optionItemSimple, il2cpp_string_new((name + "_simple"s).data())); auto rectTransform = GetRectTransform(optionItemSimple); - il2cpp_class_get_method_from_name_type(rectTransform->klass, "set_anchoredPosition", 1)->methodPointer(rectTransform, Vector2_t{ 71.583984375, -18 }); + il2cpp_class_get_method_from_name_type(rectTransform->klass, "set_anchoredPosition", 1)->methodPointer(rectTransform, UnityEngine::Vector2{ 71.583984375, -18 }); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(optionItemSimple->klass, "GetComponentsInternal", 6)->methodPointer; @@ -7475,7 +7145,7 @@ namespace auto buttons00 = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(buttonObject); - uobject_set_name(buttons00, il2cpp_string_new(name)); + UnityEngine::Object::Name(buttons00, il2cpp_string_new(name)); auto array2 = getComponents(buttons00, reinterpret_cast(GetRuntimeType( "umamusume.dll", "Gallop", "ButtonCommon")), true, true, false, false, nullptr); @@ -7486,9 +7156,9 @@ namespace auto buttonRectTransform = GetRectTransform(buttons00); - il2cpp_class_get_method_from_name_type(buttonRectTransform->klass, "set_sizeDelta", 1)->methodPointer(buttonRectTransform, Vector2_t{ 167, 67 }); + il2cpp_class_get_method_from_name_type(buttonRectTransform->klass, "set_sizeDelta", 1)->methodPointer(buttonRectTransform, UnityEngine::Vector2{ 167, 67 }); - il2cpp_class_get_method_from_name_type(buttonRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(buttonRectTransform, Vector2_t{ 382.5, 0 }); + il2cpp_class_get_method_from_name_type(buttonRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(buttonRectTransform, UnityEngine::Vector2{ 382.5, 0 }); AddToLayout(rectTransform, vector{ buttons00 }); @@ -7582,7 +7252,7 @@ namespace auto optionItem3ToggleVertical = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - uobject_set_name(optionItem3ToggleVertical, il2cpp_string_new(name)); + UnityEngine::Object::Name(optionItem3ToggleVertical, il2cpp_string_new(name)); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(optionItem3ToggleVertical->klass, "GetComponentsInternal", 6)->methodPointer; auto array = getComponents(optionItem3ToggleVertical, reinterpret_cast(GetRuntimeType( @@ -7605,7 +7275,7 @@ namespace auto optionItem3Toggle = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - uobject_set_name(optionItem3Toggle, il2cpp_string_new(name)); + UnityEngine::Object::Name(optionItem3Toggle, il2cpp_string_new(name)); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(optionItem3Toggle->klass, "GetComponentsInternal", 6)->methodPointer; auto array = getComponents(optionItem3Toggle, reinterpret_cast(GetRuntimeType( @@ -7628,7 +7298,7 @@ namespace auto optionItem2Toggle = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - uobject_set_name(optionItem2Toggle, il2cpp_string_new(name)); + UnityEngine::Object::Name(optionItem2Toggle, il2cpp_string_new(name)); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(optionItem2Toggle->klass, "GetComponentsInternal", 6)->methodPointer; auto array = getComponents(optionItem2Toggle, reinterpret_cast(GetRuntimeType( @@ -7777,9 +7447,9 @@ namespace if (transform) { - if (uobject_get_name(transform)->chars == L"ToggleMute"s || - uobject_get_name(transform)->chars == L"ImageIcon"s || - uobject_get_name(transform)->chars == L"Line"s) + if (UnityEngine::Object::Name(transform)->chars == L"ToggleMute"s || + UnityEngine::Object::Name(transform)->chars == L"ImageIcon"s || + UnityEngine::Object::Name(transform)->chars == L"Line"s) { destroyTargets.emplace_back(transform); } @@ -7804,9 +7474,9 @@ namespace if (transform) { - if (uobject_get_name(transform)->chars == L"Slider"s) + if (UnityEngine::Object::Name(transform)->chars == L"Slider"s) { - il2cpp_class_get_method_from_name_type(transform->klass, "set_sizeDelta", 1)->methodPointer(transform, Vector2_t{ 560, 24 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_sizeDelta", 1)->methodPointer(transform, UnityEngine::Vector2{ 560, 24 }); break; } } @@ -7814,19 +7484,19 @@ namespace auto gameObject = CreateGameObject(); - uobject_set_name(gameObject, il2cpp_string_new(name)); + UnityEngine::Object::Name(gameObject, il2cpp_string_new(name)); auto rootTransform = AddComponent(gameObject, GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, Vector2_t{ 0.5, 1 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0.5, 1 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); auto verticalLayoutGroup = AddComponent(gameObject, GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "VerticalLayoutGroup")); il2cpp_class_get_method_from_name_type(verticalLayoutGroup->klass, "set_childAlignment", 1)->methodPointer(verticalLayoutGroup, 1); @@ -7840,7 +7510,7 @@ namespace auto sliderTransform = GetRectTransform(optionSlider); - il2cpp_class_get_method_from_name_type(sliderTransform->klass, "set_sizeDelta", 1)->methodPointer(sliderTransform, Vector2_t{ 1000, 86 }); + il2cpp_class_get_method_from_name_type(sliderTransform->klass, "set_sizeDelta", 1)->methodPointer(sliderTransform, UnityEngine::Vector2{ 1000, 86 }); il2cpp_class_get_method_from_name_type(sliderTransform->klass, "SetParent", 2)->methodPointer(sliderTransform, rootTransform, false); return gameObject; @@ -7885,17 +7555,17 @@ namespace auto transform = GetRectTransform(dropdownGameObject); - il2cpp_class_get_method_from_name_type(transform->klass, "set_sizeDelta", 1)->methodPointer(transform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_sizeDelta", 1)->methodPointer(transform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(transform->klass, "set_anchorMax", 1)->methodPointer(transform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_anchorMax", 1)->methodPointer(transform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(transform->klass, "set_anchorMin", 1)->methodPointer(transform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_anchorMin", 1)->methodPointer(transform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(transform->klass, "set_pivot", 1)->methodPointer(transform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_pivot", 1)->methodPointer(transform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(transform->klass, "set_anchoredPosition", 1)->methodPointer(transform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_anchoredPosition", 1)->methodPointer(transform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(transform->klass, "set_localPosition", 1)->methodPointer(transform, Vector3_t{ 0, 0, -10 }); + il2cpp_class_get_method_from_name_type(transform->klass, "set_localPosition", 1)->methodPointer(transform, UnityEngine::Vector3{ 0, 0, -10 }); return dropdownGameObject; } @@ -7924,7 +7594,7 @@ namespace auto radioButtonWithText = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - uobject_set_name(radioButtonWithText, il2cpp_string_new(name)); + UnityEngine::Object::Name(radioButtonWithText, il2cpp_string_new(name)); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(radioButtonWithText->klass, "GetComponentsInternal", 6)->methodPointer; auto array = getComponents(radioButtonWithText, reinterpret_cast(GetRuntimeType( @@ -8023,27 +7693,24 @@ namespace auto gameObject = CreateGameObject(); auto rootTransform = AddComponent(gameObject, GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); auto scrollViewBase = resources_load_hook(il2cpp_string_new("ui/parts/base/scrollviewbase"), GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject")); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - auto _mainCanvasField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_mainCanvas"); - Il2CppObject* _mainCanvas; - il2cpp_field_get_value(uiManager, _mainCanvasField, &_mainCanvas); + auto uiManager = Gallop::UIManager::Instance(); + Il2CppObject* _mainCanvas = uiManager._mainCanvas(); auto transform = il2cpp_class_get_method_from_name_type(_mainCanvas->klass, "get_transform", 0)->methodPointer(_mainCanvas); - scrollViewBase = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingleWithParent", 3) - (scrollViewBase, transform, false); + scrollViewBase = UnityEngine::Object::Internal_CloneSingleWithParent(scrollViewBase, transform, false); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(scrollViewBase->klass, "GetComponentsInternal", 6)->methodPointer; @@ -8058,15 +7725,15 @@ namespace auto scrollRectTransform = il2cpp_class_get_method_from_name_type(m_Viewport->klass, "get_parent", 0)->methodPointer(m_Viewport); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, Vector2_t{ -24, -12 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ -24, -12 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, -6 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, -6 }); il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "SetParent", 2)->methodPointer(scrollRectTransform, rootTransform, false); @@ -8074,23 +7741,23 @@ namespace Il2CppObject* m_Content; il2cpp_field_get_value(scrollRect, m_ContentField, &m_Content); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, Vector2_t{ 56, 150.0f * ceilf(options.size() / 2.0f) }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 56, 150.0f * ceilf(options.size() / 2.0f) }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, Vector2_t{ 0, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, Vector2_t{ 0.5, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0.5, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 0 }); auto contentGameObject = il2cpp_class_get_method_from_name_type(m_Content->klass, "get_gameObject", 0)->methodPointer(m_Content); auto gridLayoutGroup = AddComponent(contentGameObject, GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "GridLayoutGroup")); il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_childAlignment", 1)->methodPointer(gridLayoutGroup, 0); il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_constraintCount", 1)->methodPointer(gridLayoutGroup, 2); - il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_cellSize", 1)->methodPointer(gridLayoutGroup, Vector2_t{ 400, 100 }); - il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_spacing", 1)->methodPointer(gridLayoutGroup, Vector2_t{ 34, 50 }); + il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_cellSize", 1)->methodPointer(gridLayoutGroup, UnityEngine::Vector2{ 400, 100 }); + il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_spacing", 1)->methodPointer(gridLayoutGroup, UnityEngine::Vector2{ 34, 50 }); auto padding = il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "get_padding", 0)->methodPointer(gridLayoutGroup); il2cpp_class_get_method_from_name_type(padding->klass, "set_top", 1)->methodPointer(padding, 26); @@ -8098,13 +7765,13 @@ namespace auto toggleGroupCommon = AddComponent(contentGameObject, GetRuntimeType("umamusume.dll", "Gallop", "ToggleGroupCommon")); - uobject_set_name(contentGameObject, il2cpp_string_new("option_toggle_group_content")); + UnityEngine::Object::Name(contentGameObject, il2cpp_string_new("option_toggle_group_content")); vector toggles; for (auto& pair : options) { - toggles.emplace_back(GetRadioButtonWithText(("radio_"s + pair).data(), local::u8_wide(pair).data())); + toggles.emplace_back(GetRadioButtonWithText(("radio_"s + pair).data(), u8_wide(pair).data())); } AddToLayout(m_Content, toggles); @@ -8174,27 +7841,24 @@ namespace auto gameObject = CreateGameObject(); auto rootTransform = AddComponent(gameObject, GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); auto scrollViewBase = resources_load_hook(il2cpp_string_new("ui/parts/base/scrollviewbase"), GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject")); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - auto _mainCanvasField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_mainCanvas"); - Il2CppObject* _mainCanvas; - il2cpp_field_get_value(uiManager, _mainCanvasField, &_mainCanvas); + auto uiManager = Gallop::UIManager::Instance(); + Il2CppObject* _mainCanvas = uiManager._mainCanvas(); auto transform = il2cpp_class_get_method_from_name_type(_mainCanvas->klass, "get_transform", 0)->methodPointer(_mainCanvas); - scrollViewBase = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingleWithParent", 3) - (scrollViewBase, transform, false); + scrollViewBase = UnityEngine::Object::Internal_CloneSingleWithParent(scrollViewBase, transform, false); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(scrollViewBase->klass, "GetComponentsInternal", 6)->methodPointer; @@ -8209,15 +7873,15 @@ namespace auto scrollRectTransform = il2cpp_class_get_method_from_name_type(m_Viewport->klass, "get_parent", 0)->methodPointer(m_Viewport); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, Vector2_t{ -24, -12 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ -24, -12 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, -6 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, -6 }); il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "SetParent", 2)->methodPointer(scrollRectTransform, rootTransform, false); @@ -8225,23 +7889,23 @@ namespace Il2CppObject* m_Content; il2cpp_field_get_value(scrollRect, m_ContentField, &m_Content); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, Vector2_t{ 56, 150.0f * ceilf(options.size() / 2.0f) }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 56, 150.0f * ceilf(options.size() / 2.0f) }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, Vector2_t{ 0, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, Vector2_t{ 0.5, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0.5, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 0 }); auto contentGameObject = il2cpp_class_get_method_from_name_type(m_Content->klass, "get_gameObject", 0)->methodPointer(m_Content); auto gridLayoutGroup = AddComponent(contentGameObject, GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "GridLayoutGroup")); il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_childAlignment", 1)->methodPointer(gridLayoutGroup, 0); il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_constraintCount", 1)->methodPointer(gridLayoutGroup, 2); - il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_cellSize", 1)->methodPointer(gridLayoutGroup, Vector2_t{ 400, 100 }); - il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_spacing", 1)->methodPointer(gridLayoutGroup, Vector2_t{ 34, 50 }); + il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_cellSize", 1)->methodPointer(gridLayoutGroup, UnityEngine::Vector2{ 400, 100 }); + il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_spacing", 1)->methodPointer(gridLayoutGroup, UnityEngine::Vector2{ 34, 50 }); auto padding = il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "get_padding", 0)->methodPointer(gridLayoutGroup); il2cpp_class_get_method_from_name_type(padding->klass, "set_top", 1)->methodPointer(padding, 26); @@ -8249,13 +7913,13 @@ namespace auto toggleGroupCommon = AddComponent(contentGameObject, GetRuntimeType("umamusume.dll", "Gallop", "ToggleGroupCommon")); - uobject_set_name(contentGameObject, il2cpp_string_new("option_toggle_group_content")); + UnityEngine::Object::Name(contentGameObject, il2cpp_string_new("option_toggle_group_content")); vector toggles; for (auto& color : options) { - auto colorW = local::u8_wide(color); + auto colorW = u8_wide(color); toggles.emplace_back(GetRadioButtonWithText(("radio_"s + color).data(), colorW.data())); SetTextCommonFontColor(GetTextCommon(("radio_"s + color).data()), colorW.data()); } @@ -8328,27 +7992,24 @@ namespace auto gameObject = CreateGameObject(); auto rootTransform = AddComponent(gameObject, GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); auto scrollViewBase = resources_load_hook(il2cpp_string_new("ui/parts/base/scrollviewbase"), GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject")); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - auto _mainCanvasField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_mainCanvas"); - Il2CppObject* _mainCanvas; - il2cpp_field_get_value(uiManager, _mainCanvasField, &_mainCanvas); + auto uiManager = Gallop::UIManager::Instance(); + Il2CppObject* _mainCanvas = uiManager._mainCanvas(); auto transform = il2cpp_class_get_method_from_name_type(_mainCanvas->klass, "get_transform", 0)->methodPointer(_mainCanvas); - scrollViewBase = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingleWithParent", 3) - (scrollViewBase, transform, false); + scrollViewBase = UnityEngine::Object::Internal_CloneSingleWithParent(scrollViewBase, transform, false); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(scrollViewBase->klass, "GetComponentsInternal", 6)->methodPointer; @@ -8363,15 +8024,15 @@ namespace auto scrollRectTransform = il2cpp_class_get_method_from_name_type(m_Viewport->klass, "get_parent", 0)->methodPointer(m_Viewport); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, Vector2_t{ -24, -12 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ -24, -12 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, -6 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, -6 }); il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "SetParent", 2)->methodPointer(scrollRectTransform, rootTransform, false); @@ -8379,23 +8040,23 @@ namespace Il2CppObject* m_Content; il2cpp_field_get_value(scrollRect, m_ContentField, &m_Content); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, Vector2_t{ 56, 150.0f * ceilf(options.size() / 2.0f) }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 56, 150.0f * ceilf(options.size() / 2.0f) }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, Vector2_t{ 0, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, Vector2_t{ 0.5, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0.5, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 0 }); auto contentGameObject = il2cpp_class_get_method_from_name_type(m_Content->klass, "get_gameObject", 0)->methodPointer(m_Content); auto gridLayoutGroup = AddComponent(contentGameObject, GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "GridLayoutGroup")); il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_childAlignment", 1)->methodPointer(gridLayoutGroup, 0); il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_constraintCount", 1)->methodPointer(gridLayoutGroup, 2); - il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_cellSize", 1)->methodPointer(gridLayoutGroup, Vector2_t{ 400, 100 }); - il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_spacing", 1)->methodPointer(gridLayoutGroup, Vector2_t{ 34, 50 }); + il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_cellSize", 1)->methodPointer(gridLayoutGroup, UnityEngine::Vector2{ 400, 100 }); + il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_spacing", 1)->methodPointer(gridLayoutGroup, UnityEngine::Vector2{ 34, 50 }); auto padding = il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "get_padding", 0)->methodPointer(gridLayoutGroup); il2cpp_class_get_method_from_name_type(padding->klass, "set_top", 1)->methodPointer(padding, 26); @@ -8403,13 +8064,13 @@ namespace auto toggleGroupCommon = AddComponent(contentGameObject, GetRuntimeType("umamusume.dll", "Gallop", "ToggleGroupCommon")); - uobject_set_name(contentGameObject, il2cpp_string_new("option_toggle_group_content")); + UnityEngine::Object::Name(contentGameObject, il2cpp_string_new("option_toggle_group_content")); vector toggles; for (auto& size : options) { - auto sizeW = local::u8_wide(size); + auto sizeW = u8_wide(size); toggles.emplace_back(GetRadioButtonWithText(("radio_"s + size).data(), sizeW.data())); SetTextCommonFontColor(GetTextCommon(("radio_"s + size).data()), L"White"); SetTextCommonOutlineSize(GetTextCommon(("radio_"s + size).data()), sizeW.data()); @@ -8484,27 +8145,24 @@ namespace auto gameObject = CreateGameObject(); auto rootTransform = AddComponent(gameObject, GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); auto scrollViewBase = resources_load_hook(il2cpp_string_new("ui/parts/base/scrollviewbase"), GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject")); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - auto _mainCanvasField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_mainCanvas"); - Il2CppObject* _mainCanvas; - il2cpp_field_get_value(uiManager, _mainCanvasField, &_mainCanvas); + auto uiManager = Gallop::UIManager::Instance(); + Il2CppObject* _mainCanvas = uiManager._mainCanvas(); auto transform = il2cpp_class_get_method_from_name_type(_mainCanvas->klass, "get_transform", 0)->methodPointer(_mainCanvas); - scrollViewBase = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingleWithParent", 3) - (scrollViewBase, transform, false); + scrollViewBase = UnityEngine::Object::Internal_CloneSingleWithParent(scrollViewBase, transform, false); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(scrollViewBase->klass, "GetComponentsInternal", 6)->methodPointer; @@ -8519,15 +8177,15 @@ namespace auto scrollRectTransform = il2cpp_class_get_method_from_name_type(m_Viewport->klass, "get_parent", 0)->methodPointer(m_Viewport); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, Vector2_t{ -24, -12 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ -24, -12 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, -6 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, -6 }); il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "SetParent", 2)->methodPointer(scrollRectTransform, rootTransform, false); @@ -8535,23 +8193,23 @@ namespace Il2CppObject* m_Content; il2cpp_field_get_value(scrollRect, m_ContentField, &m_Content); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, Vector2_t{ 56, 150.0f * ceilf(options.size() / 2.0f) }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 56, 150.0f * ceilf(options.size() / 2.0f) }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, Vector2_t{ 0, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, Vector2_t{ 0.5, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0.5, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 0 }); auto contentGameObject = il2cpp_class_get_method_from_name_type(m_Content->klass, "get_gameObject", 0)->methodPointer(m_Content); auto gridLayoutGroup = AddComponent(contentGameObject, GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "GridLayoutGroup")); il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_childAlignment", 1)->methodPointer(gridLayoutGroup, 0); il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_constraintCount", 1)->methodPointer(gridLayoutGroup, 2); - il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_cellSize", 1)->methodPointer(gridLayoutGroup, Vector2_t{ 400, 100 }); - il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_spacing", 1)->methodPointer(gridLayoutGroup, Vector2_t{ 34, 50 }); + il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_cellSize", 1)->methodPointer(gridLayoutGroup, UnityEngine::Vector2{ 400, 100 }); + il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "set_spacing", 1)->methodPointer(gridLayoutGroup, UnityEngine::Vector2{ 34, 50 }); auto padding = il2cpp_class_get_method_from_name_type(gridLayoutGroup->klass, "get_padding", 0)->methodPointer(gridLayoutGroup); il2cpp_class_get_method_from_name_type(padding->klass, "set_top", 1)->methodPointer(padding, 26); @@ -8559,13 +8217,13 @@ namespace auto toggleGroupCommon = AddComponent(contentGameObject, GetRuntimeType("umamusume.dll", "Gallop", "ToggleGroupCommon")); - uobject_set_name(contentGameObject, il2cpp_string_new("option_toggle_group_content")); + UnityEngine::Object::Name(contentGameObject, il2cpp_string_new("option_toggle_group_content")); vector toggles; for (auto& color : options) { - auto colorW = local::u8_wide(color); + auto colorW = u8_wide(color); toggles.emplace_back(GetRadioButtonWithText(("radio_"s + color).data(), colorW.data())); SetTextCommonOutlineColor(GetTextCommon(("radio_"s + color).data()), colorW.data()); } @@ -8717,6 +8375,8 @@ namespace AddOrSet(configDocument, L"characterSystemTextCaptionBackgroundAlpha", GetOptionSliderValue("character_system_text_caption_background_alpha") / 100); + AddOrSet(configDocument, L"liveSliderAlwaysShow", GetOptionItemOnOffIsOn("live_slider_always_show")); + AddOrSet(configDocument, L"championsLiveShowText", GetOptionItemOnOffIsOn("champions_live_show_text")); AddOrSet(configDocument, L"championsLiveYear", GetToggleGroupCommonValue("champions_live_year") + 2022); @@ -8770,6 +8430,8 @@ namespace config::character_system_text_caption_outline_color = configDocument[L"characterSystemTextCaptionOutlineColor"].GetString(); + config::live_slider_always_show = configDocument[L"liveSliderAlwaysShow"].GetBool(); + config::champions_live_show_text = configDocument[L"championsLiveShowText"].GetBool(); config::champions_live_year = configDocument[L"championsLiveYear"].GetInt(); @@ -8890,27 +8552,24 @@ namespace auto gameObject = CreateGameObject(); auto rootTransform = AddComponent(gameObject, GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); auto scrollViewBase = resources_load_hook(il2cpp_string_new("ui/parts/base/scrollviewbase"), GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject")); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - auto _mainCanvasField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_mainCanvas"); - Il2CppObject* _mainCanvas; - il2cpp_field_get_value(uiManager, _mainCanvasField, &_mainCanvas); + auto uiManager = Gallop::UIManager::Instance(); + Il2CppObject* _mainCanvas = uiManager._mainCanvas(); auto transform = il2cpp_class_get_method_from_name_type(_mainCanvas->klass, "get_transform", 0)->methodPointer(_mainCanvas); - scrollViewBase = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingleWithParent", 3) - (scrollViewBase, transform, false); + scrollViewBase = UnityEngine::Object::Internal_CloneSingleWithParent(scrollViewBase, transform, false); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(scrollViewBase->klass, "GetComponentsInternal", 6)->methodPointer; @@ -8925,15 +8584,15 @@ namespace auto scrollRectTransform = il2cpp_class_get_method_from_name_type(m_Viewport->klass, "get_parent", 0)->methodPointer(m_Viewport); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, Vector2_t{ -24, -12 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ -24, -12 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, -6 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, -6 }); il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "SetParent", 2)->methodPointer(scrollRectTransform, rootTransform, false); @@ -8941,15 +8600,15 @@ namespace Il2CppObject* m_Content; il2cpp_field_get_value(scrollRect, m_ContentField, &m_Content); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, Vector2_t{ 56, 0 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 56, 0 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, Vector2_t{ 0, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, Vector2_t{ 0.5, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0.5, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 0 }); auto contentGameObject = il2cpp_class_get_method_from_name_type(m_Content->klass, "get_gameObject", 0)->methodPointer(m_Content); @@ -8964,6 +8623,7 @@ namespace int antiAliasing = 0; bool characterSystemTextCaption = false; + bool liveSliderAlwaysShow = false; bool championsLiveShowText = false; int championsLiveYear = 2022; float characterSystemTextCaptionPositionX = 0; @@ -9006,6 +8666,11 @@ namespace championsLiveShowText = configDocument[L"championsLiveShowText"].GetBool(); } + if (configDocument.HasMember(L"liveSliderAlwaysShow")) + { + liveSliderAlwaysShow = configDocument[L"liveSliderAlwaysShow"].GetBool(); + } + if (configDocument.HasMember(L"championsLiveYear")) { championsLiveYear = configDocument[L"championsLiveYear"].GetInt(); @@ -9113,7 +8778,7 @@ namespace AddToLayout(m_Content, { GetOptionItemTitle(LocalifySettings::GetText("graphics")), - GetOptionItemSimpleWithButton("graphics_quality", (LocalifySettings::GetText("graphics_quality") + L": "s + local::u8_wide(graphicsQualityOptions[config::config_document[L"graphicsQuality"].GetInt() + 1])).data(), + GetOptionItemSimpleWithButton("graphics_quality", (LocalifySettings::GetText("graphics_quality") + L": "s + u8_wide(graphicsQualityOptions[config::config_document[L"graphicsQuality"].GetInt() + 1])).data(), localize_get_hook(GetTextIdByName(L"Circle0206"))->chars), GetOptionSlider("anti_aliasing", LocalifySettings::GetText("anti_aliasing"), antiAliasing, 0, 4, true, *[](Il2CppObject* slider) { auto numText = GetOptionSliderNumText(slider); @@ -9174,8 +8839,9 @@ namespace GetOptionSlider("ui_scale_portrait", LocalifySettings::GetText("ui_scale_portrait"), freeFormUiScalePortrait, 0.1, 2.0, false), GetOptionSlider("ui_scale_landscape", LocalifySettings::GetText("ui_scale_landscape"), freeFormUiScaleLandscape, 0.1, 2.0, false), GetOptionItemTitle(localize_get_hook(GetTextIdByName(L"Common0035"))->chars), + GetOptionItemOnOff("live_slider_always_show", LocalifySettings::GetText("live_slider_always_show")), GetOptionItemOnOff("champions_live_show_text", LocalifySettings::GetText("champions_live_show_text")), - GetOptionItemSimpleWithButton("champions_live_resource_id", (LocalifySettings::GetText("champions_live_resource_id") + L": "s + local::u8_wide(MasterDB::GetChampionsResources()[config::config_document[L"championsLiveResourceId"].GetInt() - 1])).data(), + GetOptionItemSimpleWithButton("champions_live_resource_id", (LocalifySettings::GetText("champions_live_resource_id") + L": "s + u8_wide(MasterDB::GetChampionsResources()[config::config_document[L"championsLiveResourceId"].GetInt() - 1])).data(), localize_get_hook(GetTextIdByName(L"Circle0206"))->chars), GetOptionItem3Toggle("champions_live_year", LocalifySettings::GetText("champions_live_year"), L"2022", L"2023", L"2024", championsLiveYear - 2022), GetOptionItemSimple(L""), @@ -9270,6 +8936,10 @@ namespace { })); + SetOptionItemOnOffAction("live_slider_always_show", liveSliderAlwaysShow, *([](Il2CppObject*, bool isOn) + { + })); + SetOptionItemOnOffAction("champions_live_show_text", championsLiveShowText, *([](Il2CppObject*, bool isOn) { })); @@ -9343,10 +9013,10 @@ namespace SetOptionItemButtonAction("show_notification", *([](Il2CppObject*) { auto leader_chara_id = MsgPackData::user_info["leader_chara_id"].int_value(); - auto title = local::u8_wide(MasterDB::GetTextData(6, leader_chara_id)); + auto title = u8_wide(MasterDB::GetTextData(6, leader_chara_id)); auto contentU8 = MasterDB::GetTextData(163, leader_chara_id); replaceAll(contentU8, "\\n", "\n"); - auto content = local::u8_wide(contentU8); + auto content = u8_wide(contentU8); DesktopNotificationManagerCompat::ShowToastNotification(title.data(), content.data(), MsgPackData::GetIconPath(leader_chara_id)->chars); })); @@ -9357,7 +9027,7 @@ namespace AddOrSet(config::config_document, L"graphicsQuality", value - 1); auto textCommon = GetOptionItemSimpleWithButtonTextCommon("graphics_quality"); - SetTextCommonText(textCommon, (LocalifySettings::GetText("graphics_quality") + L": "s + local::u8_wide(GetGraphicsQualityOptions()[config::config_document[L"graphicsQuality"].GetInt() + 1])).data()); + SetTextCommonText(textCommon, (LocalifySettings::GetText("graphics_quality") + L": "s + u8_wide(GetGraphicsQualityOptions()[config::config_document[L"graphicsQuality"].GetInt() + 1])).data()); }); })); @@ -9367,7 +9037,7 @@ namespace AddOrSet(config::config_document, L"championsLiveResourceId", value + 1); auto textCommon = GetOptionItemSimpleWithButtonTextCommon("champions_live_resource_id"); - SetTextCommonText(textCommon, (LocalifySettings::GetText("champions_live_resource_id") + L": "s + local::u8_wide(MasterDB::GetChampionsResources()[config::config_document[L"championsLiveResourceId"].GetInt() - 1])).data()); + SetTextCommonText(textCommon, (LocalifySettings::GetText("champions_live_resource_id") + L": "s + u8_wide(MasterDB::GetChampionsResources()[config::config_document[L"championsLiveResourceId"].GetInt() - 1])).data()); }); })); @@ -9379,7 +9049,7 @@ namespace SetOptionItemButtonAction("character_system_text_caption_font_color", *([](Il2CppObject*) { auto options = GetFontColorOptions(); - auto value = local::wide_u8(config::config_document[L"characterSystemTextCaptionFontColor"].GetString()); + auto value = wide_u8(config::config_document[L"characterSystemTextCaptionFontColor"].GetString()); auto found = find(options.begin(), options.end(), value); int index = 0; @@ -9390,7 +9060,7 @@ namespace OpenSelectFontColorOption(LocalifySettings::GetText("character_system_text_caption_font_color"), options, index, [](int value) { auto options = GetFontColorOptions(); - wstring color = local::u8_wide(options[value]); + wstring color = u8_wide(options[value]); AddOrSetString(config::config_document, L"characterSystemTextCaptionFontColor", color.data()); auto textCommon = GetOptionItemSimpleWithButtonTextCommon("character_system_text_caption_font_color"); @@ -9409,7 +9079,7 @@ namespace SetOptionItemButtonAction("character_system_text_caption_outline_size", *([](Il2CppObject*) { auto options = GetOutlineSizeOptions(); - auto value = local::wide_u8(config::config_document[L"characterSystemTextCaptionOutlineSize"].GetString()); + auto value = wide_u8(config::config_document[L"characterSystemTextCaptionOutlineSize"].GetString()); auto found = find(options.begin(), options.end(), value); int index = 0; @@ -9420,7 +9090,7 @@ namespace OpenSelectOutlineSizeOption(LocalifySettings::GetText("character_system_text_caption_outline_size"), options, index, [](int value) { auto options = GetOutlineSizeOptions(); - wstring color = local::u8_wide(options[value]); + wstring color = u8_wide(options[value]); AddOrSetString(config::config_document, L"characterSystemTextCaptionOutlineSize", color.data()); auto textCommon = GetOptionItemSimpleWithButtonTextCommon("character_system_text_caption_outline_size"); @@ -9437,7 +9107,7 @@ namespace SetOptionItemButtonAction("character_system_text_caption_outline_color", *([](Il2CppObject*) { auto options = GetOutlineColorOptions(); - auto value = local::wide_u8(config::config_document[L"characterSystemTextCaptionOutlineColor"].GetString()); + auto value = wide_u8(config::config_document[L"characterSystemTextCaptionOutlineColor"].GetString()); auto found = find(options.begin(), options.end(), value); int index = 0; @@ -9448,7 +9118,7 @@ namespace OpenSelectOutlineColorOption(LocalifySettings::GetText("character_system_text_caption_outline_color"), options, index, [](int value) { auto options = GetOutlineColorOptions(); - wstring color = local::u8_wide(options[value]); + wstring color = u8_wide(options[value]); AddOrSetString(config::config_document, L"characterSystemTextCaptionOutlineColor", color.data()); auto textCommon = GetOptionItemSimpleWithButtonTextCommon("character_system_text_caption_outline_color"); @@ -9502,7 +9172,7 @@ namespace localizeextension_text_hook(GetTextIdByName(L"Home0073")), CreateDelegateStatic(*[]() { - il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Application", "OpenURL", 1)(il2cpp_string_new("https://github.com/Kimjio/umamusume-localify")); + UnityEngine::Application::OpenURL(il2cpp_string_new("https://github.com/Kimjio/umamusume-localify")); }), GetTextIdByName(L"Common0004"), GetTextIdByName(L"Common0003"), @@ -9594,10 +9264,14 @@ namespace { auto& configDocument = config::config_document; + AddOrSet(configDocument, L"liveSliderAlwaysShow", GetOptionItemOnOffIsOn("live_slider_always_show")); + AddOrSet(configDocument, L"championsLiveShowText", GetOptionItemOnOffIsOn("champions_live_show_text")); AddOrSet(configDocument, L"championsLiveYear", GetToggleGroupCommonValue("champions_live_year") + 2022); + config::live_slider_always_show = configDocument[L"liveSliderAlwaysShow"].GetBool(); + config::champions_live_show_text = configDocument[L"championsLiveShowText"].GetBool(); config::champions_live_year = configDocument[L"championsLiveYear"].GetInt(); @@ -9656,27 +9330,24 @@ namespace auto gameObject = CreateGameObject(); auto rootTransform = AddComponent(gameObject, GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_sizeDelta", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMax", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchorMin", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_pivot", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(rootTransform->klass, "set_anchoredPosition", 1)->methodPointer(rootTransform, UnityEngine::Vector2{ 0, 0 }); auto scrollViewBase = resources_load_hook(il2cpp_string_new("ui/parts/base/scrollviewbase"), GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject")); - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - auto _mainCanvasField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_mainCanvas"); - Il2CppObject* _mainCanvas; - il2cpp_field_get_value(uiManager, _mainCanvasField, &_mainCanvas); + auto uiManager = Gallop::UIManager::Instance(); + Il2CppObject* _mainCanvas = uiManager._mainCanvas(); auto transform = il2cpp_class_get_method_from_name_type(_mainCanvas->klass, "get_transform", 0)->methodPointer(_mainCanvas); - scrollViewBase = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingleWithParent", 3) - (scrollViewBase, transform, false); + scrollViewBase = UnityEngine::Object::Internal_CloneSingleWithParent(scrollViewBase, transform, false); auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(scrollViewBase->klass, "GetComponentsInternal", 6)->methodPointer; @@ -9691,15 +9362,15 @@ namespace auto scrollRectTransform = il2cpp_class_get_method_from_name_type(m_Viewport->klass, "get_parent", 0)->methodPointer(m_Viewport); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, Vector2_t{ -24, -12 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_sizeDelta", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ -24, -12 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMax", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchorMin", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, 0 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0.5, 0.5 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_pivot", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0.5, 0.5 }); - il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, Vector2_t{ 0, -6 }); + il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "set_anchoredPosition", 1)->methodPointer(scrollRectTransform, UnityEngine::Vector2{ 0, -6 }); il2cpp_class_get_method_from_name_type(scrollRectTransform->klass, "SetParent", 2)->methodPointer(scrollRectTransform, rootTransform, false); @@ -9707,15 +9378,15 @@ namespace Il2CppObject* m_Content; il2cpp_field_get_value(scrollRect, m_ContentField, &m_Content); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, Vector2_t{ 56, 0 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_sizeDelta", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 56, 0 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, Vector2_t{ 1, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMax", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 1, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, Vector2_t{ 0, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchorMin", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, Vector2_t{ 0.5, 1 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_pivot", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0.5, 1 }); - il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, Vector2_t{ 0, 0 }); + il2cpp_class_get_method_from_name_type(m_Content->klass, "set_anchoredPosition", 1)->methodPointer(m_Content, UnityEngine::Vector2{ 0, 0 }); auto contentGameObject = il2cpp_class_get_method_from_name_type(m_Content->klass, "get_gameObject", 0)->methodPointer(m_Content); @@ -9728,6 +9399,7 @@ namespace il2cpp_class_get_method_from_name_type(padding->klass, "set_top", 1)->methodPointer(padding, -20); il2cpp_class_get_method_from_name_type(padding->klass, "set_bottom", 1)->methodPointer(padding, 16); + bool liveSliderAlwaysShow = false; bool championsLiveShowText = false; int championsLiveYear = 2023; @@ -9735,6 +9407,11 @@ namespace { auto& configDocument = config::config_document; + if (configDocument.HasMember(L"liveSliderAlwaysShow")) + { + liveSliderAlwaysShow = configDocument[L"liveSliderAlwaysShow"].GetBool(); + } + if (configDocument.HasMember(L"championsLiveShowText")) { championsLiveShowText = configDocument[L"championsLiveShowText"].GetBool(); @@ -9749,17 +9426,21 @@ namespace AddToLayout(m_Content, { GetOptionItemTitle(localize_get_hook(GetTextIdByName(L"Common0035"))->chars), + GetOptionItemOnOff("live_slider_always_show", LocalifySettings::GetText("live_slider_always_show")), GetOptionItemOnOff("champions_live_show_text", LocalifySettings::GetText("champions_live_show_text")), - GetOptionItemSimpleWithButton("champions_live_resource_id", (LocalifySettings::GetText("champions_live_resource_id") + L": "s + local::u8_wide(MasterDB::GetChampionsResources()[config::config_document[L"championsLiveResourceId"].GetInt() - 1])).data(), + GetOptionItemSimpleWithButton("champions_live_resource_id", (LocalifySettings::GetText("champions_live_resource_id") + L": "s + u8_wide(MasterDB::GetChampionsResources()[config::config_document[L"championsLiveResourceId"].GetInt() - 1])).data(), localize_get_hook(GetTextIdByName(L"Circle0206"))->chars), GetOptionItem3Toggle("champions_live_year", LocalifySettings::GetText("champions_live_year"), L"2022", L"2023", L"2024", championsLiveYear - 2022), GetOptionItemSimple(L""), } ); + SetOptionItemOnOffAction("live_slider_always_show", liveSliderAlwaysShow, *([](Il2CppObject*, bool isOn) + { + })); + SetOptionItemOnOffAction("champions_live_show_text", championsLiveShowText, *([](Il2CppObject*, bool isOn) { - // TODO })); SetOptionItemButtonAction("champions_live_resource_id", *([](Il2CppObject*) @@ -9768,7 +9449,7 @@ namespace AddOrSet(config::config_document, L"championsLiveResourceId", value + 1); auto textCommon = GetOptionItemSimpleWithButtonTextCommon("champions_live_resource_id"); - SetTextCommonText(textCommon, (LocalifySettings::GetText("champions_live_resource_id") + L": "s + local::u8_wide(MasterDB::GetChampionsResources()[config::config_document[L"championsLiveResourceId"].GetInt() - 1])).data()); + SetTextCommonText(textCommon, (LocalifySettings::GetText("champions_live_resource_id") + L": "s + u8_wide(MasterDB::GetChampionsResources()[config::config_document[L"championsLiveResourceId"].GetInt() - 1])).data()); }); })); @@ -9863,7 +9544,7 @@ namespace auto workDataManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "WorkDataManager")); auto workUserData = il2cpp_class_get_method_from_name_type(workDataManager->klass, "get_UserData", 0)->methodPointer(workDataManager); - auto viewerIdObscured = il2cpp_class_get_method_from_name_type(workUserData->klass, "get_ViewerId", 0)->methodPointer(workUserData); + auto viewerIdObscured = il2cpp_class_get_method_from_name_type(workUserData->klass, "get_ViewerId", 0)->methodPointer(workUserData); auto viewerId = viewerIdObscured.GetDecrypted(); il2cpp_symbols::get_method_pointer("UnityEngine.IMGUIModule.dll", "UnityEngine", "GUIUtility", "set_systemCopyBuffer", 1)(il2cpp_string_new16(to_wstring(viewerId).data())); @@ -9990,47 +9671,179 @@ namespace return false; } - void* Object_Internal_CloneSingleWithParent_orig = nullptr; - Il2CppObject* Object_Internal_CloneSingleWithParent_hook(Il2CppObject* data, Il2CppObject* parent, bool worldPositionStays) + UnityEngine::GameObject GetSlider(const char* name, float value, float min = 0, float max = 10, bool wholeNumbers = true, void (*onChange)(Il2CppObject*) = nullptr) { - auto cloned = reinterpret_cast(Object_Internal_CloneSingleWithParent_orig)(data, parent, worldPositionStays); + auto object = resources_load_hook(il2cpp_string_new("ui/parts/outgame/option/optionsoundvolumeslider"), GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject")); - if (wstring(uobject_get_name(cloned)->chars).find(L"ProfileTopView") != wstring::npos && Game::CurrentGameRegion == Game::Region::KOR) - { - static Il2CppDelegate* updateViewerIdText; - updateViewerIdText = &CreateDelegateWithClassStatic(il2cpp_symbols::get_class("DOTween.dll", "DG.Tweening", "TweenCallback"), *([](void*) - { - if (!UpdateViewerIdText()) - { - il2cpp_symbols::get_method_pointer("DOTween.dll", "DG.Tweening", "DOVirtual", "DelayedCall", 3)(0.05, updateViewerIdText, true); - } - }))->delegate; + auto optionSlider = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingle", 1)(object); - // Delay 50ms - il2cpp_symbols::get_method_pointer("DOTween.dll", "DG.Tweening", "DOVirtual", "DelayedCall", 3)(0.05, updateViewerIdText, true); - } + auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(optionSlider->klass, "GetComponentsInternal", 6)->methodPointer; - if (wstring(uobject_get_name(cloned)->chars).find(L"DialogOptionHome") != wstring::npos) - { - auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(cloned->klass, "GetComponentsInternal", 6)->methodPointer; - auto rectTransformArray = getComponents(cloned, reinterpret_cast(GetRuntimeType( - "UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")), true, true, false, false, nullptr); + auto optionSoundVolumeSliderArray = getComponents(optionSlider, reinterpret_cast(GetRuntimeType( + "umamusume.dll", "Gallop", "OptionSoundVolumeSlider")), true, true, false, false, nullptr); - for (int i = 0; i < rectTransformArray->max_length; i++) - { - auto rectTransform = rectTransformArray->vector[i]; + auto optionSoundVolumeSlider = optionSoundVolumeSliderArray->vector[0]; - if (rectTransform && local::wide_u8(uobject_get_name(rectTransform)->chars) == "Content") - { - InitOptionLayout(rectTransform); - break; - } + il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Destroy", 1)(optionSoundVolumeSlider); + + auto sliderCommonArray = getComponents(optionSlider, reinterpret_cast(GetRuntimeType( + "umamusume.dll", "Gallop", "SliderCommon")), true, true, false, false, nullptr); + + auto sliderCommon = sliderCommonArray->vector[0]; + + if (onChange) + { + auto onValueChanged = il2cpp_class_get_method_from_name_type(sliderCommon->klass, "get_onValueChanged", 0)->methodPointer(sliderCommon); + + auto AddCall = il2cpp_class_get_method_from_name_type(onValueChanged->klass, "AddCall", 1); + + auto delegateClass = GetGenericClass(GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine.Events", "UnityAction`1"), GetRuntimeType(il2cpp_defaults.single_class)); + + auto valueChanged = CreateDelegateWithClass(delegateClass, sliderCommon, onChange); + + auto invokeableCall = il2cpp_object_new(GetGenericClass(GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine.Events", "InvokableCall`1"), GetRuntimeType(il2cpp_defaults.single_class))); + + auto delegateField = il2cpp_class_get_field_from_name_wrap(invokeableCall->klass, "Delegate"); + il2cpp_field_set_value(invokeableCall, delegateField, valueChanged); + + AddCall->methodPointer(onValueChanged, invokeableCall); + } + + try + { + il2cpp_class_get_method_from_name_type(sliderCommon->klass, "set_wholeNumbers", 1)->methodPointer(sliderCommon, wholeNumbers); + il2cpp_class_get_method_from_name_type(sliderCommon->klass, "set_minValue", 1)->methodPointer(sliderCommon, min); + il2cpp_class_get_method_from_name_type(sliderCommon->klass, "set_maxValue", 1)->methodPointer(sliderCommon, max); + il2cpp_class_get_method_from_name_type(sliderCommon->klass, "set_value", 1)->methodPointer(sliderCommon, value); + } + catch (const Il2CppExceptionWrapper& e) + { + cout << e.ex->klass->name << ": "; + wcout << e.ex->message << endl; + } + + auto transformArray = GetRectTransformArray(optionSlider); + + vector destroyTargets; + + for (int i = 0; i < transformArray->max_length; i++) + { + auto transform = transformArray->vector[i]; + + if (transform) + { + if (UnityEngine::Object::Name(transform)->chars == L"TextName"s || + UnityEngine::Object::Name(transform)->chars == L"ToggleMute"s || + UnityEngine::Object::Name(transform)->chars == L"ImageIcon"s || + UnityEngine::Object::Name(transform)->chars == L"Line"s) + { + destroyTargets.emplace_back(transform); + } + } + } + + for (int i = 0; i < destroyTargets.size(); i++) + { + auto transform = destroyTargets[i]; + il2cpp_class_get_method_from_name_type(transform->klass, "SetParent", 2)->methodPointer(transform, nullptr, false); + auto gameObject = il2cpp_class_get_method_from_name_type(transform->klass, "get_gameObject", 0)->methodPointer(transform); + il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Destroy", 1)(gameObject); + } + + destroyTargets.clear(); + + transformArray = GetRectTransformArray(optionSlider); + UnityEngine::RectTransform sliderTransform{ nullptr }; + UnityEngine::RectTransform numTransform{ nullptr }; + + for (int i = 0; i < transformArray->max_length; i++) + { + auto transform = transformArray->vector[i]; + + if (transform) + { + if (UnityEngine::Object::Name(transform)->chars == L"Slider"s) + { + sliderTransform = UnityEngine::RectTransform(transform); + } + + if (UnityEngine::Object::Name(transform)->chars == L"Num"s) + { + numTransform = UnityEngine::RectTransform(transform); + } + + if (sliderTransform && numTransform) + { + break; + } + } + } + + auto array = getComponents(numTransform.gameObject(), reinterpret_cast(GetRuntimeType( + "umamusume.dll", "Gallop", "TextCommon")), true, true, false, false, nullptr); + + auto textCommon = array->vector[0]; + + SetTextCommonText(textCommon, L"0:00"); + + il2cpp_class_get_method_from_name_type(textCommon->klass, "set_OutlineSize", 1)->methodPointer(textCommon, GetEnumValue(ParseEnum(GetRuntimeType("umamusume.dll", "Gallop", "OutlineSizeType"), L"M"))); + il2cpp_class_get_method_from_name_type(textCommon->klass, "set_OutlineColor", 1)->methodPointer(textCommon, GetEnumValue(ParseEnum(GetRuntimeType("umamusume.dll", "Gallop", "OutlineColorType"), L"White"))); + il2cpp_class_get_method_from_name_type(textCommon->klass, "UpdateOutline", 0)->methodPointer(textCommon); + + numTransform.anchoredPosition({ -80, 10 }); + numTransform.anchorMax({ 0, 0.5 }); + numTransform.anchorMin({ 0, 0.5 }); + numTransform.sizeDelta({ 60, 50 }); + numTransform.pivot({ 0, 0.5 }); + + auto gameObject = sliderTransform.gameObject(); + + UnityEngine::Object::Name(gameObject, il2cpp_string_new(name)); + + return gameObject; + } + + void* Object_Internal_CloneSingleWithParent_orig = nullptr; + Il2CppObject* Object_Internal_CloneSingleWithParent_hook(Il2CppObject* data, Il2CppObject* parent, bool worldPositionStays) + { + auto cloned = reinterpret_cast(Object_Internal_CloneSingleWithParent_orig)(data, parent, worldPositionStays); + + if (wstring(UnityEngine::Object::Name(cloned)->chars).find(L"ProfileTopView") != wstring::npos && Game::CurrentGameRegion == Game::Region::KOR) + { + static Il2CppDelegate* updateViewerIdText; + updateViewerIdText = &CreateDelegateWithClassStatic(il2cpp_symbols::get_class("DOTween.dll", "DG.Tweening", "TweenCallback"), *([](void*) + { + if (!UpdateViewerIdText()) + { + il2cpp_symbols::get_method_pointer("DOTween.dll", "DG.Tweening", "DOVirtual", "DelayedCall", 3)(0.05, updateViewerIdText, true); + } + }))->delegate; + + // Delay 50ms + il2cpp_symbols::get_method_pointer("DOTween.dll", "DG.Tweening", "DOVirtual", "DelayedCall", 3)(0.05, updateViewerIdText, true); + } + + if (wstring(UnityEngine::Object::Name(cloned)->chars).find(L"DialogOptionHome") != wstring::npos) + { + auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(cloned->klass, "GetComponentsInternal", 6)->methodPointer; + auto rectTransformArray = getComponents(cloned, reinterpret_cast(GetRuntimeType( + "UnityEngine.CoreModule.dll", "UnityEngine", "RectTransform")), true, true, false, false, nullptr); + + for (int i = 0; i < rectTransformArray->max_length; i++) + { + auto rectTransform = rectTransformArray->vector[i]; + + if (rectTransform && wide_u8(UnityEngine::Object::Name(rectTransform)->chars) == "Content") + { + InitOptionLayout(rectTransform); + break; + } } SetupOptionLayout(); } - if (wstring(uobject_get_name(cloned)->chars).find(L"DialogOptionLiveTheater") != wstring::npos) + if (wstring(UnityEngine::Object::Name(cloned)->chars).find(L"DialogOptionLiveTheater") != wstring::npos) { auto getComponents = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*, Il2CppType*, bool, bool, bool, bool, Il2CppObject*)>(cloned->klass, "GetComponentsInternal", 6)->methodPointer; auto rectTransformArray = getComponents(cloned, reinterpret_cast(GetRuntimeType( @@ -10040,7 +9853,7 @@ namespace { auto rectTransform = rectTransformArray->vector[i]; - if (rectTransform && local::wide_u8(uobject_get_name(rectTransform)->chars) == "Content") + if (rectTransform && wide_u8(UnityEngine::Object::Name(rectTransform)->chars) == "Content") { InitOptionLayout(rectTransform); break; @@ -10050,7 +9863,7 @@ namespace SetupLiveOptionLayout(); } - if (wstring(uobject_get_name(cloned)->chars).find(L"CharacterHomeTopUI") != wstring::npos) + if (wstring(UnityEngine::Object::Name(cloned)->chars).find(L"CharacterHomeTopUI") != wstring::npos) { auto getComponent = il2cpp_class_get_method_from_name_type(cloned->klass, "GetComponent", 1)->methodPointer; auto CharacterHomeTopUI = getComponent(cloned, GetRuntimeType("umamusume.dll", "Gallop", "CharacterHomeTopUI")); @@ -10074,7 +9887,229 @@ namespace } } - if (wstring(uobject_get_name(cloned)->chars).find(L"LiveChampionsTextController") != wstring::npos) + if (wstring(UnityEngine::Object::Name(cloned)->chars).find(L"LiveView") != wstring::npos) + { + auto gameObject = UnityEngine::GameObject(cloned); + auto contentsRoot = gameObject.transform().Find(il2cpp_string_new(config::live_slider_always_show ? "ContentsRoot" : "ContentsRoot/MenuRoot")); + auto slider = GetSlider("live_slider", 0, 0, 180, false, + *[](Il2CppObject* sliderCommon) + { + auto value = GetOptionSliderValue("live_slider"); + + auto director = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop.Live", "Director")); + if (director) + { + bool isPauseLive = il2cpp_class_get_method_from_name_type(director->klass, "IsPauseLive", 0)->methodPointer(); + + auto _liveCurrentTimeField = il2cpp_class_get_field_from_name_wrap(director->klass, "_liveCurrentTime"); + il2cpp_field_set_value(director, _liveCurrentTimeField, &value); + + auto LiveTimeController = il2cpp_class_get_method_from_name_type(director->klass, "get_LiveTimeController", 0)->methodPointer(director); + auto _elapsedTimeField = il2cpp_class_get_field_from_name_wrap(LiveTimeController->klass, "_elapsedTime"); + il2cpp_field_set_value(LiveTimeController, _elapsedTimeField, &value); + il2cpp_class_get_method_from_name_type(LiveTimeController->klass, "set_CurrentTime", 1)->methodPointer(LiveTimeController, value); + + auto AudioManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "AudioManager")); + auto CriAudioManager = il2cpp_class_get_method_from_name_type(AudioManager->klass, "get_CriAudioManager", 0)->methodPointer(AudioManager); + + auto audioCtrlDictField = il2cpp_class_get_field_from_name_wrap(CriAudioManager->klass, "audioCtrlDict"); + Il2CppObject* audioCtrlDict; + il2cpp_field_get_value(CriAudioManager, audioCtrlDictField, &audioCtrlDict); + + auto _songPlaybackField = il2cpp_class_get_field_from_name_wrap(AudioManager->klass, "_songPlayback"); + Cute::Cri::AudioPlayback _songPlayback; + il2cpp_field_get_value(AudioManager, _songPlaybackField, &_songPlayback); + + auto _songCharaPlaybacksField = il2cpp_class_get_field_from_name_wrap(AudioManager->klass, "_songCharaPlaybacks"); + Il2CppArraySize_t* _songCharaPlaybacks; + il2cpp_field_get_value(AudioManager, _songCharaPlaybacksField, &_songCharaPlaybacks); + + void** params = new void* [1]; + params[0] = &_songPlayback.soundGroup; + + Il2CppException* exception; + + auto audioCtrl = il2cpp_runtime_invoke(il2cpp_class_get_method_from_name(audioCtrlDict->klass, "get_Item", 1), audioCtrlDict, params, &exception); + + delete[] params; + + if (exception) + { + wcout << exception->message->chars << endl; + } + + auto poolField = il2cpp_class_get_field_from_name_wrap(audioCtrl->klass, "pool"); + Il2CppObject* pool; + il2cpp_field_get_value(audioCtrl, poolField, &pool); + + if (pool) + { + auto method = il2cpp_symbols::find_method("Cute.Cri.Assembly.dll", "Cute.Cri", "CuteAudioSourcePool", [](const MethodInfo* info) + { + if (info->name == "FindSourceIndex"s && info->parameters[0].name == "playback"s) + { + return true; + } + + return false; + }); + + auto sourceIndex = method(pool, _songPlayback); + + params = new void* [1]; + params[0] = &sourceIndex; + + auto cuteAudioSource = il2cpp_runtime_invoke(il2cpp_class_get_method_from_name(pool->klass, "get_Item", 1), pool, params, &exception); + + delete[] params; + + if (exception) + { + wcout << exception->message->chars << endl; + } + + if (cuteAudioSource) + { + auto sourceListField = il2cpp_class_get_field_from_name_wrap(cuteAudioSource->klass, "sourceList"); + Il2CppObject* sourceList; + il2cpp_field_get_value(cuteAudioSource, sourceListField, &sourceList); + + auto usingIndexField = il2cpp_class_get_field_from_name_wrap(cuteAudioSource->klass, "usingIndex"); + int usingIndex; + il2cpp_field_get_value(cuteAudioSource, usingIndexField, &usingIndex); + + params = new void* [1]; + params[0] = &usingIndex; + + auto AtomSource = il2cpp_runtime_invoke(il2cpp_class_get_method_from_name(sourceList->klass, "get_Item", 1), sourceList, params, &exception); + + delete[] params; + + if (exception) + { + wcout << exception->message->chars << endl; + } + + auto player = il2cpp_class_get_method_from_name_type(AtomSource->klass, "get_player", 0)->methodPointer(AtomSource); + il2cpp_class_get_method_from_name_type(player->klass, "Stop", 0)->methodPointer(player); + il2cpp_class_get_method_from_name_type(player->klass, "SetStartTime", 1)->methodPointer(player, static_cast(roundf(value * 1000.0f))); + auto playback = il2cpp_class_get_method_from_name_type(player->klass, "Start", 0)->methodPointer(player); + + + if (isPauseLive) + { + il2cpp_class_get_method_from_name_type(player->klass, "Pause", 0)->methodPointer(player); + } + + _songPlayback.criAtomExPlayback = playback; + il2cpp_field_set_value(AudioManager, _songPlaybackField, &_songPlayback); + il2cpp_class_get_method_from_name_type(AtomSource->klass, "set_Playback", 1)->methodPointer(AtomSource, playback); + } + } + + + if (_songCharaPlaybacks) + { + for (int i = 0; i < _songCharaPlaybacks->max_length; i++) + { + auto charaPlayback = _songCharaPlaybacks->vector[i]; + + void** params = new void* [1]; + params[0] = &charaPlayback.soundGroup; + + Il2CppException* exception; + + auto audioCtrl = il2cpp_runtime_invoke(il2cpp_class_get_method_from_name(audioCtrlDict->klass, "get_Item", 1), audioCtrlDict, params, &exception); + + delete[] params; + + if (exception) + { + wcout << exception->message->chars << endl; + continue; + } + + auto poolField = il2cpp_class_get_field_from_name_wrap(audioCtrl->klass, "pool"); + Il2CppObject* pool; + il2cpp_field_get_value(audioCtrl, poolField, &pool); + + if (pool) + { + auto method = il2cpp_symbols::find_method("Cute.Cri.Assembly.dll", "Cute.Cri", "CuteAudioSourcePool", [](const MethodInfo* info) + { + if (info->name == "FindSourceIndex"s && info->parameters[0].name == "playback"s) + { + return true; + } + + return false; + }); + + auto sourceIndex = method(pool, charaPlayback); + + params = new void* [1]; + params[0] = &sourceIndex; + + auto cuteAudioSource = il2cpp_runtime_invoke(il2cpp_class_get_method_from_name(pool->klass, "get_Item", 1), pool, params, &exception); + + delete[] params; + + if (exception) + { + wcout << exception->message->chars << endl; + continue; + } + + if (cuteAudioSource) + { + auto sourceListField = il2cpp_class_get_field_from_name_wrap(cuteAudioSource->klass, "sourceList"); + Il2CppObject* sourceList; + il2cpp_field_get_value(cuteAudioSource, sourceListField, &sourceList); + + auto usingIndexField = il2cpp_class_get_field_from_name_wrap(cuteAudioSource->klass, "usingIndex"); + int usingIndex; + il2cpp_field_get_value(cuteAudioSource, usingIndexField, &usingIndex); + + params = new void* [1]; + params[0] = &usingIndex; + + auto AtomSource = il2cpp_runtime_invoke(il2cpp_class_get_method_from_name(sourceList->klass, "get_Item", 1), sourceList, params, &exception); + + delete[] params; + + if (exception) + { + wcout << exception->message->chars << endl; + continue; + } + + auto player = il2cpp_class_get_method_from_name_type(AtomSource->klass, "get_player", 0)->methodPointer(AtomSource); + il2cpp_class_get_method_from_name_type(player->klass, "Stop", 0)->methodPointer(player); + il2cpp_class_get_method_from_name_type(player->klass, "SetStartTime", 1)->methodPointer(player, static_cast(roundf(value * 1000.0f))); + auto playback = il2cpp_class_get_method_from_name_type(player->klass, "Start", 0)->methodPointer(player); + + if (isPauseLive) + { + il2cpp_class_get_method_from_name_type(player->klass, "Pause", 0)->methodPointer(player); + } + + charaPlayback.criAtomExPlayback = playback; + } + } + } + } + } + }); + auto sliderTransform = static_cast(slider.transform()); + sliderTransform.anchoredPosition({ 0, 44 }); + sliderTransform.anchorMax({ 1, 0 }); + sliderTransform.anchorMin({ 0, 0 }); + sliderTransform.pivot({ 0.25, 0.5 }); + sliderTransform.sizeDelta({ -480, 24 }); + sliderTransform.SetParent(contentsRoot, false); + } + + if (wstring(UnityEngine::Object::Name(cloned)->chars).find(L"LiveChampionsTextController") != wstring::npos) { auto updateScreenReferenceSize = CreateDelegateWithClass(il2cpp_symbols::get_class("DOTween.dll", "DG.Tweening", "TweenCallback"), cloned, *([](Il2CppObject* _this) { @@ -10093,9 +10128,9 @@ namespace auto root = il2cpp_class_get_method_from_name_type(_flashPlayer->klass, "get_Root", 0)->methodPointer(_flashPlayer); - int unityWidth = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); + int unityWidth = UnityEngine::Screen::width(); - int unityHeight = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int unityHeight = UnityEngine::Screen::height(); if (Game::CurrentGameRegion == Game::Region::KOR) { @@ -10105,20 +10140,20 @@ namespace if (unityWidth < unityHeight) { - float scale = min(config::freeform_ui_scale_portrait, max(1.0f, unityHeight * ratio_vertical) * config::freeform_ui_scale_portrait); - il2cpp_class_get_method_from_name_type(_flashCanvasScaler->klass, "set_referenceResolution", 1)->methodPointer(_flashCanvasScaler, Vector2_t{ static_cast(unityWidth / scale), static_cast(unityHeight / scale) }); - il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, Vector2_t{ ratio_16_9 * static_cast(unityHeight / scale), static_cast(unityHeight / scale) }); + float scale = min(config::freeform_ui_scale_portrait, max(1.0f, unityHeight * config::runtime::ratioVertical) * config::freeform_ui_scale_portrait); + il2cpp_class_get_method_from_name_type(_flashCanvasScaler->klass, "set_referenceResolution", 1)->methodPointer(_flashCanvasScaler, UnityEngine::Vector2{ static_cast(unityWidth / scale), static_cast(unityHeight / scale) }); + il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, UnityEngine::Vector2{ ratio_16_9 * static_cast(unityHeight / scale), static_cast(unityHeight / scale) }); } else { - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, unityWidth / ratio_horizontal) * config::freeform_ui_scale_landscape); - il2cpp_class_get_method_from_name_type(_flashCanvasScaler->klass, "set_referenceResolution", 1)->methodPointer(_flashCanvasScaler, Vector2_t{ static_cast(unityWidth / scale), static_cast(unityHeight / scale) }); - il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, Vector2_t{ ratio_16_9 * static_cast(unityHeight / scale), static_cast(unityHeight / scale) }); + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, unityWidth / config::runtime::ratioHorizontal) * config::freeform_ui_scale_landscape); + il2cpp_class_get_method_from_name_type(_flashCanvasScaler->klass, "set_referenceResolution", 1)->methodPointer(_flashCanvasScaler, UnityEngine::Vector2{ static_cast(unityWidth / scale), static_cast(unityHeight / scale) }); + il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, UnityEngine::Vector2{ ratio_16_9 * static_cast(unityHeight / scale), static_cast(unityHeight / scale) }); } } else { - il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, Vector2_t{ ratio_16_9 * static_cast(unityHeight), static_cast(unityHeight) }); + il2cpp_class_get_method_from_name_type(root->klass, "SetScreenReferenceSize", 1)->methodPointer(root, UnityEngine::Vector2{ ratio_16_9 * static_cast(unityHeight), static_cast(unityHeight) }); } } } @@ -10132,11 +10167,11 @@ namespace } void* Object_Internal_CloneSingle_orig = nullptr; - Il2CppObject* Object_Internal_CloneSingle_hook(Il2CppObject* data, Il2CppObject* parent, bool worldPositionStays) + Il2CppObject* Object_Internal_CloneSingle_hook(Il2CppObject* data) { - auto cloned = reinterpret_cast(Object_Internal_CloneSingle_orig)(data, parent, worldPositionStays); + auto cloned = reinterpret_cast(Object_Internal_CloneSingle_orig)(data); - if (wstring(uobject_get_name(cloned)->chars).find(L"DialogHomeMenuMain") != wstring::npos && Game::CurrentGameRegion == Game::Region::KOR) + if (wstring(UnityEngine::Object::Name(cloned)->chars).find(L"DialogHomeMenuMain") != wstring::npos && Game::CurrentGameRegion == Game::Region::KOR) { auto homeMenuMain = il2cpp_class_get_method_from_name_type(cloned->klass, "GetComponent", 1)->methodPointer(cloned, GetRuntimeType("umamusume.dll", "Gallop", "DialogHomeMenuMain")); @@ -10168,13 +10203,13 @@ namespace void* resources_load_orig = nullptr; Il2CppObject* resources_load_hook(Il2CppString* path, Il2CppObject* type) { - string u8Name = local::wide_u8(path->chars); + wstring wName = path->chars; - if (u8Name == "ui/views/titleview"s) + if (wName == L"ui/views/titleview"s) { - if (find_if(replaceAssetNames.begin(), replaceAssetNames.end(), [](const string& item) + if (find_if(replaceAssetNames.begin(), replaceAssetNames.end(), [](const wstring& item) { - return item.find("utx_obj_title_logo_umamusume") != string::npos; + return item.find(L"utx_obj_title_logo_umamusume") != wstring::npos; }) != replaceAssetNames.end()) { auto gameObj = reinterpret_cast(resources_load_orig)(path, type); @@ -10193,7 +10228,7 @@ namespace } } - if (u8Name == "TMP Settings"s && config::replace_to_custom_font && fontAssets) + if (wName == L"TMP Settings"s && config::replace_to_custom_font && fontAssets) { auto object = reinterpret_cast(resources_load_orig)(path, type); auto fontAssetField = il2cpp_class_get_field_from_name_wrap(object->klass, "m_defaultFontAsset"); @@ -10201,7 +10236,7 @@ namespace return object; } - if (u8Name.ends_with("dialogoptionhome")) + if (wName.ends_with(L"dialogoptionhome")) { auto object = reinterpret_cast(resources_load_orig)(path, type); @@ -10257,7 +10292,7 @@ namespace { auto rectTransform = rectTransformArray->vector[j]; - if (rectTransform && local::wide_u8(uobject_get_name(rectTransform)->chars) == "Content") + if (rectTransform && UnityEngine::Object::Name(rectTransform)->chars == L"Content"s) { // InitOptionLayout(rectTransform); break; @@ -10271,7 +10306,7 @@ namespace } - if (u8Name.ends_with("dialogoptionlivetheater")) + if (wName.ends_with(L"dialogoptionlivetheater")) { auto object = reinterpret_cast(resources_load_orig)(path, type); @@ -10309,7 +10344,7 @@ namespace { auto rectTransform = rectTransformArray->vector[j]; - if (rectTransform && local::wide_u8(uobject_get_name(rectTransform)->chars) == "Content") + if (rectTransform && UnityEngine::Object::Name(rectTransform)->chars == L"Content"s) { // InitOptionLayout(rectTransform); break; @@ -10330,8 +10365,8 @@ namespace Il2CppObject* Sprite_get_texture_hook(Il2CppObject* _this) { auto texture2D = reinterpret_cast(Sprite_get_texture_orig)(_this); - auto uobject_name = uobject_get_name(texture2D); - if (!local::wide_u8(uobject_name->chars).empty()) + auto uobject_name = UnityEngine::Object::Name(texture2D); + if (!wstring(uobject_name->chars).empty()) { auto newTexture = GetReplacementAssets( uobject_name, @@ -10426,10 +10461,10 @@ namespace { if (texture) { - if (!local::wide_u8(uobject_get_name(texture)->chars).empty()) + if (!wstring(UnityEngine::Object::Name(texture)->chars).empty()) { auto newTexture = GetReplacementAssets( - uobject_get_name(texture), + UnityEngine::Object::Name(texture), (Il2CppType*)GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D")); if (newTexture) { @@ -10449,8 +10484,8 @@ namespace auto texture = reinterpret_cast(Material_get_mainTexture_orig)(_this); if (texture) { - auto uobject_name = uobject_get_name(texture); - if (!local::wide_u8(uobject_name->chars).empty()) + auto uobject_name = UnityEngine::Object::Name(texture); + if (!wstring(uobject_name->chars).empty()) { auto newTexture = GetReplacementAssets( uobject_name, @@ -10469,10 +10504,10 @@ namespace void* Material_SetTextureI4_orig = nullptr; void Material_SetTextureI4_hook(Il2CppObject* _this, int nameID, Il2CppObject* texture) { - if (texture && !local::wide_u8(uobject_get_name(texture)->chars).empty()) + if (texture && !wstring(UnityEngine::Object::Name(texture)->chars).empty()) { auto newTexture = GetReplacementAssets( - uobject_get_name(texture), + UnityEngine::Object::Name(texture), (Il2CppType*)GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D")); if (newTexture) { @@ -10489,10 +10524,10 @@ namespace Il2CppObject* Material_GetTextureImpl_hook(Il2CppObject* _this, int nameID) { auto texture = reinterpret_cast(Material_GetTextureImpl_orig)(_this, nameID); - if (texture && !local::wide_u8(uobject_get_name(texture)->chars).empty()) + if (texture && !wstring(UnityEngine::Object::Name(texture)->chars).empty()) { auto newTexture = GetReplacementAssets( - uobject_get_name(texture), + UnityEngine::Object::Name(texture), (Il2CppType*)GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D")); if (newTexture) { @@ -10507,10 +10542,10 @@ namespace void* Material_SetTextureImpl_orig = nullptr; void Material_SetTextureImpl_hook(Il2CppObject* _this, int nameID, Il2CppObject* texture) { - if (texture && !local::wide_u8(uobject_get_name(texture)->chars).empty()) + if (texture && !wstring(UnityEngine::Object::Name(texture)->chars).empty()) { auto newTexture = GetReplacementAssets( - uobject_get_name(texture), + UnityEngine::Object::Name(texture), (Il2CppType*)GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D")); if (newTexture) { @@ -10526,10 +10561,10 @@ namespace void* CharaPropRendererAccessor_SetTexture_orig = nullptr; void CharaPropRendererAccessor_SetTexture_hook(Il2CppObject* _this, Il2CppObject* texture) { - if (!local::wide_u8(uobject_get_name(texture)->chars).empty()) + if (!wstring(UnityEngine::Object::Name(texture)->chars).empty()) { auto newTexture = GetReplacementAssets( - uobject_get_name(texture), + UnityEngine::Object::Name(texture), (Il2CppType*)GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D")); if (newTexture) { @@ -10567,7 +10602,7 @@ namespace void GameObject_GetComponentFastPath_hook(Il2CppObject* _this, Il2CppObject* type, uintptr_t oneFurtherThanResultValue) { /*auto name = il2cpp_class_get_method_from_name_type(type->klass, "get_FullName", 0)->methodPointer(type); - cout << "GameObject_GetComponentFastPath " << local::wide_u8(name->chars) << endl;*/ + cout << "GameObject_GetComponentFastPath " << wide_u8(name->chars) << endl;*/ reinterpret_cast(GameObject_GetComponentFastPath_orig)(_this, type, oneFurtherThanResultValue); auto helper = CastHelper{}; int objSize = sizeof(helper.obj); @@ -10599,33 +10634,9 @@ namespace } } - void* ChangeScreenOrientation_orig = nullptr; - - Il2CppObject* ChangeScreenOrientation_hook(ScreenOrientation targetOrientation, bool isForce) - { - return reinterpret_cast(ChangeScreenOrientation_orig)(targetOrientation, isForce); - } - - void* ChangeScreenOrientationPortraitAsync_orig = nullptr; - - Il2CppObject* ChangeScreenOrientationPortraitAsync_hook() - { - return il2cpp_symbols::get_method_pointer( - "umamusume.dll", - "Gallop", - "Screen", "ChangeScreenOrientationLandscapeAsync", IgnoreNumberOfArguments)(); - } - - void* get_IsVertical_orig = nullptr; - - bool get_IsVertical_hook() - { - return true; - } - void* Screen_set_orientation_orig = nullptr; - void Screen_set_orientation_hook(ScreenOrientation orientation) + void Screen_set_orientation_hook(UnityEngine::ScreenOrientation orientation) { if (!config::freeform_window) { @@ -10636,11 +10647,11 @@ namespace void* Screen_RequestOrientation_orig = nullptr; - void Screen_RequestOrientation_hook(ScreenOrientation orientation) + void Screen_RequestOrientation_hook(UnityEngine::ScreenOrientation orientation) { if (config::freeform_window) { - reinterpret_cast(Screen_RequestOrientation_orig)(ScreenOrientation::AutoRotation); + reinterpret_cast(Screen_RequestOrientation_orig)(UnityEngine::ScreenOrientation::AutoRotation); auto hWnd = GetHWND(); @@ -10707,7 +10718,7 @@ namespace void* WaitDeviceOrientation_orig = nullptr; - Il2CppObject* WaitDeviceOrientation_hook(ScreenOrientation targetOrientation) + Il2CppObject* WaitDeviceOrientation_hook(UnityEngine::ScreenOrientation targetOrientation) { if (!config::freeform_window) { @@ -10715,7 +10726,9 @@ namespace targetOrientation); } - return nullptr; + auto arrayList = il2cpp_object_new(il2cpp_symbols::get_class("mscorlib.dll", "System.Collections", "ArrayList")); + il2cpp_runtime_object_init(arrayList); + return il2cpp_class_get_method_from_name_type(arrayList->klass, "GetEnumerator", 0)->methodPointer(arrayList); } Il2CppObject* UIManager_WaitBootSetup_hook(Il2CppObject* _this); @@ -10724,7 +10737,7 @@ namespace void BootSystem_Awake_hook(Il2CppObject* _this) { - // Resolution_t r; + // UnityEngine::Resolution r; // get_resolution_stub(&r); // last_display_width = r.width; // last_display_height = r.height; @@ -10738,17 +10751,17 @@ namespace StartCoroutine(_this, il2cpp_class_get_method_from_name_type(_this->klass, "BootCoroutine", 0)->methodPointer(_this)); - /*auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + /*auto uiManager = Gallop::UIManager::Instance(); - auto defaultResolution = il2cpp_class_get_method_from_name_type(uiManager->klass, "get_DefaultResolution", 0)->methodPointer(); + auto defaultResolution = il2cpp_class_get_method_from_name_type(uiManager, "get_DefaultResolution", 0)->methodPointer(); - auto canvasScalerList = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*)>(uiManager->klass, "GetCanvasScalerList", 0)->methodPointer(uiManager); + auto canvasScalerList = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*)>(uiManager, "GetCanvasScalerList", 0)->methodPointer(uiManager); for (int i = 0; i < canvasScalerList->max_length; i++) { auto canvasScaler = canvasScalerList->vector[i]; if (canvasScaler) { - il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, defaultResolution); + il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, defaultResolution); if (defaultResolution.x < defaultResolution.y) { @@ -10763,7 +10776,7 @@ namespace } } - auto _bgCameraField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_bgCamera"); + auto _bgCameraField = il2cpp_class_get_field_from_name_wrap(uiManager, "_bgCamera"); Il2CppObject* _bgCamera; il2cpp_field_get_value(uiManager, _bgCameraField, &_bgCamera); @@ -10777,12 +10790,12 @@ namespace { auto StandaloneWindowResize = il2cpp_symbols::get_class("umamusume.dll", "Gallop", "StandaloneWindowResize"); - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); bool isLandscape = width > height; - auto changedSize = il2cpp_class_get_method_from_name_type(StandaloneWindowResize, "GetChangedSize", 3)->methodPointer(isLandscape ? height : width, isLandscape ? width : height, true); + auto changedSize = il2cpp_class_get_method_from_name_type(StandaloneWindowResize, "GetChangedSize", 3)->methodPointer(isLandscape ? height : width, isLandscape ? width : height, true); if (il2cpp_class_get_method_from_name_type(StandaloneWindowResize, "CheckOverScreenSize", 2)->methodPointer(changedSize.x, changedSize.y)) { @@ -10802,11 +10815,11 @@ namespace } Il2CppObject* (*MoviePlayerBase_get_MovieInfo)(Il2CppObject* _this); - Il2CppObject* (*MovieManager_GetMovieInfo)(Il2CppObject* _this, MoviePlayerHandle playerHandle); + Il2CppObject* (*MovieManager_GetMovieInfo)(Il2CppObject* _this, Cute::Cri::MoviePlayerHandle playerHandle); void* MovieManager_SetImageUvRect_orig = nullptr; - void MovieManager_SetImageUvRect_hook(Il2CppObject* _this, MoviePlayerHandle playerHandle, Rect_t uv) + void MovieManager_SetImageUvRect_hook(Il2CppObject* _this, Cute::Cri::MoviePlayerHandle playerHandle, UnityEngine::Rect uv) { auto movieInfo = MovieManager_GetMovieInfo(_this, playerHandle); if (!movieInfo) @@ -10819,11 +10832,11 @@ namespace unsigned int width, height; il2cpp_field_get_value(movieInfo, widthField, &width); il2cpp_field_get_value(movieInfo, heightField, &height); - if (width < height && !is_virt()) + if (width < height && !Gallop::StandaloneWindowResize::IsVirt()) { - int rWidth = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int rHeight = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); - if (roundf(ratio_horizontal * (max(1.0f, rHeight * ratio_vertical) * (config::freeform_window ? config::freeform_ui_scale_landscape : config::ui_scale))) == uv.height) + int rWidth = UnityEngine::Screen::width(); + int rHeight = UnityEngine::Screen::height(); + if (roundf(config::runtime::ratioHorizontal * (max(1.0f, rHeight * config::runtime::ratioVertical) * (config::freeform_window ? config::freeform_ui_scale_landscape : config::ui_scale))) == uv.height) { uv.height = rWidth; } @@ -10835,7 +10848,7 @@ namespace void* MovieManager_SetScreenSize_orig = nullptr; - void MovieManager_SetScreenSize_hook(Il2CppObject* _this, MoviePlayerHandle playerHandle, Vector2_t screenSize) + void MovieManager_SetScreenSize_hook(Il2CppObject* _this, Cute::Cri::MoviePlayerHandle playerHandle, UnityEngine::Vector2 screenSize) { auto movieInfo = MovieManager_GetMovieInfo(_this, playerHandle); if (!movieInfo) @@ -10848,11 +10861,11 @@ namespace unsigned int width, height; il2cpp_field_get_value(movieInfo, widthField, &width); il2cpp_field_get_value(movieInfo, heightField, &height); - if (width < height && !is_virt()) + if (width < height && !Gallop::StandaloneWindowResize::IsVirt()) { - int rWidth = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int rHeight = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); - if (roundf(ratio_horizontal * (max(1.0f, rHeight * ratio_vertical) * (config::freeform_window ? config::freeform_ui_scale_landscape : config::ui_scale))) == screenSize.y) + int rWidth = UnityEngine::Screen::width(); + int rHeight = UnityEngine::Screen::height(); + if (roundf(config::runtime::ratioHorizontal * (max(1.0f, rHeight * config::runtime::ratioVertical) * (config::freeform_window ? config::freeform_ui_scale_landscape : config::ui_scale))) == screenSize.y) { screenSize.y = rWidth; } @@ -10864,7 +10877,7 @@ namespace void* MoviePlayerForUI_AdjustScreenSize_orig = nullptr; - void MoviePlayerForUI_AdjustScreenSize_hook(Il2CppObject* _this, Vector2_t dispRectWH, bool isPanScan) + void MoviePlayerForUI_AdjustScreenSize_hook(Il2CppObject* _this, UnityEngine::Vector2 dispRectWH, bool isPanScan) { auto movieInfo = MoviePlayerBase_get_MovieInfo(_this); if (!movieInfo) @@ -10879,10 +10892,10 @@ namespace il2cpp_field_get_value(movieInfo, widthField, &width); il2cpp_field_get_value(movieInfo, heightField, &height); - auto ratio = floorf(static_cast(width) / height * 100) / 100; + // auto ratio = floorf(static_cast(width) / height * 100) / 100; auto ratio1 = static_cast(width) / static_cast(height); - if (!is_virt()) + if (!Gallop::StandaloneWindowResize::IsVirt()) { int rWidth; int rHeight; @@ -10902,14 +10915,14 @@ namespace rWidth = number1920; rHeight = number1080; - /*if (roundf(ratio_horizontal * (max(1.0f, rHeight * ratio_vertical) * (config::freeform_window ? config::freeform_ui_scale_landscape : config::ui_scale))) == dispRectWH.y) + /*if (roundf(ratio_horizontal * (max(1.0f, rHeight * config::runtime::ratioVertical) * (config::freeform_window ? config::freeform_ui_scale_landscape : config::ui_scale))) == dispRectWH.y) { dispRectWH.y = rWidth; dispRectWH.x = rHeight; } else {*/ - float scale = min(config::freeform_ui_scale_landscape, max(1.0f, rWidth / ratio_horizontal) * config::freeform_ui_scale_landscape); + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, rWidth / config::runtime::ratioHorizontal) * config::freeform_ui_scale_landscape); if (roundf(dispRectWH.y * scale) != rHeight) { @@ -10949,7 +10962,7 @@ namespace void* FrameRateController_ReflectionFrameRate_orig = nullptr; void FrameRateController_ReflectionFrameRate_hook(Il2CppObject* _this) { - set_fps_hook(30); + UnityEngine::Application::targetFrameRate(30); } Il2CppObject* errorDialog = nullptr; @@ -11033,7 +11046,7 @@ namespace auto workDataManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "WorkDataManager")); auto workUserData = il2cpp_class_get_method_from_name_type(workDataManager->klass, "get_UserData", 0)->methodPointer(workDataManager); - auto viewerIdObscured = il2cpp_class_get_method_from_name_type(workUserData->klass, "get_ViewerId", 0)->methodPointer(workUserData); + auto viewerIdObscured = il2cpp_class_get_method_from_name_type(workUserData->klass, "get_ViewerId", 0)->methodPointer(workUserData); auto viewerId = viewerIdObscured.GetDecrypted(); if (searchId == to_wstring(viewerId)) @@ -11177,12 +11190,12 @@ namespace Il2CppArraySize_t* voiceButtonList; if (Game::CurrentGameRegion == Game::Region::KOR) { - voiceButtonList = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("umamusume.dll", "Gallop", "PartsEpisodeExtraVoiceButton"), 0, 0); + voiceButtonList = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("umamusume.dll", "Gallop", "PartsEpisodeExtraVoiceButton"), UnityEngine::FindObjectsInactive::Exclude, UnityEngine::FindObjectsSortMode::None); } else { - voiceButtonList = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( + voiceButtonList = UnityEngine::Object::FindObjectsOfType( GetRuntimeType("umamusume.dll", "Gallop", "PartsEpisodeExtraVoiceButton"), false); } @@ -11517,22 +11530,6 @@ namespace (_this); } - void* UIManager_GetCameraSizeByOrientation_orig = nullptr; - - float UIManager_GetCameraSizeByOrientation_hook(int orientation) - { - return 5; - } - - void* UIManager_get_DefaultResolution_orig = nullptr; - - Vector2_t UIManager_get_DefaultResolution_hook() - { - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); - return Vector2_t{ static_cast(width), static_cast(height) }; - } - void* UIManager_WaitBootSetup_orig = nullptr; Il2CppObject* UIManager_WaitBootSetup_hook(Il2CppObject* _this) @@ -11545,7 +11542,7 @@ namespace 0)->methodPointer; while (move_next(enumerator)) {} - auto defaultResolution = UIManager_get_DefaultResolution_hook(); + auto defaultResolution = Gallop::UIManager::DefaultResolution(); auto canvasScalerList = il2cpp_class_get_method_from_name_type *(*)(Il2CppObject*)>(_this->klass, "GetCanvasScalerList", 0)->methodPointer(_this); for (int i = 0; i < canvasScalerList->max_length; i++) @@ -11553,7 +11550,7 @@ namespace auto canvasScaler = canvasScalerList->vector[i]; if (canvasScaler) { - il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, defaultResolution); + il2cpp_class_get_method_from_name_type(canvasScaler->klass, "set_referenceResolution", 1)->methodPointer(canvasScaler, defaultResolution); if (defaultResolution.x < defaultResolution.y) { @@ -11572,8 +11569,8 @@ namespace Il2CppObject* _bgCamera; il2cpp_field_get_value(_this, _bgCameraField, &_bgCamera); - il2cpp_class_get_method_from_name_type(_bgCamera->klass, "set_backgroundColor", 1)->methodPointer(_bgCamera, - il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Color", "get_clear", IgnoreNumberOfArguments)()); + il2cpp_class_get_method_from_name_type(_bgCamera->klass, "set_backgroundColor", 1)->methodPointer(_bgCamera, + il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Color", "get_clear", IgnoreNumberOfArguments)()); il2cpp_class_get_method_from_name_type(_this->klass, "AdjustSafeArea", 0)->methodPointer(_this); il2cpp_class_get_method_from_name_type(_this->klass, "CreateRenderTextureFromScreen", 0)->methodPointer(_this); @@ -11583,7 +11580,7 @@ namespace void* Input_get_mousePosition_Injected_orig = nullptr; - void Input_get_mousePosition_Injected_hook(Vector3_t* out) + void Input_get_mousePosition_Injected_hook(UnityEngine::Vector3* out) { reinterpret_cast(Input_get_mousePosition_Injected_orig)(out); } @@ -11640,7 +11637,7 @@ namespace if (document.HasMember("result_code") && document["result_code"].GetInt() == 100) { - return local::u8_wide(document["data"].GetObjectW()["url"].GetString()); + return u8_wide(document["data"].GetObjectW()["url"].GetString()); } return L""; @@ -12061,8 +12058,8 @@ namespace char* buf1 = reinterpret_cast(data) + kIl2CppSizeOfArray; memcpy(buf1, modified.data(), modified.size()); - } - } + } +} #endif return reinterpret_cast(UploadHandlerRaw_Create_orig)(self, data); @@ -12102,7 +12099,7 @@ namespace char* buf1 = reinterpret_cast(data) + kIl2CppSizeOfArray; memcpy(buf1, modified.data(), modified.size()); - } + } } #endif @@ -12141,7 +12138,7 @@ namespace char* buf1 = reinterpret_cast(data) + kIl2CppSizeOfArray; memcpy(buf1, modified.data(), modified.size()); - } + } } #endif @@ -12182,7 +12179,7 @@ namespace char* buf1 = reinterpret_cast(data) + kIl2CppSizeOfArray; memcpy(buf1, modified.data(), modified.size()); - } + } } #endif @@ -12271,7 +12268,7 @@ namespace il2cpp_field_get_value(title, textField, &text); if (text) { - name = local::wide_u8(text_get_text(text)->chars); + name = wide_u8(text_get_text(text)->chars); if (name.empty()) { name = "Live (unknown)"; @@ -12296,13 +12293,13 @@ namespace } else { - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); auto sceneManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "SceneManager")); if (uiManager && sceneManager) { string detail; - auto CommonHeaderTitle = il2cpp_class_get_method_from_name_type(uiManager->klass, "get_CommonHeaderTitle", 0)->methodPointer(uiManager); + auto CommonHeaderTitle = uiManager.CommonHeaderTitle(); if (CommonHeaderTitle) { @@ -12312,14 +12309,14 @@ namespace if (_cacheText) { - detail = local::wide_u8(_cacheText->chars); + detail = wide_u8(_cacheText->chars); } } if (detail.empty()) { auto viewId = il2cpp_class_get_method_from_name_type(sceneManager->klass, "GetCurrentViewId", 0)->methodPointer(sceneManager); - auto viewName = local::wide_u8(GetEnumName(GetRuntimeType("umamusume.dll", "Gallop", "SceneDefine/ViewId"), viewId)->chars); + auto viewName = wide_u8(GetEnumName(GetRuntimeType("umamusume.dll", "Gallop", "SceneDefine/ViewId"), viewId)->chars); detail = GetViewName(viewName); if (detail.empty()) @@ -12353,8 +12350,6 @@ namespace { if (config::cyspring_update_mode != -1) { - il2cpp_thread_attach(il2cpp_domain_get()); - auto threadClass = il2cpp_symbols::get_class("umamusume.dll", "Gallop", "CySpringController/CySpringThread"); auto instanceField = il2cpp_class_get_field_from_name_wrap(threadClass, "_instance"); @@ -12409,16 +12404,57 @@ namespace TickDiscord(); } - if (SystemMediaTransportControlsManager::instance.IsEnabled()) - { - auto active = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine.SceneManagement", "SceneManager", "GetActiveScene", IgnoreNumberOfArguments)(); + auto active = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine.SceneManagement", "SceneManager", "GetActiveScene", IgnoreNumberOfArguments)(); - auto handleName = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine.SceneManagement", "Scene", "GetNameInternal", 1)(active.handle); + auto handleName = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine.SceneManagement", "Scene", "GetNameInternal", 1)(active.handle); - if (handleName) + if (handleName) + { + wstring sceneName = handleName->chars; + + if (sceneName == L"Live") { - wstring sceneName = handleName->chars; + auto controller = GetCurrentViewController(); + + if (controller && controller->klass->name == "LiveViewController"s) + { + auto sliderCommon = GetOptionSlider("live_slider"); + + auto director = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop.Live", "Director")); + if (sliderCommon && director) + { + auto LiveCurrentTime = il2cpp_class_get_method_from_name_type(director->klass, "get_LiveCurrentTime", 0)->methodPointer(director); + auto LiveTotalTime = il2cpp_class_get_method_from_name_type(director->klass, "get_LiveTotalTime", 0)->methodPointer(director); + + auto textCommon = GetTextCommon("live_slider"); + + if (textCommon) + { + auto timeMin = static_cast(LiveCurrentTime / 60); + auto timeSec = static_cast(fmodf(LiveCurrentTime, 60)); + + wostringstream str; + str << setw(2) << setfill(L'0') << timeSec; + + SetTextCommonText(textCommon, (to_wstring(timeMin) + L":" + str.str()).data()); + } + + try + { + il2cpp_class_get_method_from_name_type(sliderCommon->klass, "set_maxValue", 1)->methodPointer(sliderCommon, LiveTotalTime); + il2cpp_class_get_method_from_name_type(sliderCommon->klass, "SetValueWithoutNotify", 1)->methodPointer(sliderCommon, LiveCurrentTime); + } + catch (const Il2CppExceptionWrapper& e) + { + cout << e.ex->klass->name << ": "; + wcout << e.ex->message << endl; + } + } + } + } + if (SystemMediaTransportControlsManager::instance.IsEnabled()) + { if (sceneName == L"Home") { bool hasSetList = false; @@ -12489,10 +12525,10 @@ namespace if (controller && controller->klass->name == "LiveViewController"s) { auto _stateField = il2cpp_class_get_field_from_name_wrap(controller->klass, "_state"); - LiveState state; + Gallop::LiveViewController::LiveState state; il2cpp_field_get_value(controller, _stateField, &state); - if (state == LiveState::Play) + if (state == Gallop::LiveViewController::LiveState::Play) { SystemMediaTransportControlsManager::instance.PlaybackStatus(winrt::Windows::Media::MediaPlaybackStatus::Playing); } @@ -12514,8 +12550,11 @@ namespace try { - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "MonoBehaviourExtension", "WaitForEndFrame", 2)(uiManager, tickFrameDelegate); + auto uiManager = Gallop::UIManager::Instance(); + if (uiManager) + { + il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "MonoBehaviourExtension", "WaitForEndFrame", 2)(uiManager, tickFrameDelegate); + } } catch (const Il2CppExceptionWrapper& e) { @@ -12531,7 +12570,7 @@ namespace if (nCode == HCBT_MINMAX) { if (lParam != SW_RESTORE) { - if (il2cpp_resolve_icall_type("UnityEngine.Screen::get_fullScreen()")()) { + if (UnityEngine::Screen::fullScreen()) { return TRUE; } } @@ -12546,12 +12585,12 @@ namespace { auto tr = il2cpp_thread_attach(il2cpp_domain_get()); - Resolution_t r; + UnityEngine::Resolution r; get_resolution_stub(&r); auto target_height = r.height - 100; - set_resolution(target_height * ratio_vertical, target_height, false); + set_resolution(target_height * config::runtime::ratioVertical, target_height, false); il2cpp_thread_detach(tr); }).detach(); @@ -12663,26 +12702,14 @@ namespace "UnityEngine.AssetBundleModule.dll", "UnityEngine", "AssetBundle", "LoadAsset", 2); - get_all_asset_names = il2cpp_symbols::get_method_pointer( + get_all_asset_names = il2cpp_symbols::get_method_pointer *(*)(Il2CppObject * _this)>( "UnityEngine.AssetBundleModule.dll", "UnityEngine", "AssetBundle", "GetAllAssetNames", 0); - uobject_get_name = il2cpp_symbols::get_method_pointer( - "UnityEngine.CoreModule.dll", "UnityEngine", - "Object", "GetName", IgnoreNumberOfArguments); - - uobject_set_name = il2cpp_symbols::get_method_pointer( - "UnityEngine.CoreModule.dll", "UnityEngine", - "Object", "SetName", 2); - uobject_IsNativeObjectAlive = il2cpp_symbols::get_method_pointer( "UnityEngine.CoreModule.dll", "UnityEngine", "Object", "IsNativeObjectAlive", 1); - get_unityVersion = il2cpp_symbols::get_method_pointer( - "UnityEngine.CoreModule.dll", "UnityEngine", - "Application", "get_unityVersion", IgnoreNumberOfArguments); - auto populate_with_errors_addr = il2cpp_symbols::get_method_pointer( "UnityEngine.TextRenderingModule.dll", "UnityEngine", "TextGenerator", @@ -12790,13 +12817,6 @@ namespace "CySpringUpdater", "get_SpringUpdateMode", 0 ); - auto set_fps_addr = il2cpp_resolve_icall("UnityEngine.Application::set_targetFrameRate(System.Int32)"); - - auto wndproc_addr = il2cpp_symbols::get_method_pointer( - "umamusume.dll", "Gallop", - "StandaloneWindowResize", "WndProc", 4 - ); - auto StandaloneWindowResize_DisableMaximizebox_addr = il2cpp_symbols::get_method_pointer( "umamusume.dll", "Gallop", "StandaloneWindowResize", "DisableMaximizebox", IgnoreNumberOfArguments @@ -12861,11 +12881,6 @@ namespace "UnityEngine", "Display", "get_renderingHeight", 0); - is_virt = il2cpp_symbols::get_method_pointer( - "umamusume.dll", "Gallop", - "StandaloneWindowResize", "get_IsVirt", 0 - ); - get_resolution = reinterpret_cast(il2cpp_resolve_icall("UnityEngine.Screen::get_currentResolution_Injected(UnityEngine.Resolution&)")); auto story_timeline_controller_play_addr = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "StoryTimelineController", "Play", 0); @@ -12995,8 +13010,6 @@ namespace auto load_zekken_composite_resource_addr = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "ModelLoader", "LoadZekkenCompositeResourceInternal", 0); - auto wait_resize_ui_addr = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "UIManager", "WaitResizeUI", 2); - auto set_anti_aliasing_addr = il2cpp_resolve_icall("UnityEngine.QualitySettings::set_antiAliasing(System.Int32)"); auto rendertexture_set_anti_aliasing_addr = il2cpp_resolve_icall("UnityEngine.RenderTexture::set_antiAliasing(System.Int32)"); @@ -13042,13 +13055,10 @@ namespace "umamusume.dll", "Gallop", "BootSystem", "Awake", 0); - UIManager_GetCanvasScalerList = il2cpp_symbols::get_method_pointer *(*)(Il2CppObject*)>( - "umamusume.dll", "Gallop", "UIManager", "GetCanvasScalerList", 0); - MoviePlayerBase_get_MovieInfo = il2cpp_symbols::get_method_pointer( "Cute.Cri.Assembly.dll", "Cute.Cri", "MoviePlayerBase", "get_MovieInfo", 0); - MovieManager_GetMovieInfo = il2cpp_symbols::get_method_pointer( + MovieManager_GetMovieInfo = il2cpp_symbols::get_method_pointer( "Cute.Cri.Assembly.dll", "Cute.Cri", "MovieManager", "GetMovieInfo", 1); auto PartsEpisodeList_SetupStoryExtraEpisodeList_addr = il2cpp_symbols::get_method_pointer( @@ -13084,10 +13094,6 @@ namespace auto DialogCircleItemDonate_Initialize_addr = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "DialogCircleItemDonate", "Initialize", 2); - auto UIManager_GetCameraSizeByOrientation_addr = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "UIManager", "GetCameraSizeByOrientation", 1); - - auto UIManager_get_DefaultResolution_addr = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "UIManager", "get_DefaultResolution", IgnoreNumberOfArguments); - auto UIManager_WaitBootSetup_addr = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "UIManager", "WaitBootSetup", 0); auto Object_Internal_CloneSingleWithParent_addr = il2cpp_resolve_icall("UnityEngine.Object::Internal_CloneSingleWithParent()"); @@ -13111,6 +13117,7 @@ namespace auto load_scene_internal_addr = il2cpp_resolve_icall("UnityEngine.SceneManagement.SceneManager::LoadSceneAsyncNameIndexInternal_Injected(System.String,System.Int32,UnityEngine.SceneManagement.LoadSceneParameters&,System.bool)"); #pragma endregion + ADD_HOOK(Certification_initDmmPlatformData, "Gallop.Certification::initDmmPlatformData at %p\n"); ADD_HOOK(TitleViewController_OnClickPushStart, "Gallop.TitleViewController::OnClickPushStart at %p\n"); @@ -13207,7 +13214,7 @@ namespace { try { - MasterDB::InitReplacementMasterDB(local::wide_u8(config::replace_text_db_path.data())); + MasterDB::InitReplacementMasterDB(wide_u8(config::replace_text_db_path.data())); ADD_HOOK(Plugin_sqlite3_step, "Plugin::sqlite3_step at %p\n"); ADD_HOOK(Plugin_sqlite3_reset, "Plugin::sqlite3_reset at %p\n"); ADD_HOOK(query_step, "Query::Step at %p\n"); @@ -13232,7 +13239,7 @@ namespace // ADD_HOOK(load_scene_internal, "SceneManager::LoadSceneAsyncNameIndexInternal at %p\n"); - ADD_HOOK(BootSystem_Awake, "Gallop.BootSystem::Awake at %p\n"); + // ADD_HOOK(BootSystem_Awake, "Gallop.BootSystem::Awake at %p\n"); if (Game::CurrentGameRegion == Game::Region::KOR) { @@ -13250,7 +13257,7 @@ namespace if (config::unlock_size || config::freeform_window) { - ADD_HOOK(canvas_scaler_setres, "UnityEngine.UI.CanvasScaler::set_referenceResolution at %p\n"); + // ADD_HOOK(canvas_scaler_setres, "UnityEngine.UI.CanvasScaler::set_referenceResolution at %p\n"); // ADD_HOOK(UIManager_UpdateCanvasScaler, "Gallop.UIManager::UpdateCanvasScaler at %p\n"); } @@ -13269,7 +13276,7 @@ namespace ADD_HOOK(FrameRateController_OverrideByMaxFrameRate, "Gallop.FrameRateController::OverrideByMaxFrameRate at %p\n"); ADD_HOOK(FrameRateController_ResetOverride, "Gallop.FrameRateController::ResetOverride at %p\n"); ADD_HOOK(FrameRateController_ReflectionFrameRate, "Gallop.FrameRateController::ReflectionFrameRate at %p\n"); - ADD_HOOK(set_fps, "UnityEngine.Application.set_targetFrameRate at %p\n"); + // ADD_HOOK(set_fps, "UnityEngine.Application.set_targetFrameRate at %p\n"); } if (config::unlock_size || config::freeform_window) @@ -13281,8 +13288,6 @@ namespace if (config::freeform_window) { - ADD_HOOK(UIManager_GetCameraSizeByOrientation, "Gallop.UIManager::GetCameraSizeByOrientation at %p\n"); - ADD_HOOK(UIManager_get_DefaultResolution, "Gallop.UIManager::get_DefaultResolution at %p\n"); ADD_HOOK(StandaloneWindowResize_DisableMaximizebox, "Gallop.StandaloneWindowResize::DisableMaximizebox at %p\n"); ADD_HOOK(StandaloneWindowResize_ReshapeAspectRatio, "Gallop.StandaloneWindowResize::ReshapeAspectRatio at %p\n"); ADD_HOOK(StandaloneWindowResize_KeepAspectRatio, "Gallop.StandaloneWindowResize::KeepAspectRatio at %p\n"); @@ -13293,10 +13298,10 @@ namespace auto StandaloneWindowResize = il2cpp_symbols::get_class("umamusume.dll", "Gallop", "StandaloneWindowResize"); il2cpp_class_get_method_from_name_type(StandaloneWindowResize, "set_IsPreventReShape", 1)->methodPointer(true); - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); - il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "StandaloneWindowResize", "set_IsVirt", 1)(width <= height); + Gallop::StandaloneWindowResize::IsVirt(width <= height); auto GallopScreen = il2cpp_symbols::get_class("umamusume.dll", "Gallop", "Screen"); @@ -13342,9 +13347,6 @@ namespace auto Screen_RequestOrientation_addr = il2cpp_resolve_icall("UnityEngine.Screen::RequestOrientation(UnityEngine.ScreenOrientation)"); - auto get_IsVertical_addr = il2cpp_symbols::get_method_pointer( - "umamusume.dll", "Gallop", "Screen", "get_IsVertical", IgnoreNumberOfArguments); - auto DeviceOrientationGuide_Show_addr = il2cpp_symbols::get_method_pointer( "umamusume.dll", "Gallop", "DeviceOrientationGuide", "Show", 2); @@ -13355,10 +13357,9 @@ namespace ADD_HOOK(Camera_set_orthographicSize, "UnityEngine.Camera::set_orthographicSize at %p\n"); ADD_HOOK(RectTransform_get_rect_Injected, "UnityEngine.RectTransform::get_rect_Injected at %p\n"); - ADD_HOOK(WaitDeviceOrientation, "Gallop.Screen::WaitDeviceOrientation at %p\n"); + // ADD_HOOK(WaitDeviceOrientation, "Gallop.Screen::WaitDeviceOrientation at %p\n"); ADD_HOOK(Screen_RequestOrientation, "UnityEngine.Screen::RequestOrientation at %p\n"); ADD_HOOK(DeviceOrientationGuide_Show, "DeviceOrientationGuide::Show at %p\n"); - ADD_HOOK(get_IsVertical, "get_IsVertical at %p\n"); ADD_HOOK(MoviePlayerForUI_AdjustScreenSize, "MoviePlayerForUI::AdjustScreenSize at %p\n"); } @@ -13414,20 +13415,18 @@ namespace notification = nullptr; }*/ - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); - auto _noticeCanvasField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_noticeCanvas"); - Il2CppObject* _noticeCanvas; - il2cpp_field_get_value(uiManager, _noticeCanvasField, &_noticeCanvas); + auto uiManager = Gallop::UIManager::Instance(); + Il2CppObject* _noticeCanvas = uiManager._noticeCanvas(); auto transform = il2cpp_class_get_method_from_name_type(_noticeCanvas->klass, "get_transform", 0)->methodPointer(_noticeCanvas); auto object = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Resources", "Load", 2)( il2cpp_string_new("UI/Parts/Notification"), GetRuntimeType("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject")); - auto instantiated = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Object", "Internal_CloneSingleWithParent", 3) - (object, transform, false); + auto instantiated = UnityEngine::Object::Internal_CloneSingleWithParent(object, transform, false); auto helper = new CastHelper{}; il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "GameObject", "GetComponentFastPath", 2)(instantiated, GetRuntimeType("umamusume.dll", "Gallop", "Notification"), &helper->oneFurtherThanResultValue); notification = helper->obj; + delete helper; auto canvasGroupField = il2cpp_class_get_field_from_name_wrap(notification->klass, "canvasGroup"); Il2CppObject* canvasGroup; @@ -13447,12 +13446,12 @@ namespace auto canvasGroupTransform = il2cpp_class_get_method_from_name_type(canvasGroup->klass, "get_transform", 0)->methodPointer(canvasGroup); - auto position = il2cpp_class_get_method_from_name_type(canvasGroupTransform->klass, "get_position", 0)->methodPointer(canvasGroupTransform); + auto position = il2cpp_class_get_method_from_name_type(canvasGroupTransform->klass, "get_position", 0)->methodPointer(canvasGroupTransform); position.x = config::character_system_text_caption_position_x; position.y = config::character_system_text_caption_position_y; - il2cpp_class_get_method_from_name_type(canvasGroupTransform->klass, "set_position", 1)->methodPointer(canvasGroupTransform, position); + il2cpp_class_get_method_from_name_type(canvasGroupTransform->klass, "set_position", 1)->methodPointer(canvasGroupTransform, position); auto gameObject = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Component", "get_gameObject", 0)(notification); if (gameObject) @@ -13471,7 +13470,7 @@ namespace void patch_after_criware() { - auto amuid = wstring(il2cpp_resolve_icall_type("UnityEngine.Application::get_companyName()")()->chars) + L".Gallop"; + auto amuid = wstring(UnityEngine::Application::companyName()->chars) + L".Gallop"; DesktopNotificationManagerCompat::RegisterAumidAndComServer(amuid.data(), localize_get_hook(GetTextIdByName(L"Outgame0028"))->chars); @@ -13481,16 +13480,6 @@ namespace DesktopNotificationManagerCompat::get_History(&history); history->Clear(); - auto get_virt_size_addr = il2cpp_symbols::get_method_pointer( - "umamusume.dll", "Gallop", - "StandaloneWindowResize", "getOptimizedWindowSizeVirt", 2 - ); - - auto get_hori_size_addr = il2cpp_symbols::get_method_pointer( - "umamusume.dll", "Gallop", - "StandaloneWindowResize", "getOptimizedWindowSizeHori", 2 - ); - auto gallop_get_screenwidth_addr = il2cpp_symbols::get_method_pointer( "umamusume.dll", "Gallop", "Screen", "get_Width", 0 @@ -13501,28 +13490,13 @@ namespace "Screen", "get_Height", 0 ); - auto ChangeScreenOrientation_addr = il2cpp_symbols::get_method_pointer( - "umamusume.dll", - "Gallop", - "Screen", "ChangeScreenOrientation", 2); - auto Screen_set_orientation_addr = il2cpp_symbols::get_method_pointer( "UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "set_orientation", 1); - auto set_resolution_addr = il2cpp_resolve_icall("UnityEngine.Screen::SetResolution(System.Int32,System.Int32,UnityEngine.FullScreenMode,System.Int32)"); - auto GetLimitSize_addr = il2cpp_symbols::get_method_pointer( - "umamusume.dll", "Gallop", "StandaloneWindowResize", "GetLimitSize", IgnoreNumberOfArguments); - - auto ChangeScreenOrientationPortraitAsync_addr = il2cpp_symbols::get_method_pointer( - "umamusume.dll", "Gallop", "Screen", "ChangeScreenOrientationPortraitAsync", IgnoreNumberOfArguments); - - auto UIManager_ChangeResizeUIForPC_addr = il2cpp_symbols::get_method_pointer( - "umamusume.dll", "Gallop", "UIManager", "ChangeResizeUIForPC", 2); - auto MovieManager_SetImageUvRect_addr = il2cpp_symbols::get_method_pointer( "Cute.Cri.Assembly.dll", "Cute.Cri", "MovieManager", "SetImageUvRect", 2); @@ -13654,8 +13628,7 @@ namespace auto names = get_all_asset_names(*it); for (int i = 0; i < names->max_length; i++) { - auto u8Name = local::wide_u8(static_cast(names->vector[i])->chars); - replaceAssetNames.emplace_back(u8Name); + replaceAssetNames.emplace_back(names->vector[i]->chars); } } } @@ -13711,8 +13684,8 @@ namespace if (config::freeform_window) { - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); auto GallopScreen = il2cpp_symbols::get_class("umamusume.dll", "Gallop", "Screen"); @@ -13720,23 +13693,23 @@ namespace Il2CppObject* SCREEN_ORIENTATION_CATEGORIES; il2cpp_field_static_get_value(SCREEN_ORIENTATION_CATEGORIES_Field, &SCREEN_ORIENTATION_CATEGORIES); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Clear", 0)->methodPointer(SCREEN_ORIENTATION_CATEGORIES); + if (width < height) { - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Clear", 0)->methodPointer(SCREEN_ORIENTATION_CATEGORIES); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::Portrait, ScreenOrientation::Portrait); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::PortraitUpsideDown, ScreenOrientation::Portrait); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::LandscapeLeft, ScreenOrientation::Portrait); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::LandscapeRight, ScreenOrientation::Portrait); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::AutoRotation, ScreenOrientation::Portrait); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::Portrait, UnityEngine::ScreenOrientation::Portrait); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::PortraitUpsideDown, UnityEngine::ScreenOrientation::Portrait); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::LandscapeLeft, UnityEngine::ScreenOrientation::Portrait); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::LandscapeRight, UnityEngine::ScreenOrientation::Portrait); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::AutoRotation, UnityEngine::ScreenOrientation::Portrait); } else { - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Clear", 0)->methodPointer(SCREEN_ORIENTATION_CATEGORIES); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::Portrait, ScreenOrientation::LandscapeLeft); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::PortraitUpsideDown, ScreenOrientation::LandscapeLeft); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::LandscapeLeft, ScreenOrientation::LandscapeLeft); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::LandscapeRight, ScreenOrientation::LandscapeLeft); - il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, ScreenOrientation::AutoRotation, ScreenOrientation::LandscapeLeft); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::Portrait, UnityEngine::ScreenOrientation::LandscapeLeft); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::PortraitUpsideDown, UnityEngine::ScreenOrientation::LandscapeLeft); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::LandscapeLeft, UnityEngine::ScreenOrientation::LandscapeLeft); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::LandscapeRight, UnityEngine::ScreenOrientation::LandscapeLeft); + il2cpp_class_get_method_from_name_type(SCREEN_ORIENTATION_CATEGORIES->klass, "Add", 2)->methodPointer(SCREEN_ORIENTATION_CATEGORIES, UnityEngine::ScreenOrientation::AutoRotation, UnityEngine::ScreenOrientation::LandscapeLeft); } } @@ -13746,21 +13719,15 @@ namespace { ADD_HOOK(set_resolution, "UnityEngine.Screen.SetResolution(int, int, FullScreenMode, int) at %p\n"); } - ADD_HOOK(UIManager_ChangeResizeUIForPC, "Gallop.UIManager::ChangeResizeUIForPC at %p\n"); + // ADD_HOOK(UIManager_ChangeResizeUIForPC, "Gallop.UIManager::ChangeResizeUIForPC at %p\n"); } if (config::unlock_size || config::freeform_window) { - // break 1080p size limit - ADD_HOOK(get_virt_size, "Gallop.StandaloneWindowResize.getOptimizedWindowSizeVirt at %p \n"); - ADD_HOOK(get_hori_size, "Gallop.StandaloneWindowResize.getOptimizedWindowSizeHori at %p \n"); - // remove fixed 1080p render resolution ADD_HOOK(gallop_get_screenheight, "Gallop.Screen::get_Height at %p\n"); ADD_HOOK(gallop_get_screenwidth, "Gallop.Screen::get_Width at %p\n"); - ADD_HOOK(GetLimitSize, "Gallop.StandaloneWindowResize::GetChangedSize at %p\n"); - auto display = display_get_main(); if (config::initial_width > 72 && config::initial_height > 72) { @@ -13771,8 +13738,8 @@ namespace if (config::initial_width < config::initial_height) { - ratio_vertical = static_cast(config::initial_width) / static_cast(config::initial_height); - ratio_horizontal = static_cast(config::initial_height) / static_cast (config::initial_width); + config::runtime::ratioVertical = static_cast(config::initial_width) / static_cast(config::initial_height); + config::runtime::ratioHorizontal = static_cast(config::initial_height) / static_cast (config::initial_width); if (config::unlock_size_use_system_resolution) { @@ -13787,8 +13754,8 @@ namespace } else { - ratio_vertical = static_cast(config::initial_height) / static_cast(config::initial_width); - ratio_horizontal = static_cast(config::initial_width) / static_cast(config::initial_height); + config::runtime::ratioVertical = static_cast(config::initial_height) / static_cast(config::initial_width); + config::runtime::ratioHorizontal = static_cast(config::initial_width) / static_cast(config::initial_height); if (config::unlock_size_use_system_resolution) { @@ -13857,41 +13824,41 @@ namespace if (config::initial_width < config::initial_height) { last_hriz_window_width = last_display_height - 400; - last_hriz_window_height = last_hriz_window_width / ratio_horizontal; + last_hriz_window_height = last_hriz_window_width / config::runtime::ratioHorizontal; if (last_hriz_window_height >= get_system_height(display)) { last_hriz_window_height = get_system_height(display) - 400; - last_hriz_window_width = last_hriz_window_height * ratio_horizontal; + last_hriz_window_width = last_hriz_window_height * config::runtime::ratioHorizontal; } last_virt_window_height = last_display_width - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; if (last_virt_window_height >= get_system_height(display)) { last_virt_window_height = get_system_height(display) - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; } } else { last_hriz_window_width = last_display_width - 400; - last_hriz_window_height = last_hriz_window_width / ratio_horizontal; + last_hriz_window_height = last_hriz_window_width / config::runtime::ratioHorizontal; if (last_hriz_window_height >= get_system_height(display)) { last_hriz_window_height = get_system_height(display) - 400; - last_hriz_window_width = last_hriz_window_height * ratio_horizontal; + last_hriz_window_width = last_hriz_window_height * config::runtime::ratioHorizontal; } last_virt_window_height = last_display_height - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; if (last_virt_window_height >= get_system_height(display)) { last_virt_window_height = get_system_height(display) - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; } } } @@ -13907,9 +13874,9 @@ namespace else { last_hriz_window_width = last_display_width - 400; - last_hriz_window_height = last_hriz_window_width / ratio_horizontal; + last_hriz_window_height = last_hriz_window_width / config::runtime::ratioHorizontal; last_virt_window_height = last_display_height - 400; - last_virt_window_width = last_virt_window_height * ratio_vertical; + last_virt_window_width = last_virt_window_height * config::runtime::ratioVertical; } } @@ -13920,7 +13887,7 @@ namespace } } - /*auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + /*auto uiManager = Gallop::UIManager::Instance(); auto mainCanvas = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "UIManager", "get_MainCanvas", IgnoreNumberOfArguments)(); auto camera = il2cpp_class_get_method_from_name_type(mainCanvas->klass, "get_worldCamera", 0)->methodPointer(mainCanvas); @@ -13930,7 +13897,7 @@ namespace wcout << il2cpp_class_get_method_from_name_type(gameObject->klass, "get_tag", 0)->methodPointer(gameObject)->chars << endl; il2cpp_class_get_method_from_name_type(gameObject->klass, "set_tag", 1)->methodPointer(gameObject, il2cpp_string_new("MainCamera"));*/ - fullScreenFl = il2cpp_resolve_icall_type("UnityEngine.Screen::get_fullScreen()")(); + fullScreenFl = UnityEngine::Screen::fullScreen(); if (config::discord_rich_presence) { @@ -13942,7 +13909,7 @@ namespace auto activeSceneChangedField = il2cpp_class_get_field_from_name_wrap(sceneManagerClass, "activeSceneChanged"); - auto action = CreateDelegateWithClassStatic(il2cpp_class_from_type(activeSceneChangedField->type), *([](void*, Scene scene, Scene scene1) + auto action = CreateDelegateWithClassStatic(il2cpp_class_from_type(activeSceneChangedField->type), *([](void*, UnityEngine::SceneManagement::Scene scene, UnityEngine::SceneManagement::Scene scene1) { auto hWnd = GetHWND(); @@ -13955,7 +13922,7 @@ namespace isPortraitBeforeFullscreen = false; - auto uiManager = GetSingletonInstance(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "UIManager")); + auto uiManager = Gallop::UIManager::Instance(); if (config::resolution_3d_scale != 1.0f) { @@ -14003,7 +13970,7 @@ namespace } } - auto active = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine.SceneManagement", "SceneManager", "GetActiveScene", IgnoreNumberOfArguments)(); + auto active = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine.SceneManagement", "SceneManager", "GetActiveScene", IgnoreNumberOfArguments)(); auto handleName = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine.SceneManagement", "Scene", "GetNameInternal", 1)(active.handle); @@ -14015,12 +13982,12 @@ namespace /*Il2CppArraySize_t* CriWareInitializerList; if (Game::CurrentGameRegion == Game::Region::KOR) { - CriWareInitializerList = il2cpp_resolve_icall_type*(*)(Il2CppObject*, int, int)>("UnityEngine.Object::FindObjectsByType()")( - GetRuntimeType("CriMw.CriWare.Runtime.dll", "CriWare", "CriWareInitializer"), 1, 0); + CriWareInitializerList = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("CriMw.CriWare.Runtime.dll", "CriWare", "CriWareInitializer"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); } else { - CriWareInitializerList = il2cpp_resolve_icall_type*(*)(Il2CppObject*, bool)>("UnityEngine.Object::FindObjectsOfType()")( + CriWareInitializerList = UnityEngine::Object::FindObjectsOfType( GetRuntimeType("CriMw.CriWare.Runtime.dll", "CriWare", "CriWareInitializer"), true); } @@ -14045,7 +14012,7 @@ namespace Il2CppString* key; il2cpp_field_get_value(decrypterConfig, keyField, &key); - cout << "key: " << local::wide_u8(key->chars) << endl; + cout << "key: " << wide_u8(key->chars) << endl; } } }*/ @@ -14201,9 +14168,7 @@ namespace if (uiManager) { - auto _bgCameraField = il2cpp_class_get_field_from_name_wrap(uiManager->klass, "_bgCamera"); - Il2CppObject* _bgCamera; - il2cpp_field_get_value(uiManager, _bgCameraField, &_bgCamera); + Il2CppObject* _bgCamera = uiManager._bgCamera(); /*il2cpp_class_get_method_from_name_type(_bgCamera->klass, "set_backgroundColor", 1)->methodPointer(_bgCamera, il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Color", "get_clear", IgnoreNumberOfArguments)());*/ @@ -14212,28 +14177,28 @@ namespace if (config::freeform_window) { - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); bool isVirt = width < height; - il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "StandaloneWindowResize", "set_IsVirt", 1)(isVirt); + Gallop::StandaloneWindowResize::IsVirt(isVirt); } if (uiManager && (config::unlock_size || config::freeform_window)) { - int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); - int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + int width = UnityEngine::Screen::width(); + int height = UnityEngine::Screen::height(); bool isVirt = width < height; if (config::freeform_window) { - UIManager_ChangeResizeUIForPC_hook(uiManager, isVirt ? min(last_virt_window_width, last_virt_window_height) : max(last_hriz_window_width, last_hriz_window_height), + uiManager.ChangeResizeUIForPC(isVirt ? min(last_virt_window_width, last_virt_window_height) : max(last_hriz_window_width, last_hriz_window_height), isVirt ? max(last_virt_window_width, last_virt_window_height) : min(last_hriz_window_width, last_hriz_window_height)); } else { - UIManager_ChangeResizeUIForPC_hook(uiManager, isVirt ? min(last_display_width, last_display_height) : max(last_display_width, last_display_height), + uiManager.ChangeResizeUIForPC(isVirt ? min(last_display_width, last_display_height) : max(last_display_width, last_display_height), isVirt ? max(last_display_width, last_display_height) : min(last_display_width, last_display_height)); } } @@ -14357,7 +14322,7 @@ namespace if (config::discord_rich_presence && discord) { - auto detail = GetSceneName(local::wide_u8(sceneName)); + auto detail = GetSceneName(wide_u8(sceneName)); discord::Activity activity{}; activity.GetAssets().SetLargeImage("umamusume"); @@ -14616,16 +14581,15 @@ BOOL InternetCrackUrlW_hook( _Inout_ LPURL_COMPONENTSW lpUrlComponents ) { - auto text = local::wide_u8(lpszUrl); - replaceAll(text, "windows", "android"); + auto newUrlW = wstring(lpszUrl); + replaceAll(newUrlW, L"windows", L"android"); - auto newUrlW = local::u8_wide(text); wchar_t* copy = new wchar_t[newUrlW.size() + 1]; wcscpy(copy, newUrlW.data()); lpszUrl = copy; - dwUrlLength = text.size(); + dwUrlLength = newUrlW.size(); return reinterpret_cast(InternetCrackUrlW_orig)(lpszUrl, dwUrlLength, dwFlags, lpUrlComponents); } @@ -14783,7 +14747,7 @@ FindFirstFileExW_hook( } void* GetModuleHandleW_orig = nullptr; -HMODULE +static HMODULE WINAPI GetModuleHandleW_hook( _In_opt_ LPCWSTR lpModuleName @@ -14791,35 +14755,41 @@ GetModuleHandleW_hook( { if (lpModuleName && lpModuleName == L"version.dll"s) { - return nullptr; + return proxy::version; } return reinterpret_cast(GetModuleHandleW_orig)(lpModuleName); } void* WinVerifyTrust_addr = nullptr; void* WinVerifyTrust_orig = nullptr; -LONG WINAPI WinVerifyTrust_hook(HWND hwnd, GUID* pgActionID, LPVOID pWVTData) +static LONG WINAPI WinVerifyTrust_hook(HWND hwnd, GUID* pgActionID, LPVOID pWVTData) { auto data = reinterpret_cast(pWVTData); - wstring path = data->pFile->pcwszFilePath; - transform(path.begin(), path.end(), path.begin(), [](auto c) - { - return tolower(c); - } - ); - if (path.find(L"version.dll") != wstring::npos) + if (data->pFile) { - wstring dll_path; - dll_path.resize(MAX_PATH); - dll_path.resize(GetSystemDirectoryW(dll_path.data(), MAX_PATH)); + if (data->pFile->pcwszFilePath) + { + wstring path = data->pFile->pcwszFilePath; + transform(path.begin(), path.end(), path.begin(), [](auto c) + { + return tolower(c); + } + ); + if (path.find(L"version.dll") != wstring::npos) + { + wstring dll_path; + dll_path.resize(MAX_PATH); + dll_path.resize(GetSystemDirectoryW(dll_path.data(), MAX_PATH)); - dll_path += LR"(\version.dll)"s; - data->pFile->pcwszFilePath = dll_path.data(); + dll_path += LR"(\version.dll)"s; + data->pFile->pcwszFilePath = dll_path.data(); - MH_DisableHook(WinVerifyTrust_addr); + MH_DisableHook(WinVerifyTrust_addr); - return reinterpret_cast(WinVerifyTrust_addr)(hwnd, pgActionID, pWVTData); + return reinterpret_cast(WinVerifyTrust_addr)(hwnd, pgActionID, pWVTData); + } + } } return reinterpret_cast(WinVerifyTrust_orig)(hwnd, pgActionID, pWVTData); @@ -14850,7 +14820,7 @@ bool init_hook_base() MH_CreateHook(InternetCrackUrlW, InternetCrackUrlW_hook, &InternetCrackUrlW_orig); MH_EnableHook(InternetCrackUrlW); #endif - } +} MH_CreateHook(FindFirstFileExW, FindFirstFileExW_hook, &FindFirstFileExW_orig); MH_EnableHook(FindFirstFileExW); diff --git a/src/il2cpp/il2cpp_symbols.cpp b/src/il2cpp/il2cpp_symbols.cpp index 47f9c1f..87cee1e 100644 --- a/src/il2cpp/il2cpp_symbols.cpp +++ b/src/il2cpp/il2cpp_symbols.cpp @@ -8,13 +8,100 @@ Il2CppDefaults il2cpp_defaults; char* il2cpp_array_addr_with_size(void* array, int32_t size, uintptr_t idx) { - return ((char*)array) + kIl2CppSizeOfArray + size * idx; + return reinterpret_cast(array) + kIl2CppSizeOfArray + size * idx; +} + +Il2CppString* il2cpp_string_new16(const wchar_t* value) +{ + return il2cpp_string_new_utf16(value, wcslen(value)); +} + +#include "config/config.hpp" +#include "string_utils.hpp" + +FieldInfo* il2cpp_class_get_field_from_name_wrap(Il2CppClass* klass, const char* name) +{ + if (config::code_map.IsNull() || config::code_map.HasParseError()) + { + return il2cpp_class_get_field_from_name(klass, name); + } + string className = string(klass->namespaze).append(".").append(klass->name); + + if (config::code_map.HasMember("!common")) + { + auto commonMap = config::code_map["!common"].GetObjectW(); + if (commonMap.HasMember(name)) + { + auto field = il2cpp_class_get_field_from_name(klass, commonMap[name].GetString()); + if (field) + { + return field; + } + } + } + + if (!config::code_map.HasMember(className.data())) + { + return il2cpp_class_get_field_from_name(klass, name); + } + + auto classMap = config::code_map[className.data()].GetObjectW(); + + if (classMap.HasMember(name)) + { + auto field = il2cpp_class_get_field_from_name(klass, classMap[name].GetString()); + if (field) + { + return field; + } + } + + if (classMap.HasMember((name + ".index"s).data())) + { + void* iter = nullptr; + int i = 0; + int index = classMap[(name + ".index"s).data()].GetInt(); + while (FieldInfo* field = il2cpp_class_get_fields(klass, &iter)) + { + if (index == i) + { + return field; + } + i++; + } + } + + if (classMap.HasMember("!extends")) + { + auto parentName = classMap["!extends"].GetString(); + auto parentMap = config::code_map[parentName].GetObjectW(); + auto parentClass = klass->parent; + + if (parentMap.HasMember((name + ".index"s).data())) + { + void* iter = nullptr; + int i = 0; + int index = parentMap[(name + ".index"s).data()].GetInt(); + while (FieldInfo* field = il2cpp_class_get_fields(parentClass, &iter)) + { + if (index == i) + { + return field; + } + i++; + } + } + } + + return il2cpp_class_get_field_from_name(klass, name);; } namespace il2cpp_symbols { Il2CppDomain* il2cpp_domain = nullptr; + std::vector> init_callbacks; + void init_functions(HMODULE game_module); void init_defaults(); @@ -24,6 +111,14 @@ namespace il2cpp_symbols il2cpp_domain = il2cpp_domain_get(); } + void call_init_callbacks() + { + for (auto& init_callback : init_callbacks) + { + init_callback(); + } + } + void init_functions(HMODULE game_module) { #define DO_API(r, n, p) n = reinterpret_cast(GetProcAddress(game_module, #n)) diff --git a/src/il2cpp/il2cpp_symbols.hpp b/src/il2cpp/il2cpp_symbols.hpp index 0eb850d..3bd52ab 100644 --- a/src/il2cpp/il2cpp_symbols.hpp +++ b/src/il2cpp/il2cpp_symbols.hpp @@ -6,156 +6,9 @@ #include -#include "il2cpp-object-internals.h" - -struct Boolean -{ - bool m_value; -}; - -struct Byte -{ - uint8_t m_value; -}; - -// UnityEngine.Color -struct Color_t -{ -public: - // System.Single UnityEngine.Color::r - float r; - // System.Single UnityEngine.Color::g - float g; - // System.Single UnityEngine.Color::b - float b; - // System.Single UnityEngine.Color::a - float a; -}; - -// UnityEngine.Color32 -struct Color32_t -{ -public: - // System.Single UnityEngine.Color32::rgba - unsigned int rgba; -}; - - -// UnityEngine.ScreenOrientation -enum class ScreenOrientation { - Unknown, - Portrait, - PortraitUpsideDown, - LandscapeLeft, - LandscapeRight, - AutoRotation, - Landscape = 3 -}; - -// UnityEngine.Vector2 -struct Vector2_t -{ -public: - // System.Single UnityEngine.Vector2::x - float x; - // System.Single UnityEngine.Vector2::y - float y; -}; - -// UnityEngine.Vector2Int -struct Vector2Int_t -{ -public: - // System.Int32 UnityEngine.Vector2Int::m_X - int x; - // System.Int32 UnityEngine.Vector2Int::m_Y - int y; -}; - -// UnityEngine.Vector3 -struct Vector3_t -{ -public: - // System.Single UnityEngine.Vector3::x - float x; - // System.Single UnityEngine.Vector3::y - float y; - // System.Single UnityEngine.Vector3::z - float z; -}; - -// UnityEngine.Vector4 -struct Vector4_t -{ -public: - // System.Single UnityEngine.Vector4::x - float x; - // System.Single UnityEngine.Vector4::y - float y; - // System.Single UnityEngine.Vector4::z - float z; - // System.Single UnityEngine.Vector4::w - float w; -}; +#include -struct Rect_t -{ -public: - float x; - float y; - float width; - float height; -}; - -struct Resolution_t -{ -public: - int width; - int height; - int herz; -}; - -// UnityEngine.TextGenerationSettings -struct TextGenerationSettings_t -{ -public: - // UnityEngine.Font UnityEngine.TextGenerationSettings::font - void* font; - // UnityEngine.Color UnityEngine.TextGenerationSettings::color - Color_t color; - // System.Int32 UnityEngine.TextGenerationSettings::fontSize - int32_t fontSize; - // System.Single UnityEngine.TextGenerationSettings::lineSpacing - float lineSpacing; - // System.Boolean UnityEngine.TextGenerationSettings::richText - bool richText; - // System.Single UnityEngine.TextGenerationSettings::scaleFactor - float scaleFactor; - // UnityEngine.FontStyle UnityEngine.TextGenerationSettings::fontStyle - int32_t fontStyle; - // UnityEngine.TextAnchor UnityEngine.TextGenerationSettings::textAnchor - int32_t textAnchor; - // System.Boolean UnityEngine.TextGenerationSettings::alignByGeometry - bool alignByGeometry; - // System.Boolean UnityEngine.TextGenerationSettings::resizeTextForBestFit - bool resizeTextForBestFit; - // System.Int32 UnityEngine.TextGenerationSettings::resizeTextMinSize - int32_t resizeTextMinSize; - // System.Int32 UnityEngine.TextGenerationSettings::resizeTextMaxSize - int32_t resizeTextMaxSize; - // System.Boolean UnityEngine.TextGenerationSettings::updateBounds - bool updateBounds; - // UnityEngine.VerticalWrapMode UnityEngine.TextGenerationSettings::verticalOverflow - int32_t verticalOverflow; - // UnityEngine.HorizontalWrapMode UnityEngine.TextGenerationSettings::horizontalOverflow - int32_t horizontalOverflow; - // UnityEngine.Vector2 UnityEngine.TextGenerationSettings::generationExtents - Vector2_t generationExtents; - // UnityEngine.Vector2 UnityEngine.TextGenerationSettings::pivot - Vector2_t pivot; - // System.Boolean UnityEngine.TextGenerationSettings::generateOutOfBounds - bool generateOutOfBounds; -}; +#include "il2cpp-object-internals.h" template struct MethodInfo_t @@ -198,136 +51,6 @@ struct Il2CppArraySize_t : public Il2CppArray ALIGN_TYPE(8) T vector[IL2CPP_ZERO_LEN_ARRAY]; }; -template -struct Nullable -{ - T value; - bool has_value; -}; - -template -struct Entry -{ - int hashCode; - int next; - K key; - V value; -}; - -struct CourseBaseObjectContext -{ - Il2CppObject* coursePrefab; - Il2CppObject* courseGrassFurPrefab; - Il2CppObject* monitorRenderTexture; - Il2CppArraySize* swapTextures; - Il2CppArraySize* swapSubTextures; - Il2CppObject* postFilmSetGroup; - Il2CppObject* grassParam; -}; - -struct RaceLoaderManagerCourceContext -{ - int courseId; - int timeEnum; - int seasonEnum; - int turfGoalGate; - int turfGoalFlower; - int dirtGoalGate; - int dirtGoalFlower; - int skydomeCourseId; - int skydomeSeasonEnum; - int skydomeWeatherEnum; - int skydomeTimeEnum; - int audienceEnum; - int audienceWeatherEnum; - int audienceSeasonEnum; - int treeWeaterEnum; - int treeTimeEnum; - int RotationCategoryEnum; - int lightProbeId; - Il2CppArraySize* materialTeturePairs; - Il2CppArraySize* materialSubTexturePairs; - bool halfStartGate; - int CourseStartGateBaseId; -}; - -struct MoviePlayerHandle -{ - uint32_t id; -}; - -struct CriAtomExPlayback -{ - uint32_t id; -}; - -struct AudioPlayback -{ - CriAtomExPlayback criAtomExPlayback; - bool isError; - int soundGroup; - bool is3dSound; - int atomSourceListIndex; - Il2CppString* cueSheetName; - Il2CppString* cueName; - int cueId; -}; - -struct Randomize3dConfig -{ -}; - -struct CuePos3dInfo -{ - float coneInsideAngle; - float coneOutsideAngle; - float minAttenuationDistance; - float maxAttenuationDistance; - float sourceRadius; - float interiorDistance; - float dopplerFactor; - Randomize3dConfig randomPos; - USHORT distanceAisacControl; - USHORT listenerBaseAngleAisacControl; - USHORT sourceBaseAngleAisacControl; - USHORT listenerBaseElevationAisacControl; - USHORT sourceBaseElevationAisacControl; - USHORT reserved[1]; -}; - -struct GameVariableInfo -{ - char* name; - UINT id; - float gameValue; -}; - -struct CueInfo -{ - int id; - int type; - char* name; - char* userData; - size_t length; - USHORT categories[16]; - short numLimits; - USHORT numBlocks; - USHORT numTracks; - USHORT numRelatedWaveForms; - char priority; - char headerVisibility; - char ignore_player_parameter; - char probability; - int panType; - CuePos3dInfo pos3dInfo; - GameVariableInfo gameVariableInfo; -}; - -struct Scene -{ - int handle; -}; - template struct Il2CppDelegate_t { @@ -355,97 +78,6 @@ struct Il2CppDelegate_t bool method_is_virtual; }; -struct OrderBlock -{ - int order; - Il2CppDelegate* callback; -}; - -struct ObscuredBool -{ - int8_t currentCryptoKey; - int hiddenValue; - bool inited; - bool fakeValue; - bool fakeValueActive; - - bool GetDecrypted() const - { - int8_t key = currentCryptoKey; - if (!key) - { - key = 9; - } - - return (hiddenValue ^ key) != 181; - } -}; - -struct ObscuredInt -{ - int currentCryptoKey; - int hiddenValue; - bool inited; - int fakeValue; - bool fakeValueActive; - - int GetDecrypted() const - { - if (!currentCryptoKey) - { - return hiddenValue ^ 123456; - } - - return hiddenValue ^ currentCryptoKey; - } -}; - -struct ObscuredLong -{ - int64_t currentCryptoKey; - int64_t hiddenValue; - bool inited; - int64_t fakeValue; - bool fakeValueActive; - - int64_t GetDecrypted() const - { - if (!currentCryptoKey) - { - return hiddenValue ^ 123456LL; - } - - return hiddenValue ^ currentCryptoKey; - } -}; - -enum DialogCommonFormType -{ - SMALL_NO_BUTTON, - SMALL_ONE_BUTTON, - SMALL_TWO_BUTTON, - SMALL_THREE_BUTTON, - MIDDLE_NO_BUTTON, - MIDDLE_ONE_BUTTON, - MIDDLE_TWO_BUTTON, - MIDDLE_THREE_BUTTON, - BIG_NO_BUTTON, - BIG_ONE_BUTTON, - BIG_TWO_BUTTON, - BIG_THREE_BUTTON, - WITHOUT_FRAME -}; - -enum LiveState -{ - Play, - Pause, - ShowSkipConfirmDialog, - ShowMenuDialog, - ShowSettingDialog, - HideUI -}; - #define DO_API(r, n, p) extern r (*n) p #include "il2cpp-api-functions.h" #undef DO_API @@ -465,12 +97,20 @@ extern Il2CppDefaults il2cpp_defaults; constexpr int IgnoreNumberOfArguments = -1; +Il2CppString* il2cpp_string_new16(const wchar_t* value); + +FieldInfo* il2cpp_class_get_field_from_name_wrap(Il2CppClass* klass, const char* name); + namespace il2cpp_symbols { extern Il2CppDomain* il2cpp_domain; + extern std::vector> init_callbacks; + void init(HMODULE game_module); + void call_init_callbacks(); + void init_defaults(); Il2CppClass* get_class(const char* assemblyName, const char* namespaze, const char* klassName); @@ -510,3 +150,5 @@ namespace il2cpp_symbols return reinterpret_cast(find_method(assemblyName, namespaze, klassName, predict)); } } + +#include "il2cpp-api-functions.hpp" diff --git a/src/il2cpp/utils/StringView.h b/src/il2cpp/utils/StringView.h index 040a5da..d2d9baa 100644 --- a/src/il2cpp/utils/StringView.h +++ b/src/il2cpp/utils/StringView.h @@ -1,5 +1,5 @@ #pragma once -#include "il2cpp-config.h" +#include "../il2cpp-config.h" #include #if IL2CPP_TARGET_WINDOWS #include diff --git a/src/local/local.cpp b/src/local/local.cpp index 5db3dcc..3141f76 100644 --- a/src/local/local.cpp +++ b/src/local/local.cpp @@ -1,5 +1,4 @@ #include -#include #include "config/config.hpp" @@ -14,60 +13,6 @@ namespace local vector str_list; } - string wide_u8(const wstring& str) - { - string result; - result.resize(str.length() * 4); - - int len = WideCharToMultiByte(CP_UTF8, 0, str.data(), str.length(), result.data(), result.length(), nullptr, nullptr); - - result.resize(len); - - return result; - } - - string u16_u8(const u16string& str) - { - wstring_convert, char16_t> utf16conv; - return utf16conv.to_bytes(str); - } - - wstring u8_wide(const string& str) - { - wstring result; - result.resize(str.length() * 4); - - int len = MultiByteToWideChar(CP_UTF8, 0, str.data(), str.length(), result.data(), result.length()); - - result.resize(len); - - return result; - } - - string wide_acp(const wstring& str) - { - string result; - result.resize(str.length() * 4); - - int len = WideCharToMultiByte(CP_ACP, 0, str.data(), str.length(), result.data(), result.length(), nullptr, nullptr); - - result.resize(len); - - return result; - } - - wstring acp_wide(const string& str) - { - wstring result; - result.resize(str.length() * 4); - - int len = MultiByteToWideChar(CP_ACP, 0, str.data(), str.length(), result.data(), result.length()); - - result.resize(len); - - return result; - } - void reload_textdb(const vector* dicts) { text_db.clear(); diff --git a/src/local/local.hpp b/src/local/local.hpp index b623929..445741e 100644 --- a/src/local/local.hpp +++ b/src/local/local.hpp @@ -6,11 +6,6 @@ namespace local { - std::string wide_u8(const std::wstring& str); - std::string u16_u8(const std::u16string& str); - std::wstring u8_wide(const std::string& str); - std::string wide_acp(const std::wstring& str); - std::wstring acp_wide(const std::string& str); void load_textdb(const std::vector *dicts); void load_textId_textdb(const std::wstring& dict); void reload_textdb(const std::vector* dicts); diff --git a/src/logger/logger.cpp b/src/logger/logger.cpp index e13a3f3..b7a856b 100644 --- a/src/logger/logger.cpp +++ b/src/logger/logger.cpp @@ -1,6 +1,7 @@ #include #include "config/config.hpp" +#include "string_utils.hpp" using namespace std; @@ -55,7 +56,7 @@ namespace logger if (!enabled) return; - auto u8str = local::wide_u8(text); + auto u8str = wide_u8(text); replaceAll(u8str, "\n", "\\n"); replaceAll(u8str, "\"", "\\\""); @@ -74,7 +75,7 @@ namespace logger for (int i = 0; i < dict.size(); i++) { auto hash = std::hash{}(dict[i]); - auto u8str = local::wide_u8(dict[i]); + auto u8str = wide_u8(dict[i]); replaceAll(u8str, "\n", "\\n"); replaceAll(u8str, "\"", "\\\""); if (i == dict.size() - 1) @@ -105,16 +106,16 @@ namespace logger thread t([dict]() { for (auto pair = dict.begin(); pair != dict.end(); pair++) { - auto u8str = local::wide_u8(pair->second); + auto u8str = wide_u8(pair->second); replaceAll(u8str, "\n", "\\n"); replaceAll(u8str, "\"", "\\\""); if (next(pair) == dict.end()) { - static_json << "\"" << local::wide_u8(pair->first) << "\": \"" << u8str << "\"\n"; + static_json << "\"" << wide_u8(pair->first) << "\": \"" << u8str << "\"\n"; } else { - static_json << "\"" << local::wide_u8(pair->first) << "\": \"" << u8str << "\",\n"; + static_json << "\"" << wide_u8(pair->first) << "\": \"" << u8str << "\",\n"; } } static_json << "}\n"; @@ -129,16 +130,16 @@ namespace logger thread t1([not_matched]() { for (auto pair = not_matched.begin(); pair != not_matched.end(); pair++) { - auto u8str = local::wide_u8(pair->second); + auto u8str = wide_u8(pair->second); replaceAll(u8str, "\n", "\\n"); replaceAll(u8str, "\"", "\\\""); if (next(pair) == not_matched.end()) { - not_matched_json << "\"" << local::wide_u8(pair->first) << "\": \"" << u8str << "\"\n"; + not_matched_json << "\"" << wide_u8(pair->first) << "\": \"" << u8str << "\"\n"; } else { - not_matched_json << "\"" << local::wide_u8(pair->first) << "\": \"" << u8str << "\",\n"; + not_matched_json << "\"" << wide_u8(pair->first) << "\": \"" << u8str << "\",\n"; } } not_matched_json << "}\n"; diff --git a/src/masterdb/masterdb.hpp b/src/masterdb/masterdb.hpp index f6b792a..1deb46a 100644 --- a/src/masterdb/masterdb.hpp +++ b/src/masterdb/masterdb.hpp @@ -2,7 +2,7 @@ #include #include "il2cpp/il2cpp_symbols.hpp" -#include "local/local.hpp" +#include "string_utils.hpp" #include "game.hpp" namespace MasterDB @@ -15,7 +15,7 @@ namespace MasterDB void InitMasterDB() { - auto path = local::wide_u8(il2cpp_symbols::get_method_pointer("Cute.Core.Assembly.dll", "Cute.Core", "Device", "GetPersistentDataPath", IgnoreNumberOfArguments)()->chars); + auto path = wide_u8(il2cpp_symbols::get_method_pointer("Cute.Core.Assembly.dll", "Cute.Core", "Device", "GetPersistentDataPath", IgnoreNumberOfArguments)()->chars); auto metaDBPath = path + R"(\meta)"; masterDBPath = path + R"(\master\master.mdb)"; diff --git a/src/msgpack/msgpack_data.hpp b/src/msgpack/msgpack_data.hpp index ea57965..cfd3050 100644 --- a/src/msgpack/msgpack_data.hpp +++ b/src/msgpack/msgpack_data.hpp @@ -13,7 +13,7 @@ #include "il2cpp/il2cpp_symbols.hpp" #include "il2cpp/il2cpp-api-functions.hpp" -#include "local/local.hpp" +#include "string_utils.hpp" #include "game.hpp" #include "masterdb/masterdb.hpp" @@ -22,6 +22,8 @@ #include "notification/DesktopNotificationManagerCompat.h" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Rect.hpp" + using namespace std; using namespace msgpack11; using namespace Microsoft::WRL; @@ -35,6 +37,13 @@ namespace MsgPackData Il2CppString* GetIconPath(int unitId) { + auto newMethod = il2cpp_class_get_method_from_name_type(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "PushNotificationManager"), "createFavIconFilePath", 2); + + if (newMethod) + { + return newMethod->methodPointer(nullptr, unitId, 2); + } + return il2cpp_class_get_method_from_name_type(il2cpp_symbols::get_class("umamusume.dll", "Gallop", "PushNotificationManager"), "createFavIconFilePath", 1)->methodPointer(nullptr, unitId); } @@ -55,7 +64,7 @@ namespace MsgPackData auto readableTexture = il2cpp_object_new(il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D")); il2cpp_class_get_method_from_name_type(readableTexture->klass, ".ctor", 2)->methodPointer(readableTexture, width, height); - il2cpp_class_get_method_from_name_type(readableTexture->klass, "ReadPixels", 3)->methodPointer(readableTexture, Rect_t{ 0, 0, static_cast(width), static_cast(height) }, 0, 0); + il2cpp_class_get_method_from_name_type(readableTexture->klass, "ReadPixels", 3)->methodPointer(readableTexture, UnityEngine::Rect{ 0, 0, static_cast(width), static_cast(height) }, 0, 0); il2cpp_class_get_method_from_name_type(readableTexture->klass, "Apply", 0)->methodPointer(readableTexture); il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "RenderTexture", "set_active", 1)(previous); @@ -131,8 +140,8 @@ namespace MsgPackData if ((!MsgPackData::user_info.empty() || !MsgPackData::tp_info.empty()) && config::notification_tp) { DesktopNotificationManagerCompat::RemoveFromScheduleByTag(L"TP"); - auto title = local::u8_wide(MasterDB::GetTextData(6, leader_chara_id)); - auto content = local::u8_wide(MasterDB::GetTextData(184, leader_chara_id)); + auto title = u8_wide(MasterDB::GetTextData(6, leader_chara_id)); + auto content = u8_wide(MasterDB::GetTextData(184, leader_chara_id)); // history->RemoveGroupedTag(L"TP", L"Generic"); DesktopNotificationManagerCompat::AddScheduledToastNotification(title.data(), content.data(), L"TP", GetIconPath(leader_chara_id)->chars, MsgPackData::tp_info["max_recovery_time"].int64_value() * 1000); } @@ -180,8 +189,8 @@ namespace MsgPackData if ((!MsgPackData::user_info.empty() || !MsgPackData::rp_info.empty()) && config::notification_rp) { DesktopNotificationManagerCompat::RemoveFromScheduleByTag(L"RP"); - auto title = local::u8_wide(MasterDB::GetTextData(6, leader_chara_id)); - auto content = local::u8_wide(MasterDB::GetTextData(185, leader_chara_id)); + auto title = u8_wide(MasterDB::GetTextData(6, leader_chara_id)); + auto content = u8_wide(MasterDB::GetTextData(185, leader_chara_id)); // history->RemoveGroupedTag(L"TP", L"Generic"); DesktopNotificationManagerCompat::AddScheduledToastNotification(title.data(), content.data(), L"RP", GetIconPath(leader_chara_id)->chars, MsgPackData::rp_info["max_recovery_time"].int64_value() * 1000); } @@ -268,18 +277,18 @@ namespace MsgPackData // unique_ptr history; // DesktopNotificationManagerCompat::get_History(&history); - auto title = local::u8_wide(MasterDB::GetTextData(6, leader_chara_id)); + auto title = u8_wide(MasterDB::GetTextData(6, leader_chara_id)); if ((data["user_info"].is_object() || data["tp_info"].is_object()) && config::notification_tp) { DesktopNotificationManagerCompat::RemoveFromScheduleByTag(L"TP"); - auto content = local::u8_wide(MasterDB::GetTextData(184, leader_chara_id)); + auto content = u8_wide(MasterDB::GetTextData(184, leader_chara_id)); // history->RemoveGroupedTag(L"TP", L"Generic"); DesktopNotificationManagerCompat::AddScheduledToastNotification(title.data(), content.data(), L"TP", GetIconPath(leader_chara_id)->chars, MsgPackData::tp_info["max_recovery_time"].int64_value() * 1000); } if ((data["user_info"].is_object() || data["rp_info"].is_object()) && config::notification_rp) { DesktopNotificationManagerCompat::RemoveFromScheduleByTag(L"RP"); - auto content = local::u8_wide(MasterDB::GetTextData(185, leader_chara_id)); + auto content = u8_wide(MasterDB::GetTextData(185, leader_chara_id)); // history->RemoveGroupedTag(L"RP", L"Generic"); DesktopNotificationManagerCompat::AddScheduledToastNotification(title.data(), content.data(), L"RP", GetIconPath(leader_chara_id)->chars, MsgPackData::rp_info["max_recovery_time"].int64_value() * 1000); } diff --git a/src/msgpack/msgpack_modify.hpp b/src/msgpack/msgpack_modify.hpp index ce31e6b..1b5900c 100644 --- a/src/msgpack/msgpack_modify.hpp +++ b/src/msgpack/msgpack_modify.hpp @@ -698,7 +698,7 @@ namespace MsgPackModify { auto userInfo = MsgPack::object{ user_info.object_items() }; - if (userInfo["viewer_id"].int64_value() != 951853429523l) + if (userInfo["viewer_id"].int64_value() != 000000000) { userInfo["name"] = ""; } diff --git a/src/notifier/notifier.cpp b/src/notifier/notifier.cpp index 16edce3..85d69f2 100644 --- a/src/notifier/notifier.cpp +++ b/src/notifier/notifier.cpp @@ -3,6 +3,7 @@ #include "stdinclude.hpp" #include "config/config.hpp" +#include "string_utils.hpp" namespace notifier { @@ -11,7 +12,7 @@ namespace notifier void init() { // g_packet_notifier - client = new httplib::Client(local::wide_u8(config::msgpack_notifier_host)); + client = new httplib::Client(wide_u8(config::msgpack_notifier_host)); client->set_connection_timeout(0, config::msgpack_notifier_connection_timeout_ms); } diff --git a/src/openxr/openxr.cpp b/src/openxr/openxr.cpp index 159b90f..c654c03 100644 --- a/src/openxr/openxr.cpp +++ b/src/openxr/openxr.cpp @@ -4,7 +4,9 @@ #include "il2cpp/il2cpp-tabledefs.h" #include "il2cpp/il2cpp-api-functions.hpp" -#include "local/local.hpp" +#include "string_utils.hpp" + +#include "scripts/UnityEngine.CoreModule/UnityEngine/BeforeRenderHelper.hpp" namespace Unity { @@ -406,13 +408,13 @@ namespace Unity return; } - auto productName = local::wide_u8(il2cpp_resolve_icall_type("UnityEngine.Application::get_productName")()->chars); + auto productName = wide_u8(il2cpp_resolve_icall_type("UnityEngine.Application::get_productName")()->chars); - auto version = local::wide_u8(il2cpp_symbols::get_method_pointer( + auto version = wide_u8(il2cpp_symbols::get_method_pointer( "UnityEngine.CoreModule.dll", "UnityEngine", "Application", "get_version", IgnoreNumberOfArguments)()->chars); - auto unityVersion = local::wide_u8(il2cpp_symbols::get_method_pointer( + auto unityVersion = wide_u8(il2cpp_symbols::get_method_pointer( "UnityEngine.CoreModule.dll", "UnityEngine", "Application", "get_unityVersion", IgnoreNumberOfArguments)()->chars); @@ -503,7 +505,7 @@ namespace Unity auto itemField = il2cpp_class_get_field_from_name(s_OrderBlocks->klass, "_items"); - Il2CppArraySize_t* array1; + Il2CppArraySize_t* array1; il2cpp_field_get_value(s_OrderBlocks, itemField, &array1); auto orderClass = il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "BeforeRenderHelper/OrderBlock"); @@ -514,7 +516,7 @@ namespace Unity il2cpp_array_setref(array2, i, &array1->vector[i]); } - auto orderBlock = reinterpret_cast(il2cpp_object_new(orderClass)); + auto orderBlock = reinterpret_cast(il2cpp_object_new(orderClass)); orderBlock->order = 0; orderBlock->callback = CreateUnityActionStatic(*([]() { @@ -822,7 +824,11 @@ namespace Unity auto allUserPaths = vector{ "/user/hand/left" , "/user/hand/right" }; string name = action.name; - transform(name.begin(), name.end(), name.begin(), tolower); + transform(name.begin(), name.end(), name.begin(), [](auto c) + { + return tolower(c); + } + ); auto actionId = Internal_CreateAction(actionSetId, name.data(), action.localizedName, action.type, guid, allUserPaths.data(), allUserPaths.size(), action.usages.data(), action.usages.size()); diff --git a/src/rich_presence.hpp b/src/rich_presence.hpp index 3a76933..385468a 100644 --- a/src/rich_presence.hpp +++ b/src/rich_presence.hpp @@ -3,7 +3,7 @@ #include #include "il2cpp/il2cpp_symbols.hpp" -#include "local/local.hpp" +#include "string_utils.hpp" using namespace std; @@ -666,7 +666,7 @@ namespace if (!textId.empty()) { - return local::wide_u8(localizeextension_text_hook(GetTextIdByName(textId))->chars).append(" "); + return wide_u8(localizeextension_text_hook(GetTextIdByName(textId))->chars).append(" "); } return ""; @@ -798,7 +798,7 @@ namespace if (!textId.empty()) { - return local::wide_u8(localizeextension_text_hook(GetTextIdByName(textId))->chars).append(" "); + return wide_u8(localizeextension_text_hook(GetTextIdByName(textId))->chars).append(" "); } return sceneId; diff --git a/src/scripts/CriMw.CriWare.Runtime/CriMw.CriWare.Runtime.hpp b/src/scripts/CriMw.CriWare.Runtime/CriMw.CriWare.Runtime.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/CriMw.CriWare.Runtime/CriWare/CriAtomEx.hpp b/src/scripts/CriMw.CriWare.Runtime/CriWare/CriAtomEx.hpp new file mode 100644 index 0000000..10d8a5b --- /dev/null +++ b/src/scripts/CriMw.CriWare.Runtime/CriWare/CriAtomEx.hpp @@ -0,0 +1,79 @@ +#pragma once + +#include "il2cpp/il2cpp_symbols.hpp" + +namespace CriWare +{ + class CriAtomEx + { + public: + enum Randomize3dCalcType + { + None = -1, + Rectangle, + Cuboid, + Circle, + Cylinder, + Sphere, + List = 6 + }; + + struct Randomize3dConfig + { + public: + const int NumOfCalcParams = 3; + bool followsOriginalSource; + CriWare::CriAtomEx::Randomize3dCalcType calculationType; + Il2CppArraySize_t* calculationParameters; + }; + + struct CuePos3dInfo + { + public: + float coneInsideAngle; + float coneOutsideAngle; + float minAttenuationDistance; + float maxAttenuationDistance; + float sourceRadius; + float interiorDistance; + float dopplerFactor; + CriWare::CriAtomEx::Randomize3dConfig randomPos; + unsigned short distanceAisacControl; + unsigned short listenerBaseAngleAisacControl; + unsigned short sourceBaseAngleAisacControl; + unsigned short listenerBaseElevationAisacControl; + unsigned short sourceBaseElevationAisacControl; + unsigned short reserved[1]; + }; + + struct GameVariableInfo + { + public: + char* name; + unsigned int id; + float gameValue; + }; + + struct CueInfo + { + public: + int id; + int type; + char* name; + char* userData; + size_t length; + unsigned short categories[16]; + short numLimits; + unsigned short numBlocks; + unsigned short numTracks; + unsigned short numRelatedWaveForms; + char priority; + char headerVisibility; + char ignore_player_parameter; + char probability; + int panType; + CriWare::CriAtomEx::CuePos3dInfo pos3dInfo; + CriWare::CriAtomEx::GameVariableInfo gameVariableInfo; + }; + }; +} diff --git a/src/scripts/CriMw.CriWare.Runtime/CriWare/CriAtomExPlayback.hpp b/src/scripts/CriMw.CriWare.Runtime/CriWare/CriAtomExPlayback.hpp new file mode 100644 index 0000000..90cf502 --- /dev/null +++ b/src/scripts/CriMw.CriWare.Runtime/CriWare/CriAtomExPlayback.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace CriWare +{ + struct CriAtomExPlayback + { + public: + unsigned int id; + }; +} diff --git a/src/scripts/Cute.Core.Assembly/Cute.Core.Assembly.hpp b/src/scripts/Cute.Core.Assembly/Cute.Core.Assembly.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Cute.Core.Assembly/Cute/Core/UpdateDispatcher.cpp b/src/scripts/Cute.Core.Assembly/Cute/Core/UpdateDispatcher.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Cute.Core.Assembly/Cute/Core/UpdateDispatcher.hpp b/src/scripts/Cute.Core.Assembly/Cute/Core/UpdateDispatcher.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Cute.Cri.Assembly/Cute.Cri.Assembly.hpp b/src/scripts/Cute.Cri.Assembly/Cute.Cri.Assembly.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Cute.Cri.Assembly/Cute/Cri/AudioPlayback.hpp b/src/scripts/Cute.Cri.Assembly/Cute/Cri/AudioPlayback.hpp new file mode 100644 index 0000000..6693087 --- /dev/null +++ b/src/scripts/Cute.Cri.Assembly/Cute/Cri/AudioPlayback.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include "il2cpp/il2cpp-object-internals.h" + +#include "scripts/CriMw.CriWare.Runtime/CriWare/CriAtomExPlayback.hpp" + +namespace Cute +{ + namespace Cri + { + struct AudioPlayback + { + public: + CriWare::CriAtomExPlayback criAtomExPlayback; + bool isError; + int soundGroup; + bool is3dSound; + int atomSourceListIndex; + Il2CppString* cueSheetName; + Il2CppString* cueName; + int cueId; + }; + }; +} diff --git a/src/scripts/Cute.Cri.Assembly/Cute/Cri/MovieManager.cpp b/src/scripts/Cute.Cri.Assembly/Cute/Cri/MovieManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Cute.Cri.Assembly/Cute/Cri/MovieManager.hpp b/src/scripts/Cute.Cri.Assembly/Cute/Cri/MovieManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Cute.Cri.Assembly/Cute/Cri/MoviePlayerBase.cpp b/src/scripts/Cute.Cri.Assembly/Cute/Cri/MoviePlayerBase.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Cute.Cri.Assembly/Cute/Cri/MoviePlayerBase.hpp b/src/scripts/Cute.Cri.Assembly/Cute/Cri/MoviePlayerBase.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Cute.Cri.Assembly/Cute/Cri/MoviePlayerHandle.hpp b/src/scripts/Cute.Cri.Assembly/Cute/Cri/MoviePlayerHandle.hpp new file mode 100644 index 0000000..cc51f4c --- /dev/null +++ b/src/scripts/Cute.Cri.Assembly/Cute/Cri/MoviePlayerHandle.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace Cute +{ + namespace Cri + { + struct MoviePlayerHandle + { + public: + unsigned int id; + }; + }; +} diff --git a/src/scripts/Cute.Cri.Assembly/Cute/Cri/SoundGroup.hpp b/src/scripts/Cute.Cri.Assembly/Cute/Cri/SoundGroup.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DG/Tweening/Core/TweenManager.cpp b/src/scripts/DOTween/DG/Tweening/Core/TweenManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DG/Tweening/Core/TweenManager.hpp b/src/scripts/DOTween/DG/Tweening/Core/TweenManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DG/Tweening/DOTweenModuleUI.cpp b/src/scripts/DOTween/DG/Tweening/DOTweenModuleUI.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DG/Tweening/DOTweenModuleUI.hpp b/src/scripts/DOTween/DG/Tweening/DOTweenModuleUI.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DG/Tweening/TweenCallback.cpp b/src/scripts/DOTween/DG/Tweening/TweenCallback.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DG/Tweening/TweenCallback.hpp b/src/scripts/DOTween/DG/Tweening/TweenCallback.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DG/Tweening/TweenExtensions.cpp b/src/scripts/DOTween/DG/Tweening/TweenExtensions.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DG/Tweening/TweenExtensions.hpp b/src/scripts/DOTween/DG/Tweening/TweenExtensions.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/DOTween/DOTween.hpp b/src/scripts/DOTween/DOTween.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/LibNative.Runtime/LibNative.Runtime.cpp b/src/scripts/LibNative.Runtime/LibNative.Runtime.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/LibNative.Runtime/LibNative.Runtime.hpp b/src/scripts/LibNative.Runtime/LibNative.Runtime.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Plugins/AnimateToUnity/AnRootManager.cpp b/src/scripts/Plugins/AnimateToUnity/AnRootManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Plugins/AnimateToUnity/AnRootManager.hpp b/src/scripts/Plugins/AnimateToUnity/AnRootManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Plugins/AnimateToUnity/AnText.cpp b/src/scripts/Plugins/AnimateToUnity/AnText.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Plugins/AnimateToUnity/AnText.hpp b/src/scripts/Plugins/AnimateToUnity/AnText.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredBool.hpp b/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredBool.hpp new file mode 100644 index 0000000..bf69fee --- /dev/null +++ b/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredBool.hpp @@ -0,0 +1,31 @@ +#pragma once + +namespace CodeStage +{ + namespace AntiCheat + { + namespace ObscuredTypes + { + struct ObscuredBool + { + bool GetDecrypted() const + { + char key = currentCryptoKey; + if (!key) + { + key = 9; + } + + return (hiddenValue ^ key) != 181; + } + + private: + char currentCryptoKey; + int hiddenValue; + bool inited; + bool fakeValue; + bool fakeValueActive; + }; + } + } +} diff --git a/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredInt.hpp b/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredInt.hpp new file mode 100644 index 0000000..cc26116 --- /dev/null +++ b/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredInt.hpp @@ -0,0 +1,30 @@ +#pragma once + +namespace CodeStage +{ + namespace AntiCheat + { + namespace ObscuredTypes + { + struct ObscuredInt + { + int GetDecrypted() const + { + if (!currentCryptoKey) + { + return hiddenValue ^ 123456; + } + + return hiddenValue ^ currentCryptoKey; + } + + private: + int currentCryptoKey; + int hiddenValue; + bool inited; + int fakeValue; + bool fakeValueActive; + }; + } + } +} diff --git a/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredLong.hpp b/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredLong.hpp new file mode 100644 index 0000000..d4982ef --- /dev/null +++ b/src/scripts/Plugins/CodeStage/AntiCheat/ObscuredTypes/ObscuredLong.hpp @@ -0,0 +1,30 @@ +#pragma once + +namespace CodeStage +{ + namespace AntiCheat + { + namespace ObscuredTypes + { + struct ObscuredLong + { + long long GetDecrypted() const + { + if (!currentCryptoKey) + { + return hiddenValue ^ 123456LL; + } + + return hiddenValue ^ currentCryptoKey; + } + + private: + long long currentCryptoKey; + long long hiddenValue; + bool inited; + long long fakeValue; + bool fakeValueActive; + }; + } + } +} diff --git a/src/scripts/Plugins/Plugins.hpp b/src/scripts/Plugins/Plugins.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/ScriptInternal.hpp b/src/scripts/ScriptInternal.hpp new file mode 100644 index 0000000..b04b950 --- /dev/null +++ b/src/scripts/ScriptInternal.hpp @@ -0,0 +1,387 @@ +#pragma once + +#define NOMINMAX + +#include +#include +#include +#include + +#include "il2cpp/il2cpp_symbols.hpp" +#include "il2cpp/il2cpp-tabledefs.h" + +#include "config/config.hpp" + +#define STATIC \ +static void __static__();\ +[[maybe_unused]] static const char __static_value__ = (__static__(), 0);\ +static void __static__() + +inline void PrintStackTrace() +{ + Il2CppString* (*trace)() = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "StackTraceUtility", "ExtractStackTrace", 0); + std::wcout << trace()->chars << std::endl; +} + +template +inline Il2CppClass* GetGenericClass(Il2CppObject* baseRuntimeType, Ts... runtimeTypes) +{ + auto typeArray = reinterpret_cast(il2cpp_array_new(il2cpp_symbols::get_class("mscorlib.dll", "System", "Type"), sizeof...(runtimeTypes))); + + int i = 0; + for (const auto type : { runtimeTypes... }) + { + il2cpp_array_setref(typeArray, i, type); + i++; + } + + auto runtimeType = il2cpp_class_get_method_from_name_type(baseRuntimeType->klass, "MakeGenericType", 1)->methodPointer(baseRuntimeType, typeArray); + auto newType = runtimeType->type.type; + + return il2cpp_class_from_type(newType); +} + +template +inline const MethodInfo* GetGenericMethod(const MethodInfo* baseMethodInfo, Ts... runtimeTypes) +{ + auto runtimeMethodInfo = il2cpp_method_get_object(baseMethodInfo, nullptr); + auto typeArray = reinterpret_cast(il2cpp_array_new(il2cpp_symbols::get_class("mscorlib.dll", "System", "Type"), sizeof...(runtimeTypes))); + + int i = 0; + for (const auto type : { runtimeTypes... }) + { + il2cpp_array_setref(typeArray, i, type); + i++; + } + + auto runtimeType = il2cpp_class_get_method_from_name_type(runtimeMethodInfo->object.klass, "MakeGenericMethod", 1)->methodPointer(&runtimeMethodInfo->object, typeArray); + return il2cpp_method_get_from_reflection(runtimeType); +} + +template +inline Il2CppMulticastDelegate* CreateDelegateWithClass(Il2CppClass* klass, Il2CppObject* target, R(*fn)(Il2CppObject*, T...)) +{ + auto delegate = reinterpret_cast(il2cpp_object_new(klass)); + delegate->delegate.method_ptr = reinterpret_cast(fn); + + const auto methodInfo = new MethodInfo{}; + methodInfo->name = "AnonymousMethod"; + methodInfo->methodPointer = delegate->delegate.method_ptr; + methodInfo->klass = il2cpp_defaults.mono_method_class; + // methodInfo->invoker_method = GetInvokerMethod(fn, index_sequence_for{}); + methodInfo->slot = kInvalidIl2CppMethodSlot; + // methodInfo->flags = METHOD_ATTRIBUTE_PINVOKE_IMPL; + methodInfo->parameters_count = sizeof...(T); + + methodInfo->nativeFunction = reinterpret_cast(fn); + methodInfo->is_marshaled_from_native = true; + + delegate->delegate.method = reinterpret_cast(il2cpp_method_get_object(methodInfo, methodInfo->klass)); + // delegate->delegate.invoke_impl = il2cpp_class_get_method_from_name(klass, "Invoke", IgnoreNumberOfArguments)->invoker_method; + + delegate->delegates = il2cpp_array_new(klass, 1); + il2cpp_array_setref(delegate->delegates, 0, &delegate->delegate); + + auto object1 = reinterpret_cast(&delegate->delegate); + + il2cpp_gc_wbarrier_set_field(object1, reinterpret_cast(&(delegate->delegate).target), target); + + return delegate; +} + +template +inline Il2CppDelegate* CreateDelegate(Il2CppObject* target, R(*fn)(Il2CppObject*, T...)) +{ + auto delegate = reinterpret_cast(il2cpp_object_new(il2cpp_defaults.delegate_class)); + delegate->method_ptr = reinterpret_cast(fn); + + const auto methodInfo = new MethodInfo{}; + methodInfo->name = "AnonymousMethod"; + methodInfo->methodPointer = delegate->method_ptr; + methodInfo->klass = il2cpp_defaults.mono_method_class; + // methodInfo->invoker_method = GetInvokerMethod(fn, index_sequence_for{}); + methodInfo->slot = kInvalidIl2CppMethodSlot; + // methodInfo->flags = METHOD_ATTRIBUTE_PINVOKE_IMPL; + methodInfo->parameters_count = sizeof...(T); + + methodInfo->nativeFunction = reinterpret_cast(fn); + methodInfo->is_marshaled_from_native = true; + + delegate->method = reinterpret_cast(il2cpp_method_get_object(methodInfo, methodInfo->klass)); + // delegate->invoke_impl = methodInfo->invoker_method; + + auto object = reinterpret_cast(delegate); + + il2cpp_gc_wbarrier_set_field(object, reinterpret_cast(&(delegate)->target), target); + + return delegate; +} + +template +inline Il2CppMulticastDelegate* CreateUnityAction(Il2CppObject* target, R(*fn)(Il2CppObject*, T...)) +{ + const auto delegateClass = il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine.Events", "UnityAction"); + auto delegate = reinterpret_cast(il2cpp_object_new(delegateClass)); + delegate->delegate.method_ptr = reinterpret_cast(fn); + + const auto methodInfo = new MethodInfo{}; + methodInfo->name = "AnonymousMethod"; + methodInfo->methodPointer = delegate->delegate.method_ptr; + methodInfo->klass = il2cpp_defaults.mono_method_class; + // methodInfo->invoker_method = GetInvokerMethod(fn, index_sequence_for{}); + methodInfo->slot = kInvalidIl2CppMethodSlot; + // methodInfo->flags = METHOD_ATTRIBUTE_PINVOKE_IMPL; + methodInfo->parameters_count = sizeof...(T); + + methodInfo->nativeFunction = reinterpret_cast(fn); + methodInfo->is_marshaled_from_native = true; + + delegate->delegate.method = reinterpret_cast(il2cpp_method_get_object(methodInfo, methodInfo->klass)); + // delegate->delegate.invoke_impl = il2cpp_class_get_method_from_name(delegateClass, "Invoke", IgnoreNumberOfArguments)->invoker_method; + + delegate->delegates = il2cpp_array_new(delegateClass, 1); + il2cpp_array_setref(delegate->delegates, 0, &delegate->delegate); + + auto object1 = reinterpret_cast(&delegate->delegate); + + il2cpp_gc_wbarrier_set_field(object1, reinterpret_cast(&(delegate->delegate).target), target); + + return delegate; +} + +template +inline Il2CppReflectionMethod* GetRuntimeMethodInfo(R(*fn)(void*, T...)) +{ + const auto methodInfo = new MethodInfo{}; + methodInfo->name = "AnonymousMethod"; + methodInfo->methodPointer = reinterpret_cast(fn); + methodInfo->klass = il2cpp_defaults.mono_method_class; + // methodInfo->invoker_method = GetInvokerMethod(fn, index_sequence_for{}); + methodInfo->slot = kInvalidIl2CppMethodSlot; + // methodInfo->flags = METHOD_ATTRIBUTE_PINVOKE_IMPL; + methodInfo->parameters_count = sizeof...(T); + + methodInfo->nativeFunction = reinterpret_cast(fn); + methodInfo->is_marshaled_from_native = true; + + return il2cpp_method_get_object(methodInfo, methodInfo->klass); +} + +template +inline Il2CppMulticastDelegate* CreateDelegateWithClassStatic(Il2CppClass* klass, R(*fn)(void*, T...)) +{ + auto delegate = reinterpret_cast(il2cpp_object_new(klass)); + delegate->delegate.method_ptr = reinterpret_cast(fn); + + const auto methodInfo = new MethodInfo{}; + methodInfo->name = "AnonymousStaticMethod"; + methodInfo->methodPointer = delegate->delegate.method_ptr; + methodInfo->klass = il2cpp_defaults.mono_method_class; + // methodInfo->invoker_method = GetInvokerMethod(fn, index_sequence_for{}); + methodInfo->slot = kInvalidIl2CppMethodSlot; + methodInfo->flags = METHOD_ATTRIBUTE_STATIC; + methodInfo->parameters_count = sizeof...(T); + + methodInfo->nativeFunction = reinterpret_cast(fn); + methodInfo->is_marshaled_from_native = true; + + delegate->delegate.method = reinterpret_cast(il2cpp_method_get_object(methodInfo, methodInfo->klass)); + // delegate->delegate.invoke_impl = il2cpp_class_get_method_from_name(klass, "Invoke", IgnoreNumberOfArguments)->invoker_method; + + delegate->delegates = il2cpp_array_new(klass, 1); + il2cpp_array_setref(delegate->delegates, 0, &delegate->delegate); + + return delegate; +} + +template +inline Il2CppMulticastDelegate* CreateDelegateWithClassStatic(Il2CppClass* klass, R(*fn)()) +{ + return CreateDelegateWithClassStatic(klass, reinterpret_cast(fn)); +} + +template +inline Il2CppDelegate* CreateDelegateStatic(R(*fn)(void*, T...)) +{ + auto delegate = reinterpret_cast(il2cpp_object_new(il2cpp_defaults.delegate_class)); + delegate->method_ptr = reinterpret_cast(fn); + + const auto methodInfo = new MethodInfo{}; + methodInfo->name = "AnonymousStaticMethod"; + methodInfo->methodPointer = delegate->method_ptr; + methodInfo->klass = il2cpp_defaults.mono_method_class; + // methodInfo->invoker_method = GetInvokerMethod(fn, index_sequence_for{}); + methodInfo->slot = kInvalidIl2CppMethodSlot; + methodInfo->flags = METHOD_ATTRIBUTE_STATIC; + methodInfo->parameters_count = sizeof...(T); + + methodInfo->nativeFunction = reinterpret_cast(fn); + methodInfo->is_marshaled_from_native = true; + + delegate->method = reinterpret_cast(il2cpp_method_get_object(methodInfo, methodInfo->klass)); + // delegate->invoke_impl = methodInfo->invoker_method; + + return delegate; +} + +template +inline Il2CppDelegate* CreateDelegateStatic(R(*fn)()) +{ + return CreateDelegateStatic(reinterpret_cast(fn)); +} + +template +inline Il2CppMulticastDelegate* CreateUnityActionStatic(R(*fn)(void*, T...)) +{ + const auto delegateClass = il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine.Events", "UnityAction"); + auto delegate = reinterpret_cast(il2cpp_object_new(delegateClass)); + delegate->delegate.method_ptr = reinterpret_cast(fn); + + const auto methodInfo = new MethodInfo{}; + methodInfo->name = "AnonymousStaticMethod"; + methodInfo->methodPointer = delegate->delegate.method_ptr; + methodInfo->klass = il2cpp_defaults.mono_method_class; + // methodInfo->invoker_method = GetInvokerMethod(fn, index_sequence_for{}); + methodInfo->slot = kInvalidIl2CppMethodSlot; + methodInfo->flags = METHOD_ATTRIBUTE_STATIC; + methodInfo->parameters_count = sizeof...(T); + + methodInfo->nativeFunction = reinterpret_cast(fn); + methodInfo->is_marshaled_from_native = true; + + delegate->delegate.method = reinterpret_cast(il2cpp_method_get_object(methodInfo, methodInfo->klass)); + // delegate->delegate.invoke_impl = il2cpp_class_get_method_from_name(delegateClass, "Invoke", IgnoreNumberOfArguments)->invoker_method; + + delegate->delegates = il2cpp_array_new(delegateClass, 1); + il2cpp_array_setref(delegate->delegates, 0, &delegate->delegate); + + return delegate; +} + +template +inline Il2CppMulticastDelegate* CreateUnityActionStatic(R(*fn)()) +{ + return CreateUnityActionStatic(reinterpret_cast(fn)); +} + +inline Il2CppObject* GetSingletonInstance(Il2CppClass* klass) +{ + if (!klass || !klass->parent) + { + return nullptr; + } + auto instanceField = il2cpp_class_get_field_from_name_wrap(klass, "_instance"); + if (!instanceField) + { + instanceField = il2cpp_class_get_field_from_name_wrap(klass, "instance"); + if (!instanceField) + { + return nullptr; + } + } + Il2CppObject* instance; + il2cpp_field_static_get_value(instanceField, &instance); + return instance; +} + +inline Il2CppObject* GetSingletonInstanceByMethod(Il2CppClass* klass) +{ + if (!klass || !klass->parent) + { + return nullptr; + } + auto get_Instance = il2cpp_class_get_method_from_name_type(klass, "get_Instance", IgnoreNumberOfArguments); + if (get_Instance) + { + return get_Instance->methodPointer(); + } + return nullptr; +} + +inline Il2CppObject* GetRuntimeType(const char* assemblyName, const char* namespaze, const char* klassName) +{ + return il2cpp_type_get_object(il2cpp_class_get_type(il2cpp_symbols::get_class(assemblyName, namespaze, klassName))); +} + +inline Il2CppObject* GetRuntimeType(Il2CppClass* klass) +{ + return il2cpp_type_get_object(il2cpp_class_get_type(klass)); +} + +#ifdef _MSC_VER +inline HWND GetHWND() +{ + std::wstring title = config::custom_title_name; + if (title.empty()) + { + title = L"umamusume"; + } + + static HWND hWndFound; + + EnumWindows(reinterpret_cast(*([](HWND hWnd, LPARAM lParam) + { + TCHAR buf[MAX_CLASS_NAME]{}; + GetClassNameW(hWnd, (LPTSTR)&buf, MAX_CLASS_NAME); + + if (std::wstring(buf).find(L"UnityWndClass") != std::wstring::npos) + { + DWORD dwWndProcID = 0; + GetWindowThreadProcessId(hWnd, &dwWndProcID); + + if (dwWndProcID == GetCurrentProcessId()) + { + hWndFound = hWnd; + return FALSE; + } + } + + return TRUE; + } + )), NULL); + + return hWndFound; +} +#endif + +inline void dump_bytes(void* pos) +{ + if (pos) + { + printf("Hex dump of %p\n", pos); + + char* memory = reinterpret_cast(pos); + + for (int i = 0; i < 0x20; i++) + { + if (i > 0 && i % 16 == 0) + printf("\n"); + + char byte = *(memory++); + + printf("%02hhX ", byte); + } + + } + printf("\n\n"); +} + +#pragma region HOOK_MACRO +#define ADD_HOOK(_name_, _fmt_) \ + auto _name_##_offset = reinterpret_cast(_name_##_addr); \ + \ + printf(_fmt_, _name_##_offset); \ + dump_bytes(_name_##_offset); \ + \ + auto _name_##_create_result = MH_CreateHook(_name_##_offset, _name_##_hook, &_name_##_orig); \ + if (_name_##_create_result != MH_OK) \ + {\ + cout << "WARN: " << #_name_ << " Create Failed: " << MH_StatusToString(_name_##_create_result) << endl; \ + }\ + auto _name_##_result = MH_EnableHook(_name_##_offset); \ + if (_name_##_result != MH_OK) \ + {\ + cout << "WARN: " << #_name_ << " Failed: " << MH_StatusToString(_name_##_result) << " LastError: " << GetLastError() << endl << endl; \ + _name_##_orig = _name_##_addr; \ + } +#pragma endregion diff --git a/src/scripts/Unity.TextMeshPro/TMPro/TMP_FontAsset.cpp b/src/scripts/Unity.TextMeshPro/TMPro/TMP_FontAsset.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Unity.TextMeshPro/TMPro/TMP_FontAsset.hpp b/src/scripts/Unity.TextMeshPro/TMPro/TMP_FontAsset.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Unity.TextMeshPro/TMPro/TMP_Settings.cpp b/src/scripts/Unity.TextMeshPro/TMPro/TMP_Settings.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Unity.TextMeshPro/TMPro/TMP_Settings.hpp b/src/scripts/Unity.TextMeshPro/TMPro/TMP_Settings.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/Unity.TextMeshPro/Unity.TextMeshPro.hpp b/src/scripts/Unity.TextMeshPro/Unity.TextMeshPro.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.AssetBundleModule/UnityEngine.AssetBundleModule.hpp b/src/scripts/UnityEngine.AssetBundleModule/UnityEngine.AssetBundleModule.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.AssetBundleModule/UnityEngine/AssetBundle.cpp b/src/scripts/UnityEngine.AssetBundleModule/UnityEngine/AssetBundle.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.AssetBundleModule/UnityEngine/AssetBundle.hpp b/src/scripts/UnityEngine.AssetBundleModule/UnityEngine/AssetBundle.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.AssetBundleModule/UnityEngine/AssetBundleRequest.cpp b/src/scripts/UnityEngine.AssetBundleModule/UnityEngine/AssetBundleRequest.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.AssetBundleModule/UnityEngine/AssetBundleRequest.hpp b/src/scripts/UnityEngine.AssetBundleModule/UnityEngine/AssetBundleRequest.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine.CoreModule.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine.CoreModule.hpp new file mode 100644 index 0000000..656a10f --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine.CoreModule.hpp @@ -0,0 +1,2 @@ +#pragma once +#define ASSEMBLY_NAME "UnityEngine.CoreModule.dll" diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Application.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Application.cpp new file mode 100644 index 0000000..4f8bf78 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Application.cpp @@ -0,0 +1,130 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "Application.hpp" + +#include "game.hpp" +#include "config/config.hpp" + +#include + +void* Quit_addr = nullptr; +void* Quit_orig = nullptr; + +void* OpenURL_addr = nullptr; + +void* get_unityVersion_addr = nullptr; + +void* get_companyName_addr = nullptr; + +void* set_targetFrameRate_addr = nullptr; +void* set_targetFrameRate_orig = nullptr; + +static void Quit_hook(int exitCode) +{ +#ifdef _MSC_VER + if (Game::CurrentGameRegion == Game::Region::KOR) + { + auto StackTrace = il2cpp_symbols::get_class("mscorlib.dll", "System.Diagnostics", "StackFrame"); + auto trace = il2cpp_object_new(StackTrace); + il2cpp_class_get_method_from_name_type(trace->klass, ".ctor", 2)->methodPointer(trace, 0, false); + + auto methodRef = il2cpp_class_get_method_from_name_type(trace->klass, "GetMethod", 0)->methodPointer(trace); + + auto method = il2cpp_method_get_from_reflection(methodRef); + + if (string(method->klass->name).find("Uncheater") != string::npos || + string(method->klass->name).find("Boot") != string::npos || + string(method->name).find("Uncheater") != string::npos) + { + return; + } + } +#endif + + UnityEngine::Application::Exit(exitCode); +} + +static void set_targetFrameRate_hook(int value) +{ + reinterpret_cast(set_targetFrameRate_orig)(config::runtime::useDefaultFPS ? value : config::max_fps); +} + +static void InitAddress() +{ + Quit_addr = il2cpp_resolve_icall("UnityEngine.Application::Quit(System.Int32)"); + OpenURL_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "UnityEngine", "Application", "OpenURL", 1); + get_unityVersion_addr = il2cpp_resolve_icall("UnityEngine.Application::get_unityVersion()"); + get_companyName_addr = il2cpp_resolve_icall("UnityEngine.Application::get_companyName()"); + set_targetFrameRate_addr = il2cpp_resolve_icall("UnityEngine.Application::set_targetFrameRate(System.Int32)"); +} + +static void HookMethods() +{ + ADD_HOOK(Quit, "UnityEngine.Application::Quit at %p\n"); + + if (config::max_fps > -1) + { + ADD_HOOK(set_targetFrameRate, "UnityEngine.Application.set_targetFrameRate at %p\n"); + } +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); + il2cpp_symbols::init_callbacks.emplace_back(HookMethods); +} + +namespace UnityEngine +{ + void Application::Quit(int exitCode) + { + reinterpret_cast(Quit_addr)(exitCode); + } + + void Application::OpenURL(Il2CppString* url) + { + reinterpret_cast(OpenURL_addr)(url); + } + + Il2CppString* Application::unityVersion() + { + return reinterpret_cast(get_unityVersion_addr)(); + } + + Il2CppString* Application::companyName() + { + return reinterpret_cast(get_companyName_addr)(); + } + + void Application::targetFrameRate(int value) + { + reinterpret_cast(set_targetFrameRate_addr)(value); + } + + void Application::Exit(int exitCode) + { +#ifdef _MSC_VER + if (Game::CurrentGameRegion == Game::Region::KOR) + { + auto module_path = filesystem::current_path(); + auto uncheater_path_new = module_path.string().append("\\umamusume_Data\\StreamingAssets\\_Uncheater"s).data(); + auto uncheater_path = module_path.string().append("\\umamusume_Data\\StreamingAssets\\Uncheater"s).data(); + if (filesystem::exists(uncheater_path_new)) + { + try + { + filesystem::rename(uncheater_path_new, uncheater_path); + } + catch (exception& e) + { + cout << "Uncheater rename error: " << e.what() << endl; + } + } + } + + TerminateProcess(GetCurrentProcess(), exitCode); +#else + reinterpret_cast(Quit_orig)(exitCode); +#endif + } +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Application.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Application.hpp new file mode 100644 index 0000000..c755995 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Application.hpp @@ -0,0 +1,17 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +namespace UnityEngine +{ + class Application + { + public: + static void Quit(int exitCode); + static void OpenURL(Il2CppString* url); + static Il2CppString* unityVersion(); + static Il2CppString* companyName(); + static void targetFrameRate(int value); + + static void Exit(int exitCode); + }; +} \ No newline at end of file diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/BeforeRenderHelper.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/BeforeRenderHelper.hpp new file mode 100644 index 0000000..81622ae --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/BeforeRenderHelper.hpp @@ -0,0 +1,17 @@ +#pragma once + +#include "il2cpp/il2cpp-object-internals.h" + +namespace UnityEngine +{ + class BeforeRenderHelper + { + public: + struct OrderBlock + { + public: + int order; + Il2CppDelegate* callback; + }; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Behaviour.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Behaviour.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Behaviour.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Behaviour.hpp new file mode 100644 index 0000000..88dfaa6 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Behaviour.hpp @@ -0,0 +1,12 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "Component.hpp" + +namespace UnityEngine +{ + class Behaviour : public Component + { + using Component::Component; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Camera.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Camera.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Camera.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Camera.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Color.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Color.hpp new file mode 100644 index 0000000..e857164 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Color.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace UnityEngine +{ + struct Color + { + public: + float r; + float g; + float b; + float a; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Color32.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Color32.hpp new file mode 100644 index 0000000..1b96c80 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Color32.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace UnityEngine +{ + struct Color32_t + { + public: + unsigned int rgba; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Component.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Component.cpp new file mode 100644 index 0000000..df848c4 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Component.cpp @@ -0,0 +1,24 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "Component.hpp" + +void* get_gameObject_addr = nullptr; + +static void InitAddress() +{ + get_gameObject_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "UnityEngine", "Component", "get_gameObject", 0); +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); +} + +namespace UnityEngine +{ + GameObject Component::gameObject() + { + auto gameObject = reinterpret_cast(get_gameObject_addr)(instance); + return GameObject(gameObject); + } +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Component.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Component.hpp new file mode 100644 index 0000000..4774ded --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Component.hpp @@ -0,0 +1,18 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "Object.hpp" + +namespace UnityEngine +{ + class GameObject; + class Component : public Object + { + public: + GameObject gameObject(); + + using Object::Object; + }; +} + +#include "GameObject.hpp" diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Coroutine.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Coroutine.cpp new file mode 100644 index 0000000..f4b69ff --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Coroutine.cpp @@ -0,0 +1,24 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "Coroutine.hpp" + +Il2CppClass* CoroutineClass = nullptr; + +static void InitAddress() +{ + CoroutineClass = il2cpp_symbols::get_class(ASSEMBLY_NAME, "UnityEngine", "Coroutine"); +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); +} + +namespace UnityEngine +{ + Coroutine::Coroutine(Il2CppObject* object) + { + auto ptrField = il2cpp_class_get_field_from_name_wrap(CoroutineClass, "m_Ptr"); + il2cpp_field_get_value(object, ptrField, &m_Ptr); + } +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Coroutine.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Coroutine.hpp new file mode 100644 index 0000000..b0a82a7 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Coroutine.hpp @@ -0,0 +1,18 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "YieldInstruction.hpp" + +namespace UnityEngine +{ + class Coroutine : public YieldInstruction + { + public: + Coroutine(Il2CppObject* object); + + private: + Coroutine() {} + + void* m_Ptr; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Display.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Display.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Display.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Display.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/GameObject.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/GameObject.cpp new file mode 100644 index 0000000..9bde1c2 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/GameObject.cpp @@ -0,0 +1,63 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "GameObject.hpp" + +void* Internal_CreateGameObject_addr = nullptr; + +void* Internal_AddComponentWithType_addr = nullptr; + +void* GetComponentByName_addr = nullptr; + +void* get_transform_addr = nullptr; + +void* SetActive_addr = nullptr; + +static void InitAddress() +{ + Internal_CreateGameObject_addr = il2cpp_resolve_icall("UnityEngine.GameObject::Internal_CreateGameObject()"); + Internal_AddComponentWithType_addr = il2cpp_resolve_icall("UnityEngine.GameObject::Internal_AddComponentWithType()"); + GetComponentByName_addr = il2cpp_resolve_icall("UnityEngine.GameObject::GetComponentByName()"); + get_transform_addr = il2cpp_resolve_icall("UnityEngine.GameObject::get_transform()"); + SetActive_addr = il2cpp_resolve_icall("UnityEngine.GameObject::SetActive()"); +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); +} + +namespace UnityEngine +{ + GameObject::GameObject(Il2CppString* name) : Object::Object(nullptr) + { + auto gameObject = il2cpp_object_new(il2cpp_symbols::get_class(ASSEMBLY_NAME, "UnityEngine", "GameObject")); + Internal_CreateGameObject(gameObject, name); + this->instance = gameObject; + } + + void GameObject::Internal_CreateGameObject(Il2CppObject* self, Il2CppString* name) + { + reinterpret_cast(Internal_CreateGameObject_addr)(self, name); + } + + Il2CppObject* GameObject::Internal_AddComponentWithType(Il2CppObject* runtimeType) + { + return reinterpret_cast(Internal_AddComponentWithType_addr)(instance, runtimeType); + } + + Il2CppObject* GameObject::GetComponentByName(Il2CppString* name) + { + return reinterpret_cast(GetComponentByName_addr)(instance, name); + } + + Transform GameObject::transform() + { + auto transform = reinterpret_cast(get_transform_addr)(instance); + return Transform(transform); + } + + void GameObject::SetActive(bool value) + { + reinterpret_cast(SetActive_addr)(instance, value); + } +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/GameObject.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/GameObject.hpp new file mode 100644 index 0000000..0b33798 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/GameObject.hpp @@ -0,0 +1,42 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "Object.hpp" + +namespace UnityEngine +{ + class Transform; + class GameObject : public Object + { + public: + GameObject() : GameObject(nullptr) + {} + + GameObject(Il2CppString* name); + + GameObject gameObject() + { + return *this; + } + + Il2CppObject* GetComponentByName(Il2CppString* name); + + Il2CppObject* AddComponent(Il2CppObject* runtimeType) + { + return Internal_AddComponentWithType(runtimeType); + } + + Transform transform(); + + void SetActive(bool value); + + using Object::Object; + + private: + static void Internal_CreateGameObject(Il2CppObject* self, Il2CppString* name); + + Il2CppObject* Internal_AddComponentWithType(Il2CppObject* runtimeType); + }; +} + +#include "Transform.hpp" diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Light.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Light.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Light.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Light.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Material.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Material.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Material.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Material.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/MonoBehaviour.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/MonoBehaviour.cpp new file mode 100644 index 0000000..554724c --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/MonoBehaviour.cpp @@ -0,0 +1,52 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "MonoBehaviour.hpp" +#include "Coroutine.hpp" +#include "scripts/umamusume/Gallop/UIManager.hpp" + +void* StartCoroutineManaged2_addr = nullptr; +void* StartCoroutineManaged2_orig = nullptr; + +static Il2CppObject* StartCoroutineManaged2_hook(Il2CppObject* _this, Il2CppObject* enumerator) +{ + auto coroutine = reinterpret_cast(StartCoroutineManaged2_orig)(_this, enumerator); + + if (string(enumerator->klass->name).find("ChangeOrientation") != string::npos) + { + auto uiManager = Gallop::UIManager::Instance(); + if (uiManager) + { + uiManager.UnlockGameCanvas(); + } + } + + return coroutine; +} + +static void InitAddress() +{ + StartCoroutineManaged2_addr = il2cpp_resolve_icall("UnityEngine.MonoBehaviour::StartCoroutineManaged2()"); +} + +static void HookMethods() +{ + if (config::freeform_window) + { + ADD_HOOK(StartCoroutineManaged2, "UnityEngine.MonoBehaviour::StartCoroutineManaged2 at %p\n"); + } +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); + il2cpp_symbols::init_callbacks.emplace_back(HookMethods); +} + +namespace UnityEngine +{ + Coroutine MonoBehaviour::StartCoroutineManaged2(Il2CppObject* enumerator) + { + auto object = reinterpret_cast(StartCoroutineManaged2_addr)(instance, enumerator); + return Coroutine(object); + } +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/MonoBehaviour.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/MonoBehaviour.hpp new file mode 100644 index 0000000..a9241af --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/MonoBehaviour.hpp @@ -0,0 +1,16 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "Behaviour.hpp" +#include "Coroutine.hpp" + +namespace UnityEngine +{ + class MonoBehaviour : public Behaviour + { + public: + Coroutine StartCoroutineManaged2(Il2CppObject* enumerator); + + using Behaviour::Behaviour; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Object.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Object.cpp new file mode 100644 index 0000000..253f424 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Object.cpp @@ -0,0 +1,66 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "Object.hpp" + +void* FindObjectsByType_addr = nullptr; + +void* FindObjectsOfType_addr = nullptr; + +void* Internal_CloneSingleWithParent_addr = nullptr; +void* Internal_CloneSingleWithParent_orig = nullptr; + +void* Internal_CloneSingle_addr = nullptr; +void* Internal_CloneSingle_orig = nullptr; + +void* GetName_addr = nullptr; + +void* SetName_addr = nullptr; + + +static void InitAddress() +{ + FindObjectsByType_addr = il2cpp_resolve_icall("UnityEngine.Object::FindObjectsByType()"); + FindObjectsOfType_addr = il2cpp_resolve_icall("UnityEngine.Object::FindObjectsOfType()"); + Internal_CloneSingleWithParent_addr = il2cpp_resolve_icall("UnityEngine.Object::Internal_CloneSingleWithParent()"); + Internal_CloneSingle_addr = il2cpp_resolve_icall("UnityEngine.Object::Internal_CloneSingle()"); + GetName_addr = il2cpp_resolve_icall("UnityEngine.Object::GetName()"); + SetName_addr = il2cpp_resolve_icall("UnityEngine.Object::SetName()"); +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); +} + +namespace UnityEngine +{ + Il2CppArraySize_t* Object::FindObjectsByType(Il2CppObject* type, FindObjectsInactive findObjectsInactive, FindObjectsSortMode sortMode) + { + return reinterpret_cast(FindObjectsByType_addr)(type, findObjectsInactive, sortMode); + } + + Il2CppArraySize_t* Object::FindObjectsOfType(Il2CppObject* type, bool includeInactive) + { + return reinterpret_cast(FindObjectsOfType_addr)(type, includeInactive); + } + + Il2CppObject* Object::Internal_CloneSingleWithParent(Il2CppObject* data, Il2CppObject* parent, bool worldPositionStays) + { + return reinterpret_cast(Internal_CloneSingleWithParent_addr)(data, parent, worldPositionStays); + } + + Il2CppObject* Object::Internal_CloneSingle(Il2CppObject* data) + { + return reinterpret_cast(Internal_CloneSingle_addr)(data); + } + + Il2CppString* Object::Name(Il2CppObject* obj) + { + return reinterpret_cast(GetName_addr)(obj); + } + + void Object::Name(Il2CppObject* obj, Il2CppString* name) + { + reinterpret_cast(SetName_addr)(obj, name); + } +} \ No newline at end of file diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Object.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Object.hpp new file mode 100644 index 0000000..c96ac73 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Object.hpp @@ -0,0 +1,56 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +namespace UnityEngine +{ + enum FindObjectsInactive + { + Exclude, + Include + }; + + enum FindObjectsSortMode + { + None, + InstanceID + }; + + class Object + { + public: + static Il2CppArraySize_t* FindObjectsByType(Il2CppObject* type, FindObjectsInactive findObjectsInactive, FindObjectsSortMode sortMode); + static Il2CppArraySize_t* FindObjectsOfType(Il2CppObject* type, bool includeInactive); + static Il2CppObject* Internal_CloneSingleWithParent(Il2CppObject* data, Il2CppObject* parent, bool worldPositionStays); + static Il2CppObject* Internal_CloneSingle(Il2CppObject* data); + static Il2CppString* Name(Il2CppObject* obj); + static void Name(Il2CppObject* obj, Il2CppString* name); + + Il2CppObject* NativeObject() const noexcept + { + return instance; + } + + explicit operator bool() const noexcept + { + return instance != nullptr; + } + + operator Il2CppObject* () const noexcept + { + return instance; + } + + operator Il2CppClass* () const noexcept + { + return instance->klass; + } + + Object(Il2CppObject* instance) + { + this->instance = instance; + } + + protected: + Il2CppObject* instance; + }; +} \ No newline at end of file diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/PlayerPrefs.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/PlayerPrefs.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/PlayerPrefs.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/PlayerPrefs.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/QualitySettings.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/QualitySettings.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/QualitySettings.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/QualitySettings.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Rect.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Rect.hpp new file mode 100644 index 0000000..6ddc735 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Rect.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace UnityEngine +{ + struct Rect + { + public: + float x; + float y; + float width; + float height; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/RectTransform.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/RectTransform.cpp new file mode 100644 index 0000000..e18123a --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/RectTransform.cpp @@ -0,0 +1,55 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "RectTransform.hpp" + +void* set_anchoredPosition_Injected_addr = nullptr; + +void* set_anchorMax_Injected_addr = nullptr; + +void* set_anchorMin_Injected_addr = nullptr; + +void* set_pivot_Injected_addr = nullptr; + +void* set_sizeDelta_Injected_addr = nullptr; + +static void InitAddress() +{ + set_anchoredPosition_Injected_addr = il2cpp_resolve_icall("UnityEngine.RectTransform::set_anchoredPosition_Injected()"); + set_anchorMax_Injected_addr = il2cpp_resolve_icall("UnityEngine.RectTransform::set_anchorMax_Injected()"); + set_anchorMin_Injected_addr = il2cpp_resolve_icall("UnityEngine.RectTransform::set_anchorMin_Injected()"); + set_pivot_Injected_addr = il2cpp_resolve_icall("UnityEngine.RectTransform::set_pivot_Injected()"); + set_sizeDelta_Injected_addr = il2cpp_resolve_icall("UnityEngine.RectTransform::set_sizeDelta_Injected()"); +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); +} + +namespace UnityEngine +{ + void RectTransform::anchoredPosition(Vector2 value) + { + reinterpret_cast(set_anchoredPosition_Injected_addr)(instance, &value); + } + + void RectTransform::anchorMax(Vector2 value) + { + reinterpret_cast(set_anchorMax_Injected_addr)(instance, &value); + } + + void RectTransform::anchorMin(Vector2 value) + { + reinterpret_cast(set_anchorMin_Injected_addr)(instance, &value); + } + + void RectTransform::pivot(Vector2 value) + { + reinterpret_cast(set_pivot_Injected_addr)(instance, &value); + } + + void RectTransform::sizeDelta(Vector2 value) + { + reinterpret_cast(set_sizeDelta_Injected_addr)(instance, &value); + } +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/RectTransform.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/RectTransform.hpp new file mode 100644 index 0000000..868dc69 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/RectTransform.hpp @@ -0,0 +1,20 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "Transform.hpp" +#include "Vector2.hpp" + +namespace UnityEngine +{ + class RectTransform : public Transform + { + public: + void anchoredPosition(Vector2 value); + void anchorMax(Vector2 value); + void anchorMin(Vector2 value); + void pivot(Vector2 value); + void sizeDelta(Vector2 value); + + using Transform::Transform; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/RenderTexture.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/RenderTexture.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/RenderTexture.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/RenderTexture.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Renderer.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Renderer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Renderer.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Renderer.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Rendering/RenderTargetIdentifier.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Rendering/RenderTargetIdentifier.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Rendering/RenderTargetIdentifier.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Rendering/RenderTargetIdentifier.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Resolution.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Resolution.hpp new file mode 100644 index 0000000..464d4cd --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Resolution.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace UnityEngine +{ + struct Resolution + { + public: + int width; + int height; + int herz; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/ResourcesAPIInternal.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/ResourcesAPIInternal.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/ResourcesAPIInternal.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/ResourcesAPIInternal.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/Scene.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/Scene.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/Scene.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/Scene.hpp new file mode 100644 index 0000000..a83e7a7 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/Scene.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include "il2cpp/il2cpp-object-internals.h" + +namespace UnityEngine +{ + namespace SceneManagement + { + struct Scene + { + public: + int handle; + }; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/SceneManager.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/SceneManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/SceneManager.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/SceneManagement/SceneManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Screen.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Screen.cpp new file mode 100644 index 0000000..51d9e57 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Screen.cpp @@ -0,0 +1,88 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "Screen.hpp" + +#include "config/config.hpp" + +void* get_width_addr = nullptr; + +void* get_height_addr = nullptr; + +void* get_fullScreen_addr = nullptr; + +void* get_currentResolution_Injected_addr = nullptr; + +void* RequestOrientation_addr = nullptr; +void* RequestOrientation_orig = nullptr; + +static void RequestOrientation_hook(UnityEngine::ScreenOrientation orientation) +{ + if (config::freeform_window) + { + reinterpret_cast(RequestOrientation_orig)(UnityEngine::ScreenOrientation::AutoRotation); +#ifdef _MSC_VER + auto hWnd = GetHWND(); + + long style = GetWindowLongW(hWnd, GWL_STYLE); + style |= WS_MAXIMIZEBOX; + SetWindowLongPtrW(hWnd, GWL_STYLE, style); +#endif + } + else + { + reinterpret_cast(RequestOrientation_orig)(orientation); + } +} + +static void InitAddress() +{ + get_width_addr = il2cpp_resolve_icall("UnityEngine.Screen::get_width()"); + get_height_addr = il2cpp_resolve_icall("UnityEngine.Screen::get_height()"); + get_fullScreen_addr = il2cpp_resolve_icall("UnityEngine.Screen::get_fullScreen()"); + get_currentResolution_Injected_addr = il2cpp_resolve_icall("UnityEngine.Screen::get_currentResolution_Injected()"); + RequestOrientation_addr = il2cpp_resolve_icall("UnityEngine.Screen::RequestOrientation()"); +} + +static void HookMethods() +{ + if (config::freeform_window) + { + ADD_HOOK(RequestOrientation, "UnityEngine.Screen::RequestOrientation at %p\n"); + } +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); + il2cpp_symbols::init_callbacks.emplace_back(HookMethods); +} + +namespace UnityEngine +{ + int Screen::width() + { + return reinterpret_cast(get_width_addr)(); + } + + int Screen::height() + { + return reinterpret_cast(get_height_addr)(); + } + + bool Screen::fullScreen() + { + return reinterpret_cast(get_fullScreen_addr)(); + } + + Resolution Screen::currentResolution() + { + Resolution resolution; + reinterpret_cast(get_currentResolution_Injected_addr)(&resolution); + return resolution; + } + + void Screen::RequestOrientation(ScreenOrientation orientation) + { + return reinterpret_cast(RequestOrientation_addr)(orientation); + } +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Screen.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Screen.hpp new file mode 100644 index 0000000..27f219e --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Screen.hpp @@ -0,0 +1,22 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "ScreenOrientation.hpp" +#include "Resolution.hpp" + +namespace UnityEngine +{ + class Screen + { + public: + static int width(); + + static int height(); + + static bool fullScreen(); + + static Resolution currentResolution(); + + static void RequestOrientation(ScreenOrientation orientation); + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/ScreenOrientation.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/ScreenOrientation.hpp new file mode 100644 index 0000000..73cbfa5 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/ScreenOrientation.hpp @@ -0,0 +1,14 @@ +#pragma once + +namespace UnityEngine +{ + enum ScreenOrientation { + Unknown, + Portrait, + PortraitUpsideDown, + LandscapeLeft, + LandscapeRight, + AutoRotation, + Landscape = 3 + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Shader.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Shader.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Shader.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Shader.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Sprite.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Sprite.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Sprite.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Sprite.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/StackTraceUtility.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/StackTraceUtility.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/StackTraceUtility.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/StackTraceUtility.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Transform.cpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Transform.cpp new file mode 100644 index 0000000..5a3c6ea --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Transform.cpp @@ -0,0 +1,32 @@ +#include "../UnityEngine.CoreModule.hpp" +#include "../../ScriptInternal.hpp" +#include "Transform.hpp" + +void* SetParent_addr = nullptr; + +void* FindRelativeTransformWithPath_addr = nullptr; + +static void InitAddress() +{ + SetParent_addr = il2cpp_resolve_icall("UnityEngine.Transform::SetParent()"); + FindRelativeTransformWithPath_addr = il2cpp_resolve_icall("UnityEngine.Transform::FindRelativeTransformWithPath()"); +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); +} + +namespace UnityEngine +{ + void Transform::SetParent(Il2CppObject* parent, bool worldPositionStays) + { + reinterpret_cast(SetParent_addr)(instance, parent, worldPositionStays); + } + + Transform Transform::FindRelativeTransformWithPath(Transform transform, Il2CppString* path, bool isActiveOnly) + { + auto relative = reinterpret_cast(FindRelativeTransformWithPath_addr)(transform, path, isActiveOnly); + return Transform(relative); + } +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Transform.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Transform.hpp new file mode 100644 index 0000000..d183582 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Transform.hpp @@ -0,0 +1,33 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "Component.hpp" + +namespace UnityEngine +{ + class Transform : public Component + { + public: + void SetParent(Transform parent) + { + SetParent(parent, true); + } + + void SetParent(Transform parent, bool worldPositionStays) + { + SetParent(parent.NativeObject(), worldPositionStays); + } + + void SetParent(Il2CppObject* parent, bool worldPositionStays); + + Transform Find(Il2CppString* name) + { + return FindRelativeTransformWithPath(instance, name, false); + } + + using Component::Component; + + private: + Transform FindRelativeTransformWithPath(Transform transform, Il2CppString* path, bool isActiveOnly); + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector2.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector2.hpp new file mode 100644 index 0000000..ddd3dac --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector2.hpp @@ -0,0 +1,11 @@ +#pragma once + +namespace UnityEngine +{ + struct Vector2 + { + public: + float x; + float y; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector2Int.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector2Int.hpp new file mode 100644 index 0000000..f935124 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector2Int.hpp @@ -0,0 +1,11 @@ +#pragma once + +namespace UnityEngine +{ + struct Vector2Int + { + public: + int m_X; + int m_Y; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector3.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector3.hpp new file mode 100644 index 0000000..bcfa868 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector3.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace UnityEngine +{ + struct Vector3 + { + public: + float x; + float y; + float z; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector4.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector4.hpp new file mode 100644 index 0000000..b57d8e5 --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/Vector4.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace UnityEngine +{ + struct Vector4 + { + public: + float x; + float y; + float z; + float w; + }; +} diff --git a/src/scripts/UnityEngine.CoreModule/UnityEngine/YieldInstruction.hpp b/src/scripts/UnityEngine.CoreModule/UnityEngine/YieldInstruction.hpp new file mode 100644 index 0000000..328c34b --- /dev/null +++ b/src/scripts/UnityEngine.CoreModule/UnityEngine/YieldInstruction.hpp @@ -0,0 +1,8 @@ +#pragma once + +namespace UnityEngine +{ + class YieldInstruction + { + }; +} diff --git a/src/scripts/UnityEngine.InputLegacyModule/UnityEngine.InputLegacyModule.hpp b/src/scripts/UnityEngine.InputLegacyModule/UnityEngine.InputLegacyModule.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.InputLegacyModule/UnityEngine/Input.cpp b/src/scripts/UnityEngine.InputLegacyModule/UnityEngine/Input.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.InputLegacyModule/UnityEngine/Input.hpp b/src/scripts/UnityEngine.InputLegacyModule/UnityEngine/Input.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.SubsystemsModule/UnityEngine/SubsystemManager.cpp b/src/scripts/UnityEngine.SubsystemsModule/UnityEngine/SubsystemManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.SubsystemsModule/UnityEngine/SubsystemManager.hpp b/src/scripts/UnityEngine.SubsystemsModule/UnityEngine/SubsystemManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.SubsystemsModule/UnityEngine/SubsystemsImplementation/SubsystemDescriptorStore.cpp b/src/scripts/UnityEngine.SubsystemsModule/UnityEngine/SubsystemsImplementation/SubsystemDescriptorStore.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.SubsystemsModule/UnityEngine/SubsystemsImplementation/SubsystemDescriptorStore.hpp b/src/scripts/UnityEngine.SubsystemsModule/UnityEngine/SubsystemsImplementation/SubsystemDescriptorStore.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.TextRenderingModule/UnityEngine.TextRenderingModule.hpp b/src/scripts/UnityEngine.TextRenderingModule/UnityEngine.TextRenderingModule.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.TextRenderingModule/UnityEngine/TextGenerationSettings.hpp b/src/scripts/UnityEngine.TextRenderingModule/UnityEngine/TextGenerationSettings.hpp new file mode 100644 index 0000000..171ad9e --- /dev/null +++ b/src/scripts/UnityEngine.TextRenderingModule/UnityEngine/TextGenerationSettings.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include "il2cpp/il2cpp-object-internals.h" + +#include "scripts/UnityEngine.CoreModule/UnityEngine/Color.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Vector2.hpp" + +namespace UnityEngine +{ + struct TextGenerationSettings + { + public: + Il2CppObject* font; + Color color; + int fontSize; + float lineSpacing; + bool richText; + float scaleFactor; + // UnityEngine.FontStyle UnityEngine.TextGenerationSettings::fontStyle + int fontStyle; + // UnityEngine.TextAnchor UnityEngine.TextGenerationSettings::textAnchor + int textAnchor; + bool alignByGeometry; + bool resizeTextForBestFit; + int resizeTextMinSize; + int resizeTextMaxSize; + bool updateBounds; + // UnityEngine.VerticalWrapMode UnityEngine.TextGenerationSettings::verticalOverflow + int verticalOverflow; + // UnityEngine.HorizontalWrapMode UnityEngine.TextGenerationSettings::horizontalOverflow + int horizontalOverflow; + Vector2 generationExtents; + Vector2 pivot; + bool generateOutOfBounds; + }; +} diff --git a/src/scripts/UnityEngine.TextRenderingModule/UnityEngine/TextGenerator.cpp b/src/scripts/UnityEngine.TextRenderingModule/UnityEngine/TextGenerator.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.TextRenderingModule/UnityEngine/TextGenerator.hpp b/src/scripts/UnityEngine.TextRenderingModule/UnityEngine/TextGenerator.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UI/UnityEngine.UI.hpp b/src/scripts/UnityEngine.UI/UnityEngine.UI.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UI/UnityEngine/UI/CanvasScaler.cpp b/src/scripts/UnityEngine.UI/UnityEngine/UI/CanvasScaler.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UI/UnityEngine/UI/CanvasScaler.hpp b/src/scripts/UnityEngine.UI/UnityEngine/UI/CanvasScaler.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UI/UnityEngine/UI/Text.cpp b/src/scripts/UnityEngine.UI/UnityEngine/UI/Text.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UI/UnityEngine/UI/Text.hpp b/src/scripts/UnityEngine.UI/UnityEngine/UI/Text.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine.UnityWebRequestModule.hpp b/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine.UnityWebRequestModule.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine/Networking/DownloadHandler.cpp b/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine/Networking/DownloadHandler.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine/Networking/DownloadHandler.hpp b/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine/Networking/DownloadHandler.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine/Networking/UploadHandlerRaw.cpp b/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine/Networking/UploadHandlerRaw.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine/Networking/UploadHandlerRaw.hpp b/src/scripts/UnityEngine.UnityWebRequestModule/UnityEngine/Networking/UploadHandlerRaw.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/_Cyan/Cyan/LocalFile/PathResolver.cpp b/src/scripts/_Cyan/Cyan/LocalFile/PathResolver.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/_Cyan/Cyan/LocalFile/PathResolver.hpp b/src/scripts/_Cyan/Cyan/LocalFile/PathResolver.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/_Cyan/_Cyan.hpp b/src/scripts/_Cyan/_Cyan.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/mscorlib/System/Boolean.hpp b/src/scripts/mscorlib/System/Boolean.hpp new file mode 100644 index 0000000..da3dfa2 --- /dev/null +++ b/src/scripts/mscorlib/System/Boolean.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace System +{ + struct Boolean + { + public: + bool m_value; + }; +} diff --git a/src/scripts/mscorlib/System/Byte.hpp b/src/scripts/mscorlib/System/Byte.hpp new file mode 100644 index 0000000..57e5120 --- /dev/null +++ b/src/scripts/mscorlib/System/Byte.hpp @@ -0,0 +1,10 @@ +#pragma once + +namespace System +{ + struct Byte + { + public: + unsigned char m_value; + }; +} diff --git a/src/scripts/mscorlib/System/Collections/Generic/Dictionary.hpp b/src/scripts/mscorlib/System/Collections/Generic/Dictionary.hpp new file mode 100644 index 0000000..c1c8e46 --- /dev/null +++ b/src/scripts/mscorlib/System/Collections/Generic/Dictionary.hpp @@ -0,0 +1,24 @@ +#pragma once + +namespace System +{ + namespace Collections + { + namespace Generic + { + template + class Dictionary + { + public: + struct Entry + { + public: + int hashCode; + int next; + K key; + V value; + }; + }; + } + } +} diff --git a/src/scripts/mscorlib/System/Enum.cpp b/src/scripts/mscorlib/System/Enum.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/mscorlib/System/Enum.hpp b/src/scripts/mscorlib/System/Enum.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/mscorlib/System/Int32.hpp b/src/scripts/mscorlib/System/Int32.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/mscorlib/System/Nullable.hpp b/src/scripts/mscorlib/System/Nullable.hpp new file mode 100644 index 0000000..9ccb120 --- /dev/null +++ b/src/scripts/mscorlib/System/Nullable.hpp @@ -0,0 +1,12 @@ +#pragma once + +namespace System +{ + template + struct Nullable + { + public: + T value; + bool has_value; + }; +} diff --git a/src/scripts/mscorlib/mscorlib.hpp b/src/scripts/mscorlib/mscorlib.hpp new file mode 100644 index 0000000..8ffb9d9 --- /dev/null +++ b/src/scripts/mscorlib/mscorlib.hpp @@ -0,0 +1,2 @@ +#pragma once +#define ASSEMBLY_NAME "mscorlib.dll" diff --git a/src/scripts/umamusume/Gallop/AudioManager.cpp b/src/scripts/umamusume/Gallop/AudioManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/AudioManager.hpp b/src/scripts/umamusume/Gallop/AudioManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/BGManager.cpp b/src/scripts/umamusume/Gallop/BGManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/BGManager.hpp b/src/scripts/umamusume/Gallop/BGManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/BootSystem.cpp b/src/scripts/umamusume/Gallop/BootSystem.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/BootSystem.hpp b/src/scripts/umamusume/Gallop/BootSystem.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/Certification.cpp b/src/scripts/umamusume/Gallop/Certification.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/Certification.hpp b/src/scripts/umamusume/Gallop/Certification.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/CharaPropRendererAccessor.cpp b/src/scripts/umamusume/Gallop/CharaPropRendererAccessor.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/CharaPropRendererAccessor.hpp b/src/scripts/umamusume/Gallop/CharaPropRendererAccessor.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/CourseBaseObject.hpp b/src/scripts/umamusume/Gallop/CourseBaseObject.hpp new file mode 100644 index 0000000..109c7a8 --- /dev/null +++ b/src/scripts/umamusume/Gallop/CourseBaseObject.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "il2cpp/il2cpp-object-internals.h" + +namespace Gallop +{ + class CourseBaseObject + { + struct Context + { + public: + Il2CppObject* coursePrefab; + Il2CppObject* courseGrassFurPrefab; + Il2CppObject* monitorRenderTexture; + Il2CppArraySize* swapTextures; + Il2CppArraySize* swapSubTextures; + Il2CppObject* postFilmSetGroup; + Il2CppObject* grassParam; + }; + }; +} diff --git a/src/scripts/umamusume/Gallop/CutInImageEffectPostRender.cpp b/src/scripts/umamusume/Gallop/CutInImageEffectPostRender.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/CutInImageEffectPostRender.hpp b/src/scripts/umamusume/Gallop/CutInImageEffectPostRender.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/CySpringController.cpp b/src/scripts/umamusume/Gallop/CySpringController.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/CySpringController.hpp b/src/scripts/umamusume/Gallop/CySpringController.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/DialogCircleItemDonate.cpp b/src/scripts/umamusume/Gallop/DialogCircleItemDonate.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/DialogCircleItemDonate.hpp b/src/scripts/umamusume/Gallop/DialogCircleItemDonate.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/DialogCommon.cpp b/src/scripts/umamusume/Gallop/DialogCommon.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/DialogCommon.hpp b/src/scripts/umamusume/Gallop/DialogCommon.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/DialogCommonBase.hpp b/src/scripts/umamusume/Gallop/DialogCommonBase.hpp new file mode 100644 index 0000000..4149de7 --- /dev/null +++ b/src/scripts/umamusume/Gallop/DialogCommonBase.hpp @@ -0,0 +1,25 @@ +#pragma once + +namespace Gallop +{ + class DialogCommonBase + { + public: + enum FormType + { + SMALL_NO_BUTTON, + SMALL_ONE_BUTTON, + SMALL_TWO_BUTTON, + SMALL_THREE_BUTTON, + MIDDLE_NO_BUTTON, + MIDDLE_ONE_BUTTON, + MIDDLE_TWO_BUTTON, + MIDDLE_THREE_BUTTON, + BIG_NO_BUTTON, + BIG_ONE_BUTTON, + BIG_TWO_BUTTON, + BIG_THREE_BUTTON, + WITHOUT_FRAME + }; + }; +} diff --git a/src/scripts/umamusume/Gallop/FrameRateController.cpp b/src/scripts/umamusume/Gallop/FrameRateController.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/FrameRateController.hpp b/src/scripts/umamusume/Gallop/FrameRateController.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GallopFrameBuffer.cpp b/src/scripts/umamusume/Gallop/GallopFrameBuffer.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GallopFrameBuffer.hpp b/src/scripts/umamusume/Gallop/GallopFrameBuffer.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GallopInput.cpp b/src/scripts/umamusume/Gallop/GallopInput.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GallopInput.hpp b/src/scripts/umamusume/Gallop/GallopInput.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GallopUtil.cpp b/src/scripts/umamusume/Gallop/GallopUtil.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GallopUtil.hpp b/src/scripts/umamusume/Gallop/GallopUtil.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GameSystem.cpp b/src/scripts/umamusume/Gallop/GameSystem.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GameSystem.hpp b/src/scripts/umamusume/Gallop/GameSystem.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GraphicSettings.cpp b/src/scripts/umamusume/Gallop/GraphicSettings.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/GraphicSettings.hpp b/src/scripts/umamusume/Gallop/GraphicSettings.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/HttpHelper.cpp b/src/scripts/umamusume/Gallop/HttpHelper.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/HttpHelper.hpp b/src/scripts/umamusume/Gallop/HttpHelper.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/ImageCommon.cpp b/src/scripts/umamusume/Gallop/ImageCommon.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/ImageCommon.hpp b/src/scripts/umamusume/Gallop/ImageCommon.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LimitBreakCut.cpp b/src/scripts/umamusume/Gallop/LimitBreakCut.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LimitBreakCut.hpp b/src/scripts/umamusume/Gallop/LimitBreakCut.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/Live/Director.cpp b/src/scripts/umamusume/Gallop/Live/Director.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/Live/Director.hpp b/src/scripts/umamusume/Gallop/Live/Director.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LiveTheaterCharaSelect.cpp b/src/scripts/umamusume/Gallop/LiveTheaterCharaSelect.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LiveTheaterCharaSelect.hpp b/src/scripts/umamusume/Gallop/LiveTheaterCharaSelect.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LiveViewController.hpp b/src/scripts/umamusume/Gallop/LiveViewController.hpp new file mode 100644 index 0000000..d2b0df3 --- /dev/null +++ b/src/scripts/umamusume/Gallop/LiveViewController.hpp @@ -0,0 +1,18 @@ +#pragma once + +namespace Gallop +{ + class LiveViewController + { + public: + enum LiveState + { + Play, + Pause, + ShowSkipConfirmDialog, + ShowMenuDialog, + ShowSettingDialog, + HideUI + }; + }; +} diff --git a/src/scripts/umamusume/Gallop/LocalPushDefine.hpp b/src/scripts/umamusume/Gallop/LocalPushDefine.hpp new file mode 100644 index 0000000..4376590 --- /dev/null +++ b/src/scripts/umamusume/Gallop/LocalPushDefine.hpp @@ -0,0 +1,22 @@ +#pragma once + +namespace Gallop +{ + class LocalPushDefine + { + public: + enum LocalPushType + { + Tp, + Rp, + Job1, + Job2, + Job3, + Job4, + Job5, + Job6, + Job7, + Job8, + }; + }; +} diff --git a/src/scripts/umamusume/Gallop/Localize.cpp b/src/scripts/umamusume/Gallop/Localize.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/Localize.hpp b/src/scripts/umamusume/Gallop/Localize.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LocalizeExtention.cpp b/src/scripts/umamusume/Gallop/LocalizeExtention.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LocalizeExtention.hpp b/src/scripts/umamusume/Gallop/LocalizeExtention.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LockableBehaviour.hpp b/src/scripts/umamusume/Gallop/LockableBehaviour.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LowResolutionCameraBase.cpp b/src/scripts/umamusume/Gallop/LowResolutionCameraBase.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LowResolutionCameraBase.hpp b/src/scripts/umamusume/Gallop/LowResolutionCameraBase.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/LowResolutionCameraUtil.hpp b/src/scripts/umamusume/Gallop/LowResolutionCameraUtil.hpp new file mode 100644 index 0000000..fa584eb --- /dev/null +++ b/src/scripts/umamusume/Gallop/LowResolutionCameraUtil.hpp @@ -0,0 +1,23 @@ +#pragma once + +namespace Gallop +{ + class LowResolutionCameraUtil + { + public: + enum DrawDirection + { + Vertical, + VerticalInverse, + Horizontal, + HorizontalInverse, + VerticalFixWidth, + VerticalWithBackGround, + Landscape, + Portrait, + PortraitWithBack, + PortraitWithBack_2nd, + Unknown + }; + }; +} diff --git a/src/scripts/umamusume/Gallop/MasterCharacterSystemText.cpp b/src/scripts/umamusume/Gallop/MasterCharacterSystemText.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/MasterCharacterSystemText.hpp b/src/scripts/umamusume/Gallop/MasterCharacterSystemText.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/MiniDirector.cpp b/src/scripts/umamusume/Gallop/MiniDirector.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/MiniDirector.hpp b/src/scripts/umamusume/Gallop/MiniDirector.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/Model/Component/CySpringUpdater.cpp b/src/scripts/umamusume/Gallop/Model/Component/CySpringUpdater.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/Model/Component/CySpringUpdater.hpp b/src/scripts/umamusume/Gallop/Model/Component/CySpringUpdater.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/ModelLoader.cpp b/src/scripts/umamusume/Gallop/ModelLoader.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/ModelLoader.hpp b/src/scripts/umamusume/Gallop/ModelLoader.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/MonoBehaviourExtension.cpp b/src/scripts/umamusume/Gallop/MonoBehaviourExtension.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/MonoBehaviourExtension.hpp b/src/scripts/umamusume/Gallop/MonoBehaviourExtension.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/MonoFunctionSealedBaseForMonoSingleton.hpp b/src/scripts/umamusume/Gallop/MonoFunctionSealedBaseForMonoSingleton.hpp new file mode 100644 index 0000000..048d4c9 --- /dev/null +++ b/src/scripts/umamusume/Gallop/MonoFunctionSealedBaseForMonoSingleton.hpp @@ -0,0 +1,13 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/MonoBehaviour.hpp" + +using namespace UnityEngine; + +namespace Gallop +{ + class MonoFunctionSealedBaseForMonoSingleton abstract : public MonoBehaviour + { + using MonoBehaviour::MonoBehaviour; + }; +} diff --git a/src/scripts/umamusume/Gallop/MonoSingleton.cpp b/src/scripts/umamusume/Gallop/MonoSingleton.cpp new file mode 100644 index 0000000..9cd7234 --- /dev/null +++ b/src/scripts/umamusume/Gallop/MonoSingleton.cpp @@ -0,0 +1,7 @@ +#include "../umamusume.hpp" +#include "../../ScriptInternal.hpp" +#include "MonoSingleton.hpp" + +namespace Gallop +{ +} diff --git a/src/scripts/umamusume/Gallop/MonoSingleton.hpp b/src/scripts/umamusume/Gallop/MonoSingleton.hpp new file mode 100644 index 0000000..fcf250e --- /dev/null +++ b/src/scripts/umamusume/Gallop/MonoSingleton.hpp @@ -0,0 +1,21 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" +#include "MonoFunctionSealedBaseForMonoSingleton.hpp" + +namespace Gallop +{ + template + class MonoSingleton abstract : public MonoFunctionSealedBaseForMonoSingleton + { + public: + static T Instance() + { + auto instanceField = il2cpp_class_get_field_from_name_wrap(il2cpp_symbols::get_class("umamusume.dll", T::namespaze, T::klassName), "_instance"); + Il2CppObject* instance; + il2cpp_field_static_get_value(instanceField, &instance); + return T(instance); + } + + using MonoFunctionSealedBaseForMonoSingleton::MonoFunctionSealedBaseForMonoSingleton; + }; +} diff --git a/src/scripts/umamusume/Gallop/NowLoading.cpp b/src/scripts/umamusume/Gallop/NowLoading.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/NowLoading.hpp b/src/scripts/umamusume/Gallop/NowLoading.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/PartsEpisodeList.cpp b/src/scripts/umamusume/Gallop/PartsEpisodeList.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/PartsEpisodeList.hpp b/src/scripts/umamusume/Gallop/PartsEpisodeList.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/PushNotificationManager.cpp b/src/scripts/umamusume/Gallop/PushNotificationManager.cpp new file mode 100644 index 0000000..819817f --- /dev/null +++ b/src/scripts/umamusume/Gallop/PushNotificationManager.cpp @@ -0,0 +1,32 @@ +#include "../umamusume.hpp" +#include "../../ScriptInternal.hpp" +#include "PushNotificationManager.hpp" + +#include "config/config.hpp" + +void* createFavIconFilePath_addr = nullptr; +void* legacy_createFavIconFilePath_addr = nullptr; + +static void InitAddress() +{ + createFavIconFilePath_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "PushNotificationManager", "createFavIconFilePath", 2); + legacy_createFavIconFilePath_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "PushNotificationManager", "createFavIconFilePath", 1); +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); +} + +namespace Gallop +{ + Il2CppString* PushNotificationManager::createFavIconFilePath(int _unitId, LocalPushDefine::LocalPushType localPushType) + { + if (createFavIconFilePath_addr) + { + return reinterpret_cast(createFavIconFilePath_addr)(_unitId, localPushType); + } + + return reinterpret_cast(legacy_createFavIconFilePath_addr)(_unitId); + } +} diff --git a/src/scripts/umamusume/Gallop/PushNotificationManager.hpp b/src/scripts/umamusume/Gallop/PushNotificationManager.hpp new file mode 100644 index 0000000..3240e12 --- /dev/null +++ b/src/scripts/umamusume/Gallop/PushNotificationManager.hpp @@ -0,0 +1,14 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "scripts/UnityEngine.CoreModule/UnityEngine/ScreenOrientation.hpp" +#include "scripts/umamusume/Gallop/LocalPushDefine.hpp" + +namespace Gallop +{ + class PushNotificationManager + { + public: + static Il2CppString* createFavIconFilePath(int _unitId, LocalPushDefine::LocalPushType localPushType); + }; +} diff --git a/src/scripts/umamusume/Gallop/RaceCameraManager.cpp b/src/scripts/umamusume/Gallop/RaceCameraManager.cpp new file mode 100644 index 0000000..82a1754 --- /dev/null +++ b/src/scripts/umamusume/Gallop/RaceCameraManager.cpp @@ -0,0 +1,66 @@ +#include "../umamusume.hpp" +#include "../../ScriptInternal.hpp" +#include "RaceCameraManager.hpp" + +#ifdef _MSC_VER +#include "StandaloneWindowResize.hpp" +#endif + +#include "config/config.hpp" + +void* SetupOrientation_addr = nullptr; + +void* ChangeOrientationCoroutine_addr = nullptr; +void* ChangeOrientationCoroutine_orig = nullptr; + +static Il2CppObject* ChangeOrientationCoroutine_hook(Il2CppObject* _this, Gallop::LowResolutionCameraUtil::DrawDirection direction, bool isFade, + Il2CppDelegate_t* onChangeResolution) +{ + cout << "ChangeOrientationCoroutine" << endl; + Gallop::LowResolutionCameraUtil::DrawDirection newDirection = direction; + +#ifdef _MSC_VER + newDirection = Gallop::StandaloneWindowResize::IsVirt() ? Gallop::LowResolutionCameraUtil::DrawDirection::Portrait : Gallop::LowResolutionCameraUtil::DrawDirection::Landscape; +#endif + + return reinterpret_cast*)> + (ChangeOrientationCoroutine_orig)(_this, newDirection, isFade, onChangeResolution); +} + +static void InitAddress() +{ + SetupOrientation_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "RaceCameraManager", "SetupOrientation", 1); + ChangeOrientationCoroutine_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "RaceCameraManager", "ChangeOrientationCoroutine", 3); +} + +static void HookMethods() +{ + if (config::freeform_window) + { + ADD_HOOK(ChangeOrientationCoroutine, "Gallop.Screen::set_OriginalScreenWidth at %p\n"); + } +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); + il2cpp_symbols::init_callbacks.emplace_back(HookMethods); +} + +namespace Gallop +{ + const char* RaceCameraManager::namespaze = "Gallop"; + const char* RaceCameraManager::klassName = "RaceCameraManager"; + + void RaceCameraManager::SetupOrientation(LowResolutionCameraUtil::DrawDirection drawDirection) + { + reinterpret_cast(SetupOrientation_addr)(instance, drawDirection); + } + + Il2CppObject* RaceCameraManager::ChangeOrientationCoroutine(LowResolutionCameraUtil::DrawDirection direction, bool isFade, + Il2CppDelegate_t* onChangeResolution) + { + return reinterpret_cast*)>(ChangeOrientationCoroutine_addr)(instance, direction, isFade, onChangeResolution); + } +} \ No newline at end of file diff --git a/src/scripts/umamusume/Gallop/RaceCameraManager.hpp b/src/scripts/umamusume/Gallop/RaceCameraManager.hpp new file mode 100644 index 0000000..3cd6965 --- /dev/null +++ b/src/scripts/umamusume/Gallop/RaceCameraManager.hpp @@ -0,0 +1,22 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "MonoSingleton.hpp" +#include "LowResolutionCameraUtil.hpp" + +namespace Gallop +{ + class RaceCameraManager : public MonoSingleton + { + public: + void SetupOrientation(LowResolutionCameraUtil::DrawDirection drawDirection); + + Il2CppObject* ChangeOrientationCoroutine(LowResolutionCameraUtil::DrawDirection direction, bool isFade, + Il2CppDelegate_t* onChangeResolution); + + using MonoSingleton::MonoSingleton; + + static const char* namespaze; + static const char* klassName; + }; +} diff --git a/src/scripts/umamusume/Gallop/RaceImageEffect.cpp b/src/scripts/umamusume/Gallop/RaceImageEffect.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/RaceImageEffect.hpp b/src/scripts/umamusume/Gallop/RaceImageEffect.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/RaceLoaderManager.hpp b/src/scripts/umamusume/Gallop/RaceLoaderManager.hpp new file mode 100644 index 0000000..f30b9c5 --- /dev/null +++ b/src/scripts/umamusume/Gallop/RaceLoaderManager.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include "il2cpp/il2cpp-object-internals.h" + +namespace Gallop +{ + class RaceLoaderManager + { + public: + struct CourceContext + { + public: + int courseId; + int timeEnum; + int seasonEnum; + int turfGoalGate; + int turfGoalFlower; + int dirtGoalGate; + int dirtGoalFlower; + int skydomeCourseId; + int skydomeSeasonEnum; + int skydomeWeatherEnum; + int skydomeTimeEnum; + int audienceEnum; + int audienceWeatherEnum; + int audienceSeasonEnum; + int treeWeaterEnum; + int treeTimeEnum; + int RotationCategoryEnum; + int lightProbeId; + Il2CppArraySize* materialTeturePairs; + Il2CppArraySize* materialSubTexturePairs; + bool halfStartGate; + int CourseStartGateBaseId; + }; + }; +} diff --git a/src/scripts/umamusume/Gallop/RaceManager.cpp b/src/scripts/umamusume/Gallop/RaceManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/RaceManager.hpp b/src/scripts/umamusume/Gallop/RaceManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/SceneDefine.hpp b/src/scripts/umamusume/Gallop/SceneDefine.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/SceneManager.cpp b/src/scripts/umamusume/Gallop/SceneManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/SceneManager.hpp b/src/scripts/umamusume/Gallop/SceneManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/Screen.cpp b/src/scripts/umamusume/Gallop/Screen.cpp new file mode 100644 index 0000000..cd0476e --- /dev/null +++ b/src/scripts/umamusume/Gallop/Screen.cpp @@ -0,0 +1,165 @@ +#include "../umamusume.hpp" +#include "../../ScriptInternal.hpp" +#include "Screen.hpp" + +#include "config/config.hpp" + +Il2CppClass* ScreenClass = nullptr; + +void* get_OriginalScreenWidth_addr = nullptr; +void* get_OriginalScreenWidth_orig = nullptr; + +void* set_OriginalScreenWidth_addr = nullptr; +void* set_OriginalScreenWidth_orig = nullptr; + +void* get_OriginalScreenHeight_addr = nullptr; +void* get_OriginalScreenHeight_orig = nullptr; + +void* set_OriginalScreenHeight_addr = nullptr; +void* set_OriginalScreenHeight_orig = nullptr; + +void* ChangeScreenOrientation_addr = nullptr; +void* ChangeScreenOrientation_orig = nullptr; + +void* ChangeScreenOrientationLandscapeAsync_addr = nullptr; +void* ChangeScreenOrientationLandscapeAsync_orig = nullptr; + +void* ChangeScreenOrientationPortraitAsync_addr = nullptr; +void* ChangeScreenOrientationPortraitAsync_orig = nullptr; + +void* get_IsVertical_addr = nullptr; +void* get_IsVertical_orig = nullptr; + +static int get_OriginalScreenWidth_hook() +{ + auto widthField = il2cpp_class_get_field_from_name_wrap(ScreenClass, "_originalScreenWidth"); + int _originalScreenWidth; + il2cpp_field_static_get_value(widthField, &_originalScreenWidth); + return _originalScreenWidth; +} + +static void set_OriginalScreenWidth_hook(int value) +{ + auto widthField = il2cpp_class_get_field_from_name_wrap(ScreenClass, "_originalScreenWidth"); + il2cpp_field_static_set_value(widthField, &value); +} + +static int get_OriginalScreenHeight_hook() +{ + auto heightField = il2cpp_class_get_field_from_name_wrap(ScreenClass, "_originalScreenHeight"); + int _originalScreenHeight; + il2cpp_field_static_get_value(heightField, &_originalScreenHeight); + return _originalScreenHeight; +} + +static void set_OriginalScreenHeight_hook(int value) +{ + auto heightField = il2cpp_class_get_field_from_name_wrap(ScreenClass, "_originalScreenHeight"); + il2cpp_field_static_set_value(heightField, &value); +} + +static Il2CppObject* ChangeScreenOrientation_hook(UnityEngine::ScreenOrientation targetOrientation, bool isForce) +{ + if (config::freeform_window) + { + auto yield = il2cpp_object_new(il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "WaitWhile")); + il2cpp_class_get_method_from_name_type(yield->klass, ".ctor", 1)->methodPointer(yield, CreateDelegateStatic(*[]() { return false; })); + return yield; + } + + return reinterpret_cast(ChangeScreenOrientation_orig)(targetOrientation, isForce); +} + +static Il2CppObject* ChangeScreenOrientationLandscapeAsync_hook() +{ + if (config::freeform_window) + { + auto yield = il2cpp_object_new(il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "WaitWhile")); + il2cpp_class_get_method_from_name_type(yield->klass, ".ctor", 1)->methodPointer(yield, CreateDelegateStatic(*[]() { return false; })); + return yield; + } + + return reinterpret_cast(ChangeScreenOrientationLandscapeAsync_orig)(); +} + +static Il2CppObject* ChangeScreenOrientationPortraitAsync_hook() +{ + if (config::freeform_window) + { + auto yield = il2cpp_object_new(il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "WaitWhile")); + il2cpp_class_get_method_from_name_type(yield->klass, ".ctor", 1)->methodPointer(yield, CreateDelegateStatic(*[]() { return false; })); + return yield; + } + + return reinterpret_cast(ChangeScreenOrientationPortraitAsync_orig)(); +} + +static void InitAddress() +{ + ScreenClass = il2cpp_symbols::get_class(ASSEMBLY_NAME, "Gallop", "Screen"); + get_OriginalScreenWidth_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "Screen", "get_OriginalScreenWidth", 0); + set_OriginalScreenWidth_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "Screen", "set_OriginalScreenWidth", 1); + get_OriginalScreenHeight_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "Screen", "get_OriginalScreenHeight", 0); + set_OriginalScreenHeight_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "Screen", "set_OriginalScreenHeight", 1); + ChangeScreenOrientation_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "Screen", "ChangeScreenOrientation", 2); + ChangeScreenOrientationLandscapeAsync_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "Screen", "ChangeScreenOrientationLandscapeAsync", 0); + ChangeScreenOrientationPortraitAsync_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "Screen", "ChangeScreenOrientationPortraitAsync", 0); +} + +static void HookMethods() +{ + if (config::freeform_window) + { + ADD_HOOK(get_OriginalScreenWidth, "Gallop.Screen::get_OriginalScreenWidth at %p\n"); + ADD_HOOK(set_OriginalScreenWidth, "Gallop.Screen::set_OriginalScreenWidth at %p\n"); + ADD_HOOK(get_OriginalScreenHeight, "Gallop.Screen::get_OriginalScreenHeight at %p\n"); + ADD_HOOK(set_OriginalScreenHeight, "Gallop.Screen::set_OriginalScreenHeight at %p\n"); + ADD_HOOK(ChangeScreenOrientation, "Gallop.Screen::ChangeScreenOrientation at %p\n"); + ADD_HOOK(ChangeScreenOrientationLandscapeAsync, "Gallop.Screen::ChangeScreenOrientationLandscapeAsync at %p\n"); + ADD_HOOK(ChangeScreenOrientationPortraitAsync, "Gallop.Screen::ChangeScreenOrientationPortraitAsync at %p\n"); + } +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); + il2cpp_symbols::init_callbacks.emplace_back(HookMethods); +} + +namespace Gallop +{ + int Screen::OriginalScreenWidth() + { + return reinterpret_cast(get_OriginalScreenWidth_addr)(); + } + + void Screen::OriginalScreenWidth(int value) + { + reinterpret_cast(set_OriginalScreenWidth_addr)(value); + } + + int Screen::OriginalScreenHeight() + { + return reinterpret_cast(get_OriginalScreenHeight_addr)(); + } + + void Screen::OriginalScreenHeight(int value) + { + reinterpret_cast(set_OriginalScreenHeight_addr)(value); + } + + Il2CppObject* Screen::ChangeScreenOrientation(UnityEngine::ScreenOrientation targetOrientation, bool isForce) + { + return reinterpret_cast(ChangeScreenOrientation_addr)(targetOrientation, isForce); + } + + Il2CppObject* Screen::ChangeScreenOrientationLandscapeAsync() + { + return reinterpret_cast(ChangeScreenOrientationLandscapeAsync_addr)(); + } + + Il2CppObject* Screen::ChangeScreenOrientationPortraitAsync() + { + return reinterpret_cast(ChangeScreenOrientationPortraitAsync_addr)(); + } +} diff --git a/src/scripts/umamusume/Gallop/Screen.hpp b/src/scripts/umamusume/Gallop/Screen.hpp new file mode 100644 index 0000000..3f6f647 --- /dev/null +++ b/src/scripts/umamusume/Gallop/Screen.hpp @@ -0,0 +1,25 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" + +#include "scripts/UnityEngine.CoreModule/UnityEngine/ScreenOrientation.hpp" + +namespace Gallop +{ + class Screen + { + public: + static int OriginalScreenWidth(); + + static void OriginalScreenWidth(int value); + + static int OriginalScreenHeight(); + + static void OriginalScreenHeight(int value); + + static Il2CppObject* ChangeScreenOrientation(UnityEngine::ScreenOrientation targetOrientation, bool isForce); + + static Il2CppObject* ChangeScreenOrientationLandscapeAsync(); + + static Il2CppObject* ChangeScreenOrientationPortraitAsync(); + }; +} diff --git a/src/scripts/umamusume/Gallop/StandaloneWindowResize.cpp b/src/scripts/umamusume/Gallop/StandaloneWindowResize.cpp new file mode 100644 index 0000000..9ea0b82 --- /dev/null +++ b/src/scripts/umamusume/Gallop/StandaloneWindowResize.cpp @@ -0,0 +1,36 @@ +#ifdef _MSC_VER + +#include "../umamusume.hpp" +#include "../../ScriptInternal.hpp" +#include "StandaloneWindowResize.hpp" + +#include "config/config.hpp" + +void* get_IsVirt_addr = nullptr; + +void* set_IsVirt_addr = nullptr; + +static void InitAddress() +{ + get_IsVirt_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "StandaloneWindowResize", "get_IsVirt", 0); + set_IsVirt_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "StandaloneWindowResize", "set_IsVirt", 1); +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); +} + +namespace Gallop +{ + bool StandaloneWindowResize::IsVirt() + { + return reinterpret_cast(get_IsVirt_addr)(); + } + + void StandaloneWindowResize::IsVirt(bool value) + { + reinterpret_cast(set_IsVirt_addr)(value); + } +} +#endif diff --git a/src/scripts/umamusume/Gallop/StandaloneWindowResize.hpp b/src/scripts/umamusume/Gallop/StandaloneWindowResize.hpp new file mode 100644 index 0000000..1212ff4 --- /dev/null +++ b/src/scripts/umamusume/Gallop/StandaloneWindowResize.hpp @@ -0,0 +1,16 @@ +#pragma once + +#ifdef _MSC_VER +#include "il2cpp/il2cpp_symbols.hpp" + +namespace Gallop +{ + class StandaloneWindowResize + { + public: + static bool IsVirt(); + + static void IsVirt(bool value); + }; +} +#endif diff --git a/src/scripts/umamusume/Gallop/StoryImageEffect.cpp b/src/scripts/umamusume/Gallop/StoryImageEffect.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryImageEffect.hpp b/src/scripts/umamusume/Gallop/StoryImageEffect.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryRaceTextAsset.cpp b/src/scripts/umamusume/Gallop/StoryRaceTextAsset.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryRaceTextAsset.hpp b/src/scripts/umamusume/Gallop/StoryRaceTextAsset.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryTimelineBlockData.cpp b/src/scripts/umamusume/Gallop/StoryTimelineBlockData.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryTimelineBlockData.hpp b/src/scripts/umamusume/Gallop/StoryTimelineBlockData.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryTimelineController.cpp b/src/scripts/umamusume/Gallop/StoryTimelineController.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryTimelineController.hpp b/src/scripts/umamusume/Gallop/StoryTimelineController.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryViewController.cpp b/src/scripts/umamusume/Gallop/StoryViewController.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/StoryViewController.hpp b/src/scripts/umamusume/Gallop/StoryViewController.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TapEffectController.cpp b/src/scripts/umamusume/Gallop/TapEffectController.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TapEffectController.hpp b/src/scripts/umamusume/Gallop/TapEffectController.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TextCommon.cpp b/src/scripts/umamusume/Gallop/TextCommon.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TextCommon.hpp b/src/scripts/umamusume/Gallop/TextCommon.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TextId.hpp b/src/scripts/umamusume/Gallop/TextId.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TextMeshProUguiCommon.cpp b/src/scripts/umamusume/Gallop/TextMeshProUguiCommon.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TextMeshProUguiCommon.hpp b/src/scripts/umamusume/Gallop/TextMeshProUguiCommon.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TextUtil.cpp b/src/scripts/umamusume/Gallop/TextUtil.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TextUtil.hpp b/src/scripts/umamusume/Gallop/TextUtil.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TitleViewController.cpp b/src/scripts/umamusume/Gallop/TitleViewController.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/TitleViewController.hpp b/src/scripts/umamusume/Gallop/TitleViewController.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/UIManager.cpp b/src/scripts/umamusume/Gallop/UIManager.cpp new file mode 100644 index 0000000..8a15a2f --- /dev/null +++ b/src/scripts/umamusume/Gallop/UIManager.cpp @@ -0,0 +1,501 @@ +#include "../umamusume.hpp" +#include "../../ScriptInternal.hpp" +#include "UIManager.hpp" +#include "StandaloneWindowResize.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Object.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Vector2.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Vector3.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Screen.hpp" + +#include "game.hpp" +#include "config/config.hpp" + +#include + +void* ShowNotification_addr = nullptr; + +void* get_UITexture_addr = nullptr; + +void* get_CommonHeaderTitle_addr = nullptr; + +void* SetCameraSizeByOrientation_addr = nullptr; + +void* CheckUIToFrameBufferBlitInstance_addr = nullptr; + +void* AdjustSafeArea_addr = nullptr; + +void* AdjustMissionClearContentsRootRect_addr = nullptr; + +void* AdjustSafeAreaToAnnounceRect_addr = nullptr; + +void* ReleaseRenderTexture_addr = nullptr; + +void* LockGameCanvas_addr = nullptr; +void* LockGameCanvas_orig = nullptr; + +void* UnlockGameCanvas_addr = nullptr; +void* UnlockGameCanvas_orig = nullptr; + +void* WaitResizeUI_addr = nullptr; +void* WaitResizeUI_orig = nullptr; + +void* GetCanvasScalerList_addr = nullptr; + +void* GetCameraSizeByOrientation_addr = nullptr; +void* GetCameraSizeByOrientation_orig = nullptr; + +void* get_DefaultResolution_addr = nullptr; +void* get_DefaultResolution_orig = nullptr; + +#ifdef _MSC_VER +void* ChangeResizeUIForPC_addr = nullptr; +void* ChangeResizeUIForPC_orig = nullptr; +#endif + +float ratio_vertical = 0.5625f; +float ratio_horizontal = 1.7777778f; + +static void SetBGCanvasScalerSize() +{ + auto bgManager = il2cpp_symbols::get_method_pointer("umamusume.dll", "Gallop", "BGManager", "get_Instance", 0)(); + if (bgManager) + { + auto _mainBgField = il2cpp_class_get_field_from_name_wrap(bgManager->klass, "_mainBg"); + Il2CppObject* _mainBg; + il2cpp_field_get_value(bgManager, _mainBgField, &_mainBg); + + if (_mainBg) + { + auto transform = il2cpp_class_get_method_from_name_type(_mainBg->klass, "get_transform", 0)->methodPointer(_mainBg); + + int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); + int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + + if (width > height) + { + auto pos = il2cpp_class_get_method_from_name_type(transform->klass, "get_localPosition", 0)->methodPointer(transform); + + if (pos.y == 0) + { + il2cpp_class_get_method_from_name_type(transform->klass, "set_localPosition", 1)->methodPointer(transform, UnityEngine::Vector3{ 0, 0, 0 }); + } + } + } + + auto _bgCanvasScalerField = il2cpp_class_get_field_from_name_wrap(bgManager->klass, "_bgCanvasScaler"); + Il2CppObject* _bgCanvasScaler; + il2cpp_field_get_value(bgManager, _bgCanvasScalerField, &_bgCanvasScaler); + + if (_bgCanvasScaler) + { + il2cpp_class_get_method_from_name_type(_bgCanvasScaler->klass, "set_scaleFactor", 1)->methodPointer(_bgCanvasScaler, 1); + + il2cpp_class_get_method_from_name_type(_bgCanvasScaler->klass, "set_uiScaleMode", 1)->methodPointer(_bgCanvasScaler, 1); + + il2cpp_class_get_method_from_name_type(_bgCanvasScaler->klass, "set_screenMatchMode", 1)->methodPointer(_bgCanvasScaler, 0); + } + } +} + +static void ChangeResizeUIForPC_hook(Il2CppObject* _this, int width, int height) +{ + if (!config::unlock_size && !config::freeform_window) + { + reinterpret_cast(ChangeResizeUIForPC_orig)(_this, width, height); + return; + } + + Il2CppArraySize_t* scalers; + if (Game::CurrentGameRegion == Game::Region::KOR) + { + scalers = UnityEngine::Object::FindObjectsByType( + GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "CanvasScaler"), UnityEngine::FindObjectsInactive::Include, UnityEngine::FindObjectsSortMode::None); + } + else + { + scalers = UnityEngine::Object::FindObjectsOfType(GetRuntimeType("UnityEngine.UI.dll", "UnityEngine.UI", "CanvasScaler"), true); + } + + // auto scalers = UIManager_GetCanvasScalerList(_this); + for (int i = 0; i < scalers->max_length; i++) + { + auto scaler = scalers->vector[i]; + if (scaler) + { + auto gameObject = il2cpp_class_get_method_from_name_type(scaler->klass, "get_gameObject", 0)->methodPointer(scaler); + + bool keepActive = il2cpp_class_get_method_from_name_type(gameObject->klass, "get_activeSelf", 0)->methodPointer(gameObject); + + il2cpp_class_get_method_from_name_type(gameObject->klass, "SetActive", 1)->methodPointer(gameObject, true); + + auto scaleMode = il2cpp_class_get_method_from_name_type(scaler->klass, "get_uiScaleMode", 0)->methodPointer(scaler); + + if (UnityEngine::Object::Name(scaler)->chars == L"SystemCanvas"s || + UnityEngine::Object::Name(scaler)->chars == L"GameCanvas"s || + UnityEngine::Object::Name(scaler)->chars == L"NoImageEffectGameCanvas"s) + { + il2cpp_class_get_method_from_name_type(scaler->klass, "set_uiScaleMode", 1)->methodPointer(scaler, 0); + + scaleMode = 0; + } + + if (config::freeform_window) + { + if (scaleMode == 1) + { + if (width < height) + { + float scale = min(config::freeform_ui_scale_portrait, max(1.0f, height * ratio_vertical) * config::freeform_ui_scale_portrait); + il2cpp_class_get_method_from_name_type(scaler->klass, "set_referenceResolution", 1)->methodPointer(scaler, UnityEngine::Vector2{ static_cast(width / scale), static_cast(height / scale) }); + } + else + { + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, width / ratio_horizontal) * config::freeform_ui_scale_landscape); + il2cpp_class_get_method_from_name_type(scaler->klass, "set_referenceResolution", 1)->methodPointer(scaler, UnityEngine::Vector2{ static_cast(width / scale), static_cast(height / scale) }); + + } + } + + if (scaleMode == 0) + { + if (width < height) + { + float scale = min(config::freeform_ui_scale_portrait, max(1.0f, height * ratio_vertical) * config::freeform_ui_scale_portrait); + il2cpp_class_get_method_from_name_type(scaler->klass, "set_scaleFactor", 1)->methodPointer(scaler, scale); + } + else + { + float scale = min(config::freeform_ui_scale_landscape, max(1.0f, width / ratio_horizontal) * config::freeform_ui_scale_landscape); + il2cpp_class_get_method_from_name_type(scaler->klass, "set_scaleFactor", 1)->methodPointer(scaler, scale); + } + } + } + else + { + if (scaleMode == 1) + { + if (width < height) + { + float scale = min(config::ui_scale, max(1.0f, height * ratio_vertical) * config::ui_scale); + il2cpp_class_get_method_from_name_type(scaler->klass, "set_referenceResolution", 1)->methodPointer(scaler, UnityEngine::Vector2{ static_cast(width / scale), static_cast(height / scale) }); + } + else + { + float scale = min(config::ui_scale, max(1.0f, width / ratio_horizontal) * config::ui_scale); + il2cpp_class_get_method_from_name_type(scaler->klass, "set_referenceResolution", 1)->methodPointer(scaler, UnityEngine::Vector2{ static_cast(width / scale), static_cast(height / scale) }); + } + } + if (scaleMode == 0) + { + // set scale factor to make ui bigger on hi-res screen + if (width < height) + { + float scale = min(config::ui_scale, max(1.0f, height * ratio_vertical) * config::ui_scale); + il2cpp_class_get_method_from_name_type(scaler->klass, "set_scaleFactor", 1)->methodPointer(scaler, scale); + } + else + { + float scale = min(config::ui_scale, max(1.0f, width / ratio_horizontal) * config::ui_scale); + il2cpp_class_get_method_from_name_type(scaler->klass, "set_scaleFactor", 1)->methodPointer(scaler, scale); + } + } + } + + // il2cpp_class_get_method_from_name_type(scaler->klass, "set_uiScaleMode", 1)->methodPointer(scaler, 0); + + // il2cpp_class_get_method_from_name_type(scaler->klass, "set_screenMatchMode", 1)->methodPointer(scaler, 0); + + il2cpp_class_get_method_from_name_type(gameObject->klass, "SetActive", 1)->methodPointer(gameObject, keepActive); + } + } + + if (config::unlock_size || config::freeform_window) + { + SetBGCanvasScalerSize(); + } +} + +static void LockGameCanvas_hook(Il2CppObject* _this) +{ + cout << "LockGameCanvas" << endl; + PrintStackTrace(); +} + +static void UnlockGameCanvas_hook(Il2CppObject* _this) +{ + cout << "UnlockGameCanvas" << endl; + PrintStackTrace(); +} + +static Il2CppObject* WaitResizeUI_hook(Il2CppObject* _this, bool isPortrait, bool isShowOrientationGuide) +{ + cout << "WaitResizeUI_hook" << endl; + PrintStackTrace(); + if (config::freeform_window) + { + auto yield = il2cpp_object_new(il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "WaitWhile")); + il2cpp_class_get_method_from_name_type(yield->klass, ".ctor", 1)->methodPointer(yield, CreateDelegateStatic(*[]() { return false; })); + return yield; + } + return reinterpret_cast(WaitResizeUI_orig)(_this, config::freeform_window ? Gallop::StandaloneWindowResize::IsVirt() : isPortrait, config::ui_loading_show_orientation_guide ? false : isShowOrientationGuide); +} + +static float GetCameraSizeByOrientation_hook(int orientation) +{ + return 5; +} + +static UnityEngine::Vector2 get_DefaultResolution_hook() +{ + int width = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_width", IgnoreNumberOfArguments)(); + int height = il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "Screen", "get_height", IgnoreNumberOfArguments)(); + return UnityEngine::Vector2{ static_cast(width), static_cast(height) }; +} + +static void InitAddress() +{ + ShowNotification_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "ShowNotification", 1); + get_UITexture_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "get_UITexture", 0); + get_CommonHeaderTitle_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "get_CommonHeaderTitle", 0); + SetCameraSizeByOrientation_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "SetCameraSizeByOrientation", 1); + CheckUIToFrameBufferBlitInstance_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "CheckUIToFrameBufferBlitInstance", 0); + AdjustSafeArea_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "AdjustSafeArea", 0); + AdjustMissionClearContentsRootRect_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "AdjustMissionClearContentsRootRect", 0); + AdjustSafeAreaToAnnounceRect_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "AdjustSafeAreaToAnnounceRect", 0); + ReleaseRenderTexture_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "ReleaseRenderTexture", 0); + LockGameCanvas_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "LockGameCanvas", 0); + UnlockGameCanvas_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "UnlockGameCanvas", 0); + WaitResizeUI_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "WaitResizeUI", 2); + GetCanvasScalerList_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "GetCanvasScalerList", 0); + GetCameraSizeByOrientation_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "GetCameraSizeByOrientation", 1); + get_DefaultResolution_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "get_DefaultResolution", 0); +#ifdef _MSC_VER + ChangeResizeUIForPC_addr = il2cpp_symbols::get_method_pointer(ASSEMBLY_NAME, "Gallop", "UIManager", "ChangeResizeUIForPC", 2); +#endif +} + +static void HookMethods() +{ +#ifdef _MSC_VER + if (config::auto_fullscreen || config::unlock_size || config::freeform_window) + { + ADD_HOOK(ChangeResizeUIForPC, "Gallop.UIManager::ChangeResizeUIForPC at %p\n"); + } +#endif + + if (config::freeform_window || config::ui_loading_show_orientation_guide) + { + ADD_HOOK(WaitResizeUI, "Gallop.UIManager::WaitResizeUI at %p\n"); + } + + + if (config::freeform_window) + { + ADD_HOOK(GetCameraSizeByOrientation, "Gallop.UIManager::GetCameraSizeByOrientation at %p\n"); + ADD_HOOK(get_DefaultResolution, "Gallop.UIManager::get_DefaultResolution at %p\n"); + // ADD_HOOK(LockGameCanvas, "Gallop.UIManager::LockGameCanvas at %p\n"); + // ADD_HOOK(UnlockGameCanvas, "Gallop.UIManager::UnlockGameCanvas at %p\n"); + } +} + +STATIC +{ + il2cpp_symbols::init_callbacks.emplace_back(InitAddress); + il2cpp_symbols::init_callbacks.emplace_back(HookMethods); +} + +namespace Gallop +{ + const char* UIManager::namespaze = "Gallop"; + const char* UIManager::klassName = "UIManager"; + + Il2CppObject* UIManager::_noticeCanvas() + { + auto _noticeCanvasField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_noticeCanvas"); + Il2CppObject* _noticeCanvas; + il2cpp_field_get_value(instance, _noticeCanvasField, &_noticeCanvas); + + return _noticeCanvas; + } + + Il2CppObject* UIManager::_bgCamera() + { + auto _bgCameraField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_bgCamera"); + Il2CppObject* _bgCamera; + il2cpp_field_get_value(instance, _bgCameraField, &_bgCamera); + + return _bgCamera; + } + + Il2CppObject* UIManager::_uiCamera() + { + auto _uiCameraField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_uiCamera"); + Il2CppObject* _uiCamera; + il2cpp_field_get_value(instance, _uiCameraField, &_uiCamera); + + return _uiCamera; + } + + Il2CppObject* UIManager::_bgManager() + { + auto _bgManagerField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_bgManager"); + Il2CppObject* _bgManager; + il2cpp_field_get_value(instance, _bgManagerField, &_bgManager); + + return _bgManager; + } + + Il2CppObject* UIManager::_uiToFrameBufferRenderCameraData() + { + auto _uiToFrameBufferRenderCameraDataField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_uiToFrameBufferRenderCameraData"); + if (_uiToFrameBufferRenderCameraDataField) + { + Il2CppObject* _uiToFrameBufferRenderCameraData; + il2cpp_field_get_value(instance, _uiToFrameBufferRenderCameraDataField, &_uiToFrameBufferRenderCameraData); + return _uiToFrameBufferRenderCameraData; + } + return nullptr; + } + + Il2CppObject* UIManager::_uiCommandBuffer() + { + auto _uiCommandBufferField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_uiCommandBuffer"); + Il2CppObject* _uiCommandBuffer; + il2cpp_field_get_value(instance, _uiCommandBufferField, &_uiCommandBuffer); + + return _uiCommandBuffer; + } + + Il2CppObject* UIManager::_blitToFrameMaterial() + { + auto _blitToFrameMaterialField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_blitToFrameMaterial"); + Il2CppObject* _blitToFrameMaterial; + il2cpp_field_get_value(instance, _blitToFrameMaterialField, &_blitToFrameMaterial); + + return _blitToFrameMaterial; + } + + Il2CppObject* UIManager::_noImageEffectUICamera() + { + auto _noImageEffectUICameraField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_noImageEffectUICamera"); + Il2CppObject* _noImageEffectUICamera; + il2cpp_field_get_value(instance, _noImageEffectUICameraField, &_noImageEffectUICamera); + + return _noImageEffectUICamera; + } + + Il2CppObject* UIManager::_noImageEffectCanvas() + { + auto _noImageEffectCanvasField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_noImageEffectCanvas"); + Il2CppObject* _noImageEffectCanvas; + il2cpp_field_get_value(instance, _noImageEffectCanvasField, &_noImageEffectCanvas); + + return _noImageEffectCanvas; + } + + Il2CppObject* UIManager::_uiToFrameBufferBlitCamera() + { + auto _uiToFrameBufferBlitCameraField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_uiToFrameBufferBlitCamera"); + Il2CppObject* _uiToFrameBufferBlitCamera; + il2cpp_field_get_value(instance, _uiToFrameBufferBlitCameraField, &_uiToFrameBufferBlitCamera); + + return _uiToFrameBufferBlitCamera; + } + + Il2CppObject* UIManager::_mainCanvas() + { + auto _mainCanvasField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_mainCanvas"); + Il2CppObject* _mainCanvas; + il2cpp_field_get_value(instance, _mainCanvasField, &_mainCanvas); + + return _mainCanvas; + } + + Il2CppObject* UIManager::UITexture() + { + return reinterpret_cast(get_UITexture_addr)(instance); + } + + void UIManager::UITexture(Il2CppObject* value) + { + auto _uiTextureField = il2cpp_class_get_field_from_name_wrap(instance->klass, "_uiTexture"); + il2cpp_field_set_value(instance, _uiTextureField, value); + } + + Il2CppObject* UIManager::CommonHeaderTitle() + { + return reinterpret_cast(get_CommonHeaderTitle_addr)(instance); + } + + void UIManager::ShowNotification(Il2CppString* text) + { + reinterpret_cast(ShowNotification_addr)(instance, text); + } + + void UIManager::SetCameraSizeByOrientation(UnityEngine::ScreenOrientation orientation) + { + reinterpret_cast(SetCameraSizeByOrientation_addr)(instance, orientation); + } + + void UIManager::CheckUIToFrameBufferBlitInstance() + { + reinterpret_cast(CheckUIToFrameBufferBlitInstance_addr)(instance); + } + + void UIManager::AdjustSafeArea() + { + reinterpret_cast(AdjustSafeArea_addr)(instance); + } + + void UIManager::AdjustMissionClearContentsRootRect() + { + reinterpret_cast(AdjustMissionClearContentsRootRect_addr)(instance); + } + + void UIManager::AdjustSafeAreaToAnnounceRect() + { + reinterpret_cast(AdjustSafeAreaToAnnounceRect_addr)(instance); + } + + void UIManager::ReleaseRenderTexture() + { + reinterpret_cast(ReleaseRenderTexture_addr)(instance); + } + + void UIManager::LockGameCanvas() + { + reinterpret_cast(LockGameCanvas_addr)(instance); + } + + void UIManager::UnlockGameCanvas() + { + reinterpret_cast(UnlockGameCanvas_addr)(instance); + } + + Il2CppObject* UIManager::WaitResizeUI(bool isPortrait, bool isShowOrientationGuide) + { + return reinterpret_cast(WaitResizeUI_addr)(instance, isPortrait, isShowOrientationGuide); + } + + Il2CppArraySize_t* UIManager::GetCanvasScalerList() + { + return reinterpret_cast*(*)(Il2CppObject*)>(GetCanvasScalerList_addr)(instance); + } + + float UIManager::GetCameraSizeByOrientation(ScreenOrientation orientation) + { + return reinterpret_cast(GetCameraSizeByOrientation_addr)(orientation); + } + + UnityEngine::Vector2 UIManager::DefaultResolution() + { + return reinterpret_cast(get_DefaultResolution_addr)(); + } + +#ifdef _MSC_VER + void UIManager::ChangeResizeUIForPC(int width, int height) + { + reinterpret_cast(ChangeResizeUIForPC_addr)(instance, width, height); + } +#endif +} diff --git a/src/scripts/umamusume/Gallop/UIManager.hpp b/src/scripts/umamusume/Gallop/UIManager.hpp new file mode 100644 index 0000000..b53c0c9 --- /dev/null +++ b/src/scripts/umamusume/Gallop/UIManager.hpp @@ -0,0 +1,77 @@ +#pragma once +#include "il2cpp/il2cpp_symbols.hpp" +#include "MonoSingleton.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/ScreenOrientation.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Vector2.hpp" + +using namespace UnityEngine; + +namespace Gallop +{ + class UIManager : public MonoSingleton + { + public: + Il2CppObject* _noticeCanvas(); + + Il2CppObject* _bgCamera(); + + Il2CppObject* _uiCamera(); + + Il2CppObject* _bgManager(); + + Il2CppObject* _uiToFrameBufferRenderCameraData(); + + Il2CppObject* _uiCommandBuffer(); + + Il2CppObject* _blitToFrameMaterial(); + + Il2CppObject* _noImageEffectUICamera(); + + Il2CppObject* _noImageEffectCanvas(); + + Il2CppObject* _uiToFrameBufferBlitCamera(); + + Il2CppObject* _mainCanvas(); + + Il2CppObject* UITexture(); + + Il2CppObject* CommonHeaderTitle(); + + void UITexture(Il2CppObject* value); + + void ShowNotification(Il2CppString*); + + void SetCameraSizeByOrientation(ScreenOrientation orientation); + + void CheckUIToFrameBufferBlitInstance(); + + void AdjustSafeArea(); + + void AdjustMissionClearContentsRootRect(); + + void AdjustSafeAreaToAnnounceRect(); + + void ReleaseRenderTexture(); + + void LockGameCanvas(); + + void UnlockGameCanvas(); + + Il2CppObject* WaitResizeUI(bool isPortrait, bool isShowOrientationGuide = false); + + Il2CppArraySize_t* GetCanvasScalerList(); + + static float GetCameraSizeByOrientation(ScreenOrientation orientation); + + static Vector2 DefaultResolution(); + +#ifdef _MSC_VER + void ChangeResizeUIForPC(int width, int height); +#endif + + using MonoSingleton::MonoSingleton; + + static const char* namespaze; + static const char* klassName; + }; +} diff --git a/src/scripts/umamusume/Gallop/UserChara.cpp b/src/scripts/umamusume/Gallop/UserChara.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/UserChara.hpp b/src/scripts/umamusume/Gallop/UserChara.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/WorkDataManager.cpp b/src/scripts/umamusume/Gallop/WorkDataManager.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/Gallop/WorkDataManager.hpp b/src/scripts/umamusume/Gallop/WorkDataManager.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/UncheaterInit.cpp b/src/scripts/umamusume/UncheaterInit.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/UncheaterInit.hpp b/src/scripts/umamusume/UncheaterInit.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/umamusume/umamusume.hpp b/src/scripts/umamusume/umamusume.hpp new file mode 100644 index 0000000..5bf5f59 --- /dev/null +++ b/src/scripts/umamusume/umamusume.hpp @@ -0,0 +1,2 @@ +#pragma once +#define ASSEMBLY_NAME "umamusume.dll" diff --git a/src/scripts/uncheatercsd/Uncheater/SystemBins64.cpp b/src/scripts/uncheatercsd/Uncheater/SystemBins64.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/uncheatercsd/Uncheater/SystemBins64.hpp b/src/scripts/uncheatercsd/Uncheater/SystemBins64.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/scripts/uncheatercsd/uncheatercsd.hpp b/src/scripts/uncheatercsd/uncheatercsd.hpp new file mode 100644 index 0000000..e69de29 diff --git a/src/settings_text.hpp b/src/settings_text.hpp index daf2854..1c9a10a 100644 --- a/src/settings_text.hpp +++ b/src/settings_text.hpp @@ -123,6 +123,11 @@ namespace LocalifySettings return isKor ? L"라이브 시어터 전체 해방" : L"ライブシアター全体解放"; } + if (id == "live_slider_always_show") + { + return isKor ? L"재생 슬라이더 항상 표시" : L"プレイスライダーを常に表示"; + } + if (id == "unlock_live_chara_info") { return isKor ? L"미해금/미해방/미공개 곡 및 우마무스메와 드레스를 사용 가능하게 변경합니다." : L"未解禁/未解放/未公開曲及びウマ娘とドレスを使えるように変更します。"; diff --git a/src/smtc/SystemMediaTransportControlsManager.hpp b/src/smtc/SystemMediaTransportControlsManager.hpp index 9a18f19..912391a 100644 --- a/src/smtc/SystemMediaTransportControlsManager.hpp +++ b/src/smtc/SystemMediaTransportControlsManager.hpp @@ -21,9 +21,10 @@ #include "il2cpp/il2cpp_symbols.hpp" #include "il2cpp/il2cpp-api-functions.hpp" -#include "local/local.hpp" +#include "string_utils.hpp" #include "masterdb/masterdb.hpp" +#include "scripts/UnityEngine.CoreModule/UnityEngine/Rect.hpp" using namespace std; @@ -117,11 +118,11 @@ namespace SystemMediaTransportControlsManager auto props = updater.MusicProperties(); - props.Title(local::u8_wide(MasterDB::GetTextData(16, music_id))); + props.Title(u8_wide(MasterDB::GetTextData(16, music_id))); auto artist = MasterDB::GetTextData(17, music_id); replaceAll(artist, "\\n", ", "); - props.Artist(local::u8_wide(artist)); + props.Artist(u8_wide(artist)); if (updater.Thumbnail()) { @@ -170,7 +171,7 @@ namespace SystemMediaTransportControlsManager auto readableTexture = il2cpp_object_new(il2cpp_symbols::get_class("UnityEngine.CoreModule.dll", "UnityEngine", "Texture2D")); il2cpp_class_get_method_from_name_type(readableTexture->klass, ".ctor", 2)->methodPointer(readableTexture, width, height); - il2cpp_class_get_method_from_name_type(readableTexture->klass, "ReadPixels", 3)->methodPointer(readableTexture, Rect_t{ 0, 0, static_cast(width), static_cast(height) }, 0, 0); + il2cpp_class_get_method_from_name_type(readableTexture->klass, "ReadPixels", 3)->methodPointer(readableTexture, UnityEngine::Rect{ 0, 0, static_cast(width), static_cast(height) }, 0, 0); il2cpp_class_get_method_from_name_type(readableTexture->klass, "Apply", 0)->methodPointer(readableTexture); il2cpp_symbols::get_method_pointer("UnityEngine.CoreModule.dll", "UnityEngine", "RenderTexture", "set_active", 1)(previous); diff --git a/src/string_utils.hpp b/src/string_utils.hpp new file mode 100644 index 0000000..b426667 --- /dev/null +++ b/src/string_utils.hpp @@ -0,0 +1,75 @@ +#pragma once +#include +#include + +#ifdef _MSC_VER +#include +#endif + +using namespace std; + +inline string wide_u8(const wstring& wstr) +{ +#ifdef _MSC_VER + string result; + result.resize(wstr.length() * 4); + + int len = WideCharToMultiByte(CP_UTF8, 0, wstr.data(), wstr.length(), result.data(), result.length(), nullptr, nullptr); + + result.resize(len); + + return result; +#else + wstring_convert, wchar_t> utf8conv; + return utf8conv.to_bytes(wstr); +#endif +} + +inline string u16_u8(const u16string& str) +{ + wstring_convert, char16_t> utf16conv; + return utf16conv.to_bytes(str); +} + +inline wstring u8_wide(const string& str) +{ +#ifdef _MSC_VER + wstring result; + result.resize(str.length() * 4); + + int len = MultiByteToWideChar(CP_UTF8, 0, str.data(), str.length(), result.data(), result.length()); + + result.resize(len); + + return result; +#else + wstring_convert, wchar_t> wconv; + return wconv.from_bytes(str); +#endif +} + +#ifdef _MSC_VER +inline string wide_acp(const wstring& str) +{ + string result; + result.resize(str.length() * 4); + + int len = WideCharToMultiByte(CP_ACP, 0, str.data(), str.length(), result.data(), result.length(), nullptr, nullptr); + + result.resize(len); + + return result; +} + +inline wstring acp_wide(const string& str) +{ + wstring result; + result.resize(str.length() * 4); + + int len = MultiByteToWideChar(CP_ACP, 0, str.data(), str.length(), result.data(), result.length()); + + result.resize(len); + + return result; +} +#endif