diff options
| author | 2018-09-02 11:58:58 -0400 | |
|---|---|---|
| committer | 2018-09-02 12:35:30 -0400 | |
| commit | 1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2 (patch) | |
| tree | f540b9cbc6db29bb5d41668f7efa8fc5c4e44469 /src/core/hle/kernel/kernel.h | |
| parent | Merge pull request #1213 from DarkLordZach/octopath-fs (diff) | |
| download | yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.tar.gz yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.tar.xz yuzu-1242c1ec0aab88d91b0bb4faf6200e4f20e4bdc2.zip | |
service: Migrate global named port map to the KernelCore class
Now that we have a class representing the kernel in some capacity, we
now have a place to put the named port map, so we move it over and get
rid of another piece of global state within the core.
Diffstat (limited to 'src/core/hle/kernel/kernel.h')
| -rw-r--r-- | src/core/hle/kernel/kernel.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 089e959ac..ab2e9bffa 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <string> | ||
| 8 | #include <unordered_map> | ||
| 7 | #include "core/hle/kernel/object.h" | 9 | #include "core/hle/kernel/object.h" |
| 8 | 10 | ||
| 9 | template <typename T> | 11 | template <typename T> |
| @@ -15,6 +17,7 @@ struct EventType; | |||
| 15 | 17 | ||
| 16 | namespace Kernel { | 18 | namespace Kernel { |
| 17 | 19 | ||
| 20 | class ClientPort; | ||
| 18 | class HandleTable; | 21 | class HandleTable; |
| 19 | class Process; | 22 | class Process; |
| 20 | class ResourceLimit; | 23 | class ResourceLimit; |
| @@ -25,6 +28,9 @@ enum class ResourceLimitCategory : u8; | |||
| 25 | 28 | ||
| 26 | /// Represents a single instance of the kernel. | 29 | /// Represents a single instance of the kernel. |
| 27 | class KernelCore { | 30 | class KernelCore { |
| 31 | private: | ||
| 32 | using NamedPortTable = std::unordered_map<std::string, SharedPtr<ClientPort>>; | ||
| 33 | |||
| 28 | public: | 34 | public: |
| 29 | KernelCore(); | 35 | KernelCore(); |
| 30 | ~KernelCore(); | 36 | ~KernelCore(); |
| @@ -59,6 +65,18 @@ public: | |||
| 59 | /// Adds the given shared pointer to an internal list of active processes. | 65 | /// Adds the given shared pointer to an internal list of active processes. |
| 60 | void AppendNewProcess(SharedPtr<Process> process); | 66 | void AppendNewProcess(SharedPtr<Process> process); |
| 61 | 67 | ||
| 68 | /// Adds a port to the named port table | ||
| 69 | void AddNamedPort(std::string name, SharedPtr<ClientPort> port); | ||
| 70 | |||
| 71 | /// Finds a port within the named port table with the given name. | ||
| 72 | NamedPortTable::iterator FindNamedPort(const std::string& name); | ||
| 73 | |||
| 74 | /// Finds a port within the named port table with the given name. | ||
| 75 | NamedPortTable::const_iterator FindNamedPort(const std::string& name) const; | ||
| 76 | |||
| 77 | /// Determines whether or not the given port is a valid named port. | ||
| 78 | bool IsValidNamedPort(NamedPortTable::const_iterator port) const; | ||
| 79 | |||
| 62 | private: | 80 | private: |
| 63 | friend class Object; | 81 | friend class Object; |
| 64 | friend class Process; | 82 | friend class Process; |