aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/hle/service/os/process.h
blob: 9109b7d0a58eeaa9983c1cdb7553ad0bd2205bb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "common/common_types.h"

namespace Core {
class System;
}

namespace Loader {
class AppLoader;
enum class ResultStatus : u16;
} // namespace Loader

namespace Kernel {
class KProcess;
}

namespace Service {

class Process {
public:
    explicit Process(Core::System& system);
    ~Process();

    bool Initialize(Loader::AppLoader& loader, Loader::ResultStatus& out_load_result);
    void Finalize();

    bool Run();
    void Terminate();
    void Suspend(bool suspended);
    void ResetSignal();

    bool IsInitialized() const {
        return m_process != nullptr;
    }

    bool IsRunning() const;
    bool IsTerminated() const;

    u64 GetProcessId() const;
    u64 GetProgramId() const;

    Kernel::KProcess* GetHandle() const {
        return m_process;
    }

private:
    Core::System& m_system;
    Kernel::KProcess* m_process{};
    s32 m_main_thread_priority{};
    u64 m_main_thread_stack_size{};
    bool m_process_started{};
};

} // namespace Service