summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2014-12-29 03:11:55 +0100
committerbunnei <bunneidev@gmail.com>2014-12-29 03:11:55 +0100
commit77363d9590ed544cf714f26c575e98b7858e18e1 (patch)
treea48225a3b62bb3d72d94289b6e34326cbed4f5cc /src/core/hle/service
parentMerge pull request #357 from bunnei/dyncom-pkhbt-pkhtb (diff)
parentKernel: New handle manager (diff)
downloadyuzu-77363d9590ed544cf714f26c575e98b7858e18e1.tar
yuzu-77363d9590ed544cf714f26c575e98b7858e18e1.tar.gz
yuzu-77363d9590ed544cf714f26c575e98b7858e18e1.tar.bz2
yuzu-77363d9590ed544cf714f26c575e98b7858e18e1.tar.lz
yuzu-77363d9590ed544cf714f26c575e98b7858e18e1.tar.xz
yuzu-77363d9590ed544cf714f26c575e98b7858e18e1.tar.zst
yuzu-77363d9590ed544cf714f26c575e98b7858e18e1.zip
Diffstat (limited to 'src/core/hle/service')
-rw-r--r--src/core/hle/service/fs/archive.cpp10
-rw-r--r--src/core/hle/service/service.cpp5
-rw-r--r--src/core/hle/service/service.h5
3 files changed, 12 insertions, 8 deletions
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 98db02f15..487bf3aa7 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -133,7 +133,7 @@ public:
case FileCommand::Close:
{
LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
- Kernel::g_object_pool.Destroy<File>(GetHandle());
+ backend->Close();
break;
}
@@ -189,7 +189,7 @@ public:
case DirectoryCommand::Close:
{
LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
- Kernel::g_object_pool.Destroy<Directory>(GetHandle());
+ backend->Close();
break;
}
@@ -283,7 +283,8 @@ ResultVal<Handle> OpenFileFromArchive(ArchiveHandle archive_handle, const FileSy
}
auto file = Common::make_unique<File>(std::move(backend), path);
- Handle handle = Kernel::g_object_pool.Create(file.release());
+ // TOOD(yuriks): Fix error reporting
+ Handle handle = Kernel::g_handle_table.Create(file.release()).ValueOr(INVALID_HANDLE);
return MakeResult<Handle>(handle);
}
@@ -388,7 +389,8 @@ ResultVal<Handle> OpenDirectoryFromArchive(ArchiveHandle archive_handle, const F
}
auto directory = Common::make_unique<Directory>(std::move(backend), path);
- Handle handle = Kernel::g_object_pool.Create(directory.release());
+ // TOOD(yuriks): Fix error reporting
+ Handle handle = Kernel::g_handle_table.Create(directory.release()).ValueOr(INVALID_HANDLE);
return MakeResult<Handle>(handle);
}
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 44e4fbcb2..0f3cc2aa8 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -56,7 +56,8 @@ Manager::~Manager() {
/// Add a service to the manager (does not create it though)
void Manager::AddService(Interface* service) {
- m_port_map[service->GetPortName()] = Kernel::g_object_pool.Create(service);
+ // TOOD(yuriks): Fix error reporting
+ m_port_map[service->GetPortName()] = Kernel::g_handle_table.Create(service).ValueOr(INVALID_HANDLE);
m_services.push_back(service);
}
@@ -70,7 +71,7 @@ void Manager::DeleteService(const std::string& port_name) {
/// Get a Service Interface from its Handle
Interface* Manager::FetchFromHandle(Handle handle) {
- return Kernel::g_object_pool.Get<Interface>(handle);
+ return Kernel::g_handle_table.Get<Interface>(handle);
}
/// Get a Service Interface from its port
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 0616822fa..28b4ccd17 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -54,7 +54,8 @@ public:
/// Allocates a new handle for the service
Handle CreateHandle(Kernel::Object *obj) {
- Handle handle = Kernel::g_object_pool.Create(obj);
+ // TODO(yuriks): Fix error reporting
+ Handle handle = Kernel::g_handle_table.Create(obj).ValueOr(INVALID_HANDLE);
m_handles.push_back(handle);
return handle;
}
@@ -62,7 +63,7 @@ public:
/// Frees a handle from the service
template <class T>
void DeleteHandle(const Handle handle) {
- Kernel::g_object_pool.Destroy<T>(handle);
+ Kernel::g_handle_table.Close(handle);
m_handles.erase(std::remove(m_handles.begin(), m_handles.end(), handle), m_handles.end());
}