Skip to content

Commit

Permalink
Fix logic, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jan 28, 2024
1 parent 7b4d245 commit a5fafb8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 2 additions & 3 deletions UI/CwCheatScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ CwCheatScreen::~CwCheatScreen() {
bool CwCheatScreen::TryLoadCheatInfo() {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, gamePath_, GameInfoFlags::PARAM_SFO);
std::string gameID;
if (info && info->Ready(GameInfoFlags::PARAM_SFO)) {
gameID = info->paramSFO.GetValueString("DISC_ID");
} else {
if (!info->Ready(GameInfoFlags::PARAM_SFO)) {
return false;
}
gameID = info->paramSFO.GetValueString("DISC_ID");
if ((info->id.empty() || !info->disc_total)
&& gamePath_.FilePathContainsNoCase("PSP/GAME/")) {
gameID = g_paramSFO.GenerateFakeID(gamePath_);
Expand Down
5 changes: 3 additions & 2 deletions UI/EmuScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ void EmuScreen::bootGame(const Path &filename) {

// We don't want to boot with the wrong game specific config, so wait until info is ready.
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, filename, GameInfoFlags::PARAM_SFO);
if (!info || info->Ready(GameInfoFlags::PARAM_SFO))
if (!info->Ready(GameInfoFlags::PARAM_SFO)) {
return;
}

auto sc = GetI18NCategory(I18NCat::SCREEN);
if (info->fileType == IdentifiedFileType::PSP_DISC_DIRECTORY) {
Expand Down Expand Up @@ -956,7 +957,7 @@ class GameInfoBGView : public UI::InertView {
dc.Flush();

// PIC1 is the loading image, so let's only draw if it's available.
if (ginfo && ginfo->Ready(GameInfoFlags::BG) && ginfo->pic1.texture) {
if (ginfo->Ready(GameInfoFlags::BG) && ginfo->pic1.texture) {
Draw::Texture *texture = ginfo->pic1.texture;
if (texture) {
dc.GetDrawContext()->BindTexture(0, texture);
Expand Down
4 changes: 2 additions & 2 deletions UI/GameScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ void GameScreen::CallbackDeleteSaveData(bool yes) {

UI::EventReturn GameScreen::OnDeleteGame(UI::EventParams &e) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(NULL, gamePath_, GameInfoFlags::PARAM_SFO);
if (info && info->Ready(GameInfoFlags::PARAM_SFO)) {
if (info->Ready(GameInfoFlags::PARAM_SFO)) {
auto di = GetI18NCategory(I18NCat::DIALOG);
auto ga = GetI18NCategory(I18NCat::GAME);
screenManager()->push(
Expand Down Expand Up @@ -560,7 +560,7 @@ void SetBackgroundPopupScreen::update() {
PopupScreen::update();

std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, gamePath_, GameInfoFlags::BG);
if (status_ == Status::PENDING && info && info->Ready(GameInfoFlags::BG)) {
if (status_ == Status::PENDING && info->Ready(GameInfoFlags::BG)) {
GameInfoTex *pic = nullptr;
if (info->pic1.dataLoaded && info->pic1.data.size()) {
pic = &info->pic1;
Expand Down

0 comments on commit a5fafb8

Please sign in to comment.