Skip to content

Commit 07a1dca

Browse files
committed
add option to reduce the fastfile reader logs
1 parent 903bf6b commit 07a1dca

File tree

163 files changed

+287
-280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+287
-280
lines changed

src/acts/tools/fastfile/fastfile_handlers.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ namespace fastfile {
388388
else if (!strcmp("-D", arg) || !_strcmpi("--decompressors", arg)) {
389389
print_decompressors = true;
390390
}
391+
else if (!strcmp("-l", arg) || !_strcmpi("--reduced-logs", arg)) {
392+
reducedLogs = true;
393+
}
391394
else if (!strcmp("-d", arg) || !_strcmpi("--dump", arg)) {
392395
dump_decompressed = true;
393396
}
@@ -501,6 +504,7 @@ namespace fastfile {
501504
LOG_INFO("-n --name [n] : Set the assets to dump by name (by default all)");
502505
LOG_INFO("-t --translate [t] : Load translation directory");
503506
LOG_INFO("-k --rsa-key [k] : Set the rsa public key (by default game's key)");
507+
LOG_INFO("-l --reduced-logs : Reduce the logs");
504508
LOG_INFO("--noAssetDump : No asset dump");
505509
LOG_INFO("--dumpBinaryAssets : Dump binary assets");
506510
LOG_INFO("--dumpBinaryAssetsMap : Dump binary assets map");

src/acts/tools/fastfile/fastfile_handlers.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ namespace fastfile {
130130
bool testDump{};
131131
bool archiveDDL{};
132132
bool graphic{};
133+
bool reducedLogs{};
133134
GameId m_gameId{};
134135
GameRevId m_gameRevId{};
135136
const char* m_casc{};
@@ -313,4 +314,6 @@ namespace fastfile {
313314
FFLinker* FindLinker(const char* name);
314315
fastfile::FastFileContext& GetCurrentContext();
315316
fastfile::FastFileOption& GetCurrentOptions();
316-
}
317+
}
318+
319+
#define LOG_OPT_INFO(...) if (!fastfile::GetCurrentOptions().reducedLogs) LOG_INFO(__VA_ARGS__)

src/acts/tools/fastfile/handlers/bo3/bo3_unlinker_rawfile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace {
1919
std::filesystem::path outFile{ opt.m_output / "bo3" / "source" / asset->name };
2020

2121
std::filesystem::create_directories(outFile.parent_path());
22-
LOG_INFO("Dump raw file {} 0x{:x}", outFile.string(), asset->len);
22+
LOG_OPT_INFO("Dump raw file {} 0x{:x}", outFile.string(), asset->len);
2323
if (!asset->len && std::filesystem::exists(outFile)) return; // ignore empty files
2424
if (!utils::WriteFile(outFile, asset->buffer, asset->len)) {
2525
LOG_ERROR("Error when dumping {}", outFile.string());

src/acts/tools/fastfile/handlers/bo3/bo3_unlinker_scriptparsetree.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace {
2626

2727
std::filesystem::path outFile{ outDir / std::format("vm_{:x}/{}c", *(uint64_t*)spt->buffer, spt->name) };
2828
std::filesystem::create_directories(outFile.parent_path());
29-
LOG_INFO("Dump scriptparsetree {} 0x{:x} ({})", outFile.string(), spt->len, spt->name);
29+
LOG_OPT_INFO("Dump scriptparsetree {} 0x{:x} ({})", outFile.string(), spt->len, spt->name);
3030
if (!utils::WriteFile(outFile, spt->buffer, spt->len)) {
3131
LOG_ERROR("Error when dumping {}", outFile.string());
3232
return;

src/acts/tools/fastfile/handlers/bo4/bo4_unlinker_aitype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ namespace {
511511
/ std::format("{}.json", hashutils::ExtractTmp("file", asset.name))
512512
};
513513
std::filesystem::create_directories(outFile.parent_path());
514-
LOG_INFO("Dump aitype {}", outFile.string());
514+
LOG_OPT_INFO("Dump aitype {}", outFile.string());
515515

516516
if (!json.WriteToFile(outFile)) {
517517
LOG_ERROR("Error when dumping {}", outFile.string());

src/acts/tools/fastfile/handlers/bo4/bo4_unlinker_arenaseasons.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ namespace {
6767
std::filesystem::create_directories(outFile.parent_path());
6868
BO4JsonWriter json{};
6969

70-
LOG_INFO("Dump arenaseasons {}", outFile.string());
70+
LOG_OPT_INFO("Dump arenaseasons {}", outFile.string());
7171

7272
json.BeginObject();
7373
json.WriteFieldValueHash("unk0", asset->unk0);

src/acts/tools/fastfile/handlers/bo4/bo4_unlinker_bgcache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace {
3535
return;
3636
}
3737

38-
LOG_INFO("Dump bgcache {}", outFile.string());
38+
LOG_OPT_INFO("Dump bgcache {}", outFile.string());
3939

4040
os << "type,name";
4141

src/acts/tools/fastfile/handlers/bo4/bo4_unlinker_character.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ namespace {
166166
constexpr size_t testLen = sizeof(Character) - postWeaponDefNameField;
167167

168168
if (utils::data::IsNulled(&((byte*)ptr)[postWeaponDefNameField], testLen)) {
169-
LOG_INFO("ignore empty character {}", hashutils::ExtractTmp("file", asset->name.name));
169+
LOG_OPT_INFO("ignore empty character {}", hashutils::ExtractTmp("file", asset->name.name));
170170
return;
171171
}
172172

@@ -178,7 +178,7 @@ namespace {
178178

179179
BO4JsonWriter json{};
180180

181-
LOG_INFO("Dump character {}", outFile.string());
181+
LOG_OPT_INFO("Dump character {}", outFile.string());
182182

183183

184184
json.BeginObject();

src/acts/tools/fastfile/handlers/bo4/bo4_unlinker_characterbodytype.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace {
5959
constexpr size_t testLen = sizeof(CharacterBodyType) - postWeaponDefNameField;
6060

6161
if (utils::data::IsNulled(&((byte*)ptr)[postWeaponDefNameField], testLen)) {
62-
LOG_INFO("ignore empty character {}", hashutils::ExtractTmp("file", asset->name.name));
62+
LOG_OPT_INFO("ignore empty character {}", hashutils::ExtractTmp("file", asset->name.name));
6363
return;
6464
}
6565

@@ -70,7 +70,7 @@ namespace {
7070

7171
BO4JsonWriter json{};
7272

73-
LOG_INFO("Dump characterbodytype {}", outFile.string());
73+
LOG_OPT_INFO("Dump characterbodytype {}", outFile.string());
7474

7575

7676
json.BeginObject();

src/acts/tools/fastfile/handlers/bo4/bo4_unlinker_computeshaderset.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace {
8686
std::filesystem::create_directories(outDir);
8787
BO4JsonWriter json{};
8888

89-
LOG_INFO("Dump computeshaderset {}", outFile.string());
89+
LOG_OPT_INFO("Dump computeshaderset {}", outFile.string());
9090

9191
json.BeginObject();
9292
json.WriteFieldValueXHash("name", asset->name);
@@ -127,7 +127,7 @@ namespace {
127127
LOG_ERROR("Can't write {}", outCode.string());
128128
}
129129
else {
130-
LOG_INFO("Dump dxbc {}", outCode.string());
130+
LOG_OPT_INFO("Dump dxbc {}", outCode.string());
131131
}
132132
json.WriteFieldValueString("code", codeFileName);
133133

0 commit comments

Comments
 (0)