mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +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
|
// game
|
||||||
int language = 1; // 1 is english, thats all i know
|
int language = 1; // 1 is english, thats all i know
|
||||||
QString gamePath, winePath, winePrefixPath;
|
QString gamePath, winePath, winePrefixPath;
|
||||||
QString bootVersion, wineVersion;
|
QString wineVersion;
|
||||||
int installedMaxExpansion = -1;
|
|
||||||
QVector<QString> gameVersions;
|
|
||||||
bool enableWatchdog = false;
|
bool enableWatchdog = false;
|
||||||
|
|
||||||
BootData* bootData;
|
BootData* bootData;
|
||||||
GameData* gameData;
|
GameData* gameData;
|
||||||
|
|
||||||
|
physis_Repositories repositories;
|
||||||
|
const char* bootVersion;
|
||||||
|
|
||||||
bool isGameInstalled() const {
|
bool isGameInstalled() const {
|
||||||
return !gameVersions.isEmpty();
|
return repositories.repositories_count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isWineInstalled() const {
|
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({"DEV.TestSID", auth.SID});
|
||||||
gameArgs.push_back({"SYS.Region", QString::number(auth.region)});
|
gameArgs.push_back({"SYS.Region", QString::number(auth.region)});
|
||||||
gameArgs.push_back({"language", QString::number(profile.language)});
|
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()) {
|
if(!auth.lobbyhost.isEmpty()) {
|
||||||
gameArgs.push_back({"DEV.GMServerHost", auth.frontierHost});
|
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["AssetDirectory"] = dataDir + "\\DalamudAssets";
|
||||||
startInfo["DefaultPluginDirectory"] = dataDir + "\\devPlugins";
|
startInfo["DefaultPluginDirectory"] = dataDir + "\\devPlugins";
|
||||||
startInfo["DelayInitializeMs"] = 0;
|
startInfo["DelayInitializeMs"] = 0;
|
||||||
startInfo["GameVersion"] = profile.gameVersions[0];
|
startInfo["GameVersion"] = profile.repositories.repositories[0].version;
|
||||||
startInfo["Language"] = profile.language;
|
startInfo["Language"] = profile.language;
|
||||||
startInfo["OptOutMbCollection"] = profile.dalamud.optOutOfMbCollection;
|
startInfo["OptOutMbCollection"] = profile.dalamud.optOutOfMbCollection;
|
||||||
|
|
||||||
|
@ -494,37 +494,12 @@ void LauncherCore::readWineInfo(ProfileSettings& profile) {
|
||||||
|
|
||||||
void LauncherCore::readGameVersion() {
|
void LauncherCore::readGameVersion() {
|
||||||
for(auto& profile : profileSettings) {
|
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->repositories = physis_gamedata_get_repositories(profile->gameData);
|
||||||
profile->gameVersions.push_back(readVersion(profile->gamePath + QString("/game/ffxivgame.ver")));
|
profile->bootVersion = physis_bootdata_get_version(profile->bootData);
|
||||||
profile->installedMaxExpansion = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
readGameData(*profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -704,9 +679,6 @@ void LauncherCore::addRegistryKey(const ProfileSettings& settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::readGameData(ProfileSettings& profile) {
|
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");
|
EXH* exh = physis_gamedata_read_excel_sheet_header(profile.gameData, "ExVersion");
|
||||||
if(exh != nullptr) {
|
if(exh != nullptr) {
|
||||||
physis_EXD exd = physis_gamedata_read_excel_sheet(profile.gameData, "ExVersion", exh, Language::English, 0);
|
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;
|
QUrl url;
|
||||||
url.setScheme("https");
|
url.setScheme("https");
|
||||||
url.setHost("patch-gamever.ffxiv.com");
|
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);
|
auto request = QNetworkRequest(url);
|
||||||
window.setSSL(request);
|
window.setSSL(request);
|
||||||
|
@ -169,12 +169,12 @@ void SquareLauncher::registerSession(const LoginInformation& info) {
|
||||||
request.setRawHeader("User-Agent", "FFXIV PATCH CLIENT");
|
request.setRawHeader("User-Agent", "FFXIV PATCH CLIENT");
|
||||||
request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
|
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++) {
|
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")
|
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 {
|
} else {
|
||||||
report += QString("\nex%1\t2012.01.01.0000.0000").arg(QString::number(i));
|
report += QString("\nex%1\t2012.01.01.0000.0000").arg(QString::number(i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,14 +204,14 @@ void SettingsWindow::reloadControls() {
|
||||||
expacString += "Boot";
|
expacString += "Boot";
|
||||||
expacString += QString(" (%1)\n").arg(profile.bootVersion);
|
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";
|
QString expansionName = "Unknown Expansion";
|
||||||
if(i < core.expansionNames.size()) {
|
if(i < core.expansionNames.size()) {
|
||||||
expansionName = core.expansionNames[i];
|
expansionName = core.expansionNames[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
expacString += expansionName;
|
expacString += expansionName;
|
||||||
expacString += QString(" (%1)\n").arg(profile.gameVersions[i]);
|
expacString += QString(" (%1)\n").arg(profile.repositories.repositories[i].version);
|
||||||
}
|
}
|
||||||
|
|
||||||
expansionVersionLabel->setText(expacString);
|
expansionVersionLabel->setText(expacString);
|
||||||
|
|
Loading…
Add table
Reference in a new issue