Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CwCheats: Retry looking in g_gameInfoCache until the data is there. #18736

Merged
merged 1 commit into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions UI/CwCheatScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@ CwCheatScreen::~CwCheatScreen() {
delete engine_;
}

void CwCheatScreen::LoadCheatInfo() {
bool CwCheatScreen::TryLoadCheatInfo() {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, gamePath_, 0);
std::string gameID;
if (info && info->paramSFOLoaded) {
gameID = info->paramSFO.GetValueString("DISC_ID");
} else {
return false;
}
if ((info->id.empty() || !info->disc_total)
&& gamePath_.FilePathContainsNoCase("PSP/GAME/")) {
Expand All @@ -76,6 +78,7 @@ void CwCheatScreen::LoadCheatInfo() {

// Let's also trigger a reload, in case it changed.
g_Config.bReloadCheats = true;
return true;
}

void CwCheatScreen::CreateViews() {
Expand All @@ -86,7 +89,7 @@ void CwCheatScreen::CreateViews() {

root_ = new AnchorLayout(new LayoutParams(FILL_PARENT, FILL_PARENT));

LoadCheatInfo();
TryLoadCheatInfo(); // in case the info is already in cache.
Margins actionMenuMargins(50, -15, 15, 0);

LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(400, FILL_PARENT));
Expand Down Expand Up @@ -134,6 +137,12 @@ void CwCheatScreen::CreateViews() {
}

void CwCheatScreen::update() {
if (gameID_.empty()) {
if (TryLoadCheatInfo()) {
RecreateViews();
}
}

if (fileCheckCounter_++ >= FILE_CHECK_FRAME_INTERVAL && engine_) {
// Check if the file has changed. If it has, we'll reload.
std::string str;
Expand Down
2 changes: 1 addition & 1 deletion UI/CwCheatScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CwCheatScreen : public UIDialogScreenWithGameBackground {
CwCheatScreen(const Path &gamePath);
~CwCheatScreen();

void LoadCheatInfo();
bool TryLoadCheatInfo();

UI::EventReturn OnAddCheat(UI::EventParams &params);
UI::EventReturn OnImportCheat(UI::EventParams &params);
Expand Down
12 changes: 9 additions & 3 deletions UI/GameSettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED);
return UI::EVENT_DONE;
});
msaaChoice->SetEnabledFunc([] {
return !g_Config.bSoftwareRendering && !g_Config.bSkipBufferEffects;
});
if (g_Config.iMultiSampleLevel > 1 && draw->GetDeviceCaps().isTilingGPU) {
msaaChoice->SetIcon(ImageID("I_WARNING"), 0.7f);
}
Expand Down Expand Up @@ -429,7 +432,8 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
});
skipBufferEffects->SetDisabledPtr(&g_Config.bSoftwareRendering);

graphicsSettings->Add(new CheckBox(&g_Config.bDisableRangeCulling, gr->T("Disable culling")));
CheckBox *disableCulling = graphicsSettings->Add(new CheckBox(&g_Config.bDisableRangeCulling, gr->T("Disable culling")));
disableCulling->SetDisabledPtr(&g_Config.bSoftwareRendering);

static const char *skipGpuReadbackModes[] = { "No (default)", "Skip", "Copy to texture" };

Expand Down Expand Up @@ -552,9 +556,11 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
anisoFiltering->SetDisabledPtr(&g_Config.bSoftwareRendering);

static const char *texFilters[] = { "Auto", "Nearest", "Linear", "Auto Max Quality"};
graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gr->T("Texture Filter"), texFilters, 1, ARRAY_SIZE(texFilters), I18NCat::GRAPHICS, screenManager()));
PopupMultiChoice *filters = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iTexFiltering, gr->T("Texture Filter"), texFilters, 1, ARRAY_SIZE(texFilters), I18NCat::GRAPHICS, screenManager()));
filters->SetDisabledPtr(&g_Config.bSoftwareRendering);

graphicsSettings->Add(new CheckBox(&g_Config.bSmart2DTexFiltering, gr->T("Smart 2D texture filtering")));
CheckBox *smartFiltering = graphicsSettings->Add(new CheckBox(&g_Config.bSmart2DTexFiltering, gr->T("Smart 2D texture filtering")));
smartFiltering->SetDisabledPtr(&g_Config.bSoftwareRendering);

#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
bool showCardboardSettings = deviceType != DEVICE_TYPE_VR;
Expand Down