aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei <ericbunnie@gmail.com>2014-05-18 22:09:08 -0400
committerGravatar bunnei <ericbunnie@gmail.com>2014-05-18 22:09:08 -0400
commit112904b832210d7b8d165988643acae2f68793e7 (patch)
tree6b459048cc4ac2262296dc6489cfea744c80b7ae /src/core
parent16d55842c561dea86ef79049abb00dafa76b08ef (diff)
- renamed NewHandle to CreateHandle
- updated CreateHandle/DeleteHandle to use KernelObject's
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/gsp.cpp4
-rw-r--r--src/core/hle/service/service.h12
2 files changed, 8 insertions, 8 deletions
diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp
index 12c7dabc..50cee2c4 100644
--- a/src/core/hle/service/gsp.cpp
+++ b/src/core/hle/service/gsp.cpp
@@ -27,7 +27,7 @@ union GX_CmdBufferHeader {
// <=15 when writing a command to shared memory. This is incremented by the application when
// writing a command to shared memory, after increasing this value TriggerCmdReqQueue is only
// used if this field is value 1.
- BitField<8,8,u32> number_commands;
+ BitField<8,8,u32> number_commands;
};
@@ -101,9 +101,7 @@ void RegisterInterruptRelayQueue(Service::Interface* self) {
u32* cmd_buff = Service::GetCommandBuffer();
u32 flags = cmd_buff[1];
u32 event_handle = cmd_buff[3]; // TODO(bunnei): Implement event handling
-
cmd_buff[2] = g_thread_id; // ThreadID
- cmd_buff[4] = self->NewHandle();
}
/// This triggers handling of the GX command written to the command buffer in shared memory.
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 35735a00..450a439f 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -63,14 +63,16 @@ public:
}
/// Allocates a new handle for the service
- Handle NewHandle() {
- Handle handle = (m_handles.size() << 16) | 0;//m_handle;
+ Handle CreateHandle(KernelObject *obj) {
+ Handle handle = g_kernel_objects.Create(obj);
m_handles.push_back(handle);
return handle;
}
/// Frees a handle from the service
- void DeleteHandle(Handle handle) {
+ template <class T>
+ void DeleteHandle(const Handle handle) {
+ g_kernel_objects.Destroy<T>(handle);
m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end());
}
@@ -111,8 +113,8 @@ protected:
private:
- std::vector<Handle> m_handles;
- std::map<u32, FunctionInfo> m_functions;
+ std::vector<Handle> m_handles;
+ std::map<u32, FunctionInfo> m_functions;
};