Merge upstream master

# Conflicts:
#	README.md
This commit is contained in:
2026-06-11 18:31:23 -04:00
73 changed files with 12419 additions and 1305 deletions
+52 -47
View File
@@ -490,15 +490,19 @@ std::shared_ptr<const ItemParameterTable> ServerState::item_parameter_table_for_
return this->item_parameter_table(is_v1(version) ? Version::PC_V2 : version);
}
std::shared_ptr<const MagEvolutionTable> ServerState::mag_evolution_table(Version version) const {
if (is_v1(version)) {
return this->mag_evolution_table_v1;
std::shared_ptr<const MagMetadataTable> ServerState::mag_metadata_table(Version version) const {
if (version == Version::DC_NTE) {
return this->mag_metadata_table_dc_nte;
} else if (version == Version::DC_11_2000) {
return this->mag_metadata_table_dc_11_2000;
} else if (is_v1(version)) {
return this->mag_metadata_table_v1;
} else if (is_v2(version)) {
return this->mag_evolution_table_v2;
return this->mag_metadata_table_v2;
} else if (!is_v4(version)) {
return this->mag_evolution_table_v3;
return this->mag_metadata_table_v3;
} else {
return this->mag_evolution_table_v4;
return this->mag_metadata_table_v4;
}
}
@@ -2136,28 +2140,28 @@ void ServerState::load_drop_tables() {
}
config_log.info_f("Loading armor table");
auto armor_data = std::make_shared<std::string>(phosg::load_file("system/tables/ArmorRandom-gc-v3.rel"));
auto new_armor_random_set = std::make_shared<ArmorRandomSet>(armor_data);
auto armor_json = phosg::JSON::parse(phosg::load_file("system/tables/armor-shop-random-set.json"));
auto new_armor_random_set = std::make_shared<ArmorShopRandomSet>(armor_json);
config_log.info_f("Loading tool table");
auto tool_data = std::make_shared<std::string>(phosg::load_file("system/tables/ToolRandom-gc-v3.rel"));
auto new_tool_random_set = std::make_shared<ToolRandomSet>(tool_data);
auto tool_json = phosg::JSON::parse(phosg::load_file("system/tables/tool-shop-random-set.json"));
auto new_tool_random_set = std::make_shared<ToolShopRandomSet>(tool_json);
config_log.info_f("Loading weapon tables");
std::array<std::shared_ptr<const WeaponRandomSet>, 4> new_weapon_random_sets;
std::array<std::shared_ptr<const WeaponShopRandomSet>, 4> new_weapon_random_sets;
const char* filenames[4] = {
"system/tables/WeaponRandomNormal-gc-v3.rel",
"system/tables/WeaponRandomHard-gc-v3.rel",
"system/tables/WeaponRandomVeryHard-gc-v3.rel",
"system/tables/WeaponRandomUltimate-gc-v3.rel",
"system/tables/weapon-shop-random-set-normal.json",
"system/tables/weapon-shop-random-set-hard.json",
"system/tables/weapon-shop-random-set-very-hard.json",
"system/tables/weapon-shop-random-set-ultimate.json",
};
for (size_t z = 0; z < 4; z++) {
auto weapon_data = std::make_shared<std::string>(phosg::load_file(filenames[z]));
new_weapon_random_sets[z] = std::make_shared<WeaponRandomSet>(weapon_data);
new_weapon_random_sets[z] = std::make_shared<WeaponShopRandomSet>(
phosg::JSON::parse(phosg::load_file(filenames[z])));
}
config_log.info_f("Loading tekker adjustment table");
auto tekker_data = std::make_shared<std::string>(phosg::load_file("system/tables/JudgeItem-gc-v3.rel"));
config_log.info_f("Loading tekker adjustment set");
auto tekker_data = phosg::JSON::parse(phosg::load_file("system/tables/tekker-adjustment-set.json"));
auto new_tekker_adjustment_set = std::make_shared<TekkerAdjustmentSet>(tekker_data);
this->rare_item_sets = std::move(new_rare_item_sets);
@@ -2188,25 +2192,32 @@ void ServerState::load_item_definitions() {
auto json = phosg::JSON::parse(phosg::load_file("system/tables/translation-table.json"));
auto new_item_translation_table = std::make_shared<ItemTranslationTable>(json, new_item_parameter_tables);
config_log.info_f("Loading v1 mag evolution table");
auto mag_data_v1 = std::make_shared<std::string>(prs_decompress(phosg::load_file("system/tables/ItemMagEdit-dc-v1.prs")));
auto new_table_v1 = MagEvolutionTable::create(mag_data_v1, Version::DC_V1);
config_log.info_f("Loading v2 mag evolution table");
auto mag_data_v2 = std::make_shared<std::string>(prs_decompress(phosg::load_file("system/tables/ItemMagEdit-dc-v2.prs")));
auto new_table_v2 = MagEvolutionTable::create(mag_data_v2, Version::DC_V2);
config_log.info_f("Loading v3 mag evolution table");
auto mag_data_v3 = std::make_shared<std::string>(prs_decompress(phosg::load_file("system/tables/ItemMagEdit-xb-v3.prs")));
auto new_table_v3 = MagEvolutionTable::create(mag_data_v3, Version::XB_V3);
config_log.info_f("Loading v4 mag evolution table");
auto mag_data_v4 = std::make_shared<std::string>(prs_decompress(phosg::load_file("system/tables/ItemMagEdit-bb-v4.prs")));
auto new_table_v4 = MagEvolutionTable::create(mag_data_v4, Version::BB_V4);
config_log.info_f("Creating DC NTE mag metadata table");
auto new_table_dc_nte = MagMetadataTable::from_binary(nullptr, Version::DC_NTE);
config_log.info_f("Loading DC 11/2000 mag metadata table");
auto new_table_11_2000 = MagMetadataTable::from_json(phosg::JSON::parse(phosg::load_file(
"system/tables/mag-metadata-table-dc-11-2000.json")));
config_log.info_f("Loading v1 mag metadata table");
auto new_table_v1 = MagMetadataTable::from_json(phosg::JSON::parse(phosg::load_file(
"system/tables/mag-metadata-table-v1.json")));
config_log.info_f("Loading v2 mag metadata table");
auto new_table_v2 = MagMetadataTable::from_json(phosg::JSON::parse(phosg::load_file(
"system/tables/mag-metadata-table-v2.json")));
config_log.info_f("Loading v3 mag metadata table");
auto new_table_v3 = MagMetadataTable::from_json(phosg::JSON::parse(phosg::load_file(
"system/tables/mag-metadata-table-v3.json")));
config_log.info_f("Loading v4 mag metadata table");
auto new_table_v4 = MagMetadataTable::from_json(phosg::JSON::parse(phosg::load_file(
"system/tables/mag-metadata-table-v4.json")));
this->item_parameter_tables = std::move(new_item_parameter_tables);
this->item_translation_table = std::move(new_item_translation_table);
this->mag_evolution_table_v1 = std::move(new_table_v1);
this->mag_evolution_table_v2 = std::move(new_table_v2);
this->mag_evolution_table_v3 = std::move(new_table_v3);
this->mag_evolution_table_v4 = std::move(new_table_v4);
this->mag_metadata_table_dc_nte = std::move(new_table_dc_nte);
this->mag_metadata_table_dc_11_2000 = std::move(new_table_11_2000);
this->mag_metadata_table_v1 = std::move(new_table_v1);
this->mag_metadata_table_v2 = std::move(new_table_v2);
this->mag_metadata_table_v3 = std::move(new_table_v3);
this->mag_metadata_table_v4 = std::move(new_table_v4);
}
void ServerState::load_ep3_cards() {
@@ -2262,20 +2273,13 @@ void ServerState::generate_bb_stream_file() {
config_log.info_f("Generating BB stream file");
auto sf = std::make_shared<BBStreamFile>();
auto add_file = [&](const std::string& filename, const void* data = nullptr, size_t size = 0) -> void {
auto add_file = [&](const std::string& filename, const void* data, size_t size) -> void {
auto& e = sf->entries.emplace_back();
e.offset = sf->data.size();
e.filename = filename;
if (!data) {
std::string file_data = phosg::load_file("system/blueburst/" + filename);
e.size = file_data.size();
e.checksum = phosg::crc32(file_data.data(), file_data.size());
sf->data += file_data;
} else {
e.size = size;
e.checksum = phosg::crc32(data, size);
sf->data.append(reinterpret_cast<const char*>(data), size);
}
e.size = size;
e.checksum = phosg::crc32(data, size);
sf->data.append(reinterpret_cast<const char*>(data), size);
config_log.debug_f(
"[BBStreamFile] Added file {} at offset {:08X} ({:08X} bytes) with checksum {:08X}; total size is now {:08X}",
filename, e.offset, e.size, e.checksum, sf->data.size());
@@ -2283,6 +2287,7 @@ void ServerState::generate_bb_stream_file() {
auto level_table_data = prs_compress_optimal(this->level_table_v4->serialize_binary_v4());
auto pmt_data = prs_compress_optimal(this->item_parameter_table(Version::BB_V4)->serialize_binary(Version::BB_V4));
auto mag_data = prs_compress_optimal(this->mag_metadata_table(Version::BB_V4)->serialize_binary(Version::BB_V4));
const auto& bps = *this->battle_params;
add_file("BattleParamEntry.dat", &bps.get_table(true, Episode::EP1), sizeof(BattleParamsIndex::Table));
@@ -2292,7 +2297,7 @@ void ServerState::generate_bb_stream_file() {
add_file("BattleParamEntry_lab_on.dat", &bps.get_table(false, Episode::EP2), sizeof(BattleParamsIndex::Table));
add_file("BattleParamEntry_ep4_on.dat", &bps.get_table(false, Episode::EP4), sizeof(BattleParamsIndex::Table));
add_file("PlyLevelTbl.prs", level_table_data.data(), level_table_data.size());
add_file("ItemMagEdit.prs");
add_file("ItemMagEdit.prs", mag_data.data(), mag_data.size());
add_file("ItemPMT.prs", pmt_data.data(), pmt_data.size());
this->bb_stream_file = sf;