Rember cheat scroll position

This commit is contained in:
iota97 committed 2020-03-26 10:59:08 +01:00
1 parent 8b6d2f9025
commit d89a858dcd
6 files changed
+15 -5

No files matched your search

+1
View File
@@ -437,6 +437,7 @@ static ConfigSetting generalSettings[] = {
ConfigSetting("AutoLoadSaveState", &g_Config.iAutoLoadSaveState, 0, true, true),
ReportedConfigSetting("EnableCheats", &g_Config.bEnableCheats, false, true, true),
ConfigSetting("CwCheatRefreshRate", &g_Config.iCwCheatRefreshRate, 77, true, true),
ConfigSetting("CwCheatScrollPosition", &g_Config.fCwCheatScrollPosition, 0.0f, true, true),
ConfigSetting("ScreenshotsAsPNG", &g_Config.bScreenshotsAsPNG, false, true, true),
ConfigSetting("UseFFV1", &g_Config.bUseFFV1, false),
+1
View File
@@ -197,6 +197,7 @@ public:
bool bEnableCheats;
bool bReloadCheats;
int iCwCheatRefreshRate;
float fCwCheatScrollPosition;
int iBloomHack; //0 = off, 1 = safe, 2 = balanced, 3 = aggressive
bool bBlockTransferGPU;
bool bDisableSlowFramebufEffects;
+7 -5
View File
@@ -97,15 +97,16 @@ void CwCheatScreen::CreateViews() {
leftColumn->Add(new Choice(cw->T("Enable/Disable All")))->OnClick.Handle(this, &CwCheatScreen::OnEnableAll);
leftColumn->Add(new PopupSliderChoice(&g_Config.iCwCheatRefreshRate, 1, 1000, cw->T("Refresh Rate"), 1, screenManager()));
ScrollView *rightScroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(0.5f));
rightScroll->SetTag("CwCheats");
rightScroll->SetScrollToTop(false);
rightScroll_ = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(0.5f));
rightScroll_->SetTag("CwCheats");
rightScroll_->SetScrollToTop(false);
rightScroll_->ScrollTo(g_Config.fCwCheatScrollPosition);
LinearLayout *rightColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, actionMenuMargins));
LayoutParams *layout = new LayoutParams(500, 50, LP_PLAIN);
rightScroll->Add(rightColumn);
rightScroll_->Add(rightColumn);
root_->Add(leftColumn);
root_->Add(rightScroll);
root_->Add(rightScroll_);
rightColumn->Add(new ItemHeader(cw->T("Cheats")));
for (size_t i = 0; i < formattedList_.size(); i++) {
name = formattedList_[i].c_str();
@@ -129,6 +130,7 @@ void CwCheatScreen::onFinish(DialogResult result) {
if (MIPSComp::jit) {
MIPSComp::jit->ClearCache();
}
g_Config.fCwCheatScrollPosition = rightScroll_->GetScrollPosition();
}
UI::EventReturn CwCheatScreen::OnEnableAll(UI::EventParams &params) {
+1
View File
@@ -46,6 +46,7 @@ protected:
private:
UI::EventReturn OnCheckBox(UI::EventParams &params);
std::vector<std::string> formattedList_;
UI::ScrollView *rightScroll_;
};
// TODO: Instead just hook the OnClick event on a regular checkbox.
+4
View File
@@ -867,6 +867,10 @@ void ScrollView::SetVisibility(Visibility visibility) {
}
}
float ScrollView::GetScrollPosition() {
return scrollPos_;
}
void ScrollView::ScrollTo(float newScrollPos) {
scrollTarget_ = newScrollPos;
scrollToTarget_ = true;
+1
View File
@@ -241,6 +241,7 @@ public:
void ScrollTo(float newScrollPos);
void ScrollToBottom();
void ScrollRelative(float distance);
float GetScrollPosition();
bool CanScroll() const;
void Update() override;