From 4fc8b8229ed1d9ea9d20faee7059c898265db6cf Mon Sep 17 00:00:00 2001
From: bunnei <bunneidev@gmail.com>
Date: Fri, 16 Dec 2016 00:37:38 -0500
Subject: core: Remove HLE module, consolidate code & various cleanups.

---
 src/core/core.cpp | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

(limited to 'src/core/core.cpp')

diff --git a/src/core/core.cpp b/src/core/core.cpp
index b4df90efd4..67d7cf7b26 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -12,10 +12,10 @@
 #include "core/core.h"
 #include "core/core_timing.h"
 #include "core/gdbstub/gdbstub.h"
-#include "core/hle/hle.h"
 #include "core/hle/kernel/kernel.h"
 #include "core/hle/kernel/memory.h"
 #include "core/hle/kernel/thread.h"
+#include "core/hle/service/service.h"
 #include "core/hw/hw.h"
 #include "core/loader/loader.h"
 #include "core/settings.h"
@@ -51,15 +51,13 @@ System::ResultStatus System::RunLoop(int tight_loop) {
         LOG_TRACE(Core_ARM11, "Idling");
         CoreTiming::Idle();
         CoreTiming::Advance();
-        HLE::Reschedule(__func__);
+        PrepareReschedule();
     } else {
         app_core->Run(tight_loop);
     }
 
     HW::Update();
-    if (HLE::IsReschedulePending()) {
-        Kernel::Reschedule();
-    }
+    Reschedule();
 
     return ResultStatus::Success;
 }
@@ -110,6 +108,20 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
     return ResultStatus::Success;
 }
 
+void System::PrepareReschedule() {
+    app_core->PrepareReschedule();
+    reschedule_pending = true;
+}
+
+void System::Reschedule() {
+    if (!reschedule_pending) {
+        return;
+    }
+
+    reschedule_pending = false;
+    Kernel::Reschedule();
+}
+
 System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
     if (app_core) {
         app_core.reset();
@@ -126,7 +138,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
     CoreTiming::Init();
     HW::Init();
     Kernel::Init(system_mode);
-    HLE::Init();
+    Service::Init();
     AudioCore::Init();
     GDBStub::Init();
 
@@ -143,7 +155,7 @@ void System::Shutdown() {
     GDBStub::Shutdown();
     AudioCore::Shutdown();
     VideoCore::Shutdown();
-    HLE::Shutdown();
+    Service::Shutdown();
     Kernel::Shutdown();
     HW::Shutdown();
     CoreTiming::Shutdown();
-- 
cgit v1.2.3-70-g09d2