Skip to content

Commit

Permalink
修复FPSHOOK&默认不启用垂直同步&刷新率>90时帧数默认解锁到90
Browse files Browse the repository at this point in the history
  • Loading branch information
EtherealAO committed Oct 31, 2022
1 parent c22c12f commit c90c73e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 4 additions & 6 deletions ura-core/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace
return reinterpret_cast<decltype(set_fps_hook)*>(set_fps_orig)(g_max_fps);
}

void set_vSyncCount_hook(int value)
void set_vSyncCount_hook(int value)
{
return reinterpret_cast<decltype(set_vSyncCount_hook)*>(set_vSyncCount_orig)(g_vertical_sync_count);
}
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
}
}
Expand Down
5 changes: 4 additions & 1 deletion ura-core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c90c73e

Please sign in to comment.