mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-13 06:20:26 +02:00
UI: Add button to show CRC on feedback screen.
This commit is contained in:
1 parent
04a077e2f5
commit
4d0dea3506
4 files changed
+54
-5
No files matched your search
+35
-1
@@ -195,6 +195,7 @@ void ReportScreen::update() {
|
||||
}
|
||||
}
|
||||
UIDialogScreenWithGameBackground::update();
|
||||
UpdateCRCInfo();
|
||||
}
|
||||
|
||||
void ReportScreen::resized() {
|
||||
@@ -269,7 +270,7 @@ void ReportScreen::CreateViews() {
|
||||
}
|
||||
|
||||
#ifdef MOBILE_DEVICE
|
||||
if (!Core_GetPowerSaving()) {
|
||||
if (!Core_GetPowerSaving() && !Reporting::HasCRC(gamePath_)) {
|
||||
auto crcWarning = new TextView(rp->T("FeedbackIncludeCRC", "Note: Battery will be used to send a disc CRC"), FLAG_WRAP_TEXT, false, new LinearLayoutParams(Margins(12, 5, 0, 5)));
|
||||
crcWarning->SetShadow(true);
|
||||
crcWarning->SetEnabledPtr(&enableReporting_);
|
||||
@@ -277,6 +278,11 @@ void ReportScreen::CreateViews() {
|
||||
}
|
||||
#endif
|
||||
|
||||
crcInfo_ = new TextView("", FLAG_WRAP_TEXT, false, new LinearLayoutParams(Margins(12, 5, 0, 5)));
|
||||
crcInfo_->SetShadow(true);
|
||||
crcInfo_->SetVisibility(V_GONE);
|
||||
leftColumnItems->Add(crcInfo_);
|
||||
|
||||
if (tookScreenshot_ && !screenshotFilename_.empty()) {
|
||||
leftColumnItems->Add(new CheckBox(&includeScreenshot_, rp->T("FeedbackIncludeScreen", "Include a screenshot")))->SetEnabledPtr(&enableReporting_);
|
||||
screenshot_ = leftColumnItems->Add(new AsyncImageFileView(screenshotFilename_, IS_KEEP_ASPECT, nullptr, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, Margins(12, 0))));
|
||||
@@ -300,6 +306,8 @@ void ReportScreen::CreateViews() {
|
||||
|
||||
rightColumnItems->SetSpacing(0.0f);
|
||||
rightColumnItems->Add(new Choice(rp->T("Open Browser")))->OnClick.Handle(this, &ReportScreen::HandleBrowser);
|
||||
showCrcButton_ = new Choice(rp->T("Show disc CRC"));
|
||||
rightColumnItems->Add(showCrcButton_)->OnClick.Handle(this, &ReportScreen::HandleShowCRC);
|
||||
submit_ = new Choice(rp->T("Submit Feedback"));
|
||||
rightColumnItems->Add(submit_)->OnClick.Handle(this, &ReportScreen::HandleSubmit);
|
||||
UpdateSubmit();
|
||||
@@ -314,12 +322,32 @@ void ReportScreen::CreateViews() {
|
||||
|
||||
leftColumn->Add(leftColumnItems);
|
||||
rightColumn->Add(rightColumnItems);
|
||||
|
||||
UpdateCRCInfo();
|
||||
}
|
||||
|
||||
void ReportScreen::UpdateSubmit() {
|
||||
submit_->SetEnabled(enableReporting_ && overall_ != ReportingOverallScore::INVALID && graphics_ >= 0 && speed_ >= 0 && gameplay_ >= 0);
|
||||
}
|
||||
|
||||
void ReportScreen::UpdateCRCInfo() {
|
||||
auto rp = GetI18NCategory("Reporting");
|
||||
std::string updated;
|
||||
|
||||
if (Reporting::HasCRC(gamePath_)) {
|
||||
std::string crc = StringFromFormat("%08X", Reporting::RetrieveCRC(gamePath_));
|
||||
updated = ReplaceAll(rp->T("FeedbackCRCValue", "Disc CRC: [VALUE]"), "[VALUE]", crc);
|
||||
} else if (showCRC_) {
|
||||
updated = rp->T("FeedbackCRCCalculating", "Disc CRC: Calculating...");
|
||||
}
|
||||
|
||||
if (!updated.empty()) {
|
||||
crcInfo_->SetText(updated);
|
||||
crcInfo_->SetVisibility(V_VISIBLE);
|
||||
showCrcButton_->SetEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ReportScreen::UpdateOverallDescription() {
|
||||
auto rp = GetI18NCategory("Reporting");
|
||||
const char *desc;
|
||||
@@ -366,6 +394,12 @@ EventReturn ReportScreen::HandleBrowser(EventParams &e) {
|
||||
return EVENT_DONE;
|
||||
}
|
||||
|
||||
EventReturn ReportScreen::HandleShowCRC(EventParams &e) {
|
||||
Reporting::QueueCRC(gamePath_);
|
||||
showCRC_ = true;
|
||||
return EVENT_DONE;
|
||||
}
|
||||
|
||||
ReportFinishScreen::ReportFinishScreen(const std::string &gamePath, ReportingOverallScore score)
|
||||
: UIDialogScreenWithGameBackground(gamePath), score_(score) {
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user