system.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "audio_core/audio_core.h"
  5. #include "core/core.h"
  6. #include "core/core_timing.h"
  7. #include "core/gdbstub/gdbstub.h"
  8. #include "core/hle/hle.h"
  9. #include "core/hle/kernel/kernel.h"
  10. #include "core/hle/kernel/memory.h"
  11. #include "core/hw/hw.h"
  12. #include "core/system.h"
  13. #include "video_core/video_core.h"
  14. namespace System {
  15. static bool is_powered_on{false};
  16. Result Init(EmuWindow* emu_window, u32 system_mode) {
  17. Core::Init();
  18. CoreTiming::Init();
  19. Memory::Init();
  20. HW::Init();
  21. Kernel::Init(system_mode);
  22. HLE::Init();
  23. if (!VideoCore::Init(emu_window)) {
  24. return Result::ErrorInitVideoCore;
  25. }
  26. AudioCore::Init();
  27. GDBStub::Init();
  28. is_powered_on = true;
  29. return Result::Success;
  30. }
  31. bool IsPoweredOn() {
  32. return is_powered_on;
  33. }
  34. void Shutdown() {
  35. GDBStub::Shutdown();
  36. AudioCore::Shutdown();
  37. VideoCore::Shutdown();
  38. HLE::Shutdown();
  39. Kernel::Shutdown();
  40. HW::Shutdown();
  41. CoreTiming::Shutdown();
  42. Core::Shutdown();
  43. is_powered_on = false;
  44. }
  45. } // namespace