Skip to content

Commit

Permalink
VK: Fix sometimes-missing images in GameScreen. Can't load textures f…
Browse files Browse the repository at this point in the history
…rom update(). (should probably make that possible though.. later).
  • Loading branch information
hrydgard committed Nov 22, 2018
1 parent c789c34 commit 3d20dde
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions UI/GameInfoCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void GameInfoCache::WaitUntilDone(std::shared_ptr<GameInfo> &info) {
}


// Runs on the main thread.
// Runs on the main thread. Only call from render() and similar, not update()!
std::shared_ptr<GameInfo> GameInfoCache::GetInfo(Draw::DrawContext *draw, const std::string &gamePath, int wantFlags) {
std::shared_ptr<GameInfo> info;

Expand Down Expand Up @@ -800,7 +800,7 @@ void GameInfoCache::SetupTexture(std::shared_ptr<GameInfo> &info, Draw::DrawCont
if (tex.texture) {
tex.timeLoaded = time_now_d();
} else {
ERROR_LOG(G3D, "Failed creating texture");
ERROR_LOG(G3D, "Failed creating texture (%s)", info->GetTitle().c_str());
}
}
if ((info->wantFlags & GAMEINFO_WANTBGDATA) == 0) {
Expand Down
4 changes: 2 additions & 2 deletions UI/GameScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ UI::EventReturn GameScreen::OnDeleteConfig(UI::EventParams &e)
return UI::EVENT_DONE;
}

void GameScreen::update() {
UIScreen::update();
void GameScreen::render() {
UIScreen::render();

I18NCategory *ga = GetI18NCategory("Game");

Expand Down
2 changes: 1 addition & 1 deletion UI/GameScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GameScreen : public UIDialogScreenWithGameBackground {
GameScreen(const std::string &gamePath);
~GameScreen();

void update() override;
void render() override;

std::string tag() const override { return "game"; }

Expand Down
3 changes: 2 additions & 1 deletion UI/TextureUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ bool ManagedTexture::LoadFromFileData(const uint8_t *data, size_t dataSize, Imag
num_levels = 1;
}

// Free the old texture, if any.
if (texture_) {
delete texture_;
texture_ = nullptr;
Expand All @@ -134,7 +135,7 @@ bool ManagedTexture::LoadFromFileData(const uint8_t *data, size_t dataSize, Imag
if (image[i])
free(image[i]);
}
return texture_ != nullptr;
return texture_;
}

bool ManagedTexture::LoadFromFile(const std::string &filename, ImageFileType type, bool generateMips) {
Expand Down

0 comments on commit 3d20dde

Please sign in to comment.