.o2r support (#3955)

This commit is contained in:
briaguya 2024-03-02 20:51:32 -05:00 committed by GitHub
commit ebde648c59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 65 additions and 26 deletions

View file

@ -265,7 +265,10 @@ OTRGlobals::OTRGlobals() {
if (patchesPath.length() > 0 && std::filesystem::exists(patchesPath)) {
if (std::filesystem::is_directory(patchesPath)) {
for (const auto& p : std::filesystem::recursive_directory_iterator(patchesPath, std::filesystem::directory_options::follow_directory_symlink)) {
if (StringHelper::IEquals(p.path().extension().string(), ".otr")) {
if (StringHelper::IEquals(p.path().extension().string(), ".otr") ||
StringHelper::IEquals(p.path().extension().string(), ".mpq") ||
StringHelper::IEquals(p.path().extension().string(), ".o2r") ||
StringHelper::IEquals(p.path().extension().string(), ".zip")) {
patchOTRs.push_back(p.path().generic_string());
}
}
@ -866,7 +869,7 @@ OTRVersion ReadPortVersionFromOTR(std::string otrPath) {
// Use a temporary archive instance to load the otr and read the version file
auto archive = LUS::OtrArchive(otrPath);
if (archive.LoadRaw()) {
if (archive.Open()) {
auto t = archive.LoadFileRaw("portVersion");
if (t != nullptr && t->IsLoaded) {
auto stream = std::make_shared<LUS::MemoryStream>(t->Buffer->data(), t->Buffer->size());
@ -877,7 +880,7 @@ OTRVersion ReadPortVersionFromOTR(std::string otrPath) {
version.minor = reader->ReadUInt16();
version.patch = reader->ReadUInt16();
}
archive.UnloadRaw();
archive.Close();
}
return version;