diff --git a/src/ReDIVA/app.cpp b/src/ReDIVA/app.cpp index b5a10ba0..8240a06b 100644 --- a/src/ReDIVA/app.cpp +++ b/src/ReDIVA/app.cpp @@ -858,379 +858,6 @@ static render_context* render_context_load(const wchar_t* config_path) { Glitter::glt_particle_manager->bone_data = aft_bone_data; - if (false) { - char buf[0x200]; - std::vector obj_set_ids; - std::map obj_set_id_name; - for (int32_t i = 800; i <= 831; i++) { - sprintf_s(buf, sizeof(buf), i == 815 ? "EFFPV%03d" : "ITMPV%03d", i); - - const object_set_info* effpv_set_info = aft_obj_db->get_object_set_info(buf); - if (effpv_set_info) { - obj_set_ids.push_back(effpv_set_info->id); - obj_set_id_name.insert({ effpv_set_info->id, buf }); - } - - sprintf_s(buf, sizeof(buf), "STGPV%03d", i); - - const object_set_info* stgpv_set_info = aft_obj_db->get_object_set_info(buf); - if (stgpv_set_info) { - obj_set_ids.push_back(stgpv_set_info->id); - obj_set_id_name.insert({ stgpv_set_info->id, buf }); - } - - sprintf_s(buf, sizeof(buf), "STGPV%03dHRC", i); - - const object_set_info* stgpvhrc_set_info = aft_obj_db->get_object_set_info(buf); - if (stgpvhrc_set_info) { - obj_set_ids.push_back(stgpvhrc_set_info->id); - obj_set_id_name.insert({ stgpvhrc_set_info->id, buf }); - } - - for (uint32_t& i : obj_set_ids) { - const object_set_info* set_info = aft_obj_db->get_object_set_info(i); - if (!set_info) - continue; - - farc f; - if (!aft_data->load_file(&f, "rom/objset/", set_info->archive_file_name.c_str(), farc::load_file)) - continue; - - farc_file* obj_ff = f.read_file(set_info->object_file_name.c_str()); - if (!obj_ff) - continue; - - farc_file* tex_ff = f.read_file(set_info->texture_file_name.c_str()); - if (!tex_ff) - continue; - - prj::shared_ptr alloc(new prj::stack_allocator); - - obj_set obj_set; - obj_set.unpack_file(alloc, obj_ff->data, obj_ff->size, false); - if (!obj_set.ready) - continue; - - txp_set txp_set; - if (!txp_set.unpack_file(tex_ff->data, false)) - continue; - - object_material_msgpack_write("patch\\AFT_orig\\objset", obj_set_id_name[i].c_str(), - i, &obj_set, &txp_set, aft_tex_db); - } - } - } - - if (false) { - const std::string mmp_base_path("R:\\SteamLibrary\\steamapps\\common\\" - "Hatsune Miku Project DIVA Mega Mix Plus\\"); - - const std::pair mmp_paths[] = { - { "diva_main\\rom_steam\\", "" }, - { "diva_main\\rom_ps4_dlc\\", "mdata_" }, - { "mods\\F2nd Song Pack\\", "mod_" }, - { "mods\\X Song Pack\\", "mod_" }, - }; - - const std::string mmp_x_pack_path = mmp_base_path + "mods\\X Song Pack\\rom\\objset\\"; - - object_database obj_db; - for (auto& i : mmp_paths) { - object_database_file obj_db_file; - obj_db_file.read((mmp_base_path + i.first + "rom\\objset\\" + i.second + "obj_db").c_str(), false); - obj_db.add(&obj_db_file); - } - - texture_database tex_db; - for (auto& i : mmp_paths) { - texture_database_file tex_db_file; - tex_db_file.read((mmp_base_path + i.first + "rom\\objset\\" + i.second + "tex_db").c_str(), false); - tex_db.add(&tex_db_file); - } - - char buf[0x200]; - std::vector obj_set_ids; - std::map obj_set_id_name; - for (int32_t i = 800; i <= 831; i++) { - sprintf_s(buf, sizeof(buf), i == 815 ? "EFFPV%03d" : "ITMPV%03d", i); - - const object_set_info* effpv_set_info = obj_db.get_object_set_info(buf); - if (effpv_set_info) { - obj_set_ids.push_back(effpv_set_info->id); - obj_set_id_name.insert({ effpv_set_info->id, buf }); - } - - sprintf_s(buf, sizeof(buf), "STGPV%03d", i); - - const object_set_info* stgpv_set_info = obj_db.get_object_set_info(buf); - if (stgpv_set_info) { - obj_set_ids.push_back(stgpv_set_info->id); - obj_set_id_name.insert({ stgpv_set_info->id, buf }); - } - - sprintf_s(buf, sizeof(buf), "STGPV%03dHRC", i); - - const object_set_info* stgpvhrc_set_info = obj_db.get_object_set_info(buf); - if (stgpvhrc_set_info) { - obj_set_ids.push_back(stgpvhrc_set_info->id); - obj_set_id_name.insert({ stgpvhrc_set_info->id, buf }); - } - - for (uint32_t& i : obj_set_ids) { - const object_set_info* set_info = obj_db.get_object_set_info(i); - if (!set_info) - continue; - - farc f; - if (!farc::load_file(&f, mmp_x_pack_path.c_str(), set_info->archive_file_name.c_str(), hash_murmurhash_empty)) - continue; - - farc_file* obj_ff = f.read_file(set_info->object_file_name.c_str()); - if (!obj_ff) - continue; - - farc_file* tex_ff = f.read_file(set_info->texture_file_name.c_str()); - if (!tex_ff) - continue; - - prj::shared_ptr alloc(new prj::stack_allocator); - - obj_set obj_set; - obj_set.unpack_file(alloc, obj_ff->data, obj_ff->size, false); - if (!obj_set.ready) - continue; - - txp_set txp_set; - if (!txp_set.unpack_file(tex_ff->data, false)) - continue; - - object_material_msgpack_write("patch\\MMp_orig\\objset", obj_set_id_name[i].c_str(), - i, &obj_set, &txp_set, &tex_db); - } - } - } - - if (false) { - data_struct* x_data = &data_list[DATA_X]; - - char buf[0x200]; - std::vector obj_set_ids; - std::map obj_set_id_name; - for (int32_t i = 801; i <= 832; i++) { - uint32_t effpv_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "EFFPV%03d", i)); - if (x_data->check_file_exists("root+/objset", effpv_hash)) { - obj_set_ids.push_back(effpv_hash); - obj_set_id_name.insert({ effpv_hash, buf }); - } - - uint32_t effpvptc_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "EFFPV%03dPTC", i)); - if (x_data->check_file_exists("root+/objset", effpvptc_hash)) { - obj_set_ids.push_back(effpvptc_hash); - obj_set_id_name.insert({ effpvptc_hash, buf }); - } - - uint32_t effstgpvptc_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "EFFSTGPV%03dPTC", i % 100)); - if (x_data->check_file_exists("root+/objset", effstgpvptc_hash)) { - obj_set_ids.push_back(effstgpvptc_hash); - obj_set_id_name.insert({ effstgpvptc_hash, buf }); - } - - uint32_t stgpv_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "STGPV%03d", i % 100)); - if (x_data->check_file_exists("root+/objset", stgpv_hash)) { - obj_set_ids.push_back(stgpv_hash); - obj_set_id_name.insert({ stgpv_hash, buf }); - } - - uint32_t stgpvhrc_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "STGPV%03dHRC", i % 100)); - if (x_data->check_file_exists("root+/objset", stgpvhrc_hash)) { - obj_set_ids.push_back(stgpvhrc_hash); - obj_set_id_name.insert({ stgpvhrc_hash, buf }); - } - - for (uint32_t& i : obj_set_ids) { - farc f; - if (!x_data->load_file(&f, "root+/objset/", i, ".farc", farc::load_file)) - continue; - - std::string& set = obj_set_id_name[i]; - - size_t set_len = set.size(); - if (set_len >= sizeof(buf) - 4) - continue; - - const char* t = strrchr(set.c_str(), '.'); - if (t) - set_len = t - set.c_str(); - - memcpy(buf, set.c_str(), set_len); - char* ext = buf + set_len; - size_t ext_len = sizeof(buf) - set_len; - - memcpy_s(ext, ext_len, ".osd", 5); - farc_file* osd = f.read_file(buf); - if (!osd) - continue; - - memcpy_s(ext, ext_len, ".txd", 5); - farc_file* txd = f.read_file(buf); - if (!txd) - continue; - - memcpy_s(ext, ext_len, ".osi", 5); - farc_file* osi = f.read_file(buf); - if (!osi) - continue; - - memcpy_s(ext, ext_len, ".txi", 5); - farc_file* txi = f.read_file(buf); - if (!txi) - continue; - - prj::shared_ptr alloc(new prj::stack_allocator); - - obj_set obj_set; - obj_set.unpack_file(alloc, osd->data, osd->size, true); - if (!obj_set.ready) - continue; - - txp_set txp_set; - if (!txp_set.unpack_file_modern(txd->data, txd->size, 'MTXD')) - continue; - - object_database_file obj_db_file; - obj_db_file.read(osi->data, osi->size, true); - if (!obj_db_file.ready) - continue; - - texture_database_file tex_db_file; - tex_db_file.read(txi->data, txi->size, true); - if (!tex_db_file.ready) - continue; - - object_database obj_db; - obj_db.add(&obj_db_file); - - texture_database tex_db; - tex_db.add(&tex_db_file); - - object_material_msgpack_write("patch\\X_orig\\objset", obj_set_id_name[i].c_str(), - i, &obj_set, &txp_set, &tex_db); - } - } - } - - if (false) { - data_struct* xhd_data = &data_list[DATA_XHD]; - - char buf[0x200]; - std::vector obj_set_ids; - std::map obj_set_id_name; - for (int32_t i = 801; i <= 832; i++) { - uint32_t effpv_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "EFFPV%03d", i)); - if (xhd_data->check_file_exists("root+/objset", effpv_hash)) { - obj_set_ids.push_back(effpv_hash); - obj_set_id_name.insert({ effpv_hash, buf }); - } - - uint32_t effpvptc_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "EFFPV%03dPTC", i)); - if (xhd_data->check_file_exists("root+/objset", effpvptc_hash)) { - obj_set_ids.push_back(effpvptc_hash); - obj_set_id_name.insert({ effpvptc_hash, buf }); - } - - uint32_t effstgpvptc_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "EFFSTGPV%03dPTC", i % 100)); - if (xhd_data->check_file_exists("root+/objset", effstgpvptc_hash)) { - obj_set_ids.push_back(effstgpvptc_hash); - obj_set_id_name.insert({ effstgpvptc_hash, buf }); - } - - uint32_t stgpv_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "STGPV%03d", i % 100)); - if (xhd_data->check_file_exists("root+/objset", stgpv_hash)) { - obj_set_ids.push_back(stgpv_hash); - obj_set_id_name.insert({ stgpv_hash, buf }); - } - - uint32_t stgpvhrc_hash = hash_murmurhash(buf, sprintf_s(buf, sizeof(buf), "STGPV%03dHRC", i % 100)); - if (xhd_data->check_file_exists("root+/objset", stgpvhrc_hash)) { - obj_set_ids.push_back(stgpvhrc_hash); - obj_set_id_name.insert({ stgpvhrc_hash, buf }); - } - - for (uint32_t& i : obj_set_ids) { - farc f; - if (!xhd_data->load_file(&f, "root+/objset/", i, ".farc", farc::load_file)) - continue; - - std::string& set = obj_set_id_name[i]; - - size_t set_len = set.size(); - if (set_len >= sizeof(buf) - 4) - continue; - - const char* t = strrchr(set.c_str(), '.'); - if (t) - set_len = t - set.c_str(); - - memcpy(buf, set.c_str(), set_len); - char* ext = buf + set_len; - size_t ext_len = sizeof(buf) - set_len; - - memcpy_s(ext, ext_len, ".osd", 5); - farc_file* osd = f.read_file(buf); - if (!osd) - continue; - - memcpy_s(ext, ext_len, ".txd", 5); - farc_file* txd = f.read_file(buf); - if (!txd) - continue; - - memcpy_s(ext, ext_len, ".osi", 5); - farc_file* osi = f.read_file(buf); - if (!osi) - continue; - - memcpy_s(ext, ext_len, ".txi", 5); - farc_file* txi = f.read_file(buf); - if (!txi) - continue; - - prj::shared_ptr alloc(new prj::stack_allocator); - - obj_set obj_set; - obj_set.unpack_file(alloc, osd->data, osd->size, true); - if (!obj_set.ready) - continue; - - txp_set txp_set; - if (!txp_set.unpack_file_modern(txd->data, txd->size, 'MTXD')) - continue; - - object_database_file obj_db_file; - obj_db_file.read(osi->data, osi->size, true); - if (!obj_db_file.ready) - continue; - - texture_database_file tex_db_file; - tex_db_file.read(txi->data, txi->size, true); - if (!tex_db_file.ready) - continue; - - object_database obj_db; - obj_db.add(&obj_db_file); - - texture_database tex_db; - tex_db.add(&tex_db_file); - - object_material_msgpack_write("patch\\XHD_orig\\objset", obj_set_id_name[i].c_str(), - i, &obj_set, &txp_set, &tex_db); - } - - obj_set_ids.clear(); - obj_set_id_name.clear(); - } - } - app_resize_fb(rctx, false); rctx->resize(internal_3d_res.x, internal_3d_res.y,