diff options
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/core.cpp | 15 | ||||
| -rw-r--r-- | src/core/core.h | 5 |
2 files changed, 12 insertions, 8 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 | ||
| 18 | namespace Core { | 21 | namespace Core { |
| 19 | 22 | ||
| 20 | ARM_Interface* g_app_core = nullptr; ///< ARM11 application core | 23 | std::unique_ptr<ARM_Interface> g_app_core; ///< ARM11 application core |
| 21 | ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core | 24 | std::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 |
| 24 | void RunLoop(int tight_loop) { | 27 | void RunLoop(int tight_loop) { |
| @@ -71,16 +74,16 @@ void Stop() { | |||
| 71 | 74 | ||
| 72 | /// Initialize the core | 75 | /// Initialize the core |
| 73 | int Init() { | 76 | int 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 | ||
| 81 | void Shutdown() { | 84 | void 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 | ||
| 9 | class ARM_Interface; | 10 | class ARM_Interface; |
| @@ -23,8 +24,8 @@ struct ThreadContext { | |||
| 23 | u32 fpexc; | 24 | u32 fpexc; |
| 24 | }; | 25 | }; |
| 25 | 26 | ||
| 26 | extern ARM_Interface* g_app_core; ///< ARM11 application core | 27 | extern std::unique_ptr<ARM_Interface> g_app_core; ///< ARM11 application core |
| 27 | extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core | 28 | extern std::unique_ptr<ARM_Interface> g_sys_core; ///< ARM11 system (OS) core |
| 28 | 29 | ||
| 29 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 30 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 30 | 31 | ||