diff options
| author | 2014-06-06 00:06:33 -0400 | |
|---|---|---|
| committer | 2014-06-13 09:51:09 -0400 | |
| commit | 0deeda54eefb18aaf6a62b8ec139cfe9bd21769c (patch) | |
| tree | 8c39407c4f6b9fa711dd8f525ca0efe5c2682f87 /src/core/core.cpp | |
| parent | Core: Changed HW update/thread reschedule to occur more frequently (assume ea... (diff) | |
| download | yuzu-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.cpp | 23 |
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 | ||
| 19 | namespace Core { | 19 | namespace Core { |
| 20 | 20 | ||
| 21 | ARM_Disasm* g_disasm = NULL; ///< ARM disassembler | 21 | u64 g_last_ticks = 0; ///< Last CPU ticks |
| 22 | ARM_Interface* g_app_core = NULL; ///< ARM11 application core | 22 | ARM_Disasm* g_disasm = NULL; ///< ARM disassembler |
| 23 | ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core | 23 | ARM_Interface* g_app_core = NULL; ///< ARM11 application core |
| 24 | ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core | ||
| 24 | 25 | ||
| 25 | /// Run the core CPU loop | 26 | /// Run the core CPU loop |
| 26 | void RunLoop() { | 27 | void 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 |
| 35 | void SingleStep() { | 36 | void 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 | ||