forked from Keelrleek/Harbor
Queue and progress treat the statically linked D3DX9 block and byte-matched library functions as library
This commit is contained in:
1 parent
7b03642f90
commit
4da2eb93e3
1 file changed
+16
-2
+16
-2
@@ -112,6 +112,18 @@ class FunctionQueue:
|
||||
return frozenset(int(m["address"], 16) for c in data.get("clusters", []) for m in c.get("members", [])
|
||||
if m.get("best_readable") and m.get("status") != "readable")
|
||||
|
||||
def library_ranges(self):
|
||||
"""[(start, end)] of statically linked library blocks (the [reverse] library_ranges csv)."""
|
||||
path = self.config.get("library_ranges")
|
||||
if not path or not Path(path).exists():
|
||||
return []
|
||||
with open(path, encoding="utf-8") as f:
|
||||
return [(int(r["start"], 16), int(r["end"], 16)) for r in csv.DictReader(f)
|
||||
if r.get("verdict", "").startswith("D3DX")]
|
||||
|
||||
def is_library(self, addr, library, ranges):
|
||||
return addr in library or any(lo <= addr < hi for lo, hi in ranges)
|
||||
|
||||
# ------------------------------------------------------------------ queue
|
||||
def score(self, addr, facts, named, rejected, similar_readable=frozenset()):
|
||||
d = facts[addr]
|
||||
@@ -145,11 +157,12 @@ class FunctionQueue:
|
||||
statuses, deferred, rejected = self.statuses(), self.deferrals(), self.rejections()
|
||||
facts, named = self.r._facts(), self._named()
|
||||
library = self._results("library_results")
|
||||
ranges = self.library_ranges()
|
||||
ranked = []
|
||||
for addr in facts:
|
||||
if not any(lo <= addr <= hi for lo, hi in bands) or any(lo <= addr <= hi for lo, hi in taken):
|
||||
continue
|
||||
if statuses.get(addr, ("raw",))[0] == "readable" or addr in deferred or addr in library:
|
||||
if statuses.get(addr, ("raw",))[0] == "readable" or addr in deferred or self.is_library(addr, library, ranges):
|
||||
continue
|
||||
if rejected.get(addr, 0) >= self.cap:
|
||||
continue
|
||||
@@ -181,12 +194,13 @@ class FunctionQueue:
|
||||
exact = {a for a, row in self._results("match_results").items() if str(row.get("status")) == "match"}
|
||||
verified = {a for a, row in self._results("diffrun_results").items() if str(row.get("verdict")) == "same"}
|
||||
library = set(self._results("library_results"))
|
||||
ranges = self.library_ranges()
|
||||
tiers = {t: {"functions": 0, "bytes": 0} for t in TIER_ORDER + ("library", "engine")}
|
||||
for addr, d in facts.items():
|
||||
size = int(d.get("size") or 0)
|
||||
category = self._category(addr)
|
||||
readable = statuses.get(addr, ("raw",))[0] == "readable"
|
||||
if addr in library or category in ("library", "platform"):
|
||||
if self.is_library(addr, library, ranges) or category in ("library", "platform", "crt"):
|
||||
tier = "library"
|
||||
elif category == "engine" and not readable:
|
||||
tier = "engine"
|
||||
|
||||
Reference in new issue
Block a user