summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-06-14 12:13:16 -0400
committerGravatar bunnei2014-06-14 12:13:16 -0400
commit004df767953a949817da89bddcd5d1379240f769 (patch)
treeb2d54928dcbf3cb4dde0cd5d3277afe7999b7bd9 /src/core/core.cpp
parentGPU debugger: Const correctness and build fix. (diff)
parentKernel: Removed unnecessary "#pragma once". (diff)
downloadyuzu-004df767953a949817da89bddcd5d1379240f769.tar.gz
yuzu-004df767953a949817da89bddcd5d1379240f769.tar.xz
yuzu-004df767953a949817da89bddcd5d1379240f769.zip
Merge branch 'threading' of https://github.com/bunnei/citra
Conflicts: src/core/hle/function_wrappers.h src/core/hle/service/gsp.cpp
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index f88bcd704..7dc0809d0 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -9,21 +9,24 @@
9#include "core/core.h" 9#include "core/core.h"
10#include "core/mem_map.h" 10#include "core/mem_map.h"
11#include "core/hw/hw.h" 11#include "core/hw/hw.h"
12#include "core/hw/gpu.h"
12#include "core/arm/disassembler/arm_disasm.h" 13#include "core/arm/disassembler/arm_disasm.h"
13#include "core/arm/interpreter/arm_interpreter.h" 14#include "core/arm/interpreter/arm_interpreter.h"
14 15
16#include "core/hle/hle.h"
15#include "core/hle/kernel/thread.h" 17#include "core/hle/kernel/thread.h"
16 18
17namespace Core { 19namespace Core {
18 20
19ARM_Disasm* g_disasm = NULL; ///< ARM disassembler 21u64 g_last_ticks = 0; ///< Last CPU ticks
20ARM_Interface* g_app_core = NULL; ///< ARM11 application core 22ARM_Disasm* g_disasm = nullptr; ///< ARM disassembler
21ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core 23ARM_Interface* g_app_core = nullptr; ///< ARM11 application core
24ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core
22 25
23/// Run the core CPU loop 26/// Run the core CPU loop
24void RunLoop() { 27void RunLoop() {
25 for (;;){ 28 for (;;){
26 g_app_core->Run(100); 29 g_app_core->Run(GPU::kFrameTicks);
27 HW::Update(); 30 HW::Update();
28 Kernel::Reschedule(); 31 Kernel::Reschedule();
29 } 32 }
@@ -32,8 +35,14 @@ void RunLoop() {
32/// Step the CPU one instruction 35/// Step the CPU one instruction
33void SingleStep() { 36void SingleStep() {
34 g_app_core->Step(); 37 g_app_core->Step();
35 HW::Update(); 38
36 Kernel::Reschedule(); 39 // Update and reschedule after approx. 1 frame
40 u64 current_ticks = Core::g_app_core->GetTicks();
41 if ((current_ticks - g_last_ticks) >= GPU::kFrameTicks || HLE::g_reschedule) {
42 g_last_ticks = current_ticks;
43 HW::Update();
44 Kernel::Reschedule();
45 }
37} 46}
38 47
39/// Halt the core 48/// Halt the core
@@ -54,6 +63,8 @@ int Init() {
54 g_app_core = new ARM_Interpreter(); 63 g_app_core = new ARM_Interpreter();
55 g_sys_core = new ARM_Interpreter(); 64 g_sys_core = new ARM_Interpreter();
56 65
66 g_last_ticks = Core::g_app_core->GetTicks();
67
57 return 0; 68 return 0;
58} 69}
59 70