Skip to content

Commit

Permalink
wip pools, use only one XHash definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ate47 committed Feb 23, 2025
1 parent 3e85dd8 commit efd5396
Show file tree
Hide file tree
Showing 28 changed files with 1,952 additions and 315 deletions.
2 changes: 1 addition & 1 deletion src/acts/tools/bo4/event_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ namespace {
};

struct StringTableEntry {
tool::pool::XHash name{};
XHash name{};
int32_t columnCount{};
int32_t rowCount{};
int32_t cellscount{};
Expand Down
2 changes: 1 addition & 1 deletion src/acts/tools/coder/error_coder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace error_coder {
"Juliett",
"Zed",
"XRay",
"charlie",
"Charlie",
"Summer",
"Edward",
"Nora",
Expand Down
15 changes: 9 additions & 6 deletions src/acts/tools/compatibility/dbf_gen.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <includes.hpp>
/*
// not in dev anymore
#include <games/bo4/pool.hpp>
#include <dbflib.hpp>
#include <rapidcsv.h>
Expand All @@ -13,14 +15,14 @@ namespace {
using namespace games::bo4;
struct RawFileEntry {
tool::pool::XHash name;
XHash name;
uint64_t size; // 0x10
char* buffer; // 0x18
}; static_assert(sizeof(RawFileEntry) == 0x20);
struct ScriptParseTreeEntry {
tool::pool::XHash name;
XHash name;
void* buffer;
uint32_t size;
uint32_t pad02;
Expand Down Expand Up @@ -53,7 +55,7 @@ namespace {
};
struct StringTable {
tool::pool::XHash name;
XHash name;
int32_t columns_count{};
int32_t rows_count{};
int32_t cells_count{};
Expand All @@ -65,14 +67,14 @@ namespace {
}; static_assert(sizeof(StringTable) == 0x40);
struct LuaFileEntry {
tool::pool::XHash name;
XHash name;
uint64_t size{};
byte* buffer{};
}; static_assert(sizeof(LuaFileEntry) == 0x20);
struct LocalizeEntry {
const char* string{ "" };
tool::pool::XHash name;
XHash name;
}; static_assert(sizeof(LocalizeEntry) == 0x18);
union AssetHeader {
Expand Down Expand Up @@ -668,4 +670,5 @@ namespace {
ADD_TOOL(dbfgen, "compatibility", " (in) (out)", "Gen dynamic file", nullptr, dbfgen);
ADD_TOOL(dbfread, "compatibility", " (out)", "Read dynamic file", nullptr, dbfread);
}
}
*/
4 changes: 2 additions & 2 deletions src/acts/tools/dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ namespace {
};

struct dvar_t {
tool::pool::XHash name;
XHash name;
uintptr_t hashnext; // dvar_t*
uintptr_t value; // DvarData*
dvarType_t type;
Expand Down Expand Up @@ -1029,7 +1029,7 @@ namespace {
}

struct __declspec(align(8)) GfxWorld {
tool::pool::XHash name;
XHash name;
uintptr_t baseName; // const char*
int32_t surfaceCount;
uint64_t unk20;
Expand Down
4 changes: 2 additions & 2 deletions src/acts/tools/ff/handlers/bo4/bo4_unlinker_bgcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace {

BGCacheInfo* asset{ (BGCacheInfo*)ptr };

const char* n{ hashutils::ExtractTmp("file", asset->name.hash) };
const char* n{ hashutils::ExtractTmp("file", asset->name.name) };
std::filesystem::path outFile{ opt.m_output / "bo4" / "source" / "tables" / "bgcache" / std::format("{}.csv", n) };

std::filesystem::create_directories(outFile.parent_path());
Expand All @@ -41,7 +41,7 @@ namespace {

for (size_t i = 0; i < asset->defCount; i++) {
BGCacheInfoDef& def{ asset->def[i] };
os << "\n" << games::bo4::pool::BGCacheNameFromId(def.type) << "," << hashutils::ExtractTmp("hash", def.name.hash);
os << "\n" << games::bo4::pool::BGCacheNameFromId(def.type) << "," << hashutils::ExtractTmp("hash", def.name.name);
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/acts/tools/ff/handlers/bo4/bo4_unlinker_luafile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace {
}; static_assert(sizeof(LuaFile) == 0x20);
LuaFile* asset{ (LuaFile*)ptr };

const char* n{ hashutils::ExtractPtr(asset->name.hash) };
const char* n{ hashutils::ExtractPtr(asset->name.name) };

if (!n) {
n = utils::va("hashed/%llx.lua", asset->name.hash);
n = utils::va("hashed/%llx.lua", asset->name.name);
}

std::filesystem::path outFile{ opt.m_output / "bo4" / "luafile" / n };
Expand Down
4 changes: 2 additions & 2 deletions src/acts/tools/ff/handlers/bo4/bo4_unlinker_rawfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace {
}; static_assert(sizeof(RawFile) == 0x20);
RawFile* asset{ (RawFile*)ptr };

const char* n{ hashutils::ExtractPtr(asset->name.hash) };
const char* n{ hashutils::ExtractPtr(asset->name.name) };

if (!n) {
n = utils::va("hashed/rawfile/file_%llx.raw", asset->name.hash);
n = utils::va("hashed/rawfile/file_%llx.raw", asset->name.name);
}

std::filesystem::path outFile{ opt.m_output / "bo4" / "source" / n };
Expand Down
6 changes: 3 additions & 3 deletions src/acts/tools/ff/handlers/bo4/bo4_unlinker_scriptbundle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ namespace {
ScriptBundle* asset{ (ScriptBundle*)ptr };

// most likely added because it is inside the scr strings
const char* n{ hashutils::ExtractTmp("file", asset->name.hash) };
const char* n{ hashutils::ExtractTmp("file", asset->name.name) };
std::filesystem::path outFile{ opt.m_output / "bo4" / "source" / "scriptbundle"
/ (asset->bundleType.hash ? hashutils::ExtractTmp("hash", asset->bundleType.hash) : "default")
/ (asset->bundleType.name ? hashutils::ExtractTmp("hash", asset->bundleType.name) : "default")
/ std::format("{}.json", n)};

std::filesystem::create_directories(outFile.parent_path());
Expand All @@ -142,5 +142,5 @@ namespace {
}
};

utils::MapAdder<ScriptBundleWorker, games::bo4::pool::XAssetType, Worker> impl{ GetWorkers(), games::bo4::pool::XAssetType::ASSET_TYPE_SCRIPTBUNDLE };
//utils::MapAdder<ScriptBundleWorker, games::bo4::pool::XAssetType, Worker> impl{ GetWorkers(), games::bo4::pool::XAssetType::ASSET_TYPE_SCRIPTBUNDLE };
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ namespace {

std::filesystem::path outDir{ opt.m_output / "bo4" / "spt" };

std::filesystem::path outFile{ outDir / std::format("vm_{:x}/script_{:x}.gscc", *(uint64_t*)spt->buffer, spt->name.hash) };
std::filesystem::path outFile{ outDir / std::format("vm_{:x}/script_{:x}.gscc", *(uint64_t*)spt->buffer, spt->name.name) };
std::filesystem::create_directories(outFile.parent_path());
LOG_INFO("Dump scriptparsetree {} 0x{:x} ({})", outFile.string(), spt->len, hashutils::ExtractTmpScript(spt->name.hash));
LOG_INFO("Dump scriptparsetree {} 0x{:x} ({})", outFile.string(), spt->len, hashutils::ExtractTmpScript(spt->name.name));
if (!utils::WriteFile(outFile, spt->buffer, spt->len)) {
LOG_ERROR("Error when dumping {}", outFile.string());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace {

ScriptParseTreeForced* asset{ (ScriptParseTreeForced*)ptr };

const char* n{ hashutils::ExtractTmp("file", asset->name.hash) };
const char* n{ hashutils::ExtractTmp("file", asset->name.name) };
std::filesystem::path outFile{ opt.m_output / "bo4" / "source" / "tables" / "scriptparsetreeforced" / std::format("{}.csv", n) };

std::filesystem::create_directories(outFile.parent_path());
Expand All @@ -35,10 +35,10 @@ namespace {
os << "vm,name";

for (size_t i = 0; i < asset->gscCount; i++) {
os << "\nserver," << hashutils::ExtractTmp("hash", asset->gscScripts[i].hash);
os << "\nserver," << hashutils::ExtractTmp("hash", asset->gscScripts[i].name);
}
for (size_t i = 0; i < asset->cscCount; i++) {
os << "\nclient," << hashutils::ExtractTmp("hash", asset->cscScripts[i].hash);
os << "\nclient," << hashutils::ExtractTmp("hash", asset->cscScripts[i].name);
}
}
};
Expand Down
Loading

0 comments on commit efd5396

Please sign in to comment.