diff --git a/src/CRE/Glitter/render_scene.cpp b/src/CRE/Glitter/render_scene.cpp index 2e52fe22..a9e41e75 100644 --- a/src/CRE/Glitter/render_scene.cpp +++ b/src/CRE/Glitter/render_scene.cpp @@ -1579,7 +1579,6 @@ namespace Glitter { mat4_rotate_zyx_mult(&mat, &rot, &mat); mat4_scale_rot(&mat, &scale, &mat); - vec3 uv_scroll; vec3 uv_scroll_2nd; uv_scroll.x = elem->uv_scroll.x; diff --git a/src/CRE/ogg_vorbis.cpp b/src/CRE/ogg_vorbis.cpp index 36fec42f..520ad017 100644 --- a/src/CRE/ogg_vorbis.cpp +++ b/src/CRE/ogg_vorbis.cpp @@ -633,7 +633,6 @@ void OggFileHandler::ThreadMain(OggFileHandler* ofh) { ofh->thread_state.set(0); } - p_OggFileHandler::p_OggFileHandler(OggFileHandler* ptr) { this->ptr = ptr; } diff --git a/src/CRE/post_process/tone_map.cpp b/src/CRE/post_process/tone_map.cpp index 39663b3d..2d6a4d41 100644 --- a/src/CRE/post_process/tone_map.cpp +++ b/src/CRE/post_process/tone_map.cpp @@ -307,7 +307,6 @@ float_t post_process_tone_map::get_lens_flare_power() { return data.lens_flare_power; } - void post_process_tone_map::set_lens_flare_power(float_t value) { if (value != data.lens_flare_power) { data.lens_flare_power = value; diff --git a/src/CRE/pv_expression.cpp b/src/CRE/pv_expression.cpp index 938b6314..7fe16452 100644 --- a/src/CRE/pv_expression.cpp +++ b/src/CRE/pv_expression.cpp @@ -118,7 +118,6 @@ bool pv_expression_array_set_motion(uint32_t hash, size_t chara_id, int32_t moti return false; } - bool pv_expression_file_check_not_ready(const char* file) { uint32_t hash = hash_utf8_murmurhash(file); for (pv_expression_file*& i : pv_expression_file_storage) @@ -195,12 +194,12 @@ void pv_expression_file_unload(const char* file) { i->file_handler.reset(); i->alloc_handler.reset(); - } - delete i; + delete i; - pv_expression_file_storage.erase(pv_expression_file_storage.begin() - + (&i - pv_expression_file_storage.data())); - return; + pv_expression_file_storage.erase(pv_expression_file_storage.begin() + + (&i - pv_expression_file_storage.data())); + } + break; } } @@ -219,11 +218,12 @@ void pv_expression_file_unload(uint32_t hash) { i->file_handler.reset(); i->alloc_handler.reset(); - } + delete i; - pv_expression_file_storage.erase(pv_expression_file_storage.begin() - + (&i - pv_expression_file_storage.data())); - return; + pv_expression_file_storage.erase(pv_expression_file_storage.begin() + + (&i - pv_expression_file_storage.data())); + } + break; } } diff --git a/src/CRE/render_context.cpp b/src/CRE/render_context.cpp index 89cc35fd..c68026b1 100644 --- a/src/CRE/render_context.cpp +++ b/src/CRE/render_context.cpp @@ -463,7 +463,6 @@ namespace mdl { break; } - if (!vertex_array) for (DispManager::vertex_array& i : vertex_array_cache) if (i.alive_time <= 0) { diff --git a/src/CRE/rob/ex_block.cpp b/src/CRE/rob/ex_block.cpp index 9e520c79..dfae20d1 100644 --- a/src/CRE/rob/ex_block.cpp +++ b/src/CRE/rob/ex_block.cpp @@ -930,7 +930,6 @@ void RobCloth::ApplyResetData() { reset_data_list = 0; } - RobClothRoot* root = this->root.data(); for (size_t i = 0; i < root_count; i++, root++) { CLOTHNode* node = &nodes.data()[i + root_count]; diff --git a/src/CRE/rob/rob.cpp b/src/CRE/rob/rob.cpp index 850b1034..6438cffd 100644 --- a/src/CRE/rob/rob.cpp +++ b/src/CRE/rob/rob.cpp @@ -15831,7 +15831,6 @@ void OpdMaker::Ctrl() { v22 = sprintf_s_string(&v60, "%s/%d", v62.c_str(), chara_id); v62 = v60; - std::vector v64; if (!sub_1400AC0B0(&v62, &v64)) { for (std::string& i : v64) { @@ -16088,7 +16087,6 @@ static void sub_140479AA0(OpdMaker::Data* a1, rob_chara* rob_chr, std::vector= 'A' && *j <= 'Z') *j += 0x20; - for (char* j = buf2; *j; j++) if (*j >= 'A' && *j <= 'Z') *j += 0x20; @@ -17170,11 +17168,17 @@ rob_sleeve_handler::rob_sleeve_handler() : ready() { } rob_sleeve_handler::~rob_sleeve_handler() { - + clear(); } void rob_sleeve_handler::clear() { ready = false; + + for (auto& i : sleeves) { + delete i.second.l; + delete i.second.r; + } + sleeves.clear(); for (p_file_handler*& i : file_handlers) @@ -17367,7 +17371,6 @@ motion_index(), pv(), thread(), disp(), not_reset(), exit(), field_D4() { exit = false; } - thread = new std::thread(PvOsageManager::ThreadMain, this); if (thread) { wchar_t buf[0x80]; diff --git a/src/CRE/sound.cpp b/src/CRE/sound.cpp index e4960be5..9cfd7974 100644 --- a/src/CRE/sound.cpp +++ b/src/CRE/sound.cpp @@ -850,7 +850,6 @@ bool sound_db_farc::load() { else if (file_handler.check_not_ready()) return true; - farc.read(file_handler.get_data(), file_handler.get_size()); if (farc.files.size() && sound_work->ParseProperty(this)) ready = true; diff --git a/src/CRE/sprite.cpp b/src/CRE/sprite.cpp index 0f678bf4..7108c909 100644 --- a/src/CRE/sprite.cpp +++ b/src/CRE/sprite.cpp @@ -755,7 +755,6 @@ namespace spr { else gl_state_disable_blend(); - if (j.shader == SHADER_FT_SPRITE) { uniform_value[U_TEX_0_TYPE] = j.tex_0_type; uniform_value[U_TEX_1_TYPE] = j.tex_1_type; diff --git a/src/CRE/task_effect.cpp b/src/CRE/task_effect.cpp index 9eb99040..ff96493e 100644 --- a/src/CRE/task_effect.cpp +++ b/src/CRE/task_effect.cpp @@ -815,7 +815,6 @@ void TaskEffectFogRing::Data::CalcPtcl(float_t delta_time) { v17 = min_def(v17, 1.0f); } - ptcl_data->density = v17; } } diff --git a/src/CRE/task_effect.hpp b/src/CRE/task_effect.hpp index 2fdd412e..a83ef942 100644 --- a/src/CRE/task_effect.hpp +++ b/src/CRE/task_effect.hpp @@ -205,7 +205,6 @@ struct struc_573 { struc_573(); }; - struct TaskEffectFogRing : public TaskEffect { public: struct Data { diff --git a/src/DivaGL/bone_data.hpp b/src/DivaGL/bone_data.hpp index 08a9e756..8444ce21 100644 --- a/src/DivaGL/bone_data.hpp +++ b/src/DivaGL/bone_data.hpp @@ -3051,7 +3051,6 @@ struct obj_skin_block_cloth_root { obj_skin_block_cloth_root_bone_weight field_28[4]; }; - struct obj_skin_block_cloth_node { uint32_t flags; vec3 trans; diff --git a/src/KKdLib/aes.hpp b/src/KKdLib/aes.hpp index 1c3e0c85..73fbefc9 100644 --- a/src/KKdLib/aes.hpp +++ b/src/KKdLib/aes.hpp @@ -70,7 +70,6 @@ void aes128_ecb_decrypt_buffer(aes128_ctx* ctx, uint8_t* buf, size_t length); void aes192_ecb_decrypt_buffer(aes192_ctx* ctx, uint8_t* buf, size_t length); void aes256_ecb_decrypt_buffer(aes256_ctx* ctx, uint8_t* buf, size_t length); - void aes128_cbc_encrypt(aes128_ctx* ctx, uint8_t buf[AES_BLOCKLEN]); void aes192_cbc_encrypt(aes192_ctx* ctx, uint8_t buf[AES_BLOCKLEN]); void aes256_cbc_encrypt(aes256_ctx* ctx, uint8_t buf[AES_BLOCKLEN]); @@ -84,7 +83,6 @@ void aes128_cbc_decrypt_buffer(aes128_ctx* ctx, uint8_t* buf, size_t length); void aes192_cbc_decrypt_buffer(aes192_ctx* ctx, uint8_t* buf, size_t length); void aes256_cbc_decrypt_buffer(aes256_ctx* ctx, uint8_t* buf, size_t length); - void aes128_ctr_xcrypt_buffer(aes128_ctx* ctx, uint8_t* buf, uint32_t length); void aes192_ctr_xcrypt_buffer(aes192_ctx* ctx, uint8_t* buf, uint32_t length); void aes256_ctr_xcrypt_buffer(aes256_ctx* ctx, uint8_t* buf, uint32_t length); diff --git a/src/KKdLib/f2/struct.cpp b/src/KKdLib/f2/struct.cpp index 0c1b4be5..47275973 100644 --- a/src/KKdLib/f2/struct.cpp +++ b/src/KKdLib/f2/struct.cpp @@ -123,7 +123,6 @@ void f2_struct::write(stream& s, bool use_depth, bool shift_x) { if (s.check_null()) return; - f2_struct_get_length(this, shift_x); f2_struct_write_inner(s, this, 0, use_depth, shift_x); diff --git a/src/KKdLib/mot.cpp b/src/KKdLib/mot.cpp index 8dcdb045..77d9e214 100644 --- a/src/KKdLib/mot.cpp +++ b/src/KKdLib/mot.cpp @@ -317,7 +317,6 @@ mot_key_set_type mot_set::fit_keys_into_curve(std::vector& values_src, mot_set_add_key((uint16_t)(count - 1), arr[count - 1], t2_old, frames, values); mot_set_add_key((uint16_t)(count - 1), arr[count - 1], 0.0f, frames, values); - count = frames.size(); arr = values.data(); for (size_t i = count; i; i--, arr += 2) diff --git a/src/KKdLib/post_process_table/dof.cpp b/src/KKdLib/post_process_table/dof.cpp index 79cab222..e648b177 100644 --- a/src/KKdLib/post_process_table/dof.cpp +++ b/src/KKdLib/post_process_table/dof.cpp @@ -62,7 +62,6 @@ void dof::read(const void* data, size_t size) { if (!data || !size) return; - f2_struct st; st.read(data, size); if (st.header.signature == reverse_endianness_uint32_t('DOFT')) { diff --git a/src/MMPlusDec/MMPlusDec.cpp b/src/MMPlusDec/MMPlusDec.cpp index 42e48102..1584c6d0 100644 --- a/src/MMPlusDec/MMPlusDec.cpp +++ b/src/MMPlusDec/MMPlusDec.cpp @@ -77,7 +77,6 @@ int32_t wmain(int32_t argc, wchar_t** argv) { std::wstring infile = indir + i; std::wstring outfile = outdir + i; - file_stream in_file; file_stream out_file; in_file.open(infile.c_str(), L"rb"); diff --git a/src/ReDIVA/data_test/auth_3d_test.cpp b/src/ReDIVA/data_test/auth_3d_test.cpp index caa529e9..93e5b2c3 100644 --- a/src/ReDIVA/data_test/auth_3d_test.cpp +++ b/src/ReDIVA/data_test/auth_3d_test.cpp @@ -347,7 +347,6 @@ Auth3dTestWindow::Auth3dTestWindow() { auth_3d_index = cat->index; } - stage.reserve(aft_stage_data->stage_data.size()); for (stage_data& i : aft_stage_data->stage_data) stage.push_back(i.name.c_str()); diff --git a/src/ReDIVA/dw.hpp b/src/ReDIVA/dw.hpp index 5561bb07..9dd3e027 100644 --- a/src/ReDIVA/dw.hpp +++ b/src/ReDIVA/dw.hpp @@ -32,7 +32,6 @@ namespace dw { public: typedef void(*Callback)(Widget* data); - bool free; union { diff --git a/src/ReDIVA/game_state.cpp b/src/ReDIVA/game_state.cpp index 090ec798..48a93552 100644 --- a/src/ReDIVA/game_state.cpp +++ b/src/ReDIVA/game_state.cpp @@ -1768,7 +1768,6 @@ static void game_state_set_state(GameStateEnum state, SubGameStateEnum sub_state } } - static GameStateData* game_state_data_array_get(GameStateEnum state) { for (GameStateData& i : game_state_data_array) if (i.game_state == state) diff --git a/src/ReDIVA/pv_game.cpp b/src/ReDIVA/pv_game.cpp index c5143fc4..b12a61a3 100644 --- a/src/ReDIVA/pv_game.cpp +++ b/src/ReDIVA/pv_game.cpp @@ -744,7 +744,6 @@ void pv_game_music::file_load(int32_t type, std::string& file_path, bool play_on } } - int32_t pv_game_music::get_master_volume(int32_t index) { if (index) return 0; diff --git a/src/ReDIVA/x_pv_game.cpp b/src/ReDIVA/x_pv_game.cpp index 78b7be26..531bb86a 100644 --- a/src/ReDIVA/x_pv_game.cpp +++ b/src/ReDIVA/x_pv_game.cpp @@ -2971,7 +2971,6 @@ void x_pv_game_stage_effect::reset() { set = false; } - x_pv_game_stage_data::x_pv_game_stage_data() : flags(), state(), frame_rate_control() { reset(); } @@ -5752,7 +5751,6 @@ void x_pv_game::ctrl(float_t curr_time, float_t delta_time) { pv_data->unload_if_state_is_0(); } - if (pv_index) { pv_index = 0; if (!pv_data->state) @@ -8088,7 +8086,6 @@ static void x_pv_game_split_auth_3d_hrc_material_list(x_pv_game* xpvgm, dst_submesh->axis_aligned_bounding_box.center = center; dst_submesh->axis_aligned_bounding_box.size = aabb_max_submesh - center; - dst_submesh->first_index = 0; dst_submesh->last_index = 0; dst_submesh->index_offset = 0; @@ -8467,11 +8464,11 @@ static void x_pv_game_split_auth_3d_hrc_material_list(x_pv_game* xpvgm, } } -static int32_t x_pv_game_split_auth_3d_material_list(auth_3d_material_list& ml, float_t play_control_size, - std::vector>& color, vec4u8& has_color, std::vector& morph, bool fast = false) { - size_t count = (size_t)(int32_t)play_control_size; +typedef std::pair material_list_color; - typedef std::pair vec4_pair; +static int32_t x_pv_game_split_auth_3d_material_list(auth_3d_material_list& ml, float_t play_control_size, + std::vector& color, vec4u8& has_color, std::vector& morph, bool fast = false) { + size_t count = (size_t)(int32_t)play_control_size; has_color.x = (ml.blend_color.flags & AUTH_3D_RGBA_R) || (ml.emission.flags & AUTH_3D_RGBA_R); has_color.y = (ml.blend_color.flags & AUTH_3D_RGBA_G) || (ml.emission.flags & AUTH_3D_RGBA_G); @@ -8500,8 +8497,8 @@ static int32_t x_pv_game_split_auth_3d_material_list(auth_3d_material_list& ml, = (has_data[0] ? 1 : 0) + (has_data[1] ? 1 : 0) + (has_data[2] ? 1 : 0) + (has_data[3] ? 1 : 0) + (has_data[4] ? 1 : 0) + (has_data[5] ? 1 : 0) + (has_data[6] ? 1 : 0) + (has_data[7] ? 1 : 0); - std::vector values(count); - vec4_pair* values_src = values.data(); + std::vector values(count); + material_list_color* values_src = values.data(); for (size_t i = 0; i < count; i++) { ml.blend_color.interpolate((float_t)(int32_t)i); @@ -8511,13 +8508,13 @@ static int32_t x_pv_game_split_auth_3d_material_list(auth_3d_material_list& ml, } { - vec4_pair val = *(vec4_pair*)&values_src[0]; - vec4_pair* arr = (vec4_pair*)&values_src[1]; + material_list_color val = *(material_list_color*)&values_src[0]; + material_list_color* arr = (material_list_color*)&values_src[1]; for (size_t i = count - 1; i; i--) if (val != *arr++) break; - if (arr == (vec4_pair*)(values_src + count)) { + if (arr == (material_list_color*)(values_src + count)) { if (values_src[0].first != 0.0f || values_src[0].second != 0.0f) { morph.push_back({ 0, (float_t)(int32_t)color.size() }); color.push_back(values_src[0]); @@ -8528,15 +8525,14 @@ static int32_t x_pv_game_split_auth_3d_material_list(auth_3d_material_list& ml, } } - float_t* arr = force_malloc_s(float_t, count); - vec4_pair* val = values_src; + material_list_color* val = values_src; const float_t reverse_bias = 0.0001f; const int32_t reverse_min_count = 4; float_t* a = arr; - vec4_pair* v = val; + material_list_color* v = val; size_t left_count = count; int32_t frame = 0; int32_t prev_frame = 0; @@ -8571,7 +8567,7 @@ static int32_t x_pv_game_split_auth_3d_material_list(auth_3d_material_list& ml, for (i = reverse_min_count - 1, i_prev = i; i < left_count; i++) { bool constant = true; for (size_t j = 1; j <= i; j++) - if (memcmp(&v[0], &v[j], sizeof(vec4_pair))) { + if (memcmp(&v[0], &v[j], sizeof(material_list_color))) { constant = false; break; } @@ -8583,8 +8579,8 @@ static int32_t x_pv_game_split_auth_3d_material_list(auth_3d_material_list& ml, float_t end[8]; float_t _t1[8]; float_t _t2[8]; - *(vec4_pair*)start = v[0]; - *(vec4_pair*)end = v[i]; + *(material_list_color*)start = v[0]; + *(material_list_color*)end = v[i]; for (size_t o = 0; o < 8; o++) { if (!has_data[o]) continue; @@ -8755,7 +8751,7 @@ static int32_t x_pv_game_split_auth_3d_material_list(auth_3d_material_list& ml, auto i_end = color.end() - 1; for (auto i = i_begin; i != i_end;) - if (!memcmp(&i[0], &i[1], sizeof(vec4_pair))) { + if (!memcmp(&i[0], &i[1], sizeof(material_list_color))) { for (size_t k = i - i_begin + 1; k < length; k++) keys[k].value -= 1.0f; i = color.erase(i); @@ -8826,32 +8822,35 @@ static void x_pv_game_split_auth_3d_material_list(x_pv_game* xpvgm, printf_debug("%s\n", auth->file_name.c_str()); - for (auth_3d_material_list& j : auth->material_list) - if (j.flags & (AUTH_3D_MATERIAL_LIST_BLEND_COLOR | AUTH_3D_MATERIAL_LIST_EMISSION)) { - std::vector> color; - vec4u8 has_color; - std::vector morph; - int32_t type = x_pv_game_split_auth_3d_material_list(j, - auth->play_control.size, color, has_color, morph); - printf_debug("%d %s %llu\n", type, j.name.c_str(), color.size()); - } - } + for (auth_3d_material_list& j : auth->material_list) { + if (!(j.flags & (AUTH_3D_MATERIAL_LIST_BLEND_COLOR | AUTH_3D_MATERIAL_LIST_EMISSION))) + continue; + std::vector color; + vec4u8 has_color; + std::vector morph; + int32_t type = x_pv_game_split_auth_3d_material_list(j, + auth->play_control.size, color, has_color, morph); + printf_debug("%d %s %llu\n", type, j.name.c_str(), color.size()); + } + } for (auth_3d_id& i : stage_data_change_effect_auth_3ds) { auth_3d* auth = i.get_auth_3d(); printf_debug("%s\n", auth->file_name.c_str()); - for (auth_3d_material_list& j : auth->material_list) - if (j.flags & (AUTH_3D_MATERIAL_LIST_BLEND_COLOR | AUTH_3D_MATERIAL_LIST_EMISSION)) { - std::vector> color; - vec4u8 has_color; - std::vector morph; - int32_t type = x_pv_game_split_auth_3d_material_list(j, - auth->play_control.size, color, has_color, morph); - printf_debug("%d %s %llu\n", type, j.name.c_str(), color.size()); - } + for (auth_3d_material_list& j : auth->material_list) { + if (!(j.flags & (AUTH_3D_MATERIAL_LIST_BLEND_COLOR | AUTH_3D_MATERIAL_LIST_EMISSION))) + continue; + + std::vector color; + vec4u8 has_color; + std::vector morph; + int32_t type = x_pv_game_split_auth_3d_material_list(j, + auth->play_control.size, color, has_color, morph); + printf_debug("%d %s %llu\n", type, j.name.c_str(), color.size()); + } } } diff --git a/src/ReDIVA/x_pv_game.hpp b/src/ReDIVA/x_pv_game.hpp index 49182f35..28f1186d 100644 --- a/src/ReDIVA/x_pv_game.hpp +++ b/src/ReDIVA/x_pv_game.hpp @@ -96,7 +96,6 @@ public: void Reset(); }; - class XPVFrameRateControl : public FrameRateControl { public: XPVFrameRateControl();