From fde68cacb95f7b83110938d0672598b90d08143a Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Sun, 9 Aug 2020 20:45:36 +0200 Subject: [PATCH] Model: Add AddressMap boilerplate code --- Il2CppInspector.Common/Model/AddressMap.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Il2CppInspector.Common/Model/AddressMap.cs diff --git a/Il2CppInspector.Common/Model/AddressMap.cs b/Il2CppInspector.Common/Model/AddressMap.cs new file mode 100644 index 0000000..3f9a310 --- /dev/null +++ b/Il2CppInspector.Common/Model/AddressMap.cs @@ -0,0 +1,34 @@ +/* + Copyright 2020 Katy Coe - http://www.djkaty.com - https://github.com/djkaty + + All rights reserved. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Il2CppInspector.Model +{ + // A map of absolutely everything in the binary we know about + // Designed to be used by static analysis disassembly frameworks such as Capstone.NET + public class AddressMap + { + public Dictionary Item { get; } = new Dictionary(); + + public AppModel Model { get; } + + public AddressMap(AppModel model) { + Model = model; + build(); + } + + private void build() { + // TODO: Build address map + } + + public object At(ulong addr) => Item.ContainsKey(addr)? Item[addr] : null; + + public bool TryAdd(ulong addr, object item) => Item.TryAdd(addr, item); + } +}