diff --git a/ura-core/hook.cpp b/ura-core/hook.cpp index 0aced01..0ae8795 100644 --- a/ura-core/hook.cpp +++ b/ura-core/hook.cpp @@ -37,7 +37,7 @@ namespace return reinterpret_cast(set_fps_orig)(g_max_fps); } - void set_vSyncCount_hook(int value) + void set_vSyncCount_hook(int value) { return reinterpret_cast(set_vSyncCount_orig)(g_vertical_sync_count); } @@ -130,10 +130,7 @@ namespace #pragma endregion #pragma region HOOK_ADDRESSES - auto set_fps_addr = il2cpp_symbols::get_method_pointer( - "UnityEngine.CoreModule.dll", "UnityEngine", - "Application", "set_targetFrameRate", 1 - ); + auto set_fps_addr = il2cpp_resolve_icall("UnityEngine.Application::set_targetFrameRate(System.Int32)"); auto set_vSyncCount_addr = il2cpp_symbols::get_method_pointer( "UnityEngine.CoreModule.dll", "UnityEngine", @@ -174,7 +171,8 @@ namespace ADD_HOOK(get_DatabaseSavePath, "get_DatabaseSavePath at %p\n"); ADD_HOOK(GetMasterdataDirectory, "GetMasterdataDirectory at %p\n"); } - set_vSyncCount_hook(g_vertical_sync_count); + if (g_vertical_sync_count != 0) + set_vSyncCount_hook(g_vertical_sync_count); return true; } } diff --git a/ura-core/main.cpp b/ura-core/main.cpp index 0f0f8df..cd6ec87 100644 --- a/ura-core/main.cpp +++ b/ura-core/main.cpp @@ -10,7 +10,7 @@ extern void uninit_hook(); bool compatible_mode = false; int g_max_fps = -1; -int g_vertical_sync_count = 1; +int g_vertical_sync_count = 0; bool g_skip_single_instance_check = true; std::string g_notifier_host = "http://127.0.0.1:4693"; std::string g_savedata_path = ""; @@ -39,6 +39,9 @@ namespace monitor.dmSize = sizeof(DEVMODE); EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &monitor); g_max_fps = monitor.dmDisplayFrequency; + //´óÓÚ90»á±¨´í + if (g_max_fps > 90) + g_max_fps = 90; } if (document.HasMember("notifier_host")) g_notifier_host = document["notifier_host"].GetString();