summaryrefslogtreecommitdiff
path: root/binaryviewtype.cpp
diff options
context:
space:
mode:
authorAlexander Taylor <alex@vector35.com>2025-02-25 20:32:24 -0500
committerAlexander Taylor <alex@vector35.com>2025-03-10 11:12:09 -0400
commit1fc3cd833f19ffa534f04caf541e88042124fd91 (patch)
tree772b0c73d87d7831dcd94f53bb4b2d4f1e429c98 /binaryviewtype.cpp
parent32455f977824cf50ec0049cad16e741f0d050c73 (diff)
Remove platform registration API footgun.
Turns out, you can just pass this thing an architecture that is *completely* different from the one in the platform you are also passing in and it'll just happily do the wrong thing. While that's pretty wild, I'm in favor of not having to make this particular mistake again the next time I copy/paste some code, so we're now deprecating it.
Diffstat (limited to 'binaryviewtype.cpp')
-rw-r--r--binaryviewtype.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/binaryviewtype.cpp b/binaryviewtype.cpp
index 2ee8e2ac..d0479a11 100644
--- a/binaryviewtype.cpp
+++ b/binaryviewtype.cpp
@@ -174,6 +174,17 @@ Ref<Architecture> BinaryViewType::GetArchitecture(uint32_t id, BNEndianness endi
}
+void BinaryViewType::RegisterPlatform(const string& name, uint32_t id, Platform* platform)
+{
+ Ref<BinaryViewType> type = BinaryViewType::GetByName(name);
+ if (!type)
+ return;
+ Ref<Architecture> arch = platform->GetArchitecture();
+ if (!arch)
+ return;
+ type->RegisterPlatform(id, arch, platform);
+}
+
void BinaryViewType::RegisterPlatform(const string& name, uint32_t id, Architecture* arch, Platform* platform)
{
Ref<BinaryViewType> type = BinaryViewType::GetByName(name);