mirror of
https://github.com/korenkonder/ReDIVA.git
synced 2026-10-06 05:38:02 +03:00
Auth 2D stuff
This commit is contained in:
+2307
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../KKdLib/default.hpp"
|
||||
#include "../KKdLib/database/aet.hpp"
|
||||
#include "../KKdLib/vec.hpp"
|
||||
#include "frame_rate_control.hpp"
|
||||
#include "sprite.hpp"
|
||||
|
||||
enum AetFlags {
|
||||
AET_DISP = 0x000001,
|
||||
AET_REVERSE = 0x000002,
|
||||
AET_PAUSE = 0x000004,
|
||||
AET_HIDDEN = 0x000008,
|
||||
AET_LOOP = 0x010000,
|
||||
AET_PLAY_ONCE = 0x020000,
|
||||
AET_FLIP_H = 0x040000,
|
||||
AET_FLIP_V = 0x080000,
|
||||
AET_100000 = 0x100000,
|
||||
};
|
||||
|
||||
struct AetArgs {
|
||||
union IDUnion {
|
||||
int32_t index;
|
||||
uint32_t id;
|
||||
aet_info info;
|
||||
|
||||
IDUnion() {
|
||||
index = -1;
|
||||
id = -1;
|
||||
info = {};
|
||||
}
|
||||
};
|
||||
|
||||
IDUnion id;
|
||||
const char* layer_name;
|
||||
const char* start_marker;
|
||||
const char* end_marker;
|
||||
float_t start_time;
|
||||
float_t end_time;
|
||||
AetFlags flags;
|
||||
int32_t index;
|
||||
int32_t layer;
|
||||
spr::SprPrio prio;
|
||||
resolution_mode mode;
|
||||
vec3 pos;
|
||||
vec3 rot;
|
||||
vec3 scale;
|
||||
vec3 anchor;
|
||||
float_t frame_speed;
|
||||
vec4 color;
|
||||
std::map<std::string, int32_t> layer_sprite;
|
||||
std::string sound_path;
|
||||
std::map<std::string, std::string> sound_replace;
|
||||
int32_t sound_queue_index;
|
||||
std::map<uint32_t, uint32_t> sprite_replace;
|
||||
std::map<uint32_t, texture*> sprite_texture;
|
||||
std::map<uint32_t, uint32_t> sprite_discard;
|
||||
FrameRateControl* frame_rate_control;
|
||||
bool sound_voice;
|
||||
|
||||
const sprite_database* spr_db;
|
||||
|
||||
AetArgs();
|
||||
~AetArgs();
|
||||
};
|
||||
|
||||
struct aet_layer_object_data {
|
||||
mat4 mat;
|
||||
vec3 position;
|
||||
vec3 anchor;
|
||||
float_t width;
|
||||
float_t height;
|
||||
float_t opacity;
|
||||
vec4u8 color;
|
||||
resolution_mode mode;
|
||||
|
||||
aet_layer_object_data();
|
||||
};
|
||||
|
||||
extern void aet_manager_init();
|
||||
extern void aet_manager_add_aet_sets(const aet_database* aet_db, bool modern);
|
||||
extern bool aet_manager_add_task();
|
||||
extern bool aet_manager_check_task_ready();
|
||||
extern bool aet_manager_del_task();
|
||||
extern void aet_manager_free_aet_object(uint32_t id);
|
||||
extern void aet_manager_free_aet_object_reset(uint32_t* id);
|
||||
extern void aet_manager_free_aet_set_objects(uint32_t set_id, const aet_database* aet_db);
|
||||
extern bool aet_manager_get_obj_disp(uint32_t id);
|
||||
extern float_t aet_manager_get_obj_frame(uint32_t id);
|
||||
extern bool aet_manager_get_obj_visible(uint32_t id);
|
||||
extern void aet_manager_get_scene_comp_layer_names(std::vector<std::string>& vec,
|
||||
uint32_t aet_id, const aet_database* aet_db);
|
||||
extern float_t aet_manager_get_scene_end_time(uint32_t aet_id, const aet_database* aet_db);
|
||||
extern float_t aet_manager_get_scene_layer_end_time(uint32_t aet_id,
|
||||
const char* layer_name, const aet_database* aet_db);
|
||||
extern void aet_manager_get_scene_layer_marker_names(std::vector<std::string>& vec,
|
||||
uint32_t aet_id, const char* layer_name, const aet_database* aet_db);
|
||||
extern float_t aet_manager_get_scene_layer_marker_time(uint32_t aet_id,
|
||||
const char* scene_name, const char* marker_name, const aet_database* aet_db);
|
||||
extern float_t aet_manager_get_scene_layer_start_time(uint32_t aet_id,
|
||||
const char* layer_name, const aet_database* aet_db);
|
||||
extern const char* aet_manager_get_scene_name(uint32_t aet_id, const aet_database* aet_db);
|
||||
extern float_t aet_manager_get_scene_start_time(uint32_t aet_id, const aet_database* aet_db);
|
||||
extern uint32_t aet_manager_get_scenes_count(uint32_t set_id, const aet_database* aet_db);
|
||||
extern bool aet_manager_get_set_ready(uint32_t set_id, const aet_database* aet_db);
|
||||
extern void aet_manager_init_aet_layout(std::map<std::string, aet_layer_object_data>* data,
|
||||
AetArgs args, const aet_database* aet_db);
|
||||
extern void aet_manager_init_aet_layout(std::map<std::string, aet_layer_object_data>* data,
|
||||
uint32_t aet_id, const char* layer_name, AetFlags flags, resolution_mode mode,
|
||||
const char* start_marker, float_t start_time, const aet_database* aet_db);
|
||||
extern uint32_t aet_manager_init_aet_object(AetArgs args, const aet_database* aet_db);
|
||||
extern uint32_t aet_manager_init_aet_object(uint32_t id, const char* layer_name, spr::SprPrio prio,
|
||||
AetFlags flags, const char* start_marker, const char* end_marker, const aet_database* aet_db);
|
||||
extern uint32_t aet_manager_init_aet_object(uint32_t aet_id, spr::SprPrio prio,
|
||||
AetFlags flags, const char* layer_name, const vec2* pos, int32_t index,
|
||||
const char* start_marker, const char* end_marker, float_t start_time, float_t end_time,
|
||||
const vec2* scale, FrameRateControl* frame_rate_control, const aet_database* aet_db);
|
||||
extern bool aet_manager_load_file(uint32_t set_id, const aet_database* aet_db);
|
||||
extern void aet_manager_read_file(uint32_t set_id,
|
||||
std::string& mdata_dir, void* data, const aet_database* aet_db);
|
||||
extern void aet_manager_read_file(uint32_t set_id,
|
||||
std::string&& mdata_dir, void* data, const aet_database* aet_db);
|
||||
extern void aet_manager_remove_aet_sets(const aet_database* aet_db, bool modern);
|
||||
extern void aet_manager_set_obj_alpha(uint32_t id, float_t value);
|
||||
extern void aet_manager_set_obj_color(uint32_t id, const vec4& value);
|
||||
extern void aet_manager_set_obj_end_time(uint32_t id, float_t value);
|
||||
extern void aet_manager_set_obj_frame(uint32_t id, float_t frame);
|
||||
extern void aet_manager_set_obj_play(uint32_t id, bool value);
|
||||
extern void aet_manager_set_obj_position(uint32_t id, const vec3& value);
|
||||
extern void aet_manager_set_obj_prio(uint32_t id, spr::SprPrio prio);
|
||||
extern void aet_manager_set_obj_rotation(uint32_t id, const vec3& value);
|
||||
extern void aet_manager_set_obj_scale(uint32_t id, const vec3& value);
|
||||
extern void aet_manager_set_obj_sprite_discard(uint32_t id, std::map<uint32_t, uint32_t>& value);
|
||||
extern void aet_manager_set_obj_sprite_replace(uint32_t id, std::map<uint32_t, uint32_t>& value);
|
||||
extern void aet_manager_set_obj_sprite_texture(uint32_t id, std::map<uint32_t, texture*>& value);
|
||||
extern void aet_manager_set_obj_visible(uint32_t id, bool value);
|
||||
extern void aet_manager_unload_set(uint32_t set_id, const aet_database* aet_db);
|
||||
extern void aet_manager_free();
|
||||
+45
-11
@@ -16,8 +16,10 @@
|
||||
#include "clear_color.hpp"
|
||||
#include "object.hpp"
|
||||
#include "pv_db.hpp"
|
||||
#include "task.hpp"
|
||||
#include "task_effect.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "sprite.hpp"
|
||||
#include "stage.hpp"
|
||||
|
||||
namespace auth_3d_detail {
|
||||
@@ -100,7 +102,7 @@ static float_t auth_3d_camera_root_calc_frame(auth_3d_camera_root* cr, float_t f
|
||||
static void auth_3d_camera_root_load(auth_3d* auth, auth_3d_camera_root* cr, auth_3d_camera_root_file* crf);
|
||||
static void auth_3d_camera_root_view_point_load(auth_3d* auth, auth_3d_camera_root_view_point* crvp,
|
||||
auth_3d_camera_root_view_point_file* crvpf);
|
||||
static void auth_3d_chara_disp(auth_3d_chara* c, mat4* parent_mat, render_context* rctx);
|
||||
static void auth_3d_chara_disp(auth_3d_chara* c, auth_3d* auth, render_context* rctx);
|
||||
static void auth_3d_chara_load(auth_3d* auth, auth_3d_chara* c, auth_3d_chara_file* cf);
|
||||
static void auth_3d_curve_load(auth_3d* auth, auth_3d_curve* c, auth_3d_curve_file* cf);
|
||||
static void auth_3d_dof_load(auth_3d* auth, auth_3d_dof* d, auth_3d_dof_file* df);
|
||||
@@ -142,7 +144,7 @@ static void auth_3d_object_texture_pattern_load(auth_3d* auth, auth_3d_object_te
|
||||
static void auth_3d_object_texture_transform_load(auth_3d* auth, auth_3d_object_texture_transform* ott,
|
||||
auth_3d_object_texture_transform_file* ottf, texture_database* tex_db);
|
||||
static void auth_3d_play_control_load(auth_3d* auth, auth_3d_play_control_file* pcf);
|
||||
static void auth_3d_point_disp(auth_3d_point* p, mat4* parent_mat, render_context* rctx);
|
||||
static void auth_3d_point_disp(auth_3d_point* p, auth_3d* auth, render_context* rctx);
|
||||
static void auth_3d_point_load(auth_3d* auth, auth_3d_point* p, auth_3d_point_file* pf);
|
||||
static void auth_3d_post_process_load(auth_3d* auth, auth_3d_post_process* pp, auth_3d_post_process_file* ppf);
|
||||
static void auth_3d_post_process_restore_prev_value(auth_3d_post_process* pp, render_context* rctx);
|
||||
@@ -193,7 +195,7 @@ static auth_3d_detail::FrameRateTimeStop frame_rate_time_stop;
|
||||
extern render_context* rctx_ptr;
|
||||
|
||||
auth_3d::auth_3d() : uid(), id(), mat(), enable(), camera_root_update(), visible(), repeat(), ended(),
|
||||
left_right_reverse(), once(), alpha(), chara_id(), chara_item(), shadow(), frame_rate(), frame(),
|
||||
left_right_reverse(), once(), alpha(), chara_id(), chara_item(), shadow(), pos(), frame_rate(), frame(),
|
||||
req_frame(), max_frame(), frame_changed(), frame_offset(), last_frame(), paused(), event_time_next() {
|
||||
hash = hash_murmurhash_empty;
|
||||
src_chara = CHARA_MAX;
|
||||
@@ -412,13 +414,16 @@ void auth_3d::disp(render_context* rctx) {
|
||||
if (state != 2 || !enable)
|
||||
return;
|
||||
|
||||
if (pos)
|
||||
spr::put_rgb_cross(mat);
|
||||
|
||||
auth_3d_set_material_list(this, rctx);
|
||||
|
||||
for (auth_3d_point& i : point)
|
||||
auth_3d_point_disp(&i, &mat, rctx);
|
||||
auth_3d_point_disp(&i, this, rctx);
|
||||
|
||||
for (auth_3d_chara& i : chara)
|
||||
auth_3d_chara_disp(&i, &mat, rctx);
|
||||
auth_3d_chara_disp(&i, this, rctx);
|
||||
|
||||
for (auth_3d_object*& i : object_list)
|
||||
auth_3d_object_disp(i, this, rctx);
|
||||
@@ -712,6 +717,7 @@ void auth_3d::reset() {
|
||||
shadow = false;
|
||||
src_chara = CHARA_MAX;
|
||||
dst_chara = CHARA_MAX;
|
||||
pos = 0;
|
||||
frame_rate = &sys_frame_rate;
|
||||
frame = 0.0f;
|
||||
req_frame = 0.0f;
|
||||
@@ -2472,6 +2478,14 @@ void auth_3d_id::set_paused(bool value) {
|
||||
}
|
||||
}
|
||||
|
||||
void auth_3d_id::set_pos(int32_t value) {
|
||||
if (id >= 0 && ((id & 0x7FFF) < AUTH_3D_DATA_COUNT)) {
|
||||
auth_3d* auth = &auth_3d_data->data[id & 0x7FFF];
|
||||
if (auth->id == id)
|
||||
auth->pos = value;
|
||||
}
|
||||
}
|
||||
|
||||
void auth_3d_id::set_repeat(bool value) {
|
||||
if (id >= 0 && ((id & 0x7FFF) < AUTH_3D_DATA_COUNT)) {
|
||||
auth_3d* auth = &auth_3d_data->data[id & 0x7FFF];
|
||||
@@ -2545,7 +2559,8 @@ auth_3d_data_struct::~auth_3d_data_struct() {
|
||||
}
|
||||
|
||||
void auth_3d_data_init() {
|
||||
auth_3d_data = new auth_3d_data_struct;
|
||||
if (!auth_3d_data)
|
||||
auth_3d_data = new auth_3d_data_struct;
|
||||
}
|
||||
|
||||
bool auth_3d_data_check_category_loaded(const char* category_name) {
|
||||
@@ -2827,11 +2842,15 @@ void auth_3d_data_unload_category(uint32_t category_hash) {
|
||||
}
|
||||
|
||||
void auth_3d_data_free() {
|
||||
delete auth_3d_data;
|
||||
if (auth_3d_data) {
|
||||
delete auth_3d_data;
|
||||
auth_3d_data = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void task_auth_3d_init() {
|
||||
task_auth_3d = new auth_3d_detail::TaskAuth3d;
|
||||
if (!task_auth_3d)
|
||||
task_auth_3d = new auth_3d_detail::TaskAuth3d;
|
||||
}
|
||||
|
||||
bool task_auth_3d_add_task() {
|
||||
@@ -3459,8 +3478,14 @@ static void auth_3d_camera_root_view_point_load(auth_3d* auth, auth_3d_camera_ro
|
||||
}
|
||||
}
|
||||
|
||||
static void auth_3d_chara_disp(auth_3d_chara* c, mat4* parent_mat, render_context* rctx) {
|
||||
static void auth_3d_chara_disp(auth_3d_chara* c, auth_3d* auth, render_context* rctx) {
|
||||
if (c->index <= ROB_CHARA_COUNT)
|
||||
rob_chara_array_set_visibility(c->index, c->model_transform.visible);
|
||||
|
||||
if (auth->pos) {
|
||||
c->model_transform.set_mat(&auth->mat);
|
||||
spr::put_rgb_cross(c->model_transform.mat);
|
||||
}
|
||||
}
|
||||
|
||||
static void auth_3d_chara_load(auth_3d* auth, auth_3d_chara* c, auth_3d_chara_file* cf) {
|
||||
@@ -5411,6 +5436,9 @@ static void auth_3d_object_disp(auth_3d_object* o, auth_3d* auth, render_context
|
||||
return;
|
||||
|
||||
if (!auth->visible) {
|
||||
if (auth->pos)
|
||||
spr::put_rgb_cross(o->model_transform.mat);
|
||||
|
||||
for (auth_3d_object*& i : o->children_object)
|
||||
auth_3d_object_disp(i, auth, rctx);
|
||||
for (auth_3d_object_hrc*& i : o->children_object_hrc)
|
||||
@@ -5538,6 +5566,9 @@ static void auth_3d_object_disp(auth_3d_object* o, auth_3d* auth, render_context
|
||||
disp_manager.set_texture_pattern();
|
||||
disp_manager.set_obj_flags();
|
||||
|
||||
if (auth->pos)
|
||||
spr::put_rgb_cross(o->model_transform.mat);
|
||||
|
||||
for (auth_3d_object*& i : o->children_object)
|
||||
auth_3d_object_disp(i, auth, rctx);
|
||||
for (auth_3d_object_hrc*& i : o->children_object_hrc)
|
||||
@@ -5907,8 +5938,11 @@ static void auth_3d_play_control_load(auth_3d* auth, auth_3d_play_control_file*
|
||||
pc->size = pcf->size;
|
||||
}
|
||||
|
||||
static void auth_3d_point_disp(auth_3d_point* p, mat4* parent_mat, render_context* rctx) {
|
||||
|
||||
static void auth_3d_point_disp(auth_3d_point* p, auth_3d* auth, render_context* rctx) {
|
||||
if (auth->pos) {
|
||||
p->model_transform.set_mat(&auth->mat);
|
||||
spr::put_rgb_cross(p->model_transform.mat);
|
||||
}
|
||||
}
|
||||
|
||||
static void auth_3d_point_load(auth_3d* auth, auth_3d_point* p, auth_3d_point_file* pf) {
|
||||
|
||||
+2
-1
@@ -14,7 +14,6 @@
|
||||
#include "../KKdLib/kf.hpp"
|
||||
#include "frame_rate_control.hpp"
|
||||
#include "render_context.hpp"
|
||||
#include "task.hpp"
|
||||
|
||||
enum auth_3d_ambient_flags {
|
||||
AUTH_3D_AMBIENT_LIGHT_DIFFUSE = 0x01,
|
||||
@@ -840,6 +839,7 @@ struct auth_3d_id {
|
||||
void set_mat(const mat4& value);
|
||||
void set_max_frame(float_t value);
|
||||
void set_paused(bool value);
|
||||
void set_pos(int32_t value);
|
||||
void set_repeat(bool value);
|
||||
void set_req_frame(float_t value);
|
||||
void set_shadow(bool value);
|
||||
@@ -866,6 +866,7 @@ struct auth_3d {
|
||||
bool shadow;
|
||||
int32_t src_chara;
|
||||
int32_t dst_chara;
|
||||
int32_t pos;
|
||||
FrameRateControl* frame_rate;
|
||||
float_t frame;
|
||||
float_t req_frame;
|
||||
|
||||
+12
-4
@@ -10,10 +10,11 @@ static void camera_calculate_projection_aet(camera* c);
|
||||
static void camera_calculate_view(camera* c);
|
||||
static void camera_calculate_forward(camera* c);
|
||||
|
||||
camera::camera() : forward(), rotation(), view_point(), interest(), render_width(), render_height(),
|
||||
sprite_width(), sprite_height(), field_1E4(), field_1F0(), field_1FC(), field_208(), yaw(),
|
||||
pitch(), roll(), aspect(), fov(), fov_rad(), max_distance(), min_distance(), changed_view(),
|
||||
changed_proj(), changed_proj_aet(), fast_change(), fast_change_hist0(), fast_change_hist1() {
|
||||
camera::camera() : forward(), rotation(), view_point(), interest(), fov_correct_height(),
|
||||
aet_depth(), render_width(), render_height(), sprite_width(), sprite_height(),
|
||||
field_1E4(), field_1F0(), field_1FC(), field_208(), yaw(), pitch(), roll(), aspect(),
|
||||
fov(), fov_rad(), max_distance(), min_distance(), changed_view(), changed_proj(),
|
||||
changed_proj_aet(), fast_change(), fast_change_hist0(), fast_change_hist1() {
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +26,8 @@ void camera::initialize(double_t aspect, int32_t render_width,
|
||||
int32_t render_height, int32_t sprite_width, int32_t sprite_height) {
|
||||
this->aspect = aspect;
|
||||
fov = 0.0;
|
||||
fov_correct_height = 0.0f;
|
||||
aet_depth = 0.0f;
|
||||
forward = { 0.0f, 0.0f, -1.0f };
|
||||
rotation = { 0.0f, 0.0f, 0.0f };
|
||||
view_point = { 0.0, 0.0f, 0.0f };
|
||||
@@ -335,6 +338,7 @@ static void camera_calculate_projection(camera* c) {
|
||||
mat4_inverse(&c->projection, &c->inv_projection);
|
||||
|
||||
float_t fov_correct_height = (float_t)(((double_t)c->render_height * 0.5) / tan(c->fov_rad * 0.5));
|
||||
|
||||
float_t height = (float_t)c->render_height * 0.5f;
|
||||
float_t width = (float_t)c->render_height * (float_t)c->aspect * 0.5f;
|
||||
|
||||
@@ -363,6 +367,10 @@ static void camera_calculate_projection_aet(camera* c) {
|
||||
float_t render_half_height = (float_t)c->render_height * 0.5f;
|
||||
|
||||
float_t aet_depth = sprite_half_height / (tanf(0.34557518363f) * 0.75f);
|
||||
c->aet_depth = aet_depth;
|
||||
|
||||
float_t fov_correct_height = (float_t)(sprite_half_height / tan(c->fov_rad * 0.5));
|
||||
c->fov_correct_height = fov_correct_height;
|
||||
|
||||
float_t v8a = (float_t)c->min_distance / aet_depth * sprite_half_width;
|
||||
float_t v8b = (float_t)c->min_distance / aet_depth * sprite_half_height;
|
||||
|
||||
@@ -24,6 +24,8 @@ struct camera {
|
||||
mat4 inv_view_rot;
|
||||
mat4 projection_aet_2d;
|
||||
mat4 projection_aet_3d;
|
||||
float_t fov_correct_height;
|
||||
float_t aet_depth;
|
||||
vec3 forward;
|
||||
vec3 rotation;
|
||||
vec3 view_point;
|
||||
|
||||
+13
-1
@@ -60,6 +60,18 @@ void data_struct_load_db() {
|
||||
data_struct* ds = &data_list[DATA_AFT];
|
||||
data_ft* d = &ds->data_ft;
|
||||
|
||||
for (const std::string& i : mdata_manager_get()->GetPrefixes()) {
|
||||
std::string file;
|
||||
file.assign(i);
|
||||
file.append("aet_db.bin");
|
||||
|
||||
aet_database_file aet_db_file;
|
||||
aet_db_file.modern = false;
|
||||
ds->load_file(&aet_db_file, "rom/2d/", file.c_str(),
|
||||
aet_database_file::load_file);
|
||||
d->aet_db.add(&aet_db_file);
|
||||
}
|
||||
|
||||
for (const std::string& i : mdata_manager_get()->GetPrefixes()) {
|
||||
std::string file;
|
||||
file.assign(i);
|
||||
@@ -563,7 +575,7 @@ bool data_struct::get_file(const char* dir, uint32_t hash, const char* ext, std:
|
||||
}
|
||||
|
||||
bool data_struct::load_file(void* data, const char* path,
|
||||
bool (*load_func)(void* data, const char* path, const char* file, uint32_t hash)) {
|
||||
bool (*load_func)(void* data, const char* path, const char* file, uint32_t hash)) {
|
||||
const char* t = strrchr(path, '/');
|
||||
if (t) {
|
||||
std::string dir = std::string(path, t - path + 1);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../KKdLib/default.hpp"
|
||||
#include "../KKdLib/database/aet.hpp"
|
||||
#include "../KKdLib/database/auth_3d.hpp"
|
||||
#include "../KKdLib/database/bone.hpp"
|
||||
#include "../KKdLib/database/motion.hpp"
|
||||
@@ -65,6 +66,7 @@ struct data_f2 {
|
||||
#endif
|
||||
|
||||
struct data_ft {
|
||||
aet_database aet_db;
|
||||
auth_3d_database auth_3d_db;
|
||||
bone_database bone_data;
|
||||
motion_database mot_db;
|
||||
|
||||
+3
-14
@@ -1688,20 +1688,9 @@ texture* obj_database_get_obj_set_texture(int32_t set, uint32_t tex_id) {
|
||||
if (!handler)
|
||||
return 0;
|
||||
|
||||
std::pair<uint32_t, uint32_t>* texture = handler->tex_id_data.data();
|
||||
size_t length = handler->tex_id_data.size();
|
||||
size_t temp;
|
||||
while (length > 0)
|
||||
if (tex_id <= texture[temp = length / 2].first)
|
||||
length /= 2;
|
||||
else {
|
||||
texture += temp + 1;
|
||||
length -= temp + 1;
|
||||
}
|
||||
|
||||
if (texture != handler->tex_id_data.data() + handler->tex_id_data.size()
|
||||
&& tex_id == texture->first)
|
||||
return (*textures)[texture->second];
|
||||
auto elem = handler->tex_id_data.find(tex_id);
|
||||
if (elem != handler->tex_id_data.end())
|
||||
return (*textures)[elem->second];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,8 +258,8 @@ void post_process::apply(camera* cam, texture* light_proj_tex, int32_t npr_param
|
||||
gl_state_bind_sampler(i, 0);
|
||||
|
||||
fbo::blit(screen_texture.fbos[0], fbo_texture.fbos[0],
|
||||
screen_x_offset, screen_y_offset, sprite_width, sprite_height,
|
||||
0, 0, render_width, render_height, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
0, 0, screen_width, screen_height,
|
||||
0, 0, screen_width, screen_height, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
}
|
||||
|
||||
void post_process::ctrl(camera* cam) {
|
||||
|
||||
+10
-8
@@ -375,12 +375,12 @@ namespace pv_param {
|
||||
}
|
||||
|
||||
bool post_process_data_load_files(int32_t pv_id) {
|
||||
std::string path = "rom/pv_param/";
|
||||
|
||||
char buf[0x100];
|
||||
sprintf_s(buf, sizeof(buf), "pv%03d/", pv_id);
|
||||
|
||||
path += buf;
|
||||
std::string path;
|
||||
path.assign("rom/pv_param/");
|
||||
path.append(buf);
|
||||
|
||||
if (data_list[DATA_AFT].check_directory_exists(path.c_str()))
|
||||
return post_process_data.load_files(path);
|
||||
@@ -388,17 +388,19 @@ namespace pv_param {
|
||||
}
|
||||
|
||||
bool post_process_data_load_files(int32_t pv_id, std::string& mdata_dir) {
|
||||
std::string path = "rom/pv_param/";
|
||||
|
||||
char buf[0x100];
|
||||
sprintf_s(buf, sizeof(buf), "pv%03d/", pv_id);
|
||||
|
||||
path += buf;
|
||||
std::string path;
|
||||
path.assign("rom/pv_param/");
|
||||
path.append(buf);
|
||||
|
||||
if (mdata_dir.size()) {
|
||||
std::string temp_path = mdata_dir + path;
|
||||
std::string temp_path;
|
||||
temp_path.assign(mdata_dir);
|
||||
temp_path.append(path);
|
||||
if (data_list[DATA_AFT].check_directory_exists(temp_path.c_str()))
|
||||
path = temp_path;
|
||||
path.assign(temp_path);
|
||||
}
|
||||
|
||||
if (data_list[DATA_AFT].check_directory_exists(path.c_str()))
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "file_handler.hpp"
|
||||
#include "render_manager.hpp"
|
||||
#include "shader_ft.hpp"
|
||||
#include "sprite.hpp"
|
||||
#include "sound.hpp"
|
||||
#include "stage.hpp"
|
||||
|
||||
@@ -18,6 +19,8 @@ int32_t delta_frame_history_int = 0;
|
||||
|
||||
extern render_context* rctx_ptr;
|
||||
|
||||
//extern void dw_gui_ctrl_disp();
|
||||
|
||||
static void object_data_get_vertex_attrib_buffer_bindings(const mdl::ObjSubMeshArgs* args,
|
||||
int32_t texcoord_array[2], GLuint vertex_attrib_buffer_binding[16]);
|
||||
|
||||
@@ -2098,7 +2101,7 @@ namespace rndr {
|
||||
cpu_time(), gpu_time(), time(), draw_pass_3d(), reflect_type(), tex_index(),
|
||||
multisample_framebuffer(), multisample_renderbuffer(), multisample(), show_vector_flags(),
|
||||
show_vector_length(), show_vector_z_offset(), field_2F8(), effect_texture(), npr_param(),
|
||||
field_31C(), field_31D(), field_31E(), field_31F(), field_320(), npr(), samplers() {
|
||||
field_31C(), field_31D(), field_31E(), field_31F(), field_320(), npr(), samplers(), sprite_samplers() {
|
||||
for (bool& i : pass_sw)
|
||||
i = true;
|
||||
reflect = true;
|
||||
@@ -2126,11 +2129,12 @@ namespace rndr {
|
||||
}
|
||||
gl_state_bind_framebuffer(0);
|
||||
|
||||
static const vec4 border_color = 0.0f;
|
||||
|
||||
glCreateSamplers(18, samplers);
|
||||
for (int32_t i = 0; i < 18; i++) {
|
||||
GLuint sampler = samplers[i];
|
||||
|
||||
static const vec4 border_color = 0.0f;
|
||||
glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, (GLfloat*)&border_color);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER,
|
||||
i % 2 ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR);
|
||||
@@ -2165,9 +2169,36 @@ namespace rndr {
|
||||
}
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_WRAP_T, wrap_t);
|
||||
}
|
||||
|
||||
GLuint sampler;
|
||||
glCreateSamplers(3, sprite_samplers);
|
||||
sampler = sprite_samplers[0];
|
||||
glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, (GLfloat*)&border_color);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f);
|
||||
|
||||
sampler = sprite_samplers[1];
|
||||
glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, (GLfloat*)&border_color);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f);
|
||||
|
||||
sampler = sprite_samplers[2];
|
||||
glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, (GLfloat*)&border_color);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_NEAREST);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glSamplerParameteri(sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f);
|
||||
}
|
||||
|
||||
RenderManager::~RenderManager() {
|
||||
glDeleteSamplers(3, sprite_samplers);
|
||||
glDeleteSamplers(18, samplers);
|
||||
|
||||
if (multisample_framebuffer) {
|
||||
@@ -2468,6 +2499,7 @@ chara_refract(), view_mat(), matrix_buffer(), box_vao(), box_vbo() {
|
||||
imgfilter_batch_ubo.Create(sizeof(imgfilter_batch_shader_data));
|
||||
glass_eye_batch_ubo.Create(sizeof(glass_eye_batch_shader_data));
|
||||
quad_ubo.Create(sizeof(quad_shader_data));
|
||||
sprite_scene_ubo.Create(sizeof(sprite_scene_shader_data));
|
||||
sss_filter_gaussian_coef_ubo.Create(sizeof(sss_filter_gaussian_coef_shader_data));
|
||||
transparency_batch_ubo.Create(sizeof(transparency_batch_shader_data));
|
||||
|
||||
@@ -2486,6 +2518,7 @@ render_context::~render_context() {
|
||||
|
||||
transparency_batch_ubo.Destroy();
|
||||
sss_filter_gaussian_coef_ubo.Destroy();
|
||||
sprite_scene_ubo.Destroy();
|
||||
quad_ubo.Destroy();
|
||||
glass_eye_batch_ubo.Destroy();
|
||||
imgfilter_batch_ubo.Destroy();
|
||||
@@ -2522,10 +2555,15 @@ void render_context::ctrl() {
|
||||
void render_context::disp() {
|
||||
rctx_ptr = this;
|
||||
disp_manager.refresh();
|
||||
sprite_manager_reset_req_list();
|
||||
draw_state.stats_prev = draw_state.stats;
|
||||
draw_state.stats.reset();
|
||||
app::TaskWork::Disp();
|
||||
render_manager.shadow_ptr->ctrl(this);
|
||||
int32_t sprite_index = sprite_manager_get_index();
|
||||
sprite_manager_set_index(3);
|
||||
//dw_gui_ctrl_disp();
|
||||
sprite_manager_set_index(sprite_index);
|
||||
post_process.ctrl(camera);
|
||||
render_manager.render_all(this);
|
||||
app::TaskWork::Basic();
|
||||
|
||||
@@ -595,6 +595,7 @@ namespace rndr {
|
||||
bool npr;
|
||||
sss_data sss_data;
|
||||
GLuint samplers[18];
|
||||
GLuint sprite_samplers[3];
|
||||
|
||||
RenderManager();
|
||||
~RenderManager();
|
||||
@@ -791,6 +792,11 @@ struct quad_shader_data {
|
||||
vec4 g_texture_lod;
|
||||
};
|
||||
|
||||
struct sprite_scene_shader_data {
|
||||
mat4 g_transform;
|
||||
vec4 g_framebuffer_size;
|
||||
};
|
||||
|
||||
struct sss_filter_gaussian_coef_shader_data {
|
||||
vec4 g_param;
|
||||
vec4 g_coef[64];
|
||||
@@ -828,6 +834,7 @@ struct render_context {
|
||||
GL::UniformBuffer imgfilter_batch_ubo;
|
||||
GL::UniformBuffer glass_eye_batch_ubo;
|
||||
GL::UniformBuffer quad_ubo;
|
||||
GL::UniformBuffer sprite_scene_ubo;
|
||||
GL::UniformBuffer sss_filter_gaussian_coef_ubo;
|
||||
GL::UniformBuffer transparency_batch_ubo;
|
||||
|
||||
|
||||
+19
-21
@@ -14,6 +14,7 @@
|
||||
#include "post_process.hpp"
|
||||
#include "render_texture.hpp"
|
||||
#include "shader_ft.hpp"
|
||||
#include "sprite.hpp"
|
||||
#include "static_var.hpp"
|
||||
#include "task_effect.hpp"
|
||||
#include "texture.hpp"
|
||||
@@ -478,7 +479,7 @@ namespace rndr {
|
||||
if (!sss_data.enable || !sss_data.npr_contour) {
|
||||
pp->set_render_texture();
|
||||
|
||||
if (false/*sprite_manager_get_reqlist_count(2)*/) {
|
||||
if (sprite_manager_get_reqlist_count(2)) {
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClearDepth(1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
@@ -495,7 +496,7 @@ namespace rndr {
|
||||
gl_state_bind_framebuffer(0);
|
||||
}
|
||||
else {
|
||||
if (false/*sprite_manager_get_reqlist_count(2)*/) {
|
||||
if (sprite_manager_get_reqlist_count(2)) {
|
||||
pp->set_render_texture();
|
||||
|
||||
vec4 clear_color = 0.0f;
|
||||
@@ -516,19 +517,19 @@ namespace rndr {
|
||||
}
|
||||
|
||||
void RenderManager::pass_sprite_bg(render_context* rctx) {
|
||||
if (!(false/*sprite_manager_get_reqlist_count(2)*/))
|
||||
if (!sprite_manager_get_reqlist_count(2))
|
||||
return;
|
||||
|
||||
post_process* pp = &rctx->post_process;
|
||||
pp->set_render_texture(true);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
//rctx->camera->projection_aet_3d;
|
||||
gl_state_set_depth_mask(GL_FALSE);
|
||||
gl_state_disable_depth_test();
|
||||
gl_state_enable_blend();
|
||||
gl_state_disable_cull_face();
|
||||
//sprite_manager_draw(2, 1, pp->aa->mlaa_buffer[1].color_texture->tex);
|
||||
sprite_manager_draw(rctx, 2, true,
|
||||
pp->aa->temp_buffer.color_texture, rctx->camera->projection_aet_3d);
|
||||
gl_state_enable_cull_face();
|
||||
gl_state_disable_blend();
|
||||
gl_state_enable_depth_test();
|
||||
@@ -774,7 +775,11 @@ namespace rndr {
|
||||
}
|
||||
|
||||
void RenderManager::pass_sprite_fg(render_context* rctx) {
|
||||
if (!sprite_manager_get_reqlist_count(0))
|
||||
return;
|
||||
|
||||
post_process* pp = &rctx->post_process;
|
||||
glViewport(0, 0, pp->screen_width, pp->screen_height);
|
||||
|
||||
if (multisample && multisample_framebuffer) {
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, multisample_framebuffer);
|
||||
@@ -782,13 +787,14 @@ namespace rndr {
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
//rctx->camera->projection_aet_2d;
|
||||
else
|
||||
rctx->post_process.fbo_texture.bind();
|
||||
|
||||
gl_state_disable_depth_test();
|
||||
gl_state_enable_blend();
|
||||
gl_state_disable_cull_face();
|
||||
//sprite_manager_draw(0, 1, pp->aa->mlaa_buffer[1].color_texture->tex);
|
||||
sprite_manager_draw(rctx, 0, true,
|
||||
pp->aa->temp_buffer.color_texture, rctx->camera->projection_aet_2d);
|
||||
gl_state_enable_cull_face();
|
||||
gl_state_disable_blend();
|
||||
gl_state_enable_depth_test();
|
||||
@@ -837,16 +843,18 @@ namespace rndr {
|
||||
}
|
||||
|
||||
void RenderManager::pass_sprite_fg_surf(render_context* rctx) {
|
||||
if (!(false/*sprite_manager_get_reqlist_count(1)*/))
|
||||
if (!sprite_manager_get_reqlist_count(1))
|
||||
return;
|
||||
|
||||
//rctx->camera->projection_aet_2d;
|
||||
post_process* pp = &rctx->post_process;
|
||||
|
||||
gl_state_set_depth_mask(GL_FALSE);
|
||||
gl_state_disable_depth_test();
|
||||
gl_state_disable_depth_test();
|
||||
gl_state_enable_blend();
|
||||
gl_state_disable_cull_face();
|
||||
//sprite_manager_draw(1, 1, rctx->post_process.aa->temp_buffer.color_texture);
|
||||
sprite_manager_draw(rctx, 1, true,
|
||||
pp->aa->temp_buffer.color_texture, rctx->camera->projection_aet_2d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1287,16 +1295,6 @@ static void draw_pass_sss_filter(render_context* rctx, sss_data* a1) {
|
||||
gl_state_bind_texture_2d(0);
|
||||
}
|
||||
|
||||
void sub_1404A9350(post_process* a1, bool a2) {
|
||||
if (a2) {
|
||||
a1->aet_back_texture.bind();
|
||||
a1->aet_back = 1;
|
||||
}
|
||||
else
|
||||
a1->rend_texture.bind();
|
||||
glViewport(0, 0, a1->render_width, a1->render_height);
|
||||
}
|
||||
|
||||
static int32_t draw_pass_3d_get_translucent_count(render_context* rctx) {
|
||||
int32_t count = 0;
|
||||
count += rctx->disp_manager.get_obj_count(mdl::OBJ_TYPE_OPAQUE_ALPHA_ORDER_1);
|
||||
|
||||
@@ -5,14 +5,6 @@
|
||||
|
||||
#include "resolution_mode.hpp"
|
||||
|
||||
struct resolution_mode_scale_data {
|
||||
vec2 scale;
|
||||
vec2 src_res;
|
||||
vec2 dst_res;
|
||||
resolution_mode src_mode;
|
||||
resolution_mode dst_mode;
|
||||
};
|
||||
|
||||
const resolution_table_struct resolution_table[] = {
|
||||
{ 320, 240, 0, 0, 0, 320, 225 }, // QVGA
|
||||
{ 640, 480, 0, 0, 60, 640, 360 }, // VGA
|
||||
@@ -90,6 +82,24 @@ resolution_struct::resolution_struct(::resolution_mode mode) {
|
||||
}
|
||||
}
|
||||
|
||||
resolution_mode_scale_data::resolution_mode_scale_data(
|
||||
resolution_mode src_mode, resolution_mode dst_mode) {
|
||||
scale = 1.0f;
|
||||
src_res = 0.0f;
|
||||
dst_res = 0.0f;
|
||||
this->src_mode = src_mode;
|
||||
this->dst_mode = dst_mode;
|
||||
scale = resolution_mode_get_scale(dst_mode, src_mode);
|
||||
if (dst_mode != RESOLUTION_MODE_MAX && src_mode != RESOLUTION_MODE_MAX
|
||||
&& dst_mode >= RESOLUTION_MODE_QVGA && src_mode >= RESOLUTION_MODE_MAX
|
||||
&& dst_mode < RESOLUTION_MODE_MAX && src_mode < RESOLUTION_MODE_MAX) {
|
||||
src_res.x = (float_t)resolution_table[src_mode].width_full * 0.5f;
|
||||
src_res.y = (float_t)resolution_table[src_mode].height_full * 0.5f;
|
||||
dst_res.x = (float_t)resolution_table[dst_mode].width_full * 0.5f;
|
||||
dst_res.y = (float_t)resolution_table[dst_mode].height_full * 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
resolution_struct* res_window_get() {
|
||||
return &res_window;
|
||||
}
|
||||
|
||||
@@ -92,6 +92,16 @@ struct resolution_struct {
|
||||
resolution_struct(::resolution_mode mode);
|
||||
};
|
||||
|
||||
struct resolution_mode_scale_data {
|
||||
vec2 scale;
|
||||
vec2 src_res;
|
||||
vec2 dst_res;
|
||||
resolution_mode src_mode;
|
||||
resolution_mode dst_mode;
|
||||
|
||||
resolution_mode_scale_data(resolution_mode src_mode, resolution_mode dst_mode);
|
||||
};
|
||||
|
||||
extern const resolution_table_struct resolution_table[];
|
||||
|
||||
extern resolution_struct* res_window_get();
|
||||
|
||||
@@ -541,7 +541,7 @@ int32_t OsageCollision::cls_ball_oidashi(vec3& vec, const vec3& p, const vec3& c
|
||||
}
|
||||
|
||||
// 0x140484540
|
||||
int32_t OsageCollision::cls_capsule_oidashi(vec3& vec, const vec3& p, const OsageCollision::Work* cls, const float_t r) {
|
||||
int32_t OsageCollision::cls_capsule_oidashi(vec3& vec, const vec3& p, const OsageCollision::Work* cls, const float_t r) {
|
||||
vec3 v11 = p - cls->pos[0];
|
||||
|
||||
float_t v17 = vec3::dot(v11, cls->vec_center);
|
||||
|
||||
@@ -11315,6 +11315,10 @@ void rob_chara_array_set_alpha_obj_flags(int32_t chara_id, float_t alpha, mdl::O
|
||||
}
|
||||
}
|
||||
|
||||
void rob_chara_array_set_visibility(int32_t chara_id, bool value) {
|
||||
rob_chara_array[chara_id].set_visibility(value);
|
||||
}
|
||||
|
||||
bool pv_osage_manager_array_get_disp() {
|
||||
bool disp = false;
|
||||
for (int32_t i = 0; i < ROB_CHARA_COUNT; i++)
|
||||
|
||||
@@ -3529,6 +3529,7 @@ extern int32_t rob_chara_array_init_chara_index(chara_index chara_index,
|
||||
extern void rob_chara_array_free_chara_id(int32_t chara_id);
|
||||
extern void rob_chara_array_reset_bone_data_item_equip(int32_t chara_id);
|
||||
extern void rob_chara_array_set_alpha_obj_flags(int32_t chara_id, float_t alpha, mdl::ObjFlags flags);
|
||||
extern void rob_chara_array_set_visibility(int32_t chara_id, bool value);
|
||||
|
||||
extern bool rob_chara_check_for_ageageagain_module(chara_index chara_index, int32_t module_index);
|
||||
|
||||
|
||||
+1664
-87
File diff suppressed because it is too large
Load Diff
+168
-43
@@ -8,26 +8,34 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include "../KKdLib/default.hpp"
|
||||
#include "../KKdLib/database/sprite.hpp"
|
||||
#include "../KKdLib/mat.hpp"
|
||||
#include "../KKdLib/vec.hpp"
|
||||
#include "render_context.hpp"
|
||||
#include "resolution_mode.hpp"
|
||||
#include "texture.hpp"
|
||||
#include "gl_state.hpp"
|
||||
|
||||
struct rectangle {
|
||||
vec2 pos;
|
||||
vec2 size;
|
||||
|
||||
inline rectangle() : pos(), size() {
|
||||
|
||||
}
|
||||
|
||||
inline rectangle(vec2 pos, vec2 size) {
|
||||
this->pos = pos;
|
||||
this->size = size;
|
||||
}
|
||||
|
||||
inline rectangle(float_t pos_x, float_t pos_y, float_t size_x, float_t size_y) {
|
||||
this->pos = { pos_x, pos_y };
|
||||
this->size = { size_x, size_y };
|
||||
}
|
||||
};
|
||||
|
||||
namespace spr {
|
||||
enum SprKind {
|
||||
SPR_KIND_NORMAL = 0,
|
||||
SPR_KIND_LINE,
|
||||
SPR_KIND_LINES,
|
||||
SPR_KIND_RECT,
|
||||
SPR_KIND_MULTI,
|
||||
SPR_KIND_ARROW_A,
|
||||
SPR_KIND_ARROW_B,
|
||||
SPR_KIND_ARROW_AB,
|
||||
SPR_KIND_TRIANGLE,
|
||||
SPR_KIND_CIRCLE,
|
||||
};
|
||||
|
||||
enum SprAttr : uint32_t {
|
||||
/*M_SPR_ATTR_SCALESIZE_X = 0x800,
|
||||
M_SPR_ATTR_SCALESIZE_Y = 0x1000,
|
||||
@@ -48,21 +56,95 @@ namespace spr {
|
||||
M_SPR_ATTR_SCALESIZE = 0x1800,
|
||||
M_SPR_ATTR_NOTCORRECT = 0x18000,*/
|
||||
|
||||
SPR_ATTR_FLIP_H = 0x00010000,
|
||||
SPR_ATTR_FLIP_V = 0x00020000,
|
||||
SPR_ATTR_CTR_LT = 0x00040000,
|
||||
SPR_ATTR_CTR_CT = 0x00080000,
|
||||
SPR_ATTR_CTR_RT = 0x00100000,
|
||||
SPR_ATTR_CTR_LC = 0x00200000,
|
||||
SPR_ATTR_CTR_CC = 0x00400000,
|
||||
SPR_ATTR_CTR_RC = 0x00800000,
|
||||
SPR_ATTR_CTR_LB = 0x01000000,
|
||||
SPR_ATTR_CTR_CB = 0x02000000,
|
||||
SPR_ATTR_CTR_RB = 0x04000000,
|
||||
SPR_ATTR_MATRIX = 0x08000000,
|
||||
SPR_ATTR_NOBLEND = 0x20000000,
|
||||
SPR_ATTR_FLIP_H = 0x00010000,
|
||||
SPR_ATTR_FLIP_V = 0x00020000,
|
||||
SPR_ATTR_CTR_LT = 0x00040000,
|
||||
SPR_ATTR_CTR_CT = 0x00080000,
|
||||
SPR_ATTR_CTR_RT = 0x00100000,
|
||||
SPR_ATTR_CTR_LC = 0x00200000,
|
||||
SPR_ATTR_CTR_CC = 0x00400000,
|
||||
SPR_ATTR_CTR_RC = 0x00800000,
|
||||
SPR_ATTR_CTR_LB = 0x01000000,
|
||||
SPR_ATTR_CTR_CB = 0x02000000,
|
||||
SPR_ATTR_CTR_RB = 0x04000000,
|
||||
SPR_ATTR_MATRIX = 0x08000000,
|
||||
SPR_ATTR_10000000 = 0x10000000,
|
||||
SPR_ATTR_NOBLEND = 0x20000000,
|
||||
|
||||
SPR_ATTR_CTR = 0x07FC0000,
|
||||
SPR_ATTR_CTR = 0x07FC0000,
|
||||
};
|
||||
|
||||
enum SprKind {
|
||||
SPR_KIND_NORMAL = 0,
|
||||
SPR_KIND_LINE,
|
||||
SPR_KIND_LINES,
|
||||
SPR_KIND_RECT,
|
||||
SPR_KIND_MULTI,
|
||||
SPR_KIND_ARROW_A,
|
||||
SPR_KIND_ARROW_B,
|
||||
SPR_KIND_ARROW_AB,
|
||||
SPR_KIND_TRIANGLE,
|
||||
SPR_KIND_CIRCLE,
|
||||
};
|
||||
|
||||
enum SprPrio {
|
||||
/*SPR_PRIO_INFORMATION = SPR_PRIO_11,
|
||||
SPR_PRIO_FRONTSIDE = SPR_PRIO_20,
|
||||
SPR_PRIO_FOREGROUND = SPR_PRIO_24,
|
||||
SPR_PRIO_SCREENSAVER = SPR_PRIO_30,
|
||||
SPR_PRIO_VISTAFRAME = SPR_PRIO_23,
|
||||
SPR_PRIO_PHASE_BACKGROUND_STA = SPR_PRIO_00,
|
||||
SPR_PRIO_PHASE_BACKGROUND_END = SPR_PRIO_04,
|
||||
SPR_PRIO_PHASE_DEFAULT_STA = SPR_PRIO_05,
|
||||
SPR_PRIO_PHASE_DEFAULT_END = SPR_PRIO_20,
|
||||
SPR_PRIO_PHASE_FOREGROUND_STA = SPR_PRIO_21,
|
||||
SPR_PRIO_PHASE_FOREGROUND_END = SPR_PRIO_26,
|
||||
SPR_PRIO_PHASE_DEBUG_STA = SPR_PRIO_27,
|
||||
SPR_PRIO_PHASE_DEBUG_END = SPR_PRIO_31,*/
|
||||
|
||||
SPR_PRIO_00 = 0,
|
||||
SPR_PRIO_01,
|
||||
SPR_PRIO_02,
|
||||
SPR_PRIO_03,
|
||||
SPR_PRIO_04,
|
||||
SPR_PRIO_05,
|
||||
SPR_PRIO_06,
|
||||
SPR_PRIO_07,
|
||||
SPR_PRIO_08,
|
||||
SPR_PRIO_09,
|
||||
SPR_PRIO_10,
|
||||
SPR_PRIO_11,
|
||||
SPR_PRIO_12,
|
||||
SPR_PRIO_13,
|
||||
SPR_PRIO_14,
|
||||
SPR_PRIO_15,
|
||||
SPR_PRIO_16,
|
||||
SPR_PRIO_17,
|
||||
SPR_PRIO_18,
|
||||
SPR_PRIO_19,
|
||||
SPR_PRIO_20,
|
||||
SPR_PRIO_21,
|
||||
SPR_PRIO_22,
|
||||
SPR_PRIO_23,
|
||||
SPR_PRIO_24,
|
||||
SPR_PRIO_25,
|
||||
SPR_PRIO_26,
|
||||
SPR_PRIO_27,
|
||||
SPR_PRIO_28,
|
||||
SPR_PRIO_29,
|
||||
SPR_PRIO_30,
|
||||
SPR_PRIO_31,
|
||||
SPR_PRIO_MAX,
|
||||
|
||||
SPR_PRIO_BACKGROUND = SPR_PRIO_03,
|
||||
SPR_PRIO_DEFAULT = SPR_PRIO_07,
|
||||
SPR_PRIO_DEBUG = SPR_PRIO_29,
|
||||
};
|
||||
|
||||
struct SpriteVertex {
|
||||
vec3 pos;
|
||||
vec2 uv;
|
||||
vec4u8 color;
|
||||
};
|
||||
|
||||
struct SprArgs {
|
||||
@@ -71,17 +153,27 @@ namespace spr {
|
||||
TEXTURE_POS_SIZE = 0x02,
|
||||
};
|
||||
|
||||
spr::SprKind kind;
|
||||
union {
|
||||
union IDUnion {
|
||||
int32_t index;
|
||||
//spr_info info;
|
||||
} id;
|
||||
vec4 color;
|
||||
uint32_t id;
|
||||
spr_info info;
|
||||
|
||||
IDUnion() {
|
||||
index = -1;
|
||||
id = -1;
|
||||
info = {};
|
||||
}
|
||||
};
|
||||
|
||||
SprKind kind;
|
||||
IDUnion id;
|
||||
bool modern;
|
||||
vec4u8 color;
|
||||
SprAttr attr;
|
||||
int32_t blend;
|
||||
int32_t index;
|
||||
int32_t layer;
|
||||
int32_t prio;
|
||||
SprPrio prio;
|
||||
resolution_mode resolution_mode_screen;
|
||||
resolution_mode resolution_mode_sprite;
|
||||
vec3 center;
|
||||
@@ -92,8 +184,7 @@ namespace spr {
|
||||
mat4 mat;
|
||||
texture* texture;
|
||||
int32_t shader;
|
||||
int32_t field_AC;
|
||||
//sprite_vertex* vertex_array;
|
||||
SpriteVertex* vertex_array;
|
||||
size_t num_vertex;
|
||||
Flags flags;
|
||||
vec2 sprite_size;
|
||||
@@ -101,6 +192,15 @@ namespace spr {
|
||||
vec2 texture_pos;
|
||||
vec2 texture_size;
|
||||
spr::SprArgs* next;
|
||||
|
||||
SprArgs();
|
||||
|
||||
void Reset();
|
||||
void SetSpriteSize(vec2 size);
|
||||
void SetTexturePosSize(float_t x, float_t y, float_t width, float_t height);
|
||||
void SetVertexArray(SpriteVertex* vertex_array, size_t num_vertex);
|
||||
|
||||
static void SetNext(SprArgs* args, SprArgs* next);
|
||||
};
|
||||
|
||||
struct SprInfo {
|
||||
@@ -116,12 +216,6 @@ namespace spr {
|
||||
float_t height;
|
||||
};
|
||||
|
||||
struct SpriteVertex {
|
||||
vec3 pos;
|
||||
vec2 uv;
|
||||
vec4u8 color;
|
||||
};
|
||||
|
||||
struct TexCoord {
|
||||
struct UV {
|
||||
float_t u;
|
||||
@@ -149,10 +243,41 @@ namespace spr {
|
||||
}
|
||||
};
|
||||
|
||||
void calc_sprite_vertex(spr::SprArgs* args, vec3* vtx, mat4* mat, bool font);
|
||||
vec2 proj_sprite_3d_line(vec3 vec, bool offset);
|
||||
|
||||
void put_cross(const mat4& mat, vec4u8 color_x, vec4u8 color_y, vec4u8 color_z);
|
||||
void put_rgb_cross(const mat4& mat);
|
||||
spr::SprArgs* put_sprite(const spr::SprArgs& args, const sprite_database* spr_db);
|
||||
void put_sprite_3d_line(vec3 p1, vec3 p2, vec4u8 color);
|
||||
void put_sprite_line(vec2 p1, vec2 p2, resolution_mode mode, spr::SprPrio prio, vec4u8 color, int32_t layer);
|
||||
void put_sprite_multi(rectangle rect, resolution_mode mode, spr::SprPrio prio, vec4u8 color, int32_t layer);
|
||||
void put_sprite_rect(rectangle rect, resolution_mode mode, spr::SprPrio prio, vec4u8 color, int32_t layer);
|
||||
void put_sprite_triangles(SpriteVertex* vert, size_t size, resolution_mode mode,
|
||||
SprPrio prio, int32_t spr_id, int32_t layer, const sprite_database* spr_db);
|
||||
}
|
||||
|
||||
extern void sprite_manager_init();
|
||||
extern void sprite_manager_load_set(int32_t set_id, std::string* mdata_dir);
|
||||
extern void sprite_manager_add_spr_sets(const sprite_database* spr_db, bool modern);
|
||||
extern void sprite_manager_clear();
|
||||
extern void sprite_manager_draw(render_context* rctx,
|
||||
int32_t index, bool font, texture* tex, const mat4& proj);
|
||||
extern int32_t sprite_manager_get_index();
|
||||
extern size_t sprite_manager_get_reqlist_count(int32_t index);
|
||||
extern bool sprite_manager_get_set_ready(uint32_t set_id, const sprite_database* spr_db);
|
||||
extern uint32_t sprite_manager_get_set_sprite_num(uint32_t set_id, const sprite_database* spr_db);
|
||||
extern uint32_t sprite_manager_get_set_texture_num(uint32_t set_id, const sprite_database* spr_db);
|
||||
extern const char* sprite_manager_get_spr_name(uint32_t spr_id, const sprite_database* spr_db);
|
||||
extern rectangle sprite_manager_get_spr_rectangle(uint32_t spr_id, const sprite_database* spr_db);
|
||||
extern texture* sprite_manager_get_spr_texture(uint32_t spr_id, const sprite_database* spr_db);
|
||||
extern bool sprite_manager_load_file(uint32_t set_id, const sprite_database* spr_db);
|
||||
extern void sprite_manager_read_file(uint32_t set_id,
|
||||
std::string& mdata_dir, void* data, const sprite_database* spr_db);
|
||||
extern void sprite_manager_read_file(uint32_t set_id,
|
||||
std::string&& mdata_dir, void* data, const sprite_database* spr_db);
|
||||
extern void sprite_manager_remove_spr_sets(const sprite_database* spr_db, bool modern);
|
||||
extern void sprite_manager_reset_req_list();
|
||||
extern void sprite_manager_reset_res_data();
|
||||
extern void sprite_manager_set_index(int32_t value);
|
||||
extern void sprite_manager_set_res(double_t aspect, int32_t width, int32_t height);
|
||||
extern void sprite_manager_unload_set(uint32_t set_id, const sprite_database* spr_db);
|
||||
extern void sprite_manager_free();
|
||||
|
||||
@@ -4,3 +4,756 @@
|
||||
*/
|
||||
|
||||
#include "aet.hpp"
|
||||
#include "../f2/struct.hpp"
|
||||
#include "../io/file_stream.hpp"
|
||||
#include "../io/memory_stream.hpp"
|
||||
#include "../io/path.hpp"
|
||||
#include "../hash.hpp"
|
||||
#include "../sort.hpp"
|
||||
#include "../str_utils.hpp"
|
||||
|
||||
static void aet_database_file_classic_read_inner(aet_database_file* aet_db, stream& s);
|
||||
static void aet_database_file_classic_write_inner(aet_database_file* aet_db, stream& s);
|
||||
static void aet_database_file_modern_read_inner(aet_database_file* aet_db, stream& s, uint32_t header_length);
|
||||
static void aet_database_file_modern_write_inner(aet_database_file* aet_db, stream& s);
|
||||
static int64_t aet_database_file_strings_get_string_offset(std::vector<string_hash>& vec,
|
||||
std::vector<int64_t>& vec_off, std::string& str);
|
||||
static bool aet_database_file_strings_push_back_check(std::vector<string_hash>& vec, std::string& str);
|
||||
|
||||
const aet_db_aet_set aet_db_aet_set_null;
|
||||
const aet_db_aet aet_db_aet_null;
|
||||
|
||||
aet_db_aet_file::aet_db_aet_file() : id(), index() {
|
||||
|
||||
}
|
||||
|
||||
aet_db_aet_file::~aet_db_aet_file() {
|
||||
|
||||
}
|
||||
|
||||
aet_db_aet::aet_db_aet() : id() {
|
||||
name_hash = hash_murmurhash_empty;
|
||||
}
|
||||
|
||||
aet_db_aet::~aet_db_aet() {
|
||||
|
||||
}
|
||||
|
||||
aet_db_aet_set_file::aet_db_aet_set_file() : id(), index(), sprite_set_id() {
|
||||
|
||||
}
|
||||
|
||||
aet_db_aet_set_file::~aet_db_aet_set_file() {
|
||||
|
||||
}
|
||||
|
||||
aet_db_aet_set::aet_db_aet_set() : id(), index(), sprite_set_id() {
|
||||
name_hash = hash_murmurhash_empty;
|
||||
file_name_hash = hash_murmurhash_empty;
|
||||
}
|
||||
|
||||
aet_db_aet_set::~aet_db_aet_set() {
|
||||
|
||||
}
|
||||
|
||||
aet_database_file::aet_database_file() : ready(), modern(), big_endian(), is_x() {
|
||||
|
||||
}
|
||||
|
||||
aet_database_file::~aet_database_file() {
|
||||
|
||||
}
|
||||
|
||||
void aet_database_file::read(const char* path, bool modern) {
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
if (!modern) {
|
||||
char* path_bin = str_utils_add(path, ".bin");
|
||||
if (path_check_file_exists(path_bin)) {
|
||||
file_stream s;
|
||||
s.open(path_bin, "rb");
|
||||
if (s.check_not_null()) {
|
||||
uint8_t* data = force_malloc_s(uint8_t, s.length);
|
||||
s.read(data, s.length);
|
||||
memory_stream s_bin;
|
||||
s_bin.open(data, s.length);
|
||||
aet_database_file_classic_read_inner(this, s_bin);
|
||||
free_def(data);
|
||||
}
|
||||
}
|
||||
free_def(path_bin);
|
||||
}
|
||||
else {
|
||||
char* path_spi = str_utils_add(path, ".aei");
|
||||
if (path_check_file_exists(path_spi)) {
|
||||
f2_struct st;
|
||||
st.read(path_spi);
|
||||
if (st.header.signature == reverse_endianness_uint32_t('AEDB')) {
|
||||
memory_stream s_spdb;
|
||||
s_spdb.open(st.data);
|
||||
s_spdb.big_endian = st.header.use_big_endian;
|
||||
aet_database_file_modern_read_inner(this, s_spdb, st.header.length);
|
||||
}
|
||||
}
|
||||
free_def(path_spi);
|
||||
}
|
||||
}
|
||||
|
||||
void aet_database_file::read(const wchar_t* path, bool modern) {
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
if (!modern) {
|
||||
wchar_t* path_bin = str_utils_add(path, L".bin");
|
||||
if (path_check_file_exists(path_bin)) {
|
||||
file_stream s;
|
||||
s.open(path_bin, L"rb");
|
||||
if (s.check_not_null()) {
|
||||
uint8_t* data = force_malloc_s(uint8_t, s.length);
|
||||
s.read(data, s.length);
|
||||
memory_stream s_bin;
|
||||
s_bin.open(data, s.length);
|
||||
aet_database_file_classic_read_inner(this, s_bin);
|
||||
free_def(data);
|
||||
}
|
||||
}
|
||||
free_def(path_bin);
|
||||
}
|
||||
else {
|
||||
wchar_t* path_spi = str_utils_add(path, L".aei");
|
||||
if (path_check_file_exists(path_spi)) {
|
||||
f2_struct st;
|
||||
st.read(path_spi);
|
||||
if (st.header.signature == reverse_endianness_uint32_t('AEDB')) {
|
||||
memory_stream s_spdb;
|
||||
s_spdb.open(st.data);
|
||||
s_spdb.big_endian = st.header.use_big_endian;
|
||||
aet_database_file_modern_read_inner(this, s_spdb, st.header.length);
|
||||
}
|
||||
}
|
||||
free_def(path_spi);
|
||||
}
|
||||
}
|
||||
|
||||
void aet_database_file::read(const void* data, size_t size, bool modern) {
|
||||
if (!data || !size)
|
||||
return;
|
||||
|
||||
if (!modern) {
|
||||
memory_stream s;
|
||||
s.open(data, size);
|
||||
aet_database_file_classic_read_inner(this, s);
|
||||
}
|
||||
else {
|
||||
f2_struct st;
|
||||
st.read(data, size);
|
||||
if (st.header.signature == reverse_endianness_uint32_t('SPDB')) {
|
||||
memory_stream s_spdb;
|
||||
s_spdb.open(st.data);
|
||||
s_spdb.big_endian = st.header.use_big_endian;
|
||||
aet_database_file_modern_read_inner(this, s_spdb, st.header.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void aet_database_file::write(const char* path) {
|
||||
if (!path || !ready)
|
||||
return;
|
||||
|
||||
if (!modern) {
|
||||
char* path_bin = str_utils_add(path, ".bin");
|
||||
file_stream s;
|
||||
s.open(path_bin, "wb");
|
||||
if (s.check_not_null())
|
||||
aet_database_file_classic_write_inner(this, s);
|
||||
free_def(path_bin);
|
||||
}
|
||||
else {
|
||||
char* path_spi = str_utils_add(path, ".spi");
|
||||
file_stream s;
|
||||
s.open(path_spi, "wb");
|
||||
if (s.check_not_null())
|
||||
aet_database_file_modern_write_inner(this, s);
|
||||
free_def(path_spi);
|
||||
}
|
||||
}
|
||||
|
||||
void aet_database_file::write(const wchar_t* path) {
|
||||
if (!path || !ready)
|
||||
return;
|
||||
|
||||
if (!modern) {
|
||||
wchar_t* path_bin = str_utils_add(path, L".bin");
|
||||
file_stream s;
|
||||
s.open(path_bin, L"wb");
|
||||
if (s.check_not_null())
|
||||
aet_database_file_classic_write_inner(this, s);
|
||||
free_def(path_bin);
|
||||
}
|
||||
else {
|
||||
wchar_t* path_spi = str_utils_add(path, L".spi");
|
||||
file_stream s;
|
||||
s.open(path_spi, L"wb");
|
||||
if (s.check_not_null())
|
||||
aet_database_file_modern_write_inner(this, s);
|
||||
free_def(path_spi);
|
||||
}
|
||||
}
|
||||
|
||||
void aet_database_file::write(void** data, size_t* size) {
|
||||
if (!data || !size || !ready)
|
||||
return;
|
||||
|
||||
memory_stream s;
|
||||
s.open();
|
||||
if (!modern)
|
||||
aet_database_file_classic_write_inner(this, s);
|
||||
else
|
||||
aet_database_file_modern_write_inner(this, s);
|
||||
s.align_write(0x10);
|
||||
s.copy(data, size);
|
||||
}
|
||||
|
||||
bool aet_database_file::load_file(void* data, const char* path, const char* file, uint32_t hash) {
|
||||
size_t file_len = utf8_length(file);
|
||||
|
||||
const char* t = strrchr(file, '.');
|
||||
if (t)
|
||||
file_len = t - file;
|
||||
|
||||
std::string s;
|
||||
s.assign(path);
|
||||
s.append(file, file_len);
|
||||
|
||||
aet_database_file* aet_db = (aet_database_file*)data;
|
||||
aet_db->read(s.c_str(), aet_db->modern);
|
||||
|
||||
return aet_db->ready;
|
||||
}
|
||||
|
||||
aet_database::aet_database() {
|
||||
|
||||
}
|
||||
|
||||
aet_database::~aet_database() {
|
||||
|
||||
}
|
||||
|
||||
void aet_database::add(aet_database_file* aet_db_file) {
|
||||
if (!aet_db_file || !aet_db_file->ready)
|
||||
return;
|
||||
|
||||
size_t aet_sets_count = this->aet_set_ids.size();
|
||||
|
||||
aet_set_ids.reserve(aet_db_file->aet_set.size());
|
||||
aet_set_indices.reserve(aet_db_file->aet_set.size());
|
||||
aet_set_names.reserve(aet_db_file->aet_set.size());
|
||||
|
||||
for (aet_db_aet_set_file& i : aet_db_file->aet_set) {
|
||||
aet_db_aet_set aet_set;
|
||||
aet_set.id = i.id;
|
||||
aet_set.name.assign(i.name);
|
||||
aet_set.name_hash = hash_string_murmurhash(aet_set.name);
|
||||
aet_set.file_name.assign(i.file_name);
|
||||
aet_set.file_name_hash = hash_string_murmurhash(aet_set.file_name);
|
||||
aet_set.index = (uint16_t)(aet_sets_count + i.index);
|
||||
aet_set.sprite_set_id = i.sprite_set_id;
|
||||
|
||||
aet_set_ids.push_back({ aet_set.id, aet_set });
|
||||
aet_set_indices.push_back({ aet_set.index, aet_set });
|
||||
aet_set_names.push_back({ aet_set.name, aet_set });
|
||||
|
||||
aet_ids.reserve(i.aet.size());
|
||||
aet_names.reserve(i.aet.size());
|
||||
aet_indices.reserve(i.aet.size());
|
||||
|
||||
for (aet_db_aet_file& j : i.aet) {
|
||||
aet_db_aet aet;
|
||||
aet.id = j.id;
|
||||
aet.name.assign(j.name);
|
||||
aet.name_hash = hash_string_murmurhash(aet.name);
|
||||
aet.info = { j.index, aet_set.index };
|
||||
|
||||
aet_ids.push_back({ aet.id, aet });
|
||||
aet_names.push_back({ aet.name, aet });
|
||||
aet_indices.push_back({ aet.info, aet });
|
||||
}
|
||||
}
|
||||
|
||||
aet_set_ids.combine();
|
||||
aet_set_indices.combine();
|
||||
aet_set_names.combine();
|
||||
aet_ids.combine();
|
||||
aet_names.combine();
|
||||
aet_indices.combine();
|
||||
}
|
||||
|
||||
const aet_db_aet_set* aet_database::get_aet_set_by_name(const char* name) const {
|
||||
auto elem = aet_set_names.find(std::string(name));
|
||||
if (elem != aet_set_names.end())
|
||||
return &elem->second;
|
||||
return &aet_db_aet_set_null;
|
||||
}
|
||||
|
||||
const aet_db_aet_set* aet_database::get_aet_set_by_id(uint32_t set_id) const {
|
||||
auto elem = aet_set_ids.find(set_id);
|
||||
if (elem != aet_set_ids.end())
|
||||
return &elem->second;
|
||||
return &aet_db_aet_set_null;
|
||||
}
|
||||
|
||||
const aet_db_aet_set* aet_database::get_aet_set_by_index(uint32_t index) const {
|
||||
auto elem = aet_set_indices.find(index);
|
||||
if (elem != aet_set_indices.end())
|
||||
return &elem->second;
|
||||
return &aet_db_aet_set_null;
|
||||
}
|
||||
|
||||
const aet_db_aet* aet_database::get_aet_by_name(const char* name) const {
|
||||
auto elem = aet_names.find(std::string(name));
|
||||
if (elem != aet_names.end())
|
||||
return &elem->second;
|
||||
return &aet_db_aet_null;
|
||||
}
|
||||
|
||||
const aet_db_aet* aet_database::get_aet_by_id(uint32_t id) const {
|
||||
auto elem = aet_ids.find(id);
|
||||
if (elem != aet_ids.end())
|
||||
return &elem->second;
|
||||
return &aet_db_aet_null;
|
||||
}
|
||||
|
||||
const aet_db_aet* aet_database::get_aet_by_set_id_index(uint32_t set_id, uint32_t index) const {
|
||||
auto elem = aet_indices.find({ (uint16_t)index, get_aet_set_by_id(set_id)->index });
|
||||
if (elem != aet_indices.end())
|
||||
return &elem->second;
|
||||
return &aet_db_aet_null;
|
||||
}
|
||||
|
||||
const aet_db_aet* aet_database::get_tex_by_set_id_index(uint32_t set_id, uint32_t index) const {
|
||||
auto elem = aet_indices.find({ (uint16_t)index, (uint16_t)(0x1000 | get_aet_set_by_id(set_id)->index) });
|
||||
if (elem != aet_indices.end())
|
||||
return &elem->second;
|
||||
return &aet_db_aet_null;
|
||||
}
|
||||
|
||||
const char* aet_database::get_aet_set_file_name(uint32_t set_id) const {
|
||||
return get_aet_set_by_id(set_id)->file_name.c_str();
|
||||
}
|
||||
|
||||
uint32_t aet_database::get_aet_set_id_by_name(const char* name) const {
|
||||
return get_aet_set_by_name(name)->id;
|
||||
}
|
||||
|
||||
uint32_t aet_database::get_aet_set_id_by_name_index(uint32_t index) const {
|
||||
return aet_set_names[index].second.id;
|
||||
}
|
||||
|
||||
const char* aet_database::get_aet_set_name(uint32_t set_id) const {
|
||||
return get_aet_set_by_id(set_id)->name.c_str();
|
||||
}
|
||||
|
||||
static void aet_database_file_classic_read_inner(aet_database_file* aet_db, stream& s) {
|
||||
uint32_t aet_sets_count = s.read_uint32_t();
|
||||
uint32_t aet_sets_offset = s.read_uint32_t();
|
||||
uint32_t aets_count = s.read_uint32_t();
|
||||
uint32_t aets_offset = s.read_uint32_t();
|
||||
|
||||
aet_db->aet_set.resize(aet_sets_count);
|
||||
|
||||
aet_db_aet_set_file* aet_db_aet_set = aet_db->aet_set.data();
|
||||
|
||||
s.position_push(aet_sets_offset, SEEK_SET);
|
||||
for (uint32_t i = 0; i < aet_sets_count; i++) {
|
||||
aet_db_aet_set_file& aet_set = aet_db_aet_set[i];
|
||||
aet_set.id = s.read_uint32_t();
|
||||
aet_set.name = s.read_string_null_terminated_offset(s.read_uint32_t());
|
||||
aet_set.file_name = s.read_string_null_terminated_offset(s.read_uint32_t());
|
||||
aet_set.index = (uint16_t)s.read_uint32_t();
|
||||
aet_set.sprite_set_id = s.read_uint32_t();
|
||||
}
|
||||
s.position_pop();
|
||||
|
||||
s.position_push(aets_offset, SEEK_SET);
|
||||
for (uint32_t i = 0; i < aets_count; i++) {
|
||||
uint32_t id = s.read_uint32_t();
|
||||
uint32_t name_offset = s.read_uint32_t();
|
||||
uint32_t info = s.read_uint32_t();
|
||||
|
||||
uint16_t index = (uint16_t)(info & 0xFFFF);
|
||||
uint16_t set_index = (uint16_t)(info >> 16);
|
||||
|
||||
aet_db_aet_set_file& aet_set = aet_db_aet_set[set_index];
|
||||
|
||||
aet_set.aet.push_back({});
|
||||
aet_db_aet_file& aet = aet_set.aet.back();
|
||||
aet.id = id;
|
||||
aet.name.assign(s.read_string_null_terminated_offset(name_offset));
|
||||
aet.index = index;
|
||||
}
|
||||
s.position_pop();
|
||||
|
||||
aet_db->ready = true;
|
||||
aet_db->modern = false;
|
||||
aet_db->big_endian = false;
|
||||
aet_db->is_x = false;
|
||||
}
|
||||
|
||||
static void aet_database_file_classic_write_inner(aet_database_file* aet_db, stream& s) {
|
||||
s.write_uint32_t(0x90669066);
|
||||
s.write_uint32_t(0x90669066);
|
||||
s.write_uint32_t(0x90669066);
|
||||
s.write_uint32_t(0x90669066);
|
||||
s.write_uint32_t(0x90669066);
|
||||
s.write_uint32_t(0x90669066);
|
||||
s.write_uint32_t(0x90669066);
|
||||
s.write_uint32_t(0x90669066);
|
||||
s.align_write(0x20);
|
||||
|
||||
size_t aet_sets_count = aet_db->aet_set.size();
|
||||
|
||||
size_t aets_count = 0;
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set)
|
||||
aets_count += i.aet.size();
|
||||
|
||||
int64_t aets_offset = s.get_position();
|
||||
s.write(0x0C * aets_count);
|
||||
s.align_write(0x20);
|
||||
|
||||
int64_t aet_sets_offset = s.get_position();
|
||||
s.write(0x10 * aet_db->aet_set.size());
|
||||
s.align_write(0x20);
|
||||
|
||||
std::vector<string_hash> strings;
|
||||
std::vector<int64_t> string_offsets;
|
||||
|
||||
strings.reserve(aet_sets_count + aets_count);
|
||||
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set)
|
||||
for (aet_db_aet_file& j : i.aet)
|
||||
if (aet_database_file_strings_push_back_check(strings, j.name)) {
|
||||
string_offsets.push_back(s.get_position());
|
||||
s.write_string_null_terminated(j.name);
|
||||
}
|
||||
s.align_write(0x04);
|
||||
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set) {
|
||||
if (aet_database_file_strings_push_back_check(strings, i.name)) {
|
||||
string_offsets.push_back(s.get_position());
|
||||
s.write_string_null_terminated(i.name);
|
||||
}
|
||||
|
||||
if (aet_database_file_strings_push_back_check(strings, i.file_name)) {
|
||||
string_offsets.push_back(s.get_position());
|
||||
s.write_string_null_terminated(i.file_name);
|
||||
}
|
||||
}
|
||||
s.align_write(0x04);
|
||||
|
||||
s.position_push(aets_offset, SEEK_SET);
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set) {
|
||||
uint16_t aet_set_index = i.index;
|
||||
|
||||
for (aet_db_aet_file& j : i.aet) {
|
||||
s.write_uint32_t(j.id);
|
||||
s.write_uint32_t((uint32_t)aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, j.name));
|
||||
s.write_uint32_t((aet_set_index << 16) | j.index);
|
||||
}
|
||||
}
|
||||
s.position_pop();
|
||||
|
||||
s.position_push(aet_sets_offset, SEEK_SET);
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set) {
|
||||
s.write_uint32_t(i.id);
|
||||
s.write_uint32_t((uint32_t)aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, i.name));
|
||||
s.write_uint32_t((uint32_t)aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, i.file_name));
|
||||
s.write_uint32_t(i.index);
|
||||
s.write_uint32_t(i.sprite_set_id);
|
||||
}
|
||||
s.position_pop();
|
||||
|
||||
s.position_push(0x00, SEEK_SET);
|
||||
s.write_uint32_t((uint32_t)aet_sets_count);
|
||||
s.write_uint32_t((uint32_t)aet_sets_offset);
|
||||
s.write_uint32_t((uint32_t)aets_count);
|
||||
s.write_uint32_t((uint32_t)aets_offset);
|
||||
s.position_pop();
|
||||
}
|
||||
|
||||
static void aet_database_file_modern_read_inner(aet_database_file* aet_db, stream& s, uint32_t header_length) {
|
||||
bool big_endian = s.big_endian;
|
||||
bool is_x = true;
|
||||
|
||||
s.set_position(0x04, SEEK_SET);
|
||||
is_x &= s.read_uint32_t_reverse_endianness() == 0;
|
||||
|
||||
s.set_position(0x00, SEEK_SET);
|
||||
|
||||
uint32_t aet_sets_count = s.read_uint32_t_reverse_endianness();
|
||||
int64_t aet_sets_offset = s.read_offset(header_length, is_x);
|
||||
uint32_t aets_count = s.read_uint32_t_reverse_endianness();
|
||||
int64_t aets_offset = s.read_offset(header_length, is_x);
|
||||
|
||||
aet_db->aet_set.resize(aet_sets_count);
|
||||
|
||||
aet_db_aet_set_file* aet_db_aet_set = aet_db->aet_set.data();
|
||||
|
||||
s.position_push(aet_sets_offset, SEEK_SET);
|
||||
if (!is_x)
|
||||
for (uint32_t i = 0; i < aet_sets_count; i++) {
|
||||
aet_db_aet_set_file& aet_set = aet_db_aet_set[i];
|
||||
aet_set.id = s.read_uint32_t_reverse_endianness();
|
||||
aet_set.name = s.read_string_null_terminated_offset(s.read_offset_f2(header_length));
|
||||
aet_set.file_name = s.read_string_null_terminated_offset(s.read_offset_f2(header_length));
|
||||
aet_set.index = (uint16_t)s.read_uint32_t_reverse_endianness();
|
||||
aet_set.sprite_set_id = s.read_uint32_t_reverse_endianness();
|
||||
}
|
||||
else
|
||||
for (uint32_t i = 0; i < aet_sets_count; i++) {
|
||||
aet_db_aet_set_file& aet_set = aet_db_aet_set[i];
|
||||
aet_set.id = s.read_uint32_t_reverse_endianness();
|
||||
aet_set.name = s.read_string_null_terminated_offset(s.read_offset_x());
|
||||
aet_set.file_name = s.read_string_null_terminated_offset(s.read_offset_x());
|
||||
aet_set.index = (uint16_t)s.read_uint32_t_reverse_endianness();
|
||||
aet_set.sprite_set_id = s.read_uint32_t_reverse_endianness();
|
||||
s.align_read(0x08);
|
||||
}
|
||||
s.position_pop();
|
||||
|
||||
s.position_push(aets_offset, SEEK_SET);
|
||||
if (!is_x)
|
||||
for (uint32_t i = 0; i < aets_count; i++) {
|
||||
uint32_t id = s.read_uint32_t_reverse_endianness();
|
||||
int64_t name_offset = s.read_offset_f2(header_length);
|
||||
uint32_t info = s.read_uint32_t_reverse_endianness();
|
||||
|
||||
uint16_t index = (uint16_t)(info & 0xFFFF);
|
||||
uint16_t set_index = (uint16_t)((info >> 16) & 0xFFFF);
|
||||
|
||||
aet_db_aet_set_file& aet_set = aet_db_aet_set[set_index];
|
||||
|
||||
aet_set.aet.push_back({});
|
||||
aet_db_aet_file& aet = aet_set.aet.back();
|
||||
aet.id = id;
|
||||
aet.name.assign(s.read_string_null_terminated_offset(name_offset));
|
||||
aet.index = index;
|
||||
}
|
||||
else
|
||||
for (uint32_t i = 0; i < aets_count; i++) {
|
||||
uint32_t id = s.read_uint32_t_reverse_endianness();
|
||||
int64_t name_offset = s.read_offset_x();
|
||||
uint32_t info = s.read_uint32_t_reverse_endianness();
|
||||
s.align_read(0x08);
|
||||
|
||||
uint16_t index = (uint16_t)(info & 0xFFFF);
|
||||
uint16_t set_index = (uint16_t)((info >> 16) & 0xFFFF);
|
||||
|
||||
aet_db_aet_set_file& aet_set = aet_db_aet_set[set_index];
|
||||
|
||||
aet_set.aet.push_back({});
|
||||
aet_db_aet_file& aet = aet_set.aet.back();
|
||||
aet.id = id;
|
||||
aet.name.assign(s.read_string_null_terminated_offset(name_offset));
|
||||
aet.index = index;
|
||||
}
|
||||
s.position_pop();
|
||||
|
||||
aet_db->ready = true;
|
||||
aet_db->modern = true;
|
||||
aet_db->big_endian = big_endian;
|
||||
aet_db->is_x = is_x;
|
||||
}
|
||||
|
||||
static void aet_database_file_modern_write_inner(aet_database_file* aet_db, stream& s) {
|
||||
bool big_endian = aet_db->big_endian;
|
||||
bool is_x = aet_db->is_x;
|
||||
|
||||
memory_stream s_spdb;
|
||||
s_spdb.open();
|
||||
s_spdb.big_endian = big_endian;
|
||||
|
||||
uint32_t off;
|
||||
enrs e;
|
||||
enrs_entry ee;
|
||||
pof pof;
|
||||
|
||||
size_t aet_sets_count = aet_db->aet_set.size();
|
||||
|
||||
size_t aets_count = 0;
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set)
|
||||
aets_count += i.aet.size();
|
||||
|
||||
if (!is_x) {
|
||||
ee = { 0, 1, 16, 1 };
|
||||
ee.append(0, 4, ENRS_DWORD);
|
||||
e.vec.push_back(ee);
|
||||
off = 16;
|
||||
off = align_val(off, 0x10);
|
||||
|
||||
ee = { off, 1, 16, (uint32_t)aet_sets_count };
|
||||
ee.append(0, 4, ENRS_DWORD);
|
||||
e.vec.push_back(ee);
|
||||
off = (uint32_t)(aet_sets_count * 16ULL);
|
||||
off = align_val(off, 0x10);
|
||||
|
||||
ee = { off, 1, 12, (uint32_t)aets_count };
|
||||
ee.append(0, 3, ENRS_DWORD);
|
||||
e.vec.push_back(ee);
|
||||
off = (uint32_t)(aets_count * 12ULL);
|
||||
off = align_val(off, 0x10);
|
||||
}
|
||||
else {
|
||||
ee = { 0, 4, 32, 1 };
|
||||
ee.append(0, 1, ENRS_DWORD);
|
||||
ee.append(4, 1, ENRS_QWORD);
|
||||
ee.append(0, 1, ENRS_DWORD);
|
||||
ee.append(4, 1, ENRS_QWORD);
|
||||
e.vec.push_back(ee);
|
||||
off = 32;
|
||||
off = align_val(off, 0x10);
|
||||
|
||||
ee = { off, 3, 32, (uint32_t)aet_sets_count };
|
||||
ee.append(0, 1, ENRS_DWORD);
|
||||
ee.append(4, 2, ENRS_QWORD);
|
||||
ee.append(0, 1, ENRS_DWORD);
|
||||
e.vec.push_back(ee);
|
||||
off = (uint32_t)(aet_sets_count * 32ULL);
|
||||
off = align_val(off, 0x10);
|
||||
|
||||
ee = { off, 3, 24, (uint32_t)aets_count };
|
||||
ee.append(0, 1, ENRS_DWORD);
|
||||
ee.append(4, 1, ENRS_QWORD);
|
||||
ee.append(0, 1, ENRS_DWORD);
|
||||
e.vec.push_back(ee);
|
||||
off = (uint32_t)(aets_count * 24ULL);
|
||||
off = align_val(off, 0x10);
|
||||
}
|
||||
|
||||
s_spdb.write(is_x ? 0x20 : 0x10);
|
||||
s_spdb.align_write(0x10);
|
||||
|
||||
int64_t aet_sets_offset = s_spdb.get_position();
|
||||
s_spdb.write(aet_sets_count * (is_x ? 0x20ULL : 0x10ULL));
|
||||
s_spdb.align_write(0x10);
|
||||
|
||||
int64_t aets_offset = s_spdb.get_position();
|
||||
s_spdb.write(aets_count * (is_x ? 0x18ULL : 0x0CULL));
|
||||
s_spdb.align_write(0x10);
|
||||
|
||||
std::vector<string_hash> strings;
|
||||
std::vector<int64_t> string_offsets;
|
||||
|
||||
strings.reserve(aet_sets_count + aets_count);
|
||||
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set) {
|
||||
if (aet_database_file_strings_push_back_check(strings, i.name)) {
|
||||
string_offsets.push_back(s_spdb.get_position());
|
||||
s_spdb.write_string_null_terminated(i.name);
|
||||
}
|
||||
|
||||
if (aet_database_file_strings_push_back_check(strings, i.file_name)) {
|
||||
string_offsets.push_back(s_spdb.get_position());
|
||||
s_spdb.write_string_null_terminated(i.file_name);
|
||||
}
|
||||
}
|
||||
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set)
|
||||
for (aet_db_aet_file& j : i.aet)
|
||||
if (aet_database_file_strings_push_back_check(strings, j.name)) {
|
||||
string_offsets.push_back(s_spdb.get_position());
|
||||
s_spdb.write_string_null_terminated(j.name);
|
||||
}
|
||||
s_spdb.align_write(0x10);
|
||||
|
||||
s_spdb.position_push(0x00, SEEK_SET);
|
||||
s_spdb.write_uint32_t_reverse_endianness((uint32_t)aet_sets_count);
|
||||
io_write_offset_pof_add(s_spdb, aet_sets_offset, 0x20, is_x, &pof);
|
||||
s_spdb.write_uint32_t_reverse_endianness((uint32_t)aets_count);
|
||||
io_write_offset_pof_add(s_spdb, aets_offset, 0x20, is_x, &pof);
|
||||
s_spdb.position_pop();
|
||||
|
||||
s_spdb.position_push(aet_sets_offset, SEEK_SET);
|
||||
if (!is_x)
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set) {
|
||||
s_spdb.write_uint32_t_reverse_endianness(i.id);
|
||||
io_write_offset_f2_pof_add(s_spdb, aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, i.name), 0x20, &pof);
|
||||
io_write_offset_f2_pof_add(s_spdb, aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, i.file_name), 0x20, &pof);
|
||||
s_spdb.write_uint32_t_reverse_endianness(i.index);
|
||||
s_spdb.write_uint32_t_reverse_endianness(i.sprite_set_id);
|
||||
}
|
||||
else
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set) {
|
||||
s_spdb.write_uint32_t_reverse_endianness(i.id);
|
||||
io_write_offset_x_pof_add(s_spdb, aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, i.name), &pof);
|
||||
io_write_offset_x_pof_add(s_spdb, aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, i.file_name), &pof);
|
||||
s_spdb.write_uint32_t_reverse_endianness(i.index);
|
||||
s_spdb.write_uint32_t_reverse_endianness(i.sprite_set_id);
|
||||
}
|
||||
s_spdb.position_pop();
|
||||
|
||||
s_spdb.position_push(aets_offset, SEEK_SET);
|
||||
for (aet_db_aet_set_file& i : aet_db->aet_set) {
|
||||
uint16_t aet_set_index = i.index;
|
||||
|
||||
if (!is_x)
|
||||
for (aet_db_aet_file& j : i.aet) {
|
||||
s_spdb.write_uint32_t_reverse_endianness(j.id);
|
||||
io_write_offset_f2_pof_add(s_spdb, aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, j.name), 0x20, &pof);
|
||||
s_spdb.write_uint32_t_reverse_endianness((aet_set_index << 16) | j.index);
|
||||
}
|
||||
else
|
||||
for (aet_db_aet_file& j : i.aet) {
|
||||
s_spdb.write_uint32_t_reverse_endianness(j.id);
|
||||
io_write_offset_x_pof_add(s_spdb, aet_database_file_strings_get_string_offset(strings,
|
||||
string_offsets, j.name), &pof);
|
||||
s_spdb.write_uint32_t_reverse_endianness((aet_set_index << 16) | j.index);
|
||||
s_spdb.align_write(0x08);
|
||||
}
|
||||
}
|
||||
s_spdb.position_pop();
|
||||
|
||||
f2_struct st;
|
||||
s_spdb.align_write(0x10);
|
||||
s_spdb.copy(st.data);
|
||||
s_spdb.close();
|
||||
|
||||
st.enrs = e;
|
||||
st.pof = pof;
|
||||
|
||||
st.header.signature = reverse_endianness_uint32_t('SPDB');
|
||||
st.header.length = 0x20;
|
||||
st.header.use_big_endian = big_endian;
|
||||
st.header.use_section_size = true;
|
||||
|
||||
st.write(s, true, aet_db->is_x);
|
||||
}
|
||||
|
||||
inline static int64_t aet_database_file_strings_get_string_offset(std::vector<string_hash>& vec,
|
||||
std::vector<int64_t>& vec_off, std::string& str) {
|
||||
uint64_t hash_fnv1a64m = hash_string_fnv1a64m(str);
|
||||
uint64_t hash_murmurhash = hash_string_murmurhash(str);
|
||||
for (string_hash& i : vec)
|
||||
if (hash_fnv1a64m == i.hash_fnv1a64m && hash_murmurhash == i.hash_murmurhash)
|
||||
return vec_off[&i - vec.data()];
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline static bool aet_database_file_strings_push_back_check(std::vector<string_hash>& vec, std::string& str) {
|
||||
uint64_t hash_fnv1a64m = hash_string_fnv1a64m(str);
|
||||
uint64_t hash_murmurhash = hash_string_murmurhash(str);
|
||||
for (string_hash& i : vec)
|
||||
if (hash_fnv1a64m == i.hash_fnv1a64m && hash_murmurhash == i.hash_murmurhash)
|
||||
return false;
|
||||
|
||||
vec.push_back(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,4 +5,146 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../default.hpp"
|
||||
#include "../prj/vector_pair_combine.hpp"
|
||||
#include "../hash.hpp"
|
||||
|
||||
struct aet_info {
|
||||
uint16_t index;
|
||||
uint16_t set_index;
|
||||
|
||||
inline aet_info() {
|
||||
this->index = (uint16_t)-1;
|
||||
this->set_index = (uint16_t)-1;
|
||||
}
|
||||
|
||||
inline aet_info(uint16_t index, uint16_t set_index) {
|
||||
this->index = index;
|
||||
this->set_index = set_index;
|
||||
}
|
||||
|
||||
inline bool is_null() const {
|
||||
return index == (uint16_t)-1 && set_index == (uint16_t)-1;
|
||||
}
|
||||
|
||||
inline bool not_null() const {
|
||||
return index != (uint16_t)-1 || set_index != (uint16_t)-1;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator >(const aet_info& left, const aet_info& right) {
|
||||
return *(uint32_t*)&left > *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator <(const aet_info& left, const aet_info& right) {
|
||||
return *(uint32_t*)&left < *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator >=(const aet_info& left, const aet_info& right) {
|
||||
return *(uint32_t*)&left >= *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator <=(const aet_info& left, const aet_info& right) {
|
||||
return *(uint32_t*)&left <= *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator ==(const aet_info& left, const aet_info& right) {
|
||||
return *(uint32_t*)&left == *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator !=(const aet_info& left, const aet_info& right) {
|
||||
return *(uint32_t*)&left != *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
struct aet_db_aet_file {
|
||||
uint32_t id;
|
||||
std::string name;
|
||||
uint16_t index;
|
||||
|
||||
aet_db_aet_file();
|
||||
~aet_db_aet_file();
|
||||
};
|
||||
|
||||
struct aet_db_aet {
|
||||
uint32_t id;
|
||||
std::string name;
|
||||
uint32_t name_hash;
|
||||
aet_info info;
|
||||
|
||||
aet_db_aet();
|
||||
~aet_db_aet();
|
||||
};
|
||||
|
||||
struct aet_db_aet_set_file {
|
||||
uint32_t id;
|
||||
std::string name;
|
||||
std::string file_name;
|
||||
std::vector<aet_db_aet_file> aet;
|
||||
uint16_t index;
|
||||
uint32_t sprite_set_id;
|
||||
|
||||
aet_db_aet_set_file();
|
||||
~aet_db_aet_set_file();
|
||||
};
|
||||
|
||||
struct aet_db_aet_set {
|
||||
uint32_t id;
|
||||
std::string name;
|
||||
uint32_t name_hash;
|
||||
std::string file_name;
|
||||
uint32_t file_name_hash;
|
||||
uint16_t index;
|
||||
uint32_t sprite_set_id;
|
||||
|
||||
aet_db_aet_set();
|
||||
~aet_db_aet_set();
|
||||
};
|
||||
|
||||
struct aet_database_file {
|
||||
bool ready;
|
||||
bool modern;
|
||||
bool big_endian;
|
||||
bool is_x;
|
||||
|
||||
std::vector<aet_db_aet_set_file> aet_set;
|
||||
|
||||
aet_database_file();
|
||||
~aet_database_file();
|
||||
|
||||
void read(const char* path, bool modern);
|
||||
void read(const wchar_t* path, bool modern);
|
||||
void read(const void* data, size_t size, bool modern);
|
||||
void write(const char* path);
|
||||
void write(const wchar_t* path);
|
||||
void write(void** data, size_t* size);
|
||||
|
||||
static bool load_file(void* data, const char* path, const char* file, uint32_t hash);
|
||||
};
|
||||
|
||||
struct aet_database {
|
||||
prj::vector_pair_combine<uint32_t, aet_db_aet_set> aet_set_ids;
|
||||
prj::vector_pair_combine<uint32_t, aet_db_aet_set> aet_set_indices;
|
||||
prj::vector_pair_combine<std::string, aet_db_aet_set> aet_set_names;
|
||||
prj::vector_pair_combine<uint32_t, aet_db_aet> aet_ids;
|
||||
prj::vector_pair_combine<std::string, aet_db_aet> aet_names;
|
||||
prj::vector_pair_combine<aet_info, aet_db_aet> aet_indices;
|
||||
|
||||
aet_database();
|
||||
~aet_database();
|
||||
|
||||
void add(aet_database_file* aet_db_file);
|
||||
|
||||
const aet_db_aet_set* get_aet_set_by_name(const char* name) const;
|
||||
const aet_db_aet_set* get_aet_set_by_id(uint32_t set_id) const;
|
||||
const aet_db_aet_set* get_aet_set_by_index(uint32_t index) const;
|
||||
const aet_db_aet* get_aet_by_name(const char* name) const;
|
||||
const aet_db_aet* get_aet_by_id(uint32_t id) const;
|
||||
const aet_db_aet* get_aet_by_set_id_index(uint32_t set_id, uint32_t index) const;
|
||||
const aet_db_aet* get_tex_by_set_id_index(uint32_t set_id, uint32_t index) const;
|
||||
const char* get_aet_set_file_name(uint32_t set_id) const;
|
||||
uint32_t get_aet_set_id_by_name(const char* name) const;
|
||||
uint32_t get_aet_set_id_by_name_index(uint32_t index) const;
|
||||
const char* get_aet_set_name(uint32_t set_id) const;
|
||||
};
|
||||
|
||||
@@ -46,27 +46,27 @@ struct object_info {
|
||||
};
|
||||
|
||||
inline bool operator >(const object_info& left, const object_info& right) {
|
||||
return left.set_id > right.set_id && left.id > right.id;
|
||||
return *(uint64_t*)&left > *(uint64_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator <(const object_info& left, const object_info& right) {
|
||||
return left.set_id < right.set_id&& left.id < right.id;
|
||||
return *(uint64_t*)&left < *(uint64_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator >=(const object_info& left, const object_info& right) {
|
||||
return left.set_id >= right.set_id && left.id >= right.id;
|
||||
return *(uint64_t*)&left >= *(uint64_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator <=(const object_info& left, const object_info& right) {
|
||||
return left.set_id <= right.set_id && left.id <= right.id;
|
||||
return *(uint64_t*)&left <= *(uint64_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator ==(const object_info& left, const object_info& right) {
|
||||
return left.set_id == right.set_id && left.id == right.id;
|
||||
return *(uint64_t*)&left == *(uint64_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator !=(const object_info& left, const object_info& right) {
|
||||
return left.set_id != right.set_id || left.id != right.id;
|
||||
return *(uint64_t*)&left != *(uint64_t*)&right;
|
||||
}
|
||||
|
||||
struct object_info_data_file {
|
||||
|
||||
@@ -243,9 +243,8 @@ sprite_database::~sprite_database() {
|
||||
void sprite_database::add(sprite_database_file* spr_db_file) {
|
||||
if (!spr_db_file || !spr_db_file->ready)
|
||||
return;
|
||||
return;
|
||||
|
||||
size_t sprite_sets_count = this->spr_ids.size();
|
||||
size_t sprite_sets_count = this->spr_set_ids.size();
|
||||
|
||||
spr_set_ids.reserve(spr_db_file->sprite_set.size());
|
||||
spr_set_indices.reserve(spr_db_file->sprite_set.size());
|
||||
@@ -281,12 +280,12 @@ void sprite_database::add(sprite_database_file* spr_db_file) {
|
||||
}
|
||||
}
|
||||
|
||||
spr_set_ids.sort_unique();
|
||||
spr_set_indices.sort_unique();
|
||||
spr_set_names.sort_unique();
|
||||
spr_ids.sort_unique();
|
||||
spr_names.sort_unique();
|
||||
spr_indices.sort_unique();
|
||||
spr_set_ids.combine();
|
||||
spr_set_indices.combine();
|
||||
spr_set_names.combine();
|
||||
spr_ids.combine();
|
||||
spr_names.combine();
|
||||
spr_indices.combine();
|
||||
}
|
||||
|
||||
const spr_db_spr_set* sprite_database::get_spr_set_by_name(const char* name) const {
|
||||
@@ -346,8 +345,8 @@ uint32_t sprite_database::get_spr_set_id_by_name(const char* name) const {
|
||||
return get_spr_set_by_name(name)->id;
|
||||
}
|
||||
|
||||
uint32_t sprite_database::get_spr_set_id_by_index(uint32_t index) const {
|
||||
return spr_ids[index].first;
|
||||
uint32_t sprite_database::get_spr_set_id_by_name_index(uint32_t index) const {
|
||||
return spr_set_names[index].second.id;
|
||||
}
|
||||
|
||||
const char* sprite_database::get_spr_set_name(uint32_t set_id) const {
|
||||
@@ -370,7 +369,7 @@ static void sprite_database_file_classic_read_inner(sprite_database_file* spr_db
|
||||
spr_set.id = s.read_uint32_t();
|
||||
spr_set.name = s.read_string_null_terminated_offset(s.read_uint32_t());
|
||||
spr_set.file_name = s.read_string_null_terminated_offset(s.read_uint32_t());
|
||||
spr_set.index = s.read_uint32_t();
|
||||
spr_set.index = (uint16_t)s.read_uint32_t();
|
||||
}
|
||||
s.position_pop();
|
||||
|
||||
@@ -529,7 +528,7 @@ static void sprite_database_file_modern_read_inner(sprite_database_file* spr_db,
|
||||
spr_set.id = s.read_uint32_t_reverse_endianness();
|
||||
spr_set.name = s.read_string_null_terminated_offset(s.read_offset_f2(header_length));
|
||||
spr_set.file_name = s.read_string_null_terminated_offset(s.read_offset_f2(header_length));
|
||||
spr_set.index = s.read_uint32_t_reverse_endianness();
|
||||
spr_set.index = (uint16_t)s.read_uint32_t_reverse_endianness();
|
||||
}
|
||||
else
|
||||
for (uint32_t i = 0; i < sprite_sets_count; i++) {
|
||||
@@ -537,7 +536,7 @@ static void sprite_database_file_modern_read_inner(sprite_database_file* spr_db,
|
||||
spr_set.id = s.read_uint32_t_reverse_endianness();
|
||||
spr_set.name = s.read_string_null_terminated_offset(s.read_offset_x());
|
||||
spr_set.file_name = s.read_string_null_terminated_offset(s.read_offset_x());
|
||||
spr_set.index = s.read_uint32_t_reverse_endianness();
|
||||
spr_set.index = (uint16_t)s.read_uint32_t_reverse_endianness();
|
||||
s.align_read(0x08);
|
||||
}
|
||||
s.position_pop();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../default.hpp"
|
||||
#include "../prj/vector_pair.hpp"
|
||||
#include "../prj/vector_pair_combine.hpp"
|
||||
#include "../hash.hpp"
|
||||
|
||||
struct spr_info {
|
||||
@@ -32,38 +32,30 @@ struct spr_info {
|
||||
inline bool not_null() const {
|
||||
return index != (uint16_t)-1 || set_index != (uint16_t)-1;
|
||||
}
|
||||
|
||||
inline bool is_null_modern() const {
|
||||
return index == (uint16_t)-1 && set_index == (uint16_t)-1;
|
||||
}
|
||||
|
||||
inline bool not_null_modern() const {
|
||||
return index != (uint16_t)-1 || set_index != (uint16_t)-1;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator >(const spr_info& left, const spr_info& right) {
|
||||
return left.set_index > right.set_index && left.index > right.index;
|
||||
return *(uint32_t*)&left > *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator <(const spr_info& left, const spr_info& right) {
|
||||
return left.set_index < right.set_index&& left.index < right.index;
|
||||
return *(uint32_t*)&left < *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator >=(const spr_info& left, const spr_info& right) {
|
||||
return left.set_index >= right.set_index && left.index >= right.index;
|
||||
return *(uint32_t*)&left >= *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator <=(const spr_info& left, const spr_info& right) {
|
||||
return left.set_index <= right.set_index && left.index <= right.index;
|
||||
return *(uint32_t*)&left <= *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator ==(const spr_info& left, const spr_info& right) {
|
||||
return left.set_index == right.set_index && left.index == right.index;
|
||||
return *(uint32_t*)&left == *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
inline bool operator !=(const spr_info& left, const spr_info& right) {
|
||||
return left.set_index != right.set_index || left.index != right.index;
|
||||
return *(uint32_t*)&left != *(uint32_t*)&right;
|
||||
}
|
||||
|
||||
struct spr_db_spr_file {
|
||||
@@ -131,12 +123,12 @@ struct sprite_database_file {
|
||||
};
|
||||
|
||||
struct sprite_database {
|
||||
prj::vector_pair<uint32_t, spr_db_spr_set> spr_set_ids;
|
||||
prj::vector_pair<uint32_t, spr_db_spr_set> spr_set_indices;
|
||||
prj::vector_pair<std::string, spr_db_spr_set> spr_set_names;
|
||||
prj::vector_pair<uint32_t, spr_db_spr> spr_ids;
|
||||
prj::vector_pair<std::string, spr_db_spr> spr_names;
|
||||
prj::vector_pair<spr_info, spr_db_spr> spr_indices;
|
||||
prj::vector_pair_combine<uint32_t, spr_db_spr_set> spr_set_ids;
|
||||
prj::vector_pair_combine<uint32_t, spr_db_spr_set> spr_set_indices;
|
||||
prj::vector_pair_combine<std::string, spr_db_spr_set> spr_set_names;
|
||||
prj::vector_pair_combine<uint32_t, spr_db_spr> spr_ids;
|
||||
prj::vector_pair_combine<std::string, spr_db_spr> spr_names;
|
||||
prj::vector_pair_combine<spr_info, spr_db_spr> spr_indices;
|
||||
|
||||
sprite_database();
|
||||
~sprite_database();
|
||||
@@ -152,6 +144,6 @@ struct sprite_database {
|
||||
const spr_db_spr* get_tex_by_set_id_index(uint32_t set_id, uint32_t index) const;
|
||||
const char* get_spr_set_file_name(uint32_t set_id) const;
|
||||
uint32_t get_spr_set_id_by_name(const char* name) const;
|
||||
uint32_t get_spr_set_id_by_index(uint32_t index) const;
|
||||
uint32_t get_spr_set_id_by_name_index(uint32_t index) const;
|
||||
const char* get_spr_set_name(uint32_t set_id) const;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
|
||||
Taken from MSVC's VC/include/memory
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../default.hpp"
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace prj {
|
||||
template <class T, class U>
|
||||
class vector_pair_combine {
|
||||
public:
|
||||
using value_pair = std::pair<T, U>;
|
||||
std::vector<value_pair> data;
|
||||
std::vector<value_pair> new_data;
|
||||
|
||||
inline typename auto find(T key) {
|
||||
auto k = data.begin();
|
||||
size_t l = data.size();
|
||||
size_t temp;
|
||||
while (l > 0) {
|
||||
if (k[temp = l / 2].first >= key)
|
||||
l /= 2;
|
||||
else {
|
||||
k += temp + 1;
|
||||
l -= temp + 1;
|
||||
}
|
||||
}
|
||||
if (k == data.end() || key < k->first)
|
||||
return data.end();
|
||||
return k;
|
||||
}
|
||||
|
||||
inline typename auto find(T key) const {
|
||||
auto k = data.begin();
|
||||
size_t l = data.size();
|
||||
size_t temp;
|
||||
while (l > 0) {
|
||||
if (k[temp = l / 2].first >= key)
|
||||
l /= 2;
|
||||
else {
|
||||
k += temp + 1;
|
||||
l -= temp + 1;
|
||||
}
|
||||
}
|
||||
if (k == data.end() || key < k->first)
|
||||
return data.end();
|
||||
return k;
|
||||
}
|
||||
|
||||
inline void combine() {
|
||||
if (new_data.size() <= 1)
|
||||
return;
|
||||
|
||||
std::sort(data.begin(), data.end(),
|
||||
[](const value_pair& a, const value_pair& b) {
|
||||
return a.first < b.first;
|
||||
});
|
||||
|
||||
for (auto& i : new_data) {
|
||||
auto elem = find(i.first);
|
||||
if (elem != data.end())
|
||||
elem->second = i.second;
|
||||
else
|
||||
data.push_back(i);
|
||||
}
|
||||
|
||||
new_data.clear();
|
||||
|
||||
if (data.size() <= 1)
|
||||
return;
|
||||
|
||||
std::sort(data.begin(), data.end(),
|
||||
[](const value_pair& a, const value_pair& b) {
|
||||
return a.first < b.first;
|
||||
});
|
||||
|
||||
auto begin = data.begin();
|
||||
auto end = data.end();
|
||||
for (auto i = begin, j = begin + 1; i != end && j != end; )
|
||||
if (i->first == j->first) {
|
||||
std::move(j + 1, end, j);
|
||||
end--;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
|
||||
if (data.size() != end - begin)
|
||||
data.resize(end - begin);
|
||||
}
|
||||
|
||||
inline typename auto begin() {
|
||||
return data.begin();
|
||||
}
|
||||
|
||||
inline typename auto begin() const {
|
||||
return data.begin();
|
||||
}
|
||||
|
||||
inline typename auto cbegin() const {
|
||||
return data.cbegin();
|
||||
}
|
||||
|
||||
inline typename auto end() {
|
||||
return data.end();
|
||||
}
|
||||
|
||||
inline typename auto end() const {
|
||||
return data.end();
|
||||
}
|
||||
|
||||
inline typename auto cend() const {
|
||||
return data.cend();
|
||||
}
|
||||
|
||||
inline typename auto rbegin() {
|
||||
return data.rbegin();
|
||||
}
|
||||
|
||||
inline typename auto rbegin() const {
|
||||
return data.rbegin();
|
||||
}
|
||||
|
||||
inline typename auto crbegin() const {
|
||||
return data.crbegin();
|
||||
}
|
||||
|
||||
inline typename auto rend() {
|
||||
return data.rend();
|
||||
}
|
||||
|
||||
inline typename auto rend() const {
|
||||
return data.rend();
|
||||
}
|
||||
|
||||
inline typename auto crend() const {
|
||||
return data.crend();
|
||||
}
|
||||
|
||||
inline void push_back(const value_pair& value) {
|
||||
new_data.push_back(value);
|
||||
}
|
||||
|
||||
inline void push_back(value_pair&& value) {
|
||||
new_data.push_back(value);
|
||||
}
|
||||
|
||||
inline void reserve(size_t new_capacity) {
|
||||
new_data.reserve(new_capacity);
|
||||
}
|
||||
|
||||
inline size_t size() const {
|
||||
return data.size();
|
||||
}
|
||||
|
||||
value_pair& operator[](const size_t pos) noexcept {
|
||||
return data[pos];
|
||||
}
|
||||
|
||||
const value_pair& operator[](const size_t pos) const noexcept {
|
||||
return data[pos];
|
||||
}
|
||||
};
|
||||
}
|
||||
+54
-54
@@ -1642,324 +1642,324 @@ inline vec4i vec4i::clamp(const vec4i& left, const int32_t min, const int32_t ma
|
||||
vec4i::load_xmm(min)), vec4i::load_xmm(max)));
|
||||
}
|
||||
|
||||
inline void vec2i8_to_vec2(vec2i8& src, vec2& dst) {
|
||||
inline void vec2i8_to_vec2(const vec2i8& src, vec2& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3i8_to_vec3(vec3i8& src, vec3& dst) {
|
||||
inline void vec3i8_to_vec3(const vec3i8& src, vec3& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
dst.z = (float_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4i8_to_vec4(vec4i8& src, vec4& dst) {
|
||||
inline void vec4i8_to_vec4(const vec4i8& src, vec4& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
dst.z = (float_t)src.z;
|
||||
dst.w = (float_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2_to_vec2i8(vec2& src, vec2i8& dst) {
|
||||
inline void vec2_to_vec2i8(const vec2& src, vec2i8& dst) {
|
||||
dst.x = (int8_t)src.x;
|
||||
dst.y = (int8_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3_to_vec3i8(vec3& src, vec3i8& dst) {
|
||||
inline void vec3_to_vec3i8(const vec3& src, vec3i8& dst) {
|
||||
dst.x = (int8_t)src.x;
|
||||
dst.y = (int8_t)src.y;
|
||||
dst.z = (int8_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4_to_vec4i8(vec4& src, vec4i8& dst) {
|
||||
inline void vec4_to_vec4i8(const vec4& src, vec4i8& dst) {
|
||||
dst.x = (int8_t)src.x;
|
||||
dst.y = (int8_t)src.y;
|
||||
dst.z = (int8_t)src.z;
|
||||
dst.w = (int8_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2u8_to_vec2(vec2u8& src, vec2& dst) {
|
||||
inline void vec2u8_to_vec2(const vec2u8& src, vec2& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3u8_to_vec3(vec3u8& src, vec3& dst) {
|
||||
inline void vec3u8_to_vec3(const vec3u8& src, vec3& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
dst.z = (float_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4u8_to_vec4(vec4u8& src, vec4& dst) {
|
||||
inline void vec4u8_to_vec4(const vec4u8& src, vec4& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
dst.z = (float_t)src.z;
|
||||
dst.w = (float_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2_to_vec2u8(vec2& src, vec2u8& dst) {
|
||||
inline void vec2_to_vec2u8(const vec2& src, vec2u8& dst) {
|
||||
dst.x = (uint8_t)src.x;
|
||||
dst.y = (uint8_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3_to_vec3u8(vec3& src, vec3u8& dst) {
|
||||
inline void vec3_to_vec3u8(const vec3& src, vec3u8& dst) {
|
||||
dst.x = (uint8_t)src.x;
|
||||
dst.y = (uint8_t)src.y;
|
||||
dst.z = (uint8_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4_to_vec4u8(vec4& src, vec4u8& dst) {
|
||||
inline void vec4_to_vec4u8(const vec4& src, vec4u8& dst) {
|
||||
dst.x = (uint8_t)src.x;
|
||||
dst.y = (uint8_t)src.y;
|
||||
dst.z = (uint8_t)src.z;
|
||||
dst.w = (uint8_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2i16_to_vec2(vec2i16& src, vec2& dst) {
|
||||
inline void vec2i16_to_vec2(const vec2i16& src, vec2& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3i16_to_vec3(vec3i16& src, vec3& dst) {
|
||||
inline void vec3i16_to_vec3(const vec3i16& src, vec3& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
dst.z = (float_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4i16_to_vec4(vec4i16& src, vec4& dst) {
|
||||
inline void vec4i16_to_vec4(const vec4i16& src, vec4& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
dst.z = (float_t)src.z;
|
||||
dst.w = (float_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2_to_vec2i16(vec2& src, vec2i16& dst) {
|
||||
inline void vec2_to_vec2i16(const vec2& src, vec2i16& dst) {
|
||||
dst.x = (int16_t)src.x;
|
||||
dst.y = (int16_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3_to_vec3i16(vec3& src, vec3i16& dst) {
|
||||
inline void vec3_to_vec3i16(const vec3& src, vec3i16& dst) {
|
||||
dst.x = (int16_t)src.x;
|
||||
dst.y = (int16_t)src.y;
|
||||
dst.z = (int16_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4_to_vec4i16(vec4& src, vec4i16& dst) {
|
||||
inline void vec4_to_vec4i16(const vec4& src, vec4i16& dst) {
|
||||
dst.x = (int16_t)src.x;
|
||||
dst.y = (int16_t)src.y;
|
||||
dst.z = (int16_t)src.z;
|
||||
dst.w = (int16_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2u16_to_vec2(vec2u16& src, vec2& dst) {
|
||||
inline void vec2u16_to_vec2(const vec2u16& src, vec2& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3u16_to_vec3(vec3u16& src, vec3& dst) {
|
||||
inline void vec3u16_to_vec3(const vec3u16& src, vec3& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
dst.z = (float_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4u16_to_vec4(vec4u16& src, vec4& dst) {
|
||||
inline void vec4u16_to_vec4(const vec4u16& src, vec4& dst) {
|
||||
dst.x = (float_t)src.x;
|
||||
dst.y = (float_t)src.y;
|
||||
dst.z = (float_t)src.z;
|
||||
dst.w = (float_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2_to_vec2u16(vec2& src, vec2u16& dst) {
|
||||
inline void vec2_to_vec2u16(const vec2& src, vec2u16& dst) {
|
||||
dst.x = (uint16_t)src.x;
|
||||
dst.y = (uint16_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3_to_vec3u16(vec3& src, vec3u16& dst) {
|
||||
inline void vec3_to_vec3u16(const vec3& src, vec3u16& dst) {
|
||||
dst.x = (uint16_t)src.x;
|
||||
dst.y = (uint16_t)src.y;
|
||||
dst.z = (uint16_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4_to_vec4u16(vec4& src, vec4u16& dst) {
|
||||
inline void vec4_to_vec4u16(const vec4& src, vec4u16& dst) {
|
||||
dst.x = (uint16_t)src.x;
|
||||
dst.y = (uint16_t)src.y;
|
||||
dst.z = (uint16_t)src.z;
|
||||
dst.w = (uint16_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2h_to_vec2(vec2h& src, vec2& dst) {
|
||||
inline void vec2h_to_vec2(const vec2h& src, vec2& dst) {
|
||||
dst.x = half_to_float(src.x);
|
||||
dst.y = half_to_float(src.y);
|
||||
}
|
||||
|
||||
inline void vec3h_to_vec3(vec3h& src, vec3& dst) {
|
||||
inline void vec3h_to_vec3(const vec3h& src, vec3& dst) {
|
||||
dst.x = half_to_float(src.x);
|
||||
dst.y = half_to_float(src.y);
|
||||
dst.z = half_to_float(src.z);
|
||||
}
|
||||
|
||||
inline void vec4h_to_vec4(vec4h& src, vec4& dst) {
|
||||
inline void vec4h_to_vec4(const vec4h& src, vec4& dst) {
|
||||
dst.x = half_to_float(src.x);
|
||||
dst.y = half_to_float(src.y);
|
||||
dst.z = half_to_float(src.z);
|
||||
dst.w = half_to_float(src.w);
|
||||
}
|
||||
|
||||
inline void vec2_to_vec2h(vec2& src, vec2h& dst) {
|
||||
inline void vec2_to_vec2h(const vec2& src, vec2h& dst) {
|
||||
dst.x = float_to_half(src.x);
|
||||
dst.y = float_to_half(src.y);
|
||||
}
|
||||
|
||||
inline void vec3_to_vec3h(vec3& src, vec3h& dst) {
|
||||
inline void vec3_to_vec3h(const vec3& src, vec3h& dst) {
|
||||
dst.x = float_to_half(src.x);
|
||||
dst.y = float_to_half(src.y);
|
||||
dst.z = float_to_half(src.z);
|
||||
}
|
||||
|
||||
inline void vec4_to_vec4h(vec4& src, vec4h& dst) {
|
||||
inline void vec4_to_vec4h(const vec4& src, vec4h& dst) {
|
||||
dst.x = float_to_half(src.x);
|
||||
dst.y = float_to_half(src.y);
|
||||
dst.z = float_to_half(src.z);
|
||||
dst.w = float_to_half(src.w);
|
||||
}
|
||||
|
||||
inline void vec2i8_to_vec2i(vec2i8& src, vec2i& dst) {
|
||||
inline void vec2i8_to_vec2i(const vec2i8& src, vec2i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
}
|
||||
|
||||
inline void vec3i8_to_vec3i(vec3i8& src, vec3i& dst) {
|
||||
inline void vec3i8_to_vec3i(const vec3i8& src, vec3i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.z = src.z;
|
||||
}
|
||||
|
||||
inline void vec4i8_to_vec4i(vec4i8& src, vec4i& dst) {
|
||||
inline void vec4i8_to_vec4i(const vec4i8& src, vec4i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.z = src.z;
|
||||
dst.w = src.w;
|
||||
}
|
||||
|
||||
inline void vec2i_to_vec2i8(vec2i& src, vec2i8& dst) {
|
||||
inline void vec2i_to_vec2i8(const vec2i& src, vec2i8& dst) {
|
||||
dst.x = (int8_t)src.x;
|
||||
dst.y = (int8_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3i_to_vec3i8(vec3i& src, vec3i8& dst) {
|
||||
inline void vec3i_to_vec3i8(const vec3i& src, vec3i8& dst) {
|
||||
dst.x = (int8_t)src.x;
|
||||
dst.y = (int8_t)src.y;
|
||||
dst.z = (int8_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4i_to_vec4i8(vec4i& src, vec4i8& dst) {
|
||||
inline void vec4i_to_vec4i8(const vec4i& src, vec4i8& dst) {
|
||||
dst.x = (int8_t)src.x;
|
||||
dst.y = (int8_t)src.y;
|
||||
dst.z = (int8_t)src.z;
|
||||
dst.w = (int8_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2u8_to_vec2i(vec2u8& src, vec2i& dst) {
|
||||
inline void vec2u8_to_vec2i(const vec2u8& src, vec2i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
}
|
||||
|
||||
inline void vec3u8_to_vec4i(vec3u8& src, vec3i& dst) {
|
||||
inline void vec3u8_to_vec4i(const vec3u8& src, vec3i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.z = src.z;
|
||||
}
|
||||
|
||||
inline void vec4u8_to_vec4i(vec4u8& src, vec4i& dst) {
|
||||
inline void vec4u8_to_vec4i(const vec4u8& src, vec4i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.z = src.z;
|
||||
dst.w = src.w;
|
||||
}
|
||||
|
||||
inline void vec2i_to_vec2u8(vec2i& src, vec2u8& dst) {
|
||||
inline void vec2i_to_vec2u8(const vec2i& src, vec2u8& dst) {
|
||||
dst.x = (uint8_t)src.x;
|
||||
dst.y = (uint8_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3i_to_vec3u8(vec3i& src, vec3u8& dst) {
|
||||
inline void vec3i_to_vec3u8(const vec3i& src, vec3u8& dst) {
|
||||
dst.x = (uint8_t)src.x;
|
||||
dst.y = (uint8_t)src.y;
|
||||
dst.z = (uint8_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4i_to_vec4u8(vec4i& src, vec4u8& dst) {
|
||||
inline void vec4i_to_vec4u8(const vec4i& src, vec4u8& dst) {
|
||||
dst.x = (uint8_t)src.x;
|
||||
dst.y = (uint8_t)src.y;
|
||||
dst.z = (uint8_t)src.z;
|
||||
dst.w = (uint8_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2i16_to_vec2i(vec2i16& src, vec2i& dst) {
|
||||
inline void vec2i16_to_vec2i(const vec2i16& src, vec2i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
}
|
||||
|
||||
inline void vec3i16_to_vec4i(vec3i16& src, vec3i& dst) {
|
||||
inline void vec3i16_to_vec4i(const vec3i16& src, vec3i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.z = src.z;
|
||||
}
|
||||
|
||||
inline void vec4i16_to_vec4i(vec4i16& src, vec4i& dst) {
|
||||
inline void vec4i16_to_vec4i(const vec4i16& src, vec4i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.z = src.z;
|
||||
dst.w = src.w;
|
||||
}
|
||||
|
||||
inline void vec2i_to_vec2i16(vec2i& src, vec2i16& dst) {
|
||||
inline void vec2i_to_vec2i16(const vec2i& src, vec2i16& dst) {
|
||||
dst.x = (int16_t)src.x;
|
||||
dst.y = (int16_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3i_to_vec3i16(vec3i& src, vec3i16& dst) {
|
||||
inline void vec3i_to_vec3i16(const vec3i& src, vec3i16& dst) {
|
||||
dst.x = (int16_t)src.x;
|
||||
dst.y = (int16_t)src.y;
|
||||
dst.z = (int16_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4i_to_vec4i16(vec4i& src, vec4i16& dst) {
|
||||
inline void vec4i_to_vec4i16(const vec4i& src, vec4i16& dst) {
|
||||
dst.x = (int16_t)src.x;
|
||||
dst.y = (int16_t)src.y;
|
||||
dst.z = (int16_t)src.z;
|
||||
dst.w = (int16_t)src.w;
|
||||
}
|
||||
|
||||
inline void vec2u16_to_vec2i(vec2u16& src, vec2i& dst) {
|
||||
inline void vec2u16_to_vec2i(const vec2u16& src, vec2i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
}
|
||||
|
||||
inline void vec3u16_to_vec4i(vec3u16& src, vec3i& dst) {
|
||||
inline void vec3u16_to_vec4i(const vec3u16& src, vec3i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.z = src.z;
|
||||
}
|
||||
|
||||
inline void vec4u16_to_vec4i(vec4u16& src, vec4i& dst) {
|
||||
inline void vec4u16_to_vec4i(const vec4u16& src, vec4i& dst) {
|
||||
dst.x = src.x;
|
||||
dst.y = src.y;
|
||||
dst.z = src.z;
|
||||
dst.w = src.w;
|
||||
}
|
||||
|
||||
inline void vec2i_to_vec2u16(vec2i& src, vec2u16& dst) {
|
||||
inline void vec2i_to_vec2u16(const vec2i& src, vec2u16& dst) {
|
||||
dst.x = (uint16_t)src.x;
|
||||
dst.y = (uint16_t)src.y;
|
||||
}
|
||||
|
||||
inline void vec3i_to_vec3u16(vec3i& src, vec3u16& dst) {
|
||||
inline void vec3i_to_vec3u16(const vec3i& src, vec3u16& dst) {
|
||||
dst.x = (uint16_t)src.x;
|
||||
dst.y = (uint16_t)src.y;
|
||||
dst.z = (uint16_t)src.z;
|
||||
}
|
||||
|
||||
inline void vec4i_to_vec4u16(vec4i& src, vec4u16& dst) {
|
||||
inline void vec4i_to_vec4u16(const vec4i& src, vec4u16& dst) {
|
||||
dst.x = (uint16_t)src.x;
|
||||
dst.y = (uint16_t)src.y;
|
||||
dst.z = (uint16_t)src.z;
|
||||
|
||||
@@ -6657,7 +6657,7 @@ static void glitter_editor_curve_editor_window_draw(GlitterEditor* glt_edt, cons
|
||||
const ImU32 random_range_color = ImGui::GetColorU32({ 0.5f, 0.5f, 0.0f, 0.25f });
|
||||
const ImU32 key_random_range_color = ImGui::GetColorU32({ 0.5f, 0.0f, 0.5f, 0.25f });
|
||||
|
||||
const std::vector<Glitter::Curve::Key>* keys = &curve->keys_rev;
|
||||
const std::vector<Glitter::Curve::Key>* keys = &curve->keys_rev;
|
||||
if (!keys->size())
|
||||
return;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include "data_initialize.hpp"
|
||||
#include "../CRE/auth_2d.hpp"
|
||||
#include "../CRE/data.hpp"
|
||||
#include "../CRE/hand_item.hpp"
|
||||
#include "../CRE/item_table.hpp"
|
||||
@@ -32,20 +33,24 @@ bool TaskDataInit::Init() {
|
||||
|
||||
bool TaskDataInit::Ctrl() {
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
aet_database* aft_aet_db = &aft_data->data_ft.aet_db;
|
||||
object_database* aft_obj_db = &aft_data->data_ft.obj_db;
|
||||
sprite_database* aft_spr_db = &aft_data->data_ft.spr_db;
|
||||
|
||||
switch (state) {
|
||||
case 0: {
|
||||
sprite_manager_reset_res_data();
|
||||
//sprite_manager_load_set(4, "");
|
||||
//sprite_manager_load_set(472, "");
|
||||
//sprite_manager_load_set(43, "");
|
||||
sprite_manager_read_file(4, "", aft_data, aft_spr_db);
|
||||
sprite_manager_read_file(472, "", aft_data, aft_spr_db);
|
||||
sprite_manager_read_file(43, "", aft_data, aft_spr_db);
|
||||
//fontmap_data_read_file();
|
||||
state = 1;
|
||||
} break;
|
||||
case 1:
|
||||
//if (!sprite_manager_load_file(4) && !sprite_manager_load_file(472)
|
||||
// && !sprite_manager_load_file(43) && !fontmap_data_parse_file())
|
||||
if (sprite_manager_load_file(4, aft_spr_db)
|
||||
|| sprite_manager_load_file(472, aft_spr_db)
|
||||
|| sprite_manager_load_file(43, aft_spr_db)
|
||||
/* || fontmap_data_parse_file()*/)
|
||||
state = field_6C ? 2 : 4;
|
||||
break;
|
||||
case 2:
|
||||
@@ -57,23 +62,25 @@ bool TaskDataInit::Ctrl() {
|
||||
state = 4;
|
||||
break;
|
||||
case 4: {
|
||||
//sprite_manager_load_set(32, "");
|
||||
//aet_manager_load_set(26, "");
|
||||
//sprite_manager_load_set(34, "");
|
||||
//aet_manager_load_set(35, "");
|
||||
sprite_manager_read_file(32, "", aft_data, aft_spr_db);
|
||||
aet_manager_read_file(26, "", aft_data, aft_aet_db);
|
||||
sprite_manager_read_file(34, "", aft_data, aft_spr_db);
|
||||
aet_manager_read_file(35, "", aft_data, aft_aet_db);
|
||||
state = 5;
|
||||
} break;
|
||||
case 5:
|
||||
//if (!sprite_manager_load_file(32) && !aet_manager_load_file(26)
|
||||
// && !sprite_manager_load_file(34) && !aet_manager_load_file(35))
|
||||
// break;
|
||||
if (sprite_manager_load_file(32, aft_spr_db)
|
||||
|| aet_manager_load_file(26, aft_aet_db)
|
||||
|| sprite_manager_load_file(34, aft_spr_db)
|
||||
|| aet_manager_load_file(35, aft_aet_db))
|
||||
break;
|
||||
|
||||
state = 6;
|
||||
case 6:
|
||||
//auth_3d_database_read_file();
|
||||
//stage_database_read_file();
|
||||
state = 7;
|
||||
break;
|
||||
//break;
|
||||
case 7:
|
||||
//if (auth_3d_database_load_file() || stage_database_load_file())
|
||||
// break;
|
||||
|
||||
@@ -0,0 +1,509 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#include "auth_2d_test.hpp"
|
||||
#include "../../KKdLib/io/path.hpp"
|
||||
#include "../../KKdLib/prj/algorithm.hpp"
|
||||
#include "../../KKdLib/sort.hpp"
|
||||
#include "../../KKdLib/str_utils.hpp"
|
||||
#include "../../CRE/auth_2d.hpp"
|
||||
#include "../../CRE/data.hpp"
|
||||
#include "../../CRE/render_context.hpp"
|
||||
#include "../../CRE/sound.hpp"
|
||||
#include "../../CRE/sprite.hpp"
|
||||
#include "../../CRE/stage.hpp"
|
||||
#include "../../CRE/task_effect.hpp"
|
||||
#include "../imgui_helper.hpp"
|
||||
#include "../input.hpp"
|
||||
#include "../task_window.hpp"
|
||||
|
||||
extern int32_t width;
|
||||
extern int32_t height;
|
||||
|
||||
DtmAet* dtm_aet;
|
||||
DtwAet* dtw_aet;
|
||||
|
||||
DtmAet::DtmAet() : curr_set_index(), set_index(), id_index(), layer_index(), marker_index(),
|
||||
type(), frame(), start_time(), end_time(), lock(), loop(), centering(), state() {
|
||||
|
||||
}
|
||||
|
||||
DtmAet::~DtmAet() {
|
||||
|
||||
}
|
||||
|
||||
bool DtmAet::Init() {
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
aet_database* aft_aet_db = &aft_data->data_ft.aet_db;
|
||||
sprite_database* aft_spr_db = &aft_data->data_ft.spr_db;
|
||||
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index(this->curr_set_index);
|
||||
std::string mdata_dir = "";//GetMdataDir(set_id);
|
||||
sprite_manager_read_file(aft_aet_db->get_aet_set_by_id(set_id)->sprite_set_id,
|
||||
mdata_dir, aft_data, aft_spr_db);
|
||||
aet_manager_read_file(set_id, mdata_dir, aft_data, aft_aet_db);
|
||||
GetSoundFarcs();
|
||||
state = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DtmAet::Ctrl() {
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
aet_database* aft_aet_db = &aft_data->data_ft.aet_db;
|
||||
sprite_database* aft_spr_db = &aft_data->data_ft.spr_db;
|
||||
|
||||
switch (state) {
|
||||
case 1: {
|
||||
bool wait_load = false;
|
||||
|
||||
for (std::string& i : sound_farcs)
|
||||
wait_load |= sound_work_load_farc(i.c_str());
|
||||
|
||||
if (!wait_load)
|
||||
state = 2;
|
||||
} break;
|
||||
case 2: {
|
||||
uint32_t prev_set_id = aft_aet_db->get_aet_set_id_by_name_index(curr_set_index);
|
||||
sprite_manager_unload_set(aft_aet_db->get_aet_set_by_id(prev_set_id)->sprite_set_id, aft_spr_db);
|
||||
aet_manager_unload_set(prev_set_id, aft_aet_db);
|
||||
|
||||
curr_set_index = set_index;
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index(set_index);
|
||||
|
||||
std::string mdata_dir = "";//GetMdataDir(set_id);
|
||||
sprite_manager_read_file(aft_aet_db->get_aet_set_by_id(set_id)->sprite_set_id,
|
||||
mdata_dir, aft_data, aft_spr_db);
|
||||
aet_manager_read_file(set_id, mdata_dir, aft_data, aft_aet_db);
|
||||
state = 3;
|
||||
} break;
|
||||
case 3: {
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index(curr_set_index);
|
||||
if (sprite_manager_load_file(aft_aet_db->get_aet_set_by_id(set_id)->sprite_set_id, aft_spr_db)
|
||||
|| aet_manager_load_file(set_id, aft_aet_db))
|
||||
break;
|
||||
|
||||
dw::List* id_list = dtw_aet->id->list;
|
||||
id_list->ClearItems();
|
||||
|
||||
uint32_t scenes_count = aet_manager_get_scenes_count(set_id, aft_aet_db);
|
||||
for (uint32_t i = scenes_count, j = 0; i; i--, j++)
|
||||
id_list->AddItem(aet_manager_get_scene_name(
|
||||
aft_aet_db->get_aet_by_set_id_index(set_id, j)->id, aft_aet_db));
|
||||
|
||||
id_list->hovered_item = id_index;
|
||||
id_list->ResetSetSelectedItem(id_index);
|
||||
state = 4;
|
||||
} break;
|
||||
case 4: {
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index(curr_set_index);
|
||||
uint32_t aet_id = aft_aet_db->get_aet_by_set_id_index(set_id, id_index)->id;
|
||||
|
||||
comp_layers.clear();
|
||||
aet_manager_get_scene_comp_layer_names(comp_layers, aet_id, aft_aet_db);
|
||||
prj::sort_unique(comp_layers);
|
||||
|
||||
auto i = comp_layers.begin();
|
||||
auto i_end = comp_layers.end();
|
||||
while (i != i_end)
|
||||
if (i->find(".pic") != -1)
|
||||
i = comp_layers.erase(i);
|
||||
else
|
||||
i++;
|
||||
|
||||
dw::List* layer_list = dtw_aet->layer->list;
|
||||
layer_list->ClearItems();
|
||||
layer_list->AddItem("ROOT");
|
||||
for (std::string& i : comp_layers)
|
||||
layer_list->AddItem(i);
|
||||
|
||||
layer_list->hovered_item = layer_index;
|
||||
layer_list->ResetSetSelectedItem(layer_index);
|
||||
state = 5;
|
||||
} break;
|
||||
case 5: {
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index(curr_set_index);
|
||||
uint32_t aet_id = aft_aet_db->get_aet_by_set_id_index(set_id, id_index)->id;
|
||||
|
||||
markers.clear();
|
||||
|
||||
if (layer_index)
|
||||
aet_manager_get_scene_layer_marker_names(markers, aet_id,
|
||||
comp_layers[layer_index - 1].c_str(), aft_aet_db);
|
||||
|
||||
if (layer_index)
|
||||
start_time = aet_manager_get_scene_layer_start_time(aet_id,
|
||||
comp_layers[layer_index - 1].c_str(), aft_aet_db);
|
||||
else
|
||||
start_time = aet_manager_get_scene_start_time(aet_id, aft_aet_db);
|
||||
|
||||
if (layer_index)
|
||||
end_time = aet_manager_get_scene_layer_end_time(aet_id,
|
||||
comp_layers[layer_index - 1].c_str(), aft_aet_db);
|
||||
else
|
||||
end_time = aet_manager_get_scene_end_time(aet_id, aft_aet_db);
|
||||
|
||||
dw::ListBox* marker = dtw_aet->marker;
|
||||
if (marker->list)
|
||||
marker->ClearItems();
|
||||
|
||||
marker->AddItem("NOMARKER");
|
||||
|
||||
for (std::string& i : markers)
|
||||
marker->AddItem(i);
|
||||
|
||||
if (marker->list) {
|
||||
marker->list->hovered_item = marker_index;
|
||||
marker->list->ResetSetSelectedItem(marker_index);
|
||||
}
|
||||
state = 6;
|
||||
} break;
|
||||
case 6: {
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index(curr_set_index);
|
||||
uint32_t aet_id = aft_aet_db->get_aet_by_set_id_index(set_id, id_index)->id;
|
||||
|
||||
float_t frame;
|
||||
if (layer_index && marker_index)
|
||||
frame = aet_manager_get_scene_layer_marker_time(aet_id,
|
||||
comp_layers[layer_index - 1].c_str(), markers[marker_index - 1].c_str(), aft_aet_db);
|
||||
else
|
||||
frame = start_time;
|
||||
|
||||
char buf[0x20];
|
||||
sprintf_s(buf, sizeof(buf), "%f frame", frame);
|
||||
dtw_aet->marker_frame->SetName(buf);
|
||||
this->frame = frame;
|
||||
state = 7;
|
||||
} break;
|
||||
case 7: {
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index(curr_set_index);
|
||||
uint32_t aet_id = aft_aet_db->get_aet_by_set_id_index(set_id, id_index)->id;
|
||||
|
||||
const char* layer_name = 0;
|
||||
if (layer_index)
|
||||
layer_name = comp_layers[layer_index - 1].c_str();
|
||||
|
||||
if (type) {
|
||||
data.clear();
|
||||
aet_manager_init_aet_layout(&data, aet_id, layer_name,
|
||||
(AetFlags)0, RESOLUTION_MODE_HD, 0, frame, aft_aet_db);
|
||||
}
|
||||
else {
|
||||
float_t x = 0.0f;
|
||||
float_t y = 0.0f;
|
||||
|
||||
if (centering) {
|
||||
x = res_window_get()->width * 0.5f;
|
||||
y = res_window_get()->height * 0.5f;
|
||||
}
|
||||
|
||||
AetArgs args;
|
||||
args.id.id = aet_id;
|
||||
args.layer_name = layer_name;
|
||||
args.start_time = frame;
|
||||
args.end_time = frame;
|
||||
args.pos.x = x;
|
||||
args.pos.y = y;
|
||||
args.pos.z = 0.0f;
|
||||
args.sound_voice = true;
|
||||
args.spr_db = aft_spr_db;
|
||||
aet_manager_init_aet_object(args, aft_aet_db);
|
||||
}
|
||||
|
||||
dtw_aet->frame->scroll_bar->SetParams(frame,
|
||||
start_time, end_time, (end_time - start_time) * 0.1f, 1.0f, 10.0f);
|
||||
} break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DtmAet::Dest() {
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
aet_database* aft_aet_db = &aft_data->data_ft.aet_db;
|
||||
sprite_database* aft_spr_db = &aft_data->data_ft.spr_db;
|
||||
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index(curr_set_index);
|
||||
sprite_manager_unload_set(aft_aet_db->get_aet_set_by_id(set_id)->sprite_set_id, aft_spr_db);
|
||||
aet_manager_unload_set(set_id, aft_aet_db);
|
||||
|
||||
for (std::string& i : sound_farcs)
|
||||
sound_work_unload_farc(i.c_str());
|
||||
sound_farcs.clear();
|
||||
state = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DtmAet::Disp() {
|
||||
if (state != 7)
|
||||
return;
|
||||
}
|
||||
|
||||
void DtmAet::Basic() {
|
||||
if (state != 7)
|
||||
return;
|
||||
|
||||
if (!lock)
|
||||
frame += 1.0f;
|
||||
|
||||
if (frame > end_time)
|
||||
if (loop)
|
||||
frame = start_time;
|
||||
else
|
||||
frame = end_time;
|
||||
}
|
||||
|
||||
void DtmAet::GetSoundFarcs() {
|
||||
static const char* dtm_aet_sound_farcs[] = {
|
||||
"rom/sound/se_sel.farc",
|
||||
"rom/sound/se_result.farc",
|
||||
"rom/sound/se_adv.farc",
|
||||
"rom/sound/se_over.farc",
|
||||
};
|
||||
|
||||
sound_farcs.clear();
|
||||
for (const char* i : dtm_aet_sound_farcs)
|
||||
if (sound_work_read_farc(i))
|
||||
sound_farcs.push_back(i);
|
||||
}
|
||||
|
||||
void DtmAet::SetSetIndex(int32_t value) {
|
||||
if (curr_set_index != value) {
|
||||
set_index = value;
|
||||
id_index = 0;
|
||||
layer_index = 0;
|
||||
marker_index = 0;
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void DtmAet::SetIdIndex(int32_t value) {
|
||||
if (id_index != value) {
|
||||
id_index = value;
|
||||
layer_index = 0;
|
||||
marker_index = 0;
|
||||
state = 4;
|
||||
}
|
||||
}
|
||||
|
||||
void DtmAet::SetLayerIndex(int32_t value) {
|
||||
if (layer_index != value) {
|
||||
layer_index = value;
|
||||
marker_index = 0;
|
||||
state = 5;
|
||||
}
|
||||
}
|
||||
|
||||
void DtmAet::SetMarkerIndex(int32_t value) {
|
||||
if (marker_index != value) {
|
||||
marker_index = value;
|
||||
state = 6;
|
||||
}
|
||||
}
|
||||
|
||||
void DtmAet::SetType(uint8_t value) {
|
||||
if (type != value) {
|
||||
type = value;
|
||||
state = 7;
|
||||
}
|
||||
}
|
||||
|
||||
void DtmAet::SetFrame(float_t value) {
|
||||
if (frame != value)
|
||||
frame = value;
|
||||
}
|
||||
|
||||
void DtmAet::SetLock(bool value) {
|
||||
if (lock != value)
|
||||
lock = value;
|
||||
}
|
||||
|
||||
void DtmAet::SetLoop(bool value) {
|
||||
if (loop != value)
|
||||
loop = value;
|
||||
}
|
||||
|
||||
void DtmAet::SetCentering(bool value) {
|
||||
if (centering != value)
|
||||
centering = value;
|
||||
}
|
||||
|
||||
DtwAet::DtwAet() : Shell(0) {
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
aet_database* aft_aet_db = &aft_data->data_ft.aet_db;
|
||||
|
||||
dw::Widget::SetName("2DAUTH TEST");
|
||||
|
||||
(new dw::Label(this))->SetName("SET");
|
||||
|
||||
set = new dw::ListBox(this, (dw::Widget::Flags)(WIDGET_SCROLL_V | WIDGET_4));
|
||||
|
||||
for (size_t i = aft_aet_db->aet_set_ids.size(), j = 0; i; i--, j++) {
|
||||
uint32_t set_id = aft_aet_db->get_aet_set_id_by_name_index((uint32_t)j);
|
||||
const aet_db_aet_set* set = aft_aet_db->get_aet_set_by_id(set_id);
|
||||
this->set->list->AddItem(set->name);
|
||||
}
|
||||
|
||||
//set->list->sub_1402F9930(20);
|
||||
set->list->hovered_item = dtm_aet->curr_set_index;
|
||||
set->list->ResetSetSelectedItem(dtm_aet->curr_set_index);
|
||||
|
||||
set->list->AddSelectionListener(new dw::SelectionListenerOnHook(DtwAet::SetCallback));
|
||||
|
||||
(new dw::Label(this))->SetName("ID");
|
||||
|
||||
id = new dw::ListBox(this, (dw::Widget::Flags)(WIDGET_SCROLL_V | WIDGET_4));
|
||||
//id->list->sub_1402F9930(20);
|
||||
|
||||
id->list->AddSelectionListener(new dw::SelectionListenerOnHook(DtwAet::IdCallback));
|
||||
|
||||
(new dw::Label(this))->SetName("LAYER");
|
||||
|
||||
layer = new dw::ListBox(this, (dw::Widget::Flags)(WIDGET_SCROLL_V | WIDGET_4));
|
||||
layer->AddItem("ROOT");
|
||||
//layer->list->sub_1402F9930(20);
|
||||
|
||||
layer->list->AddSelectionListener(new dw::SelectionListenerOnHook(DtwAet::LayerCallback));
|
||||
|
||||
(new dw::Label(this))->SetName("MARKER");
|
||||
|
||||
marker = new dw::ListBox(this, (dw::Widget::Flags)(WIDGET_SCROLL_V | WIDGET_4));
|
||||
marker->AddItem("NOMARKER");
|
||||
//marker->list->sub_1402F9930(20);
|
||||
|
||||
marker->list->AddSelectionListener(new dw::SelectionListenerOnHook(DtwAet::MarkerCallback));
|
||||
|
||||
marker_frame = new dw::Label(this);
|
||||
marker_frame->SetName("0");
|
||||
|
||||
(new dw::Label(this))->SetName("TYPE");
|
||||
|
||||
type = new dw::ListBox(this, (dw::Widget::Flags)(WIDGET_SCROLL_V | WIDGET_4));
|
||||
type->AddItem("DRAW");
|
||||
type->AddItem("LAYOUT");
|
||||
|
||||
type->list->hovered_item = dtm_aet->type;
|
||||
type->list->ResetSetSelectedItem(dtm_aet->type);
|
||||
|
||||
type->list->AddSelectionListener(new dw::SelectionListenerOnHook(DtwAet::TypeCallback));
|
||||
|
||||
(new dw::Label(this))->SetName("FRAME");
|
||||
|
||||
frame = dw::Slider::make(this, (dw::Widget::Flags)(WIDGET_800 | WIDGET_SCROLL_H),
|
||||
0.0f, 0.0f, 128.0f, 20.0f, "slider");
|
||||
frame->SetName("FRAME");
|
||||
frame->format = "%4.0f";
|
||||
|
||||
frame->scroll_bar->SetParams(0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 10.0f);
|
||||
|
||||
frame->AddSelectionListener(new dw::SelectionListenerOnHook(DtwAet::FrameCallback));
|
||||
|
||||
(new dw::Label(this))->SetName("SWITCH");
|
||||
|
||||
dw::Button* lock = new dw::Button(this, WIDGET_CHECKBOX);
|
||||
lock->SetName("LOCK");
|
||||
lock->callback = DtwAet::LockCallback;
|
||||
|
||||
dw::Button* loop = new dw::Button(this, WIDGET_CHECKBOX);
|
||||
loop->SetName("LOOP");
|
||||
loop->callback = DtwAet::LoopCallback;
|
||||
|
||||
dw::Button* centering = new dw::Button(this, WIDGET_CHECKBOX);
|
||||
centering->SetName("CENTERING");
|
||||
centering->callback = DtwAet::CenteringCallback;
|
||||
|
||||
//GetSetSize();
|
||||
}
|
||||
|
||||
DtwAet::~DtwAet() {
|
||||
|
||||
}
|
||||
|
||||
void DtwAet::Hide() {
|
||||
SetDisp(false);
|
||||
}
|
||||
|
||||
void DtwAet::CenteringCallback(dw::Widget* data) {
|
||||
dw::Button* button = dynamic_cast<dw::Button*>(data);
|
||||
if (button)
|
||||
dtm_aet->SetCentering(button->value);
|
||||
}
|
||||
|
||||
void DtwAet::FrameCallback(dw::Widget* data) {
|
||||
dw::Slider* slider = dynamic_cast<dw::Slider*>(data);
|
||||
if (slider)
|
||||
dtm_aet->SetFrame(slider->scroll_bar->value);
|
||||
}
|
||||
|
||||
void DtwAet::IdCallback(dw::Widget* data) {
|
||||
dw::ListBox* list_box = dynamic_cast<dw::ListBox*>(data);
|
||||
if (list_box)
|
||||
dtm_aet->SetIdIndex((int32_t)list_box->list->selected_item);
|
||||
}
|
||||
|
||||
void DtwAet::LayerCallback(dw::Widget* data) {
|
||||
dw::ListBox* list_box = dynamic_cast<dw::ListBox*>(data);
|
||||
if (list_box)
|
||||
dtm_aet->SetLayerIndex((int32_t)list_box->list->selected_item);
|
||||
}
|
||||
|
||||
void DtwAet::LockCallback(dw::Widget* data) {
|
||||
dw::Button* button = dynamic_cast<dw::Button*>(data);
|
||||
if (button)
|
||||
dtm_aet->SetLock(button->value);
|
||||
}
|
||||
|
||||
void DtwAet::LoopCallback(dw::Widget* data) {
|
||||
dw::Button* button = dynamic_cast<dw::Button*>(data);
|
||||
if (button)
|
||||
dtm_aet->SetLoop(button->value);
|
||||
}
|
||||
|
||||
void DtwAet::MarkerCallback(dw::Widget* data) {
|
||||
dw::ListBox* list_box = dynamic_cast<dw::ListBox*>(data);
|
||||
if (list_box)
|
||||
dtm_aet->SetMarkerIndex((int32_t)list_box->list->selected_item);
|
||||
}
|
||||
|
||||
void DtwAet::SetCallback(dw::Widget* data) {
|
||||
dw::ListBox* list_box = dynamic_cast<dw::ListBox*>(data);
|
||||
if (list_box)
|
||||
dtm_aet->SetSetIndex((int32_t)list_box->list->selected_item);
|
||||
}
|
||||
|
||||
void DtwAet::TypeCallback(dw::Widget* data) {
|
||||
dw::ListBox* list_box = dynamic_cast<dw::ListBox*>(data);
|
||||
if (list_box)
|
||||
dtm_aet->SetType(list_box->list->selected_item ? 1 : 0);
|
||||
}
|
||||
|
||||
void dtm_aet_init() {
|
||||
dtm_aet = new DtmAet;
|
||||
}
|
||||
|
||||
void dtm_aet_load() {
|
||||
if (app::TaskWork::CheckTaskReady(dtm_aet))
|
||||
return;
|
||||
|
||||
app::TaskWork::AddTask(dtm_aet, "DATA_TEST_AET_MANAGER");
|
||||
if (!dtw_aet)
|
||||
dtw_aet = new DtwAet();
|
||||
dtw_aet->Disp();
|
||||
}
|
||||
|
||||
void dtm_aet_unload() {
|
||||
dtm_aet->DelTask();
|
||||
dtw_aet->Hide();
|
||||
}
|
||||
|
||||
void dtm_aet_free() {
|
||||
if (dtw_aet) {
|
||||
delete dtw_aet;
|
||||
dtw_aet = 0;
|
||||
}
|
||||
|
||||
if (dtm_aet) {
|
||||
delete dtm_aet;
|
||||
dtm_aet = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
by korenkonder
|
||||
GitHub/GitLab: korenkonder
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../KKdLib/default.hpp"
|
||||
#include "../../CRE/auth_2d.hpp"
|
||||
#include "../dw.hpp"
|
||||
#include "../task_window.hpp"
|
||||
|
||||
class DtmAet : public app::Task {
|
||||
public:
|
||||
std::vector<std::string> sound_farcs;
|
||||
//draw_params draw_params;
|
||||
//font_info font;
|
||||
uint32_t curr_set_index;
|
||||
uint32_t set_index;
|
||||
uint32_t id_index;
|
||||
uint32_t layer_index;
|
||||
uint32_t marker_index;
|
||||
uint8_t type;
|
||||
std::vector<std::string> comp_layers;
|
||||
std::map<std::string, aet_layer_object_data> data;
|
||||
std::vector<std::string> markers;
|
||||
float_t frame;
|
||||
float_t start_time;
|
||||
float_t end_time;
|
||||
bool lock;
|
||||
bool loop;
|
||||
bool centering;
|
||||
int32_t state;
|
||||
|
||||
DtmAet();
|
||||
virtual ~DtmAet() override;
|
||||
|
||||
virtual bool Init() override;
|
||||
virtual bool Ctrl() override;
|
||||
virtual bool Dest() override;
|
||||
virtual void Disp() override;
|
||||
virtual void Basic() override;
|
||||
|
||||
virtual void GetSoundFarcs();
|
||||
virtual void SetSetIndex(int32_t value);
|
||||
virtual void SetIdIndex(int32_t value);
|
||||
virtual void SetLayerIndex(int32_t value);
|
||||
virtual void SetMarkerIndex(int32_t value);
|
||||
virtual void SetType(uint8_t value);
|
||||
virtual void SetFrame(float_t value);
|
||||
virtual void SetLock(bool value);
|
||||
virtual void SetLoop(bool value);
|
||||
virtual void SetCentering(bool value);
|
||||
};
|
||||
|
||||
class DtwAet : public dw::Shell {
|
||||
public:
|
||||
dw::ListBox* set;
|
||||
dw::ListBox* id;
|
||||
dw::ListBox* layer;
|
||||
dw::ListBox* marker;
|
||||
dw::Label* marker_frame;
|
||||
dw::ListBox* type;
|
||||
dw::Slider* frame;
|
||||
|
||||
DtwAet();
|
||||
virtual ~DtwAet() override;
|
||||
|
||||
virtual void Hide() override;
|
||||
|
||||
static void CenteringCallback(dw::Widget* data);
|
||||
static void FrameCallback(dw::Widget* data);
|
||||
static void IdCallback(dw::Widget* data);
|
||||
static void LayerCallback(dw::Widget* data);
|
||||
static void LockCallback(dw::Widget* data);
|
||||
static void LoopCallback(dw::Widget* data);
|
||||
static void MarkerCallback(dw::Widget* data);
|
||||
static void SetCallback(dw::Widget* data);
|
||||
static void TypeCallback(dw::Widget* data);
|
||||
};
|
||||
|
||||
extern DtmAet* dtm_aet;
|
||||
|
||||
extern DtwAet* dtw_aet;
|
||||
|
||||
extern void dtm_aet_init();
|
||||
extern void dtm_aet_load();
|
||||
extern void dtm_aet_unload();
|
||||
extern void dtm_aet_free();
|
||||
@@ -42,6 +42,7 @@ Auth3dTestTask::Auth3dTestTask() {
|
||||
auth_3d_uid = -1;
|
||||
repeat = true;
|
||||
left_right_reverse = false;
|
||||
pos = false;
|
||||
field_1E3 = false;
|
||||
field_1E4 = 0;
|
||||
field_1E8 = false;
|
||||
@@ -78,6 +79,7 @@ bool Auth3dTestTask::Init() {
|
||||
auth_3d_uid = -1;
|
||||
repeat = true;
|
||||
left_right_reverse = false;
|
||||
pos = false;
|
||||
field_1E3 = false;
|
||||
field_1E4 = 0;
|
||||
field_1E8 = false;
|
||||
@@ -124,6 +126,7 @@ bool Auth3dTestTask::Ctrl() {
|
||||
auth_3d_id.set_paused(false);
|
||||
auth_3d_id.set_repeat(repeat);
|
||||
auth_3d_id.set_left_right_reverse(left_right_reverse);
|
||||
auth_3d_id.set_pos(pos ? 1 : 0);
|
||||
field_1D4 = 4;
|
||||
}
|
||||
|
||||
@@ -409,7 +412,7 @@ void Auth3dTestWindow::Window() {
|
||||
ImFont* font = ImGui::GetFont();
|
||||
|
||||
float_t w = min_def((float_t)width, 280.0f);
|
||||
float_t h = min_def((float_t)height, 324.0f);
|
||||
float_t h = min_def((float_t)height, 344.0f);
|
||||
|
||||
ImGui::SetNextWindowPos({ 0, 0 }, ImGuiCond_Appearing);
|
||||
ImGui::SetNextWindowSize({ w, h }, ImGuiCond_Always);
|
||||
@@ -552,6 +555,8 @@ void Auth3dTestWindow::Window() {
|
||||
|
||||
if (ImGui::Checkbox("Left Right Reverse", &auth_3d_test_task->left_right_reverse))
|
||||
_frame = 0.0f;
|
||||
|
||||
ImGui::Checkbox("pos", &auth_3d_test_task->pos);
|
||||
|
||||
if (_frame != frame) {
|
||||
frame_changed = true;
|
||||
@@ -631,6 +636,7 @@ void Auth3dTestWindow::Window() {
|
||||
auth_3d_test_task->auth_3d_id.set_enable(enable);
|
||||
auth_3d_test_task->auth_3d_id.set_repeat(auth_3d_test_task->repeat);
|
||||
auth_3d_test_task->auth_3d_id.set_left_right_reverse(auth_3d_test_task->left_right_reverse);
|
||||
auth_3d_test_task->auth_3d_id.set_pos(auth_3d_test_task->pos ? 1 : 0);
|
||||
if (frame_changed) {
|
||||
auth_3d_test_task->auth_3d_id.set_req_frame(frame);
|
||||
frame_changed = false;
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
int32_t auth_3d_uid;
|
||||
bool repeat;
|
||||
bool left_right_reverse;
|
||||
bool pos;
|
||||
bool field_1E3;
|
||||
int32_t field_1E4;
|
||||
bool field_1E8;
|
||||
|
||||
@@ -133,12 +133,12 @@ DtwStg::DtwStg() : Shell(0) {
|
||||
|
||||
//dw::List::sub_1402F9930(this->ns->list, 30);
|
||||
ns->list->hovered_item = 0;
|
||||
ns->list->selected_item = 0;
|
||||
ns->list->ResetSetSelectedItem(0);
|
||||
ns->AddSelectionListener(new dw::SelectionListenerOnHook(DtwStg::StageCallback));
|
||||
|
||||
//dw::List::sub_1402F9930(this->stage->list, 30);
|
||||
stage->list->hovered_item = 0;
|
||||
stage->list->selected_item = 0;
|
||||
stage->list->ResetSetSelectedItem(0);
|
||||
stage->AddSelectionListener(new dw::SelectionListenerOnHook(DtwStg::StageCallback));
|
||||
|
||||
stage_display = new dw::Button(this, WIDGET_CHECKBOX);
|
||||
@@ -444,6 +444,11 @@ bool dtm_stg_unload() {
|
||||
}
|
||||
|
||||
void dtm_stg_free() {
|
||||
if (dtw_stg) {
|
||||
delete dtw_stg;
|
||||
dtw_stg = 0;
|
||||
}
|
||||
|
||||
if (dtm_stg) {
|
||||
delete dtm_stg;
|
||||
dtm_stg = 0;
|
||||
@@ -451,25 +456,21 @@ void dtm_stg_free() {
|
||||
}
|
||||
|
||||
void dtw_stg_init() {
|
||||
dtw_stg = new DtwStg;
|
||||
if (!dtw_stg)
|
||||
dtw_stg = new DtwStg;
|
||||
dtw_stg->Disp();
|
||||
}
|
||||
|
||||
void dtw_stg_load(bool hide) {
|
||||
dtw_stg->SetDisp(!hide);
|
||||
dtw_stg_init();
|
||||
if (hide)
|
||||
dtw_stg->SetDisp(false);
|
||||
}
|
||||
|
||||
void dtw_stg_unload() {
|
||||
dtw_stg->Hide();
|
||||
}
|
||||
|
||||
void dtw_stg_free() {
|
||||
if (dtw_stg) {
|
||||
delete dtw_stg;
|
||||
dtw_stg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static int stage_test_stage_pv_quicksort_compare_func(void const* src1, void const* src2) {
|
||||
int32_t pv1 = ((stage_test_stage_pv*)src1)->pv_id;
|
||||
int32_t pv2 = ((stage_test_stage_pv*)src2)->pv_id;
|
||||
|
||||
@@ -65,4 +65,3 @@ extern void dtm_stg_free();
|
||||
extern void dtw_stg_init();
|
||||
extern void dtw_stg_load(bool hide);
|
||||
extern void dtw_stg_unload();
|
||||
extern void dtw_stg_free();
|
||||
|
||||
+537
-19
@@ -6,6 +6,122 @@
|
||||
#include "dw.hpp"
|
||||
#include "imgui_helper.hpp"
|
||||
|
||||
namespace dw_gui_detail {
|
||||
struct Display {
|
||||
/*dw::Shell* field_8;
|
||||
dw::Menu* field_10;
|
||||
dw::Widget* field_18;
|
||||
dw::Widget* field_20;
|
||||
dw::Widget* field_28;
|
||||
dw::Widget* field_30;
|
||||
dw::Shell* field_38;
|
||||
char field_40;
|
||||
char field_41;*/
|
||||
std::vector<dw::Shell*> shells;
|
||||
/*std::vector<dw::Menu*> menus;
|
||||
struc_748 field_78;
|
||||
struc_748 field_90;*/
|
||||
std::vector<dw::Widget*> free_widgets;
|
||||
/*struc_751 field_C0;
|
||||
int field_F4;
|
||||
int field_F8;
|
||||
int field_FC;
|
||||
int field_100;
|
||||
int field_104;
|
||||
int field_108;
|
||||
int field_10C;
|
||||
int field_110;
|
||||
int field_114;
|
||||
__int64 field_118;
|
||||
vec2 field_120;
|
||||
float_t field_128;
|
||||
dw::DragBoundsControl* field_130;
|
||||
std::string name;
|
||||
dw_gui_detail::Display::RootKeySelection root_key_selection;*/
|
||||
|
||||
Display();
|
||||
~Display();
|
||||
|
||||
void AddShell(dw::Shell* value);
|
||||
void CheckShells();
|
||||
void Ctrl();
|
||||
void Draw();
|
||||
void FreeWidgets();
|
||||
void RemoveShell(dw::Shell* value);
|
||||
};
|
||||
}
|
||||
|
||||
struct dw_gui_colors {
|
||||
vec4u8 background;
|
||||
vec4u8 foreground;
|
||||
vec4u8 selection_background;
|
||||
vec4u8 selection_foreground;
|
||||
vec4u8 selection_inactive_background;
|
||||
vec4u8 selection_inactive_foreground;
|
||||
vec4u8 disable_background;
|
||||
vec4u8 disable_foreground;
|
||||
vec4u8 title_background;
|
||||
vec4u8 title_foreground;
|
||||
vec4u8 title_inactive_background;
|
||||
vec4u8 title_inactive_foreground;
|
||||
vec4u8 active_border_color;
|
||||
vec4u8 inactive_border_color;
|
||||
vec4u8 focus_border_color;
|
||||
vec4u8 border_color;
|
||||
vec4u8 border_light_color;
|
||||
vec4u8 border_dark_color;
|
||||
vec4u8 popup_background;
|
||||
vec4u8 popup_foreground;
|
||||
vec4u8 popup_selection_background;
|
||||
vec4u8 popup_selection_foreground;
|
||||
vec4u8 menu_background;
|
||||
vec4u8 menu_foreground;
|
||||
vec4u8 menu_selection_background;
|
||||
vec4u8 menu_selection_foreground;
|
||||
vec4u8 button_background;
|
||||
vec4u8 button_foreground;
|
||||
vec4u8 button_disable_background;
|
||||
vec4u8 button_disable_foreground;
|
||||
};
|
||||
|
||||
static dw_gui_colors dw_gui_colors_default = {
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x00, 0x00, 0x00, 0xFF },
|
||||
{ 0x00, 0x00, 0x80, 0xFF },
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
{ 0xC0, 0xC0, 0xC0, 0xFF },
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
{ 0xC0, 0xC0, 0xC0, 0xFF },
|
||||
{ 0x80, 0x80, 0x80, 0xFF },
|
||||
{ 0x00, 0x00, 0x80, 0xFF },
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
{ 0xC0, 0xC0, 0xC0, 0xFF },
|
||||
{ 0x80, 0x80, 0x80, 0xFF },
|
||||
{ 0xC0, 0xC0, 0xC0, 0xFF },
|
||||
{ 0xC0, 0xC0, 0xC0, 0xFF },
|
||||
{ 0xFF, 0x00, 0x00, 0xFF },
|
||||
{ 0xC0, 0xC0, 0xC0, 0xFF },
|
||||
{ 0xE0, 0xE0, 0xE0, 0xFF },
|
||||
{ 0x80, 0x80, 0x80, 0xFF },
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x00, 0x00, 0x00, 0xFF },
|
||||
{ 0x00, 0x00, 0x80, 0xFF },
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
{ 0xC0, 0xC0, 0xC0, 0xFF },
|
||||
{ 0x00, 0x00, 0x00, 0xFF },
|
||||
{ 0x00, 0x00, 0x80, 0xFF },
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
{ 0xC0, 0xC0, 0xC0, 0xFF },
|
||||
{ 0x00, 0x00, 0x00, 0xFF },
|
||||
{ 0xF0, 0xF0, 0xF0, 0xFF },
|
||||
{ 0x80, 0x80, 0x80, 0xFF },
|
||||
};
|
||||
|
||||
dw_gui_detail::Display* dw_gui_detail_display;
|
||||
|
||||
static bool dw_gui_get_ctrl();
|
||||
static bool dw_gui_get_disp();
|
||||
|
||||
namespace dw {
|
||||
SelectionListener::SelectionListener() {
|
||||
|
||||
@@ -22,7 +138,15 @@ namespace dw {
|
||||
SelectionAdapter::~SelectionAdapter() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SelectionAdapter::Field_8(Widget* data) {
|
||||
|
||||
}
|
||||
|
||||
void SelectionAdapter::Field_10(Widget* data) {
|
||||
|
||||
}
|
||||
|
||||
SelectionListenerOnHook::SelectionListenerOnHook() : callback() {
|
||||
|
||||
}
|
||||
@@ -35,7 +159,12 @@ namespace dw {
|
||||
|
||||
}
|
||||
|
||||
Widget::Widget(Widget* parent, Flags flags) : callback_data(), parent() {
|
||||
void SelectionListenerOnHook::Field_8(Widget* data) {
|
||||
callback(data);
|
||||
}
|
||||
|
||||
Widget::Widget(Widget* parent, Flags flags) : free(),
|
||||
callback_data(), free_callback(), parent() {
|
||||
this->flags = flags;
|
||||
}
|
||||
|
||||
@@ -67,10 +196,28 @@ namespace dw {
|
||||
return position;
|
||||
}
|
||||
|
||||
void Widget::Free() {
|
||||
if (free)
|
||||
return;
|
||||
|
||||
Reset();
|
||||
if (free_callback)
|
||||
free_callback(this);
|
||||
free = 1;
|
||||
|
||||
if (dw_gui_detail_display)
|
||||
dw_gui_detail_display->free_widgets.push_back(this);
|
||||
}
|
||||
|
||||
void Widget::SetName(std::string&& str) {
|
||||
SetName(str);
|
||||
}
|
||||
|
||||
void Widget::UpdateDraw() {
|
||||
//sub_140302800(qword_1411900C8);
|
||||
Draw();
|
||||
}
|
||||
|
||||
Control::Control(Composite* parent, Flags flags) : Widget(parent, flags),
|
||||
parent_comp(), parent_shell()/*, parent_menu()*/{
|
||||
parent_comp = parent;
|
||||
@@ -105,8 +252,49 @@ namespace dw {
|
||||
ImGui::Text(name.c_str());
|
||||
}
|
||||
|
||||
Scrollable::Scrollable(Composite* parent, Flags flags) : Control(parent, flags) {
|
||||
ScrollBar::ScrollBar(Control* parent, Widget::Flags flags) : Widget(parent, flags),
|
||||
value(), min(), field_A0(), field_A5(), field_A6() {
|
||||
field_68 = parent;
|
||||
max = 100.0f;
|
||||
field_94 = 10.0f;
|
||||
step = 1.0f;
|
||||
step_fast = 10.0f;
|
||||
round = true;
|
||||
SetSize({ 8.0f, 8.0f });
|
||||
}
|
||||
|
||||
ScrollBar::~ScrollBar() {
|
||||
|
||||
}
|
||||
|
||||
void ScrollBar::Draw() {
|
||||
|
||||
}
|
||||
|
||||
void ScrollBar::SetSize(vec2 value) {
|
||||
size = value;
|
||||
}
|
||||
|
||||
void ScrollBar::SetParams(float_t value, float_t min,
|
||||
float_t max, float_t a5, float_t step, float_t step_fast) {
|
||||
this->value = value;
|
||||
this->field_94 = a5;
|
||||
this->min = min;
|
||||
this->step_fast = step_fast;
|
||||
this->max = max;
|
||||
this->step = step;
|
||||
}
|
||||
|
||||
Scrollable::Scrollable(Composite* parent, Flags flags) : Control(parent, flags), h_bar(), v_bar() {
|
||||
if (flags & WIDGET_SCROLL_H) {
|
||||
h_bar = new ScrollBar(parent, WIDGET_SCROLL_H);
|
||||
h_bar->SetName("h_bar");
|
||||
}
|
||||
|
||||
if (flags & WIDGET_SCROLL_V) {
|
||||
v_bar = new ScrollBar(parent, WIDGET_SCROLL_V);
|
||||
v_bar->SetName("v_bar");
|
||||
}
|
||||
}
|
||||
|
||||
Scrollable::~Scrollable() {
|
||||
@@ -114,7 +302,8 @@ namespace dw {
|
||||
}
|
||||
|
||||
void Scrollable::Draw() {
|
||||
|
||||
if (v_bar)
|
||||
v_bar->UpdateDraw();
|
||||
}
|
||||
|
||||
void Scrollable::Reset() {
|
||||
@@ -137,11 +326,11 @@ namespace dw {
|
||||
|
||||
}
|
||||
|
||||
vec2 FillLayout::GetSize(dw::Composite* comp) {
|
||||
vec2 FillLayout::GetSize(Composite* comp) {
|
||||
return comp->size;
|
||||
}
|
||||
|
||||
void FillLayout::SetSize(dw::Composite* comp) {
|
||||
void FillLayout::SetSize(Composite* comp) {
|
||||
const vec2 position = comp->position;
|
||||
const vec2 size = comp->size;
|
||||
for (Control* i : comp->controls) {
|
||||
@@ -158,11 +347,11 @@ namespace dw {
|
||||
|
||||
}
|
||||
|
||||
vec2 GraphLayout::GetSize(dw::Composite* comp) {
|
||||
vec2 GraphLayout::GetSize(Composite* comp) {
|
||||
return comp->size;
|
||||
}
|
||||
|
||||
void GraphLayout::SetSize(dw::Composite* comp) {
|
||||
void GraphLayout::SetSize(Composite* comp) {
|
||||
const vec2 position = comp->position;
|
||||
const vec2 size = comp->size;
|
||||
for (Control* i : comp->controls) {
|
||||
@@ -182,11 +371,11 @@ namespace dw {
|
||||
|
||||
}
|
||||
|
||||
vec2 GridLayout::GetSize(dw::Composite* comp) {
|
||||
vec2 GridLayout::GetSize(Composite* comp) {
|
||||
return comp->size;
|
||||
}
|
||||
|
||||
void GridLayout::SetSize(dw::Composite* comp) {
|
||||
void GridLayout::SetSize(Composite* comp) {
|
||||
const vec2 position = comp->position;
|
||||
const vec2 size = comp->size;
|
||||
for (Control* i : comp->controls) {
|
||||
@@ -204,11 +393,11 @@ namespace dw {
|
||||
|
||||
}
|
||||
|
||||
vec2 RowLayout::GetSize(dw::Composite* comp) {
|
||||
vec2 RowLayout::GetSize(Composite* comp) {
|
||||
return comp->size;
|
||||
}
|
||||
|
||||
void RowLayout::SetSize(dw::Composite* comp) {
|
||||
void RowLayout::SetSize(Composite* comp) {
|
||||
const vec2 position = comp->position;
|
||||
const vec2 size = comp->size;
|
||||
for (Control* i : comp->controls) {
|
||||
@@ -232,13 +421,13 @@ namespace dw {
|
||||
|
||||
void Composite::Reset() {
|
||||
//for (Control* i : controls)
|
||||
//dw::Widget::sub_1402ECDE0(i);
|
||||
//Widget::sub_1402ECDE0(i);
|
||||
|
||||
controls.clear();
|
||||
Scrollable::Reset();
|
||||
}
|
||||
|
||||
void Composite::SetLayout(dw::Layout* value) {
|
||||
void Composite::SetLayout(Layout* value) {
|
||||
layout = value;
|
||||
}
|
||||
|
||||
@@ -251,8 +440,10 @@ namespace dw {
|
||||
}
|
||||
|
||||
void Button::Draw() {
|
||||
if (flags & WIDGET_CHECKBOX)
|
||||
ImGui::Checkbox(name.c_str(), &value);
|
||||
if (flags & WIDGET_CHECKBOX) {
|
||||
if (ImGui::Checkbox(name.c_str(), &value) && callback)
|
||||
callback(this);
|
||||
}
|
||||
else if (flags & WIDGET_RADIOBUTTON) {
|
||||
if (ImGui::RadioButton(name.c_str(), value)) {
|
||||
if (callback)
|
||||
@@ -261,7 +452,8 @@ namespace dw {
|
||||
}
|
||||
}
|
||||
else
|
||||
ImGui::Button(name.c_str());
|
||||
if (ImGui::Button(name.c_str()) && callback)
|
||||
callback(this);
|
||||
}
|
||||
|
||||
void Button::SetValue(bool value) {
|
||||
@@ -276,8 +468,44 @@ namespace dw {
|
||||
}
|
||||
}
|
||||
|
||||
Shell::Shell(Composite* parent, Flags flags) : Composite(parent, flags), disp() {
|
||||
ShellCloseButton::ShellCloseButton(Shell* parent) : Button(parent) {
|
||||
SetSize({ 14.0f, 14.0f });
|
||||
SetName("Close Box");
|
||||
callback = Callback;
|
||||
//field_100 = 0;
|
||||
//field_104 = 4;
|
||||
}
|
||||
|
||||
ShellCloseButton::~ShellCloseButton() {
|
||||
|
||||
}
|
||||
|
||||
void ShellCloseButton::Draw() {
|
||||
|
||||
}
|
||||
|
||||
void ShellCloseButton::Callback(Widget* data) {
|
||||
ShellCloseButton* close_button = dynamic_cast<ShellCloseButton*>(data);
|
||||
if (close_button)
|
||||
close_button->parent_shell->Hide();
|
||||
}
|
||||
|
||||
Shell::Shell(Shell* parent, Flags flags) : Composite(parent, flags),
|
||||
disp(), disp_callback(), hide_callback(), destroy(), close_button() {
|
||||
parent_shell = this;
|
||||
|
||||
if (flags & WIDGET_CLOSE_BUTTON) {
|
||||
close_button = new ShellCloseButton(this);
|
||||
if (controls.size())
|
||||
controls.pop_back();
|
||||
}
|
||||
|
||||
if (parent) {
|
||||
parent_comp = parent;
|
||||
parent->children.push_back(this);
|
||||
}
|
||||
|
||||
dw_gui_detail_display->shells.push_back(this);
|
||||
}
|
||||
|
||||
Shell::~Shell() {
|
||||
@@ -288,7 +516,45 @@ namespace dw {
|
||||
if (!GetDisp())
|
||||
return;
|
||||
|
||||
Composite::Draw();
|
||||
if (ImGui::Begin(name.c_str())) {
|
||||
Composite::Draw();
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
void Shell::Reset() {
|
||||
std::vector<Widget*> vec;
|
||||
vec.assign(children.begin(), children.end());
|
||||
children.clear();
|
||||
|
||||
for (Widget* i : vec)
|
||||
i->Free();
|
||||
|
||||
/*for (Menu* i : menus)
|
||||
i->Free();
|
||||
menus.clear();*/
|
||||
|
||||
if (close_button) {
|
||||
close_button->Free();
|
||||
close_button = 0;
|
||||
}
|
||||
|
||||
if (parent_comp) {
|
||||
Shell* parent_shell = dynamic_cast<Shell*>(parent_comp);
|
||||
if (parent_shell) {
|
||||
auto i = parent_shell->children.begin();
|
||||
auto i_end = parent_shell->children.end();
|
||||
while (i != i_end)
|
||||
if (*i == this) {
|
||||
parent_shell->children.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dw_gui_detail_display->RemoveShell(this);
|
||||
|
||||
Composite::Reset();
|
||||
}
|
||||
|
||||
void Shell::Hide() {
|
||||
@@ -297,6 +563,9 @@ namespace dw {
|
||||
|
||||
void Shell::Disp() {
|
||||
SetDisp(true);
|
||||
dw_gui_detail_display->AddShell(this);
|
||||
//dw_gui_detail_display->field_38 = this;
|
||||
//dw_gui_detail_display->field_40 = true;
|
||||
}
|
||||
|
||||
bool Shell::GetDisp() {
|
||||
@@ -308,6 +577,18 @@ namespace dw {
|
||||
return;
|
||||
|
||||
disp = value;
|
||||
if (disp) {
|
||||
dw_gui_detail_display->AddShell(this);
|
||||
//dw_gui_detail_display->field_38 = this;
|
||||
//dw_gui_detail_display->field_40 = true;
|
||||
if (disp_callback)
|
||||
disp_callback(this);
|
||||
}
|
||||
else {
|
||||
//dw_gui_detail_display->field_41 = true;
|
||||
if (hide_callback)
|
||||
hide_callback(this);
|
||||
}
|
||||
}
|
||||
|
||||
List::List(Composite* parent, Flags flags) : Scrollable(parent, flags) {
|
||||
@@ -348,6 +629,27 @@ namespace dw {
|
||||
return items[index];
|
||||
}
|
||||
|
||||
void List::ResetSelectedItem() {
|
||||
if (flags & WIDGET_4)
|
||||
selected_item = -1;
|
||||
else
|
||||
for (int32_t& i : selections)
|
||||
i = 0;
|
||||
}
|
||||
|
||||
void List::ResetSetSelectedItem(size_t index) {
|
||||
ResetSelectedItem();
|
||||
SetSelectedItem(index);
|
||||
}
|
||||
|
||||
void List::SetSelectedItem(size_t index) {
|
||||
if (index < items.size())
|
||||
if (flags & WIDGET_4)
|
||||
selected_item = index;
|
||||
else
|
||||
selections[index] = 1;
|
||||
}
|
||||
|
||||
ListBox::ListBox(Composite* parent, Flags flags) : Composite(parent, flags), list() {
|
||||
list = new List(parent, flags);
|
||||
}
|
||||
@@ -357,7 +659,46 @@ namespace dw {
|
||||
}
|
||||
|
||||
void ListBox::Draw() {
|
||||
bool window_focus = false;
|
||||
|
||||
std::vector<std::string>& items = list->items;
|
||||
size_t hovered_item = list->selected_item;
|
||||
size_t selected_item = list->selected_item;
|
||||
ImGui::GetContentRegionAvailSetNextItemWidth();
|
||||
ImGui::PushID(this);
|
||||
if (ImGui::BeginCombo("##", selected_item != -1
|
||||
&& items.size() ? items[selected_item].c_str() : "", 0)) {
|
||||
for (std::string& i : items) {
|
||||
size_t item = &i - items.data();
|
||||
|
||||
ImGui::PushID(&i);
|
||||
if (ImGui::Selectable(i.c_str(), selected_item == item)
|
||||
|| ImGui::ItemKeyPressed(ImGuiKey_Enter)
|
||||
|| (ImGui::IsItemFocused() && selected_item != item)) {
|
||||
selected_item = item;
|
||||
}
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
hovered_item = item;
|
||||
ImGui::PopID();
|
||||
|
||||
if (selected_item == item)
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
window_focus |= true;
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
if (list->hovered_item != hovered_item)
|
||||
list->hovered_item = hovered_item;
|
||||
|
||||
if (list->selected_item != selected_item) {
|
||||
list->selected_item = selected_item;
|
||||
for (SelectionListener*& i : list->selection_listeners)
|
||||
i->Field_8(this);
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
void ListBox::Reset() {
|
||||
@@ -383,4 +724,181 @@ namespace dw {
|
||||
std::string ListBox::GetItem(size_t index) const {
|
||||
return list->GetItem(index);
|
||||
}
|
||||
|
||||
Slider::Slider(Composite* parent, Widget::Flags flags) : Control(parent, flags) {
|
||||
format = "%f";
|
||||
scroll_bar = new ScrollBar(this, (Widget::Flags)(flags & (WIDGET_SCROLL_H | WIDGET_SCROLL_V)));
|
||||
scroll_bar->parent = this;
|
||||
}
|
||||
|
||||
Slider::~Slider() {
|
||||
delete scroll_bar;
|
||||
}
|
||||
|
||||
void Slider::Draw() {
|
||||
ScrollBar* scroll_bar = this->scroll_bar;
|
||||
if (ImGui::ColumnSliderFloatButton(name.c_str(), &scroll_bar->value,
|
||||
scroll_bar->step, scroll_bar->min, scroll_bar->max, scroll_bar->step_fast, format, 0))
|
||||
for (SelectionListener*& i : selection_listeners)
|
||||
i->Field_8(this);
|
||||
}
|
||||
|
||||
void Slider::Reset() {
|
||||
if (scroll_bar) {
|
||||
scroll_bar->Free();
|
||||
scroll_bar = 0;
|
||||
}
|
||||
|
||||
Control::Reset();
|
||||
}
|
||||
|
||||
void Slider::SetSize(vec2 value) {
|
||||
Widget::SetSize(value);
|
||||
scroll_bar->position.x = value.x - scroll_bar->size.x;
|
||||
scroll_bar->position.y = 0.0f;
|
||||
}
|
||||
|
||||
void Slider::AddSelectionListener(SelectionListener* value) {
|
||||
selection_listeners.push_back(value);
|
||||
}
|
||||
|
||||
Slider* Slider::make(Composite* parent, Widget::Flags flags,
|
||||
float_t x, float_t y, float_t width, float_t height, const char* name) {
|
||||
Slider* slider = new Slider(parent, flags);
|
||||
ScrollBar* scroll_bar = slider->scroll_bar;
|
||||
slider->SetName(name);
|
||||
scroll_bar->SetName("slider's bar");
|
||||
scroll_bar->SetSize({ width, height });
|
||||
/*sub_140302810(qword_1411900C8, &slider->font);
|
||||
std::string v13 = slider->GetName();
|
||||
float_t v15;
|
||||
float_t v17;
|
||||
if (flags & WIDGET_100) {
|
||||
vec2 v21;
|
||||
vec2 v22;
|
||||
sub_140302A70(qword_1411900C8, &v22, v13);
|
||||
sub_140302A70(qword_1411900C8, &v21, "0000");
|
||||
scroll_bar->position.x = v21.x + v22.x;
|
||||
scroll_bar->position.y = 0.0f;
|
||||
v17 = v21.x + v22.x + scroll_bar->size.x ;
|
||||
v15 = p_dw__Font::GetFontGlyphHeight(&slider->font);
|
||||
}
|
||||
else {
|
||||
vec2 v21;
|
||||
vec2 v22;
|
||||
sub_140302A70(qword_1411900C8, &v21, v13);
|
||||
sub_140302A70(qword_1411900C8, &v22, "0000");
|
||||
v17 = p_dw__Font::GetFontGlyphWidth(&slider->font);
|
||||
v15 = v21.x + v22.x + scroll_bar->size.y;
|
||||
}*/
|
||||
slider->position.x = x;
|
||||
slider->position.y = y;
|
||||
//slider->SetSize({ v17, v15 });
|
||||
return slider;
|
||||
}
|
||||
}
|
||||
|
||||
void dw_gui_detail_display_init() {
|
||||
if (!dw_gui_detail_display)
|
||||
dw_gui_detail_display = new dw_gui_detail::Display;
|
||||
}
|
||||
|
||||
void dw_gui_detail_display_free() {
|
||||
if (dw_gui_detail_display) {
|
||||
delete dw_gui_detail_display;
|
||||
dw_gui_detail_display = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void dw_gui_ctrl_disp() {
|
||||
if (dw_gui_get_ctrl())
|
||||
dw_gui_detail_display->Ctrl();
|
||||
if (dw_gui_get_disp())
|
||||
dw_gui_detail_display->Draw();
|
||||
};
|
||||
|
||||
dw_gui_detail::Display::Display() {
|
||||
|
||||
}
|
||||
|
||||
dw_gui_detail::Display::~Display() {
|
||||
|
||||
}
|
||||
|
||||
void dw_gui_detail::Display::AddShell(dw::Shell* value) {
|
||||
if (!value)
|
||||
return;
|
||||
|
||||
for (dw::Shell* i : shells)
|
||||
if (i == value)
|
||||
return;
|
||||
|
||||
shells.push_back(value);
|
||||
}
|
||||
|
||||
void dw_gui_detail::Display::CheckShells() {
|
||||
std::vector<dw::Shell*> vec;
|
||||
|
||||
for (dw::Shell* i : shells)
|
||||
if (i->destroy)
|
||||
vec.push_back(i);
|
||||
|
||||
if (vec.size()) {
|
||||
for (dw::Shell* i : vec)
|
||||
i->Free();
|
||||
//field_41 = true;
|
||||
}
|
||||
}
|
||||
|
||||
void dw_gui_detail::Display::Ctrl() {
|
||||
CheckShells();
|
||||
FreeWidgets();
|
||||
}
|
||||
|
||||
void dw_gui_detail::Display::Draw() {
|
||||
for (dw::Shell* i : shells)
|
||||
if (i->GetDisp())
|
||||
i->UpdateDraw();
|
||||
}
|
||||
|
||||
void dw_gui_detail::Display::FreeWidgets() {
|
||||
for (auto& i : free_widgets) {
|
||||
delete i;
|
||||
/*if (field_28 == i)
|
||||
field_28 = 0;
|
||||
if (field_30 == i)
|
||||
field_30 = 0;*/
|
||||
}
|
||||
free_widgets.clear();
|
||||
}
|
||||
|
||||
void dw_gui_detail::Display::RemoveShell(dw::Shell* value) {
|
||||
auto i = shells.begin();
|
||||
auto i_end = shells.end();
|
||||
while (i != i_end)
|
||||
if (*i == value) {
|
||||
shells.erase(i);
|
||||
break;
|
||||
}
|
||||
|
||||
/*if (field_8 == value) {
|
||||
field_8 = 0;
|
||||
field_41 = true;
|
||||
}
|
||||
|
||||
if (field_18 == value)
|
||||
field_18 = 0;
|
||||
|
||||
if (field_20 == value)
|
||||
field_20 = 0;*/
|
||||
}
|
||||
|
||||
static bool dw_gui_get_ctrl() {
|
||||
//return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool dw_gui_get_disp() {
|
||||
//return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
+136
-20
@@ -15,11 +15,17 @@ namespace dw {
|
||||
typedef void(*Callback)(Widget* data);
|
||||
|
||||
enum Flags {
|
||||
WIDGET_RADIOBUTTON = 0x10,
|
||||
WIDGET_CHECKBOX = 0x20,
|
||||
WIDGET_CLOSE_BUTTON = 0x40,
|
||||
WIDGET_4 = 0x004,
|
||||
WIDGET_RADIOBUTTON = 0x010,
|
||||
WIDGET_CHECKBOX = 0x020,
|
||||
WIDGET_CLOSE_BUTTON = 0x040,
|
||||
WIDGET_SCROLL_H = 0x100,
|
||||
WIDGET_SCROLL_V = 0x200,
|
||||
WIDGET_800 = 0x800,
|
||||
};
|
||||
|
||||
bool free;
|
||||
|
||||
union {
|
||||
int8_t i8;
|
||||
uint8_t u8;
|
||||
@@ -32,6 +38,7 @@ namespace dw {
|
||||
void* v64;
|
||||
} callback_data;
|
||||
|
||||
Callback free_callback;
|
||||
std::string name;
|
||||
vec2 position;
|
||||
vec2 size;
|
||||
@@ -48,19 +55,27 @@ namespace dw {
|
||||
virtual void SetSize(vec2 value);
|
||||
virtual vec2 GetPos();
|
||||
|
||||
void Free();
|
||||
void SetName(std::string&& str);
|
||||
void UpdateDraw();
|
||||
};
|
||||
|
||||
class SelectionListener {
|
||||
public:
|
||||
SelectionListener();
|
||||
virtual ~SelectionListener();
|
||||
|
||||
virtual void Field_8(Widget* data) = 0;
|
||||
virtual void Field_10(Widget* data) = 0;
|
||||
};
|
||||
|
||||
class SelectionAdapter : public SelectionListener {
|
||||
public:
|
||||
SelectionAdapter();
|
||||
virtual ~SelectionAdapter() override;
|
||||
|
||||
virtual void Field_8(Widget* data) override;
|
||||
virtual void Field_10(Widget* data) override;
|
||||
};
|
||||
|
||||
class SelectionListenerOnHook : public SelectionAdapter {
|
||||
@@ -70,6 +85,8 @@ namespace dw {
|
||||
SelectionListenerOnHook();
|
||||
SelectionListenerOnHook(Widget::Callback callback);
|
||||
virtual ~SelectionListenerOnHook() override;
|
||||
|
||||
virtual void Field_8(Widget* data) override;
|
||||
};
|
||||
|
||||
class Composite;
|
||||
@@ -96,8 +113,60 @@ namespace dw {
|
||||
virtual void Draw() override;
|
||||
};
|
||||
|
||||
class ScrollBar : public Widget {
|
||||
public:
|
||||
Control* field_68;
|
||||
std::vector<SelectionListener*> selection_listeners;
|
||||
float_t value;
|
||||
float_t min;
|
||||
float_t max;
|
||||
float_t field_94;
|
||||
float_t step;
|
||||
float_t step_fast;
|
||||
int field_A0;
|
||||
bool round;
|
||||
char field_A5;
|
||||
char field_A6;
|
||||
__int64 field_A8;
|
||||
__int64 field_B0;
|
||||
__int64 field_B8;
|
||||
__int64 field_C0;
|
||||
__int64 field_C8;
|
||||
__int64 field_D0;
|
||||
__int64 field_D8;
|
||||
__int64 field_E0;
|
||||
__int64 field_E8;
|
||||
__int64 field_F0;
|
||||
__int64 field_F8;
|
||||
__int64 field_100;
|
||||
__int64 field_108;
|
||||
__int64 field_110;
|
||||
__int64 field_118;
|
||||
__int64 field_120;
|
||||
__int64 field_128;
|
||||
__int64 field_130;
|
||||
__int64 field_138;
|
||||
__int64 field_140;
|
||||
__int64 field_148;
|
||||
__int64 field_150;
|
||||
__int64 field_158;
|
||||
__int64 field_160;
|
||||
|
||||
ScrollBar(Control* parent, Widget::Flags flags);
|
||||
virtual ~ScrollBar() override;
|
||||
|
||||
virtual void Draw() override;
|
||||
virtual void SetSize(vec2 value) override;
|
||||
|
||||
void SetParams(float_t value, float_t min, float_t max,
|
||||
float_t a5, float_t step, float_t step_fast);
|
||||
};
|
||||
|
||||
class Scrollable : public Control {
|
||||
public:
|
||||
ScrollBar* h_bar;
|
||||
ScrollBar* v_bar;
|
||||
|
||||
Scrollable(Composite* parent = 0, Flags flags = (Flags)0);
|
||||
virtual ~Scrollable() override;
|
||||
|
||||
@@ -110,8 +179,8 @@ namespace dw {
|
||||
Layout();
|
||||
virtual ~Layout();
|
||||
|
||||
virtual vec2 GetSize(dw::Composite* comp) = 0;
|
||||
virtual void SetSize(dw::Composite* comp) = 0;
|
||||
virtual vec2 GetSize(Composite* comp) = 0;
|
||||
virtual void SetSize(Composite* comp) = 0;
|
||||
};
|
||||
|
||||
class FillLayout : public Layout {
|
||||
@@ -121,8 +190,8 @@ namespace dw {
|
||||
FillLayout(int32_t a2 = 512);
|
||||
virtual ~FillLayout() override;
|
||||
|
||||
virtual vec2 GetSize(dw::Composite* comp) override;
|
||||
virtual void SetSize(dw::Composite* comp) override;
|
||||
virtual vec2 GetSize(Composite* comp) override;
|
||||
virtual void SetSize(Composite* comp) override;
|
||||
};
|
||||
|
||||
class GraphLayout : public Layout {
|
||||
@@ -132,8 +201,8 @@ namespace dw {
|
||||
GraphLayout(int32_t a2 = 512);
|
||||
virtual ~GraphLayout() override;
|
||||
|
||||
virtual vec2 GetSize(dw::Composite* comp) override;
|
||||
virtual void SetSize(dw::Composite* comp) override;
|
||||
virtual vec2 GetSize(Composite* comp) override;
|
||||
virtual void SetSize(Composite* comp) override;
|
||||
};
|
||||
|
||||
class GridLayout : public Layout {
|
||||
@@ -152,8 +221,8 @@ namespace dw {
|
||||
GridLayout(size_t a2 = 2);
|
||||
virtual ~GridLayout() override;
|
||||
|
||||
virtual vec2 GetSize(dw::Composite* comp) override;
|
||||
virtual void SetSize(dw::Composite* comp) override;
|
||||
virtual vec2 GetSize(Composite* comp) override;
|
||||
virtual void SetSize(Composite* comp) override;
|
||||
};
|
||||
|
||||
class RowLayout : public Layout {
|
||||
@@ -164,14 +233,14 @@ namespace dw {
|
||||
RowLayout(int32_t a2 = 256);
|
||||
virtual ~RowLayout() override;
|
||||
|
||||
virtual vec2 GetSize(dw::Composite* comp) override;
|
||||
virtual void SetSize(dw::Composite* comp) override;
|
||||
virtual vec2 GetSize(Composite* comp) override;
|
||||
virtual void SetSize(Composite* comp) override;
|
||||
};
|
||||
|
||||
class Composite : public Scrollable {
|
||||
public:
|
||||
dw::Layout* layout;
|
||||
std::vector<dw::Control*> controls;
|
||||
Layout* layout;
|
||||
std::vector<Control*> controls;
|
||||
|
||||
Composite(Composite* parent = 0, Flags flags = (Flags)0);
|
||||
virtual ~Composite() override;
|
||||
@@ -179,7 +248,7 @@ namespace dw {
|
||||
virtual void Draw() override;
|
||||
virtual void Reset() override;
|
||||
|
||||
void SetLayout(dw::Layout* value);
|
||||
void SetLayout(Layout* value);
|
||||
};
|
||||
|
||||
class Button : public Control {
|
||||
@@ -196,15 +265,34 @@ namespace dw {
|
||||
void SetValue(bool value);
|
||||
};
|
||||
|
||||
class ShellCloseButton : public Button {
|
||||
public:
|
||||
ShellCloseButton(dw::Shell* parent);
|
||||
virtual ~ShellCloseButton() override;
|
||||
|
||||
virtual void Draw() override;
|
||||
|
||||
static void Callback(dw::Widget* data);
|
||||
};
|
||||
|
||||
class Shell : public Composite {
|
||||
public:
|
||||
bool disp;
|
||||
typedef void(*Callback)(Shell* data);
|
||||
|
||||
Shell(Composite* parent = 0, Flags flags
|
||||
= (dw::Widget::Flags)(0x480 | WIDGET_CLOSE_BUTTON | WIDGET_CHECKBOX | WIDGET_RADIOBUTTON));
|
||||
bool disp;
|
||||
Callback disp_callback;
|
||||
Callback hide_callback;
|
||||
bool destroy;
|
||||
ShellCloseButton* close_button;
|
||||
std::vector<Widget*> children;
|
||||
//std::vector<Menu*> menus;
|
||||
|
||||
Shell(Shell* parent = 0, Flags flags
|
||||
= (Widget::Flags)(0x480 | WIDGET_CLOSE_BUTTON | WIDGET_CHECKBOX | WIDGET_RADIOBUTTON));
|
||||
virtual ~Shell() override;
|
||||
|
||||
virtual void Draw() override;
|
||||
virtual void Reset() override;
|
||||
|
||||
virtual void Hide();
|
||||
|
||||
@@ -216,6 +304,7 @@ namespace dw {
|
||||
class List : public Scrollable {
|
||||
public:
|
||||
std::vector<std::string> items;
|
||||
std::vector<int32_t> selections;
|
||||
size_t hovered_item;
|
||||
size_t selected_item;
|
||||
std::vector<SelectionListener*> selection_listeners;
|
||||
@@ -231,11 +320,14 @@ namespace dw {
|
||||
void AddSelectionListener(SelectionListener* value);
|
||||
void ClearItems();
|
||||
std::string GetItem(size_t index) const;
|
||||
void ResetSelectedItem();
|
||||
void ResetSetSelectedItem(size_t index);
|
||||
void SetSelectedItem(size_t index);
|
||||
};
|
||||
|
||||
class ListBox : public Composite {
|
||||
public:
|
||||
dw::List* list;
|
||||
List* list;
|
||||
|
||||
ListBox(Composite* parent = 0, Flags flags = (Flags)0x204);
|
||||
virtual ~ListBox() override;
|
||||
@@ -249,4 +341,28 @@ namespace dw {
|
||||
void ClearItems();
|
||||
std::string GetItem(size_t index) const;
|
||||
};
|
||||
|
||||
class Slider : public Control {
|
||||
public:
|
||||
const char* format;
|
||||
std::vector<SelectionListener*> selection_listeners;
|
||||
ScrollBar* scroll_bar;
|
||||
|
||||
Slider(Composite* parent, Widget::Flags flags);
|
||||
virtual ~Slider();
|
||||
|
||||
virtual void Draw() override;
|
||||
virtual void Reset() override;
|
||||
virtual void SetSize(vec2 value) override;
|
||||
|
||||
void AddSelectionListener(SelectionListener* value);
|
||||
|
||||
static Slider* make(Composite* parent, Widget::Flags flags,
|
||||
float_t x, float_t y, float_t width, float_t height, const char* name);
|
||||
};
|
||||
}
|
||||
|
||||
extern void dw_gui_detail_display_init();
|
||||
extern void dw_gui_detail_display_free();
|
||||
|
||||
extern void dw_gui_ctrl_disp();
|
||||
|
||||
@@ -5,9 +5,12 @@
|
||||
|
||||
#include "game_state.hpp"
|
||||
#include "../CRE/rob/rob.hpp"
|
||||
#include "../CRE/auth_2d.hpp"
|
||||
#include "../CRE/auth_3d.hpp"
|
||||
#include "../CRE/clear_color.hpp"
|
||||
#include "../CRE/pv_db.hpp"
|
||||
#include "../CRE/task.hpp"
|
||||
#include "data_test/auth_2d_test.hpp"
|
||||
#include "data_test/auth_3d_test.hpp"
|
||||
#include "data_test/glitter_test.hpp"
|
||||
#include "data_test/motion_test.hpp"
|
||||
@@ -974,7 +977,7 @@ bool GameState::AppError::Dest() {
|
||||
bool SubGameState::DataInitialize::Init() {
|
||||
task_data_init_add_task();
|
||||
task_auth_3d_add_task();
|
||||
//task_auth_2d_add_task();
|
||||
aet_manager_add_task();
|
||||
//no_good_add_task();
|
||||
return true;
|
||||
}
|
||||
@@ -1293,7 +1296,7 @@ bool SubGameState::DataTestStg::Ctrl() {
|
||||
bool SubGameState::DataTestStg::Dest() {
|
||||
clear_color = { 0x00, 0x00, 0x00, 0xFF };
|
||||
|
||||
dtw_stg_free();
|
||||
dtw_stg->Hide();
|
||||
dtm_stg->DelTask();
|
||||
return true;
|
||||
}
|
||||
@@ -1341,6 +1344,8 @@ bool SubGameState::DataTestSpr::Dest() {
|
||||
}
|
||||
|
||||
bool SubGameState::DataTestAet::Init() {
|
||||
clear_color = { 0x60, 0x60, 0x60, 0xFF };
|
||||
dtm_aet_load();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1349,6 +1354,8 @@ bool SubGameState::DataTestAet::Ctrl() {
|
||||
}
|
||||
|
||||
bool SubGameState::DataTestAet::Dest() {
|
||||
clear_color = { 0x00, 0x00, 0x00, 0xFF };
|
||||
dtm_aet_unload();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+52
-20
@@ -11,6 +11,8 @@
|
||||
#include "../CRE/rob/rob.hpp"
|
||||
#include "../CRE/rob/motion.hpp"
|
||||
#include "../CRE/rob/skin_param.hpp"
|
||||
#include "../CRE/auth_2d.hpp"
|
||||
#include "../CRE/auth_3d.hpp"
|
||||
#include "../CRE/camera.hpp"
|
||||
#include "../CRE/clear_color.hpp"
|
||||
#include "../CRE/data.hpp"
|
||||
@@ -42,6 +44,7 @@
|
||||
#include "../KKdLib/timer.hpp"
|
||||
#include "../KKdLib/sort.hpp"
|
||||
#include "../KKdLib/str_utils.hpp"
|
||||
#include "data_test/auth_2d_test.hpp"
|
||||
#include "data_test/auth_3d_test.hpp"
|
||||
#include "data_test/glitter_test.hpp"
|
||||
#include "data_test/stage_test.hpp"
|
||||
@@ -435,6 +438,8 @@ static bool render_init(render_init_struct* ris) {
|
||||
width = (int32_t)(width / 2.0f);
|
||||
height = (int32_t)(height / 2.0f);
|
||||
|
||||
res_window_set(RESOLUTION_MODE_HD);
|
||||
|
||||
#if BAKE_PNG || BAKE_VIDEO
|
||||
width = 1920;
|
||||
height = 1080;
|
||||
@@ -531,10 +536,12 @@ static render_context* render_context_load() {
|
||||
render_texture_data_init();
|
||||
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
aet_database* aft_aet_db = &aft_data->data_ft.aet_db;
|
||||
auth_3d_database* aft_auth_3d_db = &aft_data->data_ft.auth_3d_db;
|
||||
bone_database* aft_bone_data = &aft_data->data_ft.bone_data;
|
||||
motion_database* aft_mot_db = &aft_data->data_ft.mot_db;
|
||||
object_database* aft_obj_db = &aft_data->data_ft.obj_db;
|
||||
sprite_database* aft_spr_db = &aft_data->data_ft.spr_db;
|
||||
texture_database* aft_tex_db = &aft_data->data_ft.tex_db;
|
||||
stage_database* aft_stage_data = &aft_data->data_ft.stage_data;
|
||||
|
||||
@@ -559,19 +566,23 @@ static render_context* render_context_load() {
|
||||
|
||||
rob_init();
|
||||
task_wind_init();
|
||||
aet_manager_init();
|
||||
sprite_manager_init();
|
||||
auth_3d_data_init();
|
||||
auth_3d_test_task_init();
|
||||
task_auth_3d_init();
|
||||
task_stage_init();
|
||||
dtm_stg_init();
|
||||
task_stage_modern_init();
|
||||
light_param_data_storage_data_init();
|
||||
task_effect_init();
|
||||
task_pv_db_init();
|
||||
Glitter::glt_particle_manager_init();
|
||||
|
||||
dw_gui_detail_display_init();
|
||||
|
||||
auth_3d_test_window_init();
|
||||
dtw_stg_init();
|
||||
dtm_aet_init();
|
||||
dtm_stg_init();
|
||||
task_data_test_glitter_particle_init();
|
||||
|
||||
Glitter::glt_particle_manager->bone_data = aft_bone_data;
|
||||
@@ -835,7 +846,8 @@ static render_context* render_context_load() {
|
||||
|
||||
rctx->post_process.init_fbo(internal_3d_res.x, internal_3d_res.y,
|
||||
internal_2d_res.x, internal_2d_res.y, width, height);
|
||||
rctx->render_manager.resize(internal_2d_res.x, internal_2d_res.y);
|
||||
rctx->render_manager.resize(width, height);
|
||||
rctx->litproj->resize(internal_3d_res.x, internal_3d_res.y);
|
||||
|
||||
render_resize_fb(rctx, true);
|
||||
|
||||
@@ -852,7 +864,11 @@ static render_context* render_context_load() {
|
||||
|
||||
hand_item_handler_data_init();
|
||||
//rob_sleeve_data_init();
|
||||
sprite_manager_init();
|
||||
|
||||
aet_manager_add_aet_sets(aft_aet_db, false);
|
||||
sprite_manager_add_spr_sets(aft_spr_db, false);
|
||||
|
||||
sprite_manager_set_res((double_t)width / (double_t)height, width, height);
|
||||
|
||||
render_timer->reset();
|
||||
for (int32_t i = 0; i < 30; i++) {
|
||||
@@ -869,8 +885,9 @@ static render_context* render_context_load() {
|
||||
|
||||
camera* cam = rctx->camera;
|
||||
|
||||
resolution_struct* res_wind = res_window_get();
|
||||
cam->initialize(aspect, internal_3d_res.x, internal_3d_res.y,
|
||||
internal_2d_res.x, internal_2d_res.y);
|
||||
res_wind->width, res_wind->height);
|
||||
//cam->set_position({ 1.35542f, 1.41634f, 1.27852f });
|
||||
//cam->rotate({ -45.0, -32.5 });
|
||||
//cam->set_position({ -6.67555f, 4.68882f, -3.67537f });
|
||||
@@ -947,14 +964,16 @@ static void render_context_ctrl(render_context* rctx) {
|
||||
global_context_menu = true;
|
||||
lock_lock(imgui_context_lock);
|
||||
ImGui::SetCurrentContext(imgui_context);
|
||||
dw_gui_ctrl_disp();
|
||||
app::TaskWork_Window();
|
||||
classes_process_imgui(classes, classes_count);
|
||||
lock_unlock(imgui_context_lock);
|
||||
|
||||
if (old_width != width || old_height != height || old_scale_index != scale_index) {
|
||||
render_resize_fb(rctx, true);
|
||||
resolution_struct* res_wind = res_window_get();
|
||||
cam->set_res(internal_3d_res.x, internal_3d_res.y,
|
||||
internal_2d_res.x, internal_2d_res.y);
|
||||
res_wind->width, res_wind->height);
|
||||
}
|
||||
old_width = width;
|
||||
old_height = height;
|
||||
@@ -1001,7 +1020,7 @@ static void render_context_ctrl(render_context* rctx) {
|
||||
game_state_set_game_state_next(GAME_STATE_GAME);
|
||||
else if (Input::IsKeyTapped(GLFW_KEY_F6)) {
|
||||
game_state_set_game_state_next(GAME_STATE_DATA_TEST);
|
||||
game_state_set_sub_game_state_next(SUB_GAME_STATE_DATA_TEST_AUTH_3D);
|
||||
game_state_set_sub_game_state_next(SUB_GAME_STATE_DATA_TEST_AET);
|
||||
}
|
||||
else if (Input::IsKeyTapped(GLFW_KEY_F7))
|
||||
game_state_set_game_state_next(GAME_STATE_TEST_MODE);
|
||||
@@ -1075,12 +1094,12 @@ static void render_context_disp(render_context* rctx) {
|
||||
int32_t screen_x_offset = (width - internal_2d_res.x) / 2 + (width - internal_2d_res.x) % 2;
|
||||
int32_t screen_y_offset = (height - internal_2d_res.y) / 2 + (width - internal_2d_res.x) % 2;
|
||||
glViewport(screen_x_offset, screen_y_offset, internal_2d_res.x, internal_2d_res.y);
|
||||
rctx->post_process.screen_texture.bind();
|
||||
rctx->post_process.fbo_texture.bind();
|
||||
classes_process_disp(classes, classes_count);
|
||||
gl_state_bind_framebuffer(0);
|
||||
|
||||
if (rctx->render_manager.pass_sw[rndr::RND_PASSID_POSTPROCESS])
|
||||
fbo::blit(rctx->post_process.screen_texture.fbos[0], 0,
|
||||
fbo::blit(rctx->post_process.fbo_texture.fbos[0], 0,
|
||||
0, 0, width, height,
|
||||
0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
|
||||
@@ -1111,6 +1130,7 @@ static void render_context_dispose(render_context* rctx) {
|
||||
//pv_game_data.DelTask();
|
||||
Glitter::glt_particle_manager_del_task();
|
||||
task_auth_3d_del_task();
|
||||
aet_manager_del_task();
|
||||
task_pv_db_del_task();
|
||||
|
||||
app::TaskWork::Dest();
|
||||
@@ -1124,17 +1144,24 @@ static void render_context_dispose(render_context* rctx) {
|
||||
sound_work_unload_farc("rom/sound/slide_se.farc");
|
||||
sound_work_unload_farc("rom/sound/slide_long.farc");
|
||||
|
||||
data_struct* aft_data = &data_list[DATA_AFT];
|
||||
aet_database* aft_aet_db = &aft_data->data_ft.aet_db;
|
||||
sprite_database* aft_spr_db = &aft_data->data_ft.spr_db;
|
||||
|
||||
object_storage_unload_set(dbg_set_id);
|
||||
//AetUnloadSet(26);
|
||||
//SprUnloadSet(32);
|
||||
//AetUnloadSet(35);
|
||||
//SprUnloadSet(34);
|
||||
//SprUnloadSet(4);
|
||||
//SprUnloadSet(472);
|
||||
//SprUnloadSet(43);
|
||||
aet_manager_unload_set(26, aft_aet_db);
|
||||
sprite_manager_unload_set(32, aft_spr_db);
|
||||
aet_manager_unload_set(35, aft_aet_db);
|
||||
sprite_manager_unload_set(34, aft_spr_db);
|
||||
sprite_manager_unload_set(4, aft_spr_db);
|
||||
sprite_manager_unload_set(472, aft_spr_db);
|
||||
sprite_manager_unload_set(43, aft_spr_db);
|
||||
|
||||
sprite_manager_remove_spr_sets(aft_spr_db, false);
|
||||
aet_manager_remove_aet_sets(aft_aet_db, false);
|
||||
|
||||
hand_item_handler_data_free();
|
||||
//rob_sleeve_data_free();
|
||||
sprite_manager_free();
|
||||
|
||||
//rob_chara_array_free_chara_id(0);
|
||||
render_timer->reset();
|
||||
@@ -1153,19 +1180,23 @@ static void render_context_dispose(render_context* rctx) {
|
||||
light_param_data_storage::unload();
|
||||
|
||||
task_data_test_glitter_particle_free();
|
||||
dtw_stg_free();
|
||||
dtm_stg_free();
|
||||
dtm_aet_free();
|
||||
auth_3d_test_window_free();
|
||||
|
||||
dw_gui_detail_display_free();
|
||||
|
||||
Glitter::glt_particle_manager_free();
|
||||
task_pv_db_free();
|
||||
task_effect_free();
|
||||
light_param_data_storage_data_free();
|
||||
task_stage_modern_free();
|
||||
dtm_stg_free();
|
||||
task_stage_free();
|
||||
task_auth_3d_free();
|
||||
auth_3d_test_task_free();
|
||||
auth_3d_data_free();
|
||||
sprite_manager_free();
|
||||
aet_manager_free();
|
||||
task_wind_free();
|
||||
rob_free();
|
||||
|
||||
@@ -1295,8 +1326,9 @@ static void render_resize_fb(render_context* rctx, bool change_fb) {
|
||||
if (fb_changed && change_fb) {
|
||||
rctx->post_process.init_fbo(internal_3d_res.x, internal_3d_res.y,
|
||||
internal_2d_res.x, internal_2d_res.y, width, height);
|
||||
rctx->render_manager.resize(internal_2d_res.x, internal_2d_res.y);
|
||||
rctx->render_manager.resize(width, height);
|
||||
rctx->litproj->resize(internal_3d_res.x, internal_3d_res.y);
|
||||
sprite_manager_set_res((double_t)width / (double_t)height, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
*/
|
||||
|
||||
#include "system_startup.hpp"
|
||||
#include "../CRE/auth_2d.hpp"
|
||||
#include "../CRE/mdata_manager.hpp"
|
||||
#include "../CRE/sprite.hpp"
|
||||
#include "game_state.hpp"
|
||||
#include "pv_game.hpp"
|
||||
|
||||
@@ -91,6 +93,12 @@ namespace system_startup_detail {
|
||||
mdata_manager_del_task();
|
||||
return true;
|
||||
}
|
||||
|
||||
void TaskSystemStartup::Disp() {
|
||||
resolution_struct* res_wind = res_window_get();
|
||||
spr::put_sprite_rect({ 0.0f, 0.0f, (float_t)res_wind->width, (float_t)res_wind->height },
|
||||
res_wind->resolution_mode, spr::SPR_PRIO_25, { 0x00, 0x00, 0x00, 0xFF }, 0);
|
||||
}
|
||||
}
|
||||
|
||||
bool task_system_startup_add_task() {
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace system_startup_detail {
|
||||
virtual bool Init() override;
|
||||
virtual bool Ctrl() override;
|
||||
virtual bool Dest() override;
|
||||
virtual void Disp() override;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user