From e15064b2fcc2c51caee54e576b698fcc83c3360a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 31 Jan 2021 13:13:42 +0100 Subject: [PATCH] Framedump test screen. Downloads a list of framedumps. --- UI/DevScreens.cpp | 35 +++++++++++++++++++++++++++++++++++ UI/DevScreens.h | 14 ++++++++++++++ UI/GameSettingsScreen.cpp | 6 ++++++ UI/GameSettingsScreen.h | 1 + UI/UI.vcxproj.filters | 10 +++++++--- 5 files changed, 63 insertions(+), 3 deletions(-) diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 6c2f1ac95a..647ec8ab8d 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -24,6 +24,7 @@ #include "Common/System/System.h" #include "Common/GPU/OpenGL/GLFeatures.h" #include "Common/Data/Text/I18n.h" +#include "Common/Net/HTTPClient.h" #include "Common/UI/Context.h" #include "Common/UI/View.h" #include "Common/UI/ViewGroup.h" @@ -1105,3 +1106,37 @@ void ShaderViewScreen::CreateViews() { layout->Add(new Button(di->T("Back")))->OnClick.Handle(this, &UIScreen::OnBack); } + +const std::string framedumpsBaseUrl = "http://framedumps.ppsspp.org/"; + +FrameDumpTestScreen::FrameDumpTestScreen() { + +} + +FrameDumpTestScreen::~FrameDumpTestScreen() { + g_DownloadManager.CancelAll(); +} + +void FrameDumpTestScreen::CreateViews() { + for (auto &file : files_) { + std::string url = framedumpsBaseUrl + file; + } +} + +void FrameDumpTestScreen::update() { + if (!listing_) { + listing_ = g_DownloadManager.StartDownload(framedumpsBaseUrl, ""); + } + + if (listing_ && listing_->Done() && files_.empty()) { + if (listing_->ResultCode() == 200) { + std::string listingHtml; + listing_->buffer().TakeAll(&listingHtml); + INFO_LOG(COMMON, "Listing: %s", listingHtml.c_str()); + } else { + // something went bad. Too lazy to make UI, so let's just finish this screen. + TriggerFinish(DialogResult::DR_CANCEL); + } + RecreateViews(); + } +} diff --git a/UI/DevScreens.h b/UI/DevScreens.h index b97f08574b..09f09b809a 100644 --- a/UI/DevScreens.h +++ b/UI/DevScreens.h @@ -24,6 +24,7 @@ #include #include "Common/Data/Text/I18n.h" +#include "Common/Net/HTTPClient.h" #include "Common/UI/UIScreen.h" #include "UI/MiscScreens.h" @@ -181,5 +182,18 @@ private: DebugShaderType type_; }; +class FrameDumpTestScreen : public UIScreenWithBackground { +public: + FrameDumpTestScreen(); + ~FrameDumpTestScreen(); + + void CreateViews() override; + void update() override; + +private: + std::vector files_; + std::shared_ptr listing_; +}; + void DrawProfile(UIContext &ui); const char *GetCompilerABI(); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 0d13f0428a..20894c3b32 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1643,6 +1643,7 @@ void DeveloperToolsScreen::CreateViews() { if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN || g_Config.iGPUBackend == (int)GPUBackend::OPENGL) { list->Add(new Choice(dev->T("GPU Driver Test")))->OnClick.Handle(this, &DeveloperToolsScreen::OnGPUDriverTest); } + list->Add(new Choice(dev->T("Framedump tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnFramedumpTest); list->Add(new Choice(dev->T("Touchscreen Test")))->OnClick.Handle(this, &DeveloperToolsScreen::OnTouchscreenTest); allowDebugger_ = !WebServerStopped(WebServerFlags::DEBUGGER); @@ -1752,6 +1753,11 @@ UI::EventReturn DeveloperToolsScreen::OnGPUDriverTest(UI::EventParams &e) { return UI::EVENT_DONE; } +UI::EventReturn DeveloperToolsScreen::OnFramedumpTest(UI::EventParams &e) { + screenManager()->push(new FrameDumpTestScreen()); + return UI::EVENT_DONE; +} + UI::EventReturn DeveloperToolsScreen::OnTouchscreenTest(UI::EventParams &e) { screenManager()->push(new TouchTestScreen()); return UI::EVENT_DONE; diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index 43050e289f..76fd384aed 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -178,6 +178,7 @@ private: UI::EventReturn OnJitDebugTools(UI::EventParams &e); UI::EventReturn OnRemoteDebugger(UI::EventParams &e); UI::EventReturn OnGPUDriverTest(UI::EventParams &e); + UI::EventReturn OnFramedumpTest(UI::EventParams &e); UI::EventReturn OnTouchscreenTest(UI::EventParams &e); UI::EventReturn OnCopyStatesToRoot(UI::EventParams &e); diff --git a/UI/UI.vcxproj.filters b/UI/UI.vcxproj.filters index ea4444bb8a..eb282757cf 100644 --- a/UI/UI.vcxproj.filters +++ b/UI/UI.vcxproj.filters @@ -44,7 +44,6 @@ Screens - Screens @@ -76,6 +75,9 @@ Screens + + Screens + @@ -120,7 +122,6 @@ Screens - Screens @@ -153,10 +154,13 @@ Screens + + Screens + {faee5dce-633b-4ba6-b19d-ea70ee3c1c38} - + \ No newline at end of file