diff options
Diffstat (limited to 'src/core/system.cpp')
| -rw-r--r-- | src/core/system.cpp | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/src/core/system.cpp b/src/core/system.cpp deleted file mode 100644 index fa8bd0317..000000000 --- a/src/core/system.cpp +++ /dev/null | |||
| @@ -1,90 +0,0 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "audio_core/audio_core.h" | ||
| 6 | #include "core/core.h" | ||
| 7 | #include "core/core_timing.h" | ||
| 8 | #include "core/gdbstub/gdbstub.h" | ||
| 9 | #include "core/hle/hle.h" | ||
| 10 | #include "core/hle/kernel/kernel.h" | ||
| 11 | #include "core/hle/kernel/memory.h" | ||
| 12 | #include "core/hw/hw.h" | ||
| 13 | #include "core/system.h" | ||
| 14 | #include "video_core/video_core.h" | ||
| 15 | |||
| 16 | namespace Core { | ||
| 17 | |||
| 18 | /*static*/ System System::s_instance; | ||
| 19 | |||
| 20 | System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { | ||
| 21 | Core::Init(); | ||
| 22 | CoreTiming::Init(); | ||
| 23 | Memory::Init(); | ||
| 24 | HW::Init(); | ||
| 25 | Kernel::Init(system_mode); | ||
| 26 | HLE::Init(); | ||
| 27 | AudioCore::Init(); | ||
| 28 | GDBStub::Init(); | ||
| 29 | |||
| 30 | if (!VideoCore::Init(emu_window)) { | ||
| 31 | return ResultStatus::ErrorVideoCore; | ||
| 32 | } | ||
| 33 | |||
| 34 | is_powered_on = true; | ||
| 35 | |||
| 36 | return ResultStatus::Success; | ||
| 37 | } | ||
| 38 | |||
| 39 | void System::Shutdown() { | ||
| 40 | GDBStub::Shutdown(); | ||
| 41 | AudioCore::Shutdown(); | ||
| 42 | VideoCore::Shutdown(); | ||
| 43 | HLE::Shutdown(); | ||
| 44 | Kernel::Shutdown(); | ||
| 45 | HW::Shutdown(); | ||
| 46 | CoreTiming::Shutdown(); | ||
| 47 | Core::Shutdown(); | ||
| 48 | |||
| 49 | is_powered_on = false; | ||
| 50 | } | ||
| 51 | |||
| 52 | System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& filepath) { | ||
| 53 | state.app_loader = Loader::GetLoader(filepath); | ||
| 54 | |||
| 55 | if (!state.app_loader) { | ||
| 56 | LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filepath.c_str()); | ||
| 57 | return ResultStatus::ErrorGetLoader; | ||
| 58 | } | ||
| 59 | |||
| 60 | boost::optional<u32> system_mode{ state.app_loader->LoadKernelSystemMode() }; | ||
| 61 | if (!system_mode) { | ||
| 62 | LOG_CRITICAL(Frontend, "Failed to determine system mode!"); | ||
| 63 | return ResultStatus::ErrorSystemMode; | ||
| 64 | } | ||
| 65 | |||
| 66 | ResultStatus init_result{ Init(emu_window, system_mode.get()) }; | ||
| 67 | if (init_result != ResultStatus::Success) { | ||
| 68 | LOG_CRITICAL(Frontend, "Failed to initialize system (Error %i)!", init_result); | ||
| 69 | System::Shutdown(); | ||
| 70 | return init_result; | ||
| 71 | } | ||
| 72 | |||
| 73 | const Loader::ResultStatus load_result{ state.app_loader->Load() }; | ||
| 74 | if (Loader::ResultStatus::Success != load_result) { | ||
| 75 | LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); | ||
| 76 | System::Shutdown(); | ||
| 77 | |||
| 78 | switch (load_result) { | ||
| 79 | case Loader::ResultStatus::ErrorEncrypted: | ||
| 80 | return ResultStatus::ErrorLoader_ErrorEncrypted; | ||
| 81 | case Loader::ResultStatus::ErrorInvalidFormat: | ||
| 82 | return ResultStatus::ErrorLoader_ErrorInvalidFormat; | ||
| 83 | default: | ||
| 84 | return ResultStatus::ErrorLoader; | ||
| 85 | } | ||
| 86 | } | ||
| 87 | return ResultStatus::Success; | ||
| 88 | } | ||
| 89 | |||
| 90 | } // namespace Core | ||