diff options
author | bunnei <bunneidev@gmail.com> | 2018-01-01 19:25:37 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-01-01 19:25:37 +0100 |
commit | d0046b120a6be248cabb69c4394b7e6f01b6d520 (patch) | |
tree | c8b7609452a02d1fac36528b30ba3aa1062625a4 /src/core/hle/kernel/object_address_table.cpp | |
parent | thread: Keep track of the initially created handle. (diff) | |
download | yuzu-d0046b120a6be248cabb69c4394b7e6f01b6d520.tar yuzu-d0046b120a6be248cabb69c4394b7e6f01b6d520.tar.gz yuzu-d0046b120a6be248cabb69c4394b7e6f01b6d520.tar.bz2 yuzu-d0046b120a6be248cabb69c4394b7e6f01b6d520.tar.lz yuzu-d0046b120a6be248cabb69c4394b7e6f01b6d520.tar.xz yuzu-d0046b120a6be248cabb69c4394b7e6f01b6d520.tar.zst yuzu-d0046b120a6be248cabb69c4394b7e6f01b6d520.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/object_address_table.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/hle/kernel/object_address_table.cpp b/src/core/hle/kernel/object_address_table.cpp new file mode 100644 index 000000000..dda532a88 --- /dev/null +++ b/src/core/hle/kernel/object_address_table.cpp @@ -0,0 +1,34 @@ +// 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_address_table.h" + +namespace Kernel { + +ObjectAddressTable g_object_address_table; + +void ObjectAddressTable::Insert(VAddr addr, SharedPtr<Object> obj) { + ASSERT_MSG(objects.find(addr) == objects.end(), "Object already exists with addr=0x%llx", addr); + objects[addr] = obj; +} + +void ObjectAddressTable::Close(VAddr addr) { + ASSERT_MSG(objects.find(addr) != objects.end(), "Object does not exist with addr=0x%llx", addr); + objects.erase(addr); +} + +SharedPtr<Object> ObjectAddressTable::GetGeneric(VAddr addr) const { + auto iter = objects.find(addr); + if (iter != objects.end()) { + return iter->second; + } + return {}; +} + +void ObjectAddressTable::Clear() { + objects.clear(); +} + +} // namespace Kernel |