mirror of
https://github.com/open-goal/jak-project
synced 2026-06-06 19:52:01 -04:00
1254d93fbe
This adds support for generating pairs with `DataObjectGenerator` and defining your own regions and `actor-group`s in custom levels.
36 lines
1.0 KiB
C++
36 lines
1.0 KiB
C++
#include "FileInfo.h"
|
|
|
|
#include <chrono>
|
|
|
|
#include "common/versions/versions.h"
|
|
|
|
#include "goalc/data_compiler/DataObjectGenerator.h"
|
|
#include <fmt/chrono.h>
|
|
|
|
std::string get_current_time_and_date() {
|
|
auto const now = std::chrono::floor<std::chrono::seconds>(std::chrono::system_clock::now());
|
|
std::time_t const t = std::chrono::system_clock::to_time_t(now);
|
|
std::tm tm{};
|
|
#if defined(_WIN32)
|
|
localtime_s(&tm, &t);
|
|
#else
|
|
localtime_r(&t, &tm);
|
|
#endif
|
|
return fmt::format("{:%a %b %d %H:%M:%S %Y}", tm);
|
|
}
|
|
|
|
size_t FileInfo::add_to_object_file(DataObjectGenerator& gen) const {
|
|
gen.align_to_basic();
|
|
gen.add_type_tag("file-info");
|
|
size_t offset = gen.current_offset_bytes();
|
|
gen.add_type_tag(file_type);
|
|
gen.add_ref_to_string_in_pool(file_name);
|
|
gen.add_word(major_version);
|
|
gen.add_word(minor_version);
|
|
gen.add_ref_to_string_in_pool(maya_file_name);
|
|
gen.add_ref_to_string_in_pool(tool_debug + " " + get_current_time_and_date() + "\n");
|
|
gen.add_ref_to_string_in_pool(mdb_file_name);
|
|
|
|
return offset;
|
|
}
|