mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-13 17:48:28 +03:00
Temp commit. Will delete later. Osage stuff
This commit is contained in:
@@ -38,6 +38,8 @@ typedef struct data_test_auth_3d_test {
|
||||
bool auth_3d_uid_load;
|
||||
bool stage_load;
|
||||
|
||||
vec2 a3d_stage_window_pos;
|
||||
|
||||
render_context* rctx;
|
||||
|
||||
auth_3d_farc farc;
|
||||
@@ -77,7 +79,7 @@ bool data_test_auth_3d_test_init(class_data* data, render_context* rctx) {
|
||||
|
||||
auth_3d_test->category = vector_empty(data_test_auth_3d_test_category);
|
||||
vector_data_test_auth_3d_test_category_reserve(&auth_3d_test->category,
|
||||
auth_3d_db_cat->end - auth_3d_db_cat->begin);
|
||||
vector_length(*auth_3d_db_cat));
|
||||
for (auth_3d_database_category* i = auth_3d_db_cat->begin;
|
||||
i != auth_3d_db_cat->end; i++) {
|
||||
data_test_auth_3d_test_category* cat
|
||||
@@ -86,7 +88,7 @@ bool data_test_auth_3d_test_init(class_data* data, render_context* rctx) {
|
||||
cat->index = -1;
|
||||
cat->uid = vector_empty(int32_t);
|
||||
|
||||
vector_int32_t_reserve(&cat->uid, i->uid.end - i->uid.begin);
|
||||
vector_int32_t_reserve(&cat->uid, vector_length(i->uid));
|
||||
for (int32_t* j = i->uid.begin; j != i->uid.end; j++) {
|
||||
if (!uids[*j].enabled)
|
||||
continue;
|
||||
@@ -94,7 +96,7 @@ bool data_test_auth_3d_test_init(class_data* data, render_context* rctx) {
|
||||
vector_int32_t_push_back(&cat->uid, &uids[*j].org_uid);
|
||||
}
|
||||
|
||||
if (cat->uid.end - cat->uid.begin > 0)
|
||||
if (vector_length(cat->uid) > 0)
|
||||
cat->index = 0;
|
||||
}
|
||||
|
||||
@@ -121,10 +123,10 @@ bool data_test_auth_3d_test_init(class_data* data, render_context* rctx) {
|
||||
auth_3d_test->auth_3d_load = false;
|
||||
auth_3d_test->auth_3d_uid_load = false;
|
||||
|
||||
if (auth_3d_test->category.end - auth_3d_test->category.begin > 0) {
|
||||
if (vector_length(auth_3d_test->category) > 0) {
|
||||
data_test_auth_3d_test_category* cat = &auth_3d_test->category.begin[0];
|
||||
|
||||
if (cat->uid.end - cat->uid.begin > 0) {
|
||||
if (vector_length(cat->uid) > 0) {
|
||||
auth_3d_test->auth_3d_load = true;
|
||||
auth_3d_test->auth_3d_uid_load = true;
|
||||
auth_3d_test->auth_3d_uid = cat->uid.begin[0];
|
||||
@@ -137,11 +139,12 @@ bool data_test_auth_3d_test_init(class_data* data, render_context* rctx) {
|
||||
stage_database* stage_data = &rctx->data->data_ft.stage_data;
|
||||
|
||||
auth_3d_test->stage = vector_ptr_empty(char);
|
||||
vector_ptr_char_reserve(&auth_3d_test->stage,
|
||||
stage_data->stage.end - stage_data->stage.begin);
|
||||
vector_ptr_char_reserve(&auth_3d_test->stage, vector_length(stage_data->stage));
|
||||
for (stage_info* i = stage_data->stage.begin; i != stage_data->stage.end; i++)
|
||||
*vector_ptr_char_reserve_back(&auth_3d_test->stage) = string_data(&i->name);
|
||||
|
||||
auth_3d_test->a3d_stage_window_pos = (vec2){ 200.0f, 100.0f };
|
||||
|
||||
auth_3d_test->trans_x = 0.0f;
|
||||
auth_3d_test->trans_z = 0.0f;
|
||||
auth_3d_test->rot_y = 0.0f;
|
||||
@@ -241,7 +244,7 @@ void data_test_auth_3d_test_imgui(class_data* data) {
|
||||
if (auth_3d_category_index != auth_3d_test->auth_3d_category_index) {
|
||||
data_test_auth_3d_test_category* cat = &auth_3d_db_cat->begin[auth_3d_category_index];
|
||||
|
||||
if (cat->uid.end - cat->uid.begin > 0) {
|
||||
if (vector_length(cat->uid) > 0) {
|
||||
auth_3d_test->auth_3d_load = true;
|
||||
auth_3d_test->auth_3d_uid_load = true;
|
||||
auth_3d_test->auth_3d_uid = cat->uid.begin[cat->index];
|
||||
@@ -379,8 +382,8 @@ void data_test_auth_3d_test_imgui(class_data* data) {
|
||||
float_t x = w;
|
||||
float_t y = 0.0f;
|
||||
|
||||
w = min((float_t)width, 200.0f);
|
||||
h = min((float_t)height, 100.0f);
|
||||
w = min((float_t)width, auth_3d_test->a3d_stage_window_pos.x);
|
||||
h = min((float_t)height, auth_3d_test->a3d_stage_window_pos.y);
|
||||
|
||||
igSetNextWindowPos((ImVec2) { x, y }, ImGuiCond_Appearing, ImVec2_Empty);
|
||||
igSetNextWindowSize((ImVec2) { w, h }, ImGuiCond_Always);
|
||||
@@ -547,8 +550,7 @@ End:
|
||||
bool data_test_auth_3d_test_dispose(class_data* data) {
|
||||
data_test_auth_3d_test* auth_3d_test = data->data;
|
||||
if (auth_3d_test) {
|
||||
memset(auth_3d_test->stage.begin, 0,
|
||||
sizeof(char*) * (auth_3d_test->stage.end - auth_3d_test->stage.begin));
|
||||
memset(auth_3d_test->stage.begin, 0, sizeof(char*) * vector_length(auth_3d_test->stage));
|
||||
|
||||
vector_data_test_auth_3d_test_category_free(&auth_3d_test->category,
|
||||
data_test_auth_3d_test_category_free);
|
||||
|
||||
@@ -56,7 +56,7 @@ bool data_test_glitter_test_init(class_data* data, render_context* rctx) {
|
||||
|
||||
data_test_glitter_test_struct* glt_test = data->data;
|
||||
if (glt_test) {
|
||||
data_struct_get_directory_files(&data_list[DATA_AFT], "rom\\particle\\", &glt_test->files);
|
||||
data_struct_get_directory_files(&data_list[DATA_AFT], "rom/particle/", &glt_test->files);
|
||||
for (data_struct_file* i = glt_test->files.begin; i != glt_test->files.end;)
|
||||
if (str_utils_check_ends_with(string_data(&i->name), ".farc")) {
|
||||
char* temp = str_utils_get_without_extension(string_data(&i->name));
|
||||
@@ -69,9 +69,9 @@ bool data_test_glitter_test_init(class_data* data, render_context* rctx) {
|
||||
vector_data_struct_file_erase(&glt_test->files,
|
||||
i - glt_test->files.begin, data_struct_file_free);
|
||||
|
||||
glt_test->path = glt_test->files.end - glt_test->files.begin > 0
|
||||
glt_test->path = vector_length(glt_test->files) > 0
|
||||
? string_data(&glt_test->files.begin[0].path) : 0;
|
||||
glt_test->file = glt_test->files.end - glt_test->files.begin > 0
|
||||
glt_test->file = vector_length(glt_test->files) > 0
|
||||
? string_data(&glt_test->files.begin[0].name) : 0;
|
||||
glt_test->stage_test = false;
|
||||
glt_test->rctx = rctx;
|
||||
@@ -122,8 +122,7 @@ void data_test_glitter_test_imgui(class_data* data) {
|
||||
|
||||
int32_t file_index_old = file_index;
|
||||
imguiColumnComboBoxConfigFile("File", glt_test->files.begin,
|
||||
glt_test->files.end - glt_test->files.begin,
|
||||
&file_index, 0, false, &data->imgui_focus);
|
||||
vector_length(glt_test->files), &file_index, 0, false, &data->imgui_focus);
|
||||
|
||||
if (file_index != file_index_old) {
|
||||
glt_test->path = string_data(&glt_test->files.begin[file_index].path);
|
||||
@@ -252,7 +251,7 @@ void data_test_glitter_test_render(class_data* data) {
|
||||
glt_test->frame_counter = 0;
|
||||
}
|
||||
|
||||
uint64_t hash = hash_utf8_fnv1a64m(glt_test->file);
|
||||
uint64_t hash = hash_utf8_fnv1a64m(glt_test->file, false);
|
||||
if (glt_test->input_auto && !glitter_particle_manager_check_scene(GPM_VAL, hash)) {
|
||||
if (glitter_particle_manager_check_effect_group(GPM_VAL, hash))
|
||||
goto load;
|
||||
|
||||
@@ -150,7 +150,7 @@ bool data_test_stage_test_init(class_data* data, render_context* rctx) {
|
||||
*j = temp;
|
||||
}
|
||||
|
||||
if (stage_pv->end - stage_pv->begin > 0)
|
||||
if (vector_length(*stage_pv) > 0)
|
||||
stage_test->pv_id = stage_pv->begin[0].pv_id;
|
||||
|
||||
stage* stg = rctx->stage;
|
||||
@@ -161,7 +161,7 @@ bool data_test_stage_test_init(class_data* data, render_context* rctx) {
|
||||
}
|
||||
|
||||
stage_info* info = stg->stage;
|
||||
if (info - stg_info->begin >= 0 && info - stg_info->begin < stg_info->end - stg_info->begin) {
|
||||
if (info - stg_info->begin >= 0 && info - stg_info->begin < vector_length(*stg_info)) {
|
||||
stage_test->stage_index = (int32_t)(info - stg_info->begin);
|
||||
stage_test->stage_name = string_data(&info->name);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include "data_view.h"
|
||||
#include "data_view/auth_3d.h"
|
||||
#include "data_view/draw_task.h"
|
||||
#include "data_view/object.h"
|
||||
#include "data_view/texture.h"
|
||||
|
||||
classes_struct data_view_classes[] = {
|
||||
[DATA_VIEW_AUTH_3D] = {
|
||||
@@ -17,7 +19,7 @@ classes_struct data_view_classes[] = {
|
||||
.hide = CLASSES_STRUCT_NO_FUNC,
|
||||
.input = data_view_auth_3d_input,
|
||||
.imgui = data_view_auth_3d_imgui,
|
||||
.render = data_view_auth_3d_render,
|
||||
.render = CLASSES_STRUCT_NO_FUNC,
|
||||
.show = CLASSES_STRUCT_NO_FUNC,
|
||||
.sound = CLASSES_STRUCT_NO_FUNC,
|
||||
.dispose = data_view_auth_3d_dispose,
|
||||
@@ -39,7 +41,7 @@ classes_struct data_view_classes[] = {
|
||||
.hide = CLASSES_STRUCT_NO_FUNC,
|
||||
.input = data_view_draw_task_input,
|
||||
.imgui = data_view_draw_task_imgui,
|
||||
.render = data_view_draw_task_render,
|
||||
.render = CLASSES_STRUCT_NO_FUNC,
|
||||
.show = CLASSES_STRUCT_NO_FUNC,
|
||||
.sound = CLASSES_STRUCT_NO_FUNC,
|
||||
.dispose = data_view_draw_task_dispose,
|
||||
@@ -52,4 +54,48 @@ classes_struct data_view_classes[] = {
|
||||
.sub_classes = 0,
|
||||
.sub_classes_count = 0,
|
||||
},
|
||||
[DATA_VIEW_OBJECT] = {
|
||||
.name = "Object##Data View",
|
||||
.flags = CLASSES_IN_CONTEXT_MENU,
|
||||
.init = data_view_object_init,
|
||||
.draw = CLASSES_STRUCT_NO_FUNC,
|
||||
.drop = CLASSES_STRUCT_NO_FUNC,
|
||||
.hide = CLASSES_STRUCT_NO_FUNC,
|
||||
.input = data_view_object_input,
|
||||
.imgui = data_view_object_imgui,
|
||||
.render = CLASSES_STRUCT_NO_FUNC,
|
||||
.show = CLASSES_STRUCT_NO_FUNC,
|
||||
.sound = CLASSES_STRUCT_NO_FUNC,
|
||||
.dispose = data_view_object_dispose,
|
||||
.data = {
|
||||
.lock = 0,
|
||||
.flags = CLASS_DISPOSED | CLASS_HIDDEN,
|
||||
.imgui_focus = false,
|
||||
.data = CLASS_DATA_NO_DATA,
|
||||
},
|
||||
.sub_classes = 0,
|
||||
.sub_classes_count = 0,
|
||||
},
|
||||
[DATA_VIEW_TEXTURE] = {
|
||||
.name = "Texture##Data View",
|
||||
.flags = CLASSES_IN_CONTEXT_MENU,
|
||||
.init = data_view_texture_init,
|
||||
.draw = CLASSES_STRUCT_NO_FUNC,
|
||||
.drop = CLASSES_STRUCT_NO_FUNC,
|
||||
.hide = CLASSES_STRUCT_NO_FUNC,
|
||||
.input = data_view_texture_input,
|
||||
.imgui = data_view_texture_imgui,
|
||||
.render = CLASSES_STRUCT_NO_FUNC,
|
||||
.show = CLASSES_STRUCT_NO_FUNC,
|
||||
.sound = CLASSES_STRUCT_NO_FUNC,
|
||||
.dispose = data_view_texture_dispose,
|
||||
.data = {
|
||||
.lock = 0,
|
||||
.flags = CLASS_DISPOSED | CLASS_HIDDEN,
|
||||
.imgui_focus = false,
|
||||
.data = CLASS_DATA_NO_DATA,
|
||||
},
|
||||
.sub_classes = 0,
|
||||
.sub_classes_count = 0,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
typedef enum data_view_classes_enum {
|
||||
DATA_VIEW_AUTH_3D,
|
||||
DATA_VIEW_DRAW_TASK,
|
||||
DATA_VIEW_OBJECT,
|
||||
DATA_VIEW_TEXTURE,
|
||||
DATA_VIEW_MAX,
|
||||
} data_view_classes_enum;
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
tree_node_flags = tree_node_base_flags;
|
||||
tree_node_flags |= ImGuiTreeNodeFlags_DefaultOpen;
|
||||
|
||||
if (auth->ambient.end - auth->ambient.begin
|
||||
if (vector_length(auth->ambient) > 1
|
||||
&& igTreeNodeEx_Str("Ambient", tree_node_flags)) {
|
||||
for (auth_3d_ambient* l = auth->ambient.begin;
|
||||
l != auth->ambient.end; l++)
|
||||
@@ -123,7 +123,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
igTreePop();
|
||||
}
|
||||
|
||||
if (auth->auth_2d.end - auth->auth_2d.begin
|
||||
if (vector_length(auth->auth_2d) > 1
|
||||
&& igTreeNodeEx_Str("Auth 2D", tree_node_flags)) {
|
||||
for (string* l = auth->auth_2d.begin;
|
||||
l != auth->auth_2d.end; l++)
|
||||
@@ -133,17 +133,17 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
|
||||
data_view_auth_3d_imgui_auth_3d_camera_auxiliary(&auth->camera_auxiliary);
|
||||
|
||||
if (auth->camera_root.end - auth->camera_root.begin > 1
|
||||
if (vector_length(auth->camera_root) > 1
|
||||
&& igTreeNodeEx_Str("Camera Root", tree_node_flags)) {
|
||||
for (auth_3d_camera_root* l = auth->camera_root.begin;
|
||||
l != auth->camera_root.end; l++)
|
||||
data_view_auth_3d_imgui_auth_3d_camera_root(l, l - auth->camera_root.begin);
|
||||
igTreePop();
|
||||
}
|
||||
else if (auth->camera_root.end - auth->camera_root.begin == 1)
|
||||
else if (vector_length(auth->camera_root) == 1)
|
||||
data_view_auth_3d_imgui_auth_3d_camera_root(&auth->camera_root.begin[0], -1);
|
||||
|
||||
if (auth->chara.end - auth->chara.begin
|
||||
if (vector_length(auth->chara) > 0
|
||||
&& igTreeNodeEx_Str("Chara", tree_node_flags)) {
|
||||
for (auth_3d_chara* l = auth->chara.begin;
|
||||
l != auth->chara.end; l++)
|
||||
@@ -153,7 +153,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
|
||||
data_view_auth_3d_imgui_auth_3d_dof(&auth->dof);
|
||||
|
||||
if (auth->fog.end - auth->fog.begin
|
||||
if (vector_length(auth->fog) > 0
|
||||
&& igTreeNodeEx_Str("Fog", tree_node_flags)) {
|
||||
for (auth_3d_fog* l = auth->fog.begin;
|
||||
l != auth->fog.end; l++)
|
||||
@@ -161,7 +161,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
igTreePop();
|
||||
}
|
||||
|
||||
if (auth->light.end - auth->light.begin
|
||||
if (vector_length(auth->light) > 0
|
||||
&& igTreeNodeEx_Str("Light", tree_node_flags)) {
|
||||
for (auth_3d_light* l = auth->light.begin;
|
||||
l != auth->light.end; l++)
|
||||
@@ -169,7 +169,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
igTreePop();
|
||||
}
|
||||
|
||||
if (auth->m_object_hrc_list.end - auth->m_object_hrc_list.begin
|
||||
if (vector_length(auth->m_object_hrc_list) > 0
|
||||
&& igTreeNodeEx_Str("M Object HRC", tree_node_flags)) {
|
||||
for (auth_3d_m_object_hrc** l = auth->m_object_hrc_list.begin;
|
||||
l != auth->m_object_hrc_list.end; l++)
|
||||
@@ -177,7 +177,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
igTreePop();
|
||||
}
|
||||
|
||||
if (auth->material_list.end - auth->material_list.begin
|
||||
if (vector_length(auth->material_list) > 0
|
||||
&& igTreeNodeEx_Str("Material List", tree_node_flags)) {
|
||||
for (auth_3d_material_list* l = auth->material_list.begin;
|
||||
l != auth->material_list.end; l++)
|
||||
@@ -185,7 +185,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
igTreePop();
|
||||
}
|
||||
|
||||
if (auth->motion.end - auth->motion.begin
|
||||
if (vector_length(auth->motion) > 0
|
||||
&& igTreeNodeEx_Str("Motion", tree_node_flags)) {
|
||||
for (string* l = auth->motion.begin;
|
||||
l != auth->motion.end; l++)
|
||||
@@ -193,7 +193,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
igTreePop();
|
||||
}
|
||||
|
||||
if (auth->object_list.end - auth->object_list.begin
|
||||
if (vector_length(auth->object_list) > 0
|
||||
&& igTreeNodeEx_Str("Object", tree_node_flags)) {
|
||||
for (auth_3d_object** l = auth->object_list.begin;
|
||||
l != auth->object_list.end; l++)
|
||||
@@ -201,7 +201,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
igTreePop();
|
||||
}
|
||||
|
||||
if (auth->object_hrc_list.end - auth->object_hrc_list.begin
|
||||
if (vector_length(auth->object_hrc_list) > 0
|
||||
&& igTreeNodeEx_Str("Object HRC", tree_node_flags)) {
|
||||
for (auth_3d_object_hrc** l = auth->object_hrc_list.begin;
|
||||
l != auth->object_hrc_list.end; l++)
|
||||
@@ -209,7 +209,7 @@ void data_view_auth_3d_imgui(class_data* data) {
|
||||
igTreePop();
|
||||
}
|
||||
|
||||
if (auth->point.end - auth->point.begin
|
||||
if (vector_length(auth->point) > 0
|
||||
&& igTreeNodeEx_Str("Point", tree_node_flags)) {
|
||||
for (auth_3d_point* l = auth->point.begin;
|
||||
l != auth->point.end; l++)
|
||||
@@ -233,10 +233,6 @@ void data_view_auth_3d_input(class_data* data) {
|
||||
input_locked |= data->imgui_focus;
|
||||
}
|
||||
|
||||
void data_view_auth_3d_render(class_data* data) {
|
||||
|
||||
}
|
||||
|
||||
bool data_view_auth_3d_dispose(class_data* data) {
|
||||
return true;
|
||||
}
|
||||
@@ -613,7 +609,7 @@ static void data_view_auth_3d_imgui_auth_3d_m_object_hrc(auth_3d_m_object_hrc* m
|
||||
return;
|
||||
}
|
||||
|
||||
if (moh->instance.end - moh->instance.begin
|
||||
if (vector_length(moh->instance) > 0
|
||||
&& igTreeNodeEx_Str("Instance", tree_node_flags)) {
|
||||
for (auth_3d_object_instance* i = moh->instance.begin; i != moh->instance.end; i++)
|
||||
data_view_auth_3d_imgui_auth_3d_object_instance(i);
|
||||
@@ -622,7 +618,7 @@ static void data_view_auth_3d_imgui_auth_3d_m_object_hrc(auth_3d_m_object_hrc* m
|
||||
|
||||
data_view_auth_3d_imgui_auth_3d_object_model_transform(&moh->model_transform);
|
||||
|
||||
if (moh->node.end - moh->node.begin
|
||||
if (vector_length(moh->node) > 0
|
||||
&& igTreeNodeEx_Str("Node", tree_node_flags)) {
|
||||
for (auth_3d_object_node* i = moh->node.begin; i != moh->node.end; i++)
|
||||
data_view_auth_3d_imgui_auth_3d_object_node(i);
|
||||
@@ -694,7 +690,7 @@ static void data_view_auth_3d_imgui_auth_3d_object(auth_3d_object* o) {
|
||||
|
||||
tree_node_flags = tree_node_base_flags;
|
||||
|
||||
if (o->texture_pattern.end - o->texture_pattern.begin
|
||||
if (vector_length(o->texture_pattern) > 0
|
||||
&& igTreeNodeEx_Str("Texture Pattern", tree_node_flags)) {
|
||||
for (auth_3d_object_texture_pattern* i = o->texture_pattern.begin;
|
||||
i != o->texture_pattern.end; i++)
|
||||
@@ -704,7 +700,7 @@ static void data_view_auth_3d_imgui_auth_3d_object(auth_3d_object* o) {
|
||||
|
||||
tree_node_flags = tree_node_base_flags;
|
||||
|
||||
if (o->texture_transform.end - o->texture_transform.begin
|
||||
if (vector_length(o->texture_transform) > 0
|
||||
&& igTreeNodeEx_Str("Texture Transform", tree_node_flags)) {
|
||||
for (auth_3d_object_texture_transform* i = o->texture_transform.begin;
|
||||
i != o->texture_transform.end; i++)
|
||||
@@ -716,7 +712,7 @@ static void data_view_auth_3d_imgui_auth_3d_object(auth_3d_object* o) {
|
||||
tree_node_flags = tree_node_base_flags;
|
||||
tree_node_flags |= ImGuiTreeNodeFlags_DefaultOpen;
|
||||
|
||||
if (o->children_object.end - o->children_object.begin
|
||||
if (vector_length(o->children_object) > 0
|
||||
&& igTreeNodeEx_Str("Children Object", tree_node_flags)) {
|
||||
for (auth_3d_object** i = o->children_object.begin;
|
||||
i != o->children_object.end; i++)
|
||||
@@ -727,7 +723,7 @@ static void data_view_auth_3d_imgui_auth_3d_object(auth_3d_object* o) {
|
||||
tree_node_flags = tree_node_base_flags;
|
||||
tree_node_flags |= ImGuiTreeNodeFlags_DefaultOpen;
|
||||
|
||||
if (o->children_object_hrc.end - o->children_object_hrc.begin
|
||||
if (vector_length(o->children_object_hrc) > 0
|
||||
&& igTreeNodeEx_Str("Children Object HRC", tree_node_flags)) {
|
||||
for (auth_3d_object_hrc** i = o->children_object_hrc.begin;
|
||||
i != o->children_object_hrc.end; i++)
|
||||
@@ -787,7 +783,7 @@ static void data_view_auth_3d_imgui_auth_3d_object_hrc(auth_3d_object_hrc* oh) {
|
||||
|
||||
tree_node_flags = tree_node_base_flags;
|
||||
|
||||
if (oh->node.end - oh->node.begin
|
||||
if (vector_length(oh->node) > 0
|
||||
&& igTreeNodeEx_Str("Node", tree_node_flags)) {
|
||||
for (auth_3d_object_node* i = oh->node.begin; i != oh->node.end; i++)
|
||||
data_view_auth_3d_imgui_auth_3d_object_node(i);
|
||||
@@ -797,7 +793,7 @@ static void data_view_auth_3d_imgui_auth_3d_object_hrc(auth_3d_object_hrc* oh) {
|
||||
tree_node_flags = tree_node_base_flags;
|
||||
tree_node_flags |= ImGuiTreeNodeFlags_DefaultOpen;
|
||||
|
||||
if (oh->children_object.end - oh->children_object.begin
|
||||
if (vector_length(oh->children_object) > 0
|
||||
&& igTreeNodeEx_Str("Children Object", tree_node_flags)) {
|
||||
for (auth_3d_object** i = oh->children_object.begin;
|
||||
i != oh->children_object.end; i++)
|
||||
@@ -808,7 +804,7 @@ static void data_view_auth_3d_imgui_auth_3d_object_hrc(auth_3d_object_hrc* oh) {
|
||||
tree_node_flags = tree_node_base_flags;
|
||||
tree_node_flags |= ImGuiTreeNodeFlags_DefaultOpen;
|
||||
|
||||
if (oh->children_object_hrc.end - oh->children_object_hrc.begin
|
||||
if (vector_length(oh->children_object_hrc) > 0
|
||||
&& igTreeNodeEx_Str("Children Object HRC", tree_node_flags)) {
|
||||
for (auth_3d_object_hrc** i = oh->children_object_hrc.begin;
|
||||
i != oh->children_object_hrc.end; i++)
|
||||
|
||||
@@ -11,5 +11,4 @@
|
||||
extern bool data_view_auth_3d_init(class_data* data, render_context* rctx);
|
||||
extern void data_view_auth_3d_imgui(class_data* data);
|
||||
extern void data_view_auth_3d_input(class_data* data);
|
||||
extern void data_view_auth_3d_render(class_data* data);
|
||||
extern bool data_view_auth_3d_dispose(class_data* data);
|
||||
|
||||
@@ -118,7 +118,7 @@ void data_view_draw_task_imgui(class_data* data) {
|
||||
|
||||
igPushID_Int(i);
|
||||
vector_ptr_draw_task* draw_tasks = &draw_task_array[i];
|
||||
size_t count = draw_tasks->end - draw_tasks->begin;
|
||||
size_t count = vector_length(*draw_tasks);
|
||||
bool enable = count > 0;
|
||||
imguiDisableElementPush(enable);
|
||||
if (!igTreeNodeEx_StrStr("", tree_node_flags,
|
||||
@@ -225,10 +225,6 @@ void data_view_draw_task_input(class_data* data) {
|
||||
input_locked |= data->imgui_focus;
|
||||
}
|
||||
|
||||
void data_view_draw_task_render(class_data* data) {
|
||||
|
||||
}
|
||||
|
||||
bool data_view_draw_task_dispose(class_data* data) {
|
||||
data_view_draw_task* data_view = data->data;
|
||||
if (data_view) {
|
||||
|
||||
@@ -11,5 +11,4 @@
|
||||
extern bool data_view_draw_task_init(class_data* data, render_context* rctx);
|
||||
extern void data_view_draw_task_imgui(class_data* data);
|
||||
extern void data_view_draw_task_input(class_data* data);
|
||||
extern void data_view_draw_task_render(class_data* data);
|
||||
extern bool data_view_draw_task_dispose(class_data* data);
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "object.h"
|
||||
#include "../../../CRE/render_context.h"
|
||||
#include "../imgui_helper.h"
|
||||
|
||||
typedef struct data_view_object {
|
||||
render_context* rctx;
|
||||
} data_view_object;
|
||||
|
||||
extern int32_t width;
|
||||
extern int32_t height;
|
||||
extern bool input_locked;
|
||||
|
||||
const char* data_view_object_window_title = "Object##Data Viewer";
|
||||
|
||||
bool data_view_object_init(class_data* data, render_context* rctx) {
|
||||
data->data = force_malloc(sizeof(data_view_object));
|
||||
data_view_object* data_view = data->data;
|
||||
if (data_view) {
|
||||
data_view->rctx = rctx;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void data_view_object_imgui(class_data* data) {
|
||||
ImGuiIO* io = igGetIO();
|
||||
ImGuiStyle* style = igGetStyle();
|
||||
ImFont* font = igGetFont();
|
||||
|
||||
float_t w = min((float_t)width, 360.0f);
|
||||
float_t h = min((float_t)height, 480.0f);
|
||||
|
||||
igSetNextWindowPos(ImVec2_Empty, ImGuiCond_Appearing, ImVec2_Empty);
|
||||
igSetNextWindowSize((ImVec2) { w, h }, ImGuiCond_Appearing);
|
||||
|
||||
data->imgui_focus = false;
|
||||
bool open = data->flags & CLASS_HIDDEN ? false : true;
|
||||
bool collapsed = !igBegin(data_view_object_window_title, &open, 0);
|
||||
if (!open) {
|
||||
data->flags |= CLASS_HIDE;
|
||||
goto End;
|
||||
}
|
||||
else if (collapsed)
|
||||
goto End;
|
||||
|
||||
data_view_object* data_view = data->data;
|
||||
if (!data_view)
|
||||
goto End;
|
||||
|
||||
render_context* rctx = data_view->rctx;
|
||||
|
||||
size_t count = object_storage_get_object_set_count();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
object_set* set = object_storage_get_object_set_by_index(i);
|
||||
|
||||
igPushID_Int((int32_t)i);
|
||||
char buf[0x1000];
|
||||
sprintf_s(buf, sizeof(buf), "ID: 0x%08X; Name: %s", set->id, string_data(&set->name));
|
||||
igSelectable_Bool(buf, false, 0, ImVec2_Empty);
|
||||
igPopID();
|
||||
}
|
||||
|
||||
data->imgui_focus |= igIsWindowFocused(0);
|
||||
|
||||
End:
|
||||
igEnd();
|
||||
}
|
||||
|
||||
void data_view_object_input(class_data* data) {
|
||||
input_locked |= data->imgui_focus;
|
||||
}
|
||||
|
||||
bool data_view_object_dispose(class_data* data) {
|
||||
data_view_object* data_view = data->data;
|
||||
if (data_view) {
|
||||
}
|
||||
free(data->data);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../KKdLib/default.h"
|
||||
#include "../../classes.h"
|
||||
|
||||
extern bool data_view_object_init(class_data* data, render_context* rctx);
|
||||
extern void data_view_object_imgui(class_data* data);
|
||||
extern void data_view_object_input(class_data* data);
|
||||
extern bool data_view_object_dispose(class_data* data);
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "texture.h"
|
||||
#include "../../../CRE/render_context.h"
|
||||
#include "../imgui_helper.h"
|
||||
|
||||
typedef struct data_view_texture {
|
||||
render_context* rctx;
|
||||
} data_view_texture;
|
||||
|
||||
extern int32_t width;
|
||||
extern int32_t height;
|
||||
extern bool input_locked;
|
||||
|
||||
const char* data_view_texture_window_title = "Texture##Data Viewer";
|
||||
|
||||
bool data_view_texture_init(class_data* data, render_context* rctx) {
|
||||
data->data = force_malloc(sizeof(data_view_texture));
|
||||
data_view_texture* data_view = data->data;
|
||||
if (data_view) {
|
||||
data_view->rctx = rctx;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void data_view_texture_imgui(class_data* data) {
|
||||
ImGuiIO* io = igGetIO();
|
||||
ImGuiStyle* style = igGetStyle();
|
||||
ImFont* font = igGetFont();
|
||||
|
||||
float_t w = min((float_t)width, 480.0f);
|
||||
float_t h = min((float_t)height, 480.0f);
|
||||
|
||||
igSetNextWindowPos(ImVec2_Empty, ImGuiCond_Appearing, ImVec2_Empty);
|
||||
igSetNextWindowSize((ImVec2) { w, h }, ImGuiCond_Appearing);
|
||||
|
||||
data->imgui_focus = false;
|
||||
bool open = data->flags & CLASS_HIDDEN ? false : true;
|
||||
bool collapsed = !igBegin(data_view_texture_window_title, &open, 0);
|
||||
if (!open) {
|
||||
data->flags |= CLASS_HIDE;
|
||||
goto End;
|
||||
}
|
||||
else if (collapsed)
|
||||
goto End;
|
||||
|
||||
data_view_texture* data_view = data->data;
|
||||
if (!data_view)
|
||||
goto End;
|
||||
|
||||
render_context* rctx = data_view->rctx;
|
||||
|
||||
size_t count = texture_storage_get_texture_count();
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
texture* tex = texture_storage_get_texture_by_index(i);
|
||||
if (texture_get_id(tex->id))
|
||||
continue;
|
||||
|
||||
igPushID_Int((int32_t)i);
|
||||
char buf[0x1000];
|
||||
sprintf_s(buf, sizeof(buf), "ID: 0x%06X; Width: %5d; Height: %5d; Mipmap Count: %2d",
|
||||
texture_get_index(tex->id), tex->width, tex->height, tex->max_mipmap_level + 1);
|
||||
igSelectable_Bool(buf, false, 0, ImVec2_Empty);
|
||||
igPopID();
|
||||
}
|
||||
|
||||
data->imgui_focus |= igIsWindowFocused(0);
|
||||
|
||||
End:
|
||||
igEnd();
|
||||
}
|
||||
|
||||
void data_view_texture_input(class_data* data) {
|
||||
input_locked |= data->imgui_focus;
|
||||
}
|
||||
|
||||
bool data_view_texture_dispose(class_data* data) {
|
||||
data_view_texture* data_view = data->data;
|
||||
if (data_view) {
|
||||
}
|
||||
free(data->data);
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../KKdLib/default.h"
|
||||
#include "../../classes.h"
|
||||
|
||||
extern bool data_view_texture_init(class_data* data, render_context* rctx);
|
||||
extern void data_view_texture_imgui(class_data* data);
|
||||
extern void data_view_texture_input(class_data* data);
|
||||
extern bool data_view_texture_dispose(class_data* data);
|
||||
@@ -470,7 +470,7 @@ bool glitter_editor_init(class_data* data, render_context* rctx) {
|
||||
vector_string_erase(&files_x, i - files_x.begin);
|
||||
}
|
||||
|
||||
ssize_t c = files_x.end - files_x.begin;
|
||||
ssize_t c = vector_length(files_x);
|
||||
glitter_file_reader* fr = 0;
|
||||
if (files_x.begin) {
|
||||
stream s;
|
||||
@@ -556,7 +556,7 @@ bool glitter_editor_init(class_data* data, render_context* rctx) {
|
||||
vector_string_erase(&files_x, i - files_x.begin);
|
||||
}
|
||||
|
||||
ssize_t c = files_x.end - files_x.begin;
|
||||
ssize_t c = vector_length(files_x);
|
||||
glitter_file_reader* fr = 0;
|
||||
if (files_x.begin)
|
||||
for (ssize_t i = 0; i < c; i++) {
|
||||
@@ -644,7 +644,7 @@ bool glitter_editor_init(class_data* data, render_context* rctx) {
|
||||
hashes[i] = hash_murmurhash(lines[i], min(len, 0x7F), 0, false, false);
|
||||
}
|
||||
|
||||
ssize_t c = files_f2.end - files_f2.begin;
|
||||
ssize_t c = vector_length(files_f2);
|
||||
glitter_file_reader* fr = 0;
|
||||
if (files_f2.begin && files_ft.begin)
|
||||
for (ssize_t i = 0; i < c; i++) {
|
||||
@@ -908,7 +908,7 @@ void glitter_editor_render(class_data* data) {
|
||||
}
|
||||
|
||||
if (eg && glt_edt->effect_flags & GLITTER_EDITOR_ADD) {
|
||||
ssize_t eff_count = eg->effects.end - eg->effects.begin;
|
||||
ssize_t eff_count = vector_length(eg->effects);
|
||||
|
||||
LARGE_INTEGER time;
|
||||
QueryPerformanceCounter(&time);
|
||||
@@ -922,7 +922,7 @@ void glitter_editor_render(class_data* data) {
|
||||
|
||||
if (eg && has_effect)
|
||||
if (glt_edt->effect_flags & GLITTER_EDITOR_DUPLICATE) {
|
||||
ssize_t eff_count = eg->effects.end - eg->effects.begin;
|
||||
ssize_t eff_count = vector_length(eg->effects);
|
||||
|
||||
LARGE_INTEGER time;
|
||||
QueryPerformanceCounter(&time);
|
||||
@@ -949,7 +949,7 @@ void glitter_editor_render(class_data* data) {
|
||||
glt_edt->selected_emitter = 0;
|
||||
glt_edt->selected_particle = 0;
|
||||
|
||||
if (eg->effects.end - eg->effects.begin < 1)
|
||||
if (vector_length(eg->effects) < 1)
|
||||
glt_edt->close = true;
|
||||
else
|
||||
glt_edt->input_reload = true;
|
||||
@@ -979,7 +979,7 @@ void glitter_editor_render(class_data* data) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (j > -1 && j < eg->effects.end - eg->effects.begin - 1) {
|
||||
if (j > -1 && j < vector_length(eg->effects) - 1) {
|
||||
glitter_effect* temp = eg->effects.begin[j + 1];
|
||||
eg->effects.begin[j + 1] = eg->effects.begin[j];
|
||||
eg->effects.begin[j] = temp;
|
||||
@@ -1602,7 +1602,7 @@ static void glitter_editor_reload(glitter_editor_struct* glt_edt) {
|
||||
min(len, 0x7F), 0, false, false);
|
||||
else
|
||||
effect->data.name_hash = hash_fnv1a64m(effect->name,
|
||||
min(len, 0x7F));
|
||||
min(len, 0x7F), false);
|
||||
|
||||
for (glitter_curve** c = effect->animation.begin; c != effect->animation.end; c++)
|
||||
if (*c)
|
||||
@@ -1744,7 +1744,7 @@ static void glitter_editor_load_file(glitter_editor_struct* glt_edt, char* path,
|
||||
|
||||
glitter_effect* e = *i;
|
||||
size_t len = utf8_length(e->name);
|
||||
if (e->data.name_hash != hash_fnv1a64m(e->name, min(len, 0x80))) {
|
||||
if (e->data.name_hash != hash_fnv1a64m(e->name, min(len, 0x80), false)) {
|
||||
lst_not_valid = true;
|
||||
break;
|
||||
}
|
||||
@@ -1908,7 +1908,7 @@ static bool glitter_editor_list_open_window(glitter_effect_group* eg) {
|
||||
else
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
size_t len = utf8_length(lines[i]);
|
||||
hashes[i] = hash_fnv1a64m(lines[i], min(len, 0x7F));
|
||||
hashes[i] = hash_fnv1a64m(lines[i], min(len, 0x7F), false);
|
||||
}
|
||||
|
||||
ret = true;
|
||||
@@ -1966,7 +1966,7 @@ static bool glitter_editor_resource_import(glitter_editor_struct* glt_edt) {
|
||||
wchar_t* p = str_utils_wsplit_right_get_left(file, L'.');
|
||||
dds* d = dds_init();
|
||||
|
||||
uint64_t hash_ft = hash_utf16_fnv1a64m(f);
|
||||
uint64_t hash_ft = hash_utf16_fnv1a64m(f, false);
|
||||
uint64_t hash_f2 = hash_utf16_murmurhash(f, 0, false);
|
||||
|
||||
glitter_effect_group* eg = glt_edt->effect_group;
|
||||
@@ -1977,8 +1977,7 @@ static bool glitter_editor_resource_import(glitter_editor_struct* glt_edt) {
|
||||
goto DDSEnd;
|
||||
|
||||
dds_wread(d, p);
|
||||
if (d->width == 0 || d->height == 0
|
||||
|| d->mipmaps_count == 0 || d->data.end - d->data.begin < 1)
|
||||
if (d->width == 0 || d->height == 0 || d->mipmaps_count == 0 || vector_length(d->data) < 1)
|
||||
goto DDSEnd;
|
||||
|
||||
txp* tex = vector_txp_reserve_back(&eg->resources_tex);
|
||||
@@ -2454,8 +2453,7 @@ static void glitter_editor_effects_context_menu(glitter_editor_struct* glt_edt,
|
||||
close = true;
|
||||
}
|
||||
|
||||
if (igMenuItem_Bool("Move Effect Down", 0, false,
|
||||
i_idx < eg->effects.end - eg->effects.begin)) {
|
||||
if (igMenuItem_Bool("Move Effect Down", 0, false, i_idx < vector_length(eg->effects))) {
|
||||
glt_edt->effect_flags |= GLITTER_EDITOR_MOVE_DOWN;
|
||||
glt_edt->selected_effect = effect;
|
||||
close = true;
|
||||
@@ -2860,7 +2858,7 @@ static void glitter_editor_property_effect(glitter_editor_struct* glt_edt, class
|
||||
memcpy(name, effect.name, name_size);
|
||||
if (imguiColumnInputText("Name", name, name_size, 0, 0, 0)) {
|
||||
effect.data.name_hash = eg->type != GLITTER_FT
|
||||
? hash_utf8_murmurhash(name, 0, false) : hash_utf8_fnv1a64m(name);
|
||||
? hash_utf8_murmurhash(name, 0, false) : hash_utf8_fnv1a64m(name, false);
|
||||
memcpy(effect.name, name, name_size - 1);
|
||||
changed = true;
|
||||
}
|
||||
@@ -3127,16 +3125,16 @@ static void glitter_editor_property_effect(glitter_editor_struct* glt_edt, class
|
||||
ext_anim_changed = true;
|
||||
}
|
||||
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)effect.data.ext_anim, sizeof(glitter_effect_ext_anim));
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)&ext_anim, sizeof(glitter_effect_ext_anim));
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)effect.data.ext_anim, sizeof(glitter_effect_ext_anim), false);
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)&ext_anim, sizeof(glitter_effect_ext_anim), false);
|
||||
if (hash1 != hash2 && ext_anim_changed) {
|
||||
*effect.data.ext_anim = ext_anim;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)glt_edt->selected_effect, sizeof(glitter_effect));
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)&effect, sizeof(glitter_effect));
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)glt_edt->selected_effect, sizeof(glitter_effect), false);
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)&effect, sizeof(glitter_effect), false);
|
||||
if (hash1 != hash2 && changed) {
|
||||
for (glitter_emitter** i = effect.emitters.begin; i != effect.emitters.end; i++) {
|
||||
if (!*i)
|
||||
@@ -3510,8 +3508,8 @@ static void glitter_editor_property_emitter(glitter_editor_struct* glt_edt, clas
|
||||
} break;
|
||||
}
|
||||
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)glt_edt->selected_emitter, sizeof(glitter_emitter));
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)&emitter, sizeof(glitter_emitter));
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)glt_edt->selected_emitter, sizeof(glitter_emitter), false);
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)&emitter, sizeof(glitter_emitter), false);
|
||||
if (hash1 != hash2 && changed) {
|
||||
glt_edt->input_reload = true;
|
||||
*glt_edt->selected_emitter = emitter;
|
||||
@@ -4212,8 +4210,8 @@ static void glitter_editor_property_particle(glitter_editor_struct* glt_edt, cla
|
||||
changed = true;*/
|
||||
}
|
||||
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)glt_edt->selected_particle, sizeof(glitter_particle));
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)&particle, sizeof(glitter_particle));
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)glt_edt->selected_particle, sizeof(glitter_particle), false);
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)&particle, sizeof(glitter_particle), false);
|
||||
if (hash1 != hash2 && changed) {
|
||||
glt_edt->input_reload = true;
|
||||
*glt_edt->selected_particle = particle;
|
||||
@@ -5048,7 +5046,7 @@ static void glitter_editor_curve_editor(glitter_editor_struct* glt_edt) {
|
||||
|
||||
bool exist = true;
|
||||
if (crv_edt->add_key && add_key) {
|
||||
if (!crv_edt->list[crv_edt->type] || keys->end - keys->begin == 0) {
|
||||
if (!crv_edt->list[crv_edt->type] || vector_length(*keys) == 0) {
|
||||
glitter_curve_key* key = vector_glitter_curve_key_reserve_back(keys);
|
||||
key->frame = crv_edt->curve.start_time;
|
||||
key->value = glitter_editor_curve_editor_get_value(glt_edt, curve->type);
|
||||
@@ -5170,7 +5168,7 @@ static void glitter_editor_curve_editor(glitter_editor_struct* glt_edt) {
|
||||
}
|
||||
|
||||
glitter_curve* c = crv_edt->list[crv_edt->type];
|
||||
if (c && keys->end - keys->begin == 0) {
|
||||
if (c && vector_length(*keys) == 0) {
|
||||
glitter_animation* anim = crv_edt->animation;
|
||||
for (glitter_curve** i = anim->begin; i != anim->end; i++)
|
||||
if (*i && *i == c) {
|
||||
@@ -6124,9 +6122,9 @@ static void glitter_editor_curve_editor_property_window(glitter_editor_struct* g
|
||||
bool key_edit = false;
|
||||
|
||||
float_t value;
|
||||
if (curve->keys_rev.end - curve->keys_rev.begin > 1) {
|
||||
if (vector_length(curve->keys_rev) > 1) {
|
||||
glitter_curve_key* c = curve->keys_rev.begin;
|
||||
glitter_curve_key* n = curve->keys_rev.end - c > 1 ? curve->keys_rev.begin + 1 : 0;
|
||||
glitter_curve_key* n = vector_length(curve->keys_rev) > 1 ? c + 1 : 0;
|
||||
while (n != curve->keys_rev.end && n->frame < crv_edt->frame) {
|
||||
c++;
|
||||
n++;
|
||||
@@ -6147,7 +6145,7 @@ static void glitter_editor_curve_editor_property_window(glitter_editor_struct* g
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (curve->keys_rev.end - curve->keys_rev.begin == 1)
|
||||
else if (vector_length(curve->keys_rev) == 1)
|
||||
value = curve->keys_rev.begin->value;
|
||||
else if (curve->type >= GLITTER_CURVE_TRANSLATION_X && curve->type <= GLITTER_CURVE_V_SCROLL_ALPHA_2ND)
|
||||
value = glitter_editor_curve_editor_get_value(glt_edt, curve->type);
|
||||
@@ -6352,8 +6350,8 @@ static void glitter_editor_curve_editor_property_window(glitter_editor_struct* g
|
||||
glt_edt->input_reload = true;
|
||||
}
|
||||
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)crv_edt->list[crv_edt->type], sizeof(glitter_curve));
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)curve, sizeof(glitter_effect));
|
||||
uint64_t hash1 = hash_fnv1a64m((void*)crv_edt->list[crv_edt->type], sizeof(glitter_curve), false);
|
||||
uint64_t hash2 = hash_fnv1a64m((void*)curve, sizeof(glitter_effect), false);
|
||||
if (hash1 != hash2)
|
||||
*crv_edt->list[crv_edt->type] = *curve;
|
||||
}
|
||||
@@ -6845,7 +6843,7 @@ static void glitter_editor_gl_draw_wireframe_draw(glitter_editor_struct* glt_edt
|
||||
gl_state_bind_array_buffer(0);
|
||||
|
||||
const GLenum mode = rg->type == GLITTER_PARTICLE_LINE ? GL_LINE_STRIP : GL_TRIANGLE_STRIP;
|
||||
const size_t count = rg->vec_key.end - rg->vec_key.begin;
|
||||
const size_t count = vector_length(rg->vec_key);
|
||||
for (size_t i = 0; i < count; i++)
|
||||
glDrawArrays(mode, rg->vec_key.begin[i], rg->vec_val.begin[i]);
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ void information_frame_speed_imgui(class_data* data) {
|
||||
ImGuiStyle* style = igGetStyle();
|
||||
ImFont* font = igGetFont();
|
||||
|
||||
float_t w = min((float_t)width, 204.0f);
|
||||
float_t h = min((float_t)height, 60.0f);
|
||||
float_t w = min((float_t)width, 240.0f);
|
||||
float_t h = min((float_t)height, 58.0f);
|
||||
|
||||
igSetNextWindowPos(ImVec2_Empty, ImGuiCond_Appearing, ImVec2_Empty);
|
||||
igSetNextWindowSize((ImVec2) { w, h }, ImGuiCond_Always);
|
||||
|
||||
+3
-5
@@ -134,10 +134,8 @@ static void a3da_to_dft_dsc(char* a3da_path, int32_t pv_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
vec3 diff;
|
||||
float_t focus;
|
||||
vec3_sub(cam_a3da.dof.model_transform.translation_value, cr->view_point_value, diff);
|
||||
vec3_length(diff, focus);
|
||||
vec3_distance(cam_a3da.dof.model_transform.translation_value, cr->view_point_value, focus);
|
||||
|
||||
dof_data d;
|
||||
d.flags = 0x1F;
|
||||
@@ -252,13 +250,13 @@ int32_t wmain(int32_t argc, wchar_t** argv) {
|
||||
__cpuid(cpuid_data, 1);
|
||||
aes_ni = cpuid_data[2] & 0x2000000 ? true : false;
|
||||
|
||||
//a3da_to_dft_dsc("CAMPV269_BASE.a3da", 269);
|
||||
|
||||
render_init_struct ris;
|
||||
ris.res.x = 0;
|
||||
ris.res.y = 0;
|
||||
ris.scale = 0.0f;
|
||||
|
||||
//a3da_to_dft_dsc("CAMPV269_BASE.a3da", 269);
|
||||
|
||||
thread input, render, sound;
|
||||
HANDLE h[3];
|
||||
h[0] = input.handle = CreateThread(0, 0, &input_main, 0, 0, &input.id);
|
||||
|
||||
+27
-37
@@ -32,6 +32,7 @@
|
||||
#include "../CRE/post_process.h"
|
||||
#include "../KKdLib/io/path.h"
|
||||
#include "../KKdLib/farc.h"
|
||||
#include "../KKdLib/pvpp.h"
|
||||
#include"classes/imgui_helper.h"
|
||||
#include <timeapi.h>
|
||||
|
||||
@@ -352,6 +353,11 @@ static render_context* render_load() {
|
||||
data_struct_init();
|
||||
data_struct_load("CLOUD_data.txt");
|
||||
|
||||
pvpp pp;
|
||||
pvpp_init(&pp);
|
||||
data_struct_load_file(&data_list[DATA_X], &pp, "rom/pv/", "pv824.pvpp", pvpp_load_file);
|
||||
pvpp_free(&pp);
|
||||
|
||||
glGenBuffers(1, &common_data_ubo);
|
||||
|
||||
gl_state_bind_uniform_buffer(common_data_ubo);
|
||||
@@ -439,7 +445,7 @@ static render_context* render_load() {
|
||||
|
||||
render_resize_fb(rctx, true);
|
||||
|
||||
rob_chara_data_array_init();
|
||||
rob_chara_array_init();
|
||||
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
auth_3d_database* aft_auth_3d_db = &aft_data->data_ft.auth_3d_db;
|
||||
@@ -456,6 +462,10 @@ static render_context* render_load() {
|
||||
aft_obj_db, aft_tex_db, aft_stage_data, "STGTST", rctx);
|
||||
stage_set(&stage_stgtst, rctx);
|
||||
|
||||
stage_init(&stage_test_data);
|
||||
stage_test_data.set_id = -1;
|
||||
stage_test_data.stage_set_id = -1;
|
||||
|
||||
object_set_info* set_info;
|
||||
object_set_load_db_entry(&set_info, aft_data, aft_obj_db, "MIKITM000");
|
||||
object_set_load_db_entry(&set_info, aft_data, aft_obj_db, "MIKITM001");
|
||||
@@ -466,24 +476,16 @@ static render_context* render_load() {
|
||||
object_set_load_db_entry(&set_info, aft_data, aft_obj_db, "MIKITM681");
|
||||
object_set_load_db_entry(&set_info, aft_data, aft_obj_db, "MIKITM981");
|
||||
|
||||
motion_set_load_motion(216, 0, aft_mot_db);
|
||||
motion_set_load_motion(2, 0, aft_mot_db);
|
||||
motion_set_load_motion(946, 0, aft_mot_db);
|
||||
|
||||
rob_chara_pv_data pv_data;
|
||||
rob_chara_pv_data_init(&pv_data);
|
||||
item_sub_data sub_data;
|
||||
memset(&sub_data, 0, sizeof(item_sub_data));
|
||||
sub_data.kami = 500;
|
||||
sub_data.outer = 1;
|
||||
sub_data.kata = 301;
|
||||
//sub_data.kami = 681;
|
||||
//sub_data.outer = 181;
|
||||
//sub_data.kata = 481;
|
||||
//sub_data.head = 981;
|
||||
rob_chara_data_set(&rob_chara_data_array[0], 0, CHARA_MIKU, 0, &pv_data);
|
||||
rob_chara_data_reset(&rob_chara_data_array[0],
|
||||
&rob_chara_data_array[0].pv_data, aft_bone_data, aft_mot_db);
|
||||
rob_chara_data_reload_items(&rob_chara_data_array[0], &sub_data, aft_bone_data);
|
||||
rob_chara_data_load_motion(&rob_chara_data_array[0], 1294, 2, aft_bone_data, aft_mot_db);
|
||||
rob_chara_set(&rob_chara_array[0], 0, CHARA_MIKU, 0, &pv_data);
|
||||
rob_chara_reset_data(&rob_chara_array[0], &rob_chara_array[0].pv_data, aft_bone_data, aft_mot_db);
|
||||
rob_chara_reset(&rob_chara_array[0], aft_bone_data, aft_data, aft_obj_db);
|
||||
rob_chara_load_motion(&rob_chara_array[0], 9996, 2, aft_bone_data, aft_mot_db);
|
||||
//rob_chara_set_frame(&rob_chara_array[0], 1000.0f);
|
||||
|
||||
float_t* grid_verts = force_malloc(sizeof(float_t) * 3 * grid_vertex_count);
|
||||
|
||||
@@ -528,7 +530,6 @@ static render_context* render_load() {
|
||||
camera* cam = rctx->camera;
|
||||
|
||||
camera_initialize(cam, aspect, internal_3d_res.x, internal_3d_res.y);
|
||||
camera_reset(cam);
|
||||
//camera_set_position(cam, &((vec3){ 1.35542f, 1.41634f, 1.27852f }));
|
||||
//camera_rotate(cam, &((vec2d){ -45.0, -32.5 }));
|
||||
//camera_set_position(cam, &((vec3){ -6.67555f, 4.68882f, -3.67537f }));
|
||||
@@ -536,17 +537,6 @@ static render_context* render_load() {
|
||||
camera_set_position(cam, &((vec3) { 0.0f, 1.0f, 3.45f }));
|
||||
camera_set_fov(cam, 70.0);
|
||||
|
||||
typedef struct struc_403 {
|
||||
int32_t field_0;
|
||||
int32_t field_4;
|
||||
int32_t field_8;
|
||||
} struc_403;
|
||||
|
||||
typedef struct struc_404 {
|
||||
int32_t field_0;
|
||||
int32_t field_4;
|
||||
} struc_404;
|
||||
|
||||
imgui_context = igCreateContext(0);
|
||||
lock_init(&imgui_context_lock);
|
||||
|
||||
@@ -620,7 +610,7 @@ static void render_update(render_context* rctx) {
|
||||
lock_lock(&imgui_context_lock);
|
||||
igSetCurrentContext(imgui_context);
|
||||
if (global_context_menu && igIsMouseReleased(ImGuiMouseButton_Right)
|
||||
&& !igIsItemHovered(0) && imgui_context->OpenPopupStack.Size <= 0)
|
||||
&& !igIsItemHovered(0) && imgui_context->OpenPopupStack.Size < 1)
|
||||
igOpenPopup_Str("Classes init context menu", 0);
|
||||
|
||||
if (igBeginPopupContextItem("Classes init context menu", 0)) {
|
||||
@@ -654,13 +644,13 @@ static void render_update(render_context* rctx) {
|
||||
}
|
||||
camera_update(cam);
|
||||
|
||||
float_t frame = rob_chara_data_get_frame(&rob_chara_data_array[0]);
|
||||
float_t frame_count = rob_chara_data_get_frame_count(&rob_chara_data_array[0]);
|
||||
float_t frame = rob_chara_get_frame(&rob_chara_array[0]);
|
||||
float_t frame_count = rob_chara_get_frame_count(&rob_chara_array[0]);
|
||||
frame += get_delta_frame();
|
||||
if (frame >= frame_count)
|
||||
frame -= frame_count;
|
||||
rob_chara_data_set_frame(&rob_chara_data_array[0], frame);
|
||||
rob_chara_data_array[0].item_equip->shadow_type = SHADOW_CHARA;
|
||||
rob_chara_set_frame(&rob_chara_array[0], frame);
|
||||
rob_chara_array[0].item_equip->shadow_type = SHADOW_CHARA;
|
||||
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
obj_db_ptr = &aft_data->data_ft.obj_db;
|
||||
@@ -669,8 +659,8 @@ static void render_update(render_context* rctx) {
|
||||
classes_process_render(classes, classes_count);
|
||||
|
||||
wind_ptr = rctx->wind;
|
||||
rob_chara_data_calc(&rob_chara_data_array[0]);
|
||||
rob_chara_data_draw(&rob_chara_data_array[0], rctx);
|
||||
rob_chara_calc(&rob_chara_array[0]);
|
||||
rob_chara_draw(&rob_chara_array[0], rctx);
|
||||
|
||||
stage_update(rctx->stage, rctx);
|
||||
|
||||
@@ -779,7 +769,7 @@ static void render_dispose(render_context* rctx) {
|
||||
glDeleteBuffers(1, &common_data_ubo);
|
||||
glDeleteBuffers(1, &grid_vbo);
|
||||
|
||||
rob_chara_data_array_free();
|
||||
rob_chara_array_free();
|
||||
|
||||
auth_3d_data_free(rctx);
|
||||
light_param_storage_free();
|
||||
@@ -904,7 +894,7 @@ static void render_imgui_context_menu(classes_struct* classes,
|
||||
|
||||
inline static void render_shaders_load() {
|
||||
data_struct_load_file(&data_list[DATA_AFT], &shaders_ft,
|
||||
"rom\\", "ft_shaders.farc", render_load_shaders);
|
||||
"rom/", "ft_shaders.farc", render_load_shaders);
|
||||
}
|
||||
|
||||
inline static void render_shaders_free() {
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ classes_struct classes[] = {
|
||||
.data = CLASS_DATA_NO_DATA,
|
||||
},
|
||||
.sub_classes = data_view_classes,
|
||||
.sub_classes_count = 2,
|
||||
.sub_classes_count = 4,
|
||||
},
|
||||
{
|
||||
.name = "Graphics",
|
||||
|
||||
@@ -32,7 +32,7 @@ void glitter_animation_copy(glitter_animation* src, glitter_animation* dst) {
|
||||
if (!src)
|
||||
return;
|
||||
|
||||
vector_ptr_glitter_curve_reserve(dst, src->end - src->begin);
|
||||
vector_ptr_glitter_curve_reserve(dst, vector_length(*src));
|
||||
for (glitter_curve** i = src->begin; i != src->end; i++)
|
||||
if (*i) {
|
||||
glitter_curve* c = glitter_curve_copy(*i);
|
||||
@@ -70,7 +70,7 @@ bool glitter_animation_unparse_file(GLT, f2_struct* st,
|
||||
glitter_animation* anim, glitter_curve_type_flags flags) {
|
||||
memset(st, 0, sizeof(f2_struct));
|
||||
|
||||
if (anim->end - anim->begin <= 0)
|
||||
if (vector_length(*anim) < 1)
|
||||
return false;
|
||||
|
||||
static const glitter_curve_type order[] = {
|
||||
@@ -123,7 +123,7 @@ bool glitter_animation_unparse_file(GLT, f2_struct* st,
|
||||
}
|
||||
}
|
||||
|
||||
if (st->sub_structs.end - st->sub_structs.begin < 1)
|
||||
if (vector_length(st->sub_structs) < 1)
|
||||
return false;
|
||||
|
||||
st->header.signature = reverse_endianness_uint32_t('ANIM');
|
||||
|
||||
@@ -56,11 +56,11 @@ glitter_curve* glitter_curve_copy(glitter_curve* c) {
|
||||
*cc = *c;
|
||||
|
||||
cc->keys = vector_empty(glitter_curve_key);
|
||||
vector_glitter_curve_key_reserve(&cc->keys, c->keys.end - c->keys.begin);
|
||||
vector_glitter_curve_key_reserve(&cc->keys, vector_length(c->keys));
|
||||
vector_glitter_curve_key_insert_range(&cc->keys, 0, c->keys.begin, c->keys.end);
|
||||
#if defined(CRE_DEV)
|
||||
cc->keys_rev = vector_empty(glitter_curve_key);
|
||||
vector_glitter_curve_key_reserve(&cc->keys_rev, c->keys_rev.end - c->keys_rev.begin);
|
||||
vector_glitter_curve_key_reserve(&cc->keys_rev, vector_length(c->keys_rev));
|
||||
vector_glitter_curve_key_insert_range(&cc->keys_rev, 0, c->keys_rev.begin, c->keys_rev.end);
|
||||
#endif
|
||||
return cc;
|
||||
@@ -97,9 +97,9 @@ void glitter_curve_recalculate(GLT, glitter_curve* curve) {
|
||||
vector_glitter_curve_key keys_rev = curve->keys_rev;
|
||||
vector_glitter_curve_key* keys = &curve->keys;
|
||||
vector_glitter_curve_key_clear(keys, 0);
|
||||
if (keys_rev.end - keys_rev.begin == 1)
|
||||
if (vector_length(keys_rev) == 1)
|
||||
vector_glitter_curve_key_push_back(keys, &keys_rev.begin[0]);
|
||||
else if (keys_rev.end - keys_rev.begin > 1) {
|
||||
else if (vector_length(keys_rev) > 1) {
|
||||
if (~curve->flags & GLITTER_CURVE_BAKED) {
|
||||
vector_glitter_curve_key_insert_range(keys, 0, keys_rev.begin, keys_rev.end);
|
||||
return;
|
||||
@@ -109,7 +109,7 @@ void glitter_curve_recalculate(GLT, glitter_curve* curve) {
|
||||
if (GLT_VAL == GLITTER_F2 || (GLT_VAL == GLITTER_X && ~curve->flags & GLITTER_CURVE_BAKED_FULL))
|
||||
curve_baked_half = true;
|
||||
|
||||
ssize_t keys_count = keys_rev.end - keys_rev.begin;
|
||||
ssize_t keys_count = vector_length(keys_rev);
|
||||
size_t count = (size_t)end_time - start_time;
|
||||
if (curve_baked_half)
|
||||
count /= 2;
|
||||
@@ -195,11 +195,11 @@ void glitter_curve_recalculate(GLT, glitter_curve* curve) {
|
||||
bool glitter_curve_unparse_file(GLT, f2_struct* st, glitter_curve* c) {
|
||||
#if !defined(CRE_DEV)
|
||||
vector_glitter_curve_key keys = c->keys;
|
||||
if (keys.end - keys.begin < 1)
|
||||
if (vector_length(keys) < 1)
|
||||
return false;
|
||||
#else
|
||||
vector_glitter_curve_key keys = c->keys;
|
||||
if (c->keys_rev.end - c->keys_rev.begin < 1)
|
||||
if (vector_length(c->keys_rev) < 1)
|
||||
return false;
|
||||
|
||||
c->keys = vector_empty(glitter_curve_key);
|
||||
@@ -209,7 +209,7 @@ bool glitter_curve_unparse_file(GLT, f2_struct* st, glitter_curve* c) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
glitter_curve_pack_file(GLT_VAL, st, c, c->keys.end - c->keys.begin);
|
||||
glitter_curve_pack_file(GLT_VAL, st, c, vector_length(c->keys));
|
||||
|
||||
f2_struct s;
|
||||
glitter_curve_key_pack_file(GLT_VAL, &s, c, &c->keys);
|
||||
|
||||
@@ -22,7 +22,7 @@ bool glitter_curve_get_value(GLT, glitter_curve* c,
|
||||
bool negate;
|
||||
float_t _value;
|
||||
|
||||
keys_count = c->keys.end - c->keys.begin;
|
||||
keys_count = vector_length(c->keys);
|
||||
if (!keys_count)
|
||||
return false;
|
||||
|
||||
@@ -106,7 +106,7 @@ static void glitter_curve_get_key_indexes(vector_glitter_curve_key* keys,
|
||||
size_t v9;
|
||||
size_t v10;
|
||||
|
||||
count = keys->end - keys->begin;
|
||||
count = vector_length(*keys);
|
||||
if (count <= 1) {
|
||||
*curr = 0;
|
||||
*next = 0;
|
||||
|
||||
@@ -39,7 +39,7 @@ glitter_effect* glitter_effect_copy(glitter_effect* e) {
|
||||
}
|
||||
|
||||
ec->emitters = vector_ptr_empty(glitter_emitter);
|
||||
vector_ptr_glitter_emitter_reserve(&ec->emitters, e->emitters.end - e->emitters.begin);
|
||||
vector_ptr_glitter_emitter_reserve(&ec->emitters, vector_length(e->emitters));
|
||||
for (glitter_emitter** i = e->emitters.begin; i != e->emitters.end; i++)
|
||||
if (*i) {
|
||||
glitter_emitter* e = glitter_emitter_copy(*i);
|
||||
@@ -186,7 +186,8 @@ static bool glitter_effect_pack_file(GLT, f2_struct* st, glitter_effect* a2) {
|
||||
flags |= GLITTER_EFFECT_FILE_EMISSION;
|
||||
|
||||
*(uint64_t*)d = GLT_VAL != GLITTER_FT
|
||||
? hash_utf8_murmurhash(a2->name, 0, false) : hash_utf8_fnv1a64m(a2->name);;
|
||||
? hash_utf8_murmurhash(a2->name, 0, false)
|
||||
: hash_utf8_fnv1a64m(a2->name, false);;
|
||||
*(int32_t*)(d + 8) = a2->data.appear_time;
|
||||
*(int32_t*)(d + 12) = a2->data.life_time;
|
||||
*(int32_t*)(d + 16) = a2->data.start_time;
|
||||
|
||||
@@ -116,7 +116,7 @@ void glitter_effect_group_load_model(glitter_effect_group* eg, void* ds) {
|
||||
return;
|
||||
|
||||
vector_uint32_t* object_set_ids = &eg->object_set_ids;
|
||||
if (!(object_set_ids->end - object_set_ids->begin))
|
||||
if (vector_length(*object_set_ids) < 1)
|
||||
return;
|
||||
|
||||
for (uint32_t* i = object_set_ids->begin; i != object_set_ids->end; i++) {
|
||||
|
||||
@@ -89,7 +89,7 @@ glitter_effect_inst* glitter_effect_inst_init(GPM, GLT,
|
||||
ei->random = glitter_random_get_value(ei->random_ptr);
|
||||
|
||||
ei->mat = mat4_identity;
|
||||
vector_ptr_glitter_emitter_inst_reserve(&ei->emitters, a1->emitters.end - a1->emitters.begin);
|
||||
vector_ptr_glitter_emitter_inst_reserve(&ei->emitters, vector_length(a1->emitters));
|
||||
for (i = a1->emitters.begin; i != a1->emitters.end; i++) {
|
||||
if (!*i)
|
||||
continue;
|
||||
@@ -226,8 +226,8 @@ static void glitter_effect_inst_get_ext_anim(glitter_effect_inst* a1) {
|
||||
glitter_effect_inst_ext_anim* inst_ext_anim = a1->ext_anim;
|
||||
|
||||
if (a1->flags & GLITTER_EFFECT_INST_CHARA_ANIM) {
|
||||
rob_chara_data* rob_chr_data = rob_chara_data_array_get(inst_ext_anim->chara_index);
|
||||
if (!rob_chr_data)
|
||||
rob_chara* rob_chr = rob_chara_array_get(inst_ext_anim->chara_index);
|
||||
if (!rob_chr)
|
||||
return;
|
||||
|
||||
mat4 mat = mat4_identity/*chara root mat*/;
|
||||
@@ -248,7 +248,7 @@ static void glitter_effect_inst_get_ext_anim(glitter_effect_inst* a1) {
|
||||
inst_ext_anim->mat = mat;
|
||||
}
|
||||
else {
|
||||
mat4* bone_mat = rob_chara_data_get_bone_data_mat(rob_chr_data, bone_index);
|
||||
mat4* bone_mat = rob_chara_get_bone_data_mat(rob_chr, bone_index);
|
||||
if (!bone_mat)
|
||||
return;
|
||||
|
||||
@@ -306,8 +306,8 @@ static void glitter_effect_inst_get_ext_anim(glitter_effect_inst* a1) {
|
||||
mat4 mat = mat4_identity;
|
||||
int32_t chara_id = -1;// auth_3d_data_get_chara_id(inst_ext_anim->a3da_id);
|
||||
if (chara_id >= 0 && chara_id <= 5) {
|
||||
rob_chara_data* rob_chr_data = rob_chara_data_array_get(chara_id);
|
||||
if (rob_chr_data) {
|
||||
rob_chara* rob_chr = rob_chara_array_get(chara_id);
|
||||
if (rob_chr) {
|
||||
mat = mat4_identity/*chara root mat*/;
|
||||
|
||||
vec3 scale;
|
||||
@@ -428,7 +428,7 @@ static void glitter_effect_inst_get_value(GLT, glitter_effect_inst* a1) {
|
||||
glitter_curve* curve;
|
||||
float_t value;
|
||||
|
||||
length = a1->effect->animation.end - a1->effect->animation.begin;
|
||||
length = vector_length(a1->effect->animation);
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
@@ -495,7 +495,7 @@ static void glitter_effect_inst_update_init(GPM, GLT,
|
||||
float_t delta_frame;
|
||||
float_t start_time;
|
||||
|
||||
if (a1->data.start_time <= 0)
|
||||
if (a1->data.start_time < 1)
|
||||
return;
|
||||
|
||||
delta_frame = 2.0f;
|
||||
|
||||
@@ -30,7 +30,7 @@ glitter_emitter* glitter_emitter_copy(glitter_emitter* e) {
|
||||
*ec = *e;
|
||||
|
||||
ec->particles = vector_ptr_empty(glitter_particle);
|
||||
vector_ptr_glitter_particle_reserve(&ec->particles, e->particles.end - e->particles.begin);
|
||||
vector_ptr_glitter_particle_reserve(&ec->particles, vector_length(e->particles));
|
||||
for (glitter_particle** i = e->particles.begin; i != e->particles.end; i++)
|
||||
if (*i) {
|
||||
glitter_particle* p = glitter_particle_copy(*i);
|
||||
|
||||
@@ -50,7 +50,7 @@ glitter_emitter_inst* glitter_emitter_inst_init(glitter_emitter* a1,
|
||||
ei->emission = GLITTER_EMITTER_EMISSION_ON_END;
|
||||
ei->loop = ei->data.flags & GLITTER_EMITTER_LOOP ? true : false;
|
||||
|
||||
vector_ptr_glitter_particle_inst_reserve(&ei->particles, a1->particles.end - a1->particles.begin);
|
||||
vector_ptr_glitter_particle_inst_reserve(&ei->particles, vector_length(a1->particles));
|
||||
for (i = a1->particles.begin; i != a1->particles.end; i++) {
|
||||
if (!*i)
|
||||
continue;
|
||||
@@ -228,7 +228,7 @@ static void glitter_emitter_inst_get_value(GLT, glitter_emitter_inst* a1) {
|
||||
glitter_curve* curve;
|
||||
float_t value;
|
||||
|
||||
length = a1->emitter->animation.end - a1->emitter->animation.begin;
|
||||
length = vector_length(a1->emitter->animation);
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ glitter_file_reader* glitter_file_reader_init(GLT,
|
||||
fr->type = GLT_VAL;
|
||||
fr->hash = GLT_VAL != GLITTER_FT
|
||||
? hash_utf8_murmurhash(fr->file, 0, false)
|
||||
: hash_utf8_fnv1a64m(fr->file);
|
||||
: hash_utf8_fnv1a64m(fr->file, false);
|
||||
return fr;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ glitter_file_reader* glitter_file_reader_winit(GLT,
|
||||
fr->type = GLT_VAL;
|
||||
fr->hash = GLT_VAL != GLITTER_FT
|
||||
? hash_utf8_murmurhash(fr->file, 0, false)
|
||||
: hash_utf8_fnv1a64m(fr->file);
|
||||
: hash_utf8_fnv1a64m(fr->file, false);
|
||||
return fr;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ bool glitter_list_unpack_file(glitter_effect_group* a1, f2_struct* st) {
|
||||
else
|
||||
length = *(uint32_t*)d;
|
||||
|
||||
if (length != a1->effects.end - a1->effects.begin) {
|
||||
if (length != vector_length(a1->effects)) {
|
||||
for (i = a1->effects.begin; i != a1->effects.end; i++)
|
||||
if (*i)
|
||||
memset((*i)->name, 0, 0x80);
|
||||
|
||||
@@ -22,7 +22,7 @@ void glitter_locus_history_append(glitter_locus_history* a1,
|
||||
vec3 temp1;
|
||||
|
||||
data = a1->data.begin;
|
||||
size = a1->data.end - a1->data.begin;
|
||||
size = vector_length(a1->data);
|
||||
temp = a2->translation;
|
||||
if (a3->data.data.flags & GLITTER_PARTICLE_EMITTER_LOCAL && (emitter = a3->data.emitter)) {
|
||||
vec3 emit_trans;
|
||||
@@ -37,7 +37,7 @@ void glitter_locus_history_append(glitter_locus_history* a1,
|
||||
vector_glitter_locus_history_data_push_back(&a1->data, &locus_history);
|
||||
else if (size == 1) {
|
||||
locus_history.translation = data->translation;
|
||||
if (a1->data.capacity_end - a1->data.begin > 1)
|
||||
if (vector_capacity(a1->data) > 1)
|
||||
vector_glitter_locus_history_data_push_back(&a1->data, &locus_history);
|
||||
data->translation = temp;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ void glitter_locus_history_append(glitter_locus_history* a1,
|
||||
for (i = size - 1; i > 0; i--)
|
||||
data[i].translation = data[i - 1].translation;
|
||||
|
||||
if (size < a1->data.capacity_end - a1->data.begin) {
|
||||
if (size < vector_capacity(a1->data)) {
|
||||
locus_history.translation = temp1;
|
||||
vector_glitter_locus_history_data_push_back(&a1->data, &locus_history);
|
||||
}
|
||||
|
||||
@@ -224,10 +224,10 @@ void glitter_render_element_update(GLT,
|
||||
has_translation = false;
|
||||
translation = vec3_null;
|
||||
|
||||
glitter_animation curv = particle->particle->animation;
|
||||
length = curv.end - curv.begin;
|
||||
glitter_animation* curv = &particle->particle->animation;
|
||||
length = vector_length(*curv);
|
||||
for (int32_t i = 0; i < length; i++) {
|
||||
curve = curv.begin[i];
|
||||
curve = curv->begin[i];
|
||||
if (!glitter_curve_get_value(GLT_VAL, curve, a2->frame,
|
||||
&value, a2->random + i, a1->random_ptr))
|
||||
continue;
|
||||
|
||||
@@ -338,7 +338,7 @@ void glitter_render_group_draw(GPM, glitter_render_group* a1) {
|
||||
gl_state_bind_array_buffer(0);
|
||||
|
||||
const GLenum mode = a1->type == GLITTER_PARTICLE_LINE ? GL_LINE_STRIP : GL_TRIANGLE_STRIP;
|
||||
const size_t count = a1->vec_key.end - a1->vec_key.begin;
|
||||
const size_t count = vector_length(a1->vec_key);
|
||||
for (size_t i = 0; i < count; i++)
|
||||
shader_draw_arrays(&shaders_ft,
|
||||
mode, a1->vec_key.begin[i], a1->vec_val.begin[i]);
|
||||
@@ -440,7 +440,7 @@ static glitter_render_element* glitter_render_group_add_render_element(glitter_r
|
||||
|
||||
v3 = a1->count - (a2 - a1->elements);
|
||||
v4 = 0;
|
||||
if (v3 <= 0)
|
||||
if (v3 < 1)
|
||||
return 0;
|
||||
|
||||
while (a2->alive) {
|
||||
@@ -470,7 +470,7 @@ static void glitter_render_group_calc_draw_line(glitter_render_group* a1) {
|
||||
glitter_locus_history_data* hist_data;
|
||||
size_t index;
|
||||
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl <= 0)
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl < 1)
|
||||
return;
|
||||
|
||||
for (count = 0, i = a1->ctrl, elem = a1->elements; i > 0; i--, elem++) {
|
||||
@@ -478,7 +478,7 @@ static void glitter_render_group_calc_draw_line(glitter_render_group* a1) {
|
||||
continue;
|
||||
|
||||
if (elem->locus_history) {
|
||||
size_t length = elem->locus_history->data.end - elem->locus_history->data.begin;
|
||||
size_t length = vector_length(elem->locus_history->data);
|
||||
if (length > 1)
|
||||
count += length;
|
||||
}
|
||||
@@ -515,7 +515,7 @@ static void glitter_render_group_calc_draw_line(glitter_render_group* a1) {
|
||||
|
||||
i--;
|
||||
hist = elem->locus_history;
|
||||
if (!elem->draw || !hist || hist->data.end - hist->data.begin < 2)
|
||||
if (!elem->draw || !hist || vector_length(hist->data) < 2)
|
||||
continue;
|
||||
|
||||
if (has_scale)
|
||||
@@ -570,7 +570,7 @@ static void glitter_render_group_calc_draw_locus(GPM, glitter_render_group* a1)
|
||||
|
||||
mat3 model_mat;
|
||||
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl <= 0)
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl < 1)
|
||||
return;
|
||||
|
||||
for (count = 0, i = a1->ctrl, elem = a1->elements; i > 0; i--, elem++) {
|
||||
@@ -579,7 +579,7 @@ static void glitter_render_group_calc_draw_locus(GPM, glitter_render_group* a1)
|
||||
|
||||
if (elem->locus_history) {
|
||||
hist = elem->locus_history;
|
||||
size_t length = elem->locus_history->data.end - elem->locus_history->data.begin;
|
||||
size_t length = vector_length(elem->locus_history->data);
|
||||
if (length > 1)
|
||||
count += 2 * length;
|
||||
}
|
||||
@@ -634,17 +634,17 @@ static void glitter_render_group_calc_draw_locus(GPM, glitter_render_group* a1)
|
||||
|
||||
i--;
|
||||
hist = elem->locus_history;
|
||||
if (!elem->draw || !hist || hist->data.end - hist->data.begin < 2)
|
||||
if (!elem->draw || !hist || vector_length(hist->data) < 2)
|
||||
continue;
|
||||
|
||||
uv_u = elem->uv.x + elem->uv_scroll.x;
|
||||
uv_u_2nd = elem->uv.x + elem->uv_scroll.x + a1->split_uv.x;
|
||||
uv_v_2nd = elem->uv.y + elem->uv_scroll.y + a1->split_uv.y;
|
||||
uv_v_scale = a1->split_uv.y / (float_t)(hist->data.end - hist->data.begin - 1);
|
||||
uv_v_scale = a1->split_uv.y / (float_t)(vector_length(hist->data) - 1);
|
||||
|
||||
uv_v_2nd = 1.0f - uv_v_2nd;
|
||||
|
||||
size_t len = elem->locus_history->data.end - elem->locus_history->data.begin;
|
||||
size_t len = vector_length(elem->locus_history->data);
|
||||
for (j = 0, hist_data = hist->data.begin; hist_data != hist->data.end; j++, buf += 2, hist_data++) {
|
||||
pos = hist_data->translation;
|
||||
if (has_scale) {
|
||||
@@ -689,7 +689,7 @@ static void glitter_render_group_calc_draw_quad(GPM, glitter_render_group* a1) {
|
||||
mat4 view_mat;
|
||||
mat4 inv_view_mat;
|
||||
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl <= 0)
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl < 1)
|
||||
return;
|
||||
|
||||
if (a1->flags & GLITTER_PARTICLE_EMITTER_LOCAL) {
|
||||
|
||||
@@ -11,8 +11,8 @@ bool glitter_texture_hashes_pack_file(glitter_effect_group* a1, f2_struct* st) {
|
||||
size_t d;
|
||||
size_t count;
|
||||
|
||||
if (a1->effects.end - a1->effects.begin < 1 || !a1->resources_count
|
||||
|| a1->resource_hashes.end - a1->resource_hashes.begin < 1)
|
||||
if (vector_length(a1->effects) < 1 || !a1->resources_count
|
||||
|| vector_length(a1->resource_hashes) < 1)
|
||||
return false;
|
||||
|
||||
count = a1->resources_count;
|
||||
@@ -54,7 +54,7 @@ bool glitter_texture_hashes_unpack_file(glitter_effect_group* a1, f2_struct* st)
|
||||
uint64_t* resource_hashes;
|
||||
size_t i;
|
||||
|
||||
if (a1->resources_count && a1->resource_hashes.end - a1->resource_hashes.begin > 0)
|
||||
if (a1->resources_count && vector_length(a1->resource_hashes) > 0)
|
||||
return true;
|
||||
|
||||
if (!st || !st->header.data_size)
|
||||
@@ -89,7 +89,7 @@ bool glitter_texture_hashes_unpack_file(glitter_effect_group* a1, f2_struct* st)
|
||||
}
|
||||
|
||||
bool glitter_texture_resource_pack_file(glitter_effect_group* a1, f2_struct* st) {
|
||||
if (a1->resources_tex.end - a1->resources_tex.begin < 1)
|
||||
if (vector_length(a1->resources_tex) < 1)
|
||||
return false;
|
||||
|
||||
memset(st, 0, sizeof(f2_struct));
|
||||
@@ -118,9 +118,9 @@ bool glitter_texture_load(GPM, glitter_effect_group* a1) {
|
||||
if (!a1->resources_count)
|
||||
return false;
|
||||
|
||||
size_t count = a1->resources_tex.end - a1->resources_tex.begin;
|
||||
size_t count = vector_length(a1->resources_tex);
|
||||
|
||||
if (!count || !a1->resources_count || a1->resources_count != count)
|
||||
if (count < 1 || a1->resources_count < 1 || a1->resources_count != count)
|
||||
return false;
|
||||
|
||||
uint32_t* ids = force_malloc_s(uint32_t, count);
|
||||
|
||||
@@ -22,7 +22,7 @@ bool glitter_x_curve_get_value(glitter_curve* c,
|
||||
bool negate;
|
||||
float_t _value;
|
||||
|
||||
keys_count = c->keys.end - c->keys.begin;
|
||||
keys_count = vector_length(c->keys);
|
||||
if (!keys_count)
|
||||
return false;
|
||||
|
||||
@@ -106,7 +106,7 @@ static void glitter_x_curve_get_key_indexes(vector_glitter_curve_key* keys,
|
||||
size_t v9;
|
||||
size_t v10;
|
||||
|
||||
count = keys->end - keys->begin;
|
||||
count = vector_length(*keys);
|
||||
if (count <= 1) {
|
||||
*curr = 0;
|
||||
*next = 0;
|
||||
|
||||
@@ -103,7 +103,7 @@ glitter_effect_inst* glitter_x_effect_inst_init(GPM, glitter_effect* a1,
|
||||
ei->flags |= GLITTER_EFFECT_INST_FLAG_GET_EXT_ANIM_MAT;
|
||||
}
|
||||
|
||||
vector_ptr_glitter_emitter_inst_reserve(&ei->emitters, a1->emitters.end - a1->emitters.begin);
|
||||
vector_ptr_glitter_emitter_inst_reserve(&ei->emitters, vector_length(a1->emitters));
|
||||
for (i = a1->emitters.begin; i != a1->emitters.end; i++) {
|
||||
if (!*i)
|
||||
continue;
|
||||
@@ -411,7 +411,7 @@ static void glitter_x_effect_inst_get_value(glitter_effect_inst* a1) {
|
||||
glitter_curve* curve;
|
||||
float_t value;
|
||||
|
||||
length = a1->effect->animation.end - a1->effect->animation.begin;
|
||||
length = vector_length(a1->effect->animation);
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
@@ -477,7 +477,7 @@ static void glitter_x_effect_inst_update_init(glitter_effect_inst* a1, float_t e
|
||||
float_t delta_frame;
|
||||
float_t start_time;
|
||||
|
||||
if (a1->data.start_time <= 0)
|
||||
if (a1->data.start_time < 1)
|
||||
return;
|
||||
|
||||
delta_frame = 2.0f;
|
||||
|
||||
@@ -59,7 +59,7 @@ glitter_emitter_inst* glitter_x_emitter_inst_init(glitter_emitter* a1,
|
||||
ei->emission = GLITTER_EMITTER_EMISSION_ON_TIMER;
|
||||
ei->loop = ei->data.flags & GLITTER_EMITTER_LOOP ? true : false;
|
||||
|
||||
vector_ptr_glitter_particle_inst_reserve(&ei->particles, a1->particles.end - a1->particles.begin);
|
||||
vector_ptr_glitter_particle_inst_reserve(&ei->particles, vector_length(a1->particles));
|
||||
for (i = a1->particles.begin; i != a1->particles.end; i++) {
|
||||
if (!*i)
|
||||
continue;
|
||||
@@ -287,11 +287,8 @@ void glitter_x_emitter_inst_update(GPM,
|
||||
if (has_dist) {
|
||||
mat4_get_translation(&mat, &trans);
|
||||
|
||||
vec3 trans_diff;
|
||||
vec3_sub(trans, trans_prev, trans_diff);
|
||||
|
||||
float_t trans_dist;
|
||||
vec3_length(trans_diff, trans_dist);
|
||||
vec3_distance(trans, trans_prev, trans_dist);
|
||||
a1->emission_timer -= trans_dist;
|
||||
}
|
||||
|
||||
@@ -347,12 +344,9 @@ void glitter_x_emitter_inst_update_init(glitter_emitter_inst* a1,
|
||||
mat4_rot(&mat_ext_anim, rot.x, rot.y, rot.z, &a1->mat_rot);
|
||||
a1->mat = mat;
|
||||
|
||||
vec3 trans_diff;
|
||||
mat4_get_translation(&mat, &trans);
|
||||
vec3_sub(trans, trans_prev, trans_diff);
|
||||
|
||||
float_t trans_dist;
|
||||
vec3_length(trans_diff, trans_dist);
|
||||
mat4_get_translation(&mat, &trans);
|
||||
vec3_distance(trans, trans_prev, trans_dist);
|
||||
a1->emission_timer -= trans_dist;
|
||||
}
|
||||
a1->flags |= GLITTER_EMITTER_INST_HAS_DISTANCE;
|
||||
@@ -383,7 +377,7 @@ static void glitter_x_emitter_inst_get_value(glitter_emitter_inst* a1) {
|
||||
glitter_curve* curve;
|
||||
float_t value;
|
||||
|
||||
length = a1->emitter->animation.end - a1->emitter->animation.begin;
|
||||
length = vector_length(a1->emitter->animation);
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void glitter_x_locus_history_append(glitter_locus_history* a1,
|
||||
vec3 temp1;
|
||||
|
||||
data = a1->data.begin;
|
||||
size = a1->data.end - a1->data.begin;
|
||||
size = vector_length(a1->data);
|
||||
temp = a2->translation;
|
||||
if (a3->data.data.flags & GLITTER_PARTICLE_EMITTER_LOCAL && (emitter = a3->data.emitter)) {
|
||||
vec3 emit_trans;
|
||||
@@ -39,7 +39,7 @@ void glitter_x_locus_history_append(glitter_locus_history* a1,
|
||||
vector_glitter_locus_history_data_push_back(&a1->data, &locus_history);
|
||||
else if (size == 1) {
|
||||
locus_history.translation = data->translation;
|
||||
if (a1->data.capacity_end - a1->data.begin > 1)
|
||||
if (vector_capacity(a1->data) > 1)
|
||||
vector_glitter_locus_history_data_push_back(&a1->data, &locus_history);
|
||||
data->translation = temp;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void glitter_x_locus_history_append(glitter_locus_history* a1,
|
||||
for (i = size - 1; i > 0; i--)
|
||||
data[i].translation = data[i - 1].translation;
|
||||
|
||||
if (size < a1->data.capacity_end - a1->data.begin) {
|
||||
if (size < vector_capacity(a1->data)) {
|
||||
locus_history.translation = temp1;
|
||||
vector_glitter_locus_history_data_push_back(&a1->data, &locus_history);
|
||||
}
|
||||
|
||||
@@ -286,10 +286,10 @@ void glitter_x_render_element_update(glitter_render_group* a1,
|
||||
has_translation = false;
|
||||
translation = vec3_null;
|
||||
|
||||
glitter_animation curv = particle->particle->animation;
|
||||
length = curv.end - curv.begin;
|
||||
glitter_animation* curv = &particle->particle->animation;
|
||||
length = vector_length(*curv);
|
||||
for (int32_t i = 0; i < length; i++) {
|
||||
curve = curv.begin[i];
|
||||
curve = curv->begin[i];
|
||||
if (!glitter_x_curve_get_value(curve, a2->frame,
|
||||
&value, a2->random + i, a1->random_ptr))
|
||||
continue;
|
||||
|
||||
@@ -333,7 +333,7 @@ void glitter_x_render_group_draw(GPM, glitter_render_group* a1) {
|
||||
gl_state_bind_array_buffer(0);
|
||||
|
||||
const GLenum mode = a1->type == GLITTER_PARTICLE_LINE ? GL_LINE_STRIP : GL_TRIANGLE_STRIP;
|
||||
const size_t count = a1->vec_key.end - a1->vec_key.begin;
|
||||
const size_t count = vector_length(a1->vec_key);
|
||||
for (size_t i = 0; i < count; i++)
|
||||
shader_draw_arrays(&shaders_ft,
|
||||
mode, a1->vec_key.begin[i], a1->vec_val.begin[i]);
|
||||
@@ -463,7 +463,7 @@ static glitter_render_element* glitter_x_render_group_add_render_element(glitter
|
||||
|
||||
v3 = a1->count - (a2 - a1->elements);
|
||||
v4 = 0;
|
||||
if (v3 <= 0)
|
||||
if (v3 < 1)
|
||||
return 0;
|
||||
|
||||
while (a2->alive) {
|
||||
@@ -493,7 +493,7 @@ static void glitter_x_render_group_calc_draw_line(glitter_render_group* a1) {
|
||||
glitter_locus_history_data* hist_data;
|
||||
size_t index;
|
||||
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl <= 0)
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl < 1)
|
||||
return;
|
||||
|
||||
for (count = 0, i = a1->ctrl, elem = a1->elements; i > 0; i--, elem++) {
|
||||
@@ -501,7 +501,7 @@ static void glitter_x_render_group_calc_draw_line(glitter_render_group* a1) {
|
||||
continue;
|
||||
|
||||
if (elem->locus_history) {
|
||||
size_t length = elem->locus_history->data.end - elem->locus_history->data.begin;
|
||||
size_t length = vector_length(elem->locus_history->data);
|
||||
if (length > 1)
|
||||
count += length;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ static void glitter_x_render_group_calc_draw_line(glitter_render_group* a1) {
|
||||
|
||||
i--;
|
||||
hist = elem->locus_history;
|
||||
if (!elem->draw || !hist || hist->data.end - hist->data.begin < 2)
|
||||
if (!elem->draw || !hist || vector_length(hist->data) < 2)
|
||||
continue;
|
||||
|
||||
if (has_scale)
|
||||
@@ -592,7 +592,7 @@ static void glitter_x_render_group_calc_draw_locus(GPM, glitter_render_group* a1
|
||||
mat4 mat;
|
||||
mat3 model_mat;
|
||||
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl <= 0)
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl < 1)
|
||||
return;
|
||||
|
||||
for (count = 0, i = a1->ctrl, elem = a1->elements; i > 0; i--, elem++) {
|
||||
@@ -600,7 +600,7 @@ static void glitter_x_render_group_calc_draw_locus(GPM, glitter_render_group* a1
|
||||
continue;
|
||||
|
||||
if (elem->locus_history) {
|
||||
size_t length = elem->locus_history->data.end - elem->locus_history->data.begin;
|
||||
size_t length = vector_length(elem->locus_history->data);
|
||||
if (length > 1)
|
||||
count += 2 * length;
|
||||
}
|
||||
@@ -651,13 +651,13 @@ static void glitter_x_render_group_calc_draw_locus(GPM, glitter_render_group* a1
|
||||
|
||||
i--;
|
||||
hist = elem->locus_history;
|
||||
if (!elem->draw || !hist || hist->data.end - hist->data.begin < 2)
|
||||
if (!elem->draw || !hist || vector_length(hist->data) < 2)
|
||||
continue;
|
||||
|
||||
uv_u = elem->uv.x + elem->uv_scroll.x;
|
||||
uv_u_2nd = elem->uv.x + elem->uv_scroll.x + a1->split_uv.x;
|
||||
uv_v_2nd = elem->uv.y + elem->uv_scroll.y + a1->split_uv.y;
|
||||
uv_v_scale = a1->split_uv.y / (float_t)(hist->data.end - hist->data.begin - 1);
|
||||
uv_v_scale = a1->split_uv.y / (float_t)(vector_length(hist->data) - 1);
|
||||
|
||||
uv_v_2nd = 1.0f - uv_v_2nd;
|
||||
|
||||
@@ -910,7 +910,7 @@ static void glitter_x_render_group_calc_draw_quad(GPM, glitter_render_group* a1)
|
||||
mat4 view_mat;
|
||||
mat4 inv_view_mat;
|
||||
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl <= 0)
|
||||
if (!a1->elements || !a1->vbo || a1->ctrl < 1)
|
||||
return;
|
||||
|
||||
if (a1->flags & GLITTER_PARTICLE_EMITTER_LOCAL) {
|
||||
|
||||
+54
-60
@@ -334,127 +334,127 @@ void auth_3d_load(auth_3d* auth, a3da* auth_file,
|
||||
auth->last_frame = auth->play_control.size;
|
||||
auth->paused = false;
|
||||
|
||||
if (auth_file->ambient.end - auth_file->ambient.begin > 0) {
|
||||
if (vector_length(auth_file->ambient) > 0) {
|
||||
vector_auth_3d_ambient* va = &auth->ambient;
|
||||
vector_a3da_ambient* vaf = &auth_file->ambient;
|
||||
vector_auth_3d_ambient_reserve(va, vaf->end - vaf->begin);
|
||||
vector_auth_3d_ambient_reserve(va, vector_length(*vaf));
|
||||
for (auth_3d_ambient_file* i = vaf->begin; i != vaf->end; i++)
|
||||
auth_3d_ambient_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->auth_2d.end - auth_file->auth_2d.begin > 0) {
|
||||
if (vector_length(auth_file->auth_2d) > 0) {
|
||||
vector_string* va2 = &auth->auth_2d;
|
||||
vector_string* va2f = &auth_file->auth_2d;
|
||||
vector_string_reserve(va2, va2f->end - va2f->begin);
|
||||
vector_string_reserve(va2, vector_length(*va2f));
|
||||
for (string* i = va2f->begin; i != va2f->end; i++) {
|
||||
string* m = vector_string_reserve_back(va2f);
|
||||
string_copy(i, m);
|
||||
}
|
||||
}
|
||||
|
||||
if (auth_file->camera_root.end - auth_file->camera_root.begin > 0) {
|
||||
if (vector_length(auth_file->camera_root) > 0) {
|
||||
vector_auth_3d_camera_root* vcr = &auth->camera_root;
|
||||
vector_a3da_camera_root* vcrf = &auth_file->camera_root;
|
||||
vector_auth_3d_camera_root_reserve(vcr, vcrf->end - vcrf->begin);
|
||||
vector_auth_3d_camera_root_reserve(vcr, vector_length(*vcrf));
|
||||
for (auth_3d_camera_root_file* i = vcrf->begin; i != vcrf->end; i++)
|
||||
auth_3d_camera_root_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->chara.end - auth_file->chara.begin > 0) {
|
||||
if (vector_length(auth_file->chara) > 0) {
|
||||
vector_auth_3d_chara* vc = &auth->chara;
|
||||
vector_a3da_chara* vcf = &auth_file->chara;
|
||||
vector_auth_3d_chara_reserve(vc, vcf->end - vcf->begin);
|
||||
vector_auth_3d_chara_reserve(vc, vector_length(*vcf));
|
||||
for (auth_3d_chara_file* i = vcf->begin; i != vcf->end; i++)
|
||||
auth_3d_chara_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->curve.end - auth_file->curve.begin > 0) {
|
||||
if (vector_length(auth_file->curve) > 0) {
|
||||
vector_auth_3d_curve* vc = &auth->curve;
|
||||
vector_a3da_curve* vcf = &auth_file->curve;
|
||||
vector_auth_3d_curve_reserve(vc, vcf->end - vcf->begin);
|
||||
vector_auth_3d_curve_reserve(vc, vector_length(*vcf));
|
||||
for (auth_3d_curve_file* i = vcf->begin; i != vcf->end; i++)
|
||||
auth_3d_curve_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->event.end - auth_file->event.begin > 0) {
|
||||
if (vector_length(auth_file->event) > 0) {
|
||||
vector_auth_3d_event* ve = &auth->event;
|
||||
vector_a3da_event* vef = &auth_file->event;
|
||||
vector_auth_3d_event_reserve(ve, vef->end - vef->begin);
|
||||
vector_auth_3d_event_reserve(ve, vector_length(*vef));
|
||||
for (auth_3d_event_file* i = vef->begin; i != vef->end; i++)
|
||||
auth_3d_event_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->fog.end - auth_file->fog.begin > 0) {
|
||||
if (vector_length(auth_file->fog) > 0) {
|
||||
vector_auth_3d_fog* vf = &auth->fog;
|
||||
vector_a3da_fog* vff = &auth_file->fog;
|
||||
vector_auth_3d_fog_reserve(vf, vff->end - vff->begin);
|
||||
vector_auth_3d_fog_reserve(vf, vector_length(*vff));
|
||||
for (auth_3d_fog_file* i = vff->begin; i != vff->end; i++)
|
||||
auth_3d_fog_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->light.end - auth_file->light.begin > 0) {
|
||||
if (vector_length(auth_file->light) > 0) {
|
||||
vector_auth_3d_light* vl = &auth->light;
|
||||
vector_a3da_light* vlf = &auth_file->light;
|
||||
vector_auth_3d_light_reserve(vl, vlf->end - vlf->begin);
|
||||
vector_auth_3d_light_reserve(vl, vector_length(*vlf));
|
||||
for (auth_3d_light_file* i = vlf->begin; i != vlf->end; i++)
|
||||
auth_3d_light_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->m_object_hrc.end - auth_file->m_object_hrc.begin > 0) {
|
||||
if (vector_length(auth_file->m_object_hrc) > 0) {
|
||||
vector_auth_3d_m_object_hrc* vmoh = &auth->m_object_hrc;
|
||||
vector_a3da_m_object_hrc* vmohf = &auth_file->m_object_hrc;
|
||||
vector_auth_3d_m_object_hrc_reserve(vmoh, vmohf->end - vmohf->begin);
|
||||
vector_auth_3d_m_object_hrc_reserve(vmoh, vector_length(*vmohf));
|
||||
for (auth_3d_m_object_hrc_file* i = vmohf->begin; i != vmohf->end; i++)
|
||||
auth_3d_m_object_hrc_load(auth, i, obj_db);
|
||||
}
|
||||
|
||||
if (auth_file->material_list.end - auth_file->material_list.begin > 0) {
|
||||
if (vector_length(auth_file->material_list) > 0) {
|
||||
vector_auth_3d_material_list* vml = &auth->material_list;
|
||||
vector_a3da_material_list* vmlf = &auth_file->material_list;
|
||||
vector_auth_3d_material_list_reserve(vml, vmlf->end - vmlf->begin);
|
||||
vector_auth_3d_material_list_reserve(vml, vector_length(*vmlf));
|
||||
for (auth_3d_material_list_file* i = vmlf->begin; i != vmlf->end; i++)
|
||||
auth_3d_material_list_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->motion.end - auth_file->motion.begin > 0) {
|
||||
if (vector_length(auth_file->motion) > 0) {
|
||||
vector_string* vm = &auth->motion;
|
||||
vector_string* vmf = &auth_file->motion;
|
||||
vector_string_reserve(vm, vmf->end - vmf->begin);
|
||||
vector_string_reserve(vm, vector_length(*vmf));
|
||||
for (string* i = vmf->begin; i != vmf->end; i++) {
|
||||
string* m = vector_string_reserve_back(vm);
|
||||
string_copy(i, m);
|
||||
}
|
||||
}
|
||||
|
||||
if (auth_file->object.end - auth_file->object.begin > 0) {
|
||||
if (vector_length(auth_file->object) > 0) {
|
||||
vector_auth_3d_object* vo = &auth->object;
|
||||
vector_a3da_object* vof = &auth_file->object;
|
||||
vector_auth_3d_object_reserve(vo, vof->end - vof->begin);
|
||||
vector_auth_3d_object_reserve(vo, vector_length(*vof));
|
||||
for (auth_3d_object_file* i = vof->begin; i != vof->end; i++)
|
||||
auth_3d_object_load(auth, i, obj_db, tex_db);
|
||||
}
|
||||
|
||||
if (auth_file->object_hrc.end - auth_file->object_hrc.begin > 0) {
|
||||
if (vector_length(auth_file->object_hrc) > 0) {
|
||||
vector_auth_3d_object_hrc* voh = &auth->object_hrc;
|
||||
vector_a3da_object_hrc* vohf = &auth_file->object_hrc;
|
||||
vector_auth_3d_object_hrc_reserve(voh, vohf->end - vohf->begin);
|
||||
vector_auth_3d_object_hrc_reserve(voh, vector_length(*vohf));
|
||||
for (auth_3d_object_hrc_file* i = vohf->begin; i != vohf->end; i++)
|
||||
auth_3d_object_hrc_load(auth, i, obj_db);
|
||||
}
|
||||
|
||||
if (auth_file->point.end - auth_file->point.begin > 0) {
|
||||
if (vector_length(auth_file->point) > 0) {
|
||||
vector_auth_3d_point* vp = &auth->point;
|
||||
vector_a3da_point* vpf = &auth_file->point;
|
||||
vector_auth_3d_point_reserve(vp, vpf->end - vpf->begin);
|
||||
vector_auth_3d_point_reserve(vp, vector_length(*vpf));
|
||||
for (auth_3d_point_file* i = vpf->begin; i != vpf->end; i++)
|
||||
auth_3d_point_load(auth, i);
|
||||
}
|
||||
|
||||
if (auth_file->m_object_hrc_list.end - auth_file->m_object_hrc_list.begin > 0) {
|
||||
if (vector_length(auth_file->m_object_hrc_list) > 0) {
|
||||
vector_auth_3d_m_object_hrc* vmoh = &auth->m_object_hrc;
|
||||
vector_ptr_auth_3d_m_object_hrc* vmohl = &auth->m_object_hrc_list;
|
||||
vector_string* vmohlf = &auth_file->m_object_hrc_list;
|
||||
vector_ptr_auth_3d_m_object_hrc_reserve(vmohl, vmohlf->end - vmohlf->begin);
|
||||
vector_ptr_auth_3d_m_object_hrc_reserve(vmohl, vector_length(*vmohlf));
|
||||
for (string* i = vmohlf->begin; i != vmohlf->end; i++)
|
||||
for (auth_3d_m_object_hrc* j = vmoh->begin; vmoh->begin != vmoh->end; j++)
|
||||
if (string_compare(i, &j->name)) {
|
||||
@@ -463,11 +463,11 @@ void auth_3d_load(auth_3d* auth, a3da* auth_file,
|
||||
}
|
||||
}
|
||||
|
||||
if (auth_file->object_list.end - auth_file->object_list.begin > 0) {
|
||||
if (vector_length(auth_file->object_list) > 0) {
|
||||
vector_auth_3d_object* vo = &auth->object;
|
||||
vector_ptr_auth_3d_object* vol = &auth->object_list;
|
||||
vector_string* volf = &auth_file->object_list;
|
||||
vector_ptr_auth_3d_object_reserve(vol, volf->end - volf->begin);
|
||||
vector_ptr_auth_3d_object_reserve(vol, vector_length(*volf));
|
||||
for (string* i = volf->begin; i != volf->end; i++)
|
||||
for (auth_3d_object* j = vo->begin; vo->begin != vo->end; j++)
|
||||
if (string_compare(i, &j->name)) {
|
||||
@@ -476,11 +476,11 @@ void auth_3d_load(auth_3d* auth, a3da* auth_file,
|
||||
}
|
||||
}
|
||||
|
||||
if (auth_file->object_hrc_list.end - auth_file->object_hrc_list.begin > 0) {
|
||||
if (vector_length(auth_file->object_hrc_list) > 0) {
|
||||
vector_auth_3d_object_hrc* voh = &auth->object_hrc;
|
||||
vector_ptr_auth_3d_object_hrc* vohl = &auth->object_hrc_list;
|
||||
vector_string* vohlf = &auth_file->object_hrc_list;
|
||||
vector_ptr_auth_3d_object_hrc_reserve(vohl, vohlf->end - vohlf->begin);
|
||||
vector_ptr_auth_3d_object_hrc_reserve(vohl, vector_length(*vohlf));
|
||||
for (string* i = vohlf->begin; i != vohlf->end; i++)
|
||||
for (auth_3d_object_hrc* j = voh->begin; voh->begin != voh->end; j++)
|
||||
if (string_compare(i, &j->name)) {
|
||||
@@ -489,7 +489,7 @@ void auth_3d_load(auth_3d* auth, a3da* auth_file,
|
||||
}
|
||||
}
|
||||
|
||||
if (auth->object.end - auth->object.begin > 0) {
|
||||
if (vector_length(auth->object) > 0) {
|
||||
vector_auth_3d_object* vo = &auth->object;
|
||||
vector_auth_3d_object_hrc* voh = &auth->object_hrc;
|
||||
for (auth_3d_object* i = vo->begin; i != vo->end; i++) {
|
||||
@@ -523,7 +523,7 @@ void auth_3d_load(auth_3d* auth, a3da* auth_file,
|
||||
}
|
||||
}
|
||||
|
||||
if (auth->object_hrc.end - auth->object_hrc.begin > 0) {
|
||||
if (vector_length(auth->object_hrc) > 0) {
|
||||
vector_auth_3d_object* vo = &auth->object;
|
||||
vector_auth_3d_object_hrc* voh = &auth->object_hrc;
|
||||
for (auth_3d_object_hrc* i = voh->begin; i != voh->end; i++) {
|
||||
@@ -618,7 +618,7 @@ void auth_3d_farc_load(auth_3d_farc* f, void* data, char* name, object_database*
|
||||
string_init(&file, name);
|
||||
string_add_length(&file, ".farc", 5);
|
||||
data_struct_load_file(data, &f->auth_3d_farc,
|
||||
"rom\\auth_3d\\", string_data(&file), farc_load_file);
|
||||
"rom/auth_3d/", string_data(&file), farc_load_file);
|
||||
string_free(&file);
|
||||
|
||||
bool found_base = false;
|
||||
@@ -1485,8 +1485,7 @@ void auth_3d_data_init() {
|
||||
}
|
||||
|
||||
inline int32_t auth_3d_data_load_uid(int32_t uid, auth_3d_database* auth_3d_db) {
|
||||
if (uid >= auth_3d_db->uid.end - auth_3d_db->uid.begin
|
||||
|| !auth_3d_db->uid.begin[uid].enabled)
|
||||
if (uid >= vector_length(auth_3d_db->uid) || !auth_3d_db->uid.begin[uid].enabled)
|
||||
return -1;
|
||||
|
||||
int32_t index = 0;
|
||||
@@ -1526,7 +1525,7 @@ mat4* auth_3d_data_struct_get_auth_3d_object_mat(int32_t id, size_t index, bool
|
||||
if (hrc)
|
||||
return auth_3d_get_auth_3d_object_hrc_bone_mats(auth, index);
|
||||
|
||||
if ((ssize_t)index < auth->object.end - auth->object.begin) {
|
||||
if ((ssize_t)index < vector_length(auth->object)) {
|
||||
mat4u_to_mat4(&auth->object.begin[index].model_transform.mat, mat);
|
||||
return mat;
|
||||
}
|
||||
@@ -1606,14 +1605,13 @@ static kft3* auth_3d_key_find_keyframe(auth_3d_key* data, float_t frame) {
|
||||
kft3* key = data->keys;
|
||||
size_t length = data->length;
|
||||
size_t temp;
|
||||
while (length > 0) {
|
||||
while (length > 0)
|
||||
if (frame < key[temp = length / 2].frame)
|
||||
length = temp;
|
||||
else {
|
||||
key += temp + 1;
|
||||
length -= temp + 1;
|
||||
}
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -1724,7 +1722,7 @@ static void auth_3d_key_load(auth_3d* auth, auth_3d_key* k, auth_3d_key_file* kf
|
||||
k->frame_delta = k->max_frame;
|
||||
k->value_delta = 0.0f;
|
||||
|
||||
ssize_t length = kf->keys.end - kf->keys.begin;
|
||||
ssize_t length = vector_length(kf->keys);
|
||||
switch (kf->type) {
|
||||
case A3DA_KEY_NONE:
|
||||
k->type = AUTH_3D_KEY_NONE;
|
||||
@@ -1866,8 +1864,7 @@ static int32_t auth_3d_get_auth_3d_object_index_by_object_info(auth_3d* auth, ob
|
||||
|
||||
static mat4* auth_3d_get_auth_3d_object_hrc_bone_mats(auth_3d* auth, size_t index) {
|
||||
vector_auth_3d_object_hrc* voh = &auth->object_hrc;
|
||||
if ((ssize_t)index >= voh->end - voh->begin
|
||||
|| voh->begin[index].mats.begin == voh->begin[index].mats.end)
|
||||
if ((ssize_t)index >= vector_length(*voh) || vector_length(voh->begin[index].mats) < 1)
|
||||
return 0;
|
||||
return voh->begin[index].mats.begin;
|
||||
}
|
||||
@@ -2118,10 +2115,8 @@ static void auth_3d_dof_data_set(auth_3d_dof* d, render_context* rctx) {
|
||||
vec3 view_point;
|
||||
camera_get_view_point(rctx->camera, &view_point);
|
||||
|
||||
vec3 diff;
|
||||
float_t focus;
|
||||
vec3_sub(d->model_transform.translation_value, view_point, diff);
|
||||
vec3_length(diff, focus);
|
||||
vec3_distance(d->model_transform.translation_value, view_point, focus);
|
||||
|
||||
dof_pv pv;
|
||||
pv.enable = fabsf(d->model_transform.rotation_value.z) > 0.000001f;
|
||||
@@ -2516,7 +2511,7 @@ static void auth_3d_m_object_hrc_load(auth_3d* auth,
|
||||
auth_3d_m_object_hrc* moh
|
||||
= vector_auth_3d_m_object_hrc_reserve_back(&auth->m_object_hrc);
|
||||
|
||||
vector_auth_3d_object_node_reserve(&moh->node, mohf->node.end - mohf->node.begin);
|
||||
vector_auth_3d_object_node_reserve(&moh->node, vector_length(mohf->node));
|
||||
for (auth_3d_object_node_file* i = mohf->node.begin; i != mohf->node.end; i++)
|
||||
auth_3d_object_node_load(auth, &moh->node, i);
|
||||
|
||||
@@ -2571,7 +2566,7 @@ static void auth_3d_m_object_hrc_data_set(auth_3d_m_object_hrc* moh, auth_3d* au
|
||||
vector_vec3_push_back(&shad->field_1D0[shadow_type], &pos);
|
||||
}
|
||||
|
||||
if (i->mats.end - i->mats.begin > 0) {
|
||||
if (vector_length(i->mats) > 0) {
|
||||
mat4 mat;
|
||||
mat4u_to_mat4(&i->model_transform.mat, &mat);
|
||||
draw_task_add_draw_object_by_object_info_object_skin(rctx,
|
||||
@@ -2588,7 +2583,7 @@ static void auth_3d_m_object_hrc_list_get_value(auth_3d_m_object_hrc* moh, mat4*
|
||||
return;
|
||||
|
||||
auth_3d_object_node* node = moh->node.begin;
|
||||
size_t instance_count = moh->instance.end - moh->instance.begin;
|
||||
size_t instance_count = vector_length(moh->instance);
|
||||
|
||||
auth_3d_m_object_hrc_nodes_mat_mult(moh);
|
||||
|
||||
@@ -2603,7 +2598,7 @@ static void auth_3d_m_object_hrc_list_get_value(auth_3d_m_object_hrc* moh, mat4*
|
||||
|
||||
auth_3d_object_model_transform_mat_mult(&i->model_transform, &mat);
|
||||
int32_t* object_bone_indices = i->object_bone_indices.begin;
|
||||
size_t object_bone_indices_count = i->object_bone_indices.end - i->object_bone_indices.begin;
|
||||
size_t object_bone_indices_count = vector_length(i->object_bone_indices);
|
||||
mat4* mats = i->mats.begin;
|
||||
for (size_t j = 0; j < object_bone_indices_count; j++)
|
||||
mat4u_to_mat4(&node[object_bone_indices[j]].model_transform.mat, &mats[j]);
|
||||
@@ -2668,13 +2663,13 @@ static void auth_3d_object_load(auth_3d* auth, auth_3d_object_file* of,
|
||||
auth_3d_object_curve_load(auth, &o->pattern, &of->pattern, of->pattern_offset);
|
||||
|
||||
vector_auth_3d_object_texture_pattern_reserve(&o->texture_pattern,
|
||||
of->texture_pattern.end - of->texture_pattern.begin);
|
||||
vector_length(of->texture_pattern));
|
||||
for (auth_3d_object_texture_pattern_file* i = of->texture_pattern.begin;
|
||||
i != of->texture_pattern.end; i++)
|
||||
auth_3d_object_texture_pattern_load(auth, o, i, tex_db);
|
||||
|
||||
vector_auth_3d_object_texture_transform_reserve(&o->texture_transform,
|
||||
of->texture_transform.end - of->texture_transform.begin);
|
||||
vector_length(of->texture_transform));
|
||||
for (auth_3d_object_texture_transform_file* i = of->texture_transform.begin;
|
||||
i != of->texture_transform.end; i++)
|
||||
auth_3d_object_texture_transform_load(auth, o, i, tex_db);
|
||||
@@ -2865,7 +2860,7 @@ static void auth_3d_object_hrc_load(auth_3d* auth,
|
||||
|
||||
string_copy(&ohf->name, &oh->name);
|
||||
|
||||
vector_auth_3d_object_node_reserve(&oh->node, ohf->node.end - ohf->node.begin);
|
||||
vector_auth_3d_object_node_reserve(&oh->node, vector_length(ohf->node));
|
||||
for (auth_3d_object_node_file* i = ohf->node.begin; i != ohf->node.end; i++)
|
||||
auth_3d_object_node_load(auth, &oh->node, i);
|
||||
|
||||
@@ -2938,7 +2933,7 @@ static void auth_3d_object_hrc_data_set(auth_3d_object_hrc* oh, auth_3d* auth, r
|
||||
vector_vec3_push_back(&shad->field_1D0[SHADOW_STAGE], &pos);
|
||||
}
|
||||
|
||||
if (oh->mats.end - oh->mats.begin > 0) {
|
||||
if (vector_length(oh->mats) > 0) {
|
||||
mat4 mat = mat4_identity;
|
||||
draw_task_add_draw_object_by_object_info_object_skin(rctx,
|
||||
oh->object_info, 0, 0, auth->alpha, oh->mats.begin, 0, 0, &mat);
|
||||
@@ -2957,14 +2952,13 @@ static void auth_3d_object_hrc_data_set(auth_3d_object_hrc* oh, auth_3d* auth, r
|
||||
}
|
||||
|
||||
static void auth_3d_object_hrc_list_get_value(auth_3d_object_hrc* oh, mat4* mat) {
|
||||
if (!(oh->node.end - oh->node.begin)
|
||||
|| ! oh->node.begin[0].model_transform.visible)
|
||||
if (vector_length(oh->node) < 1 || !oh->node.begin[0].model_transform.visible)
|
||||
return;
|
||||
|
||||
auth_3d_object_hrc_nodes_mat_mult(oh, mat);
|
||||
|
||||
int32_t* childer_object_parent_node = oh->childer_object_parent_node.begin;
|
||||
size_t children_object_count = oh->children_object.end - oh->children_object.begin;
|
||||
size_t children_object_count = vector_length(oh->children_object);
|
||||
for (size_t i = 0; i < children_object_count; i++) {
|
||||
mat4 mat;
|
||||
mat4u_to_mat4(&oh->node.begin[childer_object_parent_node[i]].model_transform.mat, &mat);
|
||||
@@ -2972,7 +2966,7 @@ static void auth_3d_object_hrc_list_get_value(auth_3d_object_hrc* oh, mat4* mat)
|
||||
}
|
||||
|
||||
int32_t* childer_object_hrc_parent_node = oh->childer_object_hrc_parent_node.begin;
|
||||
size_t children_object_hrc_count = oh->children_object_hrc.end - oh->children_object_hrc.begin;
|
||||
size_t children_object_hrc_count = vector_length(oh->children_object_hrc);
|
||||
for (size_t i = 0; i < children_object_hrc_count; i++) {
|
||||
mat4 mat;
|
||||
mat4u_to_mat4(&oh->node.begin[childer_object_hrc_parent_node[i]].model_transform.mat, &mat);
|
||||
|
||||
+3
-1
@@ -16,7 +16,7 @@ static void camera_calculate_forward(camera* c);
|
||||
|
||||
void camera_initialize(camera* c, double_t aspect, int32_t width, int32_t height) {
|
||||
c->aspect = aspect;
|
||||
c->fov = 32.2673416137695;
|
||||
c->fov = 0.0;
|
||||
c->forward = (vec3){ 0.0f, 0.0f, -1.0f };
|
||||
c->rotation = (vec3){ 0.0f, 0.0f, 0.0f };
|
||||
c->view_point = (vec3){ 0.0, 0.0f, 0.0f };
|
||||
@@ -35,7 +35,9 @@ void camera_initialize(camera* c, double_t aspect, int32_t width, int32_t height
|
||||
camera_set_pitch(c, 0.0);
|
||||
camera_set_yaw(c, 0.0);
|
||||
camera_set_roll(c, 0.0);
|
||||
camera_set_fov(c, 32.2673416137695);
|
||||
camera_calculate_forward(c);
|
||||
camera_set_position(c, &((vec3){ 0.0, 0.0f, 0.0f}));
|
||||
camera_update(c);
|
||||
}
|
||||
|
||||
|
||||
+82
-47
@@ -23,10 +23,9 @@ static void data_load_glitter_list(data_struct* ds, char* path);
|
||||
#endif
|
||||
|
||||
void data_struct_init() {
|
||||
for (data_type i = DATA_AFT; i < DATA_MAX; i++) {
|
||||
memset(&data_list[i], 0, sizeof(data_struct));
|
||||
memset(data_list, 0, sizeof(data_struct) * DATA_MAX);
|
||||
for (data_type i = DATA_AFT; i < DATA_MAX; i++)
|
||||
data_list[i].type = i;
|
||||
}
|
||||
}
|
||||
|
||||
void data_struct_load(char* path) {
|
||||
@@ -59,16 +58,20 @@ void data_struct_get_directory_files(data_struct* ds, char* dir, vector_data_str
|
||||
vector_data_struct_file_clear(data_files, data_struct_file_free);
|
||||
|
||||
size_t dir_len = utf8_length(dir);
|
||||
if (dir_len >= 2 && !memcmp(dir, "./", 2)) {
|
||||
dir += 2;
|
||||
dir_len -= 2;
|
||||
}
|
||||
|
||||
if (dir_len < 3 || memcmp(dir, "rom", 3))
|
||||
return;
|
||||
|
||||
if (dir_len != 3) {
|
||||
dir += 4;
|
||||
dir_len -= 4;
|
||||
}
|
||||
else {
|
||||
dir += 3;
|
||||
dir_len = 0;
|
||||
dir += 3;
|
||||
dir_len -= 3;
|
||||
|
||||
while (*dir == '/' || *dir == '\\') {
|
||||
dir++;
|
||||
dir_len--;
|
||||
}
|
||||
|
||||
size_t max_len = 0;
|
||||
@@ -77,6 +80,13 @@ void data_struct_get_directory_files(data_struct* ds, char* dir, vector_data_str
|
||||
if (max_len < j->path.length)
|
||||
max_len = j->path.length;
|
||||
|
||||
char* dir_temp = force_malloc(dir_len + 1);
|
||||
memcpy(dir_temp, dir, dir_len + 1);
|
||||
|
||||
char* t = dir_temp;
|
||||
while (t = strchr(t, '/'))
|
||||
*t = '\\';
|
||||
|
||||
char* temp = force_malloc(max_len + dir_len + 2);
|
||||
for (data_struct_path* i = ds->data_paths.begin; i != ds->data_paths.end; i++)
|
||||
for (data_struct_directory* j = i->data.begin; j != i->data.end; j++) {
|
||||
@@ -86,7 +96,7 @@ void data_struct_get_directory_files(data_struct* ds, char* dir, vector_data_str
|
||||
memcpy(temp, path, path_len);
|
||||
memcpy(&temp[path_len], "\\", 2);
|
||||
if (dir_len)
|
||||
memcpy(&temp[path_len + 1], dir, dir_len + 1);
|
||||
memcpy(&temp[path_len + 1], dir_temp, dir_len + 1);
|
||||
|
||||
vector_string files = vector_empty(string);
|
||||
path_get_files(&files, temp);
|
||||
@@ -112,22 +122,27 @@ void data_struct_get_directory_files(data_struct* ds, char* dir, vector_data_str
|
||||
vector_string_free(&files, string_free);
|
||||
}
|
||||
|
||||
free(dir_temp);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
bool data_struct_load_file(data_struct* ds, void* data, char* dir, char* file,
|
||||
bool (*load_func)(void* data, char* path, char* file, uint32_t hash)) {
|
||||
size_t dir_len = utf8_length(dir);
|
||||
if (dir_len >= 2 && !memcmp(dir, "./", 2)) {
|
||||
dir += 2;
|
||||
dir_len -= 2;
|
||||
}
|
||||
|
||||
if (dir_len < 3 || memcmp(dir, "rom", 3))
|
||||
return false;
|
||||
|
||||
if (dir_len != 3) {
|
||||
dir += 4;
|
||||
dir_len -= 4;
|
||||
}
|
||||
else {
|
||||
dir += 3;
|
||||
dir_len = 0;
|
||||
dir += 3;
|
||||
dir_len -= 3;
|
||||
|
||||
while (*dir == '/' || *dir == '\\') {
|
||||
dir++;
|
||||
dir_len--;
|
||||
}
|
||||
|
||||
size_t max_len = 0;
|
||||
@@ -136,6 +151,13 @@ bool data_struct_load_file(data_struct* ds, void* data, char* dir, char* file,
|
||||
if (max_len < j->path.length)
|
||||
max_len = j->path.length;
|
||||
|
||||
char* dir_temp = force_malloc(dir_len + 1);
|
||||
memcpy(dir_temp, dir, dir_len + 1);
|
||||
|
||||
char* t = dir_temp;
|
||||
while(t = strchr(t, '/'))
|
||||
*t = '\\';
|
||||
|
||||
char* temp = force_malloc(max_len + dir_len + 2);
|
||||
for (data_struct_path* i = ds->data_paths.begin; i != ds->data_paths.end; i++)
|
||||
for (data_struct_directory* j = i->data.begin; j != i->data.end; j++) {
|
||||
@@ -145,7 +167,7 @@ bool data_struct_load_file(data_struct* ds, void* data, char* dir, char* file,
|
||||
memcpy(temp, path, path_len);
|
||||
memcpy(&temp[path_len], "\\", 2);
|
||||
if (dir_len)
|
||||
memcpy(&temp[path_len + 1], dir, dir_len + 1);
|
||||
memcpy(&temp[path_len + 1], dir_temp, dir_len + 1);
|
||||
|
||||
vector_string files = vector_empty(string);
|
||||
path_get_files(&files, temp);
|
||||
@@ -168,11 +190,13 @@ bool data_struct_load_file(data_struct* ds, void* data, char* dir, char* file,
|
||||
vector_string_free(&files, string_free);
|
||||
|
||||
if (ret) {
|
||||
free(dir_temp);
|
||||
free(temp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
free(dir_temp);
|
||||
free(temp);
|
||||
return false;
|
||||
}
|
||||
@@ -180,16 +204,20 @@ bool data_struct_load_file(data_struct* ds, void* data, char* dir, char* file,
|
||||
bool data_struct_load_file_by_hash(data_struct* ds, void* data, char* dir, uint32_t hash,
|
||||
bool (*load_func)(void* data, char* path, char* file, uint32_t hash)) {
|
||||
size_t dir_len = utf8_length(dir);
|
||||
if (dir_len >= 2 && !memcmp(dir, "./", 2)) {
|
||||
dir += 2;
|
||||
dir_len -= 2;
|
||||
}
|
||||
|
||||
if (dir_len < 3 || memcmp(dir, "rom", 3))
|
||||
return false;
|
||||
|
||||
if (dir_len != 3) {
|
||||
dir += 4;
|
||||
dir_len -= 4;
|
||||
}
|
||||
else {
|
||||
dir += 3;
|
||||
dir_len = 0;
|
||||
dir += 3;
|
||||
dir_len -= 3;
|
||||
|
||||
while (*dir == '/' || *dir == '\\') {
|
||||
dir++;
|
||||
dir_len--;
|
||||
}
|
||||
|
||||
size_t max_len = 0;
|
||||
@@ -198,6 +226,13 @@ bool data_struct_load_file_by_hash(data_struct* ds, void* data, char* dir, uint3
|
||||
if (max_len < j->path.length)
|
||||
max_len = j->path.length;
|
||||
|
||||
char* dir_temp = force_malloc(dir_len + 1);
|
||||
memcpy(dir_temp, dir, dir_len + 1);
|
||||
|
||||
char* t = dir_temp;
|
||||
while (t = strchr(t, '/'))
|
||||
*t = '\\';
|
||||
|
||||
char* temp = force_malloc(max_len + dir_len + 2);
|
||||
for (data_struct_path* i = ds->data_paths.begin; i != ds->data_paths.end; i++)
|
||||
for (data_struct_directory* j = i->data.begin; j != i->data.end; j++) {
|
||||
@@ -207,13 +242,13 @@ bool data_struct_load_file_by_hash(data_struct* ds, void* data, char* dir, uint3
|
||||
memcpy(temp, path, path_len);
|
||||
memcpy(&temp[path_len], "\\", 2);
|
||||
if (dir_len)
|
||||
memcpy(&temp[path_len + 1], dir, dir_len + 1);
|
||||
memcpy(&temp[path_len + 1], dir_temp, dir_len + 1);
|
||||
|
||||
vector_string files = vector_empty(string);
|
||||
path_get_files(&files, temp);
|
||||
|
||||
vector_uint32_t files_murmurhash = vector_empty(uint32_t);
|
||||
vector_uint32_t_reserve(&files_murmurhash, files.end - files.begin);
|
||||
vector_uint32_t_reserve(&files_murmurhash, vector_length(files));
|
||||
for (string* l = files.begin; l != files.end; l++) {
|
||||
char* t = strrchr(string_data(l), '.');
|
||||
size_t t_len = l->length;
|
||||
@@ -236,11 +271,13 @@ bool data_struct_load_file_by_hash(data_struct* ds, void* data, char* dir, uint3
|
||||
vector_uint32_t_free(&files_murmurhash, 0);
|
||||
|
||||
if (ret) {
|
||||
free(dir_temp);
|
||||
free(temp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
free(dir_temp);
|
||||
free(temp);
|
||||
return false;
|
||||
}
|
||||
@@ -364,8 +401,7 @@ static void data_load_inner(stream* s) {
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
char* s = lines[i];
|
||||
data_struct* ds
|
||||
= 0;
|
||||
data_struct* ds = 0;
|
||||
char* main_rom = "rom";
|
||||
char* add_data_rom = "rom";
|
||||
char* add_data = "";
|
||||
@@ -535,8 +571,7 @@ static void data_load_inner(stream* s) {
|
||||
|
||||
char* data_dir_path_temp = force_malloc(add_data_rom_path_len + max_len + add_data_rom_len + 3);
|
||||
if (data_dir_path_temp) {
|
||||
vector_data_struct_directory_reserve(&j->data,
|
||||
data_directories.end - data_directories.begin + 1);
|
||||
vector_data_struct_directory_reserve(&j->data, vector_length(data_directories) + 1);
|
||||
memcpy(data_dir_path_temp, add_data_rom_path, add_data_rom_path_len);
|
||||
data_dir_path_temp[add_data_rom_path_len] = '\\';
|
||||
for (string* k = data_directories.end - 1; k != data_directories.begin - 1; k--) {
|
||||
@@ -579,12 +614,12 @@ static void data_load_inner(stream* s) {
|
||||
|
||||
auth_3d_database_file* base_auth_3d_db = &d->base_auth_3d_db;
|
||||
auth_3d_database_file_init(base_auth_3d_db);
|
||||
data_struct_load_file(ds, base_auth_3d_db, "rom\\auth_3d\\",
|
||||
data_struct_load_file(ds, base_auth_3d_db, "rom/auth_3d/",
|
||||
"auth_3d_db.bin", auth_3d_database_file_load_file);
|
||||
|
||||
auth_3d_database_file mdata_auth_3d_db;
|
||||
auth_3d_database_file_init(&mdata_auth_3d_db);
|
||||
data_struct_load_file(ds, &mdata_auth_3d_db, "rom\\auth_3d\\",
|
||||
data_struct_load_file(ds, &mdata_auth_3d_db, "rom/auth_3d/",
|
||||
"mdata_auth_3d_db.bin", auth_3d_database_file_load_file);
|
||||
|
||||
auth_3d_database* auth_3d_db = &d->auth_3d_db;
|
||||
@@ -595,17 +630,17 @@ static void data_load_inner(stream* s) {
|
||||
bone_database* bone_data = &d->bone_data;
|
||||
bone_database_init(bone_data);
|
||||
bone_data->modern = false;
|
||||
data_struct_load_file(ds, bone_data, "rom\\",
|
||||
data_struct_load_file(ds, bone_data, "rom/",
|
||||
"bone_data.bin", bone_database_load_file);
|
||||
|
||||
motion_database* base_mot_db = &d->base_mot_db;
|
||||
motion_database_init(base_mot_db);
|
||||
data_struct_load_file(ds, base_mot_db, "rom\\rob\\",
|
||||
data_struct_load_file(ds, base_mot_db, "rom/rob/",
|
||||
"mot_db.farc", motion_database_load_file);
|
||||
|
||||
motion_database mdata_mot_db;
|
||||
motion_database_init(&mdata_mot_db);
|
||||
data_struct_load_file(ds, &mdata_mot_db, "rom\\rob\\",
|
||||
data_struct_load_file(ds, &mdata_mot_db, "rom/rob/",
|
||||
"mdata_mot_db.farc", motion_database_load_file);
|
||||
|
||||
motion_database* mot_db = &d->mot_db;
|
||||
@@ -616,13 +651,13 @@ static void data_load_inner(stream* s) {
|
||||
object_database* base_obj_db = &d->base_obj_db;
|
||||
object_database_init(base_obj_db);
|
||||
base_obj_db->modern = false;
|
||||
data_struct_load_file(ds, base_obj_db, "rom\\objset\\",
|
||||
data_struct_load_file(ds, base_obj_db, "rom/objset/",
|
||||
"obj_db.bin", object_database_load_file);
|
||||
|
||||
object_database mdata_obj_db;
|
||||
object_database_init(&mdata_obj_db);
|
||||
mdata_obj_db.modern = false;
|
||||
data_struct_load_file(ds, &mdata_obj_db, "rom\\objset\\",
|
||||
data_struct_load_file(ds, &mdata_obj_db, "rom/objset/",
|
||||
"mdata_obj_db.bin", object_database_load_file);
|
||||
|
||||
object_database* obj_db = &d->obj_db;
|
||||
@@ -633,13 +668,13 @@ static void data_load_inner(stream* s) {
|
||||
stage_database* base_stage_data = &d->base_stage_data;
|
||||
stage_database_init(base_stage_data);
|
||||
base_stage_data->modern = false;
|
||||
data_struct_load_file(ds, base_stage_data, "rom\\",
|
||||
data_struct_load_file(ds, base_stage_data, "rom/",
|
||||
"stage_data.bin", stage_database_load_file);
|
||||
|
||||
stage_database mdata_stage_data;
|
||||
stage_database_init(&mdata_stage_data);
|
||||
mdata_stage_data.modern = false;
|
||||
data_struct_load_file(ds, &mdata_stage_data, "rom\\",
|
||||
data_struct_load_file(ds, &mdata_stage_data, "rom/",
|
||||
"mdata_stage_data.bin", stage_database_load_file);
|
||||
|
||||
stage_database* stage_data = &d->stage_data;
|
||||
@@ -650,13 +685,13 @@ static void data_load_inner(stream* s) {
|
||||
texture_database* base_tex_db = &d->base_tex_db;
|
||||
texture_database_init(base_tex_db);
|
||||
base_tex_db->modern = false;
|
||||
data_struct_load_file(ds, base_tex_db, "rom\\objset\\",
|
||||
data_struct_load_file(ds, base_tex_db, "rom/objset/",
|
||||
"tex_db.bin", texture_database_load_file);
|
||||
|
||||
texture_database mdata_tex_db;
|
||||
texture_database_init(&mdata_tex_db);
|
||||
mdata_tex_db.modern = false;
|
||||
data_struct_load_file(ds, &mdata_tex_db, "rom\\objset\\",
|
||||
data_struct_load_file(ds, &mdata_tex_db, "rom/objset/",
|
||||
"mdata_tex_db.bin", texture_database_load_file);
|
||||
|
||||
texture_database* tex_db = &d->tex_db;
|
||||
@@ -689,7 +724,7 @@ static void data_load_inner(stream* s) {
|
||||
bone_database* bone_data = &d->bone_data;
|
||||
bone_database_init(bone_data);
|
||||
bone_data->modern = true;
|
||||
data_struct_load_file(ds, bone_data, "rom\\",
|
||||
data_struct_load_file(ds, bone_data, "rom/",
|
||||
"bone_data.bon", bone_database_load_file);
|
||||
}
|
||||
|
||||
@@ -700,7 +735,7 @@ static void data_load_inner(stream* s) {
|
||||
bone_database* bone_data = &d->bone_data;
|
||||
bone_database_init(bone_data);
|
||||
bone_data->modern = true;
|
||||
data_struct_load_file(ds, bone_data, "rom\\",
|
||||
data_struct_load_file(ds, bone_data, "rom/",
|
||||
"bone_data.bon", bone_database_load_file);
|
||||
}
|
||||
|
||||
@@ -711,7 +746,7 @@ static void data_load_inner(stream* s) {
|
||||
bone_database* bone_data = &d->bone_data;
|
||||
bone_database_init(bone_data);
|
||||
bone_data->modern = true;
|
||||
data_struct_load_file(ds, bone_data, "rom\\",
|
||||
data_struct_load_file(ds, bone_data, "rom/",
|
||||
"bone_data.bon", bone_database_load_file);
|
||||
}
|
||||
#endif
|
||||
@@ -763,7 +798,7 @@ static void data_load_glitter_list(data_struct* ds, char* path) {
|
||||
vector_uint64_t_reserve(&ds->glitter_list_fnv1a64m, count);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
size_t len = ds->glitter_list_names.begin[i].length;
|
||||
uint64_t hash = hash_fnv1a64m(lines[i], len);
|
||||
uint64_t hash = hash_fnv1a64m(lines[i], len, false);
|
||||
vector_uint64_t_push_back(&ds->glitter_list_fnv1a64m, &hash);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -311,7 +311,7 @@ inline void draw_object_model_mat_load(render_context* rctx, mat4* mat) {
|
||||
|
||||
inline void model_mat_face_camera_position(mat4* view, mat4* src, mat4* dst) {
|
||||
vec3 trans;
|
||||
mat4_mult_vec3_inv(view, (vec3*)&view->row3, &trans);
|
||||
mat4_mult_vec3_inv_trans(view, (vec3*)&view->row3, &trans);
|
||||
vec3_negate(trans, trans);
|
||||
|
||||
vec3 dir;
|
||||
@@ -1298,8 +1298,8 @@ inline static void draw_object_vertex_attrib_set_default_compressed(draw_object*
|
||||
offset += 8;
|
||||
|
||||
enable_vertex_attrib_array(15);
|
||||
glVertexAttribPointer(15, 4, GL_UNSIGNED_BYTE, GL_FALSE, vertex_size, (void*)offset);
|
||||
offset += 4;
|
||||
glVertexAttribPointer(15, 4, GL_UNSIGNED_SHORT, GL_FALSE, vertex_size, (void*)offset);
|
||||
offset += 8;
|
||||
}
|
||||
else {
|
||||
glVertexAttrib4f(1, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
@@ -1368,7 +1368,7 @@ inline static void draw_object_vertex_attrib_set_default_compressed(draw_object*
|
||||
glVertexAttrib4f(5, 1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
if (vertex_flags & OBJECT_VERTEX_BONE_DATA)
|
||||
offset += 12;
|
||||
offset += 16;
|
||||
|
||||
shader_env_vert_set(&shaders_ft, 13, draw->morph_value, 1.0f - draw->morph_value, 0.0f, 0.0f);
|
||||
}
|
||||
@@ -1642,8 +1642,8 @@ inline static void draw_object_vertex_attrib_set_reflect_compressed(draw_object*
|
||||
offset += 8;
|
||||
|
||||
enable_vertex_attrib_array(15);
|
||||
glVertexAttribPointer(15, 4, GL_UNSIGNED_BYTE, GL_FALSE, vertex_size, (void*)offset);
|
||||
offset += 4;
|
||||
glVertexAttribPointer(15, 4, GL_UNSIGNED_SHORT, GL_FALSE, vertex_size, (void*)offset);
|
||||
offset += 8;
|
||||
}
|
||||
else {
|
||||
glVertexAttrib4f(1, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
@@ -1712,7 +1712,7 @@ inline static void draw_object_vertex_attrib_set_reflect_compressed(draw_object*
|
||||
glVertexAttrib4f(5, 0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
if (vertex_flags & OBJECT_VERTEX_BONE_DATA)
|
||||
offset += 12;
|
||||
offset += 16;
|
||||
|
||||
shader_env_vert_set(&shaders_ft, 13, draw->morph_value, 1.0f - draw->morph_value, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
+2
-5
@@ -622,15 +622,12 @@ static void draw_pass_sss_filter(render_context* rctx, sss_data_struct* a1) {
|
||||
v24 = v46[0];
|
||||
|
||||
float_t length;
|
||||
vec3 dist;
|
||||
vec3_sub(interest, v24, dist);
|
||||
vec3_length(dist, length);
|
||||
vec3_distance(interest, v24, length);
|
||||
if (length > 1.25)
|
||||
interest = v46[0];
|
||||
|
||||
float_t v29;
|
||||
vec3_sub(view_point, interest, interest);
|
||||
vec3_length(interest, v29);
|
||||
vec3_distance(view_point, interest, v29);
|
||||
if (v29 < 0.25f)
|
||||
v29 = 0.25f;
|
||||
float_t v31 = tanf((float_t)(rctx->camera->fov_rad * 0.5)) * 5.0f;
|
||||
|
||||
+7
-7
@@ -24,7 +24,7 @@ static void draw_task_translucent_sort_has_objects(render_context* rctx, bool* a
|
||||
|
||||
void draw_task_draw_objects_by_type(render_context* rctx, draw_object_type type,
|
||||
int32_t a2, int32_t show_vector, bool a4, int32_t alpha) {
|
||||
if (draw_task_get_count(rctx, type) <= 0)
|
||||
if (draw_task_get_count(rctx, type) < 1)
|
||||
return;
|
||||
|
||||
int32_t alpha_test = 0;
|
||||
@@ -225,11 +225,11 @@ void draw_task_draw_objects_by_type(render_context* rctx, draw_object_type type,
|
||||
void draw_task_draw_objects_by_type_translucent(render_context* rctx, bool opaque_enable,
|
||||
bool transparent_enable, bool translucent_enable, draw_object_type opaque,
|
||||
draw_object_type transparent, draw_object_type translucent) {
|
||||
if (draw_task_get_count(rctx, opaque) <= 0)
|
||||
if (draw_task_get_count(rctx, opaque) < 1)
|
||||
return;
|
||||
else if (draw_task_get_count(rctx, transparent) <= 0)
|
||||
else if (draw_task_get_count(rctx, transparent) < 1)
|
||||
return;
|
||||
else if (draw_task_get_count(rctx, translucent) <= 0)
|
||||
else if (draw_task_get_count(rctx, translucent) < 1)
|
||||
return;
|
||||
|
||||
int32_t alpha_array[256];
|
||||
@@ -680,7 +680,7 @@ void draw_task_add_draw_object_by_object_info_object_skin(render_context* rctx,
|
||||
object_data_set_texture_specular_offset(object_data, &value);
|
||||
}
|
||||
|
||||
size_t texture_pattern_count = texture_pattern ? texture_pattern->end - texture_pattern->begin : 0;
|
||||
size_t texture_pattern_count = texture_pattern ? vector_length(*texture_pattern) : 0;
|
||||
if (texture_pattern && texture_pattern_count)
|
||||
object_data_set_texture_pattern(object_data, (int32_t)texture_pattern_count, texture_pattern->begin);
|
||||
|
||||
@@ -708,7 +708,7 @@ inline bool draw_task_add_draw_object_by_object_info_opaque(render_context* rctx
|
||||
|
||||
void draw_task_sort(render_context* rctx, draw_object_type type, int32_t compare_func) {
|
||||
vector_ptr_draw_task* vec = &rctx->object_data.draw_task_array[type];
|
||||
if (vec->end - vec->begin < 1)
|
||||
if (vector_length(*vec) < 1)
|
||||
return;
|
||||
|
||||
mat4 mat;
|
||||
@@ -726,7 +726,7 @@ void draw_task_sort(render_context* rctx, draw_object_type type, int32_t compare
|
||||
model_mat_face_camera_position(&rctx->camera->view, &mat, &mat);
|
||||
else {
|
||||
object_sub_mesh* sub_mesh = task->data.object.sub_mesh;
|
||||
if (task->data.object.mat_count <= 0 || !sub_mesh->bone_indices_count)
|
||||
if (task->data.object.mat_count < 1 || !sub_mesh->bone_indices_count)
|
||||
mat4_mult_vec3_trans(&mat, &sub_mesh->bounding_sphere.center, ¢er);
|
||||
else {
|
||||
vec3 center_sum = vec3_null;
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ inline hash hash_utf16(wchar_t* data) {
|
||||
|
||||
inline hash hash_data(void* data, size_t length) {
|
||||
hash hash;
|
||||
hash.f = hash_fnv1a64m(data, length);
|
||||
hash.f = hash_fnv1a64m(data, length, false);
|
||||
hash.m = hash_murmurhash(data, length, 0, false, false);
|
||||
return hash;
|
||||
}
|
||||
|
||||
+11
-11
@@ -45,22 +45,22 @@ void light_param_data_load(light_param_data* light_param, data_struct* data, cha
|
||||
light_param->id = 0;
|
||||
|
||||
sprintf_s(buf, sizeof(buf), "light_%s.txt", name);
|
||||
data_struct_load_file(data, &light_param->light, "rom\\light_param\\", buf, light_param_light_load_file);
|
||||
data_struct_load_file(data, &light_param->light, "rom/light_param/", buf, light_param_light_load_file);
|
||||
|
||||
sprintf_s(buf, sizeof(buf), "fog_%s.txt", name);
|
||||
data_struct_load_file(data, &light_param->fog, "rom\\light_param\\", buf, light_param_fog_load_file);
|
||||
data_struct_load_file(data, &light_param->fog, "rom/light_param/", buf, light_param_fog_load_file);
|
||||
|
||||
sprintf_s(buf, sizeof(buf), "glow_%s.txt", name);
|
||||
data_struct_load_file(data, &light_param->glow, "rom\\light_param\\", buf, light_param_glow_load_file);
|
||||
data_struct_load_file(data, &light_param->glow, "rom/light_param/", buf, light_param_glow_load_file);
|
||||
|
||||
sprintf_s(buf, sizeof(buf), "%s.ibl", name);
|
||||
data_struct_load_file(data, &light_param->ibl, "rom\\ibl\\", buf, light_param_ibl_load_file);
|
||||
data_struct_load_file(data, &light_param->ibl, "rom/ibl/", buf, light_param_ibl_load_file);
|
||||
|
||||
sprintf_s(buf, sizeof(buf), "wind_%s.txt", name);
|
||||
data_struct_load_file(data, &light_param->wind, "rom\\light_param\\", buf, light_param_wind_load_file);
|
||||
data_struct_load_file(data, &light_param->wind, "rom/light_param/", buf, light_param_wind_load_file);
|
||||
|
||||
sprintf_s(buf, sizeof(buf), "face_%s.txt", name);
|
||||
data_struct_load_file(data, &light_param->face, "rom\\light_param\\", buf, light_param_face_load_file);
|
||||
data_struct_load_file(data, &light_param->face, "rom/light_param/", buf, light_param_face_load_file);
|
||||
}
|
||||
|
||||
void light_param_data_free(light_param_data* light_param) {
|
||||
@@ -82,7 +82,7 @@ void light_param_set_load(light_param_set* set, data_struct* data, int32_t pv_id
|
||||
|
||||
farc f;
|
||||
farc_init(&f);
|
||||
if (!data_struct_load_file(data, &f, "rom\\light_param\\", buf, farc_load_file))
|
||||
if (!data_struct_load_file(data, &f, "rom/light_param/", buf, farc_load_file))
|
||||
return;
|
||||
|
||||
for (farc_file* i = f.files.begin; i != f.files.end; i++)
|
||||
@@ -118,7 +118,7 @@ inline void light_param_storage_init() {
|
||||
}
|
||||
|
||||
inline void light_param_storage_append_light_param_data(char* name) {
|
||||
uint64_t hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
for (light_param_storage* i = light_param_storage_data.begin;
|
||||
i != light_param_storage_data.end; i++)
|
||||
if (!i->pv && i->hash == hash) {
|
||||
@@ -151,7 +151,7 @@ inline void light_param_storage_load_light_param_set(data_struct* data, int32_t
|
||||
}
|
||||
|
||||
inline void light_param_storage_insert_light_param_data(light_param_data* data, char* name) {
|
||||
uint64_t hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
for (light_param_storage* i = light_param_storage_data.begin;
|
||||
i != light_param_storage_data.end; i++)
|
||||
if (!i->pv && i->hash == hash) {
|
||||
@@ -187,7 +187,7 @@ inline void light_param_storage_insert_light_param_set(light_param_set* set, int
|
||||
}
|
||||
|
||||
inline light_param_data* light_param_storage_get_light_param_data(char* name) {
|
||||
uint64_t hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
for (light_param_storage* i = light_param_storage_data.begin;
|
||||
i != light_param_storage_data.end; i++)
|
||||
if (!i->pv && i->hash == hash)
|
||||
@@ -204,7 +204,7 @@ inline light_param_set* light_param_storage_get_light_param_set(int32_t pv_id) {
|
||||
}
|
||||
|
||||
inline void light_param_storage_delete_light_param_data(char* name) {
|
||||
uint64_t hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
for (light_param_storage* i = light_param_storage_data.begin;
|
||||
i != light_param_storage_data.end; i++)
|
||||
if (!i->pv && i->hash == hash) {
|
||||
|
||||
@@ -73,7 +73,7 @@ void wind_update(wind* w) {
|
||||
mat4 mat = mat4_identity;
|
||||
mat4_rotate_y_mult(&mat, w->rot_y * DEG_TO_RAD_FLOAT, &mat);
|
||||
mat4_rotate_z_mult(&mat, w->rot_z * DEG_TO_RAD_FLOAT, &mat);
|
||||
vec3 wind_direction = vec3_identity;
|
||||
vec3 wind_direction = vec3_null;
|
||||
wind_direction.x = value;
|
||||
mat4_mult_vec3(&mat, &wind_direction, &wind_direction);
|
||||
vec3_mult_scalar(wind_direction, w->strength, w->wind_direction);
|
||||
|
||||
+41
-66
@@ -357,8 +357,8 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
|
||||
vec4i bone_index;
|
||||
vec4iu_to_vec4i(vertex_file[i].bone_index, bone_index);
|
||||
vec4i_to_vec4u8(bone_index, *(vec4u8*)d);
|
||||
d += 4;
|
||||
vec4i_to_vec4u16(bone_index, *(vec4u16*)d);
|
||||
d += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -541,6 +541,8 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
object_skin_block* block = &ex_data->blocks[j];
|
||||
object_skin_block_file* block_file = &ex_data_file->blocks[j];
|
||||
|
||||
object_skin_block_node_load(&block->base, &block_file->base);
|
||||
|
||||
switch (block_file->type) {
|
||||
case OBJ_SKIN_BLOCK_CLOTH: {
|
||||
block->type = OBJECT_SKIN_BLOCK_CLOTH;
|
||||
@@ -555,13 +557,21 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
object_skin_block_constraint* constraint = &block->constraint;
|
||||
object_skin_block_constraint_file* constraint_file = &block_file->constraint;
|
||||
|
||||
switch (constraint_file->type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
object_skin_block_node_load(&constraint->base, &constraint_file->base);
|
||||
constraint->coupling = constraint_file->coupling;
|
||||
constraint->name_index = constraint_file->name_index;
|
||||
string_copy(&constraint_file->source_node_name, &constraint->source_node_name);
|
||||
constraint->coupling = constraint_file->coupling;
|
||||
constraint->name_index = constraint_file->name_index;
|
||||
string_copy(&constraint_file->source_node_name, &constraint->source_node_name);
|
||||
|
||||
switch (constraint_file->type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
constraint->type = OBJECT_SKIN_BLOCK_CONSTRAINT_ORIENTATION;
|
||||
|
||||
object_skin_block_constraint_orientation* orientation = &constraint->orientation;
|
||||
object_skin_block_constraint_orientation_file* orientation_file
|
||||
= &constraint_file->orientation;
|
||||
|
||||
orientation->offset = orientation_file->offset;
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
constraint->type = OBJECT_SKIN_BLOCK_CONSTRAINT_DIRECTION;
|
||||
|
||||
object_skin_block_constraint_direction* direction = &constraint->direction;
|
||||
@@ -573,46 +583,7 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
direction->align_axis = direction_file->align_axis;
|
||||
direction->target_offset = direction_file->target_offset;
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
object_skin_block_node_load(&constraint->base, &constraint_file->base);
|
||||
constraint->coupling = constraint_file->coupling;
|
||||
constraint->name_index = constraint_file->name_index;
|
||||
string_copy(&constraint_file->source_node_name, &constraint->source_node_name);
|
||||
|
||||
constraint->type = OBJECT_SKIN_BLOCK_CONSTRAINT_DISTANCE;
|
||||
|
||||
object_skin_block_constraint_distance* distance = &constraint->distance;
|
||||
object_skin_block_constraint_distance_file* distance_file
|
||||
= &constraint_file->distance;
|
||||
|
||||
object_skin_block_constraint_up_vector_load(
|
||||
&distance->up_vector, &distance_file->up_vector);
|
||||
distance->distance = distance_file->distance;
|
||||
object_skin_block_constraint_attach_point_load(
|
||||
&distance->constrained_object, &distance_file->constrained_object);
|
||||
object_skin_block_constraint_attach_point_load(
|
||||
&distance->constraining_object, &distance_file->constraining_object);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
object_skin_block_node_load(&constraint->base, &constraint_file->base);
|
||||
constraint->coupling = constraint_file->coupling;
|
||||
constraint->name_index = constraint_file->name_index;
|
||||
string_copy(&constraint_file->source_node_name, &constraint->source_node_name);
|
||||
|
||||
constraint->type = OBJECT_SKIN_BLOCK_CONSTRAINT_ORIENTATION;
|
||||
|
||||
object_skin_block_constraint_orientation* orientation = &constraint->orientation;
|
||||
object_skin_block_constraint_orientation_file* orientation_file
|
||||
= &constraint_file->orientation;
|
||||
|
||||
orientation->offset = orientation_file->offset;
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
object_skin_block_node_load(&constraint->base, &constraint_file->base);
|
||||
constraint->coupling = constraint_file->coupling;
|
||||
constraint->name_index = constraint_file->name_index;
|
||||
string_copy(&constraint_file->source_node_name, &constraint->source_node_name);
|
||||
|
||||
constraint->type = OBJECT_SKIN_BLOCK_CONSTRAINT_POSITION;
|
||||
|
||||
object_skin_block_constraint_position* position = &constraint->position;
|
||||
@@ -627,8 +598,20 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
object_skin_block_constraint_attach_point_load(
|
||||
&position->constraining_object, &position_file->constraining_object);
|
||||
break;
|
||||
default:
|
||||
memset(block, 0, sizeof(object_skin_block));
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
constraint->type = OBJECT_SKIN_BLOCK_CONSTRAINT_DISTANCE;
|
||||
|
||||
object_skin_block_constraint_distance* distance = &constraint->distance;
|
||||
object_skin_block_constraint_distance_file* distance_file
|
||||
= &constraint_file->distance;
|
||||
|
||||
object_skin_block_constraint_up_vector_load(
|
||||
&distance->up_vector, &distance_file->up_vector);
|
||||
distance->distance = distance_file->distance;
|
||||
object_skin_block_constraint_attach_point_load(
|
||||
&distance->constrained_object, &distance_file->constrained_object);
|
||||
object_skin_block_constraint_attach_point_load(
|
||||
&distance->constraining_object, &distance_file->constraining_object);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -639,8 +622,6 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
object_skin_block_expression* expression = &block->expression;
|
||||
object_skin_block_expression_file* expression_file = &block_file->expression;
|
||||
|
||||
object_skin_block_node_load(&expression->base, &expression_file->base);
|
||||
|
||||
expression->name_index = expression_file->name_index;
|
||||
int32_t expressions_count = min(expression_file->expressions_count, 9);
|
||||
expression->expressions_count = expressions_count;
|
||||
@@ -657,8 +638,6 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
object_skin_block_motion* motion = &block->motion;
|
||||
object_skin_block_motion_file* motion_file = &block_file->motion;
|
||||
|
||||
object_skin_block_node_load(&motion->base, &motion_file->base);
|
||||
|
||||
int32_t nodes_count = motion_file->nodes_count;
|
||||
if (!is_x)
|
||||
motion->name_index = motion_file->name_index;
|
||||
@@ -681,7 +660,6 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
object_skin_block_osage* osage = &block->osage;
|
||||
object_skin_block_osage_file* osage_file = &block_file->osage;
|
||||
|
||||
object_skin_block_node_load(&osage->base, &osage_file->base);
|
||||
osage->start_index = osage_file->start_index;
|
||||
osage->count = osage_file->count;
|
||||
|
||||
@@ -698,12 +676,9 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
}
|
||||
|
||||
osage->external_name_index = osage_file->external_name_index;
|
||||
osage->name_index = osage->name_index;
|
||||
osage->name_index = osage_file->name_index;
|
||||
string_copy(&osage_file->motion_node_name, &osage->motion_node_name);
|
||||
} break;
|
||||
default:
|
||||
memset(block, 0, sizeof(object_skin_block));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,7 +697,7 @@ void object_set_load(object_set* set, obj_set* obj_set_file, txp_set* txp_set_fi
|
||||
skin->ex_data_init = true;
|
||||
}
|
||||
|
||||
int32_t textures_count = (int32_t)(txp_set_file->end - txp_set_file->begin);
|
||||
int32_t textures_count = (int32_t)vector_length(*txp_set_file);
|
||||
set->textures_count = textures_count;
|
||||
set->textures = force_malloc_s(GLuint, textures_count);
|
||||
texture_txp_set_load(txp_set_file, &set->texture_data, set->texture_ids);
|
||||
@@ -745,7 +720,7 @@ bool object_set_load_db_entry(object_set_info** set_info,
|
||||
size_t temp[2];
|
||||
temp[0] = (size_t)data;
|
||||
temp[1] = (size_t)*set_info;
|
||||
return data_struct_load_file(data, temp, "rom\\objset\\",
|
||||
return data_struct_load_file(data, temp, "rom/objset/",
|
||||
string_data(&(*set_info)->archive_file_name), object_set_load_file);
|
||||
}
|
||||
|
||||
@@ -754,7 +729,7 @@ bool object_set_load_by_db_entry(object_set_info* set_info,
|
||||
size_t temp[2];
|
||||
temp[0] = (size_t)data;
|
||||
temp[1] = (size_t)set_info;
|
||||
return data_struct_load_file(data, temp, "rom\\objset\\",
|
||||
return data_struct_load_file(data, temp, "rom/objset/",
|
||||
string_data(&set_info->archive_file_name), object_set_load_file);
|
||||
}
|
||||
|
||||
@@ -766,7 +741,7 @@ bool object_set_load_by_db_index(object_set_info** set_info,
|
||||
size_t temp[2];
|
||||
temp[0] = (size_t)data;
|
||||
temp[1] = (size_t)*set_info;
|
||||
return data_struct_load_file(data, temp, "rom\\objset\\",
|
||||
return data_struct_load_file(data, temp, "rom/objset/",
|
||||
string_data(&(*set_info)->archive_file_name), object_set_load_file);
|
||||
}
|
||||
|
||||
@@ -775,7 +750,7 @@ bool object_set_load_by_hash(void* data,
|
||||
size_t temp[2];
|
||||
temp[0] = (size_t)obj_db;
|
||||
temp[1] = (size_t)tex_db;
|
||||
return data_struct_load_file_by_hash(data, temp, "rom\\objset\\",
|
||||
return data_struct_load_file_by_hash(data, temp, "rom/objset/",
|
||||
hash, object_set_load_file_modern);
|
||||
}
|
||||
|
||||
@@ -1114,11 +1089,11 @@ inline object_set* object_storage_get_object_set(uint32_t set_id) {
|
||||
}
|
||||
|
||||
inline ssize_t object_storage_get_object_set_count() {
|
||||
return object_storage_data.end - object_storage_data.begin;
|
||||
return vector_length(object_storage_data);
|
||||
}
|
||||
|
||||
inline object_set* object_storage_get_object_set_by_index(ssize_t index) {
|
||||
if (index >= 0 && index < object_storage_data.end - object_storage_data.begin)
|
||||
if (index >= 0 && index < vector_length(object_storage_data))
|
||||
return &object_storage_data.begin[index].set;
|
||||
return 0;
|
||||
}
|
||||
@@ -1426,7 +1401,7 @@ inline static size_t object_vertex_flags_get_vertex_size_comp(object_vertex_flag
|
||||
if (flags & OBJECT_VERTEX_COLOR0)
|
||||
size += 8;
|
||||
if (flags & OBJECT_VERTEX_BONE_DATA)
|
||||
size += 12;
|
||||
size += 16;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -132,10 +132,10 @@ typedef enum object_primitive_type {
|
||||
|
||||
typedef enum object_skin_block_constraint_type {
|
||||
OBJECT_SKIN_BLOCK_CONSTRAINT_NONE = 0,
|
||||
OBJECT_SKIN_BLOCK_CONSTRAINT_DIRECTION,
|
||||
OBJECT_SKIN_BLOCK_CONSTRAINT_DISTANCE,
|
||||
OBJECT_SKIN_BLOCK_CONSTRAINT_ORIENTATION,
|
||||
OBJECT_SKIN_BLOCK_CONSTRAINT_DIRECTION,
|
||||
OBJECT_SKIN_BLOCK_CONSTRAINT_POSITION,
|
||||
OBJECT_SKIN_BLOCK_CONSTRAINT_DISTANCE,
|
||||
} object_skin_block_constraint_type;
|
||||
|
||||
typedef enum object_skin_block_constraint_coupling {
|
||||
|
||||
+12
-21
@@ -823,9 +823,9 @@ static void shadow_update_inner(shadow* shad, render_context* rctx) {
|
||||
int32_t count = 0;
|
||||
shad->field_2EC = 0;
|
||||
for (int32_t i = 0; i < 2; i++)
|
||||
if (shad->field_2F0[i] && shad->field_1D0[i].end - shad->field_1D0[i].begin > 0) {
|
||||
if (shad->field_2F0[i] && vector_length(shad->field_1D0[i]) > 0) {
|
||||
shad->field_2EC++;
|
||||
count += (int32_t)(shad->field_1D0[i].end - shad->field_1D0[i].begin);
|
||||
count += (int32_t)vector_length(shad->field_1D0[i]);
|
||||
}
|
||||
else
|
||||
shad->field_2F0[i] = false;
|
||||
@@ -835,14 +835,14 @@ static void shadow_update_inner(shadow* shad, render_context* rctx) {
|
||||
vector_vec3* v5 = &shad->field_1D0[i];
|
||||
shad->field_1A8[i] = vec3_null;
|
||||
shad->field_1C8[i] = 0.0f;
|
||||
if (!shad->field_2F0[i] || !(v5->end - v5->begin))
|
||||
if (!shad->field_2F0[i] || vector_length(*v5) < 1)
|
||||
continue;
|
||||
|
||||
vec3 v7 = vec3_null;
|
||||
for (vec3* j = v5->begin; j != v5->end; j++)
|
||||
vec3_add(v7, *j, v7);
|
||||
|
||||
float_t v14 = (float_t)(int32_t)(v5->end - v5->begin);
|
||||
float_t v14 = (float_t)(int32_t)vector_length(*v5);
|
||||
if (v14 < 0.0f)
|
||||
v14 += 1.8446744e19f;
|
||||
vec3_mult_scalar(v7, 1.0f / v14, v7);
|
||||
@@ -856,9 +856,8 @@ static void shadow_update_inner(shadow* shad, render_context* rctx) {
|
||||
vec3_dot(v22, direction, v23);
|
||||
vec3 v25;
|
||||
vec3_mult_scalar(direction, v23, v25);
|
||||
vec3_sub(v25, v22, v25);
|
||||
float_t v24;
|
||||
vec3_length(v25, v24);
|
||||
vec3_distance(v25, v22, v24);
|
||||
v24 -= 0.25f;
|
||||
if (v24 < 0.0f)
|
||||
v24 = 0.0f;
|
||||
@@ -879,15 +878,11 @@ static void shadow_update_inner(shadow* shad, render_context* rctx) {
|
||||
vec3 v11;
|
||||
vec3_mult_scalar(shad->direction, shad->field_208, v11);
|
||||
vec3_sub(shad->field_1A8[i], v11, v11);
|
||||
vec3 v14;
|
||||
vec3_sub(shad->view_point[i], v11, v14);
|
||||
float_t v9;
|
||||
vec3_length(v14, v9);
|
||||
vec3_distance(shad->view_point[i], v11, v9);
|
||||
|
||||
vec3 v20;
|
||||
vec3_sub(shad->interest[i], shad->field_1A8[i], v20);
|
||||
float_t v12;
|
||||
vec3_length(v20, v12);
|
||||
vec3_distance(shad->interest[i], shad->field_1A8[i], v12);
|
||||
if (v9 > 0.1f || v12 > 0.1f) {
|
||||
shad->view_point[i] = v11;
|
||||
shad->interest[i] = shad->field_1A8[i];
|
||||
@@ -961,14 +956,14 @@ static void shadow_update_inner(shadow* shad, render_context* rctx) {
|
||||
vector_vec3* v18 = &shad->field_1D0[i];
|
||||
shad->field_1A8[i] = vec3_null;
|
||||
shad->field_1C8[i] = 0.0;
|
||||
if (!shad->field_2F0[i] || !(v18->end - v18->begin))
|
||||
if (!shad->field_2F0[i] || vector_length(*v18) < 1)
|
||||
continue;
|
||||
|
||||
vec3 v22 = vec3_null;
|
||||
for (vec3* j = v18->begin; j != v18->end; j++)
|
||||
vec3_add(v22, *j, v22);
|
||||
|
||||
int32_t v27 = (int32_t)(v18->end - v18->begin);
|
||||
int32_t v27 = (int32_t)vector_length(*v18);
|
||||
float_t v29 = (float_t)v27;
|
||||
if (v27 < 0)
|
||||
v29 += 1.8446744e19f;
|
||||
@@ -1001,16 +996,12 @@ static void shadow_update_inner(shadow* shad, render_context* rctx) {
|
||||
continue;
|
||||
|
||||
float_t v51;
|
||||
vec3 v52;
|
||||
vec3 v53;
|
||||
float_t v54;
|
||||
vec3 v55;
|
||||
vec3_mult_scalar(shad->direction, shad->field_208, v53);
|
||||
vec3_sub(shad->field_1A8[i], v53, v53);
|
||||
vec3_sub(shad->view_point[i], v53, v52);
|
||||
vec3_length(v52, v51);
|
||||
vec3_sub(shad->interest[i], shad->field_1A8[i], v55);
|
||||
vec3_length(v55, v54);
|
||||
vec3_distance(shad->view_point[i], v53, v51);
|
||||
vec3_distance(shad->interest[i], shad->field_1A8[i], v54);
|
||||
if (v51 > 0.1f || v54 > 0.1f) {
|
||||
shad->view_point[i] = v53;
|
||||
shad->interest[i] = shad->field_1A8[i];
|
||||
@@ -1021,7 +1012,7 @@ static void shadow_update_inner(shadow* shad, render_context* rctx) {
|
||||
vec3 interest = vec3_null;
|
||||
int32_t count = 0;;
|
||||
for (int32_t i = 0; i < 2; i++) {
|
||||
int32_t c = (int32_t)(shad->field_1D0[i].end - shad->field_1D0[i].begin);
|
||||
int32_t c = (int32_t)vector_length(shad->field_1D0[i]);
|
||||
vec3 view_point_temp;
|
||||
vec3 interest_temp;
|
||||
vec3_mult_scalar(shad->view_point[i], (float_t)c, view_point_temp);
|
||||
|
||||
+3192
-1706
File diff suppressed because it is too large
Load Diff
+1028
-69
File diff suppressed because it is too large
Load Diff
+6
-6
@@ -33,7 +33,7 @@ vector_func(program_binary)
|
||||
int32_t shader_bind(shader* shader, uint32_t sub_index) {
|
||||
int32_t num_sub = shader->num_sub;
|
||||
int32_t sub_shader_index = 0;
|
||||
if (num_sub <= 0)
|
||||
if (num_sub < 1)
|
||||
return -1;
|
||||
|
||||
for (shader_sub* i = shader->sub; i->sub_index != sub_index; i++) {
|
||||
@@ -190,8 +190,8 @@ void shader_load(shader_set_data* set, farc* f, bool ignore_cache, bool not_load
|
||||
continue;
|
||||
}
|
||||
|
||||
uint64_t vert_file_name_cache = hash_fnv1a64m(vert_file_buf, utf8_length(vert_file_buf));
|
||||
uint64_t frag_file_name_cache = hash_fnv1a64m(frag_file_buf, utf8_length(frag_file_buf));
|
||||
uint64_t vert_file_name_cache = hash_fnv1a64m(vert_file_buf, utf8_length(vert_file_buf), false);
|
||||
uint64_t frag_file_name_cache = hash_fnv1a64m(frag_file_buf, utf8_length(frag_file_buf), false);
|
||||
for (int32_t i = 0; i < 64; i += 8)
|
||||
if (((vert_file_name_cache >> i) & 0xFF) == 0)
|
||||
vert_file_name_cache |= 0xFFULL << i;
|
||||
@@ -210,8 +210,8 @@ void shader_load(shader_set_data* set, farc* f, bool ignore_cache, bool not_load
|
||||
|
||||
vert_data = shader_parse_include(vert_data, f);
|
||||
frag_data = shader_parse_include(frag_data, f);
|
||||
uint64_t vert_data_hash = hash_fnv1a64m(vert_data, utf8_length(vert_data));
|
||||
uint64_t frag_data_hash = hash_fnv1a64m(frag_data, utf8_length(frag_data));
|
||||
uint64_t vert_data_hash = hash_fnv1a64m(vert_data, utf8_length(vert_data), false);
|
||||
uint64_t frag_data_hash = hash_fnv1a64m(frag_data, utf8_length(frag_data), false);
|
||||
|
||||
farc_file* shader_cache_file = farc_read_file(&shader_cache_farc, shader_cache_file_name);
|
||||
program_binary* bin = 0;
|
||||
@@ -363,7 +363,7 @@ void shader_load(shader_set_data* set, farc* f, bool ignore_cache, bool not_load
|
||||
else
|
||||
free(shader_cache_file->data);
|
||||
|
||||
size_t bin_count = program_data_binary.end - program_data_binary.begin;
|
||||
size_t bin_count = vector_length(program_data_binary);
|
||||
size_t bin_size = sizeof(uint64_t) * 2 + bin_count * sizeof(program_binary);
|
||||
for (program_binary* j = program_data_binary.begin; j != program_data_binary.end; j++)
|
||||
bin_size += j->length;
|
||||
|
||||
@@ -122,7 +122,7 @@ static GLuint shader_compile(GLenum type, const char* data) {
|
||||
|
||||
static GLint shader_get_uniform_location(GLint program, GLchar* name,
|
||||
vector_uint64_t* uniform_name_buf, vector_int32_t* uniform_location_buf) {
|
||||
uint64_t hash = hash_utf8_fnv1a64m(name);
|
||||
uint64_t hash = hash_utf8_fnv1a64m(name, false);
|
||||
for (uint64_t* i = uniform_name_buf->begin; i != uniform_name_buf->end; i++)
|
||||
if (*i == hash)
|
||||
return uniform_location_buf->begin[i - uniform_name_buf->begin];
|
||||
@@ -143,7 +143,7 @@ static GLint shader_get_uniform_location(GLint program, GLchar* name,
|
||||
|
||||
static GLint shader_get_uniform_block_index(GLint program, GLchar* name,
|
||||
vector_uint64_t* uniform_block_name_buf, vector_int32_t* uniform_block_index_buf) {
|
||||
uint64_t hash = hash_utf8_fnv1a64m(name);
|
||||
uint64_t hash = hash_utf8_fnv1a64m(name, false);
|
||||
for (uint64_t* i = uniform_block_name_buf->begin; i != uniform_block_name_buf->end; i++)
|
||||
if (*i == hash)
|
||||
return uniform_block_index_buf->begin[i - uniform_block_name_buf->begin];
|
||||
|
||||
+2
-2
@@ -88,10 +88,10 @@ void stage_load(stage* s, data_struct* data, auth_3d_database* auth_3d_db, objec
|
||||
|
||||
farc f;
|
||||
farc_init(&f);
|
||||
data_struct_load_file(data, &f, "rom\\auth_3d\\", string_data(&auth_3d_farc), farc_load_file);
|
||||
data_struct_load_file(data, &f, "rom/auth_3d/", string_data(&auth_3d_farc), farc_load_file);
|
||||
string_free(&auth_3d_farc);
|
||||
|
||||
if (!(f.files.end - f.files.begin)) {
|
||||
if (vector_length(f.files) < 1) {
|
||||
farc_free(&f);
|
||||
continue;
|
||||
}
|
||||
|
||||
+11
-1
@@ -72,7 +72,7 @@ bool texture_txp_set_load(txp_set* t, texture*** texs, uint32_t* ids) {
|
||||
if (!t || !texs || !ids)
|
||||
return false;
|
||||
|
||||
size_t count = t->end - t->begin;
|
||||
size_t count = vector_length(*t);
|
||||
*texs = force_malloc_s(texture*, count + 1);
|
||||
texture** tex = *texs;
|
||||
for (size_t i = 0; i < count; i++)
|
||||
@@ -106,6 +106,16 @@ inline texture* texture_storage_get_texture(uint32_t id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline size_t texture_storage_get_texture_count() {
|
||||
return vector_length(texture_storage_data);
|
||||
}
|
||||
|
||||
inline texture* texture_storage_get_texture_by_index(ssize_t index) {
|
||||
if (index >= 0 && index < vector_length(texture_storage_data))
|
||||
return texture_storage_data.begin[index];
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline void texture_storage_delete_texture(uint32_t id) {
|
||||
for (texture** i = texture_storage_data.begin; i != texture_storage_data.end; i++)
|
||||
if (*i && (*i)->id == id) {
|
||||
|
||||
+5
-1
@@ -30,7 +30,9 @@ typedef struct texture {
|
||||
vector(texture)
|
||||
vector_ptr(texture)
|
||||
|
||||
#define texture_make_id(id, index) ((uint32_t)((id << 24) | (index & 0xFFFFFF)))
|
||||
#define texture_make_id(id, index) ((uint32_t)(((id) << 24) | ((index) & 0xFFFFFF)))
|
||||
#define texture_get_id(id) (((id) >> 24) & 0xFF)
|
||||
#define texture_get_index(id) ((id) & 0xFFFFFF)
|
||||
|
||||
extern texture* texture_init(uint32_t id);
|
||||
extern texture* texture_load_tex_2d(uint32_t id, GLenum internal_format, int32_t width, int32_t height,
|
||||
@@ -45,5 +47,7 @@ extern bool texture_txp_set_load(txp_set* t, texture*** texs, uint32_t* ids);
|
||||
extern void texture_storage_init();
|
||||
extern texture* texture_storage_create_texture(uint32_t id);
|
||||
extern texture* texture_storage_get_texture(uint32_t id);
|
||||
extern size_t texture_storage_get_texture_count();
|
||||
extern texture* texture_storage_get_texture_by_index(ssize_t index);
|
||||
extern void texture_storage_delete_texture(uint32_t id);
|
||||
extern void texture_storage_free();
|
||||
|
||||
+2095
-225
File diff suppressed because it is too large
Load Diff
+296
-267
@@ -626,7 +626,7 @@ typedef struct list_ptr_##t { \
|
||||
size_t size; \
|
||||
} list_ptr_##t;
|
||||
|
||||
#define tree_def(t1, t2) \
|
||||
#define tree_def(t) \
|
||||
typedef struct tree_##t##_node tree_##t##_node; \
|
||||
\
|
||||
struct tree_##t##_node { \
|
||||
@@ -643,7 +643,7 @@ typedef struct tree_##t { \
|
||||
size_t size; \
|
||||
} tree_##t;
|
||||
|
||||
#define tree_ptr(t1, t2) \
|
||||
#define tree_ptr(t) \
|
||||
typedef struct tree_ptr_##t##_node tree_ptr_##t##_node; \
|
||||
\
|
||||
struct tree_ptr_##t##_node { \
|
||||
@@ -729,7 +729,7 @@ typedef struct aft_bone_database_skeleton {
|
||||
int32_t field_34;
|
||||
char** motion_bone_names;
|
||||
uint16_t* parent_indices;
|
||||
int32_t ex_data_mat;
|
||||
int32_t field_48;
|
||||
int32_t field_4C;
|
||||
int32_t field_50;
|
||||
int32_t field_54;
|
||||
@@ -744,16 +744,16 @@ typedef struct aft_bone_database_struct {
|
||||
char** skeleton_names;
|
||||
} aft_bone_database_struct;
|
||||
|
||||
typedef struct rob_chara_data rob_chara_data;
|
||||
typedef struct rob_chara_data_bone_data rob_chara_data_bone_data;
|
||||
typedef struct rob_chara_data_item_equip rob_chara_data_item_equip;
|
||||
typedef struct rob_chara rob_chara;
|
||||
typedef struct rob_chara_bone_data rob_chara_bone_data;
|
||||
typedef struct rob_chara_item_equip rob_chara_item_equip;
|
||||
typedef struct bone_node bone_node;
|
||||
|
||||
typedef struct bone_node_expression_data {
|
||||
vec3 position;
|
||||
vec3 rotation;
|
||||
vec3 scale;
|
||||
vec3 data_scale;
|
||||
vec3 parent_scale;
|
||||
} bone_node_expression_data;
|
||||
|
||||
typedef struct bone_node {
|
||||
@@ -849,7 +849,7 @@ tree_pair(int32_t, int32_t)
|
||||
|
||||
list_ptr(void)
|
||||
|
||||
typedef struct struc_288 {
|
||||
typedef struct rob_chara_item_sub_data {
|
||||
chara_index chara_index;
|
||||
int32_t field_4;
|
||||
request_data_object_data field_8;
|
||||
@@ -860,34 +860,64 @@ typedef struct struc_288 {
|
||||
list_ptr_void field_100;
|
||||
struc_298 field_110[31];
|
||||
tree_pair_int32_t_int32_t field_3F8;
|
||||
} struc_288;
|
||||
} rob_chara_item_sub_data;
|
||||
|
||||
typedef struct struc_264 {
|
||||
uint8_t field_0;
|
||||
typedef struct struc_525 {
|
||||
int32_t field_0;
|
||||
int32_t field_4;
|
||||
int32_t field_8;
|
||||
} struc_525;
|
||||
|
||||
typedef struct struc_524 {
|
||||
int32_t field_0;
|
||||
struc_525 field_4;
|
||||
int32_t field_C;
|
||||
uint8_t field_10;
|
||||
} struc_524;
|
||||
|
||||
typedef struct struc_523 {
|
||||
uint8_t field_0;
|
||||
uint8_t field_1;
|
||||
int32_t field_4;
|
||||
uint8_t field_8;
|
||||
uint8_t field_9;
|
||||
int32_t field_C;
|
||||
int32_t field_10;
|
||||
uint8_t field_14;
|
||||
int32_t field_14;
|
||||
int32_t field_18;
|
||||
int32_t field_1C;
|
||||
int32_t field_20;
|
||||
int32_t field_24;
|
||||
uint8_t field_28;
|
||||
int32_t field_28;
|
||||
int32_t field_2C;
|
||||
int32_t field_30;
|
||||
int32_t field_34;
|
||||
int32_t field_38;
|
||||
uint8_t field_3C;
|
||||
int32_t field_3C;
|
||||
int32_t field_40;
|
||||
int32_t field_44;
|
||||
int32_t ex_data_mat;
|
||||
int32_t field_48;
|
||||
int32_t field_4C;
|
||||
uint8_t field_50;
|
||||
int32_t field_54;
|
||||
int64_t field_58;
|
||||
int32_t field_60;
|
||||
uint8_t field_64;
|
||||
list_ptr_void field_58;
|
||||
int64_t field_68;
|
||||
int64_t field_70;
|
||||
int64_t field_78;
|
||||
int32_t field_80;
|
||||
} struc_523;
|
||||
|
||||
typedef struct struc_526 {
|
||||
int32_t field_0;
|
||||
int32_t field_4;
|
||||
} struc_526;
|
||||
|
||||
typedef struct struc_264 {
|
||||
uint8_t field_0;
|
||||
struc_524 field_4;
|
||||
struc_524 field_18;
|
||||
struc_524 field_2C;
|
||||
struc_524 field_40;
|
||||
struc_524 field_54;
|
||||
int32_t field_68;
|
||||
int32_t field_6C;
|
||||
int32_t field_70;
|
||||
@@ -909,34 +939,7 @@ typedef struct struc_264 {
|
||||
int32_t field_AC;
|
||||
int32_t field_B0;
|
||||
uint8_t eyes_adjust;
|
||||
int32_t field_B8;
|
||||
int32_t field_BC;
|
||||
int16_t field_C0;
|
||||
int32_t field_C4;
|
||||
float_t field_C8;
|
||||
float_t field_CC;
|
||||
float_t field_D0;
|
||||
int64_t field_D8;
|
||||
int64_t field_E0;
|
||||
int32_t field_E8;
|
||||
int32_t field_EC;
|
||||
int32_t field_F0;
|
||||
int32_t field_F4;
|
||||
int32_t field_F8;
|
||||
int32_t field_FC;
|
||||
int32_t field_100;
|
||||
int32_t field_104;
|
||||
int32_t field_108;
|
||||
int32_t field_10C;
|
||||
list_ptr_void field_110;
|
||||
int32_t field_120;
|
||||
int32_t field_124;
|
||||
int32_t field_128;
|
||||
int32_t field_12C;
|
||||
int32_t field_130;
|
||||
float_t field_134;
|
||||
int32_t field_138;
|
||||
int32_t field_13C;
|
||||
struc_523 field_B8;
|
||||
int32_t field_140;
|
||||
uint8_t field_144;
|
||||
uint8_t field_145;
|
||||
@@ -972,8 +975,7 @@ typedef struct struc_264 {
|
||||
int32_t field_1B4;
|
||||
int32_t field_1B8;
|
||||
int32_t field_1BC;
|
||||
int32_t field_1C0;
|
||||
int32_t field_1C4;
|
||||
struc_526 field_1C0;
|
||||
uint8_t field_1C8;
|
||||
uint8_t field_1C9;
|
||||
uint8_t field_1CA;
|
||||
@@ -982,18 +984,24 @@ typedef struct struc_264 {
|
||||
int32_t field_1D4;
|
||||
} struc_264;
|
||||
|
||||
typedef struct rob_sub_action rob_sub_action;
|
||||
|
||||
typedef struct rob_sub_action_vtbl {
|
||||
void(*dispose)(rob_sub_action*, bool);
|
||||
} rob_sub_action_vtbl;
|
||||
|
||||
typedef struct rob_sub_action_execute rob_sub_action_execute;
|
||||
|
||||
typedef struct rob_sub_action_execute_vftable {
|
||||
void(*dispose)(rob_sub_action_execute*);
|
||||
void(*field_8)(rob_sub_action_execute*);
|
||||
void(*field_10)(rob_sub_action_execute*);
|
||||
void(*field_18)(rob_sub_action_execute*, rob_chara_data*);
|
||||
void(*field_20)(rob_sub_action_execute*, rob_chara_data*);
|
||||
void(*field_18)(rob_sub_action_execute*, rob_chara*);
|
||||
void(*field_20)(rob_sub_action_execute*, rob_chara*);
|
||||
} rob_sub_action_execute_vftable;
|
||||
|
||||
struct rob_sub_action_execute {
|
||||
rob_sub_action_execute_vftable* vftable;
|
||||
rob_sub_action_execute_vftable* __vftable;
|
||||
rob_sub_action_execute_type type;
|
||||
int32_t field_C;
|
||||
};
|
||||
@@ -1031,30 +1039,40 @@ typedef struct rob_sub_action_param {
|
||||
rob_sub_action_param_type type;
|
||||
} rob_sub_action_param;
|
||||
|
||||
typedef struct rob_sub_action {
|
||||
void** dispose;
|
||||
typedef struct rob_sub_action_data {
|
||||
rob_sub_action_execute* field_0;
|
||||
rob_sub_action_execute* field_8;
|
||||
rob_sub_action_execute* field_10;
|
||||
rob_sub_action_param* field_18;
|
||||
rob_sub_action_execute* field_20;
|
||||
rob_sub_action_param* field_10;
|
||||
rob_sub_action_execute* field_18;
|
||||
rob_sub_action_execute_cry cry;
|
||||
rob_sub_action_execute_shake_hand shake_hand;
|
||||
rob_sub_action_execute_embarrassed embarrassed;
|
||||
rob_sub_action_execute_angry angry;
|
||||
rob_sub_action_execute_laugh laugh;
|
||||
rob_sub_action_execute_count_num count_num;
|
||||
} rob_sub_action;
|
||||
} rob_sub_action_data;
|
||||
|
||||
struct rob_sub_action {
|
||||
rob_sub_action_vtbl* __vftable;
|
||||
rob_sub_action_data data;
|
||||
};
|
||||
|
||||
typedef struct struc_389 {
|
||||
float_t field_0;
|
||||
float_t frame;
|
||||
float_t prev_frame;
|
||||
float_t last_frame;
|
||||
} struc_389;
|
||||
|
||||
typedef struct struc_406 {
|
||||
float_t frame;
|
||||
float_t field_4;
|
||||
float_t field_8;
|
||||
} struc_389;
|
||||
} struc_406;
|
||||
|
||||
typedef struct rob_partial_motion rob_partial_motion;
|
||||
|
||||
typedef struct rob_partial_motion_vtbl {
|
||||
void(*dispose)(rob_partial_motion*);
|
||||
void(*dispose)(rob_partial_motion*, bool);
|
||||
void(*field_8)(void*);
|
||||
} rob_partial_motion_vtbl;
|
||||
|
||||
@@ -1101,7 +1119,7 @@ typedef struct struc_269 {
|
||||
float_t field_4;
|
||||
float_t field_8;
|
||||
vec3 field_C;
|
||||
float_t field_18;
|
||||
float_t force;
|
||||
float_t field_1C;
|
||||
int32_t field_20;
|
||||
int32_t field_24;
|
||||
@@ -1154,87 +1172,51 @@ typedef struct aft_object_info {
|
||||
uint16_t set_id;
|
||||
} aft_object_info;
|
||||
|
||||
typedef struct struc_405 {
|
||||
rob_face_motion field_0;
|
||||
rob_hand_motion field_48;
|
||||
rob_hand_motion field_90;
|
||||
rob_mouth_motion field_D8;
|
||||
rob_eyes_motion field_120;
|
||||
rob_eyelid_motion field_168;
|
||||
aft_object_info field_1B0;
|
||||
aft_object_info field_1B4;
|
||||
aft_object_info field_1B8;
|
||||
aft_object_info field_1BC;
|
||||
int32_t field_1C0;
|
||||
float_t field_1C4;
|
||||
} struc_405;
|
||||
|
||||
typedef struct struc_268 {
|
||||
int32_t field_0;
|
||||
int32_t field_4;
|
||||
int32_t motion_id;
|
||||
int32_t prev_motion_id;
|
||||
struc_389 field_8;
|
||||
struc_389 step;
|
||||
float_t osage_phys_step;
|
||||
struc_406 field_14;
|
||||
float_t step;
|
||||
int32_t field_24;
|
||||
uint8_t field_28;
|
||||
uint8_t field_29;
|
||||
uint8_t field_2A;
|
||||
int32_t field_2C;
|
||||
int32_t field_30;
|
||||
int64_t field_38;
|
||||
int64_t field_40;
|
||||
int64_t ex_data_mat;
|
||||
int64_t field_50;
|
||||
int64_t field_58;
|
||||
int64_t field_60;
|
||||
int64_t field_68;
|
||||
int64_t field_70;
|
||||
int64_t field_78;
|
||||
int64_t field_80;
|
||||
int64_t field_88;
|
||||
int64_t field_90;
|
||||
int64_t field_98;
|
||||
int64_t field_A0;
|
||||
int64_t field_A8;
|
||||
int64_t field_B0;
|
||||
int64_t field_B8;
|
||||
int64_t field_C0;
|
||||
int64_t field_C8;
|
||||
int64_t field_D0;
|
||||
int64_t field_D8;
|
||||
int64_t field_E0;
|
||||
int64_t field_E8;
|
||||
int64_t field_F0;
|
||||
int64_t field_F8;
|
||||
int64_t field_100;
|
||||
int64_t field_108;
|
||||
int64_t field_110;
|
||||
int64_t field_118;
|
||||
int64_t field_120;
|
||||
int64_t field_128;
|
||||
int64_t field_130;
|
||||
int32_t field_34;
|
||||
int32_t field_38[32];
|
||||
int32_t field_B8[32];
|
||||
float_t field_138;
|
||||
float_t field_13C;
|
||||
int32_t field_140;
|
||||
int32_t field_144;
|
||||
int32_t field_148;
|
||||
int32_t field_14C;
|
||||
rob_face_motion field_150;
|
||||
rob_hand_motion field_198;
|
||||
rob_hand_motion field_1E0;
|
||||
rob_mouth_motion field_228;
|
||||
rob_eyes_motion field_270;
|
||||
rob_eyelid_motion field_2B8;
|
||||
aft_object_info field_300;
|
||||
aft_object_info field_304;
|
||||
aft_object_info field_308;
|
||||
aft_object_info field_30C;
|
||||
int32_t field_310;
|
||||
float_t field_314;
|
||||
struc_405 field_150;
|
||||
rob_hand_motion field_318;
|
||||
rob_hand_motion field_360;
|
||||
aft_object_info field_3A8;
|
||||
aft_object_info field_3AC;
|
||||
rob_face_motion field_3B0;
|
||||
rob_hand_motion field_3F8;
|
||||
rob_hand_motion field_440;
|
||||
rob_mouth_motion field_488;
|
||||
rob_eyes_motion field_4D0;
|
||||
rob_eyelid_motion field_518;
|
||||
aft_object_info field_560;
|
||||
aft_object_info field_564;
|
||||
aft_object_info field_568;
|
||||
aft_object_info field_56C;
|
||||
float_t field_570;
|
||||
struc_405 field_3B0;
|
||||
struc_269 field_578[13];
|
||||
struc_269 field_B28[13];
|
||||
struc_269 field_10D8;
|
||||
struc_269 field_1148;
|
||||
struc_269 field_10D8[2];
|
||||
struc_229 field_11B8[2];
|
||||
struc_229 field_1240[2];
|
||||
struc_222 field_12C8[2];
|
||||
@@ -1290,7 +1272,7 @@ typedef struct struc_306 {
|
||||
int32_t field_3C;
|
||||
int32_t field_40;
|
||||
int32_t field_44;
|
||||
int32_t ex_data_mat;
|
||||
int32_t field_48;
|
||||
} struc_306;
|
||||
|
||||
typedef struct struc_223 {
|
||||
@@ -1439,7 +1421,7 @@ typedef struct struc_399 {
|
||||
int32_t field_3C;
|
||||
int32_t field_40;
|
||||
int32_t field_44;
|
||||
vec3 ex_data_mat;
|
||||
vec3 field_48;
|
||||
vec3 field_54;
|
||||
int32_t field_60;
|
||||
int32_t field_64;
|
||||
@@ -1448,10 +1430,10 @@ typedef struct struc_399 {
|
||||
} struc_399;
|
||||
|
||||
typedef struct struc_220 {
|
||||
float_t scale;
|
||||
uint8_t field_4;
|
||||
float_t size;
|
||||
bool height_adjust;
|
||||
float_t field_8;
|
||||
vec3 field_C;
|
||||
vec3 pos_adjust;
|
||||
float_t field_18;
|
||||
float_t field_1C;
|
||||
float_t field_20;
|
||||
@@ -1511,7 +1493,7 @@ typedef struct struc_209 {
|
||||
int32_t field_3C;
|
||||
int32_t field_40;
|
||||
int32_t field_44;
|
||||
int32_t ex_data_mat;
|
||||
int32_t field_48;
|
||||
int32_t field_4C;
|
||||
int32_t field_50;
|
||||
int32_t field_54;
|
||||
@@ -1614,7 +1596,7 @@ typedef struct struc_209 {
|
||||
uint8_t field_1F26;
|
||||
} struc_209;
|
||||
|
||||
typedef struct struc_263 {
|
||||
typedef struct rob_chara_data {
|
||||
bool field_0;
|
||||
uint8_t field_1;
|
||||
uint8_t field_2;
|
||||
@@ -1648,7 +1630,7 @@ typedef struct struc_263 {
|
||||
int32_t field_3DD8;
|
||||
float_t field_3DDC;
|
||||
uint8_t field_3DE0;
|
||||
} struc_263;
|
||||
} rob_chara_data;
|
||||
|
||||
typedef struct struc_242 {
|
||||
int32_t field_0;
|
||||
@@ -1693,7 +1675,7 @@ typedef struct rob_chara_pv_data {
|
||||
int32_t field_94;
|
||||
int32_t field_98;
|
||||
int32_t field_9C;
|
||||
uint8_t field_A0;
|
||||
bool height_adjust;
|
||||
int32_t field_A4[4];
|
||||
eyes_adjust eyes_adjust;
|
||||
} rob_chara_pv_data;
|
||||
@@ -1747,7 +1729,7 @@ typedef struct struc_307 {
|
||||
int16_t field_1C;
|
||||
int16_t field_1E;
|
||||
int64_t field_20;
|
||||
rob_chara_data_bone_data* field_28;
|
||||
rob_chara_bone_data* field_28;
|
||||
} struc_307;
|
||||
|
||||
typedef struct struc_218 {
|
||||
@@ -1783,7 +1765,7 @@ typedef struct chara_init_data {
|
||||
int32_t field_3C;
|
||||
int32_t field_40;
|
||||
int32_t field_44;
|
||||
int32_t ex_data_mat;
|
||||
int32_t field_48;
|
||||
int32_t field_4C;
|
||||
int32_t field_50;
|
||||
int32_t field_54;
|
||||
@@ -2301,11 +2283,11 @@ typedef struct chara_init_data {
|
||||
} chara_init_data;
|
||||
|
||||
typedef struct rob_detail {
|
||||
rob_chara_data* field_8;
|
||||
struc_263* field_10;
|
||||
rob_chara* field_8;
|
||||
rob_chara_data* field_10;
|
||||
} rob_detail;
|
||||
|
||||
struct rob_chara_data {
|
||||
struct rob_chara {
|
||||
uint8_t chara_id;
|
||||
uint8_t field_1;
|
||||
uint8_t field_2;
|
||||
@@ -2320,11 +2302,11 @@ struct rob_chara_data {
|
||||
int32_t field_18;
|
||||
float_t field_1C;
|
||||
struc_307* field_20;
|
||||
rob_chara_data_bone_data* bone_data;
|
||||
rob_chara_data_item_equip* item_equip;
|
||||
struc_288 field_38;
|
||||
struc_263 field_440;
|
||||
struc_263 field_4228;
|
||||
rob_chara_bone_data* bone_data;
|
||||
rob_chara_item_equip* item_equip;
|
||||
rob_chara_item_sub_data item_sub_data;
|
||||
rob_chara_data data;
|
||||
rob_chara_data data_prev;
|
||||
chara_init_data* chara_init_data;
|
||||
rob_detail* rob_detail;
|
||||
rob_chara_pv_data pv_data;
|
||||
@@ -2538,7 +2520,7 @@ typedef struct struc_243 {
|
||||
typedef struct struc_258 {
|
||||
vector_bone_data* field_0;
|
||||
mat4u field_8;
|
||||
struc_241 ex_data_mat;
|
||||
struc_241 field_48;
|
||||
uint8_t field_8C;
|
||||
uint8_t field_8D;
|
||||
uint8_t field_8E;
|
||||
@@ -2610,7 +2592,7 @@ typedef struct struc_312 {
|
||||
} struc_312;
|
||||
|
||||
typedef struct bone_data_parent {
|
||||
rob_chara_data_bone_data* rob_bone_data;
|
||||
rob_chara_bone_data* rob_bone_data;
|
||||
bool field_8;
|
||||
bool field_9;
|
||||
size_t motion_bone_count;
|
||||
@@ -2632,7 +2614,7 @@ typedef struct struc_370 {
|
||||
bool field_34;
|
||||
float_t field_38;
|
||||
float_t* field_40;
|
||||
float_t* ex_data_mat;
|
||||
float_t* field_48;
|
||||
} struc_370;
|
||||
|
||||
typedef struct struc_308 {
|
||||
@@ -2671,14 +2653,14 @@ vector_ptr(motion_blend_mot)
|
||||
list_ptr(motion_blend_mot)
|
||||
list(size_t)
|
||||
|
||||
typedef struct rob_chara_data_bone_data_ik_scale {
|
||||
typedef struct rob_chara_bone_data_ik_scale {
|
||||
float_t ratio0;
|
||||
float_t ratio1;
|
||||
float_t ratio2;
|
||||
float_t ratio3;
|
||||
} rob_chara_data_bone_data_ik_scale;
|
||||
} rob_chara_bone_data_ik_scale;
|
||||
|
||||
struct rob_chara_data_bone_data {
|
||||
struct rob_chara_bone_data {
|
||||
uint8_t field_0;
|
||||
uint8_t field_1;
|
||||
size_t object_bone_count;
|
||||
@@ -2702,7 +2684,7 @@ struct rob_chara_data_bone_data {
|
||||
mot_blend eye;
|
||||
mot_blend eyelid;
|
||||
uint8_t field_758;
|
||||
rob_chara_data_bone_data_ik_scale ik_scale;
|
||||
rob_chara_bone_data_ik_scale ik_scale;
|
||||
vec3 field_76C;
|
||||
vec3 field_778;
|
||||
int32_t field_784;
|
||||
@@ -2741,7 +2723,7 @@ typedef struct aft_obj_skin_block_osage {
|
||||
int32_t external_name_index;
|
||||
int32_t name_index;
|
||||
aft_obj_skin_block_osage_node* nodes;
|
||||
int32_t ex_data_mat;
|
||||
int32_t field_48;
|
||||
int32_t field_4C;
|
||||
int32_t field_50;
|
||||
int32_t field_54;
|
||||
@@ -2798,7 +2780,7 @@ typedef struct aft_obj_skin_block_cloth {
|
||||
struc_251* field_20;
|
||||
uint16_t* field_24;
|
||||
uint16_t* field_28;
|
||||
int64_t ex_data_mat;
|
||||
int64_t field_48;
|
||||
uint32_t field_30;
|
||||
uint32_t field_54;
|
||||
} aft_obj_skin_block_cloth;
|
||||
@@ -2865,7 +2847,7 @@ typedef struct aft_obj_skin_block {
|
||||
};
|
||||
} aft_obj_skin_block;
|
||||
|
||||
typedef struct rob_chara_data_item_equip_object rob_chara_data_item_equip_object;
|
||||
typedef struct rob_chara_item_equip_object rob_chara_item_equip_object;
|
||||
typedef struct ex_node_block ex_node_block;
|
||||
|
||||
typedef struct ex_node_block_vtbl {
|
||||
@@ -2873,10 +2855,10 @@ typedef struct ex_node_block_vtbl {
|
||||
void(*field_8)(ex_node_block*);
|
||||
void(*field_10)(ex_node_block*);
|
||||
void(*field_18)(ex_node_block*, int64_t, int64_t);
|
||||
void(*field_20)(ex_node_block*);
|
||||
void(*update)(ex_node_block*);
|
||||
void(*field_28)(ex_node_block*);
|
||||
void* (*field_30)(ex_node_block*);
|
||||
void(*field_38)(ex_node_block*);
|
||||
void(*draw)(ex_node_block*);
|
||||
void(*reset)(ex_node_block*);
|
||||
void(*field_40)(ex_node_block*);
|
||||
void(*field_48)(ex_node_block*);
|
||||
void(*field_50)(ex_node_block*);
|
||||
@@ -2887,12 +2869,11 @@ struct ex_node_block {
|
||||
ex_node_block_vtbl* __vftable;
|
||||
bone_node* bone_node;
|
||||
ex_node_type type;
|
||||
int32_t field_14;
|
||||
char* name;
|
||||
bone_node* parent_bone_node;
|
||||
string parent_name;
|
||||
ex_node_block* parent_node;
|
||||
rob_chara_data_item_equip_object* field_50;
|
||||
rob_chara_item_equip_object* item_equip_object;
|
||||
bool field_58;
|
||||
bool field_59;
|
||||
bool field_5A;
|
||||
@@ -2905,16 +2886,15 @@ typedef struct ex_null_block {
|
||||
|
||||
typedef struct rob_osage_node rob_osage_node;
|
||||
|
||||
typedef struct struc_419 {
|
||||
typedef struct rob_osage_node_data_normal_ref {
|
||||
bool field_0;
|
||||
int32_t field_4;
|
||||
rob_osage_node* field_8;
|
||||
rob_osage_node* field_10;
|
||||
rob_osage_node* field_18;
|
||||
rob_osage_node* field_20;
|
||||
rob_osage_node* field_28;
|
||||
mat4u field_30;
|
||||
} struc_419;
|
||||
rob_osage_node* n;
|
||||
rob_osage_node* u;
|
||||
rob_osage_node* d;
|
||||
rob_osage_node* l;
|
||||
rob_osage_node* r;
|
||||
mat4u mat;
|
||||
} rob_osage_node_data_normal_ref;
|
||||
|
||||
typedef struct skin_param_hinge {
|
||||
float_t ymin;
|
||||
@@ -2930,12 +2910,12 @@ typedef struct skin_param_osage_node {
|
||||
skin_param_hinge hinge;
|
||||
} skin_param_osage_node;
|
||||
|
||||
vector_ptr(rob_osage_node)
|
||||
|
||||
typedef struct rob_osage_node_data {
|
||||
float_t force;
|
||||
int64_t field_8;
|
||||
int64_t field_10;
|
||||
int64_t field_18;
|
||||
struc_419 field_20;
|
||||
vector_ptr_rob_osage_node boc;
|
||||
rob_osage_node_data_normal_ref normal_ref;
|
||||
skin_param_osage_node skp_osg_node;
|
||||
} rob_osage_node_data;
|
||||
|
||||
@@ -2947,63 +2927,75 @@ typedef struct struc_331 {
|
||||
|
||||
vector(struc_331)
|
||||
|
||||
typedef struct struc_477 {
|
||||
float_t length;
|
||||
vec3 angle;
|
||||
} struc_477;
|
||||
|
||||
typedef struct struc_476 {
|
||||
struc_477 field_0;
|
||||
struc_477 field_10;
|
||||
} struc_476;
|
||||
|
||||
typedef struct struc_479 {
|
||||
vec3 trans;
|
||||
vec3 trans_diff;
|
||||
vec3 rotation;
|
||||
float_t field_24;
|
||||
} struc_479;
|
||||
|
||||
struct rob_osage_node {
|
||||
float_t length;
|
||||
vec3 field_4;
|
||||
vec3 field_10;
|
||||
vec3 field_1C;
|
||||
int32_t field_28;
|
||||
int32_t field_2C;
|
||||
int32_t field_30;
|
||||
float_t field_34;
|
||||
bone_node* field_38;
|
||||
mat4u* field_40;
|
||||
mat4u ex_data_mat;
|
||||
float_t field_88;
|
||||
float_t field_8C;
|
||||
float_t field_90;
|
||||
vec3 trans;
|
||||
vec3 trans_orig;
|
||||
vec3 trans_diff;
|
||||
vec3 field_28;
|
||||
float_t child_length;
|
||||
bone_node* bone_node;
|
||||
mat4* bone_node_mat;
|
||||
mat4u mat;
|
||||
rob_osage_node* sibling_node;
|
||||
float_t distance;
|
||||
vec3 field_94;
|
||||
int64_t field_A0;
|
||||
int64_t field_A8;
|
||||
int64_t field_B0;
|
||||
int64_t field_B8;
|
||||
int64_t field_C0;
|
||||
int32_t field_C8;
|
||||
struc_479 field_A0;
|
||||
float_t field_C8;
|
||||
float_t field_CC;
|
||||
vec3 field_D0;
|
||||
int32_t field_DC;
|
||||
rob_osage_node_data* field_E0;
|
||||
rob_osage_node_data field_E8;
|
||||
int32_t field_194;
|
||||
float_t force;
|
||||
rob_osage_node_data* data_ptr;
|
||||
rob_osage_node_data data;
|
||||
vector_struc_331 field_198;
|
||||
int32_t field_1B0;
|
||||
int32_t field_1B4;
|
||||
int32_t field_1B8;
|
||||
int32_t field_1BC;
|
||||
int32_t field_1C0;
|
||||
int32_t field_1C4;
|
||||
int32_t field_1C8;
|
||||
int32_t field_1CC;
|
||||
struc_476 field_1B0;
|
||||
};
|
||||
|
||||
vector(rob_osage_node)
|
||||
|
||||
typedef struct skin_param_osage_root_coli {
|
||||
int32_t type;
|
||||
int32_t bone0_index;
|
||||
int32_t bone1_index;
|
||||
float_t radius;
|
||||
vec3 bone0_pos;
|
||||
vec3 bone1_pos;
|
||||
} skin_param_osage_root_coli;
|
||||
|
||||
vector(skin_param_osage_root_coli)
|
||||
|
||||
typedef struct skin_param {
|
||||
int64_t field_0;
|
||||
int64_t field_8;
|
||||
int64_t field_10;
|
||||
int64_t field_18;
|
||||
int64_t field_20;
|
||||
int64_t field_28;
|
||||
int64_t field_30;
|
||||
int64_t field_38;
|
||||
int64_t field_40;
|
||||
int32_t ex_data_mat;
|
||||
vec4u field_4C;
|
||||
int32_t field_5C;
|
||||
int32_t field_60;
|
||||
int32_t field_64;
|
||||
int64_t field_68;
|
||||
vector_skin_param_osage_root_coli coli;
|
||||
float_t friction;
|
||||
float_t wind_afc;
|
||||
float_t air_res;
|
||||
vec3 rot;
|
||||
vec3 init_rot;
|
||||
int32_t coli_type;
|
||||
float_t stiffness;
|
||||
float_t move_cancel;
|
||||
float_t coli_r;
|
||||
skin_param_hinge hinge;
|
||||
float_t force;
|
||||
float_t force_gain;
|
||||
vector_rob_osage_node* colli_tgt_osg;
|
||||
} skin_param;
|
||||
|
||||
typedef struct osage_coli {
|
||||
@@ -3017,16 +3009,52 @@ typedef struct osage_coli {
|
||||
float_t field_34;
|
||||
} osage_coli;
|
||||
|
||||
vector(osage_coli)
|
||||
|
||||
typedef struct osage_ring_data {
|
||||
float_t ring_rectangle_x;
|
||||
float_t ring_rectangle_y;
|
||||
float_t ring_rectangle_width;
|
||||
float_t ring_rectangle_height;
|
||||
float_t ring_height;
|
||||
float_t ring_out_height;
|
||||
bool field_18;
|
||||
vector_osage_coli coli;
|
||||
vector_skin_param_osage_root_coli skp_root_coli;
|
||||
} osage_ring_data;
|
||||
|
||||
typedef struct struc_478 {
|
||||
int32_t field_0;
|
||||
int32_t field_4;
|
||||
int64_t field_8;
|
||||
int64_t field_10;
|
||||
} struc_478;
|
||||
|
||||
tree_def(struc_478)
|
||||
|
||||
typedef struct list_struc_479_node list_struc_479_node;
|
||||
|
||||
struct list_struc_479_node {
|
||||
list_struc_479_node* next;
|
||||
list_struc_479_node* prev;
|
||||
struc_479 value;
|
||||
};
|
||||
|
||||
typedef struct list_struc_479 {
|
||||
list_struc_479_node* head;
|
||||
size_t size;
|
||||
} list_struc_479;
|
||||
|
||||
typedef struct rob_osage {
|
||||
skin_param* field_0;
|
||||
bone_node_expression_data field_8;
|
||||
vector_rob_osage_node field_38;
|
||||
rob_osage_node field_50;
|
||||
skin_param field_220;
|
||||
skin_param* skin_param_ptr;
|
||||
bone_node_expression_data exp_data;
|
||||
vector_rob_osage_node nodes;
|
||||
rob_osage_node node;
|
||||
skin_param skin_param;
|
||||
int32_t field_290;
|
||||
int64_t field_298;
|
||||
uint8_t field_2A0;
|
||||
uint8_t field_2A1;
|
||||
bool field_2A0;
|
||||
bool field_2A1;
|
||||
float_t field_2A4;
|
||||
osage_coli coli[64];
|
||||
osage_coli coli_ring[64];
|
||||
@@ -3034,40 +3062,27 @@ typedef struct rob_osage {
|
||||
float_t field_1EB4;
|
||||
int32_t field_1EB8;
|
||||
int32_t field_1EBC;
|
||||
mat4* field_1EC0;
|
||||
mat4u field_1EC8;
|
||||
float_t field_1F08;
|
||||
mat4* parent_mat_ptr;
|
||||
mat4u parent_mat;
|
||||
float_t move_cancel;
|
||||
bool field_1F0C;
|
||||
bool field_1F0D;
|
||||
bool wind_reset;
|
||||
bool field_1F0E;
|
||||
bool field_1F0F;
|
||||
float_t field_1F10;
|
||||
float_t field_1F14;
|
||||
float_t field_1F18;
|
||||
float_t field_1F1C;
|
||||
float_t field_1F20;
|
||||
float_t field_1F24;
|
||||
bool field_1F28;
|
||||
int64_t field_1F30;
|
||||
int64_t field_1F38;
|
||||
int64_t field_1F40;
|
||||
int64_t field_1F48;
|
||||
int64_t field_1F50;
|
||||
int64_t field_1F58;
|
||||
int64_t field_1F60;
|
||||
int64_t field_1F68;
|
||||
int64_t field_1F70;
|
||||
uint8_t field_1F78;
|
||||
osage_ring_data ring;
|
||||
tree_struc_478 field_1F60;
|
||||
list_struc_479* field_1F70;
|
||||
bool field_1F78;
|
||||
vec3 field_1F7C;
|
||||
} rob_osage;
|
||||
|
||||
typedef struct ex_osage_block {
|
||||
ex_node_block base;
|
||||
int64_t field_60;
|
||||
size_t index;
|
||||
rob_osage rob;
|
||||
mat4* mat;
|
||||
int32_t field_1FF8;
|
||||
float_t field_1FFC;
|
||||
float_t step;
|
||||
} ex_osage_block;
|
||||
|
||||
typedef struct ex_constraint_block {
|
||||
@@ -3156,7 +3171,7 @@ typedef struct cloth_vftable {
|
||||
void(*field_30)(void*);
|
||||
void(*field_38)(void*);
|
||||
void(*field_40)(void*);
|
||||
void(*ex_data_mat)(void*);
|
||||
void(*field_48)(void*);
|
||||
void(*field_50)(void*);
|
||||
void(*field_58)(void*);
|
||||
} cloth_vftable;
|
||||
@@ -3211,7 +3226,7 @@ struct cloth {
|
||||
int64_t field_30;
|
||||
vec3 field_38;
|
||||
float_t field_44;
|
||||
uint8_t ex_data_mat;
|
||||
uint8_t field_48;
|
||||
vec3 field_4C;
|
||||
vector_struc_341 field_58;
|
||||
skin_param* field_70;
|
||||
@@ -3379,7 +3394,7 @@ typedef struct aft_obj {
|
||||
uint32_t field_3C;
|
||||
uint32_t field_40;
|
||||
uint32_t field_44;
|
||||
uint32_t ex_data_mat;
|
||||
uint32_t field_48;
|
||||
uint32_t field_4C;
|
||||
uint32_t field_50;
|
||||
uint32_t field_54;
|
||||
@@ -3433,7 +3448,7 @@ typedef struct aft_obj_skin_ex_data {
|
||||
int64_t osage_sibling_infos;
|
||||
int32_t field_40;
|
||||
int32_t field_44;
|
||||
int32_t ex_data_mat;
|
||||
int32_t field_48;
|
||||
int32_t field_4C;
|
||||
int32_t field_50;
|
||||
int32_t field_54;
|
||||
@@ -3572,10 +3587,10 @@ typedef struct rob_cloth {
|
||||
int64_t field_1D40;
|
||||
int64_t field_1D48;
|
||||
int64_t field_1D50;
|
||||
rob_chara_data_item_equip_object* field_1D58;
|
||||
rob_chara_item_equip_object* field_1D58;
|
||||
struc_230* field_1D60;
|
||||
aft_obj_skin_block_cloth* cloth_block;
|
||||
float_t field_1D70;
|
||||
aft_obj_skin_block_cloth* cls_data;
|
||||
float_t move_cancel;
|
||||
uint8_t field_1D74;
|
||||
aft_obj_mesh field_1D78[2];
|
||||
struc_332 field_1FD8[2];
|
||||
@@ -3590,7 +3605,7 @@ typedef struct rob_cloth {
|
||||
typedef struct ex_cloth_block {
|
||||
ex_node_block base;
|
||||
rob_cloth rob;
|
||||
aft_obj_skin_block_cloth* cloth_block;
|
||||
aft_obj_skin_block_cloth* cls_data;
|
||||
mat4* field_2428;
|
||||
int64_t field_2430;
|
||||
} ex_cloth_block;
|
||||
@@ -3617,7 +3632,7 @@ typedef struct texture_data_struct {
|
||||
vec3 field_28;
|
||||
} texture_data_struct;
|
||||
|
||||
struct rob_chara_data_item_equip_object {
|
||||
struct rob_chara_item_equip_object {
|
||||
size_t index;
|
||||
mat4* mat;
|
||||
aft_object_info object_info;
|
||||
@@ -3649,13 +3664,13 @@ struct rob_chara_data_item_equip_object {
|
||||
char field_1C8;
|
||||
aft_obj_skin_ex_data* skin_ex_data;
|
||||
aft_obj_skin* skin;
|
||||
rob_chara_data_item_equip* item_equip;
|
||||
rob_chara_item_equip* item_equip;
|
||||
};
|
||||
|
||||
struct rob_chara_data_item_equip {
|
||||
struct rob_chara_item_equip {
|
||||
bone_node* bone_nodes;
|
||||
mat4* matrices;
|
||||
rob_chara_data_item_equip_object* item_equip_object;
|
||||
rob_chara_item_equip_object* item_equip_object;
|
||||
int32_t field_18[31];
|
||||
bool item_equip_range;
|
||||
int32_t first_item_equip_object;
|
||||
@@ -3671,9 +3686,9 @@ struct rob_chara_data_item_equip {
|
||||
int32_t field_DC;
|
||||
vec4u texture_color_coeff;
|
||||
float_t wet;
|
||||
float_t field_F4;
|
||||
uint8_t chara_color;
|
||||
uint8_t field_F9;
|
||||
float_t wind_strength;
|
||||
bool chara_color;
|
||||
bool npr_flag;
|
||||
mat4u mat;
|
||||
mat4u field_13C[30];
|
||||
int32_t field_8BC;
|
||||
@@ -3700,7 +3715,7 @@ struct rob_chara_data_item_equip {
|
||||
int64_t field_920;
|
||||
int64_t field_928;
|
||||
int64_t field_930;
|
||||
float_t osage_phys_step;
|
||||
float_t step;
|
||||
uint8_t field_93C;
|
||||
vector_struc_373 field_940;
|
||||
uint8_t field_958;
|
||||
@@ -3710,8 +3725,22 @@ struct rob_chara_data_item_equip {
|
||||
|
||||
extern void bone_data_mult_ik(bone_data* a1, int32_t a2);
|
||||
extern void bone_data_mult_1(bone_data* a1, mat4* parent_mat, bone_data* a3, bool solve_ik);
|
||||
extern void bone_data_mult_2(rob_chara_data_bone_data* a1, mat4* a2);
|
||||
extern void rob_chara_data_bone_data_motion_load(rob_chara_data_bone_data* a1, int32_t motion_id, int32_t a3);
|
||||
extern void rob_chara_data_bone_data_interpolate(rob_chara_data_bone_data* a1);
|
||||
extern void rob_chara_data_bone_data_update(rob_chara_data_bone_data* a1, mat4* a2);
|
||||
extern void rob_chara_data_reset(rob_chara_data* a1, rob_chara_pv_data* a2);
|
||||
extern void bone_data_mult_2(rob_chara_bone_data* a1, mat4* a2);
|
||||
extern void rob_chara_bone_data_motion_load(rob_chara_bone_data* a1, int32_t motion_id, int32_t a3);
|
||||
extern void rob_chara_bone_data_interpolate(rob_chara_bone_data* a1);
|
||||
extern void rob_chara_bone_data_update(rob_chara_bone_data* a1, mat4* a2);
|
||||
extern void rob_chara_reset(rob_chara* a1, rob_chara_pv_data* a2);
|
||||
|
||||
extern void ex_node_block_field_10(ex_node_block* node);
|
||||
|
||||
extern void* ex_osage_block_dispose(ex_osage_block* osg, bool dispose);
|
||||
extern void ex_osage_block_field_8(ex_osage_block* osg);
|
||||
extern void ex_osage_block_field_18(ex_osage_block* osg, int32_t a2, bool a3);
|
||||
extern void ex_osage_block_update(ex_osage_block* osg);
|
||||
extern void ex_osage_block_field_28(ex_osage_block* osg);
|
||||
extern void ex_osage_block_draw(ex_osage_block* osg);
|
||||
extern void ex_osage_block_reset(ex_osage_block* osg);
|
||||
extern void ex_osage_block_field_40(ex_osage_block* osg);
|
||||
extern void ex_osage_block_field_48(ex_osage_block* osg);
|
||||
extern void ex_osage_block_field_50(ex_osage_block* osg);
|
||||
extern void ex_osage_block_field_58(ex_osage_block* osg);
|
||||
|
||||
@@ -74,10 +74,25 @@ static patch_struct patch_data[] = {
|
||||
//{ (void*)0x000000014041CF50, (uint64_t)&rob_chara_data_bone_data_motion_load, },
|
||||
//{ (void*)0x0000000140418870, (uint64_t)&rob_chara_data_bone_data_interpolate, },
|
||||
//{ (void*)0x0000000140418A60, (uint64_t)&rob_chara_data_bone_data_update, },
|
||||
{ (void*)0x00000001405EEAE0, (uint64_t)&ex_osage_block_dispose, },
|
||||
{ (void*)0x00000001405F3640, (uint64_t)&ex_osage_block_field_8, },
|
||||
{ (void*)0x00000001405F39E0, (uint64_t)&ex_node_block_field_10, },
|
||||
{ (void*)0x00000001405F49F0, (uint64_t)&ex_osage_block_field_18, },
|
||||
{ (void*)0x00000001405F2140, (uint64_t)&ex_osage_block_update, },
|
||||
{ (void*)0x00000001405F2470, (uint64_t)&ex_osage_block_field_28, },
|
||||
{ (void*)0x00000001405F26F0, (uint64_t)&ex_osage_block_draw, },
|
||||
{ (void*)0x00000001405F2640, (uint64_t)&ex_osage_block_reset, },
|
||||
{ (void*)0x00000001405F2860, (uint64_t)&ex_osage_block_field_40, },
|
||||
{ (void*)0x00000001405F4640, (uint64_t)&ex_osage_block_field_48, },
|
||||
{ (void*)0x00000001405F4730, (uint64_t)&ex_osage_block_field_50, },
|
||||
{ (void*)0x00000001405F48F0, (uint64_t)&ex_osage_block_field_58, },
|
||||
};
|
||||
|
||||
static uint64_t shader_bind_func_orig_data[6];
|
||||
|
||||
extern bool toggle1[10];
|
||||
extern bool toggle2[10];
|
||||
|
||||
void inject_patches() {
|
||||
char buf[12];
|
||||
buf[0] = 0x48;
|
||||
|
||||
@@ -95,7 +95,7 @@ void FASTCALL aft_shader_bind_tone_map(aft_shader* shader) {
|
||||
int32_t FASTCALL aft_shader_bind(aft_shader* shader, aft_shader_sub_enum name) {
|
||||
int32_t num_sub = shader->num_sub;
|
||||
int32_t subshader_index = 0;
|
||||
if (num_sub <= 0)
|
||||
if (num_sub < 1)
|
||||
return -1;
|
||||
|
||||
for (aft_shader_sub* i = shader->subs; i->sub_name != name; i++) {
|
||||
|
||||
+45
-46
@@ -1514,13 +1514,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
|
||||
vector_int32_t sort_index = vector_empty(int32_t);
|
||||
vector_int32_t sort_index1 = vector_empty(int32_t);
|
||||
if (a->ambient.end - a->ambient.begin && a->format == A3DA_FORMAT_MGF) {
|
||||
if (vector_length(a->ambient) && a->format == A3DA_FORMAT_MGF) {
|
||||
len = 7;
|
||||
memcpy(buf, "ambient", 7);
|
||||
off = len;
|
||||
|
||||
vector_a3da_ambient* va = &a->ambient;
|
||||
count = (int32_t)(va->end - va->begin);
|
||||
count = (int32_t)vector_length(*va);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_ambient* a = &va->begin[sort_index.begin[i]];
|
||||
@@ -1541,13 +1541,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->auth_2d.end - a->auth_2d.begin) {
|
||||
if (vector_length(a->auth_2d)) {
|
||||
len = 7;
|
||||
memcpy(buf, "auth_2d", 7);
|
||||
off = len;
|
||||
|
||||
vector_string* va2 = &a->auth_2d;
|
||||
count = (int32_t)(va2->end - va2->begin);
|
||||
count = (int32_t)vector_length(*va2);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
string* a2 = &va2->begin[sort_index.begin[i]];
|
||||
@@ -1588,13 +1588,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
}
|
||||
}
|
||||
|
||||
if (a->camera_root.end - a->camera_root.begin) {
|
||||
if (vector_length(a->camera_root) > 0) {
|
||||
len = 11;
|
||||
memcpy(buf, "camera_root", 11);
|
||||
off = len;
|
||||
|
||||
vector_a3da_camera_root* vcr = &a->camera_root;
|
||||
count = (int32_t)(vcr->end - vcr->begin);
|
||||
count = (int32_t)vector_length(*vcr);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_camera_root* cr = &vcr->begin[sort_index.begin[i]];
|
||||
@@ -1646,13 +1646,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->chara.end - a->chara.begin) {
|
||||
if (vector_length(a->chara) > 0) {
|
||||
len = 5;
|
||||
memcpy(buf, "chara", 5);
|
||||
off = len;
|
||||
|
||||
vector_a3da_chara* vc = &a->chara;
|
||||
count = (int32_t)(vc->end - vc->begin);
|
||||
count = (int32_t)vector_length(*vc);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_chara* c = &vc->begin[sort_index.begin[i]];
|
||||
@@ -1669,13 +1669,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->curve.end - a->curve.begin) {
|
||||
if (vector_length(a->curve) > 0) {
|
||||
len = 5;
|
||||
memcpy(buf, "curve", 5);
|
||||
off = len;
|
||||
|
||||
vector_a3da_curve* vc = &a->curve;
|
||||
count = (int32_t)(vc->end - vc->begin);
|
||||
count = (int32_t)vector_length(*vc);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_curve* c = &vc->begin[sort_index.begin[i]];
|
||||
@@ -1703,13 +1703,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
buf, off, "", 1, &d->model_transform, 0x1F);
|
||||
}
|
||||
|
||||
if (a->event.end - a->event.begin) {
|
||||
if (vector_length(a->event) > 0) {
|
||||
len = 5;
|
||||
memcpy(buf, "event", 5);
|
||||
off = len;
|
||||
|
||||
vector_a3da_event* ve = &a->event;
|
||||
count = (int32_t)(ve->end - ve->begin);
|
||||
count = (int32_t)vector_length(*ve);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_event* e = &ve->begin[sort_index.begin[i]];
|
||||
@@ -1732,13 +1732,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->fog.end - a->fog.begin) {
|
||||
if (vector_length(a->fog) > 0) {
|
||||
len = 3;
|
||||
memcpy(buf, "fog", 3);
|
||||
off = len;
|
||||
|
||||
vector_a3da_fog* vf = &a->fog;
|
||||
count = (int32_t)(vf->end - vf->begin);
|
||||
count = (int32_t)vector_length(*vf);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_fog* f = &vf->begin[sort_index.begin[i]];
|
||||
@@ -1761,7 +1761,7 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->light.end - a->light.begin) {
|
||||
if (vector_length(a->light) > 0) {
|
||||
len = 5;
|
||||
memcpy(buf, "light", 5);
|
||||
off = len;
|
||||
@@ -1769,7 +1769,7 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
bool xhd = a->format == A3DA_FORMAT_XHD;
|
||||
|
||||
vector_a3da_light* vl = &a->light;
|
||||
count = (int32_t)(vl->end - vl->begin);
|
||||
count = (int32_t)vector_length(*vl);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_light* l = &vl->begin[sort_index.begin[i]];
|
||||
@@ -1849,13 +1849,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->m_object_hrc.end - a->m_object_hrc.begin) {
|
||||
if (vector_length(a->m_object_hrc) > 0) {
|
||||
len = 8;
|
||||
memcpy(buf, "m_objhrc", 8);
|
||||
off = len;
|
||||
|
||||
vector_a3da_m_object_hrc* vmoh = &a->m_object_hrc;
|
||||
count = (int32_t)(vmoh->end - vmoh->begin);
|
||||
count = (int32_t)vector_length(*vmoh);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_m_object_hrc* moh = &vmoh->begin[sort_index.begin[i]];
|
||||
@@ -1868,7 +1868,7 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
off = len + len1 + len2;
|
||||
|
||||
vector_a3da_object_instance* voi = &moh->instance;
|
||||
count1 = (int32_t)(voi->end - voi->begin);
|
||||
count1 = (int32_t)vector_length(*voi);
|
||||
key_val_get_lexicographic_order(&sort_index1, count1);
|
||||
for (int32_t j = 0; j < count; j++) {
|
||||
a3da_object_instance* oi = &voi->begin[sort_index1.begin[i]];
|
||||
@@ -1907,7 +1907,7 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
off = len + len1 + len2;
|
||||
|
||||
vector_a3da_object_node* vmohn = &moh->node;
|
||||
count1 = (int32_t)(vmohn->end - vmohn->begin);
|
||||
count1 = (int32_t)vector_length(*vmohn);
|
||||
key_val_get_lexicographic_order(&sort_index1, count1);
|
||||
for (int32_t j = 0; j < count; j++) {
|
||||
a3da_object_node* mohn = &vmohn->begin[sort_index1.begin[i]];
|
||||
@@ -1941,13 +1941,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->m_object_hrc_list.end - a->m_object_hrc_list.begin) {
|
||||
if (vector_length(a->m_object_hrc_list) > 0) {
|
||||
len = 13;
|
||||
memcpy(buf, "m_objhrc_list", 13);
|
||||
off = len;
|
||||
|
||||
vector_string* vmohl = &a->m_object_hrc_list;
|
||||
count = (int32_t)(vmohl->end - vmohl->begin);
|
||||
count = (int32_t)vector_length(*vmohl);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
string* mohl = &vmohl->begin[sort_index.begin[i]];
|
||||
@@ -1962,14 +1962,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->material_list.end - a->material_list.begin
|
||||
&& (a->format == A3DA_FORMAT_X || a->format == A3DA_FORMAT_XHD)) {
|
||||
if (vector_length(a->material_list) > 0 && (a->format == A3DA_FORMAT_X || a->format == A3DA_FORMAT_XHD)) {
|
||||
len = 13;
|
||||
memcpy(buf, "material_list", 13);
|
||||
off = len;
|
||||
|
||||
vector_a3da_material_list* vml = &a->material_list;
|
||||
count = (int32_t)(vml->end - vml->begin);
|
||||
count = (int32_t)vector_length(*vml);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_material_list* ml = &vml->begin[sort_index.begin[i]];
|
||||
@@ -1992,13 +1991,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->motion.end - a->motion.begin) {
|
||||
if (vector_length(a->motion) > 0) {
|
||||
len = 6;
|
||||
memcpy(buf, "motion", 6);
|
||||
off = len;
|
||||
|
||||
vector_string* vm = &a->motion;
|
||||
count = (int32_t)(vm->end - vm->begin);
|
||||
count = (int32_t)vector_length(*vm);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
string* m = &vm->begin[sort_index.begin[i]];
|
||||
@@ -2013,13 +2012,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->object.end - a->object.begin) {
|
||||
if (vector_length(a->object) > 0) {
|
||||
len = 6;
|
||||
memcpy(buf, "object", 6);
|
||||
off = len;
|
||||
|
||||
vector_a3da_object* vo = &a->object;
|
||||
count = (int32_t)(vo->end - vo->begin);
|
||||
count = (int32_t)vector_length(*vo);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_object* o = &vo->begin[sort_index.begin[i]];
|
||||
@@ -2055,7 +2054,7 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
off = len + len1 + len2;
|
||||
|
||||
vector_a3da_object_texture_pattern* votp = &o->texture_pattern;
|
||||
count1 = (int32_t)(votp->end - votp->begin);
|
||||
count1 = (int32_t)vector_length(*votp);
|
||||
key_val_get_lexicographic_order(&sort_index1, count1);
|
||||
for (int32_t j = 0; j < count; j++) {
|
||||
a3da_object_texture_pattern* otp = &votp->begin[sort_index1.begin[i]];
|
||||
@@ -2082,7 +2081,7 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
off = len + len1 + len2;
|
||||
|
||||
vector_a3da_object_texture_transform* vott = &o->texture_transform;
|
||||
count1 = (int32_t)(vott->end - vott->begin);
|
||||
count1 = (int32_t)vector_length(*vott);
|
||||
key_val_get_lexicographic_order(&sort_index1, count1);
|
||||
for (int32_t j = 0; j < count; j++) {
|
||||
a3da_object_texture_transform* ott = &vott->begin[sort_index1.begin[i]];
|
||||
@@ -2141,13 +2140,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->object_list.end - a->object_list.begin) {
|
||||
if (vector_length(a->object_list) > 0) {
|
||||
len = 11;
|
||||
memcpy(buf, "object_list", 11);
|
||||
off = len;
|
||||
|
||||
vector_string* vol = &a->object_list;
|
||||
count = (int32_t)(vol->end - vol->begin);
|
||||
count = (int32_t)vector_length(*vol);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
string* ol = &vol->begin[sort_index.begin[i]];
|
||||
@@ -2162,13 +2161,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->object_hrc.end - a->object_hrc.begin) {
|
||||
if (vector_length(a->object_hrc) > 0) {
|
||||
len = 6;
|
||||
memcpy(buf, "objhrc", 6);
|
||||
off = len;
|
||||
|
||||
vector_a3da_object_hrc* voh = &a->object_hrc;
|
||||
count = (int32_t)(voh->end - voh->begin);
|
||||
count = (int32_t)vector_length(*voh);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_object_hrc* oh = &voh->begin[sort_index.begin[i]];
|
||||
@@ -2184,7 +2183,7 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
off = len + len1 + len2;
|
||||
|
||||
vector_a3da_object_node* vohn = &oh->node;
|
||||
count1 = (int32_t)(vohn->end - vohn->begin);
|
||||
count1 = (int32_t)vector_length(*vohn);
|
||||
key_val_get_lexicographic_order(&sort_index1, count1);
|
||||
for (int32_t j = 0; j < count; j++) {
|
||||
a3da_object_node* ohn = &vohn->begin[sort_index1.begin[i]];
|
||||
@@ -2224,13 +2223,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (a->object_hrc_list.end - a->object_hrc_list.begin) {
|
||||
if (vector_length(a->object_hrc_list) > 0) {
|
||||
len = 11;
|
||||
memcpy(buf, "objhrc_list", 11);
|
||||
off = len;
|
||||
|
||||
vector_string* vohl = &a->object_hrc_list;
|
||||
count = (int32_t)(vohl->end - vohl->begin);
|
||||
count = (int32_t)vector_length(*vohl);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
string* ohl = &vohl->begin[sort_index.begin[i]];
|
||||
@@ -2295,13 +2294,13 @@ static void a3da_write_text(a3da* a, void** data, size_t* length, bool a3dc) {
|
||||
key_val_write_a3da_key(&s, buf, off, ".lens_shaft", 12, &pp->lens_shaft);
|
||||
}
|
||||
|
||||
if (a->point.end - a->point.begin) {
|
||||
if (vector_length(a->point) > 0) {
|
||||
len = 5;
|
||||
memcpy(buf, "point", 5);
|
||||
off = len;
|
||||
|
||||
vector_a3da_point* vp = &a->point;
|
||||
count = (int32_t)(vp->end - vp->begin);
|
||||
count = (int32_t)vector_length(*vp);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
a3da_point* p = &vp->begin[sort_index.begin[i]];
|
||||
@@ -2918,7 +2917,7 @@ static void key_val_write_a3da_key(stream* s, char* buf,
|
||||
memcpy(buf + offset, ".key", 5);
|
||||
offset += 4;
|
||||
|
||||
int32_t length = (int32_t)(value->keys.end - value->keys.begin);
|
||||
int32_t length = (int32_t)vector_length(value->keys);
|
||||
|
||||
vector_int32_t sort_index = vector_empty(int32_t);
|
||||
key_val_get_lexicographic_order(&sort_index, length);
|
||||
@@ -3073,7 +3072,7 @@ static void key_val_write_a3da_key_raw_data(stream* s, char* buf,
|
||||
size_t offset, a3da_key* value) {
|
||||
key_val_write_float_t(s, buf, offset, ".max", 5, value->max);
|
||||
|
||||
int32_t length = (int32_t)(value->keys.end - value->keys.begin);
|
||||
int32_t length = (int32_t)vector_length(value->keys);
|
||||
if (value->raw_data_binary) {
|
||||
key_val_write_int32_t(s, buf, offset, ".raw_data.value_list_offset", 6,
|
||||
value->raw_data_value_list_offset);
|
||||
@@ -3365,13 +3364,13 @@ static void a3dc_read_a3da_key_f16(void* data, size_t length, a3da_key* value, a
|
||||
|
||||
static void a3dc_write_a3da_key_f16(stream* s, a3da_key* value, a3da_compress_f16 f16) {
|
||||
if (value->raw_data) {
|
||||
if ((int32_t)(value->keys.end - value->keys.begin) < 1) {
|
||||
if (vector_length(value->keys) < 1) {
|
||||
value->raw_data = false;
|
||||
value->raw_data_binary = false;
|
||||
value->type = A3DA_KEY_NONE;
|
||||
vector_kft3_free(&value->keys, 0);
|
||||
}
|
||||
else if ((int32_t)(value->keys.end - value->keys.begin) == 1) {
|
||||
else if (vector_length(value->keys) == 1) {
|
||||
value->raw_data = false;
|
||||
value->raw_data_binary = false;
|
||||
value->type = A3DA_KEY_STATIC;
|
||||
@@ -3386,7 +3385,7 @@ static void a3dc_write_a3da_key_f16(stream* s, a3da_key* value, a3da_compress_f1
|
||||
|
||||
value->raw_data_value_list_offset = (int32_t)io_get_position(s);
|
||||
|
||||
int32_t len = (int32_t)(value->keys.end - value->keys.begin);
|
||||
int32_t len = (int32_t)vector_length(value->keys);
|
||||
value->raw_data_value_list_size = len * 4;
|
||||
for (int32_t i = 0; i < len; i++) {
|
||||
kft3* k = &value->keys.begin[i];
|
||||
@@ -3412,7 +3411,7 @@ static void a3dc_write_a3da_key_f16(stream* s, a3da_key* value, a3da_compress_f1
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t len = (uint32_t)(value->keys.end - value->keys.begin);
|
||||
uint32_t len = (uint32_t)vector_length(value->keys);
|
||||
|
||||
a3dc_key_header head;
|
||||
memset(&head, 0, sizeof(a3dc_key_header));
|
||||
|
||||
@@ -186,7 +186,7 @@ static void auth_3d_database_load_categories(auth_3d_database* auth_3d_db,
|
||||
auth_3d_database_file* auth_3d_db_file, bool mdata) {
|
||||
vector_auth_3d_database_category* category = &auth_3d_db->category;
|
||||
vector_string* category_file = &auth_3d_db_file->category;
|
||||
int32_t count_file = (int32_t)(category_file->end - category_file->begin);
|
||||
int32_t count_file = (int32_t)vector_length(*category_file);
|
||||
|
||||
if (!mdata)
|
||||
vector_auth_3d_database_category_reserve(category, count_file);
|
||||
@@ -214,8 +214,8 @@ static void auth_3d_database_load_categories(auth_3d_database* auth_3d_db,
|
||||
|
||||
static void auth_3d_database_load_uids(auth_3d_database* auth_3d_db,
|
||||
auth_3d_database_file* auth_3d_db_file, bool mdata) {
|
||||
size_t uid_file_count = auth_3d_db_file->uid.end - auth_3d_db_file->uid.begin;
|
||||
size_t uid_count = auth_3d_db->uid.end - auth_3d_db->uid.begin;
|
||||
size_t uid_file_count = vector_length(auth_3d_db_file->uid);
|
||||
size_t uid_count = vector_length(auth_3d_db->uid);
|
||||
|
||||
bool reserve = true;
|
||||
size_t uid_reserve = 0;
|
||||
@@ -404,13 +404,13 @@ static void auth_3d_database_file_write_text(auth_3d_database_file* auth_3d_db_f
|
||||
io_write(&s, "# date time was eliminated.\n", 28);
|
||||
|
||||
vector_int32_t sort_index = vector_empty(int32_t);
|
||||
if (auth_3d_db_file->category.end - auth_3d_db_file->category.begin) {
|
||||
if (vector_length(auth_3d_db_file->category) > 0) {
|
||||
len = 8;
|
||||
memcpy(buf, "category", 8);
|
||||
off = len;
|
||||
|
||||
vector_string* vc = &auth_3d_db_file->category;
|
||||
count = (int32_t)(vc->end - vc->begin);
|
||||
count = (int32_t)vector_length(*vc);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
string* c = &vc->begin[sort_index.begin[i]];
|
||||
@@ -425,14 +425,14 @@ static void auth_3d_database_file_write_text(auth_3d_database_file* auth_3d_db_f
|
||||
key_val_write_int32_t(&s, buf, off, ".length", 8, count);
|
||||
}
|
||||
|
||||
if (auth_3d_db_file->uid.end - auth_3d_db_file->uid.begin) {
|
||||
if (vector_length(auth_3d_db_file->uid) > 0) {
|
||||
len = 3;
|
||||
memcpy(buf, "uid", 3);
|
||||
off = len;
|
||||
|
||||
int32_t uid_max = -1;
|
||||
vector_auth_3d_database_uid_file* vu = &auth_3d_db_file->uid;
|
||||
count = (int32_t)(vu->end - vu->begin);
|
||||
count = (int32_t)vector_length(*vu);
|
||||
key_val_get_lexicographic_order(&sort_index, count);
|
||||
for (int32_t i = 0; i < count; i++) {
|
||||
auth_3d_database_uid_file* u = &vu->begin[sort_index.begin[i]];
|
||||
|
||||
+26
-26
@@ -604,7 +604,7 @@ static void bone_database_classic_write_inner(bone_database* bone_data, stream*
|
||||
io_write_int32_t(s, 0);
|
||||
io_write_int32_t(s, 0);
|
||||
|
||||
uint32_t skeleton_count = (uint32_t)(bone_data->skeleton.end - bone_data->skeleton.begin);
|
||||
uint32_t skeleton_count = (uint32_t)vector_length(bone_data->skeleton);
|
||||
ssize_t skeleton_offsets_offset = io_get_position(s);
|
||||
io_write(s, 0, skeleton_count * 0x04ULL);
|
||||
|
||||
@@ -626,10 +626,10 @@ static void bone_database_classic_write_inner(bone_database* bone_data, stream*
|
||||
for (uint32_t i = 0; i < skeleton_count; i++) {
|
||||
bone_database_skeleton* skel = &bone_data->skeleton.begin[i];
|
||||
|
||||
uint32_t bone_count = (uint32_t)(skel->bone.end - skel->bone.begin);
|
||||
uint32_t position_count = (uint32_t)(skel->position.end - skel->position.begin);
|
||||
uint32_t object_bone_count = (uint32_t)(skel->object_bone.end - skel->object_bone.begin);
|
||||
uint32_t motion_bone_count = (uint32_t)(skel->motion_bone.end - skel->motion_bone.begin);
|
||||
uint32_t bone_count = (uint32_t)vector_length(skel->bone);
|
||||
uint32_t position_count = (uint32_t)vector_length(skel->position);
|
||||
uint32_t object_bone_count = (uint32_t)vector_length(skel->object_bone);
|
||||
uint32_t motion_bone_count = (uint32_t)vector_length(skel->motion_bone);
|
||||
|
||||
vector_string_reserve(&strings, bone_count);
|
||||
vector_ssize_t_reserve(&string_offsets, bone_count);
|
||||
@@ -932,7 +932,7 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream* s
|
||||
|
||||
bool is_x = bone_data->is_x;
|
||||
|
||||
uint32_t skeleton_count = (uint32_t)(bone_data->skeleton.end - bone_data->skeleton.begin);
|
||||
uint32_t skeleton_count = (uint32_t)vector_length(bone_data->skeleton);
|
||||
|
||||
if (!is_x) {
|
||||
uint32_t pos;
|
||||
@@ -951,10 +951,10 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream* s
|
||||
for (uint32_t i = 0; i < skeleton_count; i++) {
|
||||
bone_database_skeleton* skel = &bone_data->skeleton.begin[i];
|
||||
|
||||
uint32_t bone_count = (uint32_t)(skel->bone.end - skel->bone.begin);
|
||||
uint32_t position_count = (uint32_t)(skel->position.end - skel->position.begin);
|
||||
uint32_t object_bone_count = (uint32_t)(skel->object_bone.end - skel->object_bone.begin);
|
||||
uint32_t motion_bone_count = (uint32_t)(skel->motion_bone.end - skel->motion_bone.begin);
|
||||
uint32_t bone_count = (uint32_t)vector_length(skel->bone);
|
||||
uint32_t position_count = (uint32_t)vector_length(skel->position);
|
||||
uint32_t object_bone_count = (uint32_t)vector_length(skel->object_bone);
|
||||
uint32_t motion_bone_count = (uint32_t)vector_length(skel->motion_bone);
|
||||
|
||||
ee = (enrs_entry){ off, 1, 56, 1, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 14, ENRS_DWORD });
|
||||
@@ -1044,10 +1044,10 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream* s
|
||||
for (uint32_t i = 0; i < skeleton_count; i++) {
|
||||
bone_database_skeleton* skel = &bone_data->skeleton.begin[i];
|
||||
|
||||
uint32_t bone_count = (uint32_t)(skel->bone.end - skel->bone.begin);
|
||||
uint32_t position_count = (uint32_t)(skel->position.end - skel->position.begin);
|
||||
uint32_t object_bone_count = (uint32_t)(skel->object_bone.end - skel->object_bone.begin);
|
||||
uint32_t motion_bone_count = (uint32_t)(skel->motion_bone.end - skel->motion_bone.begin);
|
||||
uint32_t bone_count = (uint32_t)vector_length(skel->bone);
|
||||
uint32_t position_count = (uint32_t)vector_length(skel->position);
|
||||
uint32_t object_bone_count = (uint32_t)vector_length(skel->object_bone);
|
||||
uint32_t motion_bone_count = (uint32_t)vector_length(skel->motion_bone);
|
||||
|
||||
bone_count++;
|
||||
off += 8;
|
||||
@@ -1140,10 +1140,10 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream* s
|
||||
for (uint32_t i = 0; i < skeleton_count; i++) {
|
||||
bone_database_skeleton* skel = &bone_data->skeleton.begin[i];
|
||||
|
||||
uint32_t bone_count = (uint32_t)(skel->bone.end - skel->bone.begin);
|
||||
uint32_t position_count = (uint32_t)(skel->position.end - skel->position.begin);
|
||||
uint32_t object_bone_count = (uint32_t)(skel->object_bone.end - skel->object_bone.begin);
|
||||
uint32_t motion_bone_count = (uint32_t)(skel->motion_bone.end - skel->motion_bone.begin);
|
||||
uint32_t bone_count = (uint32_t)vector_length(skel->bone);
|
||||
uint32_t position_count = (uint32_t)vector_length(skel->position);
|
||||
uint32_t object_bone_count = (uint32_t)vector_length(skel->object_bone);
|
||||
uint32_t motion_bone_count = (uint32_t)vector_length(skel->motion_bone);
|
||||
|
||||
skh[i].offset = io_get_position(&s_bone);
|
||||
io_write_offset_f2_pof_add(&s_bone, 0, 0x40, &pof);
|
||||
@@ -1205,10 +1205,10 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream* s
|
||||
for (uint32_t i = 0; i < skeleton_count; i++) {
|
||||
bone_database_skeleton* skel = &bone_data->skeleton.begin[i];
|
||||
|
||||
uint32_t bone_count = (uint32_t)(skel->bone.end - skel->bone.begin);
|
||||
uint32_t position_count = (uint32_t)(skel->position.end - skel->position.begin);
|
||||
uint32_t object_bone_count = (uint32_t)(skel->object_bone.end - skel->object_bone.begin);
|
||||
uint32_t motion_bone_count = (uint32_t)(skel->motion_bone.end - skel->motion_bone.begin);
|
||||
uint32_t bone_count = (uint32_t)vector_length(skel->bone);
|
||||
uint32_t position_count = (uint32_t)vector_length(skel->position);
|
||||
uint32_t object_bone_count = (uint32_t)vector_length(skel->object_bone);
|
||||
uint32_t motion_bone_count = (uint32_t)vector_length(skel->motion_bone);
|
||||
|
||||
|
||||
skh[i].bones_offset = io_get_position(&s_bone);
|
||||
@@ -1299,10 +1299,10 @@ static void bone_database_modern_write_inner(bone_database* bone_data, stream* s
|
||||
for (uint32_t i = 0; i < skeleton_count; i++) {
|
||||
bone_database_skeleton* skel = &bone_data->skeleton.begin[i];
|
||||
|
||||
uint32_t bone_count = (uint32_t)(skel->bone.end - skel->bone.begin);
|
||||
uint32_t position_count = (uint32_t)(skel->position.end - skel->position.begin);
|
||||
uint32_t object_bone_count = (uint32_t)(skel->object_bone.end - skel->object_bone.begin);
|
||||
uint32_t motion_bone_count = (uint32_t)(skel->motion_bone.end - skel->motion_bone.begin);
|
||||
uint32_t bone_count = (uint32_t)vector_length(skel->bone);
|
||||
uint32_t position_count = (uint32_t)vector_length(skel->position);
|
||||
uint32_t object_bone_count = (uint32_t)vector_length(skel->object_bone);
|
||||
uint32_t motion_bone_count = (uint32_t)vector_length(skel->motion_bone);
|
||||
|
||||
io_position_push(&s_bone, skh[i].offset, SEEK_SET);
|
||||
if (!is_x) {
|
||||
|
||||
@@ -150,7 +150,7 @@ void motion_database_merge_mdata(motion_database* mot_db,
|
||||
vector_string* bone_name = &mot_db->bone_name;
|
||||
vector_string* base_bone_name = &base_mot_db->bone_name;
|
||||
|
||||
int32_t bone_count = (int32_t)(base_bone_name->end - base_bone_name->begin);
|
||||
int32_t bone_count = (int32_t)vector_length(*base_bone_name);
|
||||
vector_string_reserve(bone_name, bone_count);
|
||||
bone_name->end += bone_count;
|
||||
|
||||
@@ -161,7 +161,7 @@ void motion_database_merge_mdata(motion_database* mot_db,
|
||||
vector_motion_set_info* base_motion_set = &base_mot_db->motion_set;
|
||||
vector_motion_set_info* mdata_motion_set = &mdata_mot_db->motion_set;
|
||||
|
||||
int32_t count = (int32_t)(base_motion_set->end - base_motion_set->begin);
|
||||
int32_t count = (int32_t)vector_length(*base_motion_set);
|
||||
vector_motion_set_info_reserve(motion_set, count);
|
||||
motion_set->end += count;
|
||||
|
||||
@@ -171,9 +171,9 @@ void motion_database_merge_mdata(motion_database* mot_db,
|
||||
|
||||
set_info->id = b_set_info->id;
|
||||
string_copy(&b_set_info->name, &set_info->name);
|
||||
set_info->name_hash = hash_fnv1a64m(string_data(&set_info->name), set_info->name.length);
|
||||
set_info->name_hash = hash_fnv1a64m(string_data(&set_info->name), set_info->name.length, false);
|
||||
|
||||
int32_t info_count = (int32_t)(b_set_info->motion.end - b_set_info->motion.begin);
|
||||
int32_t info_count = (int32_t)vector_length(b_set_info->motion);
|
||||
vector_motion_info_reserve(&set_info->motion, info_count);
|
||||
set_info->motion.end += info_count;
|
||||
|
||||
@@ -183,11 +183,11 @@ void motion_database_merge_mdata(motion_database* mot_db,
|
||||
|
||||
info->id = b_info->id;
|
||||
string_copy(&b_info->name, &info->name);
|
||||
info->name_hash = hash_fnv1a64m(string_data(&info->name), info->name.length);
|
||||
info->name_hash = hash_fnv1a64m(string_data(&info->name), info->name.length, false);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mdata_count = (int32_t)(mdata_motion_set->end - mdata_motion_set->begin);
|
||||
int32_t mdata_count = (int32_t)vector_length(*mdata_motion_set);
|
||||
for (int32_t i = 0; i < mdata_count; i++) {
|
||||
motion_set_info* m_set_info = &mdata_motion_set->begin[i];
|
||||
|
||||
@@ -204,10 +204,10 @@ void motion_database_merge_mdata(motion_database* mot_db,
|
||||
|
||||
set_info->id = m_set_info->id;
|
||||
string_replace(&m_set_info->name, &set_info->name);
|
||||
set_info->name_hash = hash_fnv1a64m(string_data(&set_info->name), set_info->name.length);
|
||||
set_info->name_hash = hash_fnv1a64m(string_data(&set_info->name), set_info->name.length, false);
|
||||
|
||||
vector_motion_info_clear(&set_info->motion, motion_info_free);
|
||||
int32_t info_count = (int32_t)(m_set_info->motion.end - m_set_info->motion.begin);
|
||||
int32_t info_count = (int32_t)vector_length(m_set_info->motion);
|
||||
vector_motion_info_reserve(&set_info->motion, info_count);
|
||||
set_info->motion.end += info_count;
|
||||
|
||||
@@ -217,7 +217,7 @@ void motion_database_merge_mdata(motion_database* mot_db,
|
||||
|
||||
info->id = m_info->id;
|
||||
string_copy(&m_info->name, &info->name);
|
||||
info->name_hash = hash_fnv1a64m(string_data(&info->name), info->name.length);
|
||||
info->name_hash = hash_fnv1a64m(string_data(&info->name), info->name.length, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ motion_set_info* motion_database_get_motion_set_by_name(motion_database* mot_db,
|
||||
if (!mot_db || !name)
|
||||
return 0;
|
||||
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
|
||||
for (motion_set_info* i = mot_db->motion_set.begin; i != mot_db->motion_set.end; i++)
|
||||
if (name_hash == i->name_hash)
|
||||
@@ -258,7 +258,7 @@ uint32_t motion_database_get_motion_set_id(motion_database* mot_db, char* name)
|
||||
if (!mot_db || !name)
|
||||
return -1;
|
||||
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
|
||||
for (motion_set_info* i = mot_db->motion_set.begin; i != mot_db->motion_set.end; i++)
|
||||
if (name_hash == i->name_hash)
|
||||
@@ -291,7 +291,7 @@ motion_info* motion_database_get_motion_by_name(motion_database* mot_db, char* n
|
||||
if (!mot_db || !name)
|
||||
return 0;
|
||||
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
|
||||
for (motion_set_info* i = mot_db->motion_set.begin; i != mot_db->motion_set.end; i++)
|
||||
for (motion_info* j = i->motion.begin; j != i->motion.end; j++)
|
||||
@@ -304,7 +304,7 @@ uint32_t motion_database_get_motion_id(motion_database* mot_db, char* name) {
|
||||
if (!mot_db || !name)
|
||||
return -1;
|
||||
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
|
||||
for (motion_set_info* i = mot_db->motion_set.begin; i != mot_db->motion_set.end; i++)
|
||||
for (motion_info* j = i->motion.begin; j != i->motion.end; j++)
|
||||
@@ -413,8 +413,8 @@ static void motion_database_write_inner(motion_database* mot_db, stream* s) {
|
||||
vector_string* bone_name = &mot_db->bone_name;
|
||||
vector_motion_set_info* motion_set = &mot_db->motion_set;
|
||||
|
||||
ssize_t bone_name_count = bone_name->end - bone_name->begin;
|
||||
ssize_t motion_set_count = motion_set->end - motion_set->begin;
|
||||
ssize_t bone_name_count = vector_length(*bone_name);
|
||||
ssize_t motion_set_count = vector_length(*motion_set);
|
||||
|
||||
ssize_t motion_sets_offset = io_get_position(s);
|
||||
io_write(s, 0, 0x10 * motion_set_count + 0x10);
|
||||
@@ -439,7 +439,7 @@ static void motion_database_write_inner(motion_database* mot_db, stream* s) {
|
||||
ssize_t motion_names_offset = io_get_position(s);
|
||||
size = 0;
|
||||
for (motion_set_info* i = motion_set->begin; i != motion_set->end; i++)
|
||||
size += 0x04 * (i->motion.end - i->motion.begin);
|
||||
size += 0x04 * vector_length(i->motion);
|
||||
io_write(s, 0, size);
|
||||
io_align_write(s, 0x20);
|
||||
|
||||
@@ -492,11 +492,11 @@ static void motion_database_write_inner(motion_database* mot_db, stream* s) {
|
||||
for (motion_set_info* i = motion_set->begin; i != motion_set->end; i++) {
|
||||
io_write_uint32_t(s, (uint32_t)motion_set_name_offset);
|
||||
io_write_uint32_t(s, (uint32_t)motion_names_offset);
|
||||
io_write_uint32_t(s, (uint32_t)(i->motion.end - i->motion.begin));
|
||||
io_write_uint32_t(s, (uint32_t)vector_length(i->motion));
|
||||
io_write_uint32_t(s, (uint32_t)motion_ids_offset);
|
||||
motion_set_name_offset += i->name.length + 1;
|
||||
motion_names_offset += 0x04 * (i->motion.end - i->motion.begin);
|
||||
motion_ids_offset += 0x04 * (i->motion.end - i->motion.begin);
|
||||
motion_names_offset += 0x04 * vector_length(i->motion);
|
||||
motion_ids_offset += 0x04 * vector_length(i->motion);
|
||||
}
|
||||
io_write(s, 0, 0x10);
|
||||
io_position_pop(s);
|
||||
|
||||
@@ -222,7 +222,7 @@ void object_database_merge_mdata(object_database* obj_db,
|
||||
vector_string* bone_name = &obj_db->bone_name;
|
||||
vector_string* base_bone_name = &base_obj_db->bone_name;
|
||||
|
||||
int32_t bone_count = (int32_t)(base_bone_name->end - base_bone_name->begin);
|
||||
int32_t bone_count = (int32_t)vector_length(*base_bone_name);
|
||||
vector_string_reserve(bone_name, bone_count);
|
||||
bone_name->end += bone_count;
|
||||
|
||||
@@ -233,7 +233,7 @@ void object_database_merge_mdata(object_database* obj_db,
|
||||
vector_object_set_info* base_object_set = &base_obj_db->object_set;
|
||||
vector_object_set_info* mdata_object_set = &mdata_obj_db->object_set;
|
||||
|
||||
int32_t count = (int32_t)(base_object_set->end - base_object_set->begin);
|
||||
int32_t count = (int32_t)vector_length(*base_object_set);
|
||||
vector_object_set_info_reserve(object_set, count);
|
||||
object_set->end += count;
|
||||
|
||||
@@ -242,13 +242,13 @@ void object_database_merge_mdata(object_database* obj_db,
|
||||
object_set_info* set_info = &object_set->begin[i];
|
||||
|
||||
string_copy(&b_set_info->name, &set_info->name);
|
||||
set_info->name_hash = hash_fnv1a64m(string_data(&set_info->name), set_info->name.length);
|
||||
set_info->name_hash = hash_fnv1a64m(string_data(&set_info->name), set_info->name.length, false);
|
||||
set_info->id = b_set_info->id;
|
||||
string_copy(&b_set_info->object_file_name, &set_info->object_file_name);
|
||||
string_copy(&b_set_info->texture_file_name, &set_info->texture_file_name);
|
||||
string_copy(&b_set_info->archive_file_name, &set_info->archive_file_name);
|
||||
|
||||
int32_t info_count = (int32_t)(b_set_info->object.end - b_set_info->object.begin);
|
||||
int32_t info_count = (int32_t)vector_length(b_set_info->object);
|
||||
vector_object_info_data_reserve(&set_info->object, info_count);
|
||||
set_info->object.end += info_count;
|
||||
|
||||
@@ -258,14 +258,14 @@ void object_database_merge_mdata(object_database* obj_db,
|
||||
|
||||
info->id = b_info->id;
|
||||
string_copy(&b_info->name, &info->name);
|
||||
info->name_hash_fnv1a64m = hash_fnv1a64m(string_data(&info->name), info->name.length);
|
||||
info->name_hash_fnv1a64m_upper = hash_fnv1a64m_upper(string_data(&info->name), info->name.length);
|
||||
info->name_hash_fnv1a64m = hash_fnv1a64m(string_data(&info->name), info->name.length, false);
|
||||
info->name_hash_fnv1a64m_upper = hash_fnv1a64m(string_data(&info->name), info->name.length, true);
|
||||
info->name_hash_murmurhash = hash_murmurhash(string_data(&info->name),
|
||||
info->name.length, 0, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mdata_count = (int32_t)(mdata_object_set->end - mdata_object_set->begin);
|
||||
int32_t mdata_count = (int32_t)vector_length(*mdata_object_set);
|
||||
for (int32_t i = 0; i < mdata_count; i++) {
|
||||
object_set_info* m_set_info = &mdata_object_set->begin[i];
|
||||
|
||||
@@ -281,14 +281,14 @@ void object_database_merge_mdata(object_database* obj_db,
|
||||
set_info = vector_object_set_info_reserve_back(object_set);
|
||||
|
||||
string_replace(&m_set_info->name, &set_info->name);
|
||||
set_info->name_hash = hash_fnv1a64m(string_data(&set_info->name), set_info->name.length);
|
||||
set_info->name_hash = hash_fnv1a64m(string_data(&set_info->name), set_info->name.length, false);
|
||||
set_info->id = m_set_info->id;
|
||||
string_replace(&m_set_info->object_file_name, &set_info->object_file_name);
|
||||
string_replace(&m_set_info->texture_file_name, &set_info->texture_file_name);
|
||||
string_replace(&m_set_info->archive_file_name, &set_info->archive_file_name);
|
||||
|
||||
vector_object_info_data_clear(&set_info->object, object_info_data_free);
|
||||
int32_t info_count = (int32_t)(m_set_info->object.end - m_set_info->object.begin);
|
||||
int32_t info_count = (int32_t)vector_length(m_set_info->object);
|
||||
vector_object_info_data_reserve(&set_info->object, info_count);
|
||||
set_info->object.end += info_count;
|
||||
|
||||
@@ -298,8 +298,8 @@ void object_database_merge_mdata(object_database* obj_db,
|
||||
|
||||
info->id = m_info->id;
|
||||
string_copy(&m_info->name, &info->name);
|
||||
info->name_hash_fnv1a64m = hash_fnv1a64m(string_data(&info->name), info->name.length);
|
||||
info->name_hash_fnv1a64m_upper = hash_fnv1a64m_upper(string_data(&info->name), info->name.length);
|
||||
info->name_hash_fnv1a64m = hash_fnv1a64m(string_data(&info->name), info->name.length, false);
|
||||
info->name_hash_fnv1a64m_upper = hash_fnv1a64m(string_data(&info->name), info->name.length, true);
|
||||
info->name_hash_murmurhash = hash_murmurhash(string_data(&info->name),
|
||||
info->name.length, 0, false, false);
|
||||
}
|
||||
@@ -324,7 +324,7 @@ bool object_database_get_object_set_info(object_database* obj_db,
|
||||
if (!obj_db || !name)
|
||||
return false;
|
||||
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
|
||||
for (object_set_info* i = obj_db->object_set.begin; i != obj_db->object_set.end; i++)
|
||||
if (name_hash == i->name_hash) {
|
||||
@@ -360,7 +360,7 @@ bool object_database_get_object_info_data(object_database* obj_db,
|
||||
if (!obj_db || !name)
|
||||
return false;
|
||||
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
|
||||
for (object_set_info* i = obj_db->object_set.begin; i != obj_db->object_set.end; i++)
|
||||
for (object_info_data* j = i->object.begin; j != i->object.end; j++)
|
||||
@@ -429,19 +429,31 @@ object_info object_database_get_object_info(object_database* obj_db, char* name)
|
||||
return object_info_null;
|
||||
|
||||
size_t name_len = utf8_length(name);
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
if (!str_utils_compare_length(name, name_len, "NULL", 5))
|
||||
return object_info_null;
|
||||
|
||||
for (object_set_info* i = obj_db->object_set.begin; i != obj_db->object_set.end; i++) {
|
||||
for (object_set_info* i = obj_db->object_set.begin; i != obj_db->object_set.end; i++)
|
||||
for (object_info_data* j = i->object.begin; j != i->object.end; j++)
|
||||
if (name_hash == j->name_hash_fnv1a64m)
|
||||
return (object_info) { j->id, i->id };
|
||||
}
|
||||
|
||||
return object_info_null;
|
||||
}
|
||||
|
||||
char* object_database_get_object_name(object_database* obj_db, object_info obj_info) {
|
||||
if (!obj_db || (obj_info.id == -1 && obj_info.set_id == -1))
|
||||
return 0;
|
||||
|
||||
for (object_set_info* i = obj_db->object_set.begin; i != obj_db->object_set.end; i++)
|
||||
if (obj_info.set_id == i->id)
|
||||
for (object_info_data* j = i->object.begin; j != i->object.end; j++)
|
||||
if (obj_info.id == j->id)
|
||||
return string_data(&j->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void object_database_free(object_database* obj_db) {
|
||||
vector_object_set_info_free(&obj_db->object_set, object_set_info_free);
|
||||
}
|
||||
@@ -528,7 +540,7 @@ static void object_database_classic_write_inner(object_database* obj_db, stream*
|
||||
io_write_uint32_t(s, 0x90669066);
|
||||
io_align_write(s, 0x20);
|
||||
|
||||
uint32_t object_set_count = (uint32_t)(obj_db->object_set.end - obj_db->object_set.begin);
|
||||
uint32_t object_set_count = (uint32_t)vector_length(obj_db->object_set);
|
||||
|
||||
vector_ssize_t string_offsets = vector_empty(ssize_t);
|
||||
vector_ssize_t_reserve(&string_offsets, object_set_count * 4ULL);
|
||||
@@ -558,7 +570,7 @@ static void object_database_classic_write_inner(object_database* obj_db, stream*
|
||||
io_write(s, 0, 0x10);
|
||||
if (max_object_set_id < i->id)
|
||||
max_object_set_id = i->id;
|
||||
object_count += (uint32_t)(i->object.end - i->object.begin);
|
||||
object_count += (uint32_t)vector_length(i->object);
|
||||
}
|
||||
|
||||
vector_ssize_t_clear(&string_offsets, 0);
|
||||
@@ -706,11 +718,11 @@ static void object_database_modern_write_inner(object_database* obj_db, stream*
|
||||
|
||||
bool is_x = obj_db->is_x;
|
||||
|
||||
uint32_t object_set_count = (uint32_t)(obj_db->object_set.end - obj_db->object_set.begin);
|
||||
uint32_t object_set_count = (uint32_t)vector_length(obj_db->object_set);
|
||||
|
||||
uint32_t object_count = 0;
|
||||
for (object_set_info* i = obj_db->object_set.begin; i != obj_db->object_set.end; i++)
|
||||
object_count += (uint32_t)(i->object.end - i->object.begin);
|
||||
object_count += (uint32_t)vector_length(i->object);
|
||||
|
||||
if (!is_x) {
|
||||
ee = (enrs_entry){ 0, 1, 1, 1, vector_empty(enrs_sub_entry) };
|
||||
@@ -796,7 +808,7 @@ static void object_database_modern_write_inner(object_database* obj_db, stream*
|
||||
}
|
||||
}
|
||||
|
||||
vector_ssize_t_reserve(&string_offsets, strings.end - strings.begin);
|
||||
vector_ssize_t_reserve(&string_offsets, vector_length(strings));
|
||||
|
||||
for (string* i = strings.begin; i != strings.end; i++) {
|
||||
ssize_t off = io_get_position(&s_mosi);
|
||||
|
||||
@@ -74,6 +74,7 @@ extern bool object_database_get_object_info_data_by_fnv1a64m_hash_upper(object_d
|
||||
extern bool object_database_get_object_info_data_by_murmurhash(object_database* obj_db,
|
||||
uint32_t hash, object_info_data** info);
|
||||
extern object_info object_database_get_object_info(object_database* obj_db, char* name);
|
||||
extern char* object_database_get_object_name(object_database* obj_db, object_info obj_info);
|
||||
extern void object_database_free(object_database* obj_db);
|
||||
|
||||
extern void object_info_data_free(object_info_data* info);
|
||||
|
||||
@@ -216,7 +216,7 @@ void stage_database_merge_mdata(stage_database* stage_data,
|
||||
vector_stage_info* base_stage = &base_stage_data->stage;
|
||||
vector_stage_info* mdata_stage = &mdata_stage_data->stage;
|
||||
|
||||
int32_t count = (int32_t)(base_stage->end - base_stage->begin);
|
||||
int32_t count = (int32_t)vector_length(*base_stage);
|
||||
vector_stage_info_reserve(stage, count);
|
||||
stage->end += count;
|
||||
|
||||
@@ -239,7 +239,7 @@ void stage_database_merge_mdata(stage_database* stage_data,
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mdata_count = (int32_t)(mdata_stage->end - mdata_stage->begin);
|
||||
int32_t mdata_count = (int32_t)vector_length(*mdata_stage);
|
||||
mdata_count -= count;
|
||||
if (mdata_count > 0)
|
||||
vector_stage_info_reserve(stage, mdata_count);
|
||||
|
||||
@@ -219,7 +219,7 @@ void texture_database_merge_mdata(texture_database* tex_db,
|
||||
vector_texture_info* base_texture = &base_tex_db->texture;
|
||||
vector_texture_info* mdata_texture = &mdata_tex_db->texture;
|
||||
|
||||
int32_t count = (int32_t)(base_texture->end - base_texture->begin);
|
||||
int32_t count = (int32_t)vector_length(*base_texture);
|
||||
vector_texture_info_reserve(texture, count);
|
||||
texture->end += count;
|
||||
|
||||
@@ -229,10 +229,10 @@ void texture_database_merge_mdata(texture_database* tex_db,
|
||||
|
||||
info->id = b_info->id;
|
||||
string_copy(&b_info->name, &info->name);
|
||||
info->name_hash = hash_fnv1a64m(string_data(&info->name), info->name.length);
|
||||
info->name_hash = hash_fnv1a64m(string_data(&info->name), info->name.length, false);
|
||||
}
|
||||
|
||||
int32_t mdata_count = (int32_t)(mdata_texture->end - mdata_texture->begin);
|
||||
int32_t mdata_count = (int32_t)vector_length(*mdata_texture);
|
||||
for (int32_t i = 0; i < mdata_count; i++) {
|
||||
texture_info* m_info = &mdata_texture->begin[i];
|
||||
|
||||
@@ -248,7 +248,7 @@ void texture_database_merge_mdata(texture_database* tex_db,
|
||||
|
||||
info->id = m_info->id;
|
||||
string_replace(&m_info->name, &info->name);
|
||||
info->name_hash = hash_fnv1a64m(string_data(&info->name), info->name.length);
|
||||
info->name_hash = hash_fnv1a64m(string_data(&info->name), info->name.length, false);
|
||||
}
|
||||
|
||||
tex_db->ready = true;
|
||||
@@ -266,7 +266,7 @@ uint32_t texture_database_get_texture_id(texture_database* tex_db, char* name) {
|
||||
if (!tex_db || !name)
|
||||
return -1;
|
||||
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name));
|
||||
uint64_t name_hash = hash_fnv1a64m(name, utf8_length(name), false);
|
||||
|
||||
for (texture_info* i = tex_db->texture.begin; i != tex_db->texture.end; i++)
|
||||
if (name_hash == i->name_hash)
|
||||
@@ -323,7 +323,7 @@ static void texture_database_classic_write_inner(texture_database* tex_db, strea
|
||||
io_write_uint32_t(s, 0x90669066);
|
||||
io_align_write(s, 0x20);
|
||||
|
||||
uint32_t texture_count = (uint32_t)(tex_db->texture.end - tex_db->texture.begin);
|
||||
uint32_t texture_count = (uint32_t)vector_length(tex_db->texture);
|
||||
|
||||
vector_ssize_t string_offsets = vector_empty(ssize_t);
|
||||
vector_ssize_t_reserve(&string_offsets, texture_count);
|
||||
@@ -395,7 +395,7 @@ static void texture_database_modern_write_inner(texture_database* tex_db, stream
|
||||
|
||||
bool is_x = tex_db->is_x;
|
||||
|
||||
uint32_t texture_count = (uint32_t)(tex_db->texture.end - tex_db->texture.begin);
|
||||
uint32_t texture_count = (uint32_t)vector_length(tex_db->texture);
|
||||
|
||||
if (!is_x) {
|
||||
ee = (enrs_entry){ 0, 2, 8, texture_count, vector_empty(enrs_sub_entry) };
|
||||
@@ -446,7 +446,7 @@ static void texture_database_modern_write_inner(texture_database* tex_db, stream
|
||||
}
|
||||
}
|
||||
|
||||
vector_ssize_t_reserve(&string_offsets, strings.end - strings.begin);
|
||||
vector_ssize_t_reserve(&string_offsets, vector_length(strings));
|
||||
|
||||
for (string* i = strings.begin; i != strings.end; i++) {
|
||||
*vector_ssize_t_reserve_back(&string_offsets) = io_get_position(&s_mtxi);
|
||||
|
||||
+3
-3
@@ -269,7 +269,7 @@ void dds_wread(dds* d, wchar_t* path) {
|
||||
d->format = TXP_DXT1a;
|
||||
vector_ptr_void_push_back(&d->data, &data);
|
||||
}
|
||||
while (d->has_cube_map && (d->data.end - d->data.begin) / d->mipmaps_count < 6);
|
||||
while (d->has_cube_map && vector_length(d->data) / d->mipmaps_count < 6);
|
||||
}
|
||||
End:
|
||||
io_free(&s);
|
||||
@@ -277,7 +277,7 @@ End:
|
||||
}
|
||||
|
||||
void dds_write(dds* d, char* path) {
|
||||
if (!d || !path || d->data.end - d->data.begin < 1)
|
||||
if (!d || !path || vector_length(d->data) < 1)
|
||||
return;
|
||||
|
||||
wchar_t* path_buf = utf8_to_utf16(path);
|
||||
@@ -286,7 +286,7 @@ void dds_write(dds* d, char* path) {
|
||||
}
|
||||
|
||||
void dds_wwrite(dds* d, wchar_t* path) {
|
||||
if (!d || !path || d->data.end - d->data.begin < 1)
|
||||
if (!d || !path || vector_length(d->data) < 1)
|
||||
return;
|
||||
|
||||
wchar_t* path_dds = str_utils_wadd(path, L".dds");
|
||||
|
||||
+1378
-104
File diff suppressed because it is too large
Load Diff
+98
-9
@@ -41,6 +41,8 @@ typedef enum dsc_type {
|
||||
DSC_FT,
|
||||
DSC_PSP,
|
||||
DSC_2ND,
|
||||
DSC_DT,
|
||||
DSC_DT2,
|
||||
DSC_F,
|
||||
DSC_F2,
|
||||
DSC_MGF,
|
||||
@@ -69,8 +71,8 @@ typedef struct dsc_note11 {
|
||||
int32_t wave_count;
|
||||
int32_t distance;
|
||||
int32_t amplitude;
|
||||
int32_t timing;
|
||||
int32_t bar_time;
|
||||
int32_t target_flying_time;
|
||||
int32_t time_signature;
|
||||
} dsc_note11;
|
||||
|
||||
typedef struct dsc_note12 {
|
||||
@@ -83,8 +85,8 @@ typedef struct dsc_note12 {
|
||||
int32_t wave_count;
|
||||
int32_t distance;
|
||||
int32_t amplitude;
|
||||
int32_t timing;
|
||||
int32_t bar_time;
|
||||
int32_t target_flying_time;
|
||||
int32_t time_signature;
|
||||
int32_t target_effect;
|
||||
} dsc_note12;
|
||||
#pragma endregion
|
||||
@@ -262,6 +264,7 @@ typedef enum dsc_target_id_x {
|
||||
#pragma endregion
|
||||
|
||||
typedef struct dsc_data {
|
||||
const char* name;
|
||||
int32_t func;
|
||||
uint32_t data_offset;
|
||||
} dsc_data;
|
||||
@@ -270,15 +273,64 @@ vector(dsc_data)
|
||||
|
||||
typedef struct dsc {
|
||||
dsc_type type;
|
||||
union {
|
||||
uint32_t signature;
|
||||
uint32_t id;
|
||||
};
|
||||
uint32_t signature;
|
||||
uint32_t id;
|
||||
vector_dsc_data data;
|
||||
vector_uint32_t data_buffer;
|
||||
} dsc;
|
||||
|
||||
typedef struct dsc_replace dsc_replace;
|
||||
typedef struct dsc_replace_data dsc_replace_data;
|
||||
|
||||
typedef int32_t(*dsc_get_func_length)(int32_t id);
|
||||
typedef const char*(*dsc_get_func_name)(int32_t id);
|
||||
typedef const void(*dsc_func_convert)(dsc_replace* dr, dsc_replace_data* drd, uint32_t* data);
|
||||
|
||||
struct dsc_replace_data {
|
||||
const char* name;
|
||||
int32_t func_id;
|
||||
int32_t length;
|
||||
dsc_func_convert func;
|
||||
};
|
||||
|
||||
struct dsc_replace {
|
||||
dsc_type src_type;
|
||||
dsc_type dst_type;
|
||||
dsc_replace_data* replace_data;
|
||||
dsc dsc;
|
||||
bool dst_has_perf_id;
|
||||
|
||||
int32_t bpm;
|
||||
int32_t time_signature;
|
||||
int32_t target_flying_time;
|
||||
|
||||
int32_t bar_time_set_func_id;
|
||||
int32_t target_flying_time_func_id;
|
||||
};
|
||||
|
||||
extern const int32_t dsc_ac101_func_count;
|
||||
extern const int32_t dsc_ac110_func_count;
|
||||
extern const int32_t dsc_ac120_func_count;
|
||||
extern const int32_t dsc_ac200_func_count;
|
||||
extern const int32_t dsc_ac210_func_count;
|
||||
extern const int32_t dsc_ac500_func_count;
|
||||
extern const int32_t dsc_ac510_func_count;
|
||||
extern const int32_t dsc_aft101_func_count;
|
||||
extern const int32_t dsc_aft200_func_count;
|
||||
extern const int32_t dsc_aft300_func_count;
|
||||
extern const int32_t dsc_aft310_func_count;
|
||||
extern const int32_t dsc_aft410_func_count;
|
||||
extern const int32_t dsc_aft701_func_count;
|
||||
extern const int32_t dsc_ft_func_count;
|
||||
extern const int32_t dsc_psp_func_count;
|
||||
extern const int32_t dsc_2nd_func_count;
|
||||
extern const int32_t dsc_dt_func_count;
|
||||
extern const int32_t dsc_dt2_func_count;
|
||||
extern const int32_t dsc_f_func_count;
|
||||
extern const int32_t dsc_f2_func_count;
|
||||
extern const int32_t dsc_mgf_func_count;
|
||||
extern const int32_t dsc_x_func_count;
|
||||
extern const int32_t dsc_vrfl_func_count;
|
||||
|
||||
extern int32_t dsc_ac101_get_func_length(int32_t id);
|
||||
extern int32_t dsc_ac110_get_func_length(int32_t id);
|
||||
@@ -296,6 +348,8 @@ extern int32_t dsc_aft701_get_func_length(int32_t id);
|
||||
extern int32_t dsc_ft_get_func_length(int32_t id);
|
||||
extern int32_t dsc_psp_get_func_length(int32_t id);
|
||||
extern int32_t dsc_2nd_get_func_length(int32_t id);
|
||||
extern int32_t dsc_dt_get_func_length(int32_t id);
|
||||
extern int32_t dsc_dt2_get_func_length(int32_t id);
|
||||
extern int32_t dsc_f_get_func_length(int32_t id);
|
||||
extern int32_t dsc_f2_get_func_length(int32_t id);
|
||||
extern int32_t dsc_mgf_get_func_length(int32_t id);
|
||||
@@ -313,14 +367,49 @@ extern int32_t dsc_aft310_get_func_length_old(int32_t id);
|
||||
extern int32_t dsc_aft410_get_func_length_old(int32_t id);
|
||||
extern int32_t dsc_aft701_get_func_length_old(int32_t id);
|
||||
extern int32_t dsc_ft_get_func_length_old(int32_t id);
|
||||
extern int32_t dsc_dt2_get_func_length_old(int32_t id);
|
||||
extern int32_t dsc_f_get_func_length_old(int32_t id);
|
||||
|
||||
extern const char* dsc_ac101_get_func_name(int32_t id);
|
||||
extern const char* dsc_ac110_get_func_name(int32_t id);
|
||||
extern const char* dsc_ac120_get_func_name(int32_t id);
|
||||
extern const char* dsc_ac200_get_func_name(int32_t id);
|
||||
extern const char* dsc_ac210_get_func_name(int32_t id);
|
||||
extern const char* dsc_ac500_get_func_name(int32_t id);
|
||||
extern const char* dsc_ac510_get_func_name(int32_t id);
|
||||
extern const char* dsc_aft101_get_func_name(int32_t id);
|
||||
extern const char* dsc_aft200_get_func_name(int32_t id);
|
||||
extern const char* dsc_aft300_get_func_name(int32_t id);
|
||||
extern const char* dsc_aft310_get_func_name(int32_t id);
|
||||
extern const char* dsc_aft410_get_func_name(int32_t id);
|
||||
extern const char* dsc_aft701_get_func_name(int32_t id);
|
||||
extern const char* dsc_ft_get_func_name(int32_t id);
|
||||
extern const char* dsc_psp_get_func_name(int32_t id);
|
||||
extern const char* dsc_2nd_get_func_name(int32_t id);
|
||||
extern const char* dsc_dt_get_func_name(int32_t id);
|
||||
extern const char* dsc_dt2_get_func_name(int32_t id);
|
||||
extern const char* dsc_f_get_func_name(int32_t id);
|
||||
extern const char* dsc_f2_get_func_name(int32_t id);
|
||||
extern const char* dsc_mgf_get_func_name(int32_t id);
|
||||
extern const char* dsc_x_get_func_name(int32_t id);
|
||||
extern const char* dsc_vrfl_get_func_name(int32_t id);
|
||||
|
||||
extern const int32_t dsc_func_count_array[];
|
||||
extern const dsc_get_func_length dsc_get_func_length_array[];
|
||||
extern const dsc_get_func_length dsc_get_func_length_old_array[];
|
||||
extern const dsc_get_func_name dsc_get_func_name_array[];
|
||||
|
||||
extern void dsc_init(dsc* d);
|
||||
extern void dsc_convert(dsc* d, dsc_type dst_type);
|
||||
extern void dsc_data_buffer_rebuild(dsc* d);
|
||||
extern void* dsc_data_get_func_data(dsc* d, dsc_data* data);
|
||||
extern void dsc_parse(dsc* d, void* data, size_t length, dsc_type type);
|
||||
extern bool dsc_parse(dsc* d, void* data, size_t length, dsc_type type);
|
||||
extern void dsc_unparse(dsc* d, void** data, size_t* length);
|
||||
extern bool dsc_load_file(void* data, char* path, char* file, uint32_t hash);
|
||||
extern void dsc_free(dsc* d);
|
||||
|
||||
extern void dsc_replace_init(dsc_replace* dr, dsc_type src_type,
|
||||
dsc_type dst_type, bool dst_has_perf_id);
|
||||
extern void dsc_replace_free(dsc_replace* dr);
|
||||
|
||||
extern int32_t dsc_calculate_target_flying_time(int32_t bpm, int32_t time_signature);
|
||||
|
||||
@@ -71,7 +71,7 @@ uint32_t enrs_length(vector_enrs_entry* enrs) {
|
||||
o = 0;
|
||||
for (i = enrs->begin; i != enrs->end; i++) {
|
||||
entry = *i;
|
||||
entry.count = (uint32_t)(entry.sub.end - entry.sub.begin);
|
||||
entry.count = (uint32_t)vector_length(entry.sub);
|
||||
if (i != enrs->begin && i[-1].count < 1) {
|
||||
o += (uint32_t)((size_t)i[-1].size * i[-1].repeat_count);
|
||||
if (i->count > 0) {
|
||||
@@ -159,12 +159,12 @@ void enrs_write(stream* s, vector_enrs_entry* enrs) {
|
||||
o = 0;
|
||||
size_t length = enrs_length(enrs);
|
||||
io_write_uint32_t(s, 0);
|
||||
io_write_uint32_t(s, (uint32_t)(enrs->end - enrs->begin));
|
||||
io_write_uint32_t(s, (uint32_t)vector_length(*enrs));
|
||||
io_write_uint32_t(s, 0);
|
||||
io_write_uint32_t(s, 0);
|
||||
for (i = enrs->begin; i != enrs->end; i++) {
|
||||
entry = *i;
|
||||
entry.count = (uint32_t)(entry.sub.end - entry.sub.begin);
|
||||
entry.count = (uint32_t)vector_length(entry.sub);
|
||||
if (i != enrs->begin && i[-1].count < 1) {
|
||||
o += (uint32_t)((size_t)i[-1].size * i[-1].repeat_count);
|
||||
if (i->count > 0) {
|
||||
|
||||
@@ -132,9 +132,9 @@ static void f2_struct_get_length(f2_struct* s, bool shift_x) {
|
||||
uint32_t l;
|
||||
vector_f2_struct ls;
|
||||
|
||||
has_pof = s->pof.end - s->pof.begin > 0 ? true : false;
|
||||
has_enrs = s->enrs.end - s->enrs.begin > 0 ? true : false;
|
||||
has_sub_structs = s->sub_structs.end - s->sub_structs.begin > 0 ? true : false;
|
||||
has_pof = vector_length(s->pof) > 0 ? true : false;
|
||||
has_enrs = vector_length(s->enrs) > 0 ? true : false;
|
||||
has_sub_structs = vector_length(s->sub_structs) > 0 ? true : false;
|
||||
|
||||
s->header.section_size = s->data ? (uint32_t)s->length : 0;
|
||||
|
||||
@@ -202,7 +202,7 @@ static void f2_struct_read_data(stream* s, f2_struct* st, f2_header* h) {
|
||||
}
|
||||
}
|
||||
|
||||
if (st->sub_structs.end - st->sub_structs.begin < 1)
|
||||
if (vector_length(st->sub_structs) < 1)
|
||||
vector_f2_struct_free(&st->sub_structs, f2_struct_free);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -209,7 +209,7 @@ bool farc_load_file(void* data, char* path, char* file, uint32_t hash) {
|
||||
|
||||
farc* f = data;
|
||||
farc_read(f, buf, true, false);
|
||||
bool ret = f->files.end - f->files.begin ? true : false;
|
||||
bool ret = vector_length(f->files) ? true : false;
|
||||
if (!ret)
|
||||
farc_free(f);
|
||||
return ret;
|
||||
@@ -233,14 +233,14 @@ static errno_t farc_get_files(farc* f) {
|
||||
|
||||
vector_wstring files = vector_empty(wstring);
|
||||
path_wget_files(&files, f->directory_path);
|
||||
if (files.end - files.begin < 1) {
|
||||
if (vector_length(files) < 1) {
|
||||
vector_wstring_free(&files, wstring_free);
|
||||
return -1;
|
||||
}
|
||||
|
||||
f->files = vector_empty(farc_file);
|
||||
vector_farc_file_reserve(&f->files, files.end - files.begin);
|
||||
f->files.end = &f->files.begin[files.end - files.begin];
|
||||
vector_farc_file_reserve(&f->files, vector_length(files));
|
||||
f->files.end = &f->files.begin[vector_length(files)];
|
||||
for (farc_file* i = f->files.begin; i != f->files.end; i++) {
|
||||
memset(i, 0, sizeof(farc_file));
|
||||
string_copy_wstring(&files.begin[i - f->files.begin], &i->name);
|
||||
|
||||
+90
-37
@@ -5,60 +5,84 @@
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
static const uint16_t hash_crc16_ccitt_table[] = {
|
||||
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
|
||||
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
|
||||
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
|
||||
0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
|
||||
0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
|
||||
0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
|
||||
0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
|
||||
0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
|
||||
0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
|
||||
0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
|
||||
0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
|
||||
0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
|
||||
0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
|
||||
0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
|
||||
0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
|
||||
0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
|
||||
0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
|
||||
0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
|
||||
0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
|
||||
0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
|
||||
0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
|
||||
0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
|
||||
0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
|
||||
0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
|
||||
0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
|
||||
0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
|
||||
0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
|
||||
0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
|
||||
0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
|
||||
0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
|
||||
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
|
||||
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0,
|
||||
};
|
||||
|
||||
const uint64_t hash_fnv1a64m_empty = 0xCBF29CE44FD0BFC1;
|
||||
const uint32_t hash_murmurhash_empty = 0x0CAD3078;
|
||||
const uint32_t hash_crc16_ccitt_empty = 0xFFFF;
|
||||
|
||||
inline uint64_t hash_fnv1a64m(uint8_t* data, size_t length) { // 0x1403B04D0 in SBZV_7.10; FNV 1a 64-bit Modified
|
||||
// FNV 1a 64-bit Modified
|
||||
// 0x1403B04D0 in SBZV_7.10
|
||||
inline uint64_t hash_fnv1a64m(uint8_t* data, size_t length, bool make_upper) {
|
||||
uint64_t hash = 0xCBF29CE484222325;
|
||||
if (data)
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
hash ^= data[i];
|
||||
hash *= 0x100000001B3;
|
||||
}
|
||||
if (make_upper) // Modification for only uppercase latin text
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
uint8_t a = data[i];
|
||||
if (a > 0x60 && a < 0x7B)
|
||||
a -= 0x20;
|
||||
hash ^= a;
|
||||
hash *= 0x100000001B3;
|
||||
}
|
||||
else
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
hash ^= data[i];
|
||||
hash *= 0x100000001B3;
|
||||
}
|
||||
return (hash >> 32) ^ hash; // Actual Modification
|
||||
}
|
||||
|
||||
inline uint64_t hash_utf8_fnv1a64m(char* data) {
|
||||
uint64_t hash = hash_fnv1a64m((uint8_t*)data, utf8_length(data));
|
||||
inline uint64_t hash_utf8_fnv1a64m(char* data, bool make_upper) {
|
||||
uint64_t hash = hash_fnv1a64m((uint8_t*)data, utf8_length(data), make_upper);
|
||||
return hash;
|
||||
}
|
||||
|
||||
inline uint64_t hash_utf16_fnv1a64m(wchar_t* data) {
|
||||
inline uint64_t hash_utf16_fnv1a64m(wchar_t* data, bool make_upper) {
|
||||
char* temp = utf16_to_utf8(data);
|
||||
uint64_t hash = hash_fnv1a64m((uint8_t*)temp, utf8_length(temp));
|
||||
free(temp);
|
||||
return hash;
|
||||
}
|
||||
|
||||
inline uint64_t hash_fnv1a64m_upper(uint8_t* data, size_t length) { // FNV 1a 64-bit Modified; Always Upper
|
||||
uint64_t hash = 0xCBF29CE484222325;
|
||||
if (data)
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
uint8_t a = data[i];
|
||||
if (a > 0x60 && a < 0x7B)
|
||||
a -= 0x20;
|
||||
hash ^= a;
|
||||
hash *= 0x100000001B3;
|
||||
}
|
||||
return (hash >> 32) ^ hash; // Actual Modification
|
||||
}
|
||||
|
||||
inline uint64_t hash_utf8_fnv1a64m_upper(char* data) {
|
||||
uint64_t hash = hash_fnv1a64m_upper((uint8_t*)data, utf8_length(data));
|
||||
return hash;
|
||||
}
|
||||
|
||||
inline uint64_t hash_utf16_fnv1a64m_upper(wchar_t* data) {
|
||||
char* temp = utf16_to_utf8(data);
|
||||
uint64_t hash = hash_fnv1a64m_upper((uint8_t*)temp, utf8_length(temp));
|
||||
uint64_t hash = hash_fnv1a64m((uint8_t*)temp, utf8_length(temp), make_upper);
|
||||
free(temp);
|
||||
return hash;
|
||||
}
|
||||
|
||||
// MurmurHash
|
||||
// 0x814D7A9C in PCSB00554
|
||||
// 0x8134C304 in PCSB01007
|
||||
// 0x0069CEA4 in NPEB02013
|
||||
uint32_t hash_murmurhash(uint8_t* data, size_t length,
|
||||
uint32_t seed, bool upper, bool big_endian) { // 0x814D7A9C in PCSB00554; MurmurHash
|
||||
// 0x8134C304 in PCSB01007
|
||||
// 0x0069CEA4 in NPEB02013
|
||||
uint32_t seed, bool upper, bool big_endian) {
|
||||
uint32_t a, b, hash;
|
||||
size_t i;
|
||||
|
||||
@@ -195,3 +219,32 @@ inline uint32_t hash_utf16_murmurhash(wchar_t* data, uint32_t seed, bool upper)
|
||||
free(temp);
|
||||
return hash;
|
||||
}
|
||||
|
||||
// CRC16-CCITT
|
||||
// 0x140011A90 in SBZV_7.10
|
||||
uint16_t hash_crc16_ccitt(uint8_t* data, size_t length, bool make_upper) {
|
||||
uint16_t hash = 0xFFFF;
|
||||
if (make_upper) // Modification for only uppercase latin text
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
uint8_t a = data[i];
|
||||
if (a > 0x60 && a < 0x7B)
|
||||
a -= 0x20;
|
||||
hash = (uint16_t)(hash_crc16_ccitt_table[(hash >> 8) ^ a] ^ (hash << 8));
|
||||
}
|
||||
else
|
||||
for (size_t i = 0; i < length; i++)
|
||||
hash = (uint16_t)(hash_crc16_ccitt_table[(hash >> 8) ^ data[i]] ^ (hash << 8));
|
||||
return hash;
|
||||
}
|
||||
|
||||
uint16_t hash_utf8_crc16_ccitt(uint8_t* data, bool make_upper) {
|
||||
uint32_t hash = hash_crc16_ccitt((uint8_t*)data, utf8_length(data), make_upper);
|
||||
return hash;
|
||||
}
|
||||
|
||||
uint16_t hash_utf16_crc16_ccitt(wchar_t* data, bool make_upper) {
|
||||
char* temp = utf16_to_utf8(data);
|
||||
uint32_t hash = hash_crc16_ccitt((uint8_t*)temp, utf8_length(temp), make_upper);
|
||||
free(temp);
|
||||
return hash;
|
||||
}
|
||||
|
||||
+7
-6
@@ -9,13 +9,14 @@
|
||||
|
||||
extern const uint64_t hash_fnv1a64m_empty;
|
||||
extern const uint32_t hash_murmurhash_empty;
|
||||
extern const uint32_t hash_crc16_ccitt_empty;
|
||||
|
||||
extern uint64_t hash_fnv1a64m(uint8_t* data, size_t length);
|
||||
extern uint64_t hash_utf8_fnv1a64m(char* data);
|
||||
extern uint64_t hash_utf16_fnv1a64m(wchar_t* data);
|
||||
extern uint64_t hash_fnv1a64m_upper(uint8_t* data, size_t length);
|
||||
extern uint64_t hash_utf8_fnv1a64m_upper(char* data);
|
||||
extern uint64_t hash_utf16_fnv1a64m_upper(wchar_t* data);
|
||||
extern uint64_t hash_fnv1a64m(uint8_t* data, size_t length, bool make_upper);
|
||||
extern uint64_t hash_utf8_fnv1a64m(char* data, bool make_upper);
|
||||
extern uint64_t hash_utf16_fnv1a64m(wchar_t* data, bool make_upper);
|
||||
extern uint32_t hash_murmurhash(uint8_t* data, size_t length, uint32_t seed, bool upper, bool big_endian);
|
||||
extern uint32_t hash_utf8_murmurhash(char* data, uint32_t seed, bool upper);
|
||||
extern uint32_t hash_utf16_murmurhash(wchar_t* data, uint32_t seed, bool upper);
|
||||
extern uint16_t hash_crc16_ccitt(uint8_t* data, size_t length, bool make_upper);
|
||||
extern uint16_t hash_utf8_crc16_ccitt(uint8_t* data, bool make_upper);
|
||||
extern uint16_t hash_utf16_crc16_ccitt(wchar_t* data, bool make_upper);
|
||||
|
||||
@@ -238,13 +238,13 @@ static void io_msgpack_write_inner(stream* s, msgpack* msg) {
|
||||
break;
|
||||
case MSGPACK_ARRAY: {
|
||||
msgpack_array* ptr = MSGPACK_SELECT_PTR(msgpack_array, msg);
|
||||
io_msgpack_write_array(s, ptr->end - ptr->begin);
|
||||
io_msgpack_write_array(s, vector_length(*ptr));
|
||||
for (msgpack* i = ptr->begin; i != ptr->end; i++)
|
||||
io_msgpack_write_inner(s, i);
|
||||
} break;
|
||||
case MSGPACK_MAP: {
|
||||
msgpack_map* ptr = MSGPACK_SELECT_PTR(msgpack_map, msg);
|
||||
io_msgpack_write_map(s, ptr->end - ptr->begin);
|
||||
io_msgpack_write_map(s, vector_length(*ptr));
|
||||
for (msgpack* i = ptr->begin; i != ptr->end; i++)
|
||||
io_msgpack_write_inner(s, i);
|
||||
} break;
|
||||
|
||||
@@ -390,7 +390,7 @@ void path_get_directories_recursive(vector_string* directories, char* path,
|
||||
|
||||
vector_string_push_back(directories, i);
|
||||
|
||||
if (!(temp.end - temp.begin)) {
|
||||
if (vector_length(temp) < 1) {
|
||||
vector_string_free(&temp, string_free);
|
||||
continue;
|
||||
}
|
||||
@@ -511,7 +511,7 @@ void path_wget_directories_recursive(vector_wstring* directories, wchar_t* path,
|
||||
|
||||
vector_wstring_push_back(directories, i);
|
||||
|
||||
if (!(temp.end - temp.begin)) {
|
||||
if (vector_length(temp) < 1) {
|
||||
vector_wstring_free(&temp, wstring_free);
|
||||
continue;
|
||||
}
|
||||
|
||||
+54
-24
@@ -55,7 +55,7 @@ void io_mcopy(stream* s, void** data, size_t* length) {
|
||||
if (!s || !data || !length || s->type != STREAM_MEMORY)
|
||||
return;
|
||||
|
||||
*length = s->io.data.vec.end - s->io.data.vec.begin;
|
||||
*length = vector_length(s->io.data.vec);
|
||||
*data = force_malloc(*length);
|
||||
memcpy(*data, s->io.data.vec.begin, *length);
|
||||
}
|
||||
@@ -158,7 +158,7 @@ inline ssize_t io_get_length(stream* s) {
|
||||
s->length = 0;
|
||||
break;
|
||||
case STREAM_MEMORY:
|
||||
s->length = s->io.data.vec.end - s->io.data.vec.begin;
|
||||
s->length = vector_length(s->io.data.vec);
|
||||
break;
|
||||
default:
|
||||
s->length = 0;
|
||||
@@ -189,7 +189,7 @@ int32_t io_set_position(stream* s, ssize_t pos, int32_t seek) {
|
||||
if (pos < 0)
|
||||
return EOF;
|
||||
|
||||
capacity = s->io.data.vec.capacity_end - s->io.data.vec.begin;
|
||||
capacity = vector_capacity(s->io.data.vec);
|
||||
if (capacity < pos)
|
||||
vector_uint8_t_reserve(&s->io.data.vec, pos - capacity);
|
||||
|
||||
@@ -223,7 +223,7 @@ int32_t io_set_position(stream* s, ssize_t pos, int32_t seek) {
|
||||
if (pos < 0)
|
||||
return EOF;
|
||||
|
||||
capacity = s->io.data.vec.end - s->io.data.vec.begin;
|
||||
capacity = vector_length(s->io.data.vec);
|
||||
if (capacity < pos)
|
||||
return EOF;
|
||||
|
||||
@@ -242,7 +242,7 @@ inline int32_t io_position_push(stream* s, ssize_t pos, int32_t seek) {
|
||||
}
|
||||
|
||||
inline void io_position_pop(stream* s) {
|
||||
if (!(s->position_stack.end - s->position_stack.begin))
|
||||
if (vector_length(s->position_stack) < 1)
|
||||
return;
|
||||
|
||||
ssize_t position = s->position_stack.end[-1];
|
||||
@@ -373,40 +373,41 @@ inline void io_write_uint8_t(stream* s, uint8_t val) {
|
||||
}
|
||||
|
||||
inline void io_read_string(stream* s, string* str, size_t length) {
|
||||
char* temp = force_malloc(length + 1);
|
||||
string_init_length(str, 0, length);
|
||||
char* temp = string_data(str);
|
||||
io_read(s, temp, length);
|
||||
temp[length] = 0;
|
||||
string_init_length(str, temp, length);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
inline void io_read_wstring(stream* s, wstring* str, size_t length) {
|
||||
wchar_t* temp = force_malloc_s(wchar_t, length + 1);
|
||||
wstring_init_length(str, 0, length);
|
||||
wchar_t* temp = wstring_data(str);
|
||||
io_read(s, temp, sizeof(wchar_t) * length);
|
||||
temp[length] = 0;
|
||||
wstring_init_length(str, temp, length);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
inline void io_read_string_null_terminated(stream* s, string* str) {
|
||||
ssize_t offset = io_get_position(s);
|
||||
char* temp = io_read_utf8_string_null_terminated_offset(s, offset);
|
||||
string_init(str, temp);
|
||||
size_t length = 0;
|
||||
char* temp = io_read_utf8_string_null_terminated_offset_length(s, offset, &length);
|
||||
string_init_length(str, temp, length);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
inline void io_read_wstring_null_terminated(stream* s, wstring* str) {
|
||||
ssize_t offset = io_get_position(s);
|
||||
wchar_t* temp = io_read_utf16_string_null_terminated_offset(s, offset);
|
||||
wstring_init(str, temp);
|
||||
size_t length = 0;
|
||||
wchar_t* temp = io_read_utf16_string_null_terminated_offset_length(s, offset, &length);
|
||||
wstring_init_length(str, temp, length);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
inline void io_read_string_null_terminated_offset(stream* s,
|
||||
ssize_t offset, string* str) {
|
||||
if (offset) {
|
||||
char* temp = io_read_utf8_string_null_terminated_offset(s, offset);
|
||||
string_init(str, temp);
|
||||
size_t length = 0;
|
||||
char* temp = io_read_utf8_string_null_terminated_offset_length(s, offset, &length);
|
||||
string_init_length(str, temp, length);
|
||||
free(temp);
|
||||
}
|
||||
else
|
||||
@@ -416,8 +417,9 @@ inline void io_read_string_null_terminated_offset(stream* s,
|
||||
inline void io_read_wstring_null_terminated_offset(stream* s,
|
||||
ssize_t offset, wstring* str) {
|
||||
if (offset) {
|
||||
wchar_t* temp = io_read_utf16_string_null_terminated_offset(s, offset);
|
||||
wstring_init(str, temp);
|
||||
size_t length = 0;
|
||||
wchar_t* temp = io_read_utf16_string_null_terminated_offset_length(s, offset, &length);
|
||||
wstring_init_length(str, temp, length);
|
||||
free(temp);
|
||||
}
|
||||
else
|
||||
@@ -426,15 +428,37 @@ inline void io_read_wstring_null_terminated_offset(stream* s,
|
||||
|
||||
inline char* io_read_utf8_string_null_terminated(stream* s) {
|
||||
ssize_t offset = io_get_position(s);
|
||||
return io_read_utf8_string_null_terminated_offset(s, offset);
|
||||
size_t length = 0;
|
||||
return io_read_utf8_string_null_terminated_offset_length(s, offset, &length);
|
||||
}
|
||||
|
||||
inline wchar_t* io_read_utf16_string_null_terminated(stream* s) {
|
||||
ssize_t offset = io_get_position(s);
|
||||
return io_read_utf16_string_null_terminated_offset(s, offset);
|
||||
size_t length = 0;
|
||||
return io_read_utf16_string_null_terminated_offset_length(s, offset, &length);
|
||||
}
|
||||
|
||||
char* io_read_utf8_string_null_terminated_offset(stream* s, ssize_t offset) {
|
||||
inline char* io_read_utf8_string_null_terminated_length(stream* s, ssize_t* length) {
|
||||
ssize_t offset = io_get_position(s);
|
||||
return io_read_utf8_string_null_terminated_offset_length(s, offset, length);
|
||||
}
|
||||
|
||||
inline wchar_t* io_read_utf16_string_null_terminated_length(stream* s, ssize_t* length) {
|
||||
ssize_t offset = io_get_position(s);
|
||||
return io_read_utf16_string_null_terminated_offset_length(s, offset, length);
|
||||
}
|
||||
|
||||
inline char* io_read_utf8_string_null_terminated_offset(stream* s, ssize_t offset) {
|
||||
size_t length = 0;
|
||||
return io_read_utf8_string_null_terminated_offset_length(s, offset, &length);
|
||||
}
|
||||
|
||||
inline wchar_t* io_read_utf16_string_null_terminated_offset(stream* s, ssize_t offset) {
|
||||
size_t length = 0;
|
||||
return io_read_utf16_string_null_terminated_offset_length(s, offset, &length);
|
||||
}
|
||||
|
||||
char* io_read_utf8_string_null_terminated_offset_length(stream* s, ssize_t offset, ssize_t* length) {
|
||||
io_position_push(s, offset, SEEK_SET);
|
||||
|
||||
size_t name_length = 0;
|
||||
@@ -444,6 +468,7 @@ char* io_read_utf8_string_null_terminated_offset(stream* s, ssize_t offset) {
|
||||
|
||||
if (name_length == 0) {
|
||||
io_position_pop(s);
|
||||
*length = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -453,10 +478,11 @@ char* io_read_utf8_string_null_terminated_offset(stream* s, ssize_t offset) {
|
||||
str[name_length] = 0;
|
||||
|
||||
io_position_pop(s);
|
||||
*length = name_length;
|
||||
return str;
|
||||
}
|
||||
|
||||
wchar_t* io_read_utf16_string_null_terminated_offset(stream* s, ssize_t offset) {
|
||||
wchar_t* io_read_utf16_string_null_terminated_offset_length(stream* s, ssize_t offset, ssize_t* length) {
|
||||
io_position_push(s, offset, SEEK_SET);
|
||||
|
||||
size_t name_length = 0;
|
||||
@@ -466,8 +492,11 @@ wchar_t* io_read_utf16_string_null_terminated_offset(stream* s, ssize_t offset)
|
||||
&& (((c0 & 0xFF) | ((c1 & 0xFF) << 8)) != 0))
|
||||
name_length++;
|
||||
|
||||
if (name_length == 0)
|
||||
if (name_length == 0) {
|
||||
io_position_pop(s);
|
||||
*length = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
wchar_t* str = force_malloc_s(wchar_t, name_length + 1);
|
||||
io_set_position(s, offset, SEEK_SET);
|
||||
@@ -475,6 +504,7 @@ wchar_t* io_read_utf16_string_null_terminated_offset(stream* s, ssize_t offset)
|
||||
str[name_length] = 0;
|
||||
|
||||
io_position_pop(s);
|
||||
*length = name_length;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,12 @@ extern void io_read_string_null_terminated_offset(stream* s, ssize_t offset, str
|
||||
extern void io_read_wstring_null_terminated_offset(stream* s, ssize_t offset, wstring* str);
|
||||
extern char* io_read_utf8_string_null_terminated(stream* s);
|
||||
extern wchar_t* io_read_utf16_string_null_terminated(stream* s);
|
||||
extern char* io_read_utf8_string_null_terminated_length(stream* s, ssize_t* length);
|
||||
extern wchar_t* io_read_utf16_string_null_terminated_length(stream* s, ssize_t* length);
|
||||
extern char* io_read_utf8_string_null_terminated_offset(stream* s, ssize_t offset);
|
||||
extern wchar_t* io_read_utf16_string_null_terminated_offset(stream* s, ssize_t offset);
|
||||
extern char* io_read_utf8_string_null_terminated_offset_length(stream* s, ssize_t offset, ssize_t* length);
|
||||
extern wchar_t* io_read_utf16_string_null_terminated_offset_length(stream* s, ssize_t offset, ssize_t* length);
|
||||
extern void io_write_string(stream* s, string* str);
|
||||
extern void io_write_wstring(stream* s, wstring* str);
|
||||
extern void io_write_string_null_terminated(stream* s, string* str);
|
||||
|
||||
+51
-10
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "key_val.h"
|
||||
#include "io/path.h"
|
||||
#include "hash.h"
|
||||
#include "str_utils.h"
|
||||
|
||||
@@ -50,7 +51,7 @@ void key_val_init(key_val* kv, uint8_t* data, size_t length) {
|
||||
size_t key_length = c - s;
|
||||
size_t val_length = len - (key_length + 1);
|
||||
|
||||
uint64_t key_hash = hash_fnv1a64m(key_str_data, key_length);
|
||||
uint64_t key_hash = hash_fnv1a64m(key_str_data, key_length, false);
|
||||
|
||||
vector_ptr_char_push_back(&kv->key, &key_str_data);
|
||||
vector_size_t_push_back(&kv->key_len, &key_length);
|
||||
@@ -62,6 +63,46 @@ void key_val_init(key_val* kv, uint8_t* data, size_t length) {
|
||||
free(lines)
|
||||
}
|
||||
|
||||
void key_val_file_read(key_val* kv, char* path) {
|
||||
if (!kv)
|
||||
return;
|
||||
|
||||
if (!path || !path_check_file_exists(path)) {
|
||||
key_val_init(kv, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
stream s;
|
||||
io_open(&s, path, "rb");
|
||||
if (s.io.stream) {
|
||||
char* d = force_malloc(s.length);
|
||||
io_read(&s, d, s.length);
|
||||
key_val_init(kv, d, s.length);
|
||||
free(d);
|
||||
}
|
||||
io_free(&s);
|
||||
}
|
||||
|
||||
void key_val_wfile_read(key_val* kv, wchar_t* path) {
|
||||
if (!kv)
|
||||
return;
|
||||
|
||||
if (!path || !path_wcheck_file_exists(path)) {
|
||||
key_val_init(kv, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
stream s;
|
||||
io_wopen(&s, path, L"rb");
|
||||
if (s.io.stream) {
|
||||
char* d = force_malloc(s.length);
|
||||
io_read(&s, d, s.length);
|
||||
key_val_init(kv, d, s.length);
|
||||
free(d);
|
||||
}
|
||||
io_free(&s);
|
||||
}
|
||||
|
||||
bool key_val_get_local_key_val(key_val* kv, char* str, key_val* lkv) {
|
||||
lkv->buf = 0;
|
||||
lkv->key = vector_ptr_empty(char);
|
||||
@@ -79,7 +120,7 @@ bool key_val_get_local_key_val(key_val* kv, char* str, key_val* lkv) {
|
||||
|
||||
char** i = kv->key.begin;
|
||||
size_t* i_len = kv->key_len.begin;
|
||||
size_t j = kv->key.end - kv->key.begin;
|
||||
size_t j = vector_length(kv->key);
|
||||
for (; j; i++, i_len++, j--)
|
||||
if (str_length <= *i_len && !memcmp(str, (char*)*i, str_length)) {
|
||||
if (!first)
|
||||
@@ -109,7 +150,7 @@ bool key_val_has_key(key_val* kv, char* str) {
|
||||
|
||||
char** i = kv->key.begin;
|
||||
size_t* i_len = kv->key_len.begin;
|
||||
size_t j = kv->key.end - kv->key.begin;
|
||||
size_t j = vector_length(kv->key);
|
||||
for (; j; i++, i_len++, j--) {
|
||||
size_t len = min(str_length, *i_len);
|
||||
if (len && str_length <= *i_len && !memcmp(str, *i, len))
|
||||
@@ -320,7 +361,7 @@ void key_val_write_vec3(stream* s, char* buf,
|
||||
|
||||
void key_val_free(key_val* kv) {
|
||||
if (kv->buf) {
|
||||
size_t count = kv->key.end - kv->key.begin;
|
||||
size_t count = vector_length(kv->key);
|
||||
memset(kv->key.begin, 0, sizeof(char*) * count);
|
||||
memset(kv->val.begin, 0, sizeof(char*) * count);
|
||||
|
||||
@@ -339,7 +380,7 @@ void key_val_get_lexicographic_order(vector_int32_t* vec, int32_t length) {
|
||||
|
||||
int32_t i, j, m;
|
||||
|
||||
if (length <= 0)
|
||||
if (length < 1)
|
||||
return;
|
||||
|
||||
vector_int32_t_reserve(vec, length);
|
||||
@@ -391,13 +432,13 @@ void key_val_get_lexicographic_order(vector_int32_t* vec, int32_t length) {
|
||||
}
|
||||
|
||||
static ssize_t key_val_get_key_index(key_val* kv, char* str, size_t length) {
|
||||
if (!(kv->key_hash.end - kv->key_hash.begin))
|
||||
if (vector_length(kv->key_hash) < 1)
|
||||
return -1;
|
||||
|
||||
uint64_t hash = hash_fnv1a64m(str, length);
|
||||
uint64_t hash = hash_fnv1a64m(str, length, false);
|
||||
|
||||
uint64_t* key = kv->key_hash.begin;
|
||||
size_t len = kv->key.end - kv->key.begin;
|
||||
size_t len = vector_length(kv->key);
|
||||
size_t temp;
|
||||
while (len > 0) {
|
||||
if (hash < key[temp = len / 2])
|
||||
@@ -424,7 +465,7 @@ static ssize_t key_val_get_key_index(key_val* kv, char* str, size_t length) {
|
||||
#define RADIX (1 << RADIX_BASE)
|
||||
|
||||
static void key_val_sort(key_val* kv) {
|
||||
size_t count = kv->key.end - kv->key.begin;
|
||||
size_t count = vector_length(kv->key);
|
||||
|
||||
kv->key_hash = vector_empty(uint64_t);
|
||||
kv->key_index = vector_empty(size_t);
|
||||
@@ -439,7 +480,7 @@ static void key_val_sort(key_val* kv) {
|
||||
size_t* key_index = kv->key_index.begin;
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
*key_index++ = i;
|
||||
*key_hash++ = hash_fnv1a64m(*key++, *key_len++);
|
||||
*key_hash++ = hash_fnv1a64m(*key++, *key_len++, false);
|
||||
}
|
||||
|
||||
if (count < 2)
|
||||
|
||||
@@ -21,6 +21,8 @@ typedef struct key_val {
|
||||
} key_val;
|
||||
|
||||
extern void key_val_init(key_val* kv, uint8_t* data, size_t length);
|
||||
extern void key_val_file_read(key_val* kv, char* path);
|
||||
extern void key_val_wfile_read(key_val* kv, wchar_t* path);
|
||||
extern bool key_val_get_local_key_val(key_val* kv, char* str, key_val* lkv);
|
||||
extern bool key_val_has_key(key_val* kv, char* str);
|
||||
extern bool key_val_read_bool(key_val* kv, char* buf,
|
||||
|
||||
+2
-2
@@ -54,13 +54,13 @@ void kkc_init_from_key(kkc* c, vector_uint8_t* key) {
|
||||
c->state = 1;
|
||||
c->error = KKC_ERROR_NONE;
|
||||
|
||||
if (!key || !key->begin || key->end - key->begin < 1) {
|
||||
if (!key || !key->begin || vector_length(*key) < 1) {
|
||||
c->error = KKC_ERROR_INVALID_KEY;
|
||||
return;
|
||||
}
|
||||
|
||||
kkc_key_type type = 0;
|
||||
size_t kl = key->end - key->begin;
|
||||
size_t kl = vector_length(*key);
|
||||
|
||||
switch (kl) {
|
||||
case 16:
|
||||
|
||||
+104
-4
@@ -278,7 +278,7 @@ inline void mat3_normalize(mat3* x, mat3* z) {
|
||||
z->row2 = *(vec3*)&xt2;
|
||||
}
|
||||
|
||||
void mat3_normalize_rotation(mat3* x, mat3* z) {
|
||||
inline void mat3_normalize_rotation(mat3* x, mat3* z) {
|
||||
__m128 xt;
|
||||
__m128 yt;
|
||||
*(vec3*)&xt = x->row0;
|
||||
@@ -681,7 +681,6 @@ inline void mat4_mult_vec3_inv(mat4* x, vec3* y, vec3* z) {
|
||||
|
||||
*(vec3*)&yt = *y;
|
||||
yt = _mm_and_ps(yt, vec4_mask_vec3);
|
||||
yt = _mm_sub_ps(yt, x->row3.data);
|
||||
zt = _mm_mul_ps(yt, x->row0.data);
|
||||
zt = _mm_hadd_ps(zt, zt);
|
||||
z->x = _mm_cvtss_f32(_mm_hadd_ps(zt, zt));
|
||||
@@ -911,7 +910,7 @@ inline void mat4_normalize(mat4* x, mat4* z) {
|
||||
z->row3.data = _mm_mul_ps(x->row3.data, det);
|
||||
}
|
||||
|
||||
void mat4_normalize_rotation(mat4* x, mat4* z) {
|
||||
inline void mat4_normalize_rotation(mat4* x, mat4* z) {
|
||||
__m128 xt;
|
||||
__m128 yt;
|
||||
xt = _mm_and_ps(x->row0.data, vec4_mask_vec3);
|
||||
@@ -937,7 +936,7 @@ void mat4_normalize_rotation(mat4* x, mat4* z) {
|
||||
if (yt.m128_f32[0] != 0.0f)
|
||||
yt.m128_f32[0] = 1.0f / yt.m128_f32[0];
|
||||
xt = _mm_mul_ps(xt, _mm_shuffle_ps(yt, yt, 0));
|
||||
*(vec3*)&z->row2.data = *(vec3*)&xt;
|
||||
*(vec3*)&z->row2 = *(vec3*)&xt;
|
||||
z->row0.w = x->row0.w;
|
||||
z->row1.w = x->row1.w;
|
||||
z->row2.w = x->row2.w;
|
||||
@@ -1707,6 +1706,38 @@ inline void mat4_from_quat(quat* quat, mat4* mat) {
|
||||
mat->row3 = (vec4){ 0.0f, 0.0f, 0.0f, 1.0f };
|
||||
}
|
||||
|
||||
float_t vec3_angle_between_two_vectors(vec3* x, vec3* y) {
|
||||
vec3 z_t;
|
||||
vec3_cross(*x, *y, z_t);
|
||||
float_t v2;
|
||||
vec3_length(z_t, v2);
|
||||
float_t v3;
|
||||
vec3_dot(*x, *y, v3);
|
||||
return fabsf(atan2f(v2, v3));
|
||||
}
|
||||
|
||||
void mat4_from_two_vectors(vec3* x, vec3* y, mat4* mat) {
|
||||
*mat = mat4_identity;
|
||||
if (x->x == y->x && y->y == x->y && y->z == x->z)
|
||||
return;
|
||||
|
||||
float_t v5;
|
||||
vec3_dot(*x, *y, v5);
|
||||
if (fabsf(1.0f - v5) <= 0.000001f)
|
||||
return;
|
||||
|
||||
vec3 axis;
|
||||
vec3_cross(*x, *y, axis);
|
||||
float_t axis_length;
|
||||
vec3_length(axis, axis_length);
|
||||
if (axis_length > 0.000001f) {
|
||||
float_t angle = vec3_angle_between_two_vectors(x, y);
|
||||
if (axis_length != 0.0)
|
||||
vec3_mult_scalar(axis, 1.0f / axis_length, axis);
|
||||
mat4_from_axis_angle(&axis, angle, mat);
|
||||
}
|
||||
}
|
||||
|
||||
inline void mat4_from_axis_angle(vec3* axis, float_t angle, mat4* mat) {
|
||||
float_t angle_sin;
|
||||
float_t angle_cos;
|
||||
@@ -1811,6 +1842,29 @@ inline void mat4_set_translation(mat4* x, vec3* z) {
|
||||
*(vec3*)&x->row3 = *z;
|
||||
}
|
||||
|
||||
inline void mat4_blend(mat4* x, mat4* y, mat4* z, float_t blend) {
|
||||
quat q1;
|
||||
quat q2;
|
||||
quat q3;
|
||||
|
||||
quat_from_mat3(x->row0.x, x->row1.x, x->row2.x, x->row0.y,
|
||||
x->row1.y, x->row2.y, x->row0.z, x->row1.z, x->row2.z, &q1);
|
||||
quat_from_mat3(y->row0.x, y->row1.x, y->row2.x, y->row0.y,
|
||||
y->row1.y, y->row2.y, y->row0.z, y->row1.z, y->row2.z, &q1);
|
||||
|
||||
vec3 t1;
|
||||
vec3 t2;
|
||||
vec3 t3;
|
||||
mat4_get_translation(x, &t1);
|
||||
mat4_get_translation(y, &t2);
|
||||
|
||||
quat_slerp(&q3, &q1, &q2, blend);
|
||||
vec3_lerp_scalar(t1, t2, t3, blend);
|
||||
|
||||
mat4_from_quat(&q3, z);
|
||||
mat4_set_translation(z, &t3);
|
||||
}
|
||||
|
||||
inline void mat4_blend_rotation(mat4* x, mat4* y, mat4* z, float_t blend) {
|
||||
quat q0;
|
||||
quat q1;
|
||||
@@ -1824,6 +1878,52 @@ inline void mat4_blend_rotation(mat4* x, mat4* y, mat4* z, float_t blend) {
|
||||
mat4_from_quat(&q2, z);
|
||||
}
|
||||
|
||||
void mat4_lerp_rotation(mat4* dst, mat4* src0, mat4* src1, float_t blend) {
|
||||
vec3 m0;
|
||||
vec3 m1;
|
||||
vec3_lerp_scalar(*(vec3*)&src0->row0, *(vec3*)&src1->row0, m0, blend);
|
||||
vec3_lerp_scalar(*(vec3*)&src0->row1, *(vec3*)&src1->row1, m1, blend);
|
||||
|
||||
float_t m0_len_sq;
|
||||
float_t m1_len_sq;
|
||||
vec3_length_squared(m0, m0_len_sq);
|
||||
vec3_length_squared(m1, m1_len_sq);
|
||||
|
||||
if (m0_len_sq <= 0.000001f || m1_len_sq <= 0.000001f) {
|
||||
*dst = *src1;
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 m2;
|
||||
vec3_cross(m0, m1, m2);
|
||||
vec3_cross(m2, m0, m1);
|
||||
|
||||
float_t m2_len_sq;
|
||||
vec3_length_squared(m1, m1_len_sq);
|
||||
vec3_length_squared(m2, m2_len_sq);
|
||||
if (m2_len_sq <= 0.000001f || m1_len_sq <= 0.000001) {
|
||||
*dst = *src1;
|
||||
return;
|
||||
}
|
||||
|
||||
float_t m0_len = sqrtf(m0_len_sq);
|
||||
if (m0_len != 0.0f)
|
||||
vec3_div_scalar(m0, 1.0f / m0_len, m0);
|
||||
|
||||
float_t m1_len = sqrtf(m1_len_sq);
|
||||
if (m1_len != 0.0f)
|
||||
vec3_div_scalar(m1, 1.0f / m1_len, m1);
|
||||
|
||||
float_t m2_len = sqrtf(m2_len_sq);
|
||||
if (m2_len != 0.0f)
|
||||
vec3_div_scalar(m2, 1.0f / m2_len, m2);
|
||||
|
||||
*dst = mat4_identity;
|
||||
*(vec3*)&dst->row0 = m0;
|
||||
*(vec3*)&dst->row1 = m1;
|
||||
*(vec3*)&dst->row2 = m2;
|
||||
}
|
||||
|
||||
inline float_t mat4_get_max_scale(mat4* x) {
|
||||
mat4 mat;
|
||||
mat4_transpose(x, &mat);
|
||||
|
||||
+3
-1
@@ -151,12 +151,14 @@ extern void mat4_get_scale(mat4* x, vec3* z);
|
||||
extern void mat4_get_rotation(mat4* x, vec3* z);
|
||||
extern void mat4_get_translation(mat4* x, vec3* z);
|
||||
extern void mat4_set_translation(mat4* x, vec3* z);
|
||||
extern void mat4_blend(mat4* x, mat4* y, mat4* z, float_t blend);
|
||||
extern void mat4_blend_rotation(mat4* x, mat4* y, mat4* z, float_t blend);
|
||||
extern void mat4_lerp_rotation(mat4* dst, mat4* src0, mat4* src1, float_t blend);
|
||||
extern float_t mat4_get_max_scale(mat4* x);
|
||||
extern void mat4_ortho(double_t left, double_t right,
|
||||
double_t bottom, double_t top, double_t z_near, double_t z_far, mat4* mat);
|
||||
extern void mat4_persp(double_t fov_y, double_t aspect, double_t z_near, double_t z_far, mat4* mat);
|
||||
extern void mat4_look_at(vec3* eye, vec3* target, vec3* up, mat4* mat);
|
||||
extern float_t mat4_get_max_scale(mat4* x);
|
||||
|
||||
extern void mat4_to_mat4u(mat4* x, mat4u* z);
|
||||
extern void mat4u_to_mat4(mat4u* x, mat4* z);
|
||||
|
||||
+5
-5
@@ -51,7 +51,7 @@ void mot_read(mot_set_farc* msf, char* path, bool modern) {
|
||||
farc_init(&f);
|
||||
farc_read(&f, path_farc, true, false);
|
||||
|
||||
vector_mot_set_reserve(&msf->vec, f.files.end - f.files.begin);
|
||||
vector_mot_set_reserve(&msf->vec, vector_length(f.files));
|
||||
if (!modern)
|
||||
for (farc_file* i = f.files.begin; i != f.files.end; i++) {
|
||||
if (!i->data || !i->size
|
||||
@@ -116,7 +116,7 @@ void mot_wread(mot_set_farc* msf, wchar_t* path, bool modern) {
|
||||
farc_init(&f);
|
||||
farc_wread(&f, path_farc, true, false);
|
||||
|
||||
vector_mot_set_reserve(&msf->vec, f.files.end - f.files.begin);
|
||||
vector_mot_set_reserve(&msf->vec, vector_length(f.files));
|
||||
if (!modern)
|
||||
for (farc_file* i = f.files.begin; i != f.files.end; i++) {
|
||||
if (!i->data || !i->size
|
||||
@@ -178,7 +178,7 @@ void mot_mread(mot_set_farc* msf, void* data, size_t length, bool modern) {
|
||||
farc_init(&f);
|
||||
farc_mread(&f, data, length, true);
|
||||
|
||||
vector_mot_set_reserve(&msf->vec, f.files.end - f.files.begin);
|
||||
vector_mot_set_reserve(&msf->vec, vector_length(f.files));
|
||||
if (!modern)
|
||||
for (farc_file* i = f.files.begin; i != f.files.end; i++) {
|
||||
if (!i->data || !i->size
|
||||
@@ -514,7 +514,7 @@ static bool mot_classic_read_inner(mot_set* ms, stream* s) {
|
||||
}
|
||||
|
||||
static void mot_classic_write_inner(mot_set* ms, stream* s) {
|
||||
size_t count = ms->vec.end - ms->vec.begin;
|
||||
size_t count = vector_length(ms->vec);
|
||||
io_set_position(s, count * 0x10 + 0x10, SEEK_SET);
|
||||
mot_header_classic* mh = force_malloc_s(mot_header_classic, count);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
@@ -727,7 +727,7 @@ static void mot_modern_write_inner(mot_set* ms, stream* s) {
|
||||
enrs_entry ee;
|
||||
vector_size_t pof = vector_empty(size_t);
|
||||
uint32_t murmurhash = 0;
|
||||
if (ms->vec.end - ms->vec.begin > 0) {
|
||||
if (vector_length(ms->vec) > 0) {
|
||||
mot_header_modern mh;
|
||||
memset(&mh, 0, sizeof(mot_header_modern));
|
||||
mot_data* m = ms->vec.begin;
|
||||
|
||||
@@ -190,7 +190,7 @@ msgpack* msgpack_get_by_index(msgpack* msg, size_t index) {
|
||||
return 0;
|
||||
|
||||
msgpack_array* ptr = MSGPACK_SELECT_PTR(msgpack_array, msg);
|
||||
if ((ssize_t)index < ptr->end - ptr->begin)
|
||||
if ((ssize_t)index < vector_length(*ptr))
|
||||
return &ptr->begin[index];
|
||||
return 0;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ void msgpack_set_by_index(msgpack* msg, msgpack* m, size_t index) {
|
||||
return;
|
||||
|
||||
msgpack_array* ptr = MSGPACK_SELECT_PTR(msgpack_array, msg);
|
||||
if ((ssize_t)index < ptr->end - ptr->begin) {
|
||||
if ((ssize_t)index < vector_length(*ptr)) {
|
||||
msgpack_free(&ptr->begin[index]);
|
||||
ptr->begin[index] = *m;
|
||||
}
|
||||
|
||||
+220
-272
@@ -402,10 +402,8 @@ void obj_free(obj_set* os) {
|
||||
|
||||
for (uint32_t k = 0; k < cloth->count; k++) {
|
||||
obj_skin_block_cloth_field_1C* sub = &cloth->field_1C[k];
|
||||
string_free(&sub->sub_data_0.bone_name);
|
||||
string_free(&sub->sub_data_1.bone_name);
|
||||
string_free(&sub->sub_data_2.bone_name);
|
||||
string_free(&sub->sub_data_3.bone_name);
|
||||
for (int32_t l = 0; l < 4; l++)
|
||||
string_free(&sub->sub_data[l].bone_name);
|
||||
}
|
||||
free(cloth->field_1C);
|
||||
free(cloth->field_20);
|
||||
@@ -1164,14 +1162,15 @@ static void obj_classic_read_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
for (int32_t i = 0; i < ex->blocks_count; i++) {
|
||||
obj_skin_block* block = &ex->blocks[i];
|
||||
|
||||
char* block_signature = io_read_utf8_string_null_terminated_offset(s,
|
||||
bhs[i].block_signature_offset);
|
||||
if (!block_signature || utf8_length(block_signature) != 3) {
|
||||
free(block_signature);
|
||||
string block_signature = string_empty;
|
||||
io_read_string_null_terminated_offset(s,
|
||||
bhs[i].block_signature_offset, &block_signature);
|
||||
if (block_signature.length != 3) {
|
||||
string_free(&block_signature);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t signature = load_reverse_endianness_uint32_t(block_signature);
|
||||
uint32_t signature = load_reverse_endianness_uint32_t(string_data(&block_signature));
|
||||
switch (signature) {
|
||||
case 'CLS\0':
|
||||
block->type = OBJ_SKIN_BLOCK_CLOTH;
|
||||
@@ -1204,7 +1203,7 @@ static void obj_classic_read_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
s, bone_names);
|
||||
break;
|
||||
}
|
||||
free(block_signature);
|
||||
string_free(&block_signature);
|
||||
}
|
||||
free(bhs);
|
||||
}
|
||||
@@ -1220,7 +1219,7 @@ static void obj_classic_read_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
obj_skin_osage_sibling_info* osis = force_malloc_s(
|
||||
obj_skin_osage_sibling_info, ex->osage_sibling_infos_count);
|
||||
ex->osage_sibling_infos = osis;
|
||||
io_set_position(s, exh.blocks_offset, SEEK_SET);
|
||||
io_set_position(s, exh.osage_sibling_infos_offset, SEEK_SET);
|
||||
for (int32_t i = 0; i < ex->osage_sibling_infos_count; i++) {
|
||||
osis[i].name_index = io_read_uint32_t(s);
|
||||
osis[i].sibling_name_index = io_read_uint32_t(s);
|
||||
@@ -1393,10 +1392,9 @@ static void obj_classic_write_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&cloth->backface_mesh_name));
|
||||
for (uint32_t k = 0; k < cloth->count; k++) {
|
||||
obj_skin_block_cloth_field_1C* sub = &cloth->field_1C[k];
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&sub->sub_data_0.bone_name));
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&sub->sub_data_1.bone_name));
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&sub->sub_data_2.bone_name));
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&sub->sub_data_3.bone_name));
|
||||
for (int32_t l = 0; l < 4; l++)
|
||||
obj_skin_strings_push_back_check(&strings,
|
||||
string_data(&sub->sub_data[l].bone_name));
|
||||
}
|
||||
obj_skin_strings_push_back_check(&strings, "CLS");
|
||||
} break;
|
||||
@@ -1407,20 +1405,23 @@ static void obj_classic_write_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
bone_names_ptr, constraint->name_index);
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&constraint->source_node_name));
|
||||
switch (constraint->type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
obj_skin_strings_push_back_check(&strings, "Direction");
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&constraint->direction.up_vector.name));
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
obj_skin_strings_push_back_check(&strings, "Distance");
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&constraint->distance.up_vector.name));
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
obj_skin_strings_push_back_check(&strings, "Orientation");
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
obj_skin_strings_push_back_check(&strings, "Direction");
|
||||
obj_skin_strings_push_back_check(&strings,
|
||||
string_data(&constraint->direction.up_vector.name));
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
obj_skin_strings_push_back_check(&strings, "Position");
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&constraint->position.up_vector.name));
|
||||
obj_skin_strings_push_back_check(&strings,
|
||||
string_data(&constraint->position.up_vector.name));
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
obj_skin_strings_push_back_check(&strings, "Distance");
|
||||
obj_skin_strings_push_back_check(&strings,
|
||||
string_data(&constraint->distance.up_vector.name));
|
||||
break;
|
||||
}
|
||||
obj_skin_strings_push_back_check(&strings, "CNS");
|
||||
@@ -1521,7 +1522,7 @@ static void obj_classic_write_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
}
|
||||
}
|
||||
|
||||
exh.bone_names_count = (int32_t)(bone_names.end - bone_names.begin);
|
||||
exh.bone_names_count = (int32_t)vector_length(bone_names);
|
||||
exh.bone_names_offset = io_get_position(s);
|
||||
for (string* i = bone_names.begin; i != bone_names.end; i++)
|
||||
io_write_int32_t(s, 0);
|
||||
@@ -1580,24 +1581,24 @@ static void obj_classic_write_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
io_write(s, 0, 0x28);
|
||||
io_write(s, 0, 0x10);
|
||||
switch (block->constraint.type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write(s, 0, 0x0C);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
io_write(s, 0, 0x24);
|
||||
io_write(s, 0, 0x18);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
io_write(s, 0, 0x24);
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x14);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
io_write(s, 0, 0x24);
|
||||
io_write(s, 0, 0x04);
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x14);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write(s, 0, 0x0C);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
io_write(s, 0, 0x24);
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x14);
|
||||
break;
|
||||
}
|
||||
}
|
||||
io_align_write(s, 0x10);
|
||||
@@ -1726,7 +1727,7 @@ static void obj_classic_write_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
}
|
||||
}
|
||||
|
||||
vector_ssize_t_reserve(&string_offsets, strings.end - strings.begin);
|
||||
vector_ssize_t_reserve(&string_offsets, vector_length(strings));
|
||||
|
||||
for (string* i = strings.begin; i != strings.end; i++) {
|
||||
*vector_ssize_t_reserve_back(&string_offsets) = io_get_position(s);
|
||||
@@ -1759,13 +1760,13 @@ static void obj_classic_write_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
|
||||
ssize_t constraint_type_name_offsets[4];
|
||||
constraint_type_name_offsets[0] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Direction");
|
||||
constraint_type_name_offsets[1] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Distance");
|
||||
constraint_type_name_offsets[2] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Orientation");
|
||||
constraint_type_name_offsets[3] = obj_skin_strings_get_string_offset(&strings,
|
||||
constraint_type_name_offsets[1] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Direction");
|
||||
constraint_type_name_offsets[2] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Position");
|
||||
constraint_type_name_offsets[3] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Distance");
|
||||
|
||||
char** bone_names_ptr = ex->bone_names;
|
||||
for (int32_t i = 0; i < ex->blocks_count; i++) {
|
||||
@@ -1906,7 +1907,7 @@ static void obj_classic_write_skin(obj* obj, stream* s, ssize_t base_offset) {
|
||||
io_write_int32_t(s, 0);
|
||||
io_position_pop(s);
|
||||
|
||||
exh.osage_count = (int32_t)(osage_names.end - osage_names.begin);
|
||||
exh.osage_count = (int32_t)vector_length(osage_names);
|
||||
exh.osage_count -= exh.cloth_count;
|
||||
io_position_push(s, exh.osage_names_offset, SEEK_SET);
|
||||
for (string* i = osage_names.begin; i != osage_names.end; i++) {
|
||||
@@ -2012,10 +2013,9 @@ static void obj_classic_read_skin_block_cloth(obj_skin_block_cloth* b,
|
||||
f->field_1C = io_read_uint32_t(s);
|
||||
f->field_20 = io_read_uint32_t(s);
|
||||
f->field_24 = io_read_uint32_t(s);
|
||||
obj_classic_read_skin_block_cloth_field_1C_sub(&f->sub_data_0, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_1C_sub(&f->sub_data_1, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_1C_sub(&f->sub_data_2, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_1C_sub(&f->sub_data_3, s, str);
|
||||
|
||||
for (int32_t j = 0; j < 4; j++)
|
||||
obj_classic_read_skin_block_cloth_field_1C_sub(&f->sub_data[j], s, str);
|
||||
}
|
||||
io_position_pop(s);
|
||||
}
|
||||
@@ -2025,16 +2025,8 @@ static void obj_classic_read_skin_block_cloth(obj_skin_block_cloth* b,
|
||||
b->field_20 = force_malloc_s(obj_skin_block_cloth_field_20, b->count);
|
||||
for (uint32_t i = 0; i < b->count; i++) {
|
||||
obj_skin_block_cloth_field_20* f = &b->field_20[i];
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_0, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_1, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_2, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_3, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_4, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_5, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_6, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_7, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_8, s, str);
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data_9, s, str);
|
||||
for (int32_t j = 0; j < 10; j++)
|
||||
obj_classic_read_skin_block_cloth_field_20_sub(&f->sub_data[j], s, str);
|
||||
}
|
||||
io_position_pop(s);
|
||||
}
|
||||
@@ -2123,10 +2115,10 @@ static void obj_classic_write_skin_block_cloth(obj_skin_block_cloth* b,
|
||||
io_write_uint32_t(s, f->field_1C);
|
||||
io_write_uint32_t(s, f->field_20);
|
||||
io_write_uint32_t(s, f->field_24);
|
||||
obj_classic_write_skin_block_cloth_field_1C_sub(&f->sub_data_0, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_1C_sub(&f->sub_data_1, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_1C_sub(&f->sub_data_2, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_1C_sub(&f->sub_data_3, s, strings, string_offsets);
|
||||
|
||||
for (int32_t j = 0; j < 4; j++)
|
||||
obj_classic_write_skin_block_cloth_field_1C_sub(&f->sub_data[j],
|
||||
s, strings, string_offsets);
|
||||
}
|
||||
io_position_pop(s);
|
||||
*field_1C_offset += (10 * sizeof(int32_t)
|
||||
@@ -2137,16 +2129,9 @@ static void obj_classic_write_skin_block_cloth(obj_skin_block_cloth* b,
|
||||
io_position_push(s, *field_20_offset, SEEK_SET);
|
||||
for (uint32_t i = 0; i < b->count; i++) {
|
||||
obj_skin_block_cloth_field_20* f = &b->field_20[i];
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_0, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_1, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_2, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_3, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_4, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_5, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_6, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_7, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_8, s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data_9, s, strings, string_offsets);
|
||||
for (int32_t j = 0; j < 10; j++)
|
||||
obj_classic_write_skin_block_cloth_field_20_sub(&f->sub_data[j],
|
||||
s, strings, string_offsets);
|
||||
}
|
||||
io_position_pop(s);
|
||||
*field_20_offset += 10 * (11 * sizeof(int32_t)) * b->count;
|
||||
@@ -2241,7 +2226,13 @@ static void obj_classic_read_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
int32_t source_node_name_offset = io_read_int32_t(s);
|
||||
io_read_string_null_terminated_offset(s, source_node_name_offset, &b->source_node_name);
|
||||
|
||||
if (!str_utils_compare(type, "Direction")) {
|
||||
if (!str_utils_compare(type, "Orientation")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION;
|
||||
b->orientation.offset.x = io_read_float_t(s);
|
||||
b->orientation.offset.y = io_read_float_t(s);
|
||||
b->orientation.offset.z = io_read_float_t(s);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Direction")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION;
|
||||
obj_classic_read_skin_block_constraint_up_vector(&b->direction.up_vector,
|
||||
s, str);
|
||||
@@ -2252,6 +2243,15 @@ static void obj_classic_read_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
b->direction.target_offset.y = io_read_float_t(s);
|
||||
b->direction.target_offset.z = io_read_float_t(s);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Position")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_POSITION;
|
||||
obj_classic_read_skin_block_constraint_up_vector(&b->position.up_vector,
|
||||
s, str);
|
||||
obj_classic_read_skin_block_constraint_attach_point(&b->position.constrained_object,
|
||||
s, str);
|
||||
obj_classic_read_skin_block_constraint_attach_point(&b->position.constraining_object,
|
||||
s, str);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Distance")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE;
|
||||
obj_classic_read_skin_block_constraint_up_vector(&b->distance.up_vector,
|
||||
@@ -2262,21 +2262,6 @@ static void obj_classic_read_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
obj_classic_read_skin_block_constraint_attach_point(&b->distance.constraining_object,
|
||||
s, str);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Orientation")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION;
|
||||
b->orientation.offset.x = io_read_float_t(s);
|
||||
b->orientation.offset.y = io_read_float_t(s);
|
||||
b->orientation.offset.z = io_read_float_t(s);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Position")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_POSITION;
|
||||
obj_classic_read_skin_block_constraint_up_vector(&b->position.up_vector,
|
||||
s, str);
|
||||
obj_classic_read_skin_block_constraint_attach_point(&b->position.constrained_object,
|
||||
s, str);
|
||||
obj_classic_read_skin_block_constraint_attach_point(&b->position.constraining_object,
|
||||
s, str);
|
||||
}
|
||||
else
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_NONE;
|
||||
free(type);
|
||||
@@ -2288,16 +2273,16 @@ static void obj_classic_write_skin_block_constraint(obj_skin_block_constraint* b
|
||||
|
||||
ssize_t type_offset = 0;
|
||||
switch (b->type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
type_offset = offsets[0];
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
type_offset = offsets[1];
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
type_offset = offsets[2];
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
type_offset = offsets[3];
|
||||
break;
|
||||
}
|
||||
@@ -2314,6 +2299,11 @@ static void obj_classic_write_skin_block_constraint(obj_skin_block_constraint* b
|
||||
io_write_int32_t(s, (int32_t)source_node_name_offset);
|
||||
|
||||
switch (b->type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write_float_t(s, b->orientation.offset.x);
|
||||
io_write_float_t(s, b->orientation.offset.y);
|
||||
io_write_float_t(s, b->orientation.offset.z);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
obj_classic_write_skin_block_constraint_up_vector(&b->direction.up_vector,
|
||||
s, strings, string_offsets);
|
||||
@@ -2324,6 +2314,14 @@ static void obj_classic_write_skin_block_constraint(obj_skin_block_constraint* b
|
||||
io_write_float_t(s, b->direction.target_offset.y);
|
||||
io_write_float_t(s, b->direction.target_offset.z);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
obj_classic_write_skin_block_constraint_up_vector(&b->position.up_vector,
|
||||
s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_constraint_attach_point(&b->position.constrained_object,
|
||||
s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_constraint_attach_point(&b->position.constraining_object,
|
||||
s, strings, string_offsets);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
obj_classic_write_skin_block_constraint_up_vector(&b->distance.up_vector,
|
||||
s, strings, string_offsets);
|
||||
@@ -2333,19 +2331,6 @@ static void obj_classic_write_skin_block_constraint(obj_skin_block_constraint* b
|
||||
obj_classic_write_skin_block_constraint_attach_point(&b->distance.constraining_object,
|
||||
s, strings, string_offsets);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write_float_t(s, b->orientation.offset.x);
|
||||
io_write_float_t(s, b->orientation.offset.y);
|
||||
io_write_float_t(s, b->orientation.offset.z);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
obj_classic_write_skin_block_constraint_up_vector(&b->position.up_vector,
|
||||
s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_constraint_attach_point(&b->position.constrained_object,
|
||||
s, strings, string_offsets);
|
||||
obj_classic_write_skin_block_constraint_attach_point(&b->position.constraining_object,
|
||||
s, strings, string_offsets);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2776,20 +2761,10 @@ static void obj_classic_read_vertex(obj* obj, stream* s, ssize_t* attrib_offsets
|
||||
break;
|
||||
case OBJ_VERTEX_ATTRIB_BONE_INDEX:
|
||||
for (int32_t j = 0; j < vertex_count; j++) {
|
||||
vec4i bone_index;
|
||||
bone_index.x = (int32_t)io_read_float_t(s);
|
||||
bone_index.y = (int32_t)io_read_float_t(s);
|
||||
bone_index.z = (int32_t)io_read_float_t(s);
|
||||
bone_index.w = (int32_t)io_read_float_t(s);
|
||||
if (bone_index.x == 0xFF)
|
||||
bone_index.x = -1;
|
||||
if (bone_index.y == 0xFF)
|
||||
bone_index.y = -1;
|
||||
if (bone_index.z == 0xFF)
|
||||
bone_index.z = -1;
|
||||
if (bone_index.w == 0xFF)
|
||||
bone_index.w = -1;
|
||||
vec4i_to_vec4iu(bone_index, vtx[j].bone_index);
|
||||
vtx[j].bone_index.x = (int32_t)io_read_float_t(s);
|
||||
vtx[j].bone_index.y = (int32_t)io_read_float_t(s);
|
||||
vtx[j].bone_index.z = (int32_t)io_read_float_t(s);
|
||||
vtx[j].bone_index.w = (int32_t)io_read_float_t(s);
|
||||
}
|
||||
break;
|
||||
case OBJ_VERTEX_ATTRIB_UNKNOWN:
|
||||
@@ -2936,12 +2911,10 @@ static void obj_classic_write_vertex(obj* obj, stream* s, ssize_t* attrib_offset
|
||||
if (_attrib_type & OBJ_VERTEX_ATTRIB_BONE_INDEX) {
|
||||
attrib_offsets[11] = io_get_position(s) - base_offset;
|
||||
for (int32_t i = 0; i < _vertex_count; i++) {
|
||||
vec4 bone_index;
|
||||
vec4i16_to_vec4(vtx[i].bone_index, bone_index);
|
||||
io_write_float_t(s, bone_index.x);
|
||||
io_write_float_t(s, bone_index.y);
|
||||
io_write_float_t(s, bone_index.z);
|
||||
io_write_float_t(s, bone_index.w);
|
||||
io_write_float_t(s, (float_t)vtx[i].bone_index.x);
|
||||
io_write_float_t(s, (float_t)vtx[i].bone_index.y);
|
||||
io_write_float_t(s, (float_t)vtx[i].bone_index.z);
|
||||
io_write_float_t(s, (float_t)vtx[i].bone_index.w);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3464,7 +3437,7 @@ static void obj_modern_write_index(obj* obj, stream* s, bool is_x,
|
||||
vector_enrs_entry* e = &oidx->enrs;
|
||||
enrs_entry ee;
|
||||
bool add_enrs = true;
|
||||
if (e->end - e->begin > 0) {
|
||||
if (vector_length(*e) > 0) {
|
||||
off = (uint32_t)((size_t)e->end[-1].size * e->end[-1].repeat_count);
|
||||
if (e->end[-1].count && e->end[-1].sub.begin[0].type == type) {
|
||||
e->end[-1].repeat_count += sub_mesh->indices_count;
|
||||
@@ -4275,14 +4248,15 @@ static void obj_modern_read_skin(obj* obj, stream* s, ssize_t base_offset,
|
||||
for (int32_t i = 0; i < ex->blocks_count; i++) {
|
||||
obj_skin_block* block = &ex->blocks[i];
|
||||
|
||||
char* block_signature = io_read_utf8_string_null_terminated_offset(s,
|
||||
bhs[i].block_signature_offset);
|
||||
if (utf8_length(block_signature) != 3) {
|
||||
free(block_signature);
|
||||
string block_signature = string_empty;
|
||||
io_read_string_null_terminated_offset(s,
|
||||
bhs[i].block_signature_offset, &block_signature);
|
||||
if (block_signature.length != 3) {
|
||||
string_free(&block_signature);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t signature = load_reverse_endianness_uint32_t(block_signature);
|
||||
uint32_t signature = load_reverse_endianness_uint32_t(string_data(&block_signature));
|
||||
switch (signature) {
|
||||
case 'CLS\0':
|
||||
block->type = OBJ_SKIN_BLOCK_CLOTH;
|
||||
@@ -4317,7 +4291,7 @@ static void obj_modern_read_skin(obj* obj, stream* s, ssize_t base_offset,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
free(block_signature);
|
||||
string_free(&block_signature);
|
||||
}
|
||||
free(bhs);
|
||||
}
|
||||
@@ -4447,10 +4421,9 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
|
||||
for (uint32_t k = 0; k < cloth->count; k++) {
|
||||
obj_skin_block_cloth_field_1C* sub = &cloth->field_1C[k];
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&sub->sub_data_0.bone_name));
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&sub->sub_data_1.bone_name));
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&sub->sub_data_2.bone_name));
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&sub->sub_data_3.bone_name));
|
||||
for (int32_t l = 0; l < 4; l++)
|
||||
obj_skin_strings_push_back_check(&strings,
|
||||
string_data(&sub->sub_data[l].bone_name));
|
||||
}
|
||||
obj_skin_strings_push_back_check(&strings, "CLS");
|
||||
} break;
|
||||
@@ -4461,20 +4434,23 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
bone_names_ptr, constraint->name_index);
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&constraint->source_node_name));
|
||||
switch (constraint->type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
obj_skin_strings_push_back_check(&strings, "Direction");
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&constraint->direction.up_vector.name));
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
obj_skin_strings_push_back_check(&strings, "Distance");
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&constraint->distance.up_vector.name));
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
obj_skin_strings_push_back_check(&strings, "Orientation");
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
obj_skin_strings_push_back_check(&strings, "Direction");
|
||||
obj_skin_strings_push_back_check(&strings,
|
||||
string_data(&constraint->direction.up_vector.name));
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
obj_skin_strings_push_back_check(&strings, "Position");
|
||||
obj_skin_strings_push_back_check(&strings, string_data(&constraint->position.up_vector.name));
|
||||
obj_skin_strings_push_back_check(&strings,
|
||||
string_data(&constraint->position.up_vector.name));
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
obj_skin_strings_push_back_check(&strings, "Distance");
|
||||
obj_skin_strings_push_back_check(&strings,
|
||||
string_data(&constraint->distance.up_vector.name));
|
||||
break;
|
||||
}
|
||||
obj_skin_strings_push_back_check(&strings, "CNS");
|
||||
@@ -4576,7 +4552,7 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
exh.osage_count++;
|
||||
}
|
||||
|
||||
exh.bone_names_count = (int32_t)(bone_names.end - bone_names.begin);
|
||||
exh.bone_names_count = (int32_t)vector_length(bone_names);
|
||||
}
|
||||
|
||||
if (sk->ex_data_init) {
|
||||
@@ -4740,25 +4716,34 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
cns_type = block->constraint.type;
|
||||
if (!is_x)
|
||||
switch (cns_type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
ee = (enrs_entry){ off, 8, 144, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 29, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
ee = (enrs_entry){ off, 8, 136, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 34, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
ee = (enrs_entry){ off, 6, 68, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 17, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
ee = (enrs_entry){ off, 8, 144, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 29, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
ee = (enrs_entry){ off, 8, 132, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 33, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
ee = (enrs_entry){ off, 8, 136, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 34, ENRS_DWORD });
|
||||
break;
|
||||
}
|
||||
else
|
||||
switch (cns_type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
ee = (enrs_entry){ off, 6, 96, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 9, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 4, 2, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 4, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 3, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
ee = (enrs_entry){ off, 8, 144, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
@@ -4770,26 +4755,6 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 6, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
ee = (enrs_entry){ off, 8, 168, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 9, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 4, 2, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 4, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 8, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 11, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
ee = (enrs_entry){ off, 6, 96, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 9, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 4, 2, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 4, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 3, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
ee = (enrs_entry){ off, 8, 160, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
@@ -4801,6 +4766,17 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 10, ENRS_DWORD });
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
ee = (enrs_entry){ off, 8, 168, 0, vector_empty(enrs_sub_entry) };
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 9, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 4, 2, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 4, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 8, ENRS_DWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 1, ENRS_QWORD });
|
||||
vector_enrs_sub_entry_push_back(&ee.sub, &(enrs_sub_entry){ 0, 11, ENRS_DWORD });
|
||||
break;
|
||||
}
|
||||
constraint_count = 1;
|
||||
}
|
||||
@@ -5258,11 +5234,20 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
io_write(s, 0, 0x04);
|
||||
io_write_offset_f2_pof_add(s, 0, 0x20, &pof);
|
||||
switch (block->constraint.type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write(s, 0, 0x0C);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
io_write(s, 0, 0x20);
|
||||
io_write_offset_f2_pof_add(s, 0, 0x20, &pof);
|
||||
io_write(s, 0, 0x18);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
io_write(s, 0, 0x20);
|
||||
io_write_offset_f2_pof_add(s, 0, 0x20, &pof);
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x14);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
io_write(s, 0, 0x20);
|
||||
io_write_offset_f2_pof_add(s, 0, 0x20, &pof);
|
||||
@@ -5270,15 +5255,6 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x14);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write(s, 0, 0x0C);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
io_write(s, 0, 0x20);
|
||||
io_write_offset_f2_pof_add(s, 0, 0x20, &pof);
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x14);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -5295,11 +5271,21 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
io_write(s, 0, 0x08);
|
||||
io_write_offset_x_pof_add(s, 0, &pof);
|
||||
switch (block->constraint.type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write(s, 0, 0x0C);
|
||||
io_write(s, 0, 0x04);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
io_write(s, 0, 0x20);
|
||||
io_write_offset_x_pof_add(s, 0, &pof);
|
||||
io_write(s, 0, 0x18);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
io_write(s, 0, 0x20);
|
||||
io_write_offset_x_pof_add(s, 0, &pof);
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x14);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
io_write(s, 0, 0x20);
|
||||
io_write_offset_x_pof_add(s, 0, &pof);
|
||||
@@ -5308,16 +5294,6 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x04);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write(s, 0, 0x0C);
|
||||
io_write(s, 0, 0x04);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
io_write(s, 0, 0x20);
|
||||
io_write_offset_x_pof_add(s, 0, &pof);
|
||||
io_write(s, 0, 0x14);
|
||||
io_write(s, 0, 0x14);
|
||||
break;
|
||||
}
|
||||
}
|
||||
io_align_write(s, 0x10);
|
||||
@@ -5461,7 +5437,7 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
}
|
||||
}
|
||||
|
||||
vector_ssize_t_reserve(&string_offsets, strings.end - strings.begin);
|
||||
vector_ssize_t_reserve(&string_offsets, vector_length(strings));
|
||||
|
||||
for (string* i = strings.begin; i != strings.end; i++) {
|
||||
ssize_t off = io_get_position(s);
|
||||
@@ -5495,13 +5471,13 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
|
||||
ssize_t constraint_type_name_offsets[4];
|
||||
constraint_type_name_offsets[0] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Direction");
|
||||
constraint_type_name_offsets[1] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Distance");
|
||||
constraint_type_name_offsets[2] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Orientation");
|
||||
constraint_type_name_offsets[3] = obj_skin_strings_get_string_offset(&strings,
|
||||
constraint_type_name_offsets[1] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Direction");
|
||||
constraint_type_name_offsets[2] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Position");
|
||||
constraint_type_name_offsets[3] = obj_skin_strings_get_string_offset(&strings,
|
||||
&string_offsets, "Distance");
|
||||
|
||||
char** bone_names_ptr = ex->bone_names;
|
||||
for (int32_t i = 0; i < ex->blocks_count; i++) {
|
||||
@@ -5691,7 +5667,7 @@ static void obj_modern_write_skin(obj* obj, stream* s,
|
||||
io_write_int32_t(s, 0);
|
||||
io_position_pop(s);
|
||||
|
||||
exh.osage_count = (int32_t)(osage_names.end - osage_names.begin);
|
||||
exh.osage_count = (int32_t)vector_length(osage_names);
|
||||
exh.osage_count -= exh.cloth_count;
|
||||
io_position_push(s, exh.osage_names_offset, SEEK_SET);
|
||||
if (!is_x)
|
||||
@@ -5840,10 +5816,10 @@ static void obj_modern_read_skin_block_cloth(obj_skin_block_cloth* b,
|
||||
f->field_1C = io_read_uint32_t_stream_reverse_endianness(s);
|
||||
f->field_20 = io_read_uint32_t_stream_reverse_endianness(s);
|
||||
f->field_24 = io_read_uint32_t_stream_reverse_endianness(s);
|
||||
obj_modern_read_skin_block_cloth_field_1C_sub(&f->sub_data_0, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_1C_sub(&f->sub_data_1, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_1C_sub(&f->sub_data_2, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_1C_sub(&f->sub_data_3, s, header_length, str, is_x);
|
||||
|
||||
for (int32_t j = 0; j < 4; j++)
|
||||
obj_modern_read_skin_block_cloth_field_1C_sub(&f->sub_data[j],
|
||||
s, header_length, str, is_x);
|
||||
}
|
||||
io_position_pop(s);
|
||||
}
|
||||
@@ -5853,16 +5829,9 @@ static void obj_modern_read_skin_block_cloth(obj_skin_block_cloth* b,
|
||||
b->field_20 = force_malloc_s(obj_skin_block_cloth_field_1C, b->count);
|
||||
for (uint32_t i = 0; i < b->count; i++) {
|
||||
obj_skin_block_cloth_field_20* f = &b->field_20[i];
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_0, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_1, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_2, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_3, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_4, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_5, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_6, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_7, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_8, s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data_9, s, header_length, str, is_x);
|
||||
for (int32_t j = 0; j < 10; j++)
|
||||
obj_modern_read_skin_block_cloth_field_20_sub(&f->sub_data[j],
|
||||
s, header_length, str, is_x);
|
||||
}
|
||||
io_position_pop(s);
|
||||
}
|
||||
@@ -5979,14 +5948,10 @@ static void obj_modern_write_skin_block_cloth(obj_skin_block_cloth* b,
|
||||
io_write_uint32_t(s, f->field_1C);
|
||||
io_write_uint32_t(s, f->field_20);
|
||||
io_write_uint32_t(s, f->field_24);
|
||||
obj_modern_write_skin_block_cloth_field_1C_sub(&f->sub_data_0,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_1C_sub(&f->sub_data_1,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_1C_sub(&f->sub_data_2,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_1C_sub(&f->sub_data_3,
|
||||
s, strings, string_offsets, is_x);
|
||||
|
||||
for (int32_t j = 0; j < 4; j++)
|
||||
obj_modern_write_skin_block_cloth_field_1C_sub(&f->sub_data[j],
|
||||
s, strings, string_offsets, is_x);
|
||||
}
|
||||
io_position_pop(s);
|
||||
if (!is_x)
|
||||
@@ -6001,26 +5966,9 @@ static void obj_modern_write_skin_block_cloth(obj_skin_block_cloth* b,
|
||||
io_position_push(s, *field_20_offset, SEEK_SET);
|
||||
for (uint32_t i = 0; i < b->count; i++) {
|
||||
obj_skin_block_cloth_field_20* f = &b->field_20[i];
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_0,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_1,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_2,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_3,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_4,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_5,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_6,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_7,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_8,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data_9,
|
||||
s, strings, string_offsets, is_x);
|
||||
for (int32_t j = 0; j < 10; j++)
|
||||
obj_modern_write_skin_block_cloth_field_20_sub(&f->sub_data[j],
|
||||
s, strings, string_offsets, is_x);
|
||||
}
|
||||
io_position_pop(s);
|
||||
*field_20_offset += 10 * (11 * sizeof(int32_t)) * b->count;
|
||||
@@ -6119,7 +6067,13 @@ static void obj_modern_read_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
ssize_t source_node_name_offset = io_read_offset(s, header_length, is_x);
|
||||
io_read_string_null_terminated_offset(s, source_node_name_offset, &b->source_node_name);
|
||||
|
||||
if (!str_utils_compare(type, "Direction")) {
|
||||
if (!str_utils_compare(type, "Orientation")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION;
|
||||
b->orientation.offset.x = io_read_float_t_stream_reverse_endianness(s);
|
||||
b->orientation.offset.y = io_read_float_t_stream_reverse_endianness(s);
|
||||
b->orientation.offset.z = io_read_float_t_stream_reverse_endianness(s);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Direction")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION;
|
||||
obj_modern_read_skin_block_constraint_up_vector(&b->direction.up_vector,
|
||||
s, header_length, str, is_x);
|
||||
@@ -6130,6 +6084,15 @@ static void obj_modern_read_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
b->direction.target_offset.y = io_read_float_t_stream_reverse_endianness(s);
|
||||
b->direction.target_offset.z = io_read_float_t_stream_reverse_endianness(s);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Position")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_POSITION;
|
||||
obj_modern_read_skin_block_constraint_up_vector(&b->position.up_vector,
|
||||
s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_constraint_attach_point(&b->position.constrained_object,
|
||||
s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_constraint_attach_point(&b->position.constraining_object,
|
||||
s, header_length, str, is_x);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Distance")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE;
|
||||
obj_modern_read_skin_block_constraint_up_vector(&b->distance.up_vector,
|
||||
@@ -6140,21 +6103,6 @@ static void obj_modern_read_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
obj_modern_read_skin_block_constraint_attach_point(&b->distance.constraining_object,
|
||||
s, header_length, str, is_x);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Orientation")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION;
|
||||
b->orientation.offset.x = io_read_float_t_stream_reverse_endianness(s);
|
||||
b->orientation.offset.y = io_read_float_t_stream_reverse_endianness(s);
|
||||
b->orientation.offset.z = io_read_float_t_stream_reverse_endianness(s);
|
||||
}
|
||||
else if (!str_utils_compare(type, "Position")) {
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_POSITION;
|
||||
obj_modern_read_skin_block_constraint_up_vector(&b->position.up_vector,
|
||||
s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_constraint_attach_point(&b->position.constrained_object,
|
||||
s, header_length, str, is_x);
|
||||
obj_modern_read_skin_block_constraint_attach_point(&b->position.constraining_object,
|
||||
s, header_length, str, is_x);
|
||||
}
|
||||
else
|
||||
b->type = OBJ_SKIN_BLOCK_CONSTRAINT_NONE;
|
||||
free(type);
|
||||
@@ -6167,16 +6115,16 @@ static void obj_modern_write_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
|
||||
ssize_t type_offset = 0;
|
||||
switch (b->type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
type_offset = offsets[0];
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
type_offset = offsets[1];
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
type_offset = offsets[2];
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
type_offset = offsets[3];
|
||||
break;
|
||||
}
|
||||
@@ -6193,6 +6141,11 @@ static void obj_modern_write_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
io_write_offset(s, source_node_name_offset, 0x20, is_x);
|
||||
|
||||
switch (b->type) {
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write_float_t(s, b->orientation.offset.x);
|
||||
io_write_float_t(s, b->orientation.offset.y);
|
||||
io_write_float_t(s, b->orientation.offset.z);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION:
|
||||
obj_modern_write_skin_block_constraint_up_vector(&b->direction.up_vector,
|
||||
s, strings, string_offsets, is_x);
|
||||
@@ -6203,6 +6156,14 @@ static void obj_modern_write_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
io_write_float_t(s, b->direction.target_offset.y);
|
||||
io_write_float_t(s, b->direction.target_offset.z);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
obj_modern_write_skin_block_constraint_up_vector(&b->position.up_vector,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_constraint_attach_point(&b->position.constrained_object,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_constraint_attach_point(&b->position.constraining_object,
|
||||
s, strings, string_offsets, is_x);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE:
|
||||
obj_modern_write_skin_block_constraint_up_vector(&b->distance.up_vector,
|
||||
s, strings, string_offsets, is_x);
|
||||
@@ -6212,19 +6173,6 @@ static void obj_modern_write_skin_block_constraint(obj_skin_block_constraint* b,
|
||||
obj_modern_write_skin_block_constraint_attach_point(&b->distance.constraining_object,
|
||||
s, strings, string_offsets, is_x);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION:
|
||||
io_write_float_t(s, b->orientation.offset.x);
|
||||
io_write_float_t(s, b->orientation.offset.y);
|
||||
io_write_float_t(s, b->orientation.offset.z);
|
||||
break;
|
||||
case OBJ_SKIN_BLOCK_CONSTRAINT_POSITION:
|
||||
obj_modern_write_skin_block_constraint_up_vector(&b->position.up_vector,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_constraint_attach_point(&b->position.constrained_object,
|
||||
s, strings, string_offsets, is_x);
|
||||
obj_modern_write_skin_block_constraint_attach_point(&b->position.constraining_object,
|
||||
s, strings, string_offsets, is_x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6683,7 +6631,7 @@ static void obj_modern_write_vertex(obj* obj, stream* s, bool is_x,
|
||||
vector_enrs_entry* e = &ovtx->enrs;
|
||||
enrs_entry ee;
|
||||
bool add_enrs = true;
|
||||
if (e->end - e->begin > 0) {
|
||||
if (vector_length(*e) > 0) {
|
||||
off = (uint32_t)((size_t)e->end[-1].size * e->end[-1].repeat_count);
|
||||
if (e->end[-1].sub.begin[2].repeat_count == enrs_se3_rc) {
|
||||
e->end[-1].repeat_count += _vertex_count;
|
||||
|
||||
+5
-16
@@ -122,10 +122,10 @@ typedef enum obj_primitive_type {
|
||||
|
||||
typedef enum obj_skin_block_constraint_type {
|
||||
OBJ_SKIN_BLOCK_CONSTRAINT_NONE = 0,
|
||||
OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION,
|
||||
OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE,
|
||||
OBJ_SKIN_BLOCK_CONSTRAINT_ORIENTATION,
|
||||
OBJ_SKIN_BLOCK_CONSTRAINT_DIRECTION,
|
||||
OBJ_SKIN_BLOCK_CONSTRAINT_POSITION,
|
||||
OBJ_SKIN_BLOCK_CONSTRAINT_DISTANCE,
|
||||
} obj_skin_block_constraint_type;
|
||||
|
||||
typedef enum obj_skin_block_constraint_coupling {
|
||||
@@ -337,10 +337,7 @@ typedef struct obj_skin_block_cloth_field_1C {
|
||||
uint32_t field_1C;
|
||||
uint32_t field_20;
|
||||
uint32_t field_24;
|
||||
obj_skin_block_cloth_field_1C_sub sub_data_0;
|
||||
obj_skin_block_cloth_field_1C_sub sub_data_1;
|
||||
obj_skin_block_cloth_field_1C_sub sub_data_2;
|
||||
obj_skin_block_cloth_field_1C_sub sub_data_3;
|
||||
obj_skin_block_cloth_field_1C_sub sub_data[4];
|
||||
} obj_skin_block_cloth_field_1C;
|
||||
|
||||
typedef struct obj_skin_block_cloth_field_20_sub {
|
||||
@@ -358,16 +355,7 @@ typedef struct obj_skin_block_cloth_field_20_sub {
|
||||
} obj_skin_block_cloth_field_20_sub;
|
||||
|
||||
typedef struct obj_skin_block_cloth_field_20 {
|
||||
obj_skin_block_cloth_field_20_sub sub_data_0;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_1;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_2;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_3;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_4;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_5;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_6;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_7;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_8;
|
||||
obj_skin_block_cloth_field_20_sub sub_data_9;
|
||||
obj_skin_block_cloth_field_20_sub sub_data[10];
|
||||
} obj_skin_block_cloth_field_20;
|
||||
|
||||
typedef struct obj_skin_block_node {
|
||||
@@ -488,6 +476,7 @@ typedef struct obj_skin_block_osage {
|
||||
typedef struct obj_skin_block {
|
||||
obj_skin_block_type type;
|
||||
union {
|
||||
obj_skin_block_node base;
|
||||
obj_skin_block_cloth cloth;
|
||||
obj_skin_block_constraint constraint;
|
||||
obj_skin_block_expression expression;
|
||||
|
||||
@@ -0,0 +1,370 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "pvpp.h"
|
||||
#include "f2/struct.h"
|
||||
#include "io/path.h"
|
||||
#include "io/stream.h"
|
||||
#include "str_utils.h"
|
||||
|
||||
vector_func(pvpp_a3da)
|
||||
vector_func(pvpp_chara)
|
||||
vector_func(pvpp_chara_item)
|
||||
vector_func(pvpp_chara_effect)
|
||||
vector_func(pvpp_chara_effect_a3da)
|
||||
vector_func(pvpp_effect)
|
||||
vector_func(pvpp_glitter)
|
||||
vector_func(pvpp_motion)
|
||||
|
||||
static void pvpp_a3da_init(pvpp_a3da* a3d);
|
||||
static void pvpp_a3da_read(pvpp_a3da* a3d, stream* s);
|
||||
static void pvpp_a3da_free(pvpp_a3da* a3d);
|
||||
static void pvpp_chara_init(pvpp_chara* chr);
|
||||
static void pvpp_chara_read(pvpp_chara* chr, stream* s);
|
||||
static void pvpp_chara_free(pvpp_chara* chr);
|
||||
static void pvpp_chara_effect_init(pvpp_chara_effect* chr_eff);
|
||||
static void pvpp_chara_effect_read(pvpp_chara_effect* chr_eff, stream* s);
|
||||
static void pvpp_chara_effect_free(pvpp_chara_effect* chr_eff);
|
||||
static void pvpp_chara_effect_a3da_init(pvpp_chara_effect_a3da* chr_pv_eff);
|
||||
static void pvpp_chara_effect_a3da_read(pvpp_chara_effect_a3da* chr_pv_eff, stream* s);
|
||||
static void pvpp_chara_effect_a3da_free(pvpp_chara_effect_a3da* chr_pv_eff);
|
||||
static void pvpp_chara_item_init(pvpp_chara_item* chr_itm);
|
||||
static void pvpp_chara_item_read(pvpp_chara_item* chr_itm, stream* s);
|
||||
static void pvpp_chara_item_free(pvpp_chara_item* chr_itm);
|
||||
static void pvpp_effect_init(pvpp_effect* eff);
|
||||
static void pvpp_effect_read(pvpp_effect* eff, stream* s);
|
||||
static void pvpp_effect_free(pvpp_effect* eff);
|
||||
static void pvpp_glitter_init(pvpp_glitter* glt);
|
||||
static void pvpp_glitter_read(pvpp_glitter* glt, stream* s);
|
||||
static void pvpp_glitter_free(pvpp_glitter* glt);
|
||||
static void pvpp_motion_init(pvpp_motion* mot);
|
||||
static void pvpp_motion_read(pvpp_motion* mot, stream* s);
|
||||
static void pvpp_motion_free(pvpp_motion* mot);
|
||||
static void pvpp_read_inner(pvpp* pp, stream* s);
|
||||
|
||||
void pvpp_init(pvpp* pp) {
|
||||
memset(pp, 0, sizeof(pvpp));
|
||||
}
|
||||
|
||||
void pvpp_read(pvpp* pp, char* path) {
|
||||
if (!pp || !path)
|
||||
return;
|
||||
|
||||
char* path_pvpp = str_utils_add(path, ".pvpp");
|
||||
if (path_check_file_exists(path_pvpp)) {
|
||||
stream s;
|
||||
io_open(&s, path_pvpp, "rb");
|
||||
if (s.io.stream)
|
||||
pvpp_read_inner(pp, &s);
|
||||
io_free(&s);
|
||||
}
|
||||
free(path_pvpp);
|
||||
}
|
||||
|
||||
void pvpp_wread(pvpp* pp, wchar_t* path) {
|
||||
if (!pp || !path)
|
||||
return;
|
||||
|
||||
wchar_t* path_pvpp = str_utils_wadd(path, L".pvpp");
|
||||
if (path_wcheck_file_exists(path_pvpp)) {
|
||||
stream s;
|
||||
io_wopen(&s, path_pvpp, L"rb");
|
||||
if (s.io.stream)
|
||||
pvpp_read_inner(pp, &s);
|
||||
io_free(&s);
|
||||
}
|
||||
free(path_pvpp);
|
||||
}
|
||||
|
||||
bool pvpp_load_file(void* data, char* path, char* file, uint32_t hash) {
|
||||
size_t file_len = utf8_length(file);
|
||||
|
||||
char* t = strrchr(file, '.');
|
||||
if (t)
|
||||
file_len = t - file;
|
||||
|
||||
string s;
|
||||
string_init(&s, path);
|
||||
string_add_length(&s, file, file_len);
|
||||
|
||||
pvpp* pp = data;
|
||||
pvpp_read(pp, string_data(&s));
|
||||
|
||||
string_free(&s);
|
||||
return pp->ready;
|
||||
}
|
||||
|
||||
void pvpp_free(pvpp* pp) {
|
||||
vector_pvpp_chara_free(&pp->chara, pvpp_chara_free);
|
||||
vector_pvpp_effect_free(&pp->effect, pvpp_effect_free);
|
||||
}
|
||||
|
||||
static void pvpp_a3da_init(pvpp_a3da* a3d) {
|
||||
memset(a3d, 0, sizeof(pvpp_a3da));
|
||||
}
|
||||
|
||||
static void pvpp_a3da_read(pvpp_a3da* a3d, stream* s) {
|
||||
io_read_string_null_terminated_offset(s, io_read_offset_x(s), &a3d->name);
|
||||
a3d->hash = io_read_uint32_t_stream_reverse_endianness(s);
|
||||
io_align_read(s, 0x08);
|
||||
}
|
||||
|
||||
static void pvpp_a3da_free(pvpp_a3da* a3d) {
|
||||
memset(a3d, 0, sizeof(pvpp_a3da));
|
||||
}
|
||||
|
||||
static void pvpp_chara_init(pvpp_chara* chr) {
|
||||
memset(chr, 0, sizeof(pvpp_chara));
|
||||
}
|
||||
|
||||
static void pvpp_chara_read(pvpp_chara* chr, stream* s) {
|
||||
uint8_t u00 = io_read_uint8_t(s);
|
||||
uint8_t chr_eff_count = io_read_uint8_t(s);
|
||||
uint8_t motion_count = io_read_uint8_t(s);
|
||||
uint8_t a3da_count = io_read_uint8_t(s);
|
||||
uint8_t item_count = io_read_uint8_t(s);
|
||||
uint8_t u05 = io_read_uint8_t(s);
|
||||
uint8_t glitter_count = io_read_uint8_t(s);
|
||||
uint8_t u07 = io_read_uint8_t(s);
|
||||
size_t chr_eff_offset = io_read_offset_x(s);
|
||||
size_t motion_offset = io_read_offset_x(s);
|
||||
size_t a3da_offset = io_read_offset_x(s);
|
||||
size_t item_offset = io_read_offset_x(s);
|
||||
size_t glitter_offset = io_read_offset_x(s);
|
||||
size_t o30 = io_read_offset_x(s);
|
||||
|
||||
vector_pvpp_chara_effect_reserve(&chr->chara_effect, chr_eff_count);
|
||||
chr->chara_effect.end += chr_eff_count;
|
||||
|
||||
io_position_push(s, chr_eff_offset, SEEK_SET);
|
||||
for (int32_t j = 0; j < chr_eff_count; j++)
|
||||
pvpp_chara_effect_read(&chr->chara_effect.begin[j], s);
|
||||
io_position_pop(s);
|
||||
|
||||
vector_pvpp_motion_reserve(&chr->motion, motion_count);
|
||||
chr->motion.end += motion_count;
|
||||
|
||||
io_position_push(s, motion_offset, SEEK_SET);
|
||||
for (int32_t j = 0; j < motion_count; j++) {
|
||||
io_position_push(s, io_read_offset_x(s), SEEK_SET);
|
||||
pvpp_motion_read(&chr->motion.begin[j], s);
|
||||
io_position_pop(s);
|
||||
}
|
||||
io_position_pop(s);
|
||||
|
||||
vector_pvpp_a3da_reserve(&chr->a3da, a3da_count);
|
||||
chr->a3da.end += a3da_count;
|
||||
|
||||
io_position_push(s, a3da_offset, SEEK_SET);
|
||||
for (int32_t j = 0; j < a3da_count; j++)
|
||||
pvpp_a3da_read(&chr->a3da.begin[j], s);
|
||||
io_position_pop(s);
|
||||
|
||||
vector_pvpp_chara_item_reserve(&chr->item, item_count);
|
||||
chr->item.end += item_count;
|
||||
|
||||
io_position_push(s, item_offset, SEEK_SET);
|
||||
for (int32_t j = 0; j < item_count; j++)
|
||||
pvpp_chara_item_read(&chr->item.begin[j], s);
|
||||
io_position_pop(s);
|
||||
|
||||
vector_pvpp_glitter_reserve(&chr->glitter, glitter_count);
|
||||
chr->glitter.end += glitter_count;
|
||||
|
||||
io_position_push(s, glitter_offset, SEEK_SET);
|
||||
for (int32_t j = 0; j < glitter_count; j++)
|
||||
pvpp_glitter_read(&chr->glitter.begin[j], s);
|
||||
io_position_pop(s);
|
||||
}
|
||||
|
||||
static void pvpp_chara_free(pvpp_chara* chr) {
|
||||
vector_pvpp_a3da_free(&chr->a3da, pvpp_a3da_free);
|
||||
vector_pvpp_chara_effect_free(&chr->chara_effect, pvpp_chara_effect_free);
|
||||
vector_pvpp_chara_item_free(&chr->item, pvpp_chara_item_free);
|
||||
vector_pvpp_glitter_free(&chr->glitter, pvpp_glitter_free);
|
||||
vector_pvpp_motion_free(&chr->motion, pvpp_motion_free);
|
||||
}
|
||||
|
||||
static void pvpp_chara_effect_init(pvpp_chara_effect* chr_eff) {
|
||||
memset(chr_eff, 0, sizeof(pvpp_chara_effect));
|
||||
}
|
||||
|
||||
static void pvpp_chara_effect_read(pvpp_chara_effect* chr_eff, stream* s) {
|
||||
chr_eff->base_chara = io_read_uint8_t(s);
|
||||
uint8_t pv_effects_count = io_read_uint8_t(s);
|
||||
size_t pv_effects_offstet = io_read_offset_x(s);
|
||||
|
||||
vector_pvpp_chara_effect_a3da_reserve(&chr_eff->effect_a3da, pv_effects_count);
|
||||
chr_eff->effect_a3da.end += pv_effects_count;
|
||||
|
||||
io_position_push(s, pv_effects_offstet, SEEK_SET);
|
||||
for (int32_t k = 0; k < pv_effects_count; k++)
|
||||
pvpp_chara_effect_a3da_read(&chr_eff->effect_a3da.begin[k], s);
|
||||
io_position_pop(s);
|
||||
}
|
||||
|
||||
static void pvpp_chara_effect_free(pvpp_chara_effect* chr_eff) {
|
||||
vector_pvpp_chara_effect_a3da_free(&chr_eff->effect_a3da, pvpp_chara_effect_a3da_free);
|
||||
}
|
||||
|
||||
static void pvpp_chara_effect_a3da_init(pvpp_chara_effect_a3da* chr_eff_a3da) {
|
||||
memset(chr_eff_a3da, 0, sizeof(pvpp_chara_effect_a3da));
|
||||
}
|
||||
|
||||
static void pvpp_chara_effect_a3da_read(pvpp_chara_effect_a3da* chr_eff_a3da, stream* s) {
|
||||
chr_eff_a3da->u00 = io_read_uint8_t(s);
|
||||
chr_eff_a3da->u01 = io_read_uint8_t(s);
|
||||
chr_eff_a3da->u02 = io_read_uint8_t(s);
|
||||
chr_eff_a3da->u03 = io_read_uint8_t(s);
|
||||
chr_eff_a3da->u04 = io_read_uint8_t(s);
|
||||
chr_eff_a3da->u05 = io_read_uint8_t(s);
|
||||
chr_eff_a3da->u06 = io_read_uint8_t(s);
|
||||
chr_eff_a3da->u07 = io_read_uint8_t(s);
|
||||
size_t a3da_offset = io_read_offset_x(s);
|
||||
size_t o10 = io_read_offset_x(s);
|
||||
|
||||
io_position_push(s, a3da_offset, SEEK_SET);
|
||||
pvpp_a3da_read(&chr_eff_a3da->a3da, s);
|
||||
io_position_pop(s);
|
||||
}
|
||||
|
||||
static void pvpp_chara_effect_a3da_free(pvpp_chara_effect_a3da* chr_eff_a3da) {
|
||||
pvpp_a3da_free(&chr_eff_a3da->a3da);
|
||||
}
|
||||
|
||||
static void pvpp_chara_item_init(pvpp_chara_item* chr_itm) {
|
||||
memset(chr_itm, 0, sizeof(pvpp_chara_item));
|
||||
}
|
||||
|
||||
static void pvpp_chara_item_read(pvpp_chara_item* chr_itm, stream* s) {
|
||||
uint8_t a3das_count = io_read_uint8_t(s);
|
||||
size_t a3das_offset = io_read_offset_x(s);
|
||||
size_t bone_offset = io_read_offset_x(s);
|
||||
chr_itm->u18.x = io_read_float_t_stream_reverse_endianness(s);
|
||||
chr_itm->u18.y = io_read_float_t_stream_reverse_endianness(s);
|
||||
chr_itm->u18.z = io_read_float_t_stream_reverse_endianness(s);
|
||||
chr_itm->u18.w = io_read_float_t_stream_reverse_endianness(s);
|
||||
|
||||
vector_pvpp_a3da_reserve(&chr_itm->a3da, a3das_count);
|
||||
chr_itm->a3da.end += a3das_count;
|
||||
|
||||
io_position_push(s, a3das_offset, SEEK_SET);
|
||||
for (int32_t k = 0; k < a3das_count; k++)
|
||||
pvpp_a3da_read(&chr_itm->a3da.begin[k], s);
|
||||
io_position_pop(s);
|
||||
|
||||
io_read_string_null_terminated_offset(s, bone_offset, &chr_itm->bone);
|
||||
}
|
||||
|
||||
static void pvpp_chara_item_free(pvpp_chara_item* chr_itm) {
|
||||
vector_pvpp_a3da_free(&chr_itm->a3da, pvpp_a3da_free);
|
||||
string_free(&chr_itm->bone);
|
||||
}
|
||||
|
||||
static void pvpp_effect_init(pvpp_effect* eff) {
|
||||
memset(eff, 0, sizeof(pvpp_effect));
|
||||
}
|
||||
|
||||
static void pvpp_effect_read(pvpp_effect* eff, stream* s) {
|
||||
uint8_t a3da_count = io_read_uint8_t(s);
|
||||
uint8_t effect_count = io_read_uint8_t(s);
|
||||
eff->chara_index = io_read_uint8_t(s);
|
||||
ssize_t a3da_offset = io_read_offset_x(s);
|
||||
ssize_t effect_offset = io_read_offset_x(s);
|
||||
|
||||
vector_pvpp_a3da_reserve(&eff->a3da, a3da_count);
|
||||
eff->a3da.end += a3da_count;
|
||||
|
||||
io_position_push(s, a3da_offset, SEEK_SET);
|
||||
for (int32_t j = 0; j < a3da_count; j++)
|
||||
pvpp_a3da_read(&eff->a3da.begin[j], s);
|
||||
io_position_pop(s);
|
||||
|
||||
vector_pvpp_glitter_reserve(&eff->glitter, effect_count);
|
||||
eff->glitter.end += effect_count;
|
||||
|
||||
io_position_push(s, effect_offset, SEEK_SET);
|
||||
for (int32_t j = 0; j < effect_count; j++)
|
||||
pvpp_glitter_read(&eff->glitter.begin[j], s);
|
||||
io_position_pop(s);
|
||||
}
|
||||
|
||||
static void pvpp_effect_free(pvpp_effect* eff) {
|
||||
vector_pvpp_a3da_free(&eff->a3da, pvpp_a3da_free);
|
||||
vector_pvpp_glitter_free(&eff->glitter, pvpp_glitter_free);
|
||||
}
|
||||
|
||||
static void pvpp_glitter_init(pvpp_glitter* glt) {
|
||||
memset(glt, 0, sizeof(pvpp_glitter));
|
||||
}
|
||||
|
||||
static void pvpp_glitter_read(pvpp_glitter* glt, stream* s) {
|
||||
io_read_string_null_terminated_offset(s, io_read_offset_x(s), &glt->name);
|
||||
io_read_string_null_terminated_offset(s, io_read_offset_x(s), &glt->unk1);
|
||||
glt->unk2 = io_read_uint8_t(s) ? true : false;
|
||||
io_align_read(s, 0x08);
|
||||
}
|
||||
|
||||
static void pvpp_glitter_free(pvpp_glitter* glt) {
|
||||
string_free(&glt->name);
|
||||
string_free(&glt->unk1);
|
||||
}
|
||||
|
||||
static void pvpp_motion_init(pvpp_motion* mot) {
|
||||
memset(mot, 0, sizeof(pvpp_motion));
|
||||
}
|
||||
|
||||
static void pvpp_motion_read(pvpp_motion* mot, stream* s) {
|
||||
io_read_string_null_terminated_offset(s, io_read_offset_x(s), &mot->name);
|
||||
mot->hash = io_read_uint32_t_stream_reverse_endianness(s);
|
||||
io_align_read(s, 0x08);
|
||||
}
|
||||
|
||||
static void pvpp_motion_free(pvpp_motion* mot) {
|
||||
string_free(&mot->name);
|
||||
}
|
||||
|
||||
static void pvpp_read_inner(pvpp* pp, stream* s) {
|
||||
f2_struct st;
|
||||
f2_struct_sread(&st, s);
|
||||
if (st.header.signature == reverse_endianness_uint32_t('PVPP') && st.data) {
|
||||
stream s_pvpp;
|
||||
io_mopen(&s_pvpp, st.data, st.length);
|
||||
s_pvpp.is_big_endian = st.header.use_big_endian;
|
||||
|
||||
io_read_uint32_t_stream_reverse_endianness(&s_pvpp);
|
||||
uint8_t chara_count = io_read_uint8_t(&s_pvpp);
|
||||
ssize_t effect_offset = io_read_offset_x(&s_pvpp);
|
||||
ssize_t chara_offset = io_read_offset_x(&s_pvpp);
|
||||
io_read_offset_x(&s_pvpp);
|
||||
|
||||
vector_pvpp_chara_reserve(&pp->chara, chara_count);
|
||||
pp->chara.end += chara_count;
|
||||
|
||||
io_position_push(&s_pvpp, chara_offset, SEEK_SET);
|
||||
for (int32_t i = 0; i < chara_count; i++)
|
||||
pvpp_chara_read(&pp->chara.begin[i], &s_pvpp);
|
||||
io_position_pop(&s_pvpp);
|
||||
|
||||
io_position_push(&s_pvpp, effect_offset, SEEK_SET);
|
||||
io_read_uint8_t(&s_pvpp);
|
||||
uint8_t efffect_count = io_read_uint8_t(&s_pvpp);
|
||||
effect_offset = io_read_offset_x(&s_pvpp);
|
||||
io_position_pop(&s_pvpp);
|
||||
|
||||
vector_pvpp_effect_reserve(&pp->effect, efffect_count);
|
||||
pp->effect.end += efffect_count;
|
||||
|
||||
io_position_push(&s_pvpp, effect_offset, SEEK_SET);
|
||||
for (int32_t i = 0; i < efffect_count; i++)
|
||||
pvpp_effect_read(&pp->effect.begin[i], &s_pvpp);
|
||||
io_position_pop(&s_pvpp);
|
||||
|
||||
io_free(&s_pvpp);
|
||||
|
||||
pp->ready = true;
|
||||
}
|
||||
f2_struct_free(&st);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "default.h"
|
||||
#include "string.h"
|
||||
#include "vec.h"
|
||||
#include "vector.h"
|
||||
|
||||
typedef enum pvpp_chara_type {
|
||||
PVPP_CHARA_MIKU = 0,
|
||||
PVPP_CHARA_RIN = 1,
|
||||
PVPP_CHARA_LEN = 2,
|
||||
PVPP_CHARA_LUKA = 3,
|
||||
PVPP_CHARA_NERU = 4,
|
||||
PVPP_CHARA_HAKU = 5,
|
||||
PVPP_CHARA_KAITO = 6,
|
||||
PVPP_CHARA_MEIKO = 7,
|
||||
PVPP_CHARA_SAKINE = 8,
|
||||
PVPP_CHARA_TETO = 9,
|
||||
PVPP_CHARA_EXTRA = 10,
|
||||
PVPP_CHARA_STAGE = 255,
|
||||
} pvpp_chara_type;
|
||||
|
||||
typedef struct pvpp_a3da {
|
||||
uint32_t hash;
|
||||
string name;
|
||||
} pvpp_a3da;
|
||||
|
||||
typedef struct pvpp_chara_effect_a3da {
|
||||
pvpp_a3da a3da;
|
||||
uint8_t u00;
|
||||
uint8_t u01;
|
||||
uint8_t u02;
|
||||
uint8_t u03;
|
||||
uint8_t u04;
|
||||
uint8_t u05;
|
||||
uint8_t u06;
|
||||
uint8_t u07;
|
||||
} pvpp_chara_effect_a3da;
|
||||
|
||||
vector(pvpp_chara_effect_a3da)
|
||||
|
||||
typedef struct pvpp_chara_effect {
|
||||
pvpp_chara_type base_chara;
|
||||
vector_pvpp_chara_effect_a3da effect_a3da;
|
||||
} pvpp_chara_effect;
|
||||
|
||||
vector(pvpp_a3da)
|
||||
|
||||
typedef struct pvpp_chara_item {
|
||||
vector_pvpp_a3da a3da;
|
||||
string bone;
|
||||
vec4u u18;
|
||||
} pvpp_chara_item;
|
||||
|
||||
typedef struct pvpp_glitter {
|
||||
string name;
|
||||
string unk1;
|
||||
bool unk2;
|
||||
} pvpp_glitter;
|
||||
|
||||
typedef struct pvpp_motion {
|
||||
uint32_t hash;
|
||||
string name;
|
||||
} pvpp_motion;
|
||||
|
||||
vector(pvpp_glitter)
|
||||
|
||||
typedef struct pvpp_effect {
|
||||
vector_pvpp_a3da a3da;
|
||||
pvpp_chara_type chara_index;
|
||||
vector_pvpp_glitter glitter;
|
||||
} pvpp_effect;
|
||||
|
||||
vector(pvpp_chara_effect)
|
||||
vector(pvpp_motion)
|
||||
vector(pvpp_chara_item)
|
||||
|
||||
typedef struct pvpp_chara {
|
||||
vector_pvpp_a3da a3da;
|
||||
vector_pvpp_chara_item item;
|
||||
vector_pvpp_chara_effect chara_effect;
|
||||
vector_pvpp_glitter glitter;
|
||||
vector_pvpp_motion motion;
|
||||
} pvpp_chara;
|
||||
|
||||
vector(pvpp_chara)
|
||||
vector(pvpp_effect)
|
||||
|
||||
typedef struct pvpp {
|
||||
bool ready;
|
||||
|
||||
vector_pvpp_chara chara;
|
||||
vector_pvpp_effect effect;
|
||||
} pvpp;
|
||||
|
||||
extern void pvpp_init(pvpp* pp);
|
||||
extern void pvpp_read(pvpp* pp, char* path);
|
||||
extern void pvpp_wread(pvpp* pp, wchar_t* path);
|
||||
extern bool pvpp_load_file(void* data, char* path, char* file, uint32_t hash);
|
||||
extern void pvpp_free(pvpp* pp);
|
||||
@@ -0,0 +1,558 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "pvsr.h"
|
||||
|
||||
/*
|
||||
private struct PVSR
|
||||
{
|
||||
public StageEffect[] StageEffects;
|
||||
public Effect[] EffectList;
|
||||
public string[] EMCSList;
|
||||
public StageEffect?[] StageChangeEffects;
|
||||
public AET[] AETs;
|
||||
|
||||
public struct AET
|
||||
{
|
||||
public ushort U48;
|
||||
public ushort U4A;
|
||||
public ushort U4C;
|
||||
public ushort U4E;
|
||||
public ushort U50;
|
||||
public ushort U52;
|
||||
public ushort U54;
|
||||
public ushort U56;
|
||||
public ushort U58;
|
||||
public ushort U5A;
|
||||
public ushort U5C;
|
||||
public ushort U5E;
|
||||
public ushort U60;
|
||||
|
||||
public string SetName;
|
||||
public AETEntry[] FrontList;
|
||||
public AETEntry[] FrontLowList;
|
||||
public AETEntry[] BackList;
|
||||
public Sub1? Sub1Data;
|
||||
public Sub2? Sub2AData;
|
||||
public Sub2? Sub2BData;
|
||||
public Sub2? Sub2CData;
|
||||
public Sub2? Sub2DData;
|
||||
public AETEntry[] Unk03List;
|
||||
public AETEntry[] Unk04List;
|
||||
|
||||
public override string ToString() =>
|
||||
$"(Set Name: {SetName}; Front List Count: {(FrontList != null ? FrontList.Length : 0)}"
|
||||
+ $"; Front Low List Count: {(FrontLowList != null ? FrontLowList.Length : 0)}"
|
||||
+ $"; Back List Count: {(BackList != null ? BackList.Length : 0)}"
|
||||
+ $"; U48: {U48}; U4A: {U4A}; U4C: {U4C}; U4E: {U4E}; U4C: {U4C}; U50: {U50}; U52: {U52}"
|
||||
+ $"; U54: {U54}; U56: {U56}; U58: {U58}; U5A: {U5A}; U5E: {U5E}; U60: {U60}"
|
||||
+ $"; Unk 3 List Count: {(Unk03List != null ? Unk03List.Length : 0)}"
|
||||
+ $"; Unk 4 List Count: {(Unk04List != null ? Unk04List.Length : 0)}";
|
||||
|
||||
public struct Sub1
|
||||
{
|
||||
public string Name;
|
||||
public uint Hash;
|
||||
public ushort Unk2;
|
||||
|
||||
public override string ToString() =>
|
||||
$"(Name: {Name}; Hash: {Hash:X08}; Unk 2: {Unk2})";
|
||||
}
|
||||
|
||||
public struct Sub2
|
||||
{
|
||||
public ushort U00;
|
||||
public ushort U02;
|
||||
public ushort U04;
|
||||
public ushort U06;
|
||||
public ushort U08;
|
||||
public ushort U0A;
|
||||
public ushort U0C;
|
||||
|
||||
public override string ToString() =>
|
||||
$"(U00: {U00}; U02: {U02}; U04: {U04}; U06: {U06}; U08: {U08}; U0A: {U0A})";
|
||||
}
|
||||
}
|
||||
|
||||
public struct AETEntry
|
||||
{
|
||||
public string Name;
|
||||
public uint Hash;
|
||||
public float BrightScale;
|
||||
|
||||
public override string ToString() =>
|
||||
$"(Name: {Name}; Hash: {Hash:X08}; Bright Scale: {BrightScale})";
|
||||
}
|
||||
|
||||
public struct A3DAEntry
|
||||
{
|
||||
public string Name;
|
||||
public uint Hash;
|
||||
|
||||
public override string ToString() =>
|
||||
$"(Name: {Name}; Hash: {Hash:X08})";
|
||||
}
|
||||
|
||||
public struct Effect
|
||||
{
|
||||
public string Name;
|
||||
public float Emission;
|
||||
|
||||
public override string ToString() =>
|
||||
$"(Name: {Name}; Emission: {Emission})";
|
||||
}
|
||||
|
||||
public struct Glitter
|
||||
{
|
||||
public string Name;
|
||||
public byte Unk1;
|
||||
|
||||
public override string ToString() =>
|
||||
$"(Name: {Name}; Unk 1: {Unk1})";
|
||||
}
|
||||
|
||||
public struct StageEffect
|
||||
{
|
||||
public A3DAEntry[] A3DAs;
|
||||
public Glitter[] Glitters;
|
||||
|
||||
public override string ToString() =>
|
||||
$"A3DAs Count: {(A3DAs != null ? A3DAs.Length : 0)}"
|
||||
+ $"; Effects Count: {(Glitters != null ? Glitters.Length : 0)})";
|
||||
}
|
||||
}
|
||||
|
||||
private static PVSR PVSRReader(string file)
|
||||
{
|
||||
int i, j;
|
||||
KKdBaseLib.F2.Struct st = File.ReadAllBytes(file + ".pvsr").RSt();
|
||||
|
||||
PVSR pvsr = default;
|
||||
Stream s = File.OpenReader(st.Data);
|
||||
s.IsBE = st.Header.UseBigEndian;
|
||||
s.IsX = true;
|
||||
|
||||
int x00 = s.RI32E();
|
||||
byte x04 = s.RU8();
|
||||
byte x05 = s.RU8();
|
||||
byte x06 = s.RU8();
|
||||
byte x07 = s.RU8();
|
||||
byte stageEffectsCount = s.RU8();
|
||||
byte aetsCount = s.RU8();
|
||||
byte x0A = s.RU8();
|
||||
byte x0B = s.RU8();
|
||||
byte x0C = s.RU8();
|
||||
byte x0D = s.RU8();
|
||||
byte x0E = s.RU8();
|
||||
byte x0F = s.RU8();
|
||||
long x10 = s.RI64E();
|
||||
long stageEffectsOffset = s.RI64E();
|
||||
long stageEffectsListOffset = s.RI64E();
|
||||
long aetsOffset = s.RI64E();
|
||||
|
||||
s.PI64 = x10;
|
||||
byte UnknownsCount = s.RU8();
|
||||
byte EffectsCount = s.RU8();
|
||||
byte EMCSsCount = s.RU8();
|
||||
s.A(0x08);
|
||||
long UnknownOffset = s.RI64E();
|
||||
long EffectsOffset = s.RI64E();
|
||||
long EMCSsOffset = s.RI64E();
|
||||
|
||||
s.PI64 = EffectsOffset;
|
||||
pvsr.EffectList = new PVSR.Effect[EffectsCount];
|
||||
for (i = 0; i < EffectsCount; i++)
|
||||
{
|
||||
ref PVSR.Effect effect = ref pvsr.EffectList[i];
|
||||
effect.Name = s.RSaO();
|
||||
effect.Emission = s.RF32E();
|
||||
s.A(0x08);
|
||||
}
|
||||
|
||||
s.PI64 = EMCSsOffset;
|
||||
pvsr.EMCSList = new string[EMCSsCount];
|
||||
for (i = 0; i < EMCSsCount; i++)
|
||||
pvsr.EMCSList[i] = s.RSaO();
|
||||
|
||||
s.PI64 = stageEffectsOffset;
|
||||
pvsr.StageEffects = new PVSR.StageEffect[stageEffectsCount];
|
||||
for (i = 0; i < stageEffectsCount; i++)
|
||||
pvsr.StageEffects[i] = readStageEffect();
|
||||
|
||||
s.PI64 = stageEffectsListOffset;
|
||||
pvsr.StageChangeEffects = new PVSR.StageEffect?[0x100];
|
||||
for (i = 0; i < 0x100; i++)
|
||||
{
|
||||
long o = s.RI64E();
|
||||
if (o > 0)
|
||||
pvsr.StageChangeEffects[i] = readStageEffect(o);
|
||||
|
||||
}
|
||||
|
||||
s.PI64 = aetsOffset;
|
||||
pvsr.AETs = new PVSR.AET[aetsCount];
|
||||
for (i = 0; i < aetsCount; i++)
|
||||
{
|
||||
long offset = s.PI64;
|
||||
ref PVSR.AET aet = ref pvsr.AETs[i];
|
||||
|
||||
long setNameOffset = s.RI64E();
|
||||
long frontOffset = s.RI64E();
|
||||
long frontLowOffset = s.RI64E();
|
||||
long backOffset = s.RI64E();
|
||||
long sub1Offset = s.RI64E();
|
||||
long sub2AOffset = s.RI64E();
|
||||
long sub2BOffset = s.RI64E();
|
||||
long sub2COffset = s.RI64E();
|
||||
long sub2DOffset = s.RI64E();
|
||||
aet.U48 = s.RU16E();
|
||||
aet.U4A = s.RU16E();
|
||||
aet.U4C = s.RU16E();
|
||||
aet.U4E = s.RU16E();
|
||||
aet.U50 = s.RU16E();
|
||||
aet.U52 = s.RU16E();
|
||||
aet.U54 = s.RU16E();
|
||||
aet.U56 = s.RU16E();
|
||||
aet.U58 = s.RU16E();
|
||||
aet.U5A = s.RU16E();
|
||||
aet.U5C = s.RU16E();
|
||||
aet.U5E = s.RU16E();
|
||||
aet.U60 = s.RU16E();
|
||||
byte frontCount = s.RU8();
|
||||
byte frontLowCount = s.RU8();
|
||||
byte backCount = s.RU8();
|
||||
s.A(0x08);
|
||||
long O68 = 0;
|
||||
long O70 = 0;
|
||||
byte U78 = 0;
|
||||
byte U79 = 0;
|
||||
if ((x00 & 0x100) != 0)
|
||||
{
|
||||
O68 = s.RI64E();
|
||||
O70 = s.RI64E();
|
||||
U78 = s.RU8();
|
||||
U79 = s.RU8();
|
||||
s.A(0x08);
|
||||
}
|
||||
|
||||
aet.SetName = s.RSaO(setNameOffset);
|
||||
|
||||
s.PI64 = frontOffset;
|
||||
aet.FrontList = new PVSR.AETEntry[frontCount];
|
||||
for (j = 0; j < frontCount; j++)
|
||||
aet.FrontList[j] = readAETEntry();
|
||||
|
||||
s.PI64 = frontLowOffset;
|
||||
aet.FrontLowList = new PVSR.AETEntry[frontLowCount];
|
||||
for (j = 0; j < frontLowCount; j++)
|
||||
aet.FrontLowList[j] = readAETEntry();
|
||||
|
||||
s.PI64 = backOffset;
|
||||
aet.BackList = new PVSR.AETEntry[backCount];
|
||||
for (j = 0; j < backCount; j++)
|
||||
aet.BackList[j] = readAETEntry();
|
||||
|
||||
aet.Sub1Data = readAETSub1(sub1Offset);
|
||||
aet.Sub2AData = readAETSub2(sub2AOffset);
|
||||
aet.Sub2BData = readAETSub2(sub2BOffset);
|
||||
aet.Sub2CData = readAETSub2(sub2COffset);
|
||||
aet.Sub2DData = readAETSub2(sub2DOffset);
|
||||
|
||||
if (O68 > 0)
|
||||
{
|
||||
s.PI64 = O68;
|
||||
aet.Unk03List = new PVSR.AETEntry[U78];
|
||||
for (j = 0; j < U78; j++)
|
||||
aet.Unk03List[j] = readAETEntry();
|
||||
}
|
||||
|
||||
if (O70 > 0)
|
||||
{
|
||||
s.PI64 = O70;
|
||||
aet.Unk04List = new PVSR.AETEntry[U79];
|
||||
for (j = 0; j < U79; j++)
|
||||
aet.Unk04List[j] = readAETEntry();
|
||||
}
|
||||
s.PI64 = offset + ((x00 & 0x100) != 0 ? 0x80 : 0x68);
|
||||
}
|
||||
s.C();
|
||||
return pvsr;
|
||||
|
||||
PVSR.StageEffect readStageEffect(long o = 0)
|
||||
{
|
||||
long offset = s.PI64;
|
||||
if (o > 0)
|
||||
s.PI64 = o;
|
||||
PVSR.StageEffect eff = default;
|
||||
byte U00 = s.RU8();
|
||||
byte U01 = s.RU8();
|
||||
byte U02 = s.RU8();
|
||||
byte U03 = s.RU8();
|
||||
byte U04 = s.RU8();
|
||||
s.A(0x08);
|
||||
long A3DAsOffset = s.RI64E();
|
||||
long GlittersOffset = s.RI64E();
|
||||
|
||||
int a3dasCount;
|
||||
int glittersCount;
|
||||
if (U04 != 0xFF)
|
||||
{
|
||||
a3dasCount = U00;
|
||||
glittersCount = U01;
|
||||
}
|
||||
else
|
||||
{
|
||||
a3dasCount = U01;
|
||||
glittersCount = U02;
|
||||
}
|
||||
|
||||
if (A3DAsOffset > 0)
|
||||
{
|
||||
s.PI64 = A3DAsOffset;
|
||||
eff.A3DAs = new PVSR.A3DAEntry[a3dasCount];
|
||||
for (int i = 0; i < a3dasCount; i++)
|
||||
{
|
||||
PVSR.A3DAEntry entry = default;
|
||||
entry.Name = s.RSaO();
|
||||
entry.Hash = s.RU32E();
|
||||
s.A(0x08);
|
||||
eff.A3DAs[i] = entry;
|
||||
}
|
||||
}
|
||||
|
||||
if (GlittersOffset > 0)
|
||||
{
|
||||
s.PI64 = GlittersOffset;
|
||||
eff.Glitters = new PVSR.Glitter[glittersCount];
|
||||
for (int i = 0; i < glittersCount; i++)
|
||||
eff.Glitters[i] = readGlitter();
|
||||
}
|
||||
|
||||
if (o > 0)
|
||||
s.PI64 = offset;
|
||||
else
|
||||
s.PI64 = offset + 0x20;
|
||||
return eff;
|
||||
}
|
||||
|
||||
PVSR.AETEntry readAETEntry()
|
||||
{
|
||||
PVSR.AETEntry entry = default;
|
||||
entry.Name = s.RSaO();
|
||||
entry.Hash = s.RU32E();
|
||||
entry.BrightScale = s.RF32E();
|
||||
return entry;
|
||||
}
|
||||
|
||||
PVSR.AET.Sub1? readAETSub1(long offset)
|
||||
{
|
||||
if (offset <= 0)
|
||||
return default;
|
||||
|
||||
s.PI64 = offset;
|
||||
PVSR.AET.Sub1 sub = default;
|
||||
sub.Name = s.RSaO();
|
||||
sub.Hash = s.RU32E();
|
||||
sub.Unk2 = s.RU16E();
|
||||
s.A(0x08);
|
||||
return sub;
|
||||
}
|
||||
|
||||
PVSR.AET.Sub2? readAETSub2(long offset)
|
||||
{
|
||||
if (offset <= 0)
|
||||
return default;
|
||||
|
||||
s.PI64 = offset;
|
||||
PVSR.AET.Sub2 sub = default;
|
||||
sub.U00 = s.RU16E();
|
||||
sub.U02 = s.RU16E();
|
||||
sub.U04 = s.RU16E();
|
||||
sub.U06 = s.RU16E();
|
||||
sub.U08 = s.RU16E();
|
||||
sub.U0A = s.RU16E();
|
||||
sub.U0C = s.RU16E();
|
||||
s.A(0x08);
|
||||
return sub;
|
||||
}
|
||||
|
||||
PVSR.Glitter readGlitter()
|
||||
{
|
||||
PVSR.Glitter eff = default;
|
||||
eff.Name = s.RSaO();
|
||||
eff.Unk1 = s.RU8();
|
||||
s.A(0x08);
|
||||
return eff;
|
||||
}
|
||||
}
|
||||
|
||||
private static void PVSRMsgPackWriter(string file, PVSR pvsr)
|
||||
{
|
||||
int i, j;
|
||||
MsgPack _PVSR = new MsgPack("PVSR");
|
||||
|
||||
int stageEffectsCount = pvsr.StageEffects != null ? pvsr.StageEffects.Length : 0;
|
||||
MsgPack stgEffs = new MsgPack(stageEffectsCount, "StageEffects");
|
||||
for (i = 0; i < stageEffectsCount; i++)
|
||||
stgEffs[i] = writeStageEffect(pvsr.StageEffects[i]);
|
||||
if (stageEffectsCount > 0)
|
||||
_PVSR.Add(stgEffs);
|
||||
|
||||
int effectsCount = pvsr.EffectList != null ? pvsr.EffectList.Length : 0;
|
||||
MsgPack effectList = new MsgPack(effectsCount, "EffectList");
|
||||
for (i = 0; i < effectsCount; i++)
|
||||
{
|
||||
ref PVSR.Effect effect = ref pvsr.EffectList[i];
|
||||
effectList[i] = MsgPack.New.Add("Name", effect.Name).Add("Emission", effect.Emission);
|
||||
}
|
||||
if (effectsCount > 0)
|
||||
_PVSR.Add(effectList);
|
||||
|
||||
int emcssCount = pvsr.EMCSList != null ? pvsr.EMCSList.Length : 0;
|
||||
MsgPack emcsList = new MsgPack(emcssCount, "EMCSList");
|
||||
for (i = 0; i < emcssCount; i++)
|
||||
emcsList[i] = pvsr.EMCSList[i];
|
||||
if (emcssCount > 0)
|
||||
_PVSR.Add(emcsList);
|
||||
|
||||
MsgPack stgChgEffs = new MsgPack(0x10, "StageChangeEffects");
|
||||
for (i = 0; i < 0x10; i++)
|
||||
{
|
||||
MsgPack stgChgEff = new MsgPack(0x10);
|
||||
for (j = 0; j < 0x10; j++)
|
||||
{
|
||||
if (pvsr.StageChangeEffects[i * 0x10 + j].HasValue)
|
||||
stgChgEff[j] = writeStageEffect(pvsr.StageChangeEffects[i * 0x10 + j].Value);
|
||||
else
|
||||
stgChgEff[j] = default;
|
||||
}
|
||||
stgChgEffs[i] = stgChgEff;
|
||||
}
|
||||
_PVSR.Add(stgChgEffs);
|
||||
|
||||
int aetsCount = pvsr.AETs != null ? pvsr.AETs.Length : 0;
|
||||
MsgPack aets = new MsgPack(aetsCount, "AETs");
|
||||
for (i = 0; i < aetsCount; i++)
|
||||
{
|
||||
ref PVSR.AET aet = ref pvsr.AETs[i];
|
||||
|
||||
MsgPack a = MsgPack.New.Add("SetName", aet.SetName);
|
||||
int frontCount = aet.FrontList != null ? aet.FrontList.Length : 0;
|
||||
MsgPack frontList = new MsgPack(frontCount, "FrontList");
|
||||
for (j = 0; j < frontCount; j++)
|
||||
frontList[j] = writeAETEntry(aet.FrontList[j]);
|
||||
if (frontCount > 0)
|
||||
a.Add(frontList);
|
||||
|
||||
int frontLowCount = aet.FrontLowList != null ? aet.FrontLowList.Length : 0;
|
||||
MsgPack frontLowList = new MsgPack(frontLowCount, "FrontLowList");
|
||||
for (j = 0; j < frontLowCount; j++)
|
||||
frontLowList[j] = writeAETEntry(aet.FrontLowList[j]);
|
||||
if (frontLowCount > 0)
|
||||
a.Add(frontLowList);
|
||||
|
||||
int backCount = aet.BackList != null ? aet.BackList.Length : 0;
|
||||
MsgPack backList = new MsgPack(backCount, "BackList");
|
||||
for (j = 0; j < backCount; j++)
|
||||
backList[j] = writeAETEntry(aet.BackList[j]);
|
||||
if (backCount > 0)
|
||||
a.Add(backList);
|
||||
|
||||
a.Add("U48", aet.U48);
|
||||
a.Add("U4A", aet.U4A);
|
||||
a.Add("U4C", aet.U4C);
|
||||
a.Add("U4E", aet.U4E);
|
||||
a.Add("U50", aet.U50);
|
||||
a.Add("U52", aet.U52);
|
||||
a.Add("U54", aet.U54);
|
||||
a.Add("U56", aet.U56);
|
||||
a.Add("U58", aet.U58);
|
||||
a.Add("U5A", aet.U5A);
|
||||
a.Add("U5C", aet.U5C);
|
||||
a.Add("U5E", aet.U5E);
|
||||
a.Add("U60", aet.U60);
|
||||
|
||||
MsgPack temp;
|
||||
if ((temp = writeAETSub1(aet.Sub1Data, "Sub1")).NotNull)
|
||||
a.Add(temp);
|
||||
if ((temp = writeAETSub2(aet.Sub2AData, "Sub2A")).NotNull)
|
||||
a.Add(temp);
|
||||
if ((temp = writeAETSub2(aet.Sub2BData, "Sub2B")).NotNull)
|
||||
a.Add(temp);
|
||||
if ((temp = writeAETSub2(aet.Sub2CData, "Sub2C")).NotNull)
|
||||
a.Add(temp);
|
||||
if ((temp = writeAETSub2(aet.Sub2DData, "Sub2D")).NotNull)
|
||||
a.Add(temp);
|
||||
|
||||
int unk03Count = aet.FrontList != null ? aet.FrontList.Length : 0;
|
||||
MsgPack unk03List = new MsgPack(unk03Count, "Unk04List");
|
||||
for (j = 0; j < unk03Count; j++)
|
||||
unk03List[j] = writeAETEntry(aet.Unk03List[j]);
|
||||
if (unk03Count > 0)
|
||||
_PVSR.Add(unk03List);
|
||||
|
||||
int unk04Count = aet.Unk04List != null ? aet.Unk04List.Length : 0;
|
||||
MsgPack unk04List = new MsgPack(unk04Count, "Unk04List");
|
||||
for (j = 0; j < unk04Count; j++)
|
||||
unk04List[j] = writeAETEntry(aet.Unk04List[j]);
|
||||
if (unk04Count > 0)
|
||||
a.Add(unk04List);
|
||||
aets[i] = a;
|
||||
}
|
||||
if (aetsCount > 0)
|
||||
_PVSR.Add(aets);
|
||||
|
||||
_PVSR.Write(false, true, file, json);
|
||||
|
||||
MsgPack writeStageEffect(PVSR.StageEffect eff, string name = null)
|
||||
{
|
||||
MsgPack effect = new MsgPack(name);
|
||||
int a3dasCount = eff.A3DAs != null ? eff.A3DAs.Length : 0;
|
||||
MsgPack a3das = new MsgPack(a3dasCount, "A3DAs");
|
||||
for (int i = 0; i < a3dasCount; i++)
|
||||
a3das[i] = eff.A3DAs[i].Name;
|
||||
if (a3dasCount > 0)
|
||||
effect.Add(a3das);
|
||||
|
||||
int glittersCount = eff.Glitters != null ? eff.Glitters.Length : 0;
|
||||
MsgPack glitters = new MsgPack(glittersCount, "Glitters");
|
||||
for (int i = 0; i < glittersCount; i++)
|
||||
glitters[i] = writeGlitter(eff.Glitters[i]);
|
||||
if (glittersCount > 0)
|
||||
effect.Add(glitters);
|
||||
|
||||
if (a3dasCount > 0 || glittersCount > 0)
|
||||
return effect;
|
||||
else
|
||||
return default;
|
||||
}
|
||||
|
||||
MsgPack writeAETEntry(PVSR.AETEntry entry, string name = null) =>
|
||||
new MsgPack(name).Add("Name", entry.Name).Add("BrightScale", entry.BrightScale);
|
||||
|
||||
MsgPack writeAETSub1(PVSR.AET.Sub1? sub, string name = null)
|
||||
{
|
||||
if (!sub.HasValue)
|
||||
return default;
|
||||
|
||||
PVSR.AET.Sub1 s = sub.Value;
|
||||
return new MsgPack(name).Add("Name", s.Name).Add("Unk2", s.Unk2);
|
||||
}
|
||||
|
||||
MsgPack writeAETSub2(PVSR.AET.Sub2? sub, string name = null)
|
||||
{
|
||||
if (!sub.HasValue)
|
||||
return default;
|
||||
|
||||
PVSR.AET.Sub2 s = sub.Value;
|
||||
return new MsgPack(name)
|
||||
.Add("U00", s.U00).Add("U02", s.U02).Add("U04", s.U04).Add("U06", s.U06)
|
||||
.Add("U08", s.U08).Add("U0A", s.U0A).Add("U0C", s.U0C);
|
||||
}
|
||||
|
||||
MsgPack writeGlitter(PVSR.Glitter eff, string name = null) =>
|
||||
new MsgPack(name).Add("Name", eff.Name).Add("Unk1", eff.Unk1);
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "default.h"
|
||||
#include "string.h"
|
||||
#include "vector.h"
|
||||
@@ -8,7 +8,7 @@
|
||||
void sort_array(size_t* array, size_t length) {
|
||||
size_t i, j, l, m;
|
||||
|
||||
if (length <= 0)
|
||||
if (length < 1)
|
||||
return;
|
||||
else if (length == 1) {
|
||||
*array = 0;
|
||||
|
||||
+13
-6
@@ -589,13 +589,13 @@ bool str_utils_text_file_parse(void* data, size_t length,
|
||||
ch = 0;
|
||||
|
||||
size_t buf_len = length;
|
||||
for (size_t i = 0, l = 0; i < length; i++) {
|
||||
for (size_t i = 0, l = 0, m = 0; i < length; i++) {
|
||||
ch = *t++;
|
||||
if (ch == '\r') {
|
||||
if (i + 1 < length && *t == '\n') {
|
||||
i++;
|
||||
t++;
|
||||
buf_len--;
|
||||
l++;
|
||||
}
|
||||
lf = true;
|
||||
}
|
||||
@@ -607,10 +607,13 @@ bool str_utils_text_file_parse(void* data, size_t length,
|
||||
buf_len--;
|
||||
c++;
|
||||
l = 0;
|
||||
m = 0;
|
||||
lf = false;
|
||||
}
|
||||
else
|
||||
else {
|
||||
l++;
|
||||
m++;
|
||||
}
|
||||
}
|
||||
|
||||
if (ch != '\r' && ch != '\n')
|
||||
@@ -622,12 +625,13 @@ bool str_utils_text_file_parse(void* data, size_t length,
|
||||
char** temp_lines = force_malloc_s(char*, c);
|
||||
|
||||
char* b = temp_buf;
|
||||
for (size_t i = 0, j = 0, l = 0; j < c; i++) {
|
||||
for (size_t i = 0, j = 0, l = 0, m = 0; j < c; i++) {
|
||||
ch = *t++;
|
||||
if (ch == '\r') {
|
||||
if (i + 1 < length && *t == '\n') {
|
||||
i++;
|
||||
t++;
|
||||
l++;
|
||||
}
|
||||
lf = true;
|
||||
}
|
||||
@@ -637,7 +641,7 @@ bool str_utils_text_file_parse(void* data, size_t length,
|
||||
if (i >= length || lf) {
|
||||
temp_lines[j] = b;
|
||||
if (l) {
|
||||
memcpy(b, d + i - l, l);
|
||||
memcpy(b, d + i - l, m);
|
||||
b[l] = 0;
|
||||
b += l + 1;
|
||||
}
|
||||
@@ -651,10 +655,13 @@ bool str_utils_text_file_parse(void* data, size_t length,
|
||||
break;
|
||||
|
||||
l = 0;
|
||||
m = 0;
|
||||
lf = false;
|
||||
}
|
||||
else
|
||||
else {
|
||||
l++;
|
||||
m++;
|
||||
}
|
||||
}
|
||||
|
||||
*buf = temp_buf;
|
||||
|
||||
+27
-11
@@ -44,7 +44,10 @@ inline void string_init_length(string* s, char* str, size_t length) {
|
||||
return;
|
||||
|
||||
string_reserve(s, length);
|
||||
memmove(string_data(s), str, length);
|
||||
if (str)
|
||||
memmove(string_data(s), str, length);
|
||||
else
|
||||
memset(string_data(s), 0, length);
|
||||
s->length = length;
|
||||
string_data(s)[s->length] = 0;
|
||||
}
|
||||
@@ -68,11 +71,14 @@ inline void string_add(string* s, char* str) {
|
||||
}
|
||||
|
||||
inline void string_add_length(string* s, char* str, size_t length) {
|
||||
if (!s || !str || !length)
|
||||
if (!s || !length)
|
||||
return;
|
||||
|
||||
string_reserve(s, length);
|
||||
memmove(string_data(s) + s->length, str, length);
|
||||
if (str)
|
||||
memmove(string_data(s) + s->length, str, length);
|
||||
else
|
||||
memset(string_data(s) + s->length, 0, length);
|
||||
s->length += length;
|
||||
string_data(s)[s->length] = 0;
|
||||
}
|
||||
@@ -98,12 +104,14 @@ inline void string_copy_wstring(wstring* src, string* dst) {
|
||||
|
||||
inline void string_replace(string* src, string* dst) {
|
||||
string_free(dst);
|
||||
string_copy(src, dst);
|
||||
string_init_length(dst, string_data(src), src->length);
|
||||
}
|
||||
|
||||
inline void string_replace_wstring(wstring* src, string* dst) {
|
||||
char* temp = utf16_to_utf8(wstring_data(src));
|
||||
string_free(dst);
|
||||
string_copy_wstring(src, dst);
|
||||
string_init(dst, temp);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
inline bool string_compare(string* str0, string* str1) {
|
||||
@@ -137,11 +145,14 @@ inline void wstring_init(wstring* s, wchar_t* str) {
|
||||
|
||||
inline void wstring_init_length(wstring* s, wchar_t* str, size_t length) {
|
||||
*s = wstring_empty;
|
||||
if (!str || !length)
|
||||
if (!length)
|
||||
return;
|
||||
|
||||
wstring_reserve(s, length);
|
||||
memmove(wstring_data(s), str, sizeof(wchar_t) * length);
|
||||
if (str)
|
||||
memmove(wstring_data(s), str, sizeof(wchar_t) * length);
|
||||
else
|
||||
memset(wstring_data(s), 0, sizeof(wchar_t) * length);
|
||||
s->length = length;
|
||||
wstring_data(s)[s->length] = 0;
|
||||
}
|
||||
@@ -161,11 +172,14 @@ inline void wstring_add(wstring* s, wchar_t* str) {
|
||||
}
|
||||
|
||||
inline void wstring_add_length(wstring* s, wchar_t* str, size_t length) {
|
||||
if (!s || !str || !length)
|
||||
if (!s || !length)
|
||||
return;
|
||||
|
||||
wstring_reserve(s, length);
|
||||
memmove(wstring_data(s) + s->length, str, sizeof(wchar_t) * length);
|
||||
if (str)
|
||||
memmove(wstring_data(s) + s->length, str, sizeof(wchar_t) * length);
|
||||
else
|
||||
memset(wstring_data(s) + s->length, 0, sizeof(wchar_t) * length);
|
||||
s->length += length;
|
||||
wstring_data(s)[s->length] = 0;
|
||||
}
|
||||
@@ -191,12 +205,14 @@ inline void wstring_copy_string(string* src, wstring* dst) {
|
||||
|
||||
inline void wstring_replace(wstring* src, wstring* dst) {
|
||||
wstring_free(dst);
|
||||
wstring_copy(src, dst);
|
||||
wstring_init_length(dst, wstring_data(src), src->length);
|
||||
}
|
||||
|
||||
inline void wstring_replace_string(string* src, wstring* dst) {
|
||||
wchar_t* temp = utf8_to_utf16(string_data(src));
|
||||
wstring_free(dst);
|
||||
wstring_copy_string(src, dst);
|
||||
wstring_init(dst, temp);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
inline bool wstring_compare(wstring* str0, wstring* str1) {
|
||||
|
||||
+3
-3
@@ -20,7 +20,7 @@ void txp_copy(txp* src, txp* dst) {
|
||||
dst->array_size = src->array_size;
|
||||
dst->mipmaps_count = src->mipmaps_count;
|
||||
dst->data = vector_empty(txp_mipmap);
|
||||
vector_txp_mipmap_reserve(&dst->data, src->data.end - src->data.begin);
|
||||
vector_txp_mipmap_reserve(&dst->data, vector_length(src->data));
|
||||
txp_mipmap* tex_mipmap = src->data.begin;
|
||||
for (size_t j = 0; j < src->array_size; j++) {
|
||||
for (size_t k = 0; k < src->mipmaps_count; k++, tex_mipmap++) {
|
||||
@@ -111,7 +111,7 @@ bool txp_set_pack_file(txp_set* ts, void** data, size_t* length, bool big_endian
|
||||
*data = 0;
|
||||
*length = 0;
|
||||
|
||||
size_t count = ts->end - ts->begin;
|
||||
size_t count = vector_length(*ts);
|
||||
if (count < 1)
|
||||
return false;
|
||||
|
||||
@@ -218,7 +218,7 @@ bool txp_set_produce_enrs(txp_set* ts, vector_enrs_entry* enrs) {
|
||||
*enrs = vector_empty(enrs_entry);
|
||||
l = 0;
|
||||
|
||||
size_t count = ts->end - ts->begin;
|
||||
size_t count = vector_length(*ts);
|
||||
if (count < 1)
|
||||
return false;
|
||||
|
||||
|
||||
+57
-33
@@ -699,28 +699,34 @@ vector_ptr(vec4i)
|
||||
|
||||
#define vec2_lerp(x, y, z, blend) \
|
||||
{ \
|
||||
__m128 b; \
|
||||
__m128 b1; \
|
||||
__m128 b2; \
|
||||
__m128 xt; \
|
||||
__m128 yt; \
|
||||
__m128 zt; \
|
||||
*(vec2*)&xt = (x); \
|
||||
*(vec2*)&yt = (y); \
|
||||
*(vec2*)&b = (blend); \
|
||||
zt = _mm_add_ps(xt, _mm_mul_ps(_mm_sub_ps(yt, xt), b)); \
|
||||
*(vec3*)&b1 = (blend); \
|
||||
*(vec3*)&b2 = vec3_identity; \
|
||||
b2 = _mm_sub_ps(b2, b1); \
|
||||
zt = _mm_add_ps(_mm_mul_ps(xt, b2), _mm_mul_ps(yt, b1)); \
|
||||
(z) = *(vec2*)&zt; \
|
||||
}
|
||||
|
||||
#define vec2_lerp_scalar(x, y, z, blend) \
|
||||
{ \
|
||||
__m128 b; \
|
||||
__m128 b1; \
|
||||
__m128 b2; \
|
||||
__m128 xt; \
|
||||
__m128 yt; \
|
||||
__m128 zt; \
|
||||
*(vec2*)&xt = (x); \
|
||||
*(vec2*)&yt = (y); \
|
||||
b = _mm_set_ss(blend); \
|
||||
b = _mm_shuffle_ps(b, b, 0); \
|
||||
zt = _mm_add_ps(xt, _mm_mul_ps(_mm_sub_ps(yt, xt), b)); \
|
||||
b1 = _mm_set_ss(blend); \
|
||||
b1 = _mm_shuffle_ps(b1, b1, 0); \
|
||||
*(vec2*)&b2 = vec2_identity; \
|
||||
b2 = _mm_sub_ps(b2, b1); \
|
||||
zt = _mm_add_ps(_mm_mul_ps(xt, b2), _mm_mul_ps(yt, b1)); \
|
||||
(z) = *(vec2*)&zt; \
|
||||
}
|
||||
|
||||
@@ -1011,9 +1017,9 @@ vector_ptr(vec4i)
|
||||
__m128 yt; \
|
||||
__m128 zt; \
|
||||
*(vec3*)&xt = (x); \
|
||||
xt.m128_f32[3] = 0.0f; \
|
||||
xt = _mm_and_ps(xt, vec4_mask_vec3); \
|
||||
*(vec3*)&yt = (y); \
|
||||
yt.m128_f32[3] = 0.0f; \
|
||||
yt = _mm_and_ps(yt, vec4_mask_vec3); \
|
||||
zt = _mm_mul_ps(xt, yt); \
|
||||
zt = _mm_hadd_ps(zt, zt); \
|
||||
(z) = _mm_cvtss_f32(_mm_hadd_ps(zt, zt)); \
|
||||
@@ -1024,7 +1030,7 @@ vector_ptr(vec4i)
|
||||
__m128 xt; \
|
||||
__m128 zt; \
|
||||
*(vec3*)&xt = (x); \
|
||||
xt.m128_f32[3] = 0.0f; \
|
||||
xt = _mm_and_ps(xt, vec4_mask_vec3); \
|
||||
zt = _mm_mul_ps(xt, xt); \
|
||||
zt = _mm_hadd_ps(zt, zt); \
|
||||
(z) = _mm_cvtss_f32(_mm_sqrt_ss(_mm_hadd_ps(zt, zt))); \
|
||||
@@ -1035,7 +1041,7 @@ vector_ptr(vec4i)
|
||||
__m128 xt; \
|
||||
__m128 zt; \
|
||||
*(vec3*)&xt = (x); \
|
||||
xt.m128_f32[3] = 0.0f; \
|
||||
xt = _mm_and_ps(xt, vec4_mask_vec3); \
|
||||
zt = _mm_mul_ps(xt, xt); \
|
||||
zt = _mm_hadd_ps(zt, zt); \
|
||||
(z) = _mm_cvtss_f32(_mm_hadd_ps(zt, zt)); \
|
||||
@@ -1047,9 +1053,9 @@ vector_ptr(vec4i)
|
||||
__m128 yt; \
|
||||
__m128 zt; \
|
||||
*(vec3*)&xt = (x); \
|
||||
xt.m128_f32[3] = 0.0f; \
|
||||
xt = _mm_and_ps(xt, vec4_mask_vec3); \
|
||||
*(vec3*)&yt = (y); \
|
||||
yt.m128_f32[3] = 0.0f; \
|
||||
yt = _mm_and_ps(yt, vec4_mask_vec3); \
|
||||
zt = _mm_sub_ps(xt, yt); \
|
||||
zt = _mm_mul_ps(zt, zt); \
|
||||
zt = _mm_hadd_ps(zt, zt); \
|
||||
@@ -1062,9 +1068,9 @@ vector_ptr(vec4i)
|
||||
__m128 yt; \
|
||||
__m128 zt; \
|
||||
*(vec3*)&xt = (x); \
|
||||
xt.m128_f32[3] = 0.0f; \
|
||||
xt = _mm_and_ps(xt, vec4_mask_vec3); \
|
||||
*(vec3*)&yt = (y); \
|
||||
yt.m128_f32[3] = 0.0f; \
|
||||
yt = _mm_and_ps(yt, vec4_mask_vec3); \
|
||||
zt = _mm_sub_ps(xt, yt); \
|
||||
zt = _mm_mul_ps(zt, zt); \
|
||||
zt = _mm_hadd_ps(zt, zt); \
|
||||
@@ -1073,28 +1079,34 @@ vector_ptr(vec4i)
|
||||
|
||||
#define vec3_lerp(x, y, z, blend) \
|
||||
{ \
|
||||
__m128 b; \
|
||||
__m128 b1; \
|
||||
__m128 b2; \
|
||||
__m128 xt; \
|
||||
__m128 yt; \
|
||||
__m128 zt; \
|
||||
*(vec3*)&xt = (x); \
|
||||
*(vec3*)&yt = (y); \
|
||||
*(vec3*)&b = (blend); \
|
||||
zt = _mm_add_ps(xt, _mm_mul_ps(_mm_sub_ps(yt, xt), b)); \
|
||||
*(vec3*)&b1 = (blend); \
|
||||
*(vec3*)&b2 = vec3_identity; \
|
||||
b2 = _mm_sub_ps(b2, b1); \
|
||||
zt = _mm_add_ps(_mm_mul_ps(xt, b2), _mm_mul_ps(yt, b1)); \
|
||||
(z) = *(vec3*)&zt; \
|
||||
}
|
||||
|
||||
#define vec3_lerp_scalar(x, y, z, blend) \
|
||||
{ \
|
||||
__m128 b; \
|
||||
__m128 b1; \
|
||||
__m128 b2; \
|
||||
__m128 xt; \
|
||||
__m128 yt; \
|
||||
__m128 zt; \
|
||||
*(vec3*)&xt = (x); \
|
||||
*(vec3*)&yt = (y); \
|
||||
b = _mm_set_ss(blend); \
|
||||
b = _mm_shuffle_ps(b, b, 0); \
|
||||
zt = _mm_add_ps(xt, _mm_mul_ps(_mm_sub_ps(yt, xt), b)); \
|
||||
b1 = _mm_set_ss(blend); \
|
||||
b1 = _mm_shuffle_ps(b1, b1, 0); \
|
||||
*(vec3*)&b2 = vec3_identity; \
|
||||
b2 = _mm_sub_ps(b2, b1); \
|
||||
zt = _mm_add_ps(_mm_mul_ps(xt, b2), _mm_mul_ps(yt, b1)); \
|
||||
(z) = *(vec3*)&zt; \
|
||||
}
|
||||
|
||||
@@ -1103,7 +1115,7 @@ vector_ptr(vec4i)
|
||||
__m128 xt; \
|
||||
__m128 zt; \
|
||||
*(vec3*)&xt = (x); \
|
||||
xt.m128_f32[3] = 0.0f; \
|
||||
xt = _mm_and_ps(xt, vec4_mask_vec3); \
|
||||
zt = _mm_mul_ps(xt, xt); \
|
||||
zt = _mm_hadd_ps(zt, zt); \
|
||||
zt = _mm_sqrt_ss(_mm_hadd_ps(zt, zt)); \
|
||||
@@ -1380,15 +1392,21 @@ vector_ptr(vec4i)
|
||||
|
||||
#define vec4_lerp(x, y, z, blend) \
|
||||
{ \
|
||||
(z).data = _mm_add_ps((x).data, _mm_mul_ps(_mm_sub_ps((y).data, (x).data), (blend).data)); \
|
||||
__m128 b1; \
|
||||
__m128 b2; \
|
||||
b1 = (blend).data; \
|
||||
b2 = _mm_sub_ps(vec4_identity.data, b1); \
|
||||
(z).data = _mm_add_ps(_mm_mul_ps((x).data, b2), _mm_mul_ps((y).data, b1)); \
|
||||
}
|
||||
|
||||
#define vec4_lerp_scalar(x, y, z, blend) \
|
||||
{ \
|
||||
__m128 b; \
|
||||
b = _mm_set_ss(blend); \
|
||||
b = _mm_shuffle_ps(b, b, 0); \
|
||||
(z).data = _mm_add_ps((x).data, _mm_mul_ps(_mm_sub_ps((y).data, (x).data), b)); \
|
||||
__m128 b1; \
|
||||
__m128 b2; \
|
||||
b1 = _mm_set_ss(blend); \
|
||||
b1 = _mm_shuffle_ps(b1, b1, 0); \
|
||||
b2 = _mm_sub_ps(vec4_identity.data, b1); \
|
||||
(z).data = _mm_add_ps(_mm_mul_ps((x).data, b2), _mm_mul_ps((y).data, b1)); \
|
||||
}
|
||||
|
||||
#define vec4_normalize(x, z) \
|
||||
@@ -1759,15 +1777,21 @@ vector_ptr(vec4i)
|
||||
|
||||
#define vec2d_lerp(x, y, z, blend) \
|
||||
{ \
|
||||
(z).data = _mm_add_pd((x).data, _mm_mul_pd(_mm_sub_pd((y).data, (z).data), (blend).data)); \
|
||||
__m128d b1; \
|
||||
__m128d b2; \
|
||||
b1 = (blend).data; \
|
||||
b2 = _mm_sub_pd(vec2d_identity.data, b1); \
|
||||
(z).data = _mm_add_pd(_mm_mul_pd((x).data, b2), _mm_mul_pd((y).data, b1)); \
|
||||
}
|
||||
|
||||
#define vec2d_lerp_scalar(x, y, z, blend) \
|
||||
{ \
|
||||
__m128d b; \
|
||||
b = _mm_set_sd(blend); \
|
||||
b = _mm_shuffle_pd(b, b, 0); \
|
||||
(z).data = _mm_add_pd((x).data, _mm_mul_pd(_mm_sub_pd((y).data, (z).data), b)); \
|
||||
__m128d b1; \
|
||||
__m128d b2; \
|
||||
b1 = _mm_set_sd(blend); \
|
||||
b1 = _mm_shuffle_pd(b1, b1, 0); \
|
||||
b2 = _mm_sub_pd(vec2d_identity.data, b1); \
|
||||
(z).data = _mm_add_pd(_mm_mul_pd((x).data, b2), _mm_mul_pd((y).data, b1)); \
|
||||
}
|
||||
|
||||
#define vec2d_normalize(x, z) \
|
||||
|
||||
+38
-8
@@ -10,6 +10,8 @@
|
||||
#define vector_dispose_func(t) void(* dispose_func)(t* data)
|
||||
#define vector_empty(t) (vector_##t){ 0, 0, 0 }
|
||||
#define vector_ptr_empty(t) (vector_ptr_##t){ 0, 0, 0 }
|
||||
#define vector_length(vec) ((vec).end - (vec).begin)
|
||||
#define vector_capacity(vec) ((vec).capacity_end - (vec).begin)
|
||||
|
||||
#define vector(t) \
|
||||
typedef struct vector_##t { \
|
||||
@@ -21,6 +23,7 @@ typedef struct vector_##t { \
|
||||
extern void vector_##t##_reserve(vector_##t* vec, ssize_t size); \
|
||||
extern void vector_##t##_push_back(vector_##t* vec, t* val); \
|
||||
extern t* vector_##t##_reserve_back(vector_##t* vec); \
|
||||
extern t* vector_##t##_reserve_back_range(vector_##t* vec, ssize_t count); \
|
||||
extern void vector_##t##_pop_back(vector_##t* vec, vector_dispose_func(t)); \
|
||||
extern void vector_##t##_insert(vector_##t* vec, ssize_t position, t* val); \
|
||||
extern void vector_##t##_insert_range(vector_##t* vec, ssize_t position, t* first, t* last); \
|
||||
@@ -42,6 +45,7 @@ typedef struct vector_ptr_##t { \
|
||||
extern void vector_ptr_##t##_reserve(vector_ptr_##t* vec, ssize_t size); \
|
||||
extern void vector_ptr_##t##_push_back(vector_ptr_##t* vec, t** val); \
|
||||
extern t** vector_ptr_##t##_reserve_back(vector_ptr_##t* vec); \
|
||||
extern t** vector_ptr_##t##_reserve_back_range(vector_ptr_##t* vec, ssize_t count); \
|
||||
extern void vector_ptr_##t##_pop_back(vector_ptr_##t* vec, vector_dispose_func(t)); \
|
||||
extern void vector_ptr_##t##_insert(vector_ptr_##t* vec, ssize_t position, t** val); \
|
||||
extern void vector_ptr_##t##_insert_range(vector_ptr_##t* vec, ssize_t position, t** first, t** last); \
|
||||
@@ -85,7 +89,7 @@ void vector_##t##_push_back(vector_##t* vec, t* val) { \
|
||||
return; \
|
||||
\
|
||||
if (vec->capacity_end - vec->end < 1) \
|
||||
vector_##t##_reserve(vec, vec->end - vec->capacity_end + 1); \
|
||||
vector_##t##_reserve(vec, 1); \
|
||||
\
|
||||
*vec->end = *val; \
|
||||
vec->end++; \
|
||||
@@ -96,13 +100,26 @@ t* vector_##t##_reserve_back(vector_##t* vec) { \
|
||||
return 0; \
|
||||
\
|
||||
if (vec->capacity_end - vec->end < 1) \
|
||||
vector_##t##_reserve(vec, vec->end - vec->capacity_end + 1); \
|
||||
vector_##t##_reserve(vec, 1); \
|
||||
\
|
||||
t* val = vec->end++; \
|
||||
memset(val, 0, sizeof(t)); \
|
||||
return val; \
|
||||
} \
|
||||
\
|
||||
t* vector_##t##_reserve_back_range(vector_##t* vec, ssize_t count) { \
|
||||
if (!vec) \
|
||||
return 0; \
|
||||
\
|
||||
if (vec->capacity_end - vec->end < count) \
|
||||
vector_##t##_reserve(vec, count); \
|
||||
\
|
||||
t* val = vec->end; \
|
||||
vec->end += count; \
|
||||
memset(val, 0, sizeof(t) * count); \
|
||||
return val; \
|
||||
} \
|
||||
\
|
||||
void vector_##t##_pop_back(vector_##t* vec, vector_dispose_func(t)) { \
|
||||
if (!vec) \
|
||||
return; \
|
||||
@@ -119,7 +136,7 @@ void vector_##t##_insert(vector_##t* vec, ssize_t position, t* val) { \
|
||||
return; \
|
||||
\
|
||||
if (vec->capacity_end - vec->end < 1) \
|
||||
vector_##t##_reserve(vec, vec->end - vec->capacity_end + 1); \
|
||||
vector_##t##_reserve(vec, 1); \
|
||||
\
|
||||
t* t0 = vec->begin + position; \
|
||||
t* t1 = vec->begin + position + 1; \
|
||||
@@ -139,7 +156,7 @@ void vector_##t##_insert_range(vector_##t* vec, ssize_t position, t* first, t* l
|
||||
if (vec->end - vec->begin == 0) \
|
||||
vector_##t##_reserve(vec, s); \
|
||||
else if (vec->capacity_end - vec->end < s) \
|
||||
vector_##t##_reserve(vec, vec->end - vec->capacity_end + s); \
|
||||
vector_##t##_reserve(vec, s); \
|
||||
\
|
||||
t* t0 = vec->begin + position; \
|
||||
t* t1 = vec->begin + position + s; \
|
||||
@@ -246,7 +263,7 @@ void vector_ptr_##t##_push_back(vector_ptr_##t* vec, t** val) { \
|
||||
return; \
|
||||
\
|
||||
if (vec->capacity_end - vec->end < 1) \
|
||||
vector_ptr_##t##_reserve(vec, vec->end - vec->capacity_end + 1); \
|
||||
vector_ptr_##t##_reserve(vec, 1); \
|
||||
\
|
||||
*vec->end++ = *val; \
|
||||
} \
|
||||
@@ -256,13 +273,26 @@ t** vector_ptr_##t##_reserve_back(vector_ptr_##t* vec) { \
|
||||
return 0; \
|
||||
\
|
||||
if (vec->capacity_end - vec->end < 1) \
|
||||
vector_ptr_##t##_reserve(vec, vec->end - vec->capacity_end + 1); \
|
||||
vector_ptr_##t##_reserve(vec, 1); \
|
||||
\
|
||||
t** val = vec->end++; \
|
||||
memset(val, 0, sizeof(t*)); \
|
||||
return val; \
|
||||
} \
|
||||
\
|
||||
t** vector_ptr_##t##_reserve_back_range(vector_ptr_##t* vec, ssize_t count) { \
|
||||
if (!vec) \
|
||||
return 0; \
|
||||
\
|
||||
if (vec->capacity_end - vec->end < count) \
|
||||
vector_ptr_##t##_reserve(vec, count); \
|
||||
\
|
||||
t** val = vec->end; \
|
||||
vec->end += count; \
|
||||
memset(val, 0, sizeof(t*) * count); \
|
||||
return val; \
|
||||
} \
|
||||
\
|
||||
void vector_ptr_##t##_pop_back(vector_ptr_##t* vec, vector_dispose_func(t)) { \
|
||||
if (!vec) \
|
||||
return; \
|
||||
@@ -281,7 +311,7 @@ void vector_ptr_##t##_insert(vector_ptr_##t* vec, ssize_t position, t** val) { \
|
||||
return; \
|
||||
\
|
||||
if (vec->capacity_end - vec->end < 1) \
|
||||
vector_ptr_##t##_reserve(vec, vec->end - vec->capacity_end + 1); \
|
||||
vector_ptr_##t##_reserve(vec, 1); \
|
||||
\
|
||||
t** t0 = vec->begin + position; \
|
||||
t** t1 = vec->begin + position + 1; \
|
||||
@@ -301,7 +331,7 @@ void vector_ptr_##t##_insert_range(vector_ptr_##t* vec, ssize_t position, t** fi
|
||||
if (vec->end - vec->begin == 0) \
|
||||
vector_ptr_##t##_reserve(vec, s); \
|
||||
else if (vec->capacity_end - vec->end < s) \
|
||||
vector_ptr_##t##_reserve(vec, vec->end - vec->capacity_end + s); \
|
||||
vector_ptr_##t##_reserve(vec, s); \
|
||||
\
|
||||
t** t0 = vec->begin + position; \
|
||||
t** t1 = vec->begin + position + s; \
|
||||
|
||||
Reference in New Issue
Block a user