summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeod <47716344+JeodC@users.noreply.github.com>2026-07-21 20:40:49 -0400
committerGitHub <noreply@github.com>2026-07-22 01:40:49 +0100
commit5f5903421dc58a63499b21df2015b65b3f47d561 (patch)
treeaebb35f13c27ada1540146667c2b924323e43f3b /src
parent5b79bdbc01cea67ac8ac387e3f6b982017413b39 (diff)
BK: suppress extraction warnings per port policy (#229)
Diffstat (limited to 'src')
-rw-r--r--src/factories/bk64/ConfigFactory.cpp15
-rw-r--r--src/factories/bk64/ConfigFactory.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/src/factories/bk64/ConfigFactory.cpp b/src/factories/bk64/ConfigFactory.cpp
index 1568ad6..2b51018 100644
--- a/src/factories/bk64/ConfigFactory.cpp
+++ b/src/factories/bk64/ConfigFactory.cpp
@@ -443,6 +443,21 @@ RomhackKind ClassifyRomhack(const std::vector<uint8_t>& rom) {
// Public wrapper: thin bool-returning view used by Lighthouse to gate UI before
// running the rest of extraction. Same detection logic as DetectCustomCodeBlob
// above; we discard the returned metadata for callers that just want a yes/no.
+bool GetCustomCodeBlobInfo(const std::vector<uint8_t>& rom, CustomCodeKind& outKind, char outSha1Hex[41]) {
+ uint32_t blobRom = 0, firstTarget = 0, ramBase = 0;
+ int jalCount = 0;
+ uint8_t sha1[20] = {};
+ outKind = CustomCodeKind::NONE;
+ outSha1Hex[0] = '\0';
+ if (!DetectCustomCodeBlob(rom, blobRom, jalCount, firstTarget, ramBase, outKind, sha1)) {
+ return false;
+ }
+ for (int i = 0; i < 20; i++) {
+ std::snprintf(outSha1Hex + i * 2, 3, "%02x", sha1[i]);
+ }
+ return true;
+}
+
bool HasCustomCodeBlob(const std::vector<uint8_t>& rom) {
uint32_t blobRom = 0, firstTarget = 0, ramBase = 0;
int jalCount = 0;
diff --git a/src/factories/bk64/ConfigFactory.h b/src/factories/bk64/ConfigFactory.h
index 7822647..c2c6982 100644
--- a/src/factories/bk64/ConfigFactory.h
+++ b/src/factories/bk64/ConfigFactory.h
@@ -69,6 +69,12 @@ enum class CustomCodeKind : uint16_t {
BB_INJECTED = 2,
};
+// Pre-extraction probe for callers that decide the warning policy themselves
+// (e.g. the extraction UI checks RomhackTable for hand-ported hashes): reports
+// the detected blob's kind and its SHA1 as 40 lowercase hex chars + NUL.
+// Returns false (kind NONE, empty hash) when no blob is found.
+bool GetCustomCodeBlobInfo(const std::vector<uint8_t>& rom, CustomCodeKind& outKind, char outSha1Hex[41]);
+
// CODE_CONSTANTS key IDs - they index into the sBBConfigs table.
enum class CodeConstantKey : uint16_t {
NEW_GAME_MAP = 0,