process.h 946 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "common/common_funcs.h"
  5. #include "common/common_types.h"
  6. namespace Kernel {
  7. class KProcess;
  8. }
  9. namespace Core {
  10. class System;
  11. }
  12. namespace Service::AM {
  13. class Process {
  14. public:
  15. explicit Process(Core::System& system);
  16. ~Process();
  17. bool Initialize(u64 program_id);
  18. void Finalize();
  19. bool Run();
  20. void Terminate();
  21. bool IsInitialized() const {
  22. return m_process != nullptr;
  23. }
  24. u64 GetProcessId() const;
  25. u64 GetProgramId() const {
  26. return m_program_id;
  27. }
  28. Kernel::KProcess* GetProcess() const {
  29. return m_process;
  30. }
  31. private:
  32. Core::System& m_system;
  33. Kernel::KProcess* m_process{};
  34. s32 m_main_thread_priority{};
  35. u64 m_main_thread_stack_size{};
  36. u64 m_program_id{};
  37. bool m_process_started{};
  38. };
  39. } // namespace Service::AM