From 90771cb31e4f7bc94a40ca6bd5bab91e5588765e Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Wed, 3 Apr 2024 00:03:43 -0500 Subject: [PATCH] Fix text issue with locket message --- .../main/java/jace/lawless/LawlessHacks.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessHacks.java b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessHacks.java index 6533cadb..d9549136 100644 --- a/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessHacks.java +++ b/Platform/Apple/tools/jace/src/main/java/jace/lawless/LawlessHacks.java @@ -10,6 +10,7 @@ import java.util.Locale; import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; @@ -76,12 +77,27 @@ public class LawlessHacks extends Cheats { } // Enhance text rendering by forcing the text to be pure B&W + Map detectedEntryPoints = new TreeMap<>(); + long lastStatus = 0; private void enhanceText(RAMEvent e) { if (!e.isMainMemory()) { return; } int pc = Emulator.withComputer(c->c.getCpu().getProgramCounter(), 0); - boolean drawingText = pc == 0x0ee46 || pc > 0x0f300; + boolean drawingText = (pc >= 0x0ee00 && pc <= 0x0f0c0) || pc > 0x0f100; + if (DEBUG) { + if (drawingText) { + detectedEntryPoints.put(pc, detectedEntryPoints.getOrDefault(pc, 0) + 1); + } + if ((System.currentTimeMillis() - lastStatus) >= 10000) { + lastStatus = System.currentTimeMillis(); + System.out.println("---text entry points---"); + detectedEntryPoints.forEach((addr, count) -> { + System.out.println(Integer.toHexString(addr) + ": " + count); + }); + } + } + Emulator.withVideo(v -> { if (v instanceof LawlessVideo) { LawlessVideo video = (LawlessVideo) v;