mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 03:37:47 +00:00
Use physis for reading game/boot versions
This commit is contained in:
parent
440d5670e7
commit
935d5d6593
4 changed files with 18 additions and 45 deletions
|
@ -45,16 +45,17 @@ public:
|
|||
// game
|
||||
int language = 1; // 1 is english, thats all i know
|
||||
QString gamePath, winePath, winePrefixPath;
|
||||
QString bootVersion, wineVersion;
|
||||
int installedMaxExpansion = -1;
|
||||
QVector<QString> gameVersions;
|
||||
QString wineVersion;
|
||||
bool enableWatchdog = false;
|
||||
|
||||
BootData* bootData;
|
||||
GameData* gameData;
|
||||
|
||||
physis_Repositories repositories;
|
||||
const char* bootVersion;
|
||||
|
||||
bool isGameInstalled() const {
|
||||
return !gameVersions.isEmpty();
|
||||
return repositories.repositories_count > 0;
|
||||
}
|
||||
|
||||
bool isWineInstalled() const {
|
||||
|
|
|
@ -85,7 +85,7 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
|
|||
gameArgs.push_back({"DEV.TestSID", auth.SID});
|
||||
gameArgs.push_back({"SYS.Region", QString::number(auth.region)});
|
||||
gameArgs.push_back({"language", QString::number(profile.language)});
|
||||
gameArgs.push_back({"ver", profile.gameVersions[0]});
|
||||
gameArgs.push_back({"ver", profile.repositories.repositories[0].version});
|
||||
|
||||
if(!auth.lobbyhost.isEmpty()) {
|
||||
gameArgs.push_back({"DEV.GMServerHost", auth.frontierHost});
|
||||
|
@ -150,7 +150,7 @@ void LauncherCore::launchGame(const ProfileSettings& profile, const LoginAuth au
|
|||
startInfo["AssetDirectory"] = dataDir + "\\DalamudAssets";
|
||||
startInfo["DefaultPluginDirectory"] = dataDir + "\\devPlugins";
|
||||
startInfo["DelayInitializeMs"] = 0;
|
||||
startInfo["GameVersion"] = profile.gameVersions[0];
|
||||
startInfo["GameVersion"] = profile.repositories.repositories[0].version;
|
||||
startInfo["Language"] = profile.language;
|
||||
startInfo["OptOutMbCollection"] = profile.dalamud.optOutOfMbCollection;
|
||||
|
||||
|
@ -494,37 +494,12 @@ void LauncherCore::readWineInfo(ProfileSettings& profile) {
|
|||
|
||||
void LauncherCore::readGameVersion() {
|
||||
for(auto& profile : profileSettings) {
|
||||
profile->bootVersion = readVersion(profile->gamePath + "/boot/ffxivboot.ver");
|
||||
profile->gameData = physis_gamedata_initialize((profile->gamePath + "/game").toStdString().c_str());
|
||||
profile->bootData = physis_bootdata_initialize((profile->gamePath + "/boot").toStdString().c_str());
|
||||
|
||||
if(QFile::exists(profile->gamePath + QString("/game/ffxivgame.ver"))) {
|
||||
profile->gameVersions.push_back(readVersion(profile->gamePath + QString("/game/ffxivgame.ver")));
|
||||
profile->installedMaxExpansion = 0;
|
||||
}
|
||||
profile->repositories = physis_gamedata_get_repositories(profile->gameData);
|
||||
profile->bootVersion = physis_bootdata_get_version(profile->bootData);
|
||||
|
||||
auto sqpackDirectories = QDir(profile->gamePath + "/game/sqpack/").entryList(QDir::Filter::Dirs | QDir::Filter::NoDotAndDotDot);
|
||||
|
||||
if(QDir().exists(profile->gamePath + "/game/sqpack/"))
|
||||
profile->gameVersions.resize(sqpackDirectories.size());
|
||||
|
||||
for(auto dir : sqpackDirectories) {
|
||||
if(dir.contains("ex")) {
|
||||
int expansion = -1;
|
||||
|
||||
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) {
|
||||
profile->installedMaxExpansion = std::max(profile->installedMaxExpansion, expansion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(profile->installedMaxExpansion >= 0 && !sqpackDirectories.empty())
|
||||
readGameData(*profile);
|
||||
}
|
||||
}
|
||||
|
@ -704,9 +679,6 @@ void LauncherCore::addRegistryKey(const ProfileSettings& settings,
|
|||
}
|
||||
|
||||
void LauncherCore::readGameData(ProfileSettings& profile) {
|
||||
profile.gameData = physis_gamedata_initialize((profile.gamePath + "/game").toStdString().c_str());
|
||||
profile.bootData = physis_bootdata_initialize((profile.gamePath + "/boot").toStdString().c_str());
|
||||
|
||||
EXH* exh = physis_gamedata_read_excel_sheet_header(profile.gameData, "ExVersion");
|
||||
if(exh != nullptr) {
|
||||
physis_EXD exd = physis_gamedata_read_excel_sheet(profile.gameData, "ExVersion", exh, Language::English, 0);
|
||||
|
|
|
@ -161,7 +161,7 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
|
|||
QUrl url;
|
||||
url.setScheme("https");
|
||||
url.setHost("patch-gamever.ffxiv.com");
|
||||
url.setPath(QString("/http/win32/ffxivneo_release_game/%1/%2").arg(info.settings->gameVersions[0], SID));
|
||||
url.setPath(QString("/http/win32/ffxivneo_release_game/%1/%2").arg(info.settings->repositories.repositories[0].version, SID));
|
||||
|
||||
auto request = QNetworkRequest(url);
|
||||
window.setSSL(request);
|
||||
|
@ -169,12 +169,12 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
|
|||
request.setRawHeader("User-Agent", "FFXIV PATCH CLIENT");
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
|
||||
|
||||
QString report = info.settings->bootVersion + "=" + getBootHash(info);
|
||||
QString report = QString("%1=%2").arg(info.settings->bootVersion, getBootHash(info));
|
||||
|
||||
for(int i = 1; i < auth.maxExpansion + 1; i++) {
|
||||
if(i <= info.settings->installedMaxExpansion) {
|
||||
if(i <= info.settings->repositories.repositories_count) {
|
||||
report += QString("\nex%1\t%2")
|
||||
.arg(QString::number(i), info.settings->gameVersions[i]);
|
||||
.arg(QString::number(i), info.settings->repositories.repositories[i].version);
|
||||
} else {
|
||||
report += QString("\nex%1\t2012.01.01.0000.0000").arg(QString::number(i));
|
||||
}
|
||||
|
|
|
@ -204,14 +204,14 @@ void SettingsWindow::reloadControls() {
|
|||
expacString += "Boot";
|
||||
expacString += QString(" (%1)\n").arg(profile.bootVersion);
|
||||
|
||||
for(int i = 0; i < profile.gameVersions.size(); i++) {
|
||||
for(int i = 0; i < profile.repositories.repositories_count; i++) {
|
||||
QString expansionName = "Unknown Expansion";
|
||||
if(i < core.expansionNames.size()) {
|
||||
expansionName = core.expansionNames[i];
|
||||
}
|
||||
|
||||
expacString += expansionName;
|
||||
expacString += QString(" (%1)\n").arg(profile.gameVersions[i]);
|
||||
expacString += QString(" (%1)\n").arg(profile.repositories.repositories[i].version);
|
||||
}
|
||||
|
||||
expansionVersionLabel->setText(expacString);
|
||||
|
|
Loading…
Add table
Reference in a new issue