Initial public OpenBMH 0.1 source (by Codex)

This commit is contained in:
Codex committed 2026-10-16 19:36:32 +02:00
commit 558fbf166b
613 files changed
+168029

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "formats/executable_layout.hpp"
// textfind <TEXTD.BLK> <substring>: lists the texts containing the substring with their id
// and the address of the pointer variable the original uses for them (format field + 4 * id).
#include <cstdio>
#include <string>
#include "formats/textd.hpp"
int main(int argc, char** argv) {
if (argc < 3) {
std::printf("usage: textfind <TEXTD.BLK> <substring>\n");
return 1;
}
const bmh::TextDb db = bmh::load_textd(argv[1]);
for (size_t i = 0; i < db.strings.size(); i++)
if (db.strings[i].find(argv[2]) != std::string::npos)
std::printf("%4zu offset %08zx %s\n", i, size_t(::bmh::layout::TextPointerTable) + i * 4, db.strings[i].c_str());
return 0;
}