From dc122f85958838f346ae7d3b2bd1ac9ee3fdb0e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 29 Oct 2024 11:24:36 +0100 Subject: [PATCH] ReportScreen: Calculate the disc CRC while filling out the form. Prevents a temporary hang after the refactor. --- Core/HLE/sceHttp.cpp | 10 ---------- UI/ReportScreen.cpp | 20 ++++++++------------ UI/ReportScreen.h | 3 --- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/Core/HLE/sceHttp.cpp b/Core/HLE/sceHttp.cpp index b56f2cc9cf..55c0800131 100644 --- a/Core/HLE/sceHttp.cpp +++ b/Core/HLE/sceHttp.cpp @@ -23,7 +23,6 @@ // 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. enum PSPHttpMethod { PSP_HTTP_METHOD_GET, @@ -36,15 +35,6 @@ class HTTPTemplate { char useragent[512]; }; -class HTTPConnection { - -}; - -class HTTPRequest { - -}; - - int sceHttpSetResolveRetry(int connectionID, int retryCount) { ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetResolveRetry(%d, %d)", connectionID, retryCount); return 0; diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index e698abf6d1..238c057174 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -160,10 +160,13 @@ void CompatRatingChoice::SetupChoices() { AddChoice(4, rp->T("Nothing")); } -ReportScreen::ReportScreen(const Path &gamePath) // unused gamePath, after removing the background +ReportScreen::ReportScreen(const Path &gamePath) : UIDialogScreen(), gamePath_(gamePath) { enableReporting_ = Reporting::IsEnabled(); 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) { @@ -296,7 +299,7 @@ void ReportScreen::CreateViews() { 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, 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 { if (tookScreenshot_) { includeScreenshot_ = false; @@ -317,10 +320,9 @@ 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); + submit_->SetEnabled(false); // Waiting for CRC UpdateSubmit(); UpdateOverallDescription(); @@ -348,14 +350,14 @@ void ReportScreen::UpdateCRCInfo() { if (Reporting::HasCRC(gamePath_)) { std::string crc = StringFromFormat("%08X", Reporting::RetrieveCRC(gamePath_)); updated = ApplySafeSubstitutions(rp->T("FeedbackCRCValue", "Disc CRC: %1"), crc); - } else if (showCRC_) { + submit_->SetEnabled(true); + } else { updated = rp->T("FeedbackCRCCalculating", "Disc CRC: Calculating..."); } if (!updated.empty()) { crcInfo_->SetText(updated); crcInfo_->SetVisibility(V_VISIBLE); - showCrcButton_->SetEnabled(false); } } @@ -405,12 +407,6 @@ EventReturn ReportScreen::HandleBrowser(EventParams &e) { return EVENT_DONE; } -EventReturn ReportScreen::HandleShowCRC(EventParams &e) { - Reporting::QueueCRC(gamePath_); - showCRC_ = true; - return EVENT_DONE; -} - ReportFinishScreen::ReportFinishScreen(const Path &gamePath, ReportingOverallScore score) : UIDialogScreen(), gamePath_(gamePath), score_(score) { } diff --git a/UI/ReportScreen.h b/UI/ReportScreen.h index 8967cac82e..187116b428 100644 --- a/UI/ReportScreen.h +++ b/UI/ReportScreen.h @@ -54,7 +54,6 @@ protected: UI::EventReturn HandleChoice(UI::EventParams &e); UI::EventReturn HandleSubmit(UI::EventParams &e); UI::EventReturn HandleBrowser(UI::EventParams &e); - UI::EventReturn HandleShowCRC(UI::EventParams &e); UI::EventReturn HandleReportingChange(UI::EventParams &e); UI::Choice *submit_ = nullptr; @@ -62,7 +61,6 @@ protected: UI::TextView *reportingNotice_ = nullptr; UI::TextView *overallDescription_ = nullptr; UI::TextView *crcInfo_ = nullptr; - UI::Choice *showCrcButton_ = nullptr; Path gamePath_; Path screenshotFilename_; @@ -74,7 +72,6 @@ protected: bool ratingEnabled_; bool tookScreenshot_ = false; bool includeScreenshot_ = true; - bool showCRC_ = false; }; class ReportFinishScreen : public UIDialogScreen {