Temp commit. Auth3D Object HRC breakdown

This commit is contained in:
korenkonder
2022-12-10 03:14:07 +03:00
parent a15befd8fb
commit c96c52d4d3
198 changed files with 26200 additions and 14772 deletions
+3 -1
View File
@@ -108,7 +108,9 @@ bool auth_3d_database_file::load_file(void* data, const char* path, const char*
if (t)
file_len = t - file;
std::string s = path + std::string(file, file_len);
std::string s;
s.assign(path);
s.append(file, file_len);
auth_3d_database_file* auth_3d_db = (auth_3d_database_file*)data;
auth_3d_db->read(s.c_str());
+2 -2
View File
@@ -55,7 +55,7 @@ struct auth_3d_database_file {
int32_t uid_max;
auth_3d_database_file();
virtual ~auth_3d_database_file();
~auth_3d_database_file();
void read(const char* path);
void read(const wchar_t* path);
@@ -72,7 +72,7 @@ struct auth_3d_database {
std::vector<auth_3d_database_uid> uid;
auth_3d_database();
virtual ~auth_3d_database();
~auth_3d_database();
void add(auth_3d_database_file* auth_3d_db_file, bool mdata);
int32_t get_category_index(const char* name);
+3 -1
View File
@@ -362,7 +362,9 @@ bool bone_database::load_file(void* data, const char* path, const char* file, ui
if (t)
file_len = t - file;
std::string s = path + std::string(file, file_len);
std::string s;
s.assign(path);
s.append(file, file_len);
bone_database* bone_data = (bone_database*)data;
bone_data->read(s.c_str(), bone_data->modern);
+1 -1
View File
@@ -70,7 +70,7 @@ struct bone_database {
std::vector<bone_database_skeleton> skeleton;
bone_database();
virtual ~bone_database();
~bone_database();
void read(const char* path, bool modern);
void read(const wchar_t* path, bool modern);
+3 -1
View File
@@ -158,7 +158,9 @@ bool itm_table::load_file(void* data, const char* path, const char* file, uint32
if (t)
file_len = t - file;
std::string s = path + std::string(file, file_len);
std::string s;
s.assign(path);
s.append(file, file_len);
itm_table* itm_tbl = (itm_table*)data;
itm_tbl->read(s.c_str());
+1 -1
View File
@@ -183,7 +183,7 @@ struct itm_table {
std::vector<itm_table_dbgset> dbgset;
itm_table();
virtual ~itm_table();
~itm_table();
void read(const char* path);
void read(const wchar_t* path);
+3 -1
View File
@@ -120,7 +120,9 @@ bool motion_database_file::load_file(void* data, const char* path, const char* f
if (t)
file_len = t - file;
std::string s = path + std::string(file, file_len);
std::string s;
s.assign(path);
s.append(file, file_len);
motion_database_file* mot_db = (motion_database_file*)data;
mot_db->read(s.c_str());
+2 -2
View File
@@ -52,7 +52,7 @@ struct motion_database_file {
std::vector<motion_set_info_file> motion_set;
motion_database_file();
virtual ~motion_database_file();
~motion_database_file();
void read(const char* path);
void read(const wchar_t* path);
@@ -69,7 +69,7 @@ struct motion_database {
std::vector<motion_set_info> motion_set;
motion_database();
virtual ~motion_database();
~motion_database();
void add(motion_database_file* mot_db_file);
+3 -1
View File
@@ -229,7 +229,9 @@ bool object_database_file::load_file(void* data, const char* path, const char* f
if (t)
file_len = t - file;
std::string s = path + std::string(file, file_len);
std::string s;
s.assign(path);
s.append(file, file_len);
object_database_file* obj_db = (object_database_file*)data;
obj_db->read(s.c_str(), obj_db->modern);
+17 -2
View File
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
#include "../default.hpp"
#include "../hash.hpp"
struct object_info {
uint32_t id;
@@ -17,6 +18,8 @@ struct object_info {
object_info(uint32_t id, uint32_t set_id);
bool is_null();
bool not_null();
bool is_null_modern();
bool not_null_modern();
};
inline bool object_info::is_null() {
@@ -27,6 +30,18 @@ inline bool object_info::not_null() {
return id != (uint32_t)-1 || set_id != (uint32_t)-1;
}
inline bool object_info::is_null_modern() {
return id == (uint32_t)-1 && set_id == (uint32_t)-1
|| id == hash_murmurhash_empty || id == hash_murmurhash_null
|| set_id == hash_murmurhash_empty || set_id == hash_murmurhash_null;
}
inline bool object_info::not_null_modern() {
return id != (uint32_t)-1 || set_id != (uint32_t)-1
|| (id != hash_murmurhash_empty && id != hash_murmurhash_null
&& set_id != hash_murmurhash_empty && set_id != hash_murmurhash_null);
}
inline bool operator >(const object_info& left, const object_info& right) {
return left.set_id > right.set_id && left.id > right.id;
}
@@ -104,7 +119,7 @@ struct object_database_file {
std::vector<object_set_info_file> object_set;
object_database_file();
virtual ~object_database_file();
~object_database_file();
void read(const char* path, bool modern);
void read(const wchar_t* path, bool modern);
@@ -120,7 +135,7 @@ struct object_database {
std::vector<object_set_info> object_set;
object_database();
virtual ~object_database();
~object_database();
void add(object_database_file* obj_db_file);
+3 -1
View File
@@ -235,7 +235,9 @@ bool sprite_database_file::load_file(void* data, const char* path, const char* f
if (t)
file_len = t - file;
std::string s = path + std::string(file, file_len);
std::string s;
s.assign(path);
s.append(file, file_len);
sprite_database_file* spr_db = (sprite_database_file*)data;
spr_db->read(s.c_str(), spr_db->modern);
+2 -2
View File
@@ -82,7 +82,7 @@ struct sprite_database_file {
std::vector<sprite_set_file> sprite_set;
sprite_database_file();
virtual ~sprite_database_file();
~sprite_database_file();
void read(const char* path, bool modern);
void read(const wchar_t* path, bool modern);
@@ -98,7 +98,7 @@ struct sprite_database {
std::vector<sprite_set> sprite_set;
sprite_database();
virtual ~sprite_database();
~sprite_database();
void add(sprite_database_file* spr_db_file);
};
+53 -23
View File
@@ -16,10 +16,23 @@ static void stage_database_file_classic_write_inner(stage_database_file* stage_d
static void stage_database_file_modern_read_inner(stage_database_file* stage_data, stream& s, uint32_t header_length);
static void stage_database_file_modern_write_inner(stage_database_file* stage_data, stream& s);
const stage_effects stage_effects_default;
const stage_effects_modern stage_effects_modern_default;
stage_effects::stage_effects() : field_0(), field_20() {
field_0[0] = -1;
field_20[0] = -1;
}
stage_effects_modern::stage_effects_modern() {
field_0[0] = -1;
field_20[0] = -1;
}
stage_data_file::stage_data_file() : id(), object_set_id(), lens_flare_texture(), lens_shaft_texture(),
lens_ghost_texture(), unknown(), render_texture(), movie_texture(), reflect_type(), refract_enable(),
reflect(), reflect_data(), refract(), refract_data(), flags(), ring_rectangle_x(), ring_rectangle_y(),
ring_rectangle_width(), ring_rectangle_height(), ring_height(), ring_out_height(), effects() {
ring_rectangle_width(), ring_rectangle_height(), ring_height(), ring_out_height(), effects_init() {
lens_shaft_inv_scale = 1.0f;
}
@@ -31,7 +44,7 @@ stage_data_modern_file::stage_data_modern_file() : unknown(), render_texture(),
render_texture_flag(), movie_texture(), movie_texture_flag(), field_04(), field_04_flag(), field_05(),
field_05_flag(), field_06(), field_06_flag(), field_07(), field_07_flag(), field_08(), field_09(),
field_10(), field_11(), field_12(), ring_rectangle_x(), ring_rectangle_y(), ring_rectangle_width(),
ring_rectangle_height(), ring_height(), ring_out_height(), field_13(), effects() {
ring_rectangle_height(), ring_height(), ring_out_height(), field_13(), effects_init() {
hash = hash_murmurhash_empty;
lens_shaft_inv_scale = 1.0f;
}
@@ -43,7 +56,7 @@ stage_data_modern_file::~stage_data_modern_file() {
stage_data::stage_data() : id(), object_set_id(), lens_flare_texture(), lens_shaft_texture(),
lens_ghost_texture(), unknown(), render_texture(), movie_texture(), reflect_type(), refract_enable(),
reflect(), reflect_data(), refract(), refract_data(), flags(), ring_rectangle_x(), ring_rectangle_y(),
ring_rectangle_width(), ring_rectangle_height(), ring_height(), ring_out_height(), effects() {
ring_rectangle_width(), ring_rectangle_height(), ring_height(), ring_out_height(), effects_init() {
name_hash = hash_murmurhash_empty;
lens_shaft_inv_scale = 1.0f;
}
@@ -56,7 +69,7 @@ stage_data_modern::stage_data_modern() : unknown(), render_texture(),
render_texture_flag(), movie_texture(), movie_texture_flag(), field_04(), field_04_flag(), field_05(),
field_05_flag(), field_06(), field_06_flag(), field_07(), field_07_flag(), field_08(), field_09(),
field_10(), field_11(), field_12(), ring_rectangle_x(), ring_rectangle_y(), ring_rectangle_width(),
ring_rectangle_height(), ring_height(), ring_out_height(), field_13(), effects() {
ring_rectangle_height(), ring_height(), ring_out_height(), field_13(), effects_init() {
hash = hash_murmurhash_empty;
auth_3d_name_hash = hash_murmurhash_empty;
lens_shaft_inv_scale = 1.0f;
@@ -232,7 +245,9 @@ bool stage_database_file::load_file(void* data, const char* path, const char* fi
if (t)
file_len = t - file;
std::string s = path + std::string(file, file_len);
std::string s;
s.assign(path);
s.append(file, file_len);
stage_database_file* stage_data = (stage_database_file*)data;
stage_data->read(s.c_str(), stage_data->modern);
@@ -271,9 +286,9 @@ void stage_database::add(stage_database_file* stage_data_file) {
}
data->id = i.id;
data->name = i.name;
data->name.assign(i.name);
data->name_hash = hash_string_murmurhash(data->name);
data->auth_3d_name = i.auth_3d_name;
data->auth_3d_name.assign(i.auth_3d_name);
data->object_set_id = i.object_set_id;
data->object_ground = i.object_ground;
data->object_ring = i.object_ring;
@@ -303,7 +318,8 @@ void stage_database::add(stage_database_file* stage_data_file) {
data->ring_height = i.ring_height;
data->ring_out_height = i.ring_out_height;
data->effects = i.effects;
data->auth_3d_ids = i.auth_3d_ids;
data->effects_init = i.effects_init;
data->auth_3d_ids.assign(i.auth_3d_ids.begin(), i.auth_3d_ids.end());
}
for (stage_data_modern_file& i : stage_data_file->stage_modern) {
@@ -322,8 +338,8 @@ void stage_database::add(stage_database_file* stage_data_file) {
}
data->hash = i.hash;
data->name = i.name;
data->auth_3d_name = i.auth_3d_name;
data->name.assign(i.name);
data->auth_3d_name.assign(i.auth_3d_name);
data->auth_3d_name_hash = hash_string_murmurhash(data->auth_3d_name);
data->object_ground = i.object_ground;
data->object_sky = i.object_sky;
@@ -355,8 +371,6 @@ void stage_database::add(stage_database_file* stage_data_file) {
data->ring_rectangle_height = i.ring_rectangle_height;
data->ring_height = i.ring_height;
data->ring_out_height = i.ring_out_height;
data->effects = i.effects;
data->auth_3d_ids = i.auth_3d_ids;
data->render_texture = i.render_texture;
data->render_texture_flag = i.render_texture_flag;
data->movie_texture = i.movie_texture;
@@ -369,7 +383,8 @@ void stage_database::add(stage_database_file* stage_data_file) {
data->ring_out_height = i.ring_out_height;
data->field_13 = i.field_13;
data->effects = i.effects;
data->auth_3d_ids = i.auth_3d_ids;
data->effects_init = i.effects_init;
data->auth_3d_ids.assign(i.auth_3d_ids.begin(), i.auth_3d_ids.end());
}
}
@@ -381,7 +396,7 @@ void stage_database::add(stage_database_file* stage_data_file) {
::stage_data_modern* stage_database::get_stage_data_modern(uint32_t stage_hash) {
for (::stage_data_modern& i : stage_modern)
if (stage_hash == i.hash)
if (i.hash == stage_hash)
return &i;
return 0;
}
@@ -394,12 +409,25 @@ int32_t stage_database::get_stage_index(const char* name) {
return -1;
}
const char* stage_database::get_stage_name(int32_t stage_index) {
if (stage_index >= 0 && stage_index < stage_data.size())
return stage_data[stage_index].name.c_str();
return 0;
}
const char* stage_database::get_stage_name_modern(uint32_t stage_hash) {
for (::stage_data_modern& i : stage_modern)
if (i.hash == stage_hash)
return i.name.c_str();
return 0;
}
static void stage_database_file_classic_read_inner(stage_database_file* stage_data, stream& s) {
int32_t count = s.read_int32_t();
int32_t stages_offset = s.read_int32_t();
int32_t stage_effects_offset = s.read_int32_t();
int32_t auth3d_id_counts_offset = s.read_int32_t();
int32_t auth3d_ids_offsets_offset = s.read_int32_t();
int32_t auth_3d_ids_offsets_offset = s.read_int32_t();
int32_t size = (stage_effects_offset - stages_offset) / count;
stage_data->format = size == 104 ? STAGE_DATA_AC
@@ -522,6 +550,7 @@ static void stage_database_file_classic_read_inner(stage_database_file* stage_da
for (int32_t i = 0; i < count; i++) {
stage_data_file* stage = &stage_data->stage_data[i];
stage_effects* effects = &stage->effects;
stage->effects_init = true;
for (int32_t j = 0; j < 8; j++)
effects->field_0[j] = s.read_uint32_t();
@@ -539,7 +568,7 @@ static void stage_database_file_classic_read_inner(stage_database_file* stage_da
}
s.position_pop();
s.position_push(auth3d_ids_offsets_offset, SEEK_SET);
s.position_push(auth_3d_ids_offsets_offset, SEEK_SET);
for (int32_t i = 0; i < count; i++) {
stage_data_file* stage = &stage_data->stage_data[i];
@@ -647,7 +676,8 @@ static void stage_database_file_modern_read_inner(stage_database_file* stage_dat
if (is_x)
stage->field_13 = s.read_uint32_t_reverse_endianness();
stage_effects* effects = &stage->effects;
stage_effects_modern* effects = &stage->effects;
stage->effects_init = true;
for (int32_t j = 0; j < 8; j++)
effects->field_0[j] = s.read_uint32_t_reverse_endianness();
@@ -658,20 +688,20 @@ static void stage_database_file_modern_read_inner(stage_database_file* stage_dat
if (is_x)
s.read_uint32_t_reverse_endianness();
int32_t auth3d_ids_count = s.read_int32_t_reverse_endianness();
int64_t auth3d_ids_offset = s.read_offset(header_length, is_x);
int32_t auth_3d_ids_count = s.read_int32_t_reverse_endianness();
int64_t auth_3d_ids_offset = s.read_offset(header_length, is_x);
if (is_x)
s.read_uint32_t_reverse_endianness();
if (!auth3d_ids_offset) {
if (!auth_3d_ids_offset) {
stage->auth_3d_ids.clear();
stage->auth_3d_ids.shrink_to_fit();
continue;
}
s.position_push(auth3d_ids_offset, SEEK_SET);
for (int32_t j = 0; j < auth3d_ids_count; j++)
s.position_push(auth_3d_ids_offset, SEEK_SET);
for (int32_t j = 0; j < auth_3d_ids_count; j++)
if (s.read_uint32_t() == hash_murmurhash_empty) {
stage->auth_3d_ids.resize(j);
stage->auth_3d_ids.shrink_to_fit();
@@ -680,7 +710,7 @@ static void stage_database_file_modern_read_inner(stage_database_file* stage_dat
s.position_pop();
if (stage->auth_3d_ids.size()) {
s.position_push(auth3d_ids_offset, SEEK_SET);
s.position_push(auth_3d_ids_offset, SEEK_SET);
for (uint32_t& j : stage->auth_3d_ids)
j = s.read_int32_t();
s.position_pop();
+22 -4
View File
@@ -62,6 +62,15 @@ struct stage_data_refract {
struct stage_effects {
int32_t field_0[8];
int32_t field_20[16];
stage_effects();
};
struct stage_effects_modern {
uint32_t field_0[8];
int32_t field_20[16];
stage_effects_modern();
};
struct stage_data_file {
@@ -97,6 +106,7 @@ struct stage_data_file {
float_t ring_height;
float_t ring_out_height;
stage_effects effects;
bool effects_init;
std::vector<int32_t> auth_3d_ids;
stage_data_file();
@@ -138,7 +148,8 @@ struct stage_data_modern_file {
float_t ring_height;
float_t ring_out_height;
uint32_t field_13;
stage_effects effects;
stage_effects_modern effects;
bool effects_init;
std::vector<uint32_t> auth_3d_ids;
stage_data_modern_file();
@@ -179,6 +190,7 @@ struct stage_data {
float_t ring_height;
float_t ring_out_height;
stage_effects effects;
bool effects_init;
std::vector<int32_t> auth_3d_ids;
stage_data();
@@ -221,7 +233,8 @@ struct stage_data_modern {
float_t ring_height;
float_t ring_out_height;
uint32_t field_13;
stage_effects effects;
stage_effects_modern effects;
bool effects_init;
std::vector<uint32_t> auth_3d_ids;
stage_data_modern();
@@ -239,7 +252,7 @@ struct stage_database_file {
std::vector<stage_data_modern_file> stage_modern;
stage_database_file();
virtual ~stage_database_file();
~stage_database_file();
void read(const char* path, bool modern);
void read(const wchar_t* path, bool modern);
@@ -256,11 +269,16 @@ struct stage_database {
std::vector<stage_data_modern> stage_modern;
stage_database();
virtual ~stage_database();
~stage_database();
void add(stage_database_file* stage_data_file);
::stage_data* get_stage_data(int32_t stage_index);
::stage_data_modern* get_stage_data_modern(uint32_t stage_hash);
int32_t get_stage_index(const char* name);
const char* get_stage_name(int32_t stage_index);
const char* get_stage_name_modern(uint32_t stage_hash);
};
extern const stage_effects stage_effects_default;
extern const stage_effects_modern stage_effects_modern_default;
+3 -1
View File
@@ -203,7 +203,9 @@ bool texture_database_file::load_file(void* data, const char* path, const char*
if (t)
file_len = t - file;
std::string s = path + std::string(file, file_len);
std::string s;
s.assign(path);
s.append(file, file_len);
texture_database_file* tex_db = (texture_database_file*)data;
tex_db->read(s.c_str(), tex_db->modern);
+2 -2
View File
@@ -35,7 +35,7 @@ struct texture_database_file {
std::vector<texture_info_file> texture;
texture_database_file();
virtual ~texture_database_file();
~texture_database_file();
void read(const char* path, bool modern);
void read(const wchar_t* path, bool modern);
@@ -51,7 +51,7 @@ struct texture_database {
std::vector<texture_info> texture;
texture_database();
virtual ~texture_database();
~texture_database();
void add(texture_database_file* tex_db_file);