diff options
author | bunnei <bunneidev@gmail.com> | 2015-12-30 04:34:32 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-12-30 04:34:32 +0100 |
commit | 8a24214b46cf86349528e9c1d79a970a5a0ad1a4 (patch) | |
tree | 7f8b3ed355becf4d26ad1ee87fd91b7d845d8d7a /src/core | |
parent | Merge pull request #1305 from lioncash/override (diff) | |
parent | core: Use unique_ptr for holding the interpreter instances (diff) | |
download | yuzu-8a24214b46cf86349528e9c1d79a970a5a0ad1a4.tar yuzu-8a24214b46cf86349528e9c1d79a970a5a0ad1a4.tar.gz yuzu-8a24214b46cf86349528e9c1d79a970a5a0ad1a4.tar.bz2 yuzu-8a24214b46cf86349528e9c1d79a970a5a0ad1a4.tar.lz yuzu-8a24214b46cf86349528e9c1d79a970a5a0ad1a4.tar.xz yuzu-8a24214b46cf86349528e9c1d79a970a5a0ad1a4.tar.zst yuzu-8a24214b46cf86349528e9c1d79a970a5a0ad1a4.zip |
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 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include <memory> + +#include "common/make_unique.h" #include "common/logging/log.h" #include "core/core.h" @@ -17,8 +20,8 @@ namespace Core { -ARM_Interface* g_app_core = nullptr; ///< ARM11 application core -ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core +std::unique_ptr<ARM_Interface> g_app_core; ///< ARM11 application core +std::unique_ptr<ARM_Interface> g_sys_core; ///< ARM11 system (OS) core /// Run the core CPU loop void RunLoop(int tight_loop) { @@ -71,16 +74,16 @@ void Stop() { /// Initialize the core int Init() { - g_sys_core = new ARM_DynCom(USER32MODE); - g_app_core = new ARM_DynCom(USER32MODE); + g_sys_core = Common::make_unique<ARM_DynCom>(USER32MODE); + g_app_core = Common::make_unique<ARM_DynCom>(USER32MODE); LOG_DEBUG(Core, "Initialized OK"); return 0; } void Shutdown() { - delete g_app_core; - delete g_sys_core; + g_app_core.reset(); + g_sys_core.reset(); LOG_DEBUG(Core, "Shutdown OK"); } 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 @@ #pragma once +#include <memory> #include "common/common_types.h" class ARM_Interface; @@ -23,8 +24,8 @@ struct ThreadContext { u32 fpexc; }; -extern ARM_Interface* g_app_core; ///< ARM11 application core -extern ARM_Interface* g_sys_core; ///< ARM11 system (OS) core +extern std::unique_ptr<ARM_Interface> g_app_core; ///< ARM11 application core +extern std::unique_ptr<ARM_Interface> g_sys_core; ///< ARM11 system (OS) core //////////////////////////////////////////////////////////////////////////////////////////////////// |