diff options
author | bunnei <ericbunnie@gmail.com> | 2014-05-19 00:24:24 +0200 |
---|---|---|
committer | bunnei <ericbunnie@gmail.com> | 2014-05-19 00:24:24 +0200 |
commit | 725d240bf7b9cb48de7a66f8696695ef7aabc889 (patch) | |
tree | f9bbcff151b96109da675e00b23fb65c7a042f25 /src/core | |
parent | - moved Handle/Result definitions to kernel.h (diff) | |
download | yuzu-725d240bf7b9cb48de7a66f8696695ef7aabc889.tar yuzu-725d240bf7b9cb48de7a66f8696695ef7aabc889.tar.gz yuzu-725d240bf7b9cb48de7a66f8696695ef7aabc889.tar.bz2 yuzu-725d240bf7b9cb48de7a66f8696695ef7aabc889.tar.lz yuzu-725d240bf7b9cb48de7a66f8696695ef7aabc889.tar.xz yuzu-725d240bf7b9cb48de7a66f8696695ef7aabc889.tar.zst yuzu-725d240bf7b9cb48de7a66f8696695ef7aabc889.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/service/service.cpp | 16 | ||||
-rw-r--r-- | src/core/hle/service/service.h | 22 | ||||
-rw-r--r-- | src/core/hle/service/srv.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/syscall.cpp | 4 |
4 files changed, 22 insertions, 24 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index e6605a398..5601e59a1 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -32,27 +32,27 @@ Manager::~Manager() { /// Add a service to the manager (does not create it though) void Manager::AddService(Interface* service) { int index = m_services.size(); - u32 new_uid = GetUIDFromIndex(index); + Handle handle = GetHandleFromIndex(index); m_services.push_back(service); - m_port_map[service->GetPortName()] = new_uid; - service->m_uid = new_uid; + m_port_map[service->GetPortName()] = handle; + service->m_handle = handle; } /// Removes a service from the manager, also frees memory void Manager::DeleteService(std::string port_name) { auto service = FetchFromPortName(port_name); - m_services.erase(m_services.begin() + GetIndexFromUID(service->m_uid)); + m_services.erase(m_services.begin() + GetIndexFromHandle(service->m_handle)); m_port_map.erase(port_name); delete service; } -/// Get a Service Interface from its UID -Interface* Manager::FetchFromUID(u32 uid) { - int index = GetIndexFromUID(uid); +/// Get a Service Interface from its Handle +Interface* Manager::FetchFromHandle(Handle handle) { + int index = GetIndexFromHandle(handle); if (index < (int)m_services.size()) { return m_services[index]; } @@ -65,7 +65,7 @@ Interface* Manager::FetchFromPortName(std::string port_name) { if (itr == m_port_map.end()) { return NULL; } - return FetchFromUID(itr->second); + return FetchFromHandle(itr->second); } diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index 026e3d5de..c3dbd202f 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h @@ -20,8 +20,6 @@ namespace Service { -typedef s32 NativeUID; ///< Native handle for a service - static const int kMaxPortSize = 0x08; ///< Maximum size of a port name (8 characters) static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header @@ -56,11 +54,11 @@ public: }; /** - * Gets the UID for the serice - * @return UID of service in native format + * Gets the Handle for the serice + * @return Handle of service in native format */ - NativeUID GetUID() const { - return (NativeUID)m_uid; + Handle GetHandle() const { + return m_handle; } /** @@ -73,7 +71,7 @@ public: /// Allocates a new handle for the service Handle NewHandle() { - Handle handle = (m_handles.size() << 16) | m_uid; + Handle handle = (m_handles.size() << 16) | m_handle; m_handles.push_back(handle); return handle; } @@ -124,7 +122,7 @@ protected: } private: - u32 m_uid; + u32 m_handle; std::vector<Handle> m_handles; std::map<u32, FunctionInfo> m_functions; @@ -145,7 +143,7 @@ public: void DeleteService(std::string port_name); /// Get a Service Interface from its UID - Interface* FetchFromUID(u32 uid); + Interface* FetchFromHandle(u32 uid); /// Get a Service Interface from its port Interface* FetchFromPortName(std::string port_name); @@ -153,13 +151,13 @@ public: private: /// Convert an index into m_services vector into a UID - static u32 GetUIDFromIndex(const int index) { + static Handle GetHandleFromIndex(const int index) { return index | 0x10000000; } /// Convert a UID into an index into m_services - static int GetIndexFromUID(const u32 uid) { - return uid & 0x0FFFFFFF; + static int GetIndexFromHandle(const Handle handle) { + return handle & 0x0FFFFFFF; } std::vector<Interface*> m_services; diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index a3d041176..ff6da8f1c 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp @@ -30,10 +30,10 @@ void GetServiceHandle(Service::Interface* self) { Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name.c_str(), - service->GetUID()); + service->GetHandle()); if (NULL != service) { - cmd_buff[3] = service->GetUID(); + cmd_buff[3] = service->GetHandle(); } else { ERROR_LOG(OSHLE, "Service %s does not exist", port_name.c_str()); res = -1; diff --git a/src/core/hle/syscall.cpp b/src/core/hle/syscall.cpp index 047d8c40f..1d7daf95c 100644 --- a/src/core/hle/syscall.cpp +++ b/src/core/hle/syscall.cpp @@ -83,7 +83,7 @@ Result MapMemoryBlock(Handle memblock, u32 addr, u32 mypermissions, u32 otherper /// Connect to an OS service given the port name, returns the handle to the port to out Result ConnectToPort(void* out, const char* port_name) { Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); - Core::g_app_core->SetReg(1, service->GetUID()); + Core::g_app_core->SetReg(1, service->GetHandle()); DEBUG_LOG(SVC, "ConnectToPort called port_name=%s", port_name); return 0; } @@ -91,7 +91,7 @@ Result ConnectToPort(void* out, const char* port_name) { /// Synchronize to an OS service Result SendSyncRequest(Handle session) { DEBUG_LOG(SVC, "SendSyncRequest called session=0x%08X"); - Service::Interface* service = Service::g_manager->FetchFromUID(session); + Service::Interface* service = Service::g_manager->FetchFromHandle(session); service->Sync(); return 0; } |