ReportScreen: Calculate the disc CRC while filling out the form.

Prevents a temporary hang after the refactor.
This commit is contained in:
Henrik Rydgård 2024-10-29 11:24:36 +01:00
parent 14bb7a6062
commit dc122f8595
3 changed files with 8 additions and 25 deletions

View File

@ -23,7 +23,6 @@
// If http isn't loaded (seems unlikely), most functions should return SCE_KERNEL_ERROR_LIBRARY_NOTFOUND // If http isn't loaded (seems unlikely), most functions should return SCE_KERNEL_ERROR_LIBRARY_NOTFOUND
// Could come in handy someday if we ever implement sceHttp* for real. // Could come in handy someday if we ever implement sceHttp* for real.
enum PSPHttpMethod { enum PSPHttpMethod {
PSP_HTTP_METHOD_GET, PSP_HTTP_METHOD_GET,
@ -36,15 +35,6 @@ class HTTPTemplate {
char useragent[512]; char useragent[512];
}; };
class HTTPConnection {
};
class HTTPRequest {
};
int sceHttpSetResolveRetry(int connectionID, int retryCount) { int sceHttpSetResolveRetry(int connectionID, int retryCount) {
ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetResolveRetry(%d, %d)", connectionID, retryCount); ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetResolveRetry(%d, %d)", connectionID, retryCount);
return 0; return 0;

View File

@ -160,10 +160,13 @@ void CompatRatingChoice::SetupChoices() {
AddChoice(4, rp->T("Nothing")); AddChoice(4, rp->T("Nothing"));
} }
ReportScreen::ReportScreen(const Path &gamePath) // unused gamePath, after removing the background ReportScreen::ReportScreen(const Path &gamePath)
: UIDialogScreen(), gamePath_(gamePath) { : UIDialogScreen(), gamePath_(gamePath) {
enableReporting_ = Reporting::IsEnabled(); enableReporting_ = Reporting::IsEnabled();
ratingEnabled_ = enableReporting_; ratingEnabled_ = enableReporting_;
// Start computing a CRC immediately, we'll need it on submit.
// We won't enable the submit button until it's done.
Reporting::QueueCRC(gamePath_);
} }
ScreenRenderFlags ReportScreen::render(ScreenRenderMode mode) { ScreenRenderFlags ReportScreen::render(ScreenRenderMode mode) {
@ -296,7 +299,7 @@ void ReportScreen::CreateViews() {
if (tookScreenshot_ && !screenshotFilename_.empty()) { if (tookScreenshot_ && !screenshotFilename_.empty()) {
leftColumnItems->Add(new CheckBox(&includeScreenshot_, rp->T("FeedbackIncludeScreen", "Include a screenshot")))->SetEnabledPtr(&enableReporting_); leftColumnItems->Add(new CheckBox(&includeScreenshot_, rp->T("FeedbackIncludeScreen", "Include a screenshot")))->SetEnabledPtr(&enableReporting_);
screenshot_ = leftColumnItems->Add(new AsyncImageFileView(screenshotFilename_, IS_KEEP_ASPECT, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, Margins(12, 0)))); screenshot_ = leftColumnItems->Add(new AsyncImageFileView(screenshotFilename_, IS_KEEP_ASPECT, new LinearLayoutParams(300, WRAP_CONTENT, Margins(12, 0))));
} else { } else {
if (tookScreenshot_) { if (tookScreenshot_) {
includeScreenshot_ = false; includeScreenshot_ = false;
@ -317,10 +320,9 @@ void ReportScreen::CreateViews() {
rightColumnItems->SetSpacing(0.0f); rightColumnItems->SetSpacing(0.0f);
rightColumnItems->Add(new Choice(rp->T("Open Browser")))->OnClick.Handle(this, &ReportScreen::HandleBrowser); 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")); submit_ = new Choice(rp->T("Submit Feedback"));
rightColumnItems->Add(submit_)->OnClick.Handle(this, &ReportScreen::HandleSubmit); rightColumnItems->Add(submit_)->OnClick.Handle(this, &ReportScreen::HandleSubmit);
submit_->SetEnabled(false); // Waiting for CRC
UpdateSubmit(); UpdateSubmit();
UpdateOverallDescription(); UpdateOverallDescription();
@ -348,14 +350,14 @@ void ReportScreen::UpdateCRCInfo() {
if (Reporting::HasCRC(gamePath_)) { if (Reporting::HasCRC(gamePath_)) {
std::string crc = StringFromFormat("%08X", Reporting::RetrieveCRC(gamePath_)); std::string crc = StringFromFormat("%08X", Reporting::RetrieveCRC(gamePath_));
updated = ApplySafeSubstitutions(rp->T("FeedbackCRCValue", "Disc CRC: %1"), crc); updated = ApplySafeSubstitutions(rp->T("FeedbackCRCValue", "Disc CRC: %1"), crc);
} else if (showCRC_) { submit_->SetEnabled(true);
} else {
updated = rp->T("FeedbackCRCCalculating", "Disc CRC: Calculating..."); updated = rp->T("FeedbackCRCCalculating", "Disc CRC: Calculating...");
} }
if (!updated.empty()) { if (!updated.empty()) {
crcInfo_->SetText(updated); crcInfo_->SetText(updated);
crcInfo_->SetVisibility(V_VISIBLE); crcInfo_->SetVisibility(V_VISIBLE);
showCrcButton_->SetEnabled(false);
} }
} }
@ -405,12 +407,6 @@ EventReturn ReportScreen::HandleBrowser(EventParams &e) {
return EVENT_DONE; return EVENT_DONE;
} }
EventReturn ReportScreen::HandleShowCRC(EventParams &e) {
Reporting::QueueCRC(gamePath_);
showCRC_ = true;
return EVENT_DONE;
}
ReportFinishScreen::ReportFinishScreen(const Path &gamePath, ReportingOverallScore score) ReportFinishScreen::ReportFinishScreen(const Path &gamePath, ReportingOverallScore score)
: UIDialogScreen(), gamePath_(gamePath), score_(score) { : UIDialogScreen(), gamePath_(gamePath), score_(score) {
} }

View File

@ -54,7 +54,6 @@ protected:
UI::EventReturn HandleChoice(UI::EventParams &e); UI::EventReturn HandleChoice(UI::EventParams &e);
UI::EventReturn HandleSubmit(UI::EventParams &e); UI::EventReturn HandleSubmit(UI::EventParams &e);
UI::EventReturn HandleBrowser(UI::EventParams &e); UI::EventReturn HandleBrowser(UI::EventParams &e);
UI::EventReturn HandleShowCRC(UI::EventParams &e);
UI::EventReturn HandleReportingChange(UI::EventParams &e); UI::EventReturn HandleReportingChange(UI::EventParams &e);
UI::Choice *submit_ = nullptr; UI::Choice *submit_ = nullptr;
@ -62,7 +61,6 @@ protected:
UI::TextView *reportingNotice_ = nullptr; UI::TextView *reportingNotice_ = nullptr;
UI::TextView *overallDescription_ = nullptr; UI::TextView *overallDescription_ = nullptr;
UI::TextView *crcInfo_ = nullptr; UI::TextView *crcInfo_ = nullptr;
UI::Choice *showCrcButton_ = nullptr;
Path gamePath_; Path gamePath_;
Path screenshotFilename_; Path screenshotFilename_;
@ -74,7 +72,6 @@ protected:
bool ratingEnabled_; bool ratingEnabled_;
bool tookScreenshot_ = false; bool tookScreenshot_ = false;
bool includeScreenshot_ = true; bool includeScreenshot_ = true;
bool showCRC_ = false;
}; };
class ReportFinishScreen : public UIDialogScreen { class ReportFinishScreen : public UIDialogScreen {