Skip to content
Open
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
3 changes: 3 additions & 0 deletions Common/UI/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,9 @@ void CheckBox::Draw(UIContext &dc) {
}
if (down_) {
style = dc.GetTheme().itemDownStyle;
} else if (highlightChecked_ && Toggled()) {
style = dc.GetTheme().itemStyle;
style.background.color = alphaMul(style.background.color, 1.90f); // increase opacity (darker)
}
}

Expand Down
9 changes: 7 additions & 2 deletions Common/UI/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -909,12 +909,12 @@ class PopupHeader : public Item {
class CheckBox : public ClickableItem {
public:
CheckBox(bool *toggle, std::string_view text, std::string_view smallText = "", LayoutParams *layoutParams = nullptr)
: ClickableItem(layoutParams), toggle_(toggle), text_(text), smallText_(smallText) {
: ClickableItem(layoutParams), toggle_(toggle), highlightChecked_(false), text_(text), smallText_(smallText) {
}

// Image-only "checkbox", lights up instead of showing a checkmark.
CheckBox(bool *toggle, ImageID imageID, LayoutParams *layoutParams = nullptr)
: ClickableItem(layoutParams), toggle_(toggle), imageID_(imageID) {
: ClickableItem(layoutParams), toggle_(toggle), highlightChecked_(false), imageID_(imageID) {
}

void Draw(UIContext &dc) override;
Expand All @@ -928,10 +928,15 @@ class CheckBox : public ClickableItem {
// we don't allow these for checkboxes.
void SetAutoResult(DialogResult result) override {}

void SetHighlightChecked(bool highlightChecked) {
highlightChecked_ = highlightChecked;
}

protected:
void ClickInternal() override;

bool *toggle_;
bool highlightChecked_; // only for non-image mode
std::string text_;
std::string smallText_;
ImageID imageID_;
Expand Down
3 changes: 3 additions & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ static const ConfigSetting generalSettings[] = {
ConfigSetting("AutoLoadSaveState", SETTING(g_Config, iAutoLoadSaveState), 0, CfgFlag::PER_GAME),
ConfigSetting("EnableCheats", SETTING(g_Config, bEnableCheats), false, CfgFlag::PER_GAME | CfgFlag::REPORT),
ConfigSetting("EnablePlugins", SETTING(g_Config, bEnablePlugins), true, CfgFlag::PER_GAME | CfgFlag::REPORT),
ConfigSetting("CwCheatHighlightCheckedCheats", SETTING(g_Config, bCwCheatHighlightCheckedCheats), true, CfgFlag::DEFAULT),
ConfigSetting("CwCheatRefreshRate", SETTING(g_Config, iCwCheatRefreshIntervalMs), 77, CfgFlag::PER_GAME),
ConfigSetting("CwCheatScrollPosition", SETTING(g_Config, fCwCheatScrollPosition), 0.0f, CfgFlag::PER_GAME),
ConfigSetting("GameListScrollPosition", SETTING(g_Config, fGameListScrollPosition), 0.0f, CfgFlag::DEFAULT),
Expand Down Expand Up @@ -314,6 +315,7 @@ static const ConfigSetting generalSettings[] = {

ConfigSetting("BackgroundAnimation", SETTING(g_Config, iBackgroundAnimation), 1, CfgFlag::DEFAULT),
ConfigSetting("TransparentBackground", SETTING(g_Config, bTransparentBackground), true, CfgFlag::DEFAULT),
ConfigSetting("ShowPic1OnBackgroundScreen", SETTING(g_Config, bShowPic1OnBackgroundScreen), true, CfgFlag::DEFAULT),
ConfigSetting("UITint", SETTING(g_Config, fUITint), 0.0, CfgFlag::DEFAULT),
ConfigSetting("UISaturation", SETTING(g_Config, fUISaturation), &DefaultUISaturation, CfgFlag::DEFAULT),

Expand Down Expand Up @@ -827,6 +829,7 @@ std::string DefaultProAdhocServer() {

static const ConfigSetting soundSettings[] = {
ConfigSetting("Enable", SETTING(g_Config, bEnableSound), true, CfgFlag::PER_GAME),
ConfigSetting("EnableGameScreenBackgroundAudio", SETTING(g_Config, bEnableGameScreenBackgroundAudio), true, CfgFlag::DEFAULT),
ConfigSetting("ExtraAudioBuffering", SETTING(g_Config, bExtraAudioBuffering), false, CfgFlag::DEFAULT),
ConfigSetting("AudioBufferSize", SETTING(g_Config, iSDLAudioBufferSize), 256, CfgFlag::DEFAULT),

Expand Down
3 changes: 3 additions & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ struct Config : public ConfigBlock {
bool bEnableCheats;
bool bReloadCheats;
bool bEnablePlugins;
bool bCwCheatHighlightCheckedCheats;
int iCwCheatRefreshIntervalMs;
float fCwCheatScrollPosition;
float fGameListScrollPosition;
Expand Down Expand Up @@ -391,6 +392,7 @@ struct Config : public ConfigBlock {

// Sound
bool bEnableSound;
bool bEnableGameScreenBackgroundAudio;
int iSDLAudioBufferSize;
int iAudioBufferSize;
bool bFillAudioGaps;
Expand Down Expand Up @@ -426,6 +428,7 @@ struct Config : public ConfigBlock {
float fGameGridScale;
int iBackgroundAnimation; // enum BackgroundAnimation
bool bTransparentBackground;
bool bShowPic1OnBackgroundScreen;
int iSettingsCurrentTab;
int iDeveloperSettingsCurrentTab;

Expand Down
4 changes: 3 additions & 1 deletion UI/CwCheatScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ void CwCheatScreen::CreateContentViews(UI::ViewGroup *parent) {
rightScroll->Add(rightColumn);
rightColumn->Add(new ItemHeader(cw->T("Cheats")));
for (size_t i = 0; i < fileInfo_.size(); ++i) {
rightColumn->Add(new CheckBox(&fileInfo_[i].enabled, fileInfo_[i].name))->OnClick.Add([=](UI::EventParams &) {
auto checkbox = new CheckBox(&fileInfo_[i].enabled, fileInfo_[i].name);
checkbox->SetHighlightChecked(g_Config.bCwCheatHighlightCheckedCheats);
rightColumn->Add(checkbox)->OnClick.Add([=](UI::EventParams &) {
OnCheckBox((int)i);
});
}
Expand Down
6 changes: 5 additions & 1 deletion UI/GameScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ class PMFView : public UI::InertView {
};

GameScreen::GameScreen(const Path &gamePath, bool inGame) : UITwoPaneBaseDialogScreen(gamePath, TwoPaneFlags::SettingsToTheRight | TwoPaneFlags::CustomContextMenu), inGame_(inGame) {
g_BackgroundAudio.SetGame(gamePath);
if (g_Config.bEnableGameScreenBackgroundAudio) {
g_BackgroundAudio.SetGame(gamePath);
} else {
g_BackgroundAudio.SetGame(Path());
}
System_PostUIMessage(UIMessage::GAME_SELECTED, gamePath.ToString());

// We want to re-fetch savedata size when opening this screen. We re-fetch PARAM_SFO because it's connected to updating the hasConfig bool.
Expand Down
2 changes: 1 addition & 1 deletion UI/MiscScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ScreenRenderFlags BackgroundScreen::render(ScreenRenderMode mode) {
Lin::Vec3 focus;
screenManager()->getFocusPosition(focus.x, focus.y, focus.z);

if (!gamePath_.empty()) {
if (g_Config.bShowPic1OnBackgroundScreen && !gamePath_.empty()) {
::DrawGameBackground(*uiContext, gamePath_, focus, 1.0f);
} else {
::DrawBackground(*uiContext, 1.0f, focus);
Expand Down
Loading