mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-21 12:17:45 +00:00
Improve game version detection
This is needed for future game patching situations, where you might have a base game version but no actual sqpack directories.
This commit is contained in:
parent
d2186f8593
commit
c74e1bb459
1 changed files with 16 additions and 16 deletions
|
@ -498,27 +498,27 @@ void LauncherCore::readGameVersion() {
|
||||||
for(auto& profile : profileSettings) {
|
for(auto& profile : profileSettings) {
|
||||||
profile->bootVersion = readVersion(profile->gamePath + "/boot/ffxivboot.ver");
|
profile->bootVersion = readVersion(profile->gamePath + "/boot/ffxivboot.ver");
|
||||||
|
|
||||||
|
if(QFile::exists(profile->gamePath + QString("/game/ffxivgame.ver"))) {
|
||||||
|
profile->gameVersions.push_back(readVersion(profile->gamePath + QString("/game/ffxivgame.ver")));
|
||||||
|
profile->installedMaxExpansion = 0;
|
||||||
|
}
|
||||||
|
|
||||||
auto sqpackDirectories = QDir(profile->gamePath + "/game/sqpack/").entryList(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot);
|
auto sqpackDirectories = QDir(profile->gamePath + "/game/sqpack/").entryList(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot);
|
||||||
profile->gameVersions.resize(sqpackDirectories.size() + 1);
|
|
||||||
|
if(QDir().exists(profile->gamePath + "/game/sqpack/"))
|
||||||
|
profile->gameVersions.resize(sqpackDirectories.size());
|
||||||
|
|
||||||
for(auto dir : sqpackDirectories) {
|
for(auto dir : sqpackDirectories) {
|
||||||
if(dir.contains("ex") || dir == "ffxiv") {
|
if(dir.contains("ex")) {
|
||||||
int expansion = -1;
|
int expansion = -1;
|
||||||
|
|
||||||
// we're going to treat ffxiv as ex0
|
QString originalName = dir.remove("ex");
|
||||||
if(dir == "ffxiv") {
|
bool ok = false;
|
||||||
expansion = 0;
|
int convertedInt = originalName.toInt(&ok);
|
||||||
|
if(ok)
|
||||||
|
expansion = convertedInt;
|
||||||
|
|
||||||
profile->gameVersions[0] = readVersion(profile->gamePath + QString("/game/ffxivgame.ver"));
|
profile->gameVersions[convertedInt] = readVersion(QString("%1/game/sqpack/ex%2/ex%2.ver").arg(profile->gamePath, QString::number(expansion)));
|
||||||
} else {
|
|
||||||
QString originalName = dir.remove("ex");
|
|
||||||
bool ok = false;
|
|
||||||
int convertedInt = originalName.toInt(&ok);
|
|
||||||
if(ok)
|
|
||||||
expansion = convertedInt;
|
|
||||||
|
|
||||||
profile->gameVersions[convertedInt] = readVersion(QString("%1/game/sqpack/ex%2/ex%2.ver").arg(profile->gamePath, QString::number(expansion)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(expansion != -1) {
|
if(expansion != -1) {
|
||||||
profile->installedMaxExpansion = std::max(profile->installedMaxExpansion, expansion);
|
profile->installedMaxExpansion = std::max(profile->installedMaxExpansion, expansion);
|
||||||
|
@ -526,7 +526,7 @@ void LauncherCore::readGameVersion() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(profile->installedMaxExpansion >= 0)
|
if(profile->installedMaxExpansion >= 0 && !sqpackDirectories.empty())
|
||||||
readGameData(*profile);
|
readGameData(*profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue