MCPcopy Create free account
hub / github.com/SpecialKO/SpecialK / SK_Unity_SetInputPollingFreq

Function SK_Unity_SetInputPollingFreq

src/plugins/unity.cpp:1668–1694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1666 return *(_T *)unboxed;
1667 }
1668 }
1669
1670 return
1671 std::nullopt;
1672}
1673
1674void
1675SK_Unity_SetInputPollingFreq (float PollingHz)
1676{
1677#ifdef HAVE_WORKING_INPUT_POLLING_FREQ
1678 if (std::exchange (SK_Unity_InputPollingFrequency, PollingHz) == PollingHz)
1679 return;
1680
1681 AttachThread ();
1682
1683 auto NativeInputRuntime_instance =
1684 GetStaticFieldValue ("NativeInputRuntime", "instance", "Unity.InputSystem", "UnityEngine.InputSystem.LowLevel");
1685
1686 if (NativeInputRuntime_instance != nullptr)
1687 {
1688 void* params [1] = { &PollingHz };
1689
1690 SK_LOGi0 (L"Setting Input Polling Hz: %f", PollingHz);
1691
1692 InvokeMethod ("UnityEngine.InputSystem.LowLevel", "NativeInputRuntime", "set_pollingFrequency", 1, NativeInputRuntime_instance, "Unity.InputSystem", params);
1693 }
1694
1695 // We don't want garbage collection overhead on this thread just because we called a function once!
1696 DetachCurrentThreadIfNotNative ();
1697#else

Callers 1

SK_Unity_EndFrameFunction · 0.85

Calls 5

AttachThreadFunction · 0.70
GetStaticFieldValueFunction · 0.70
InvokeMethodFunction · 0.70
exchangeFunction · 0.50

Tested by

no test coverage detected