mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
90a7e9b4b9
* see if math works on windows * add dgo * windows debug * windows debug 2 * one more debug try * add extra debug print and change logic for slashes * update * again * try again * remove build game * remove build game * add back build-game * remove runtime from test * test * reduce number of files * go to c++ 14 * big stacks * increase stack size again * clean up cmake files
29 lines
879 B
C++
29 lines
879 B
C++
#include "BinaryWriter.h"
|
|
#include "FileUtil.h"
|
|
#include "DgoWriter.h"
|
|
|
|
void build_dgo(const DgoDescription& description) {
|
|
BinaryWriter writer;
|
|
// dgo header
|
|
writer.add<uint32_t>(description.entries.size());
|
|
writer.add_cstr_len(description.dgo_name.c_str(), 60);
|
|
|
|
for (auto& obj : description.entries) {
|
|
auto obj_data = file_util::read_binary_file(file_util::get_file_path({"data", obj.file_name}));
|
|
// size
|
|
writer.add<uint32_t>(obj_data.size());
|
|
// name
|
|
writer.add_str_len(obj.name_in_dgo, 60);
|
|
// data
|
|
writer.add_data(obj_data.data(), obj_data.size());
|
|
// pad
|
|
while (writer.get_size() & 0xf) {
|
|
writer.add<uint8_t>(0);
|
|
}
|
|
}
|
|
|
|
printf("DGO: %15s %.3f MB\n", description.dgo_name.c_str(),
|
|
(float)(writer.get_size()) / (1 << 20));
|
|
writer.write_to_file(file_util::get_file_path({"out", description.dgo_name}));
|
|
}
|