mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 15:28:58 -04:00
Add addition and subtraction for integers, build macros, dgo building, and build/load test (#35)
* 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
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#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}));
|
||||
}
|
||||
Reference in New Issue
Block a user