Add a new command in developer tools to list and load framedumps from framedump.ppsspp.org/repro/

Useful to make it easy to test GPU driver bugs etc, without having to
use real games or copying files around.
This commit is contained in:
Henrik Rydgård 2021-01-31 14:42:40 +01:00
parent e15064b2fc
commit ae50534918
3 changed files with 62 additions and 3 deletions

View File

@ -49,6 +49,7 @@
#include "GPU/GPUState.h"
#include "UI/MiscScreens.h"
#include "UI/DevScreens.h"
#include "UI/MainScreen.h"
#include "UI/ControlMappingScreen.h"
#include "UI/GameSettingsScreen.h"
@ -1107,7 +1108,7 @@ void ShaderViewScreen::CreateViews() {
layout->Add(new Button(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
}
const std::string framedumpsBaseUrl = "http://framedumps.ppsspp.org/";
const std::string framedumpsBaseUrl = "http://framedump.ppsspp.org/repro/";
FrameDumpTestScreen::FrameDumpTestScreen() {
@ -1118,12 +1119,48 @@ FrameDumpTestScreen::~FrameDumpTestScreen() {
}
void FrameDumpTestScreen::CreateViews() {
using namespace UI;
root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));
auto di = GetI18NCategory("Dialog");
TabHolder *tabHolder;
tabHolder = new TabHolder(ORIENT_VERTICAL, 200, new AnchorLayoutParams(10, 0, 10, 0, false));
root_->Add(tabHolder);
AddStandardBack(root_);
tabHolder->SetTag("DumpTypes");
root_->SetDefaultFocusView(tabHolder);
ViewGroup *dumpsScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
dumpsScroll->SetTag("GameSettingsGraphics");
LinearLayout *dumps = new LinearLayout(ORIENT_VERTICAL);
dumps->SetSpacing(0);
dumpsScroll->Add(dumps);
tabHolder->AddTab("Dumps", dumps);
dumps->Add(new ItemHeader("GE Frame Dumps"));
for (auto &file : files_) {
std::string url = framedumpsBaseUrl + file;
Choice *c = dumps->Add(new Choice(file));
c->SetTag(url);
c->OnClick.Handle<FrameDumpTestScreen>(this, &FrameDumpTestScreen::OnLoadDump);
}
}
UI::EventReturn FrameDumpTestScreen::OnLoadDump(UI::EventParams &params) {
std::string url = params.v->Tag();
INFO_LOG(COMMON, "Trying to launch '%s'", url.c_str());
// Our disc streaming functionality detects the URL and takes over and handles loading framedumps well,
// except for some reason the game ID.
// TODO: Fix that since it can be important for compat settings.
LaunchFile(screenManager(), url);
return UI::EVENT_DONE;
}
void FrameDumpTestScreen::update() {
UIScreen::update();
if (!listing_) {
listing_ = g_DownloadManager.StartDownload(framedumpsBaseUrl, "");
}
@ -1132,7 +1169,24 @@ void FrameDumpTestScreen::update() {
if (listing_->ResultCode() == 200) {
std::string listingHtml;
listing_->buffer().TakeAll(&listingHtml);
INFO_LOG(COMMON, "Listing: %s", listingHtml.c_str());
std::vector<std::string> lines;
// We rely slightly on nginx listing format here. Not great.
SplitString(listingHtml, '\n', lines);
for (auto &line : lines) {
std::string trimmed = StripSpaces(line);
if (startsWith(trimmed, "<a href=\"")) {
trimmed = trimmed.substr(strlen("<a href=\""));
size_t offset = trimmed.find('\"');
if (offset != std::string::npos) {
trimmed = trimmed.substr(0, offset);
if (endsWith(trimmed, ".ppdmp")) {
INFO_LOG(COMMON, "Found ppdmp: '%s'", trimmed.c_str());
files_.push_back(trimmed);
}
}
}
}
} else {
// something went bad. Too lazy to make UI, so let's just finish this screen.
TriggerFinish(DialogResult::DR_CANCEL);

View File

@ -182,7 +182,7 @@ private:
DebugShaderType type_;
};
class FrameDumpTestScreen : public UIScreenWithBackground {
class FrameDumpTestScreen : public UIDialogScreenWithBackground {
public:
FrameDumpTestScreen();
~FrameDumpTestScreen();
@ -191,8 +191,11 @@ public:
void update() override;
private:
UI::EventReturn OnLoadDump(UI::EventParams &e);
std::vector<std::string> files_;
std::shared_ptr<http::Download> listing_;
std::shared_ptr<http::Download> dumpDownload_;
};
void DrawProfile(UIContext &ui);

View File

@ -38,6 +38,8 @@ enum class BrowseFlags {
};
ENUM_CLASS_BITOPS(BrowseFlags);
bool LaunchFile(ScreenManager *screenManager, std::string path);
class GameBrowser : public UI::LinearLayout {
public:
GameBrowser(std::string path, BrowseFlags browseFlags, bool *gridStyle, ScreenManager *screenManager, std::string lastText, std::string lastLink, UI::LayoutParams *layoutParams = nullptr);