summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-06-06 00:06:33 -0400
committerGravatar bunnei2014-06-13 09:51:09 -0400
commit0deeda54eefb18aaf6a62b8ec139cfe9bd21769c (patch)
tree8c39407c4f6b9fa711dd8f525ca0efe5c2682f87 /src/core/core.cpp
parentCore: Changed HW update/thread reschedule to occur more frequently (assume ea... (diff)
downloadyuzu-0deeda54eefb18aaf6a62b8ec139cfe9bd21769c.tar.gz
yuzu-0deeda54eefb18aaf6a62b8ec139cfe9bd21769c.tar.xz
yuzu-0deeda54eefb18aaf6a62b8ec139cfe9bd21769c.zip
Core: Cleaned up SingleStep(), updated default LCD refresh to assume each instruction is ~3 cycles
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 6ec25fdd4..26d52f7be 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -18,14 +18,15 @@
18 18
19namespace Core { 19namespace Core {
20 20
21ARM_Disasm* g_disasm = NULL; ///< ARM disassembler 21u64 g_last_ticks = 0; ///< Last CPU ticks
22ARM_Interface* g_app_core = NULL; ///< ARM11 application core 22ARM_Disasm* g_disasm = NULL; ///< ARM disassembler
23ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core 23ARM_Interface* g_app_core = NULL; ///< ARM11 application core
24ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core
24 25
25/// Run the core CPU loop 26/// Run the core CPU loop
26void RunLoop() { 27void RunLoop() {
27 for (;;){ 28 for (;;){
28 g_app_core->Run(LCD::kFrameTicks / 3); 29 g_app_core->Run(LCD::kFrameTicks);
29 HW::Update(); 30 HW::Update();
30 Kernel::Reschedule(); 31 Kernel::Reschedule();
31 } 32 }
@@ -33,16 +34,14 @@ void RunLoop() {
33 34
34/// Step the CPU one instruction 35/// Step the CPU one instruction
35void SingleStep() { 36void SingleStep() {
36 static int ticks = 0;
37
38 g_app_core->Step(); 37 g_app_core->Step();
39 38
40 if ((ticks >= LCD::kFrameTicks / 3) || HLE::g_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) >= LCD::kFrameTicks || HLE::g_reschedule) {
42 g_last_ticks = current_ticks;
41 HW::Update(); 43 HW::Update();
42 Kernel::Reschedule(); 44 Kernel::Reschedule();
43 ticks = 0;
44 } else {
45 ticks++;
46 } 45 }
47} 46}
48 47
@@ -64,6 +63,8 @@ int Init() {
64 g_app_core = new ARM_Interpreter(); 63 g_app_core = new ARM_Interpreter();
65 g_sys_core = new ARM_Interpreter(); 64 g_sys_core = new ARM_Interpreter();
66 65
66 g_last_ticks = Core::g_app_core->GetTicks();
67
67 return 0; 68 return 0;
68} 69}
69 70