fix download quests with PVR files

This commit is contained in:
Martin Michelsen
2024-02-07 10:23:37 -08:00
parent ba53f67097
commit 07996444a1
3 changed files with 11 additions and 4 deletions
+9 -3
View File
@@ -356,6 +356,14 @@ string VersionedQuest::dat_filename() const {
}
}
string VersionedQuest::pvr_filename() const {
if (this->episode == Episode::EP3) {
throw logic_error("Episode 3 quests do not have .pvr files");
} else {
return string_printf("quest%" PRIu32 ".pvr", this->quest_number);
}
}
string VersionedQuest::xb_filename() const {
if (this->episode == Episode::EP3) {
throw logic_error("Episode 3 quests do not have Xbox filenames");
@@ -911,9 +919,7 @@ shared_ptr<VersionedQuest> VersionedQuest::create_download_quest(uint8_t overrid
auto dlq = make_shared<VersionedQuest>(*this);
dlq->bin_contents = make_shared<string>(encode_download_quest_data(compressed_bin, decompressed_bin.size()));
dlq->dat_contents = make_shared<string>(encode_download_quest_data(*this->dat_contents));
if (this->pvr_contents) {
dlq->pvr_contents = make_shared<string>(encode_download_quest_data(*this->pvr_contents));
}
dlq->pvr_contents = this->pvr_contents;
dlq->is_dlq_encoded = true;
return dlq;
}
+1
View File
@@ -90,6 +90,7 @@ struct VersionedQuest {
std::string bin_filename() const;
std::string dat_filename() const;
std::string pvr_filename() const;
std::string xb_filename() const;
std::shared_ptr<VersionedQuest> create_download_quest(uint8_t override_language = 0xFF) const;
+1 -1
View File
@@ -2564,7 +2564,7 @@ static void on_10(shared_ptr<Client> c, uint16_t, uint32_t, string& data) {
send_open_quest_file(c, q->name, vq->bin_filename(), xb_filename, vq->quest_number, type, vq->bin_contents);
send_open_quest_file(c, q->name, vq->dat_filename(), xb_filename, vq->quest_number, type, vq->dat_contents);
if (vq->pvr_contents) {
send_open_quest_file(c, q->name, vq->dat_filename(), xb_filename, vq->quest_number, type, vq->pvr_contents);
send_open_quest_file(c, q->name, vq->pvr_filename(), xb_filename, vq->quest_number, type, vq->pvr_contents);
}
}
}