summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2014-05-15 18:26:28 -0400
committerGravatar bunnei2014-05-15 18:26:28 -0400
commita7cc430aa4da2962dcf08db2f6009fc272bdda70 (patch)
treeba494a655541d038a5ac0d9e078ebef031461598 /src
parent- added ThreadContext struct (diff)
downloadyuzu-a7cc430aa4da2962dcf08db2f6009fc272bdda70.tar.gz
yuzu-a7cc430aa4da2962dcf08db2f6009fc272bdda70.tar.xz
yuzu-a7cc430aa4da2962dcf08db2f6009fc272bdda70.zip
changed "UID" to "Handle" to be a little more consistent with CTR naming
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/kernel.cpp10
-rw-r--r--src/core/hle/kernel/kernel.h29
2 files changed, 21 insertions, 18 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 1c26fb388..f7145ddd8 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -27,7 +27,7 @@ KernelObjectPool::KernelObjectPool() {
27 next_id = INITIAL_NEXT_ID; 27 next_id = INITIAL_NEXT_ID;
28} 28}
29 29
30UID KernelObjectPool::Create(KernelObject *obj, int range_bottom, int range_top) { 30Handle KernelObjectPool::Create(KernelObject *obj, int range_bottom, int range_top) {
31 if (range_top > MAX_COUNT) { 31 if (range_top > MAX_COUNT) {
32 range_top = MAX_COUNT; 32 range_top = MAX_COUNT;
33 } 33 }
@@ -38,7 +38,7 @@ UID KernelObjectPool::Create(KernelObject *obj, int range_bottom, int range_top)
38 if (!occupied[i]) { 38 if (!occupied[i]) {
39 occupied[i] = true; 39 occupied[i] = true;
40 pool[i] = obj; 40 pool[i] = obj;
41 pool[i]->uid = i + HANDLE_OFFSET; 41 pool[i]->handle = i + HANDLE_OFFSET;
42 return i + HANDLE_OFFSET; 42 return i + HANDLE_OFFSET;
43 } 43 }
44 } 44 }
@@ -46,7 +46,7 @@ UID KernelObjectPool::Create(KernelObject *obj, int range_bottom, int range_top)
46 return 0; 46 return 0;
47} 47}
48 48
49bool KernelObjectPool::IsValid(UID handle) 49bool KernelObjectPool::IsValid(Handle handle)
50{ 50{
51 int index = handle - HANDLE_OFFSET; 51 int index = handle - HANDLE_OFFSET;
52 if (index < 0) 52 if (index < 0)
@@ -70,7 +70,7 @@ void KernelObjectPool::Clear()
70 next_id = INITIAL_NEXT_ID; 70 next_id = INITIAL_NEXT_ID;
71} 71}
72 72
73KernelObject *&KernelObjectPool::operator [](UID handle) 73KernelObject *&KernelObjectPool::operator [](Handle handle)
74{ 74{
75 _dbg_assert_msg_(KERNEL, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ"); 75 _dbg_assert_msg_(KERNEL, IsValid(handle), "GRABBING UNALLOCED KERNEL OBJ");
76 return pool[handle - HANDLE_OFFSET]; 76 return pool[handle - HANDLE_OFFSET];
@@ -148,7 +148,7 @@ bool __KernelLoadExec(u32 entry_point) {
148 Core::g_app_core->SetPC(entry_point); 148 Core::g_app_core->SetPC(entry_point);
149 149
150 // 0x30 is the typical main thread priority I've seen used so far 150 // 0x30 is the typical main thread priority I've seen used so far
151 UID thread_id = __KernelSetupRootThread(0xDEADBEEF, 0, 0x30); 151 Handle thread_id = __KernelSetupMainThread(0x30);
152 152
153 return true; 153 return true;
154} 154}
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 0eb58210c..24d422682 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -6,7 +6,7 @@
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8 8
9typedef u32 UID; 9typedef s32 Handle;
10 10
11enum KernelIDType { 11enum KernelIDType {
12 KERNEL_ID_TYPE_THREAD = 1, 12 KERNEL_ID_TYPE_THREAD = 1,
@@ -15,20 +15,23 @@ enum KernelIDType {
15 KERNEL_ID_TYPE_EVENT = 4, 15 KERNEL_ID_TYPE_EVENT = 4,
16}; 16};
17 17
18enum {
19 KERNELOBJECT_MAX_NAME_LENGTH = 255,
20};
21
18#define KERNELOBJECT_MAX_NAME_LENGTH 31 22#define KERNELOBJECT_MAX_NAME_LENGTH 31
19 23
20class KernelObjectPool; 24class KernelObjectPool;
21 25
22class KernelObject { 26class KernelObject {
23 friend class KernelObjectPool; 27 friend class KernelObjectPool;
24 u32 uid; 28 u32 handle;
25public: 29public:
26 virtual ~KernelObject() {} 30 virtual ~KernelObject() {}
27 UID GetUID() const { return uid; } 31 Handle GetHandle() const { return handle; }
28 virtual const char *GetTypeName() { return "[BAD KERNEL OBJECT TYPE]"; } 32 virtual const char *GetTypeName() { return "[BAD KERNEL OBJECT TYPE]"; }
29 virtual const char *GetName() { return "[UNKNOWN KERNEL OBJECT]"; } 33 virtual const char *GetName() { return "[UNKNOWN KERNEL OBJECT]"; }
30 virtual KernelIDType GetIDType() const = 0; 34 virtual KernelIDType GetIDType() const = 0;
31 //virtual void GetQuickInfo(char *ptr, int size);
32}; 35};
33 36
34class KernelObjectPool { 37class KernelObjectPool {
@@ -36,13 +39,13 @@ public:
36 KernelObjectPool(); 39 KernelObjectPool();
37 ~KernelObjectPool() {} 40 ~KernelObjectPool() {}
38 41
39 // Allocates a UID within the range and inserts the object into the map. 42 // Allocates a handle within the range and inserts the object into the map.
40 UID Create(KernelObject *obj, int range_bottom=INITIAL_NEXT_ID, int range_top=0x7FFFFFFF); 43 Handle Create(KernelObject *obj, int range_bottom=INITIAL_NEXT_ID, int range_top=0x7FFFFFFF);
41 44
42 static KernelObject *CreateByIDType(int type); 45 static KernelObject *CreateByIDType(int type);
43 46
44 template <class T> 47 template <class T>
45 u32 Destroy(UID handle) { 48 u32 Destroy(Handle handle) {
46 u32 error; 49 u32 error;
47 if (Get<T>(handle, error)) { 50 if (Get<T>(handle, error)) {
48 occupied[handle - HANDLE_OFFSET] = false; 51 occupied[handle - HANDLE_OFFSET] = false;
@@ -51,10 +54,10 @@ public:
51 return error; 54 return error;
52 }; 55 };
53 56
54 bool IsValid(UID handle); 57 bool IsValid(Handle handle);
55 58
56 template <class T> 59 template <class T>
57 T* Get(UID handle, u32& outError) { 60 T* Get(Handle handle, u32& outError) {
58 if (handle < HANDLE_OFFSET || handle >= HANDLE_OFFSET + MAX_COUNT || !occupied[handle - HANDLE_OFFSET]) { 61 if (handle < HANDLE_OFFSET || handle >= HANDLE_OFFSET + MAX_COUNT || !occupied[handle - HANDLE_OFFSET]) {
59 // Tekken 6 spams 0x80020001 gets wrong with no ill effects, also on the real PSP 62 // Tekken 6 spams 0x80020001 gets wrong with no ill effects, also on the real PSP
60 if (handle != 0 && (u32)handle != 0x80020001) { 63 if (handle != 0 && (u32)handle != 0x80020001) {
@@ -79,8 +82,8 @@ public:
79 82
80 // ONLY use this when you know the handle is valid. 83 // ONLY use this when you know the handle is valid.
81 template <class T> 84 template <class T>
82 T *GetFast(UID handle) { 85 T *GetFast(Handle handle) {
83 const UID realHandle = handle - HANDLE_OFFSET; 86 const Handle realHandle = handle - HANDLE_OFFSET;
84 _dbg_assert_(KERNEL, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]); 87 _dbg_assert_(KERNEL, realHandle >= 0 && realHandle < MAX_COUNT && occupied[realHandle]);
85 return static_cast<T *>(pool[realHandle]); 88 return static_cast<T *>(pool[realHandle]);
86 } 89 }
@@ -100,7 +103,7 @@ public:
100 } 103 }
101 } 104 }
102 105
103 bool GetIDType(UID handle, int *type) const { 106 bool GetIDType(Handle handle, int *type) const {
104 if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) || 107 if ((handle < HANDLE_OFFSET) || (handle >= HANDLE_OFFSET + MAX_COUNT) ||
105 !occupied[handle - HANDLE_OFFSET]) { 108 !occupied[handle - HANDLE_OFFSET]) {
106 ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); 109 ERROR_LOG(KERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle);
@@ -111,7 +114,7 @@ public:
111 return true; 114 return true;
112 } 115 }
113 116
114 KernelObject *&operator [](UID handle); 117 KernelObject *&operator [](Handle handle);
115 void List(); 118 void List();
116 void Clear(); 119 void Clear();
117 int GetCount(); 120 int GetCount();