Skip to content

Commit

Permalink
sb dump adds
Browse files Browse the repository at this point in the history
  • Loading branch information
ate47 committed May 31, 2024
1 parent a9298a0 commit 79f81b8
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/acts/tools/bo3/dumpt7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,10 @@ namespace {

auto n = proc.ReadStringTmp(p.name, nullptr);
auto type = GetMTString(proc, p.type);

if (!p.kvp.kvpCount || !n || *n < 0x20 || *n > 0x7F) {
continue;
}
if (!*type) {
type = "default";
}
Expand All @@ -534,8 +538,9 @@ namespace {

std::cout << "->" << file;

bool readed{};
if (!std::filesystem::exists(file, ec)) {
readFile++;
readed = true;
std::cout << " (new)";
}
std::cout << "\n";
Expand All @@ -547,20 +552,21 @@ namespace {
continue;
}

out << "{\n";
utils::Padding(out, 1) << "\"name\": \"" << n << "\",\n";
utils::Padding(out, 1) << "\"type\": \"" << GetMTString(proc, p.type) << "\"";
out << "{";
if (p.kvp.kvpCount) {
out << ",\n";
utils::Padding(out, 1) << "\"objects\": {";
if (!DumpSBObject(proc, out, opt, p.kvp, 2)) {
if (!DumpSBObject(proc, out, opt, p.kvp, 1)) {
out << "Error when dumping\n";
}
utils::Padding(out << "\n", 1) << "}";
}
else {
// default value
out << "\n";
utils::Padding(out, 1) << "\"name\": \"" << n << "\",\n";
utils::Padding(out, 1) << "\"type\": \"" << type << "\"";
}
if (p.sbObjectsArray.sbObjectCount) {
out << ",\n";
utils::Padding(out, 1) << "\"array\": [";
utils::Padding(out, 1) << "\"objects\": [";

auto [objs, oksb] = proc.ReadMemoryArray<SB_Object>(p.sbObjectsArray.sbObjects, p.sbObjectsArray.sbObjectCount);

Expand All @@ -583,6 +589,7 @@ namespace {
}
out << "\n}";

if (readed) readFile++;
out.close();
}

Expand Down

0 comments on commit 79f81b8

Please sign in to comment.