mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-30 23:33:17 +00:00
support for unlocking trophies (#854)
* add pugixml * trophy_viewer: support for trophy unlocking * nptrophy: UnlockTrophy(), DestroyContext() * initial imgui popup * queue to handle multiple trophies at once * extract trophy info on game start + various fixes * platinum trophy support + extract trophy data on startup * format * nptrophy: GetTrophyUnlockState * implement vinicius' reviews
This commit is contained in:
parent
c5b8e492f6
commit
74c2888aaa
11 changed files with 607 additions and 53 deletions
|
@ -9,7 +9,8 @@ TrophyViewer::TrophyViewer(QString trophyPath, QString gameTrpPath) : QMainWindo
|
|||
this->setAttribute(Qt::WA_DeleteOnClose);
|
||||
tabWidget = new QTabWidget(this);
|
||||
gameTrpPath_ = gameTrpPath;
|
||||
headers << "Trophy"
|
||||
headers << "Unlocked"
|
||||
<< "Trophy"
|
||||
<< "Name"
|
||||
<< "Description"
|
||||
<< "ID"
|
||||
|
@ -61,6 +62,7 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||
|
||||
QStringList trpId;
|
||||
QStringList trpHidden;
|
||||
QStringList trpUnlocked;
|
||||
QStringList trpType;
|
||||
QStringList trpPid;
|
||||
QStringList trophyNames;
|
||||
|
@ -81,6 +83,15 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||
trpHidden.append(reader.attributes().value("hidden").toString());
|
||||
trpType.append(reader.attributes().value("ttype").toString());
|
||||
trpPid.append(reader.attributes().value("pid").toString());
|
||||
if (reader.attributes().hasAttribute("unlockstate")) {
|
||||
if (reader.attributes().value("unlockstate").toString() == "unlocked") {
|
||||
trpUnlocked.append("unlocked");
|
||||
} else {
|
||||
trpUnlocked.append("locked");
|
||||
}
|
||||
} else {
|
||||
trpUnlocked.append("locked");
|
||||
}
|
||||
}
|
||||
|
||||
if (reader.name().toString() == "name" && !trpId.isEmpty()) {
|
||||
|
@ -93,7 +104,7 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||
}
|
||||
QTableWidget* tableWidget = new QTableWidget(this);
|
||||
tableWidget->setShowGrid(false);
|
||||
tableWidget->setColumnCount(7);
|
||||
tableWidget->setColumnCount(8);
|
||||
tableWidget->setHorizontalHeaderLabels(headers);
|
||||
tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
@ -105,21 +116,22 @@ void TrophyViewer::PopulateTrophyWidget(QString title) {
|
|||
QTableWidgetItem* item = new QTableWidgetItem();
|
||||
item->setData(Qt::DecorationRole, icon);
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
|
||||
tableWidget->setItem(row, 0, item);
|
||||
tableWidget->setItem(row, 1, item);
|
||||
if (!trophyNames.isEmpty() && !trophyDetails.isEmpty()) {
|
||||
SetTableItem(tableWidget, row, 1, trophyNames[row]);
|
||||
SetTableItem(tableWidget, row, 2, trophyDetails[row]);
|
||||
SetTableItem(tableWidget, row, 3, trpId[row]);
|
||||
SetTableItem(tableWidget, row, 4, trpHidden[row]);
|
||||
SetTableItem(tableWidget, row, 5, GetTrpType(trpType[row].at(0)));
|
||||
SetTableItem(tableWidget, row, 6, trpPid[row]);
|
||||
SetTableItem(tableWidget, row, 0, trpUnlocked[row]);
|
||||
SetTableItem(tableWidget, row, 2, trophyNames[row]);
|
||||
SetTableItem(tableWidget, row, 3, trophyDetails[row]);
|
||||
SetTableItem(tableWidget, row, 4, trpId[row]);
|
||||
SetTableItem(tableWidget, row, 5, trpHidden[row]);
|
||||
SetTableItem(tableWidget, row, 6, GetTrpType(trpType[row].at(0)));
|
||||
SetTableItem(tableWidget, row, 7, trpPid[row]);
|
||||
}
|
||||
tableWidget->verticalHeader()->resizeSection(row, icon.height());
|
||||
row++;
|
||||
}
|
||||
tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
int width = 16;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
width += tableWidget->horizontalHeader()->sectionSize(i);
|
||||
}
|
||||
tableWidget->resize(width, 720);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue