summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp15
1 files changed, 9 insertions, 6 deletions
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}