summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/debugger/callstack.cpp12
-rw-r--r--src/citra_qt/debugger/registers.cpp8
-rw-r--r--src/core/core.cpp15
-rw-r--r--src/core/core.h5
4 files changed, 20 insertions, 20 deletions
diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp
index d45eed179..793944639 100644
--- a/src/citra_qt/debugger/callstack.cpp
+++ b/src/citra_qt/debugger/callstack.cpp
@@ -29,18 +29,16 @@ CallstackWidget::CallstackWidget(QWidget* parent): QDockWidget(parent)
29 29
30void CallstackWidget::OnDebugModeEntered() 30void CallstackWidget::OnDebugModeEntered()
31{ 31{
32 ARM_Interface* app_core = Core::g_app_core; 32 // Stack pointer
33 33 const u32 sp = Core::g_app_core->GetReg(13);
34 u32 sp = app_core->GetReg(13); //stack pointer
35 u32 ret_addr, call_addr, func_addr;
36 34
37 Clear(); 35 Clear();
38 36
39 int counter = 0; 37 int counter = 0;
40 for (u32 addr = 0x10000000; addr >= sp; addr -= 4) 38 for (u32 addr = 0x10000000; addr >= sp; addr -= 4)
41 { 39 {
42 ret_addr = Memory::Read32(addr); 40 const u32 ret_addr = Memory::Read32(addr);
43 call_addr = ret_addr - 4; //get call address??? 41 const u32 call_addr = ret_addr - 4; //get call address???
44 42
45 if (Memory::GetPointer(call_addr) == nullptr) 43 if (Memory::GetPointer(call_addr) == nullptr)
46 break; 44 break;
@@ -60,7 +58,7 @@ void CallstackWidget::OnDebugModeEntered()
60 // Pre-compute the left-shift and the prefetch offset 58 // Pre-compute the left-shift and the prefetch offset
61 i_offset <<= 2; 59 i_offset <<= 2;
62 i_offset += 8; 60 i_offset += 8;
63 func_addr = call_addr + i_offset; 61 const u32 func_addr = call_addr + i_offset;
64 62
65 callstack_model->setItem(counter, 0, new QStandardItem(QString("0x%1").arg(addr, 8, 16, QLatin1Char('0')))); 63 callstack_model->setItem(counter, 0, new QStandardItem(QString("0x%1").arg(addr, 8, 16, QLatin1Char('0'))));
66 callstack_model->setItem(counter, 1, new QStandardItem(QString("0x%1").arg(ret_addr, 8, 16, QLatin1Char('0')))); 64 callstack_model->setItem(counter, 1, new QStandardItem(QString("0x%1").arg(ret_addr, 8, 16, QLatin1Char('0'))));
diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp
index 6100d67c5..1bd0bfebc 100644
--- a/src/citra_qt/debugger/registers.cpp
+++ b/src/citra_qt/debugger/registers.cpp
@@ -59,16 +59,14 @@ RegistersWidget::RegistersWidget(QWidget* parent) : QDockWidget(parent) {
59} 59}
60 60
61void RegistersWidget::OnDebugModeEntered() { 61void RegistersWidget::OnDebugModeEntered() {
62 ARM_Interface* app_core = Core::g_app_core; 62 if (!Core::g_app_core)
63
64 if (app_core == nullptr)
65 return; 63 return;
66 64
67 for (int i = 0; i < core_registers->childCount(); ++i) 65 for (int i = 0; i < core_registers->childCount(); ++i)
68 core_registers->child(i)->setText(1, QString("0x%1").arg(app_core->GetReg(i), 8, 16, QLatin1Char('0'))); 66 core_registers->child(i)->setText(1, QString("0x%1").arg(Core::g_app_core->GetReg(i), 8, 16, QLatin1Char('0')));
69 67
70 for (int i = 0; i < vfp_registers->childCount(); ++i) 68 for (int i = 0; i < vfp_registers->childCount(); ++i)
71 vfp_registers->child(i)->setText(1, QString("0x%1").arg(app_core->GetVFPReg(i), 8, 16, QLatin1Char('0'))); 69 vfp_registers->child(i)->setText(1, QString("0x%1").arg(Core::g_app_core->GetVFPReg(i), 8, 16, QLatin1Char('0')));
72 70
73 UpdateCPSRValues(); 71 UpdateCPSRValues();
74 UpdateVFPSystemRegisterValues(); 72 UpdateVFPSystemRegisterValues();
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 219b03af4..453c7162d 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -2,6 +2,9 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <memory>
6
7#include "common/make_unique.h"
5#include "common/logging/log.h" 8#include "common/logging/log.h"
6 9
7#include "core/core.h" 10#include "core/core.h"
@@ -17,8 +20,8 @@
17 20
18namespace Core { 21namespace Core {
19 22
20ARM_Interface* g_app_core = nullptr; ///< ARM11 application core 23std::unique_ptr<ARM_Interface> g_app_core; ///< ARM11 application core
21ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core 24std::unique_ptr<ARM_Interface> g_sys_core; ///< ARM11 system (OS) core
22 25
23/// Run the core CPU loop 26/// Run the core CPU loop
24void RunLoop(int tight_loop) { 27void RunLoop(int tight_loop) {
@@ -71,16 +74,16 @@ void Stop() {
71 74
72/// Initialize the core 75/// Initialize the core
73int Init() { 76int Init() {
74 g_sys_core = new ARM_DynCom(USER32MODE); 77 g_sys_core = Common::make_unique<ARM_DynCom>(USER32MODE);
75 g_app_core = new ARM_DynCom(USER32MODE); 78 g_app_core = Common::make_unique<ARM_DynCom>(USER32MODE);
76 79
77 LOG_DEBUG(Core, "Initialized OK"); 80 LOG_DEBUG(Core, "Initialized OK");
78 return 0; 81 return 0;
79} 82}
80 83
81void Shutdown() { 84void Shutdown() {
82 delete g_app_core; 85 g_app_core.reset();
83 delete g_sys_core; 86 g_sys_core.reset();
84 87
85 LOG_DEBUG(Core, "Shutdown OK"); 88 LOG_DEBUG(Core, "Shutdown OK");
86} 89}
diff --git a/src/core/core.h b/src/core/core.h
index 491230a74..453e0a5f0 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -4,6 +4,7 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <memory>
7#include "common/common_types.h" 8#include "common/common_types.h"
8 9
9class ARM_Interface; 10class ARM_Interface;
@@ -23,8 +24,8 @@ struct ThreadContext {
23 u32 fpexc; 24 u32 fpexc;
24}; 25};
25 26
26extern ARM_Interface* g_app_core; ///< ARM11 application core 27extern std::unique_ptr<ARM_Interface> g_app_core; ///< ARM11 application core
27extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core 28extern std::unique_ptr<ARM_Interface> g_sys_core; ///< ARM11 system (OS) core
28 29
29//////////////////////////////////////////////////////////////////////////////////////////////////// 30////////////////////////////////////////////////////////////////////////////////////////////////////
30 31