From 4b96e13752db183c101f140e3793755d54890f47 Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sun, 29 May 2016 09:24:52 +0100 Subject: [PATCH] HLE: Move faked HLE timing from Reschedule to CallSVC --- src/core/hle/hle.cpp | 6 ------ src/core/hle/svc.cpp | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index 5c5373517..75b23a168 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp @@ -23,12 +23,6 @@ namespace HLE { void Reschedule(const char *reason) { DEBUG_ASSERT_MSG(reason != nullptr && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); - // TODO(bunnei): It seems that games depend on some CPU execution time elapsing during HLE - // routines. This simulates that time by artificially advancing the number of CPU "ticks". - // The value was chosen empirically, it seems to work well enough for everything tested, but - // is likely not ideal. We should find a more accurate way to simulate timing with HLE. - Core::g_app_core->AddTicks(4000); - Core::g_app_core->PrepareReschedule(); reschedule = true; diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 0ce72de87..267232f5f 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -1081,6 +1081,14 @@ MICROPROFILE_DEFINE(Kernel_SVC, "Kernel", "SVC", MP_RGB(70, 200, 70)); void CallSVC(u32 immediate) { MICROPROFILE_SCOPE(Kernel_SVC); + // TODO(bunnei): It seems that games depend on some CPU execution time elapsing during HLE + // routines. This simulates that time by artificially advancing the number of CPU "ticks". + // The value was chosen empirically, it seems to work well enough for everything tested, but + // is likely not ideal. We should find a more accurate way to simulate timing with HLE. + // NOTE(merry): This is performed before service functions are called and not during or after + // because the thread-state is well defined at this point in time. (See #1837, #1854, #1868.) + Core::g_app_core->AddTicks(4000); + const FunctionDef* info = GetSVCInfo(immediate); if (info) { if (info->func) {