Skip to content

Commit

Permalink
padscore: Invoke sampling callbacks every 5ms
Browse files Browse the repository at this point in the history
This fixes high input latency in games like Pokemon Rumble U which update input via the sampling callbacks
  • Loading branch information
Exzap committed Aug 15, 2024
1 parent b0bab27 commit 2843da4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Cafe/OS/libs/padscore/padscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,8 @@ namespace padscore
// call sampling callback
for (auto i = 0; i < InputManager::kMaxWPADControllers; ++i)
{
if (g_padscore.controller_data[i].sampling_callback) {
if (g_padscore.controller_data[i].sampling_callback)
{
if (const auto controller = instance.get_wpad_controller(i))
{
cemuLog_log(LogType::InputAPI, "Calling WPADsamplingCallback({})", i);
Expand All @@ -761,7 +762,7 @@ namespace padscore
{
OSCreateAlarm(&g_padscore.alarm);
const uint64 start_tick = coreinit::coreinit_getOSTime();
const uint64 period_tick = coreinit::EspressoTime::GetTimerClock(); // once a second
const uint64 period_tick = coreinit::EspressoTime::GetTimerClock() / 200; // every 5ms
MPTR handler = PPCInterpreter_makeCallableExportDepr(TickFunction);
OSSetPeriodicAlarm(&g_padscore.alarm, start_tick, period_tick, handler);
}
Expand Down

0 comments on commit 2843da4

Please sign in to comment.