mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu.git
				synced 2025-05-12 00:45:25 +00:00 
			
		
		
		
	Merge pull request #894 from lioncash/object
kernel: Move object class to its own source files
This commit is contained in:
		
						commit
						4c3c608d59
					
				| @ -67,6 +67,8 @@ add_library(core STATIC | |||||||
|     hle/kernel/memory.h |     hle/kernel/memory.h | ||||||
|     hle/kernel/mutex.cpp |     hle/kernel/mutex.cpp | ||||||
|     hle/kernel/mutex.h |     hle/kernel/mutex.h | ||||||
|  |     hle/kernel/object.cpp | ||||||
|  |     hle/kernel/object.h | ||||||
|     hle/kernel/process.cpp |     hle/kernel/process.cpp | ||||||
|     hle/kernel/process.h |     hle/kernel/process.h | ||||||
|     hle/kernel/resource_limit.cpp |     hle/kernel/resource_limit.cpp | ||||||
|  | |||||||
| @ -16,7 +16,6 @@ | |||||||
| #include "core/hle/service/sm/controller.h" | #include "core/hle/service/sm/controller.h" | ||||||
| #include "core/hle/service/sm/sm.h" | #include "core/hle/service/sm/sm.h" | ||||||
| #include "core/loader/loader.h" | #include "core/loader/loader.h" | ||||||
| #include "core/memory_setup.h" |  | ||||||
| #include "core/settings.h" | #include "core/settings.h" | ||||||
| #include "file_sys/vfs_real.h" | #include "file_sys/vfs_real.h" | ||||||
| #include "video_core/video_core.h" | #include "video_core/video_core.h" | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ | |||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/arm/exclusive_monitor.h" | #include "core/arm/exclusive_monitor.h" | ||||||
| #include "core/core_cpu.h" | #include "core/core_cpu.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/scheduler.h" | #include "core/hle/kernel/scheduler.h" | ||||||
| #include "core/loader/loader.h" | #include "core/loader/loader.h" | ||||||
| #include "core/memory.h" | #include "core/memory.h" | ||||||
|  | |||||||
| @ -12,7 +12,6 @@ | |||||||
| #include "core/arm/unicorn/arm_unicorn.h" | #include "core/arm/unicorn/arm_unicorn.h" | ||||||
| #include "core/core_cpu.h" | #include "core/core_cpu.h" | ||||||
| #include "core/core_timing.h" | #include "core/core_timing.h" | ||||||
| #include "core/hle/kernel/kernel.h" |  | ||||||
| #include "core/hle/kernel/scheduler.h" | #include "core/hle/kernel/scheduler.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| #include "core/settings.h" | #include "core/settings.h" | ||||||
|  | |||||||
| @ -37,7 +37,6 @@ | |||||||
| #include "core/core.h" | #include "core/core.h" | ||||||
| #include "core/core_cpu.h" | #include "core/core_cpu.h" | ||||||
| #include "core/gdbstub/gdbstub.h" | #include "core/gdbstub/gdbstub.h" | ||||||
| #include "core/hle/kernel/kernel.h" |  | ||||||
| #include "core/hle/kernel/scheduler.h" | #include "core/hle/kernel/scheduler.h" | ||||||
| #include "core/loader/loader.h" | #include "core/loader/loader.h" | ||||||
| #include "core/memory.h" | #include "core/memory.h" | ||||||
|  | |||||||
| @ -5,15 +5,18 @@ | |||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <array> | #include <array> | ||||||
|  | #include <cstring> | ||||||
|  | #include <memory> | ||||||
| #include <tuple> | #include <tuple> | ||||||
| #include <type_traits> | #include <type_traits> | ||||||
| #include <utility> | #include <utility> | ||||||
|  | #include "common/assert.h" | ||||||
|  | #include "common/common_types.h" | ||||||
| #include "core/hle/ipc.h" | #include "core/hle/ipc.h" | ||||||
| #include "core/hle/kernel/client_port.h" | #include "core/hle/kernel/client_port.h" | ||||||
| #include "core/hle/kernel/client_session.h" | #include "core/hle/kernel/client_session.h" | ||||||
| #include "core/hle/kernel/handle_table.h" |  | ||||||
| #include "core/hle/kernel/hle_ipc.h" | #include "core/hle/kernel/hle_ipc.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/server_port.h" | #include "core/hle/kernel/server_port.h" | ||||||
| 
 | 
 | ||||||
| namespace IPC { | namespace IPC { | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/core.h" | #include "core/core.h" | ||||||
| #include "core/hle/kernel/errors.h" | #include "core/hle/kernel/errors.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/process.h" | #include "core/hle/kernel/process.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ | |||||||
| #include "core/hle/kernel/client_session.h" | #include "core/hle/kernel/client_session.h" | ||||||
| #include "core/hle/kernel/errors.h" | #include "core/hle/kernel/errors.h" | ||||||
| #include "core/hle/kernel/hle_ipc.h" | #include "core/hle/kernel/hle_ipc.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/server_port.h" | #include "core/hle/kernel/server_port.h" | ||||||
| #include "core/hle/kernel/server_session.h" | #include "core/hle/kernel/server_session.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
| 
 | 
 | ||||||
| #include <string> | #include <string> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ | |||||||
| #include <memory> | #include <memory> | ||||||
| #include <string> | #include <string> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include "common/assert.h" | #include "common/assert.h" | ||||||
| #include "core/hle/kernel/event.h" | #include "core/hle/kernel/event.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/wait_object.h" | #include "core/hle/kernel/wait_object.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | |||||||
| @ -8,7 +8,6 @@ | |||||||
| #include "core/core.h" | #include "core/core.h" | ||||||
| #include "core/hle/kernel/errors.h" | #include "core/hle/kernel/errors.h" | ||||||
| #include "core/hle/kernel/handle_table.h" | #include "core/hle/kernel/handle_table.h" | ||||||
| #include "core/hle/kernel/kernel.h" |  | ||||||
| #include "core/hle/kernel/process.h" | #include "core/hle/kernel/process.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ | |||||||
| #include <array> | #include <array> | ||||||
| #include <cstddef> | #include <cstddef> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | |||||||
| @ -3,17 +3,21 @@ | |||||||
| // Refer to the license.txt file included.
 | // Refer to the license.txt file included.
 | ||||||
| 
 | 
 | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
|  | #include <array> | ||||||
|  | #include <sstream> | ||||||
| #include <utility> | #include <utility> | ||||||
| 
 | 
 | ||||||
| #include <boost/range/algorithm_ext/erase.hpp> | #include <boost/range/algorithm_ext/erase.hpp> | ||||||
|  | 
 | ||||||
| #include "common/assert.h" | #include "common/assert.h" | ||||||
| #include "common/common_funcs.h" | #include "common/common_funcs.h" | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
|  | #include "common/logging/log.h" | ||||||
| #include "core/hle/ipc_helpers.h" | #include "core/hle/ipc_helpers.h" | ||||||
| #include "core/hle/kernel/event.h" | #include "core/hle/kernel/event.h" | ||||||
| #include "core/hle/kernel/handle_table.h" | #include "core/hle/kernel/handle_table.h" | ||||||
| #include "core/hle/kernel/hle_ipc.h" | #include "core/hle/kernel/hle_ipc.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/process.h" | #include "core/hle/kernel/process.h" | ||||||
| #include "core/hle/kernel/server_session.h" | #include "core/hle/kernel/server_session.h" | ||||||
| #include "core/memory.h" | #include "core/memory.h" | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ | |||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "common/swap.h" | #include "common/swap.h" | ||||||
| #include "core/hle/ipc.h" | #include "core/hle/ipc.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/server_session.h" | #include "core/hle/kernel/server_session.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -4,120 +4,10 @@ | |||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include <cstddef> |  | ||||||
| #include <string> |  | ||||||
| #include <utility> |  | ||||||
| #include <boost/smart_ptr/intrusive_ptr.hpp> |  | ||||||
| #include "common/assert.h" |  | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
| 
 | 
 | ||||||
| using Handle = u32; |  | ||||||
| 
 |  | ||||||
| enum class HandleType : u32 { |  | ||||||
|     Unknown, |  | ||||||
|     Event, |  | ||||||
|     SharedMemory, |  | ||||||
|     Thread, |  | ||||||
|     Process, |  | ||||||
|     AddressArbiter, |  | ||||||
|     Timer, |  | ||||||
|     ResourceLimit, |  | ||||||
|     CodeSet, |  | ||||||
|     ClientPort, |  | ||||||
|     ServerPort, |  | ||||||
|     ClientSession, |  | ||||||
|     ServerSession, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| enum class ResetType { |  | ||||||
|     OneShot, |  | ||||||
|     Sticky, |  | ||||||
|     Pulse, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| class Object : NonCopyable { |  | ||||||
| public: |  | ||||||
|     virtual ~Object() {} |  | ||||||
| 
 |  | ||||||
|     /// Returns a unique identifier for the object. For debugging purposes only.
 |  | ||||||
|     unsigned int GetObjectId() const { |  | ||||||
|         return object_id; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     virtual std::string GetTypeName() const { |  | ||||||
|         return "[BAD KERNEL OBJECT TYPE]"; |  | ||||||
|     } |  | ||||||
|     virtual std::string GetName() const { |  | ||||||
|         return "[UNKNOWN KERNEL OBJECT]"; |  | ||||||
|     } |  | ||||||
|     virtual Kernel::HandleType GetHandleType() const = 0; |  | ||||||
| 
 |  | ||||||
|     /**
 |  | ||||||
|      * Check if a thread can wait on the object |  | ||||||
|      * @return True if a thread can wait on the object, otherwise false |  | ||||||
|      */ |  | ||||||
|     bool IsWaitable() const { |  | ||||||
|         switch (GetHandleType()) { |  | ||||||
|         case HandleType::Event: |  | ||||||
|         case HandleType::Thread: |  | ||||||
|         case HandleType::Timer: |  | ||||||
|         case HandleType::ServerPort: |  | ||||||
|         case HandleType::ServerSession: |  | ||||||
|             return true; |  | ||||||
| 
 |  | ||||||
|         case HandleType::Unknown: |  | ||||||
|         case HandleType::SharedMemory: |  | ||||||
|         case HandleType::Process: |  | ||||||
|         case HandleType::AddressArbiter: |  | ||||||
|         case HandleType::ResourceLimit: |  | ||||||
|         case HandleType::CodeSet: |  | ||||||
|         case HandleType::ClientPort: |  | ||||||
|         case HandleType::ClientSession: |  | ||||||
|             return false; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         UNREACHABLE(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| public: |  | ||||||
|     static unsigned int next_object_id; |  | ||||||
| 
 |  | ||||||
| private: |  | ||||||
|     friend void intrusive_ptr_add_ref(Object*); |  | ||||||
|     friend void intrusive_ptr_release(Object*); |  | ||||||
| 
 |  | ||||||
|     unsigned int ref_count = 0; |  | ||||||
|     unsigned int object_id = next_object_id++; |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| // Special functions used by boost::instrusive_ptr to do automatic ref-counting
 |  | ||||||
| inline void intrusive_ptr_add_ref(Object* object) { |  | ||||||
|     ++object->ref_count; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline void intrusive_ptr_release(Object* object) { |  | ||||||
|     if (--object->ref_count == 0) { |  | ||||||
|         delete object; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> |  | ||||||
| using SharedPtr = boost::intrusive_ptr<T>; |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * Attempts to downcast the given Object pointer to a pointer to T. |  | ||||||
|  * @return Derived pointer to the object, or `nullptr` if `object` isn't of type T. |  | ||||||
|  */ |  | ||||||
| template <typename T> |  | ||||||
| inline SharedPtr<T> DynamicObjectCast(SharedPtr<Object> object) { |  | ||||||
|     if (object != nullptr && object->GetHandleType() == T::HANDLE_TYPE) { |  | ||||||
|         return boost::static_pointer_cast<T>(std::move(object)); |  | ||||||
|     } |  | ||||||
|     return nullptr; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /// Initialize the kernel with the specified system mode.
 | /// Initialize the kernel with the specified system mode.
 | ||||||
| void Init(u32 system_mode); | void Init(u32 system_mode); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -12,8 +12,8 @@ | |||||||
| #include "core/core.h" | #include "core/core.h" | ||||||
| #include "core/hle/kernel/errors.h" | #include "core/hle/kernel/errors.h" | ||||||
| #include "core/hle/kernel/handle_table.h" | #include "core/hle/kernel/handle_table.h" | ||||||
| #include "core/hle/kernel/kernel.h" |  | ||||||
| #include "core/hle/kernel/mutex.h" | #include "core/hle/kernel/mutex.h" | ||||||
|  | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| 
 | 
 | ||||||
| union ResultCode; | union ResultCode; | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										35
									
								
								src/core/hle/kernel/object.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								src/core/hle/kernel/object.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | |||||||
|  | // Copyright 2018 Citra Emulator Project
 | ||||||
|  | // Licensed under GPLv2 or any later version
 | ||||||
|  | // Refer to the license.txt file included.
 | ||||||
|  | 
 | ||||||
|  | #include "common/assert.h" | ||||||
|  | #include "core/hle/kernel/object.h" | ||||||
|  | 
 | ||||||
|  | namespace Kernel { | ||||||
|  | 
 | ||||||
|  | Object::~Object() = default; | ||||||
|  | 
 | ||||||
|  | bool Object::IsWaitable() const { | ||||||
|  |     switch (GetHandleType()) { | ||||||
|  |     case HandleType::Event: | ||||||
|  |     case HandleType::Thread: | ||||||
|  |     case HandleType::Timer: | ||||||
|  |     case HandleType::ServerPort: | ||||||
|  |     case HandleType::ServerSession: | ||||||
|  |         return true; | ||||||
|  | 
 | ||||||
|  |     case HandleType::Unknown: | ||||||
|  |     case HandleType::SharedMemory: | ||||||
|  |     case HandleType::Process: | ||||||
|  |     case HandleType::AddressArbiter: | ||||||
|  |     case HandleType::ResourceLimit: | ||||||
|  |     case HandleType::CodeSet: | ||||||
|  |     case HandleType::ClientPort: | ||||||
|  |     case HandleType::ClientSession: | ||||||
|  |         return false; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     UNREACHABLE(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | } // namespace Kernel
 | ||||||
							
								
								
									
										100
									
								
								src/core/hle/kernel/object.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								src/core/hle/kernel/object.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,100 @@ | |||||||
|  | // Copyright 2018 Citra Emulator Project
 | ||||||
|  | // Licensed under GPLv2 or any later version
 | ||||||
|  | // Refer to the license.txt file included.
 | ||||||
|  | 
 | ||||||
|  | #pragma once | ||||||
|  | 
 | ||||||
|  | #include <string> | ||||||
|  | #include <utility> | ||||||
|  | 
 | ||||||
|  | #include <boost/smart_ptr/intrusive_ptr.hpp> | ||||||
|  | 
 | ||||||
|  | #include "common/common_types.h" | ||||||
|  | 
 | ||||||
|  | namespace Kernel { | ||||||
|  | 
 | ||||||
|  | using Handle = u32; | ||||||
|  | 
 | ||||||
|  | enum class HandleType : u32 { | ||||||
|  |     Unknown, | ||||||
|  |     Event, | ||||||
|  |     SharedMemory, | ||||||
|  |     Thread, | ||||||
|  |     Process, | ||||||
|  |     AddressArbiter, | ||||||
|  |     Timer, | ||||||
|  |     ResourceLimit, | ||||||
|  |     CodeSet, | ||||||
|  |     ClientPort, | ||||||
|  |     ServerPort, | ||||||
|  |     ClientSession, | ||||||
|  |     ServerSession, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | enum class ResetType { | ||||||
|  |     OneShot, | ||||||
|  |     Sticky, | ||||||
|  |     Pulse, | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | class Object : NonCopyable { | ||||||
|  | public: | ||||||
|  |     virtual ~Object(); | ||||||
|  | 
 | ||||||
|  |     /// Returns a unique identifier for the object. For debugging purposes only.
 | ||||||
|  |     unsigned int GetObjectId() const { | ||||||
|  |         return object_id; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     virtual std::string GetTypeName() const { | ||||||
|  |         return "[BAD KERNEL OBJECT TYPE]"; | ||||||
|  |     } | ||||||
|  |     virtual std::string GetName() const { | ||||||
|  |         return "[UNKNOWN KERNEL OBJECT]"; | ||||||
|  |     } | ||||||
|  |     virtual HandleType GetHandleType() const = 0; | ||||||
|  | 
 | ||||||
|  |     /**
 | ||||||
|  |      * Check if a thread can wait on the object | ||||||
|  |      * @return True if a thread can wait on the object, otherwise false | ||||||
|  |      */ | ||||||
|  |     bool IsWaitable() const; | ||||||
|  | 
 | ||||||
|  | public: | ||||||
|  |     static unsigned int next_object_id; | ||||||
|  | 
 | ||||||
|  | private: | ||||||
|  |     friend void intrusive_ptr_add_ref(Object*); | ||||||
|  |     friend void intrusive_ptr_release(Object*); | ||||||
|  | 
 | ||||||
|  |     unsigned int ref_count = 0; | ||||||
|  |     unsigned int object_id = next_object_id++; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | // Special functions used by boost::instrusive_ptr to do automatic ref-counting
 | ||||||
|  | inline void intrusive_ptr_add_ref(Object* object) { | ||||||
|  |     ++object->ref_count; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | inline void intrusive_ptr_release(Object* object) { | ||||||
|  |     if (--object->ref_count == 0) { | ||||||
|  |         delete object; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | template <typename T> | ||||||
|  | using SharedPtr = boost::intrusive_ptr<T>; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * Attempts to downcast the given Object pointer to a pointer to T. | ||||||
|  |  * @return Derived pointer to the object, or `nullptr` if `object` isn't of type T. | ||||||
|  |  */ | ||||||
|  | template <typename T> | ||||||
|  | inline SharedPtr<T> DynamicObjectCast(SharedPtr<Object> object) { | ||||||
|  |     if (object != nullptr && object->GetHandleType() == T::HANDLE_TYPE) { | ||||||
|  |         return boost::static_pointer_cast<T>(std::move(object)); | ||||||
|  |     } | ||||||
|  |     return nullptr; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | } // namespace Kernel
 | ||||||
| @ -12,7 +12,7 @@ | |||||||
| #include <boost/container/static_vector.hpp> | #include <boost/container/static_vector.hpp> | ||||||
| #include "common/bit_field.h" | #include "common/bit_field.h" | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| #include "core/hle/kernel/vm_manager.h" | #include "core/hle/kernel/vm_manager.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ | |||||||
| #include <vector> | #include <vector> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "common/thread_queue_list.h" | #include "common/thread_queue_list.h" | ||||||
|  | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| 
 | 
 | ||||||
| class ARM_Interface; | class ARM_Interface; | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
| #include "common/assert.h" | #include "common/assert.h" | ||||||
| #include "core/hle/kernel/client_port.h" | #include "core/hle/kernel/client_port.h" | ||||||
| #include "core/hle/kernel/errors.h" | #include "core/hle/kernel/errors.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/server_port.h" | #include "core/hle/kernel/server_port.h" | ||||||
| #include "core/hle/kernel/server_session.h" | #include "core/hle/kernel/server_session.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
| #include <tuple> | #include <tuple> | ||||||
| #include <vector> | #include <vector> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/wait_object.h" | #include "core/hle/kernel/wait_object.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/wait_object.h" | #include "core/hle/kernel/wait_object.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ | |||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/process.h" | #include "core/hle/kernel/process.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -20,8 +20,8 @@ | |||||||
| #include "core/core_timing_util.h" | #include "core/core_timing_util.h" | ||||||
| #include "core/hle/kernel/errors.h" | #include "core/hle/kernel/errors.h" | ||||||
| #include "core/hle/kernel/handle_table.h" | #include "core/hle/kernel/handle_table.h" | ||||||
| #include "core/hle/kernel/kernel.h" |  | ||||||
| #include "core/hle/kernel/memory.h" | #include "core/hle/kernel/memory.h" | ||||||
|  | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/process.h" | #include "core/hle/kernel/process.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ | |||||||
| 
 | 
 | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/arm/arm_interface.h" | #include "core/arm/arm_interface.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/wait_object.h" | #include "core/hle/kernel/wait_object.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ | |||||||
| #include "core/core_timing.h" | #include "core/core_timing.h" | ||||||
| #include "core/core_timing_util.h" | #include "core/core_timing_util.h" | ||||||
| #include "core/hle/kernel/handle_table.h" | #include "core/hle/kernel/handle_table.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| #include "core/hle/kernel/timer.h" | #include "core/hle/kernel/timer.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/wait_object.h" | #include "core/hle/kernel/wait_object.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
|  | |||||||
| @ -5,8 +5,7 @@ | |||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include "common/assert.h" | #include "common/assert.h" | ||||||
| #include "common/logging/log.h" | #include "common/logging/log.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/kernel/memory.h" |  | ||||||
| #include "core/hle/kernel/process.h" | #include "core/hle/kernel/process.h" | ||||||
| #include "core/hle/kernel/thread.h" | #include "core/hle/kernel/thread.h" | ||||||
| #include "core/hle/kernel/timer.h" | #include "core/hle/kernel/timer.h" | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ | |||||||
| #include <vector> | #include <vector> | ||||||
| #include <boost/smart_ptr/intrusive_ptr.hpp> | #include <boost/smart_ptr/intrusive_ptr.hpp> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -4,9 +4,8 @@ | |||||||
| 
 | 
 | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
| 
 | 
 | ||||||
| #include "common/alignment.h" | #include "common/assert.h" | ||||||
| #include "common/scope_exit.h" | #include "common/logging/log.h" | ||||||
| #include "core/core_timing.h" |  | ||||||
| #include "core/hle/service/nvflinger/buffer_queue.h" | #include "core/hle/service/nvflinger/buffer_queue.h" | ||||||
| 
 | 
 | ||||||
| namespace Service { | namespace Service { | ||||||
|  | |||||||
| @ -8,10 +8,9 @@ | |||||||
| #include <string> | #include <string> | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| #include <boost/container/flat_map.hpp> | #include <boost/container/flat_map.hpp> | ||||||
| #include "common/bit_field.h" |  | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/hle_ipc.h" | #include "core/hle/kernel/hle_ipc.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| 
 | 
 | ||||||
| ////////////////////////////////////////////////////////////////////////////////////////////////////
 | ////////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||||
| // Namespace Service
 | // Namespace Service
 | ||||||
|  | |||||||
| @ -4,9 +4,11 @@ | |||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| 
 | 
 | ||||||
|  | #include <memory> | ||||||
| #include <string> | #include <string> | ||||||
| #include <unordered_map> | #include <unordered_map> | ||||||
| #include "core/hle/kernel/kernel.h" | 
 | ||||||
|  | #include "core/hle/kernel/object.h" | ||||||
| #include "core/hle/result.h" | #include "core/hle/result.h" | ||||||
| #include "core/hle/service/service.h" | #include "core/hle/service/service.h" | ||||||
| 
 | 
 | ||||||
| @ -19,6 +21,8 @@ class SessionRequestHandler; | |||||||
| 
 | 
 | ||||||
| namespace Service::SM { | namespace Service::SM { | ||||||
| 
 | 
 | ||||||
|  | class Controller; | ||||||
|  | 
 | ||||||
| /// Interface to "sm:" service
 | /// Interface to "sm:" service
 | ||||||
| class SM final : public ServiceFramework<SM> { | class SM final : public ServiceFramework<SM> { | ||||||
| public: | public: | ||||||
| @ -32,8 +36,6 @@ private: | |||||||
|     std::shared_ptr<ServiceManager> service_manager; |     std::shared_ptr<ServiceManager> service_manager; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| class Controller; |  | ||||||
| 
 |  | ||||||
| constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(-1); | constexpr ResultCode ERR_SERVICE_NOT_REGISTERED(-1); | ||||||
| constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); | constexpr ResultCode ERR_MAX_CONNECTIONS_REACHED(-1); | ||||||
| constexpr ResultCode ERR_INVALID_NAME_SIZE(-1); | constexpr ResultCode ERR_INVALID_NAME_SIZE(-1); | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ | |||||||
| #include <string> | #include <string> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/file_sys/program_metadata.h" | #include "core/file_sys/program_metadata.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/loader/loader.h" | #include "core/loader/loader.h" | ||||||
| 
 | 
 | ||||||
| namespace Loader { | namespace Loader { | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ | |||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "common/file_util.h" | #include "common/file_util.h" | ||||||
| #include "core/file_sys/vfs.h" | #include "core/file_sys/vfs.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| 
 | 
 | ||||||
| namespace Kernel { | namespace Kernel { | ||||||
| struct AddressMapping; | struct AddressMapping; | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ | |||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/file_sys/content_archive.h" | #include "core/file_sys/content_archive.h" | ||||||
| #include "core/file_sys/program_metadata.h" | #include "core/file_sys/program_metadata.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/loader/loader.h" | #include "core/loader/loader.h" | ||||||
| 
 | 
 | ||||||
| namespace Loader { | namespace Loader { | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
| 
 | 
 | ||||||
| #include <string> | #include <string> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/loader/linker.h" | #include "core/loader/linker.h" | ||||||
| #include "core/loader/loader.h" | #include "core/loader/loader.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ | |||||||
| 
 | 
 | ||||||
| #include <string> | #include <string> | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| #include "core/loader/linker.h" | #include "core/loader/linker.h" | ||||||
| #include "core/loader/loader.h" | #include "core/loader/loader.h" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
| #include <QTreeView> | #include <QTreeView> | ||||||
| #include <boost/container/flat_set.hpp> | #include <boost/container/flat_set.hpp> | ||||||
| #include "core/core.h" | #include "core/core.h" | ||||||
| #include "core/hle/kernel/kernel.h" | #include "core/hle/kernel/object.h" | ||||||
| 
 | 
 | ||||||
| class EmuThread; | class EmuThread; | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 bunnei
						bunnei