Skip to content

Commit

Permalink
Add reload button to GameBrowser. Fix assert if game load failed
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 28, 2023
1 parent 9317ad4 commit cd00d06
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Common/File/PathBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class PathBrowser {
~PathBrowser();

void SetPath(const Path &path);
void Refresh() {
HandlePath();
}
bool IsListingReady();
bool GetListing(std::vector<File::FileInfo> &fileInfo, const char *filter = nullptr, bool *cancel = nullptr);

Expand Down
9 changes: 5 additions & 4 deletions UI/EmuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1452,8 +1452,9 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
using namespace Draw;

DrawContext *draw = screenManager()->getDrawContext();
if (!draw)
if (!draw) {
return flags; // shouldn't really happen but I've seen a suspicious stack trace..
}

bool skipBufferEffects = g_Config.bSkipBufferEffects;

Expand Down Expand Up @@ -1494,10 +1495,10 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
PSP_BeginHostFrame();
gpu->CopyDisplayToOutput(true);
PSP_EndHostFrame();
draw->SetViewport(viewport);
draw->SetScissorRect(0, 0, g_display.pixel_xres, g_display.pixel_yres);
darken();
}
draw->SetViewport(viewport);
draw->SetScissorRect(0, 0, g_display.pixel_xres, g_display.pixel_yres);
darken();
return flags;
}

Expand Down
5 changes: 5 additions & 0 deletions UI/MainScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,11 @@ void GameBrowser::Refresh() {
layoutChoice->AddChoice(ImageID("I_LINES"));
layoutChoice->SetSelection(*gridStyle_ ? 0 : 1, false);
layoutChoice->OnChoice.Handle(this, &GameBrowser::LayoutChange);
topBar->Add(new Choice(ImageID("I_ROTATE_LEFT"), new LayoutParams(64.0f, 64.0f)))->OnClick.Add([=](UI::EventParams &e) {
path_.Refresh();
Refresh();
return UI::EVENT_DONE;
});
topBar->Add(new Choice(ImageID("I_GEAR"), new LayoutParams(64.0f, 64.0f)))->OnClick.Handle(this, &GameBrowser::GridSettingsClick);
Add(topBar);

Expand Down

0 comments on commit cd00d06

Please sign in to comment.