diff options
| author | kat <kat@vector35.com> | 2024-10-30 08:39:09 -0400 |
|---|---|---|
| committer | kat <kat@vector35.com> | 2024-11-05 09:03:12 -0500 |
| commit | f4a4b17b9e30cf603eb614e153d68226a3b24520 (patch) | |
| tree | e33d18742c1a9e9b47af04df24bf88248c17f06a /view/sharedcache/api/python | |
| parent | fd8eb478a7a3bbc848da37bd33e62c2d8cf26b99 (diff) | |
[SharedCache] Implement LoadedImage API, Fix serialized image names, more robust system for out-of-date databases
Diffstat (limited to 'view/sharedcache/api/python')
| -rw-r--r-- | view/sharedcache/api/python/_sharedcachecore.py | 17 | ||||
| -rw-r--r-- | view/sharedcache/api/python/sharedcache.py | 45 |
2 files changed, 20 insertions, 42 deletions
diff --git a/view/sharedcache/api/python/_sharedcachecore.py b/view/sharedcache/api/python/_sharedcachecore.py index 93228468..d208048b 100644 --- a/view/sharedcache/api/python/_sharedcachecore.py +++ b/view/sharedcache/api/python/_sharedcachecore.py @@ -578,23 +578,6 @@ def BNDSCViewLoadSectionAtAddress( # ------------------------------------------------------- -# _BNDSCViewLoadedImageCount - -_BNDSCViewLoadedImageCount = core.BNDSCViewLoadedImageCount -_BNDSCViewLoadedImageCount.restype = ctypes.c_ulonglong -_BNDSCViewLoadedImageCount.argtypes = [ - ctypes.POINTER(BNSharedCache), - ] - - -# noinspection PyPep8Naming -def BNDSCViewLoadedImageCount( - cache: ctypes.POINTER(BNSharedCache) - ) -> int: - return _BNDSCViewLoadedImageCount(cache) - - -# ------------------------------------------------------- # _BNFreeSharedCacheReference _BNFreeSharedCacheReference = core.BNFreeSharedCacheReference diff --git a/view/sharedcache/api/python/sharedcache.py b/view/sharedcache/api/python/sharedcache.py index ca031e03..54745ed5 100644 --- a/view/sharedcache/api/python/sharedcache.py +++ b/view/sharedcache/api/python/sharedcache.py @@ -12,17 +12,15 @@ from .sharedcache_enums import * @dataclasses.dataclass class DSCMemoryMapping: - filePath: str name: str vmAddress: int - rawViewOffset: int size: int def __str__(self): return repr(self) def __repr__(self): - return f"<DSCMemoryMapping '{self.name}' {os.path.basename(self.filePath)} raw<{self.rawViewOffset:x}>: {self.vmAddress:x}+{self.size:x}>" + return f"<DSCMemoryMapping '{self.name}': {self.vmAddress:x}+{self.size:x}>" @dataclasses.dataclass @@ -176,31 +174,32 @@ class SharedCache: return result @property - def loaded_images(self): + def loaded_regions(self): + """ + Get all loaded regions in the shared cache + + The internal logic for loading images treats a region as 'loaded' whenever + that region has been mapped into memory, and, if it's located within an image, header information has been applied to that region. + + Individual segments within an image can be loaded independently of the image itself. + + Only once all regions of an image are loaded will the header processor refuse to run on that region. + :return: + """ count = ctypes.c_ulonglong() - value = sccore.BNDSCViewGetLoadedImages(self.handle, count) + value = sccore.BNDSCViewGetLoadedRegions(self.handle, count) if value is None: return [] result = [] for i in range(count.value): - mappings = [] - for j in range(value[i].mappingCount): - mapping = DSCMemoryMapping( - value[i].mappings[j].filePath, - value[i].mappings[j].name, - value[i].mappings[j].vmAddress, - value[i].mappings[j].rawViewOffset, - value[i].mappings[j].size - ) - mappings.append(mapping) - result.append(LoadedRegion( + mapping = DSCMemoryMapping( value[i].name, - value[i].headerAddress, - mappings - )) - - sccore.BNDSCViewFreeLoadedImages(value, count) + value[i].vmAddress, + value[i].size, + ) + result.append(mapping) + sccore.BNDSCViewFreeLoadedRegions(value, count) return result def load_all_symbols_and_wait(self): @@ -235,10 +234,6 @@ class SharedCache: return result @property - def image_count(self): - return sccore.BNDSCViewLoadedImageCount(self.handle) - - @property def state(self): return DSCViewState(sccore.BNDSCViewGetState(self.handle)) |
