Remove the UI::EventReturn return values. Makes editing the UI nicer.

This commit is contained in:
Henrik Rydgård committed 2025-09-15 11:09:00 -06:00
1 parent 730fd4754e
commit 58456ae950
62 files changed
+516 -935

No files matched your search

+20 -41
View File
@@ -41,13 +41,12 @@ void ListPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
listView_->OnChoice.Handle(this, &ListPopupScreen::OnListChoice);
}
UI::EventReturn ListPopupScreen::OnListChoice(UI::EventParams &e) {
void ListPopupScreen::OnListChoice(UI::EventParams &e) {
adaptor_.SetSelected(e.a);
if (callback_)
callback_(adaptor_.GetSelected());
TriggerFinish(DR_OK);
OnChoice.Dispatch(e);
return UI::EVENT_DONE;
}
PopupContextMenuScreen::PopupContextMenuScreen(const ContextMenuItem *items, size_t itemCount, I18NCat category, UI::View *sourceView)
@@ -71,10 +70,9 @@ void PopupContextMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
if (enabled_[i]) {
choice->OnClick.Add([=](EventParams &p) {
TriggerFinish(DR_OK);
p.a = (uint32_t)i;
OnChoice.Dispatch(p);
return EVENT_DONE;
});
p.a = (uint32_t)i;
OnChoice.Dispatch(p);
});
} else {
choice->SetEnabled(false);
}
@@ -95,7 +93,7 @@ std::string ChopTitle(const std::string &title) {
return title;
}
UI::EventReturn PopupMultiChoice::HandleClick(UI::EventParams &e) {
void PopupMultiChoice::HandleClick(UI::EventParams &e) {
if (!callbackExecuted_ && preOpenCallback_) {
preOpenCallback_(this);
callbackExecuted_ = true;
@@ -117,7 +115,6 @@ UI::EventReturn PopupMultiChoice::HandleClick(UI::EventParams &e) {
if (e.v)
popupScreen->SetPopupOrigin(e.v);
screenManager_->push(popupScreen);
return UI::EVENT_DONE;
}
void PopupMultiChoice::Update() {
@@ -207,7 +204,7 @@ void PopupSliderChoiceFloat::SetFormat(std::string_view fmt) {
}
}
EventReturn PopupSliderChoice::HandleClick(EventParams &e) {
void PopupSliderChoice::HandleClick(EventParams &e) {
restoreFocus_ = HasFocus();
SliderPopupScreen *popupScreen = new SliderPopupScreen(value_, minValue_, maxValue_, defaultValue_, ChopTitle(text_), step_, units_, liveUpdate_);
@@ -218,17 +215,15 @@ EventReturn PopupSliderChoice::HandleClick(EventParams &e) {
if (e.v)
popupScreen->SetPopupOrigin(e.v);
screenManager_->push(popupScreen);
return EVENT_DONE;
}
EventReturn PopupSliderChoice::HandleChange(EventParams &e) {
void PopupSliderChoice::HandleChange(EventParams &e) {
e.v = this;
OnChange.Trigger(e);
if (restoreFocus_) {
SetFocusedView(this);
}
return EVENT_DONE;
}
static bool IsValidNumberFormatString(std::string_view s) {
@@ -273,7 +268,7 @@ std::string PopupSliderChoice::ValueText() const {
return std::string(temp);
}
EventReturn PopupSliderChoiceFloat::HandleClick(EventParams &e) {
void PopupSliderChoiceFloat::HandleClick(EventParams &e) {
restoreFocus_ = HasFocus();
SliderFloatPopupScreen *popupScreen = new SliderFloatPopupScreen(value_, minValue_, maxValue_, defaultValue_, ChopTitle(text_), step_, units_, liveUpdate_);
@@ -282,17 +277,15 @@ EventReturn PopupSliderChoiceFloat::HandleClick(EventParams &e) {
if (e.v)
popupScreen->SetPopupOrigin(e.v);
screenManager_->push(popupScreen);
return EVENT_DONE;
}
EventReturn PopupSliderChoiceFloat::HandleChange(EventParams &e) {
void PopupSliderChoiceFloat::HandleChange(EventParams &e) {
e.v = this;
OnChange.Trigger(e);
if (restoreFocus_) {
SetFocusedView(this);
}
return EVENT_DONE;
}
std::string PopupSliderChoiceFloat::ValueText() const {
@@ -308,7 +301,7 @@ std::string PopupSliderChoiceFloat::ValueText() const {
return temp;
}
EventReturn SliderPopupScreen::OnDecrease(EventParams &params) {
void SliderPopupScreen::OnDecrease(EventParams &params) {
if (sliderValue_ > minValue_ && sliderValue_ < maxValue_) {
sliderValue_ = step_ * floor((sliderValue_ / step_) + 0.5f);
}
@@ -318,10 +311,9 @@ EventReturn SliderPopupScreen::OnDecrease(EventParams &params) {
UpdateTextBox();
changing_ = false;
disabled_ = false;
return EVENT_DONE;
}
EventReturn SliderPopupScreen::OnIncrease(EventParams &params) {
void SliderPopupScreen::OnIncrease(EventParams &params) {
if (sliderValue_ > minValue_ && sliderValue_ < maxValue_) {
sliderValue_ = step_ * floor((sliderValue_ / step_) + 0.5f);
}
@@ -331,24 +323,21 @@ EventReturn SliderPopupScreen::OnIncrease(EventParams &params) {
UpdateTextBox();
changing_ = false;
disabled_ = false;
return EVENT_DONE;
}
EventReturn SliderPopupScreen::OnSliderChange(EventParams &params) {
void SliderPopupScreen::OnSliderChange(EventParams &params) {
changing_ = true;
UpdateTextBox();
changing_ = false;
disabled_ = false;
return EVENT_DONE;
}
EventReturn SliderPopupScreen::OnTextChange(EventParams &params) {
void SliderPopupScreen::OnTextChange(EventParams &params) {
if (!changing_) {
sliderValue_ = atoi(edit_->GetText().c_str());
disabled_ = false;
slider_->Clamp();
}
return EVENT_DONE;
}
void SliderPopupScreen::UpdateTextBox() {
@@ -401,7 +390,6 @@ void SliderPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
changing_ = true;
UpdateTextBox();
changing_ = false;
return UI::EVENT_DONE;
});
}
@@ -445,7 +433,6 @@ void SliderFloatPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
if (liveUpdate_) {
*value_ = defaultValue_;
}
return UI::EVENT_DONE;
});
}
@@ -454,7 +441,7 @@ void SliderFloatPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
UI::SetFocusedView(slider_);
}
EventReturn SliderFloatPopupScreen::OnDecrease(EventParams &params) {
void SliderFloatPopupScreen::OnDecrease(EventParams &params) {
if (sliderValue_ > minValue_ && sliderValue_ < maxValue_) {
sliderValue_ = step_ * floor((sliderValue_ / step_) + 0.5f);
}
@@ -466,10 +453,9 @@ EventReturn SliderFloatPopupScreen::OnDecrease(EventParams &params) {
if (liveUpdate_) {
*value_ = sliderValue_;
}
return EVENT_DONE;
}
EventReturn SliderFloatPopupScreen::OnIncrease(EventParams &params) {
void SliderFloatPopupScreen::OnIncrease(EventParams &params) {
if (sliderValue_ > minValue_ && sliderValue_ < maxValue_) {
sliderValue_ = step_ * floor((sliderValue_ / step_) + 0.5f);
}
@@ -481,17 +467,15 @@ EventReturn SliderFloatPopupScreen::OnIncrease(EventParams &params) {
if (liveUpdate_) {
*value_ = sliderValue_;
}
return EVENT_DONE;
}
EventReturn SliderFloatPopupScreen::OnSliderChange(EventParams &params) {
void SliderFloatPopupScreen::OnSliderChange(EventParams &params) {
changing_ = true;
UpdateTextBox();
changing_ = false;
if (liveUpdate_) {
*value_ = sliderValue_;
}
return EVENT_DONE;
}
void SliderFloatPopupScreen::UpdateTextBox() {
@@ -500,7 +484,7 @@ void SliderFloatPopupScreen::UpdateTextBox() {
edit_->SetText(temp);
}
EventReturn SliderFloatPopupScreen::OnTextChange(EventParams &params) {
void SliderFloatPopupScreen::OnTextChange(EventParams &params) {
if (!changing_) {
sliderValue_ = atof(edit_->GetText().c_str());
slider_->Clamp();
@@ -508,7 +492,6 @@ EventReturn SliderFloatPopupScreen::OnTextChange(EventParams &params) {
*value_ = sliderValue_;
}
}
return EVENT_DONE;
}
void SliderPopupScreen::OnCompleted(DialogResult result) {
@@ -539,7 +522,7 @@ PopupTextInputChoice::PopupTextInputChoice(RequesterToken token, std::string *va
OnClick.Handle(this, &PopupTextInputChoice::HandleClick);
}
EventReturn PopupTextInputChoice::HandleClick(EventParams &e) {
void PopupTextInputChoice::HandleClick(EventParams &e) {
restoreFocus_ = HasFocus();
// Choose method depending on platform capabilities.
@@ -549,7 +532,7 @@ EventReturn PopupTextInputChoice::HandleClick(EventParams &e) {
EventParams params{};
OnChange.Trigger(params);
});
return EVENT_DONE;
return;
}
TextEditPopupScreen *popupScreen = new TextEditPopupScreen(value_, placeHolder_, ChopTitle(text_), maxLen_);
@@ -561,14 +544,13 @@ EventReturn PopupTextInputChoice::HandleClick(EventParams &e) {
if (e.v)
popupScreen->SetPopupOrigin(e.v);
screenManager_->push(popupScreen);
return EVENT_DONE;
}
std::string PopupTextInputChoice::ValueText() const {
return *value_;
}
EventReturn PopupTextInputChoice::HandleChange(EventParams &e) {
void PopupTextInputChoice::HandleChange(EventParams &e) {
*value_ = StripSpaces(SanitizeString(*value_, restriction_, minLen_, maxLen_));
e.v = this;
OnChange.Trigger(e);
@@ -576,7 +558,6 @@ EventReturn PopupTextInputChoice::HandleChange(EventParams &e) {
if (restoreFocus_) {
SetFocusedView(this);
}
return EVENT_DONE;
}
void TextEditPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
@@ -718,7 +699,6 @@ FileChooserChoice::FileChooserChoice(RequesterToken token, std::string *value, s
OnChange.Trigger(e);
}
});
return UI::EVENT_DONE;
});
}
@@ -742,7 +722,6 @@ FolderChooserChoice::FolderChooserChoice(RequesterToken token, std::string *valu
OnChange.Trigger(e);
}
});
return UI::EVENT_DONE;
});
}
+16 -16
View File
@@ -50,7 +50,7 @@ protected:
UI::ListView *listView_ = nullptr;
private:
UI::EventReturn OnListChoice(UI::EventParams &e);
void OnListChoice(UI::EventParams &e);
std::function<void(int)> callback_;
bool showButtons_ = false;
@@ -98,10 +98,10 @@ public:
Event OnChange;
private:
EventReturn OnDecrease(EventParams &params);
EventReturn OnIncrease(EventParams &params);
EventReturn OnTextChange(EventParams &params);
EventReturn OnSliderChange(EventParams &params);
void OnDecrease(EventParams &params);
void OnIncrease(EventParams &params);
void OnTextChange(EventParams &params);
void OnSliderChange(EventParams &params);
void OnCompleted(DialogResult result) override;
void UpdateTextBox();
Slider *slider_ = nullptr;
@@ -132,10 +132,10 @@ public:
Event OnChange;
private:
EventReturn OnIncrease(EventParams &params);
EventReturn OnDecrease(EventParams &params);
EventReturn OnTextChange(EventParams &params);
EventReturn OnSliderChange(EventParams &params);
void OnIncrease(EventParams &params);
void OnDecrease(EventParams &params);
void OnTextChange(EventParams &params);
void OnSliderChange(EventParams &params);
void OnCompleted(DialogResult result) override;
void UpdateTextBox();
UI::SliderFloat *slider_ = nullptr;
@@ -252,7 +252,7 @@ protected:
void UpdateText();
private:
UI::EventReturn HandleClick(UI::EventParams &e);
void HandleClick(UI::EventParams &e);
void ChoiceCallback(int num);
virtual bool PostChoiceCallback(int num) { return true; }
@@ -354,8 +354,8 @@ protected:
std::string ValueText() const override;
private:
EventReturn HandleClick(EventParams &e);
EventReturn HandleChange(EventParams &e);
void HandleClick(EventParams &e);
void HandleChange(EventParams &e);
int *value_;
int minValue_;
@@ -395,8 +395,8 @@ protected:
std::string ValueText() const override;
private:
EventReturn HandleClick(EventParams &e);
EventReturn HandleChange(EventParams &e);
void HandleClick(EventParams &e);
void HandleChange(EventParams &e);
float *value_;
float minValue_;
float maxValue_;
@@ -427,8 +427,8 @@ protected:
std::string ValueText() const override;
private:
EventReturn HandleClick(EventParams &e);
EventReturn HandleChange(EventParams &e);
void HandleClick(EventParams &e);
void HandleChange(EventParams &e);
RequesterToken token_;
ScreenManager *screenManager_;
std::string *value_;
+3 -7
View File
@@ -552,14 +552,13 @@ std::string ListView::DescribeText() const {
return DescribeListOrdered(u->T("List:"));
}
EventReturn ListView::OnItemCallback(int num, EventParams &e) {
void ListView::OnItemCallback(int num, EventParams &e) {
EventParams ev{};
ev.v = nullptr;
ev.a = num;
adaptor_->SetSelected(num);
OnChoice.Trigger(ev);
CreateAllItems();
return EVENT_DONE;
}
View *ChoiceListAdaptor::CreateItemView(int index, ImageID *optionalImageID) {
@@ -570,13 +569,11 @@ View *ChoiceListAdaptor::CreateItemView(int index, ImageID *optionalImageID) {
return choice;
}
bool ChoiceListAdaptor::AddEventCallback(View *view, std::function<EventReturn(EventParams &)> callback) {
void ChoiceListAdaptor::AddEventCallback(View *view, std::function<void(EventParams &)> callback) {
Choice *choice = (Choice *)view;
choice->OnClick.Add(callback);
return EVENT_DONE;
}
View *StringVectorListAdaptor::CreateItemView(int index, ImageID *optionalImageID) {
Choice *choice = new Choice(items_[index], "", index == selected_);
if (optionalImageID) {
@@ -585,10 +582,9 @@ View *StringVectorListAdaptor::CreateItemView(int index, ImageID *optionalImageI
return choice;
}
bool StringVectorListAdaptor::AddEventCallback(View *view, std::function<EventReturn(EventParams &)> callback) {
void StringVectorListAdaptor::AddEventCallback(View *view, std::function<void(EventParams &)> callback) {
Choice *choice = (Choice *)view;
choice->OnClick.Add(callback);
return EVENT_DONE;
}
} // namespace
+4 -4
View File
@@ -91,7 +91,7 @@ public:
virtual ~ListAdaptor() {}
virtual View *CreateItemView(int index, ImageID *optionalImageID) = 0;
virtual int GetNumItems() = 0;
virtual bool AddEventCallback(View *view, std::function<EventReturn(EventParams &)> callback) { return false; }
virtual void AddEventCallback(View *view, std::function<void(EventParams &)> callback) {}
virtual std::string GetTitle(int index) const { return ""; }
virtual void SetSelected(int sel) { }
virtual int GetSelected() { return -1; }
@@ -102,7 +102,7 @@ public:
ChoiceListAdaptor(const char *items[], int numItems) : items_(items), numItems_(numItems) {}
View *CreateItemView(int index, ImageID *optionalImageID) override;
int GetNumItems() override { return numItems_; }
bool AddEventCallback(View *view, std::function<EventReturn(EventParams &)> callback) override;
void AddEventCallback(View *view, std::function<void(EventParams &)> callback) override;
private:
const char **items_;
@@ -116,7 +116,7 @@ public:
StringVectorListAdaptor(const std::vector<std::string> &items, int selected = -1) : items_(items), selected_(selected) {}
View *CreateItemView(int index, ImageID *optionalImageID) override;
int GetNumItems() override { return (int)items_.size(); }
bool AddEventCallback(View *view, std::function<EventReturn(EventParams &)> callback) override;
void AddEventCallback(View *view, std::function<void(EventParams &)> callback) override;
void SetSelected(int sel) override { selected_ = sel; }
std::string GetTitle(int index) const override { return items_[index]; }
int GetSelected() override { return selected_; }
@@ -141,7 +141,7 @@ public:
private:
void CreateAllItems();
EventReturn OnItemCallback(int num, EventParams &e);
void OnItemCallback(int num, EventParams &e);
ListAdaptor *adaptor_;
LinearLayout *linLayout_;
float maxHeight_;
+3 -6
View File
@@ -285,19 +285,16 @@ void UIDialogScreen::sendMessage(UIMessage message, const char *value) {
}
}
UI::EventReturn UIScreen::OnBack(UI::EventParams &e) {
void UIScreen::OnBack(UI::EventParams &e) {
TriggerFinish(DR_BACK);
return UI::EVENT_DONE;
}
UI::EventReturn UIScreen::OnOK(UI::EventParams &e) {
void UIScreen::OnOK(UI::EventParams &e) {
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
}
UI::EventReturn UIScreen::OnCancel(UI::EventParams &e) {
void UIScreen::OnCancel(UI::EventParams &e) {
TriggerFinish(DR_CANCEL);
return UI::EVENT_DONE;
}
PopupScreen::PopupScreen(std::string_view title, std::string_view button1, std::string_view button2)
+3 -3
View File
@@ -53,9 +53,9 @@ public:
virtual void TriggerFinish(DialogResult result);
// Some useful default event handlers
UI::EventReturn OnOK(UI::EventParams &e);
UI::EventReturn OnCancel(UI::EventParams &e);
UI::EventReturn OnBack(UI::EventParams &e);
void OnOK(UI::EventParams &e);
void OnCancel(UI::EventParams &e);
void OnBack(UI::EventParams &e);
protected:
virtual void CreateViews() = 0;
+2 -4
View File
@@ -64,7 +64,7 @@ void ApplyBoundsBySpec(Bounds &bounds, MeasureSpec horiz, MeasureSpec vert) {
ApplyBoundBySpec(bounds.h, vert);
}
void Event::Add(std::function<EventReturn(EventParams&)> func) {
void Event::Add(std::function<void(EventParams&)> func) {
_dbg_assert_(!func_);
func_ = func;
}
@@ -78,10 +78,9 @@ void Event::Trigger(EventParams &e) {
}
// Call this from UI thread
EventReturn Event::Dispatch(EventParams &e) {
void Event::Dispatch(EventParams &e) {
if (func_)
func_(e);
return UI::EVENT_DONE;
}
Event::~Event() {
@@ -138,7 +137,6 @@ std::string View::DescribeLog() const {
return StringFromFormat("%0.1f,%0.1f %0.1fx%0.1f", bounds_.x, bounds_.y, bounds_.w, bounds_.h);
}
void View::PersistData(PersistStatus status, std::string anonId, PersistMap &storage) {
// Remember if this view was a focused view.
std::string tag = Tag();
+6 -10
View File
@@ -211,12 +211,6 @@ enum MeasureSpecType {
AT_MOST,
};
// I hope I can find a way to simplify this one day.
enum EventReturn {
EVENT_DONE, // Return this when no other view may process this event, for example if you changed the view hierarchy
EVENT_CONTINUE, // Return this if it's safe to send this event to further listeners. This should normally be the default choice but often EVENT_DONE is necessary.
};
enum FocusFlags {
FF_LOSTFOCUS = 1,
FF_GOTFOCUS = 2
@@ -252,6 +246,8 @@ struct EventParams {
std::string s;
};
typedef std::function<void(EventParams &)> EventCallback;
class Event {
public:
Event() {}
@@ -259,20 +255,20 @@ public:
// Call this from input thread or whatever, it doesn't matter
void Trigger(EventParams &e);
// Call this from UI thread
EventReturn Dispatch(EventParams &e);
void Dispatch(EventParams &e);
// This is now the suggested default way to bind a handler - just used a lambda, and if necessary call other functions.
void Add(std::function<EventReturn(EventParams &)> func);
void Add(EventCallback func);
// The old way of doing things.
template<class T>
T *Handle(T *thiz, EventReturn (T::* theCallback)(EventParams &)) {
T *Handle(T *thiz, void (T::* theCallback)(EventParams &)) {
Add(std::bind(theCallback, thiz, std::placeholders::_1));
return thiz;
}
private:
std::function<EventReturn(EventParams&)> func_;
std::function<void(EventParams&)> func_;
DISALLOW_COPY_AND_ASSIGN(Event);
};
+3 -6
View File
@@ -1071,7 +1071,6 @@ bool TabHolder::SetCurrentTab(int tab, bool skipTween) {
tween = new AnchorTranslateTween(0.15f, bezierEaseInOut);
tween->Finish.Add([&](EventParams &e) {
e.v->SetVisibility(tabs_[currentTab_] == e.v ? V_VISIBLE : V_GONE);
return EVENT_DONE;
});
view->AddTween(tween)->Persist();
};
@@ -1113,14 +1112,13 @@ bool TabHolder::SetCurrentTab(int tab, bool skipTween) {
return created;
}
EventReturn TabHolder::OnTabClick(EventParams &e) {
void TabHolder::OnTabClick(EventParams &e) {
// We have e.b set when it was an explicit click action.
// In that case, we make the view gone and then visible - this scrolls scrollviews to the top.
if (e.b != 0) {
EnsureTab(e.a);
SetCurrentTab((int)e.a);
}
return EVENT_DONE;
}
void TabHolder::PersistData(PersistStatus status, std::string anonId, PersistMap &storage) {
@@ -1176,7 +1174,7 @@ void ChoiceStrip::AddChoice(ImageID buttonImage) {
c->Press();
}
EventReturn ChoiceStrip::OnChoiceClick(EventParams &e) {
void ChoiceStrip::OnChoiceClick(EventParams &e) {
// Unstick the other choices that weren't clicked.
for (int i = 0; i < (int)views_.size(); i++) {
if (views_[i] != e.v) {
@@ -1192,7 +1190,7 @@ EventReturn ChoiceStrip::OnChoiceClick(EventParams &e) {
// Set to 1 to indicate an explicit click.
e2.b = 1;
// Dispatch immediately (we're already on the UI thread as we're in an event handler).
return OnChoice.Dispatch(e2);
OnChoice.Dispatch(e2);
}
void ChoiceStrip::SetSelection(int sel, bool triggerClick) {
@@ -1263,7 +1261,6 @@ CollapsibleSection::CollapsibleSection(std::string_view title, LayoutParams *lay
// Change the visibility of all children except the first one.
// Later maybe try something more ambitious.
UpdateVisibility();
return UI::EVENT_DONE;
});
}
+2 -2
View File
@@ -283,7 +283,7 @@ public:
private:
StickyChoice *Choice(int index);
EventReturn OnChoiceClick(EventParams &e);
void OnChoiceClick(EventParams &e);
int selected_ = 0; // Can be controlled with L/R.
bool topTabs_ = false;
@@ -323,7 +323,7 @@ public:
private:
void AddTabContents(std::string_view title, ViewGroup *tabContents);
EventReturn OnTabClick(EventParams &e);
void OnTabClick(EventParams &e);
bool EnsureTab(int index); // return true if it actually created a tab.
View *bannerView_ = nullptr;
+7 -15
View File
@@ -96,15 +96,14 @@ void ChatMenu::CreateSubviews(const Bounds &screenBounds) {
UpdateChat();
}
UI::EventReturn ChatMenu::OnSubmitMessage(UI::EventParams &e) {
void ChatMenu::OnSubmitMessage(UI::EventParams &e) {
std::string chat = chatEdit_->GetText();
chatEdit_->SetText("");
chatEdit_->SetFocus();
sendChat(chat);
return UI::EVENT_DONE;
}
UI::EventReturn ChatMenu::OnAskForChatMessage(UI::EventParams &e) {
void ChatMenu::OnAskForChatMessage(UI::EventParams &e) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
using namespace UI;
@@ -122,37 +121,30 @@ UI::EventReturn ChatMenu::OnAskForChatMessage(UI::EventParams &e) {
}
popupScreen->OnChange.Add([=](UI::EventParams &e) {
sendChat(messageTemp_);
return UI::EVENT_DONE;
});
popupScreen->SetPopupOrigin(chatButton_);
screenManager_->push(popupScreen);
}
return UI::EVENT_DONE;
}
UI::EventReturn ChatMenu::OnQuickChat1(UI::EventParams &e) {
void ChatMenu::OnQuickChat1(UI::EventParams &e) {
sendChat(g_Config.sQuickChat0);
return UI::EVENT_DONE;
}
UI::EventReturn ChatMenu::OnQuickChat2(UI::EventParams &e) {
void ChatMenu::OnQuickChat2(UI::EventParams &e) {
sendChat(g_Config.sQuickChat1);
return UI::EVENT_DONE;
}
UI::EventReturn ChatMenu::OnQuickChat3(UI::EventParams &e) {
void ChatMenu::OnQuickChat3(UI::EventParams &e) {
sendChat(g_Config.sQuickChat2);
return UI::EVENT_DONE;
}
UI::EventReturn ChatMenu::OnQuickChat4(UI::EventParams &e) {
void ChatMenu::OnQuickChat4(UI::EventParams &e) {
sendChat(g_Config.sQuickChat3);
return UI::EVENT_DONE;
}
UI::EventReturn ChatMenu::OnQuickChat5(UI::EventParams &e) {
void ChatMenu::OnQuickChat5(UI::EventParams &e) {
sendChat(g_Config.sQuickChat4);
return UI::EVENT_DONE;
}
void ChatMenu::UpdateChat() {
+7 -7
View File
@@ -25,14 +25,14 @@ private:
void CreateContents(UI::ViewGroup *parent);
void UpdateChat();
UI::EventReturn OnAskForChatMessage(UI::EventParams &e);
void OnAskForChatMessage(UI::EventParams &e);
UI::EventReturn OnSubmitMessage(UI::EventParams &e);
UI::EventReturn OnQuickChat1(UI::EventParams &e);
UI::EventReturn OnQuickChat2(UI::EventParams &e);
UI::EventReturn OnQuickChat3(UI::EventParams &e);
UI::EventReturn OnQuickChat4(UI::EventParams &e);
UI::EventReturn OnQuickChat5(UI::EventParams &e);
void OnSubmitMessage(UI::EventParams &e);
void OnQuickChat1(UI::EventParams &e);
void OnQuickChat2(UI::EventParams &e);
void OnQuickChat3(UI::EventParams &e);
void OnQuickChat4(UI::EventParams &e);
void OnQuickChat5(UI::EventParams &e);
UI::TextEdit *chatEdit_ = nullptr;
UI::ScrollView *scroll_ = nullptr;
+16 -28
View File
@@ -65,11 +65,11 @@ public:
private:
void Refresh();
UI::EventReturn OnAdd(UI::EventParams &params);
UI::EventReturn OnAddMouse(UI::EventParams &params);
UI::EventReturn OnDelete(UI::EventParams &params);
UI::EventReturn OnReplace(UI::EventParams &params);
UI::EventReturn OnReplaceAll(UI::EventParams &params);
void OnAdd(UI::EventParams &params);
void OnAddMouse(UI::EventParams &params);
void OnDelete(UI::EventParams &params);
void OnReplace(UI::EventParams &params);
void OnReplaceAll(UI::EventParams &params);
void MappedCallback(const MultiInputMapping &kdf);
@@ -201,32 +201,28 @@ void SingleControlMapper::MappedCallback(const MultiInputMapping &kdf) {
g_IsMappingMouseInput = false;
}
UI::EventReturn SingleControlMapper::OnReplace(UI::EventParams &params) {
void SingleControlMapper::OnReplace(UI::EventParams &params) {
actionIndex_ = atoi(params.v->Tag().c_str());
action_ = REPLACEONE;
scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING));
return UI::EVENT_DONE;
}
UI::EventReturn SingleControlMapper::OnReplaceAll(UI::EventParams &params) {
void SingleControlMapper::OnReplaceAll(UI::EventParams &params) {
action_ = REPLACEALL;
scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING));
return UI::EVENT_DONE;
}
UI::EventReturn SingleControlMapper::OnAdd(UI::EventParams &params) {
void SingleControlMapper::OnAdd(UI::EventParams &params) {
action_ = ADD;
scrm_->push(new KeyMappingNewKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING));
return UI::EVENT_DONE;
}
UI::EventReturn SingleControlMapper::OnAddMouse(UI::EventParams &params) {
void SingleControlMapper::OnAddMouse(UI::EventParams &params) {
action_ = ADD;
g_IsMappingMouseInput = true;
scrm_->push(new KeyMappingNewMouseKeyDialog(pspKey_, true, std::bind(&SingleControlMapper::MappedCallback, this, std::placeholders::_1), I18NCat::KEYMAPPING));
return UI::EVENT_DONE;
}
UI::EventReturn SingleControlMapper::OnDelete(UI::EventParams &params) {
void SingleControlMapper::OnDelete(UI::EventParams &params) {
int index = atoi(params.v->Tag().c_str());
KeyMap::DeleteNthMapping(pspKey_, index);
@@ -234,7 +230,6 @@ UI::EventReturn SingleControlMapper::OnDelete(UI::EventParams &params) {
rows_[index]->SetFocus();
else
SetFocus();
return UI::EVENT_DONE;
}
@@ -263,11 +258,9 @@ void ControlMappingScreen::CreateViews() {
LinearLayout *leftColumn = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(200, FILL_PARENT, Margins(10, 0, 0, 10)));
leftColumn->Add(new Choice(km->T("Clear All")))->OnClick.Add([](UI::EventParams &) {
KeyMap::ClearAllMappings();
return UI::EVENT_DONE;
});
leftColumn->Add(new Choice(km->T("Default All")))->OnClick.Add([](UI::EventParams &) {
KeyMap::RestoreDefault();
return UI::EVENT_DONE;
});
std::string sysName = System_GetProperty(SYSPROP_NAME);
// If there's a builtin controller, restore to default should suffice. No need to conf the controller on top.
@@ -277,7 +270,6 @@ void ControlMappingScreen::CreateViews() {
leftColumn->Add(new Choice(km->T("Show PSP")))->OnClick.Add([=](UI::EventParams &) {
screenManager()->push(new VisualMappingScreen(gamePath_));
return UI::EVENT_DONE;
});
leftColumn->Add(new CheckBox(&g_Config.bAllowMappingCombos, km->T("Allow combo mappings")));
leftColumn->Add(new CheckBox(&g_Config.bStrictComboOrder, km->T("Strict combo input order")));
@@ -330,7 +322,7 @@ void ControlMappingScreen::update() {
SetVRAppMode(VRAppMode::VR_MENU_MODE);
}
UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
void ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
std::vector<std::string> items;
const auto seenPads = KeyMap::GetSeenPads();
for (auto s = seenPads.begin(), end = seenPads.end(); s != end; ++s) {
@@ -341,7 +333,6 @@ UI::EventReturn ControlMappingScreen::OnAutoConfigure(UI::EventParams &params) {
if (params.v)
autoConfList->SetPopupOrigin(params.v);
screenManager()->push(autoConfList);
return UI::EVENT_DONE;
}
void ControlMappingScreen::dialogFinished(const Screen *dialog, DialogResult result) {
@@ -599,13 +590,12 @@ void AnalogSetupScreen::CreateViews() {
AddStandardBack(leftColumn);
}
UI::EventReturn AnalogSetupScreen::OnResetToDefaults(UI::EventParams &e) {
void AnalogSetupScreen::OnResetToDefaults(UI::EventParams &e) {
g_Config.fAnalogDeadzone = 0.15f;
g_Config.fAnalogInverseDeadzone = 0.0f;
g_Config.fAnalogSensitivity = 1.1f;
g_Config.bAnalogIsCircular = false;
g_Config.fAnalogAutoRotSpeed = 8.0f;
return UI::EVENT_DONE;
}
class Backplate : public UI::InertView {
@@ -793,7 +783,7 @@ private:
UI::AnchorLayoutParams *LayoutSize(float w, float h, float l, float t);
MockButton *AddButton(int button, ImageID img, ImageID bg, float angle, UI::LayoutParams *lp);
UI::EventReturn OnSelectButton(UI::EventParams &e);
void OnSelectButton(UI::EventParams &e);
std::unordered_map<int, MockButton *> buttons_;
UI::TextView *labelView_ = nullptr;
@@ -890,7 +880,7 @@ MockButton *MockPSP::AddButton(int button, ImageID img, ImageID bg, float angle,
return view;
}
UI::EventReturn MockPSP::OnSelectButton(UI::EventParams &e) {
void MockPSP::OnSelectButton(UI::EventParams &e) {
auto view = (MockButton *)e.v;
e.a = view->Button();
return ButtonClick.Dispatch(e);
@@ -992,17 +982,15 @@ void VisualMappingScreen::resized() {
RecreateViews();
}
UI::EventReturn VisualMappingScreen::OnMapButton(UI::EventParams &e) {
void VisualMappingScreen::OnMapButton(UI::EventParams &e) {
nextKey_ = e.a;
MapNext(false);
return UI::EVENT_DONE;
}
UI::EventReturn VisualMappingScreen::OnBindAll(UI::EventParams &e) {
void VisualMappingScreen::OnBindAll(UI::EventParams &e) {
bindAll_ = 0;
nextKey_ = bindAllOrder[bindAll_];
MapNext(false);
return UI::EVENT_DONE;
}
void VisualMappingScreen::HandleKeyMapping(const KeyMap::MultiInputMapping &key) {
+4 -4
View File
@@ -49,7 +49,7 @@ protected:
void update() override;
private:
UI::EventReturn OnAutoConfigure(UI::EventParams &params);
void OnAutoConfigure(UI::EventParams &params);
void dialogFinished(const Screen *dialog, DialogResult result) override;
@@ -135,7 +135,7 @@ protected:
void CreateViews() override;
private:
UI::EventReturn OnResetToDefaults(UI::EventParams &e);
void OnResetToDefaults(UI::EventParams &e);
ControlMapper mapper_;
@@ -165,8 +165,8 @@ protected:
void resized() override;
private:
UI::EventReturn OnMapButton(UI::EventParams &e);
UI::EventReturn OnBindAll(UI::EventParams &e);
void OnMapButton(UI::EventParams &e);
void OnBindAll(UI::EventParams &e);
void HandleKeyMapping(const KeyMap::MultiInputMapping &key);
void MapNext(bool successive);
+1 -6
View File
@@ -47,7 +47,6 @@ public:
c->OnClick.Add([=](UI::EventParams &e) {
*setting_ = i;
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
});
}
@@ -77,7 +76,6 @@ public:
c->OnClick.Add([=](UI::EventParams &e) {
*setting_ = i;
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
});
}
@@ -159,7 +157,6 @@ void CustomButtonMappingScreen::CreateViews() {
iconScreen->SetPopupOrigin(e.v);
screenManager()->push(iconScreen);
return UI::EVENT_DONE;
});
Choice *shape = vertLayout->Add(new Choice(co->T("Shape")));
@@ -170,7 +167,6 @@ void CustomButtonMappingScreen::CreateViews() {
shape->SetPopupOrigin(e.v);
screenManager()->push(shape);
return UI::EVENT_DONE;
});
vertLayout->Add(new ItemHeader(co->T("Button Binding")));
@@ -234,7 +230,6 @@ void CustomButtonMappingScreen::onFinish(DialogResult result) {
g_Config.Save("CustomButtonMappingScreen::onFinish");
}
UI::EventReturn CustomButtonMappingScreen::ChoiceEventHandler::onChoiceClick(UI::EventParams &e){
void CustomButtonMappingScreen::ChoiceEventHandler::onChoiceClick(UI::EventParams &e){
checkbox_->Toggle();
return UI::EVENT_DONE;
};
+1 -1
View File
@@ -46,7 +46,7 @@ private:
class ChoiceEventHandler{
public:
ChoiceEventHandler(UI::CheckBox *checkbox) : checkbox_(checkbox) {}
UI::EventReturn onChoiceClick(UI::EventParams &e);
void onChoiceClick(UI::EventParams &e);
private:
UI::CheckBox *checkbox_;
};
+6 -15
View File
@@ -168,7 +168,7 @@ void CwCheatScreen::onFinish(DialogResult result) {
}
}
UI::EventReturn CwCheatScreen::OnDisableAll(UI::EventParams &params) {
void CwCheatScreen::OnDisableAll(UI::EventParams &params) {
// Disable all the switches.
for (auto &info : fileInfo_) {
info.enabled = false;
@@ -179,17 +179,14 @@ UI::EventReturn CwCheatScreen::OnDisableAll(UI::EventParams &params) {
// TODO: Report error.
RecreateViews();
}
return UI::EVENT_DONE;
}
UI::EventReturn CwCheatScreen::OnAddCheat(UI::EventParams &params) {
void CwCheatScreen::OnAddCheat(UI::EventParams &params) {
TriggerFinish(DR_OK);
g_Config.bReloadCheats = true;
return UI::EVENT_DONE;
}
UI::EventReturn CwCheatScreen::OnEditCheatFile(UI::EventParams &params) {
void CwCheatScreen::OnEditCheatFile(UI::EventParams &params) {
g_Config.bReloadCheats = true;
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
if (MIPSComp::jit) {
@@ -198,7 +195,6 @@ UI::EventReturn CwCheatScreen::OnEditCheatFile(UI::EventParams &params) {
if (engine_) {
File::OpenFileInEditor(engine_->CheatFilename());
}
return UI::EVENT_DONE;
}
static char *GetLineNoNewline(char *temp, int sz, FILE *fp) {
@@ -213,7 +209,7 @@ static char *GetLineNoNewline(char *temp, int sz, FILE *fp) {
return line;
}
UI::EventReturn CwCheatScreen::OnImportBrowse(UI::EventParams &params) {
void CwCheatScreen::OnImportBrowse(UI::EventParams &params) {
System_BrowseForFile(GetRequesterToken(), "Open cheat DB file", BrowseFileType::DB, [&](const std::string &value, int) {
Path path(value);
INFO_LOG(Log::System, "Attempting to load cheats from: '%s'", path.ToVisualString().c_str());
@@ -224,19 +220,16 @@ UI::EventReturn CwCheatScreen::OnImportBrowse(UI::EventParams &params) {
}
RecreateViews();
});
return UI::EVENT_DONE;
}
UI::EventReturn CwCheatScreen::OnImportCheat(UI::EventParams &params) {
void CwCheatScreen::OnImportCheat(UI::EventParams &params) {
if (!ImportCheats(GetGlobalCheatFilePath())) {
// Show an error message?
errorMessageView_->SetVisibility(UI::V_VISIBLE);
return UI::EVENT_DONE;
}
g_Config.bReloadCheats = true;
RecreateViews();
return UI::EVENT_DONE;
}
bool CwCheatScreen::ImportCheats(const Path & cheatFile) {
@@ -329,13 +322,11 @@ bool CwCheatScreen::ImportCheats(const Path & cheatFile) {
return true;
}
UI::EventReturn CwCheatScreen::OnCheckBox(int index) {
void CwCheatScreen::OnCheckBox(int index) {
if (!RebuildCheatFile(index)) {
// TODO: Report error. Let's reload the file, presumably it changed.
RecreateViews();
}
return UI::EVENT_DONE;
}
bool CwCheatScreen::HasCheatWithName(const std::string &name) {
+6 -6
View File
@@ -35,11 +35,11 @@ public:
bool TryLoadCheatInfo();
UI::EventReturn OnAddCheat(UI::EventParams &params);
UI::EventReturn OnImportCheat(UI::EventParams &params);
UI::EventReturn OnImportBrowse(UI::EventParams &params);
UI::EventReturn OnEditCheatFile(UI::EventParams &params);
UI::EventReturn OnDisableAll(UI::EventParams &params);
void OnAddCheat(UI::EventParams &params);
void OnImportCheat(UI::EventParams &params);
void OnImportBrowse(UI::EventParams &params);
void OnEditCheatFile(UI::EventParams &params);
void OnDisableAll(UI::EventParams &params);
void update() override;
void onFinish(DialogResult result) override;
@@ -50,7 +50,7 @@ protected:
void CreateViews() override;
private:
UI::EventReturn OnCheckBox(int index);
void OnCheckBox(int index);
bool ImportCheats(const Path &cheatFile);
enum { INDEX_ALL = -1 };
+17 -58
View File
@@ -143,18 +143,15 @@ void DevMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
items->Add(new Choice(dev->T("Log View")))->OnClick.Add([this](UI::EventParams & e) {
UpdateUIState(UISTATE_PAUSEMENU);
screenManager()->push(new LogViewScreen());
return UI::EVENT_DONE;
});
items->Add(new Choice(dev->T("Logging Channels")))->OnClick.Add([this](UI::EventParams & e) {
UpdateUIState(UISTATE_PAUSEMENU);
screenManager()->push(new LogConfigScreen());
return UI::EVENT_DONE;
});
items->Add(new Choice(dev->T("Debugger")))->OnClick.Add([](UI::EventParams &e) {
g_Config.bShowImDebugger = !g_Config.bShowImDebugger;
return UI::EVENT_DONE;
});
if (WebServerRunning(WebServerFlags::DEBUGGER)) {
@@ -168,7 +165,6 @@ void DevMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
} else {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "http://ppsspp-debugger.unknownbrackets.org/cpu"); // NOTE: https doesn't work
}
return UI::EVENT_DONE;
});
}
@@ -186,20 +182,17 @@ void DevMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
} else {
PSP_CoreParameter().freezeNext = true;
}
return UI::EVENT_DONE;
});
items->Add(new Choice(dev->T("Reset limited logging")))->OnClick.Handle(this, &DevMenuScreen::OnResetLimitedLogging);
items->Add(new Choice(dev->T("GPI/GPO switches/LEDs")))->OnClick.Add([=](UI::EventParams &e) {
screenManager()->push(new GPIGPOScreen(dev->T("GPI/GPO switches/LEDs")));
return UI::EVENT_DONE;
});
if (PSP_CoreParameter().fileType != IdentifiedFileType::PPSSPP_GE_DUMP) {
items->Add(new Choice(dev->T("Create frame dump")))->OnClick.Add([](UI::EventParams &e) {
SaveFrameDump();
return UI::EVENT_DONE;
});
}
@@ -207,7 +200,6 @@ void DevMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_DESKTOP) {
items->Add(new Choice(dev->T("Dump next frame to log")))->OnClick.Add([](UI::EventParams &e) {
gpu->DumpNextFrame();
return UI::EVENT_DONE;
});
}
@@ -217,28 +209,24 @@ void DevMenuScreen::CreatePopupContents(UI::ViewGroup *parent) {
g_logManager.EnableOutput(LogOutput::RingBuffer);
}
UI::EventReturn DevMenuScreen::OnResetLimitedLogging(UI::EventParams &e) {
void DevMenuScreen::OnResetLimitedLogging(UI::EventParams &e) {
Reporting::ResetCounts();
return UI::EVENT_DONE;
}
UI::EventReturn DevMenuScreen::OnDeveloperTools(UI::EventParams &e) {
void DevMenuScreen::OnDeveloperTools(UI::EventParams &e) {
UpdateUIState(UISTATE_PAUSEMENU);
screenManager()->push(new DeveloperToolsScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn DevMenuScreen::OnJitCompare(UI::EventParams &e) {
void DevMenuScreen::OnJitCompare(UI::EventParams &e) {
UpdateUIState(UISTATE_PAUSEMENU);
screenManager()->push(new JitCompareScreen());
return UI::EVENT_DONE;
}
UI::EventReturn DevMenuScreen::OnShaderView(UI::EventParams &e) {
void DevMenuScreen::OnShaderView(UI::EventParams &e) {
UpdateUIState(UISTATE_PAUSEMENU);
if (gpu) // Avoid crashing if chosen while the game is being loaded.
screenManager()->push(new ShaderListScreen());
return UI::EVENT_DONE;
}
void DevMenuScreen::dialogFinished(const Screen *dialog, DialogResult result) {
@@ -336,36 +324,32 @@ void LogConfigScreen::CreateViews() {
}
}
UI::EventReturn LogConfigScreen::OnToggleAll(UI::EventParams &e) {
void LogConfigScreen::OnToggleAll(UI::EventParams &e) {
for (int i = 0; i < LogManager::GetNumChannels(); i++) {
LogChannel *chan = g_logManager.GetLogChannel((Log)i);
chan->enabled = !chan->enabled;
}
return UI::EVENT_DONE;
}
UI::EventReturn LogConfigScreen::OnEnableAll(UI::EventParams &e) {
void LogConfigScreen::OnEnableAll(UI::EventParams &e) {
for (int i = 0; i < LogManager::GetNumChannels(); i++) {
LogChannel *chan = g_logManager.GetLogChannel((Log)i);
chan->enabled = true;
}
return UI::EVENT_DONE;
}
UI::EventReturn LogConfigScreen::OnDisableAll(UI::EventParams &e) {
void LogConfigScreen::OnDisableAll(UI::EventParams &e) {
for (int i = 0; i < LogManager::GetNumChannels(); i++) {
LogChannel *chan = g_logManager.GetLogChannel((Log)i);
chan->enabled = false;
}
return UI::EVENT_DONE;
}
UI::EventReturn LogConfigScreen::OnLogLevelChange(UI::EventParams &e) {
void LogConfigScreen::OnLogLevelChange(UI::EventParams &e) {
RecreateViews();
return UI::EVENT_DONE;
}
UI::EventReturn LogConfigScreen::OnLogLevel(UI::EventParams &e) {
void LogConfigScreen::OnLogLevel(UI::EventParams &e) {
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
auto logLevelScreen = new LogLevelScreen(dev->T("Log Level"));
@@ -373,7 +357,6 @@ UI::EventReturn LogConfigScreen::OnLogLevel(UI::EventParams &e) {
if (e.v)
logLevelScreen->SetPopupOrigin(e.v);
screenManager()->push(logLevelScreen);
return UI::EVENT_DONE;
}
LogLevelScreen::LogLevelScreen(std::string_view title) : ListPopupScreen(title) {
@@ -459,14 +442,12 @@ void JitDebugScreen::CreateViews() {
}
}
UI::EventReturn JitDebugScreen::OnEnableAll(UI::EventParams &e) {
void JitDebugScreen::OnEnableAll(UI::EventParams &e) {
g_Config.uJitDisableFlags &= ~(uint32_t)MIPSComp::JitDisable::ALL_FLAGS;
return UI::EVENT_DONE;
}
UI::EventReturn JitDebugScreen::OnDisableAll(UI::EventParams &e) {
void JitDebugScreen::OnDisableAll(UI::EventParams &e) {
g_Config.uJitDisableFlags |= (uint32_t)MIPSComp::JitDisable::ALL_FLAGS;
return UI::EVENT_DONE;
}
void SystemInfoScreen::update() {
@@ -475,7 +456,7 @@ void SystemInfoScreen::update() {
}
// TODO: How can we de-duplicate this and SystemInfoScreen::CreateTabs?
UI::EventReturn SystemInfoScreen::CopySummaryToClipboard(UI::EventParams &e) {
void SystemInfoScreen::CopySummaryToClipboard(UI::EventParams &e) {
auto di = GetI18NCategory(I18NCat::DIALOG);
auto si = GetI18NCategory(I18NCat::DIALOG);
@@ -510,7 +491,6 @@ UI::EventReturn SystemInfoScreen::CopySummaryToClipboard(UI::EventParams &e) {
delete[] summary;
g_OSD.Show(OSDType::MESSAGE_INFO, ApplySafeSubstitutions(di->T("Copied to clipboard: %1"), si->T("System Information")));
return UI::EVENT_DONE;
}
void SystemInfoScreen::CreateTabs() {
@@ -968,7 +948,6 @@ void SystemInfoScreen::CreateInternalsTab(UI::ViewGroup *internals) {
internals->Add(new Choice(di->T("Clear")))->OnClick.Add([&](UI::EventParams &) {
g_iconCache.ClearData();
RecreateViews();
return UI::EVENT_DONE;
});
internals->Add(new ItemHeader(si->T("Font cache")));
@@ -985,15 +964,12 @@ void SystemInfoScreen::CreateInternalsTab(UI::ViewGroup *internals) {
internals->Add(new Choice(si->T("Error")))->OnClick.Add([&](UI::EventParams &) {
std::string str = "Error " + CodepointToUTF8(0x1F41B) + CodepointToUTF8(0x1F41C) + CodepointToUTF8(0x1F914);
g_OSD.Show(OSDType::MESSAGE_ERROR, str);
return UI::EVENT_DONE;
});
internals->Add(new Choice(si->T("Warning")))->OnClick.Add([&](UI::EventParams &) {
g_OSD.Show(OSDType::MESSAGE_WARNING, "Warning", "Some\nAdditional\nDetail");
return UI::EVENT_DONE;
});
internals->Add(new Choice(si->T("Info")))->OnClick.Add([&](UI::EventParams &) {
g_OSD.Show(OSDType::MESSAGE_INFO, "Info");
return UI::EVENT_DONE;
});
// This one is clickable
internals->Add(new Choice(si->T("Success")))->OnClick.Add([&](UI::EventParams &) {
@@ -1003,45 +979,35 @@ void SystemInfoScreen::CreateInternalsTab(UI::ViewGroup *internals) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.google.com/");
}
}, nullptr);
return UI::EVENT_DONE;
});
internals->Add(new Choice(sy->T("RetroAchievements")))->OnClick.Add([&](UI::EventParams &) {
g_OSD.Show(OSDType::MESSAGE_WARNING, "RetroAchievements warning", "", "I_RETROACHIEVEMENTS_LOGO");
return UI::EVENT_DONE;
});
internals->Add(new ItemHeader(si->T("Progress tests")));
internals->Add(new Choice(si->T("30%")))->OnClick.Add([&](UI::EventParams &) {
g_OSD.SetProgressBar("testprogress", "Test Progress", 1, 100, 30, 0.0f);
return UI::EVENT_DONE;
});
internals->Add(new Choice(si->T("100%")))->OnClick.Add([&](UI::EventParams &) {
g_OSD.SetProgressBar("testprogress", "Test Progress", 1, 100, 100, 1.0f);
return UI::EVENT_DONE;
});
internals->Add(new Choice(si->T("N/A%")))->OnClick.Add([&](UI::EventParams &) {
g_OSD.SetProgressBar("testprogress", "Test Progress", 0, 0, 0, 0.0f);
return UI::EVENT_DONE;
});
internals->Add(new Choice(si->T("Success")))->OnClick.Add([&](UI::EventParams &) {
g_OSD.RemoveProgressBar("testprogress", true, 0.5f);
return UI::EVENT_DONE;
});
internals->Add(new Choice(si->T("Failure")))->OnClick.Add([&](UI::EventParams &) {
g_OSD.RemoveProgressBar("testprogress", false, 0.5f);
return UI::EVENT_DONE;
});
internals->Add(new ItemHeader(si->T("Achievement tests")));
internals->Add(new Choice(si->T("Leaderboard tracker: Show")))->OnClick.Add([=](UI::EventParams &) {
g_OSD.ShowLeaderboardTracker(1, "My leaderboard tracker", true);
return UI::EVENT_DONE;
});
internals->Add(new Choice(si->T("Leaderboard tracker: Update")))->OnClick.Add([=](UI::EventParams &) {
g_OSD.ShowLeaderboardTracker(1, "Updated tracker", true);
return UI::EVENT_DONE;
});
internals->Add(new Choice(si->T("Leaderboard tracker: Hide")))->OnClick.Add([=](UI::EventParams &) {
g_OSD.ShowLeaderboardTracker(1, nullptr, false);
return UI::EVENT_DONE;
});
static const char *positions[] = { "Bottom Left", "Bottom Center", "Bottom Right", "Top Left", "Top Center", "Top Right", "Center Left", "Center Right", "None" };
@@ -1053,13 +1019,11 @@ void SystemInfoScreen::CreateInternalsTab(UI::ViewGroup *internals) {
// Untranslated string because this is debug mode only, only for PPSSPP developers.
internals->Add(new Choice("Assert"))->OnClick.Add([=](UI::EventParams &) {
_dbg_assert_msg_(false, "Test assert message");
return UI::EVENT_DONE;
});
#endif
#if PPSSPP_PLATFORM(ANDROID)
internals->Add(new Choice(si->T("Exception")))->OnClick.Add([&](UI::EventParams &) {
System_Notify(SystemNotification::TEST_JAVA_EXCEPTION);
return UI::EVENT_DONE;
});
#endif
}
@@ -1109,12 +1073,11 @@ void ShaderListScreen::CreateViews() {
}
}
UI::EventReturn ShaderListScreen::OnShaderClick(UI::EventParams &e) {
void ShaderListScreen::OnShaderClick(UI::EventParams &e) {
using namespace UI;
std::string id = e.v->Tag();
DebugShaderType type = shaderTypes[tabs_->GetCurrentTab()].type;
screenManager()->push(new ShaderViewScreen(id, type));
return EVENT_DONE;
}
void ShaderViewScreen::CreateViews() {
@@ -1195,14 +1158,13 @@ void FrameDumpTestScreen::CreateViews() {
}
}
UI::EventReturn FrameDumpTestScreen::OnLoadDump(UI::EventParams &params) {
void FrameDumpTestScreen::OnLoadDump(UI::EventParams &params) {
Path url = Path(params.v->Tag());
INFO_LOG(Log::Common, "Trying to launch '%s'", url.c_str());
// Our disc streaming functionality detects the URL and takes over and handles loading framedumps well,
// except for some reason the game ID.
// TODO: Fix that since it can be important for compat settings.
screenManager()->switchScreen(new EmuScreen(url));
return UI::EVENT_DONE;
}
void FrameDumpTestScreen::update() {
@@ -1436,21 +1398,18 @@ void RecreateActivity() {
}
}
UI::EventReturn TouchTestScreen::OnImmersiveModeChange(UI::EventParams &e) {
void TouchTestScreen::OnImmersiveModeChange(UI::EventParams &e) {
System_Notify(SystemNotification::IMMERSIVE_MODE_CHANGE);
if (g_Config.iAndroidHwScale != 0) {
RecreateActivity();
}
return UI::EVENT_DONE;
}
UI::EventReturn TouchTestScreen::OnRenderingBackend(UI::EventParams &e) {
void TouchTestScreen::OnRenderingBackend(UI::EventParams &e) {
g_Config.Save("GameSettingsScreen::RenderingBackend");
System_RestartApp("--touchscreentest");
return UI::EVENT_DONE;
}
UI::EventReturn TouchTestScreen::OnRecreateActivity(UI::EventParams &e) {
void TouchTestScreen::OnRecreateActivity(UI::EventParams &e) {
RecreateActivity();
return UI::EVENT_DONE;
}
+17 -17
View File
@@ -38,10 +38,10 @@ public:
void dialogFinished(const Screen *dialog, DialogResult result) override;
protected:
UI::EventReturn OnJitCompare(UI::EventParams &e);
UI::EventReturn OnShaderView(UI::EventParams &e);
UI::EventReturn OnDeveloperTools(UI::EventParams &e);
UI::EventReturn OnResetLimitedLogging(UI::EventParams &e);
void OnJitCompare(UI::EventParams &e);
void OnShaderView(UI::EventParams &e);
void OnDeveloperTools(UI::EventParams &e);
void OnResetLimitedLogging(UI::EventParams &e);
private:
Path gamePath_;
@@ -55,8 +55,8 @@ public:
const char *tag() const override { return "JitDebug"; }
private:
UI::EventReturn OnEnableAll(UI::EventParams &e);
UI::EventReturn OnDisableAll(UI::EventParams &e);
void OnEnableAll(UI::EventParams &e);
void OnDisableAll(UI::EventParams &e);
};
class LogConfigScreen : public UIDialogScreenWithBackground {
@@ -67,11 +67,11 @@ public:
const char *tag() const override { return "LogConfig"; }
private:
UI::EventReturn OnToggleAll(UI::EventParams &e);
UI::EventReturn OnEnableAll(UI::EventParams &e);
UI::EventReturn OnDisableAll(UI::EventParams &e);
UI::EventReturn OnLogLevel(UI::EventParams &e);
UI::EventReturn OnLogLevelChange(UI::EventParams &e);
void OnToggleAll(UI::EventParams &e);
void OnEnableAll(UI::EventParams &e);
void OnDisableAll(UI::EventParams &e);
void OnLogLevel(UI::EventParams &e);
void OnLogLevelChange(UI::EventParams &e);
};
class LogViewScreen : public UIDialogScreenWithBackground {
@@ -110,7 +110,7 @@ public:
void resized() override { RecreateViews(); }
protected:
UI::EventReturn CopySummaryToClipboard(UI::EventParams &e);
void CopySummaryToClipboard(UI::EventParams &e);
bool ShowSearchControls() const override { return false; }
private:
@@ -144,7 +144,7 @@ public:
private:
int ListShaders(DebugShaderType shaderType, UI::LinearLayout *view);
UI::EventReturn OnShaderClick(UI::EventParams &e);
void OnShaderClick(UI::EventParams &e);
UI::TabHolder *tabs_;
};
@@ -175,7 +175,7 @@ public:
const char *tag() const override { return "FrameDumpTest"; }
private:
UI::EventReturn OnLoadDump(UI::EventParams &e);
void OnLoadDump(UI::EventParams &e);
std::vector<std::string> files_;
std::shared_ptr<http::Request> listing_;
@@ -218,9 +218,9 @@ protected:
void CreateViews() override;
void UpdateLogView();
UI::EventReturn OnImmersiveModeChange(UI::EventParams &e);
UI::EventReturn OnRenderingBackend(UI::EventParams &e);
UI::EventReturn OnRecreateActivity(UI::EventParams &e);
void OnImmersiveModeChange(UI::EventParams &e);
void OnRenderingBackend(UI::EventParams &e);
void OnRecreateActivity(UI::EventParams &e);
};
void DrawProfile(UIContext &ui);
+15 -46
View File
@@ -110,7 +110,6 @@ void DeveloperToolsScreen::CreateTextureReplacementTab(UI::LinearLayout *list) {
path = GetSysDirectory(DIRECTORY_TEXTURES);
}
System_ShowFileInFolder(path);
return UI::EVENT_DONE;
});
}
@@ -138,7 +137,6 @@ void DeveloperToolsScreen::CreateGeneralTab(UI::LinearLayout *list) {
core->OnChoice.Handle(this, &DeveloperToolsScreen::OnJitAffectingSetting);
core->OnChoice.Add([](UI::EventParams &) {
g_Config.NotifyUpdatedCpuCore();
return UI::EVENT_DONE;
});
if (!canUseJit) {
core->HideChoice(1);
@@ -175,7 +173,6 @@ void DeveloperToolsScreen::CreateGeneralTab(UI::LinearLayout *list) {
list->Add(new Choice(dev->T("GPI/GPO switches/LEDs")))->OnClick.Add([=](UI::EventParams &e) {
screenManager()->push(new GPIGPOScreen(dev->T("GPI/GPO switches/LEDs")));
return UI::EVENT_DONE;
});
#if PPSSPP_PLATFORM(ANDROID)
@@ -184,7 +181,6 @@ void DeveloperToolsScreen::CreateGeneralTab(UI::LinearLayout *list) {
framerateMode->SetEnabledFunc([]() { return System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 30; });
framerateMode->OnChoice.Add([](UI::EventParams &e) {
System_Notify(SystemNotification::FORCE_RECREATE_ACTIVITY);
return UI::EVENT_DONE;
});
#endif
@@ -193,7 +189,6 @@ void DeveloperToolsScreen::CreateGeneralTab(UI::LinearLayout *list) {
list->Add(new Choice(sy->T("Set Memory Stick folder")))->OnClick.Add(
[=](UI::EventParams &) {
SetMemStickDirDarwin(GetRequesterToken());
return UI::EVENT_DONE;
});
#endif
@@ -213,7 +208,6 @@ void DeveloperToolsScreen::CreateTestsTab(UI::LinearLayout *list) {
Choice *frameDumpTests = list->Add(new Choice(dev->T("Framedump tests")));
frameDumpTests->OnClick.Add([this](UI::EventParams &e) {
screenManager()->push(new FrameDumpTestScreen());
return UI::EVENT_DONE;
});
frameDumpTests->SetEnabled(!PSP_IsInited());
// For now, we only implement GPU driver tests for Vulkan and OpenGL. This is simply
@@ -227,7 +221,6 @@ void DeveloperToolsScreen::CreateTestsTab(UI::LinearLayout *list) {
auto memmapTest = list->Add(new Choice(dev->T("Memory map test")));
memmapTest->OnClick.Add([this](UI::EventParams &e) {
MemoryMapTest();
return UI::EVENT_DONE;
});
memmapTest->SetEnabled(PSP_IsInited());
*/
@@ -312,7 +305,6 @@ void DeveloperToolsScreen::CreateMIPSTracerTab(UI::LinearLayout *list) {
storage_capacity->SetFormat("0x%x asm opcodes");
storage_capacity->OnChange.Add([&](UI::EventParams &) {
INFO_LOG(Log::JIT, "User changed the tracer's storage capacity to 0x%x", mipsTracer.in_storage_capacity);
return UI::EVENT_CONTINUE;
});
PopupSliderChoice* trace_max_size = list->Add(
@@ -323,7 +315,6 @@ void DeveloperToolsScreen::CreateMIPSTracerTab(UI::LinearLayout *list) {
trace_max_size->SetFormat("%d basic blocks");
trace_max_size->OnChange.Add([&](UI::EventParams &) {
INFO_LOG(Log::JIT, "User changed the tracer's max trace size to %d", mipsTracer.in_max_trace_size);
return UI::EVENT_CONTINUE;
});
list->Add(new ItemHeader(dev->T("MIPSTracer actions")));
@@ -385,7 +376,6 @@ void DeveloperToolsScreen::CreateGraphicsTab(UI::LinearLayout *list) {
list->Add(new CheckBox(&g_Config.bRenderMultiThreading, dev->T("Multi-threaded rendering"), ""))->OnClick.Add([](UI::EventParams &e) {
// TODO: Not translating yet. Will combine with other translations of settings that need restart.
g_OSD.Show(OSDType::MESSAGE_WARNING, "Restart required");
return UI::EVENT_DONE;
});
}
@@ -393,7 +383,6 @@ void DeveloperToolsScreen::CreateGraphicsTab(UI::LinearLayout *list) {
auto driverChoice = list->Add(new Choice(gr->T("AdrenoTools driver manager")));
driverChoice->OnClick.Add([=](UI::EventParams &e) {
screenManager()->push(new DriverManagerScreen(gamePath_));
return UI::EVENT_DONE;
});
}
@@ -443,7 +432,6 @@ void DeveloperToolsScreen::CreateGraphicsTab(UI::LinearLayout *list) {
if (e.v)
procScreen->SetPopupOrigin(e.v);
screenManager()->push(procScreen);
return UI::EVENT_DONE;
});
const ShaderInfo *shaderInfo = GetPostShaderInfo(g_Config.sStereoToMonoShader);
if (shaderInfo) {
@@ -511,12 +499,11 @@ void DeveloperToolsScreen::onFinish(DialogResult result) {
System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED);
}
UI::EventReturn DeveloperToolsScreen::OnLoggingChanged(UI::EventParams &e) {
void DeveloperToolsScreen::OnLoggingChanged(UI::EventParams &e) {
System_Notify(SystemNotification::TOGGLE_DEBUG_CONSOLE);
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnOpenTexturesIniFile(UI::EventParams &e) {
void DeveloperToolsScreen::OnOpenTexturesIniFile(UI::EventParams &e) {
std::string gameID = g_paramSFO.GetDiscID();
Path generatedFilename;
@@ -531,35 +518,29 @@ UI::EventReturn DeveloperToolsScreen::OnOpenTexturesIniFile(UI::EventParams &e)
hasTexturesIni_ = HasIni::YES;
}
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnLogConfig(UI::EventParams &e) {
void DeveloperToolsScreen::OnLogConfig(UI::EventParams &e) {
screenManager()->push(new LogConfigScreen());
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnJitDebugTools(UI::EventParams &e) {
void DeveloperToolsScreen::OnJitDebugTools(UI::EventParams &e) {
screenManager()->push(new JitDebugScreen());
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnGPUDriverTest(UI::EventParams &e) {
void DeveloperToolsScreen::OnGPUDriverTest(UI::EventParams &e) {
screenManager()->push(new GPUDriverTestScreen());
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnTouchscreenTest(UI::EventParams &e) {
void DeveloperToolsScreen::OnTouchscreenTest(UI::EventParams &e) {
screenManager()->push(new TouchTestScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnJitAffectingSetting(UI::EventParams &e) {
void DeveloperToolsScreen::OnJitAffectingSetting(UI::EventParams &e) {
System_PostUIMessage(UIMessage::REQUEST_CLEAR_JIT);
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnCopyStatesToRoot(UI::EventParams &e) {
void DeveloperToolsScreen::OnCopyStatesToRoot(UI::EventParams &e) {
Path savestate_dir = GetSysDirectory(DIRECTORY_SAVESTATE);
Path root_dir = GetSysDirectory(DIRECTORY_MEMSTICK_ROOT);
@@ -572,11 +553,9 @@ UI::EventReturn DeveloperToolsScreen::OnCopyStatesToRoot(UI::EventParams &e) {
INFO_LOG(Log::System, "Copying file '%s' to '%s'", src.c_str(), dst.c_str());
File::Copy(src, dst);
}
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnRemoteDebugger(UI::EventParams &e) {
void DeveloperToolsScreen::OnRemoteDebugger(UI::EventParams &e) {
if (allowDebugger_) {
StartWebServer(WebServerFlags::DEBUGGER);
} else {
@@ -584,10 +563,9 @@ UI::EventReturn DeveloperToolsScreen::OnRemoteDebugger(UI::EventParams &e) {
}
// Persist the setting. Maybe should separate?
g_Config.bRemoteDebuggerOnStartup = allowDebugger_;
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnMIPSTracerEnabled(UI::EventParams &e) {
void DeveloperToolsScreen::OnMIPSTracerEnabled(UI::EventParams &e) {
if (MIPSTracerEnabled_) {
u32 capacity = mipsTracer.in_storage_capacity;
u32 trace_size = mipsTracer.in_max_trace_size;
@@ -597,10 +575,9 @@ UI::EventReturn DeveloperToolsScreen::OnMIPSTracerEnabled(UI::EventParams &e) {
} else {
mipsTracer.stop_tracing();
}
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnMIPSTracerPathChanged(UI::EventParams &e) {
void DeveloperToolsScreen::OnMIPSTracerPathChanged(UI::EventParams &e) {
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
System_BrowseForFileSave(
GetRequesterToken(),
@@ -613,27 +590,21 @@ UI::EventReturn DeveloperToolsScreen::OnMIPSTracerPathChanged(UI::EventParams &e
MIPSTracerPath->SetRightText(MIPSTracerPath_);
}
);
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnMIPSTracerFlushTrace(UI::EventParams &e) {
void DeveloperToolsScreen::OnMIPSTracerFlushTrace(UI::EventParams &e) {
mipsTracer.flush_to_file();
// The error logs are emitted inside the tracer
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnMIPSTracerClearJitCache(UI::EventParams &e) {
void DeveloperToolsScreen::OnMIPSTracerClearJitCache(UI::EventParams &e) {
INFO_LOG(Log::JIT, "Clearing the jit cache...");
System_PostUIMessage(UIMessage::REQUEST_CLEAR_JIT);
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnMIPSTracerClearTracer(UI::EventParams &e) {
void DeveloperToolsScreen::OnMIPSTracerClearTracer(UI::EventParams &e) {
INFO_LOG(Log::JIT, "Clearing the MIPSTracer...");
mipsTracer.clear();
return UI::EVENT_DONE;
}
void DeveloperToolsScreen::update() {
@@ -690,13 +661,11 @@ static bool RunMemstickTest(std::string *error) {
return true;
}
UI::EventReturn DeveloperToolsScreen::OnMemstickTest(UI::EventParams &e) {
void DeveloperToolsScreen::OnMemstickTest(UI::EventParams &e) {
std::string error;
if (RunMemstickTest(&error)) {
g_OSD.Show(OSDType::MESSAGE_SUCCESS, "Memstick test passed", error, 6.0f);
} else {
g_OSD.Show(OSDType::MESSAGE_ERROR, "Memstick test failed", error, 6.0f);
}
return UI::EVENT_DONE;
}
+15 -15
View File
@@ -25,21 +25,21 @@ private:
void CreateGraphicsTab(UI::LinearLayout *list);
void CreateNetworkTab(UI::LinearLayout *list);
UI::EventReturn OnLoggingChanged(UI::EventParams &e);
UI::EventReturn OnOpenTexturesIniFile(UI::EventParams &e);
UI::EventReturn OnLogConfig(UI::EventParams &e);
UI::EventReturn OnJitAffectingSetting(UI::EventParams &e);
UI::EventReturn OnJitDebugTools(UI::EventParams &e);
UI::EventReturn OnRemoteDebugger(UI::EventParams &e);
UI::EventReturn OnMIPSTracerEnabled(UI::EventParams &e);
UI::EventReturn OnMIPSTracerPathChanged(UI::EventParams &e);
UI::EventReturn OnMIPSTracerFlushTrace(UI::EventParams &e);
UI::EventReturn OnMIPSTracerClearJitCache(UI::EventParams &e);
UI::EventReturn OnMIPSTracerClearTracer(UI::EventParams &e);
UI::EventReturn OnGPUDriverTest(UI::EventParams &e);
UI::EventReturn OnMemstickTest(UI::EventParams &e);
UI::EventReturn OnTouchscreenTest(UI::EventParams &e);
UI::EventReturn OnCopyStatesToRoot(UI::EventParams &e);
void OnLoggingChanged(UI::EventParams &e);
void OnOpenTexturesIniFile(UI::EventParams &e);
void OnLogConfig(UI::EventParams &e);
void OnJitAffectingSetting(UI::EventParams &e);
void OnJitDebugTools(UI::EventParams &e);
void OnRemoteDebugger(UI::EventParams &e);
void OnMIPSTracerEnabled(UI::EventParams &e);
void OnMIPSTracerPathChanged(UI::EventParams &e);
void OnMIPSTracerFlushTrace(UI::EventParams &e);
void OnMIPSTracerClearJitCache(UI::EventParams &e);
void OnMIPSTracerClearTracer(UI::EventParams &e);
void OnGPUDriverTest(UI::EventParams &e);
void OnMemstickTest(UI::EventParams &e);
void OnTouchscreenTest(UI::EventParams &e);
void OnCopyStatesToRoot(UI::EventParams &e);
void MemoryMapTest();
+6 -13
View File
@@ -157,12 +157,11 @@ static void NotifyPostChanges() {
}
}
UI::EventReturn DisplayLayoutScreen::OnPostProcShaderChange(UI::EventParams &e) {
void DisplayLayoutScreen::OnPostProcShaderChange(UI::EventParams &e) {
// Remove the virtual "Off" entry. TODO: Get rid of it generally.
g_Config.vPostShaderNames.erase(std::remove(g_Config.vPostShaderNames.begin(), g_Config.vPostShaderNames.end(), "Off"), g_Config.vPostShaderNames.end());
FixPostShaderOrder(&g_Config.vPostShaderNames);
NotifyPostChanges();
return UI::EVENT_DONE;
}
static std::string PostShaderTranslateName(std::string_view value) {
@@ -286,7 +285,6 @@ void DisplayLayoutScreen::CreateViews() {
g_Config.fDisplayScale = 1.0f;
g_Config.fDisplayOffsetX = 0.5f;
g_Config.fDisplayOffsetY = 0.5f;
return UI::EVENT_DONE;
});
rightColumn->Add(center);
@@ -352,7 +350,6 @@ void DisplayLayoutScreen::CreateViews() {
if (e.v)
procScreen->SetPopupOrigin(e.v);
screenManager()->push(procScreen);
return UI::EVENT_DONE;
});
postProcChoice_->SetEnabledFunc([=] {
return !g_Config.bSkipBufferEffects && !enableStereo();
@@ -375,12 +372,11 @@ void DisplayLayoutScreen::CreateViews() {
auto settingsButton = shaderRow->Add(checkBox);
settingsButton->OnClick.Add([=](EventParams &e) {
RecreateViews();
return UI::EVENT_DONE;
});
}
auto removeButton = shaderRow->Add(new Choice(ImageID("I_TRASHCAN"), new LinearLayoutParams(0.0f)));
removeButton->OnClick.Add([=](EventParams &e) -> UI::EventReturn {
removeButton->OnClick.Add([=](EventParams &e) -> void {
// Protect against possible race conditions.
if (i < g_Config.vPostShaderNames.size()) {
g_Config.vPostShaderNames.erase(g_Config.vPostShaderNames.begin() + i);
@@ -388,14 +384,13 @@ void DisplayLayoutScreen::CreateViews() {
NotifyPostChanges();
RecreateViews();
}
return UI::EVENT_DONE;
});
auto moreButton = shaderRow->Add(new Choice(ImageID("I_THREE_DOTS"), new LinearLayoutParams(0.0f)));
moreButton->OnClick.Add([=](EventParams &e) -> UI::EventReturn {
moreButton->OnClick.Add([=](EventParams &e) -> void {
if (i >= g_Config.vPostShaderNames.size()) {
// Protect against possible race conditions.
return UI::EVENT_DONE;
return;
}
PopupContextMenuScreen *contextMenu = new UI::PopupContextMenuScreen(postShaderContextMenu, ARRAY_SIZE(postShaderContextMenu), I18NCat::DIALOG, moreButton);
@@ -404,7 +399,7 @@ void DisplayLayoutScreen::CreateViews() {
bool usesLastFrame = info ? info->usePreviousFrame : false;
contextMenu->SetEnabled(0, i > 0 && !usesLastFrame);
contextMenu->SetEnabled(1, i < g_Config.vPostShaderNames.size() - 1);
contextMenu->OnChoice.Add([=](EventParams &e) -> UI::EventReturn {
contextMenu->OnChoice.Add([=](EventParams &e) -> void {
switch (e.a) {
case 0: // Move up
std::swap(g_Config.vPostShaderNames[i - 1], g_Config.vPostShaderNames[i]);
@@ -416,14 +411,12 @@ void DisplayLayoutScreen::CreateViews() {
g_Config.vPostShaderNames.erase(g_Config.vPostShaderNames.begin() + i);
break;
default:
return UI::EVENT_DONE;
return;
}
FixPostShaderOrder(&g_Config.vPostShaderNames);
NotifyPostChanges();
RecreateViews();
return UI::EVENT_DONE;
});
return UI::EVENT_DONE;
});
}
+1 -1
View File
@@ -41,7 +41,7 @@ public:
const char *tag() const override { return "DisplayLayout"; }
protected:
UI::EventReturn OnPostProcShaderChange(UI::EventParams &e);
void OnPostProcShaderChange(UI::EventParams &e);
void sendMessage(UIMessage message, const char *value) override;
void DrawBackground(UIContext &dc) override;
+4 -10
View File
@@ -129,7 +129,6 @@ DriverChoice::DriverChoice(const std::string &driverName, bool current, UI::Layo
UI::EventParams e{};
e.s = name_;
OnDelete.Trigger(e);
return UI::EVENT_DONE;
});
}
if (usable) {
@@ -138,7 +137,6 @@ DriverChoice::DriverChoice(const std::string &driverName, bool current, UI::Layo
UI::EventParams e{};
e.s = name_;
OnUse.Trigger(e);
return UI::EVENT_DONE;
});
}
} else {
@@ -166,7 +164,6 @@ void DriverManagerScreen::CreateDriverTab(UI::ViewGroup *drivers) {
auto customDriverInstallChoice = drivers->Add(new Choice(gr->T("Install custom driver...")));
drivers->Add(new Choice(di->T("More info")))->OnClick.Add([=](UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/docs/reference/custom-drivers/");
return UI::EVENT_DONE;
});
customDriverInstallChoice->OnClick.Handle(this, &DriverManagerScreen::OnCustomDriverInstall);
@@ -187,7 +184,7 @@ void DriverManagerScreen::CreateDriverTab(UI::ViewGroup *drivers) {
drivers->Add(new Spacer(12.0));
}
UI::EventReturn DriverManagerScreen::OnCustomDriverChange(UI::EventParams &e) {
void DriverManagerScreen::OnCustomDriverChange(UI::EventParams &e) {
auto di = GetI18NCategory(I18NCat::DIALOG);
screenManager()->push(new PromptScreen(gamePath_, di->T("Changing this setting requires PPSSPP to restart."), di->T("Restart"), di->T("Cancel"), [=](bool yes) {
@@ -197,12 +194,11 @@ UI::EventReturn DriverManagerScreen::OnCustomDriverChange(UI::EventParams &e) {
TriggerRestart("GameSettingsScreen::CustomDriverYes", false, gamePath_);
}
}));
return UI::EVENT_DONE;
}
UI::EventReturn DriverManagerScreen::OnCustomDriverUninstall(UI::EventParams &e) {
void DriverManagerScreen::OnCustomDriverUninstall(UI::EventParams &e) {
if (e.s.empty()) {
return UI::EVENT_DONE;
return;
}
INFO_LOG(Log::G3D, "Uninstalling driver: %s", e.s.c_str());
@@ -210,10 +206,9 @@ UI::EventReturn DriverManagerScreen::OnCustomDriverUninstall(UI::EventParams &e)
File::DeleteDirRecursively(folder);
RecreateViews();
return UI::EVENT_DONE;
}
UI::EventReturn DriverManagerScreen::OnCustomDriverInstall(UI::EventParams &e) {
void DriverManagerScreen::OnCustomDriverInstall(UI::EventParams &e) {
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
System_BrowseForFile(GetRequesterToken(), gr->T("Install custom driver..."), BrowseFileType::ZIP, [this](const std::string &value, int) {
@@ -275,5 +270,4 @@ UI::EventReturn DriverManagerScreen::OnCustomDriverInstall(UI::EventParams &e) {
g_OSD.Show(OSDType::MESSAGE_SUCCESS, iz->T("Installed!"));
RecreateViews();
});
return UI::EVENT_DONE;
}
+3 -3
View File
@@ -19,9 +19,9 @@ protected:
bool ShowSearchControls() const override { return false; }
private:
UI::EventReturn OnCustomDriverInstall(UI::EventParams &e);
UI::EventReturn OnCustomDriverUninstall(UI::EventParams &e);
UI::EventReturn OnCustomDriverChange(UI::EventParams &e);
void OnCustomDriverInstall(UI::EventParams &e);
void OnCustomDriverUninstall(UI::EventParams &e);
void OnCustomDriverChange(UI::EventParams &e);
void CreateDriverTab(UI::ViewGroup *drivers);
};
+2 -9
View File
@@ -1253,7 +1253,6 @@ void EmuScreen::CreateViews() {
Memory::MemFault_IgnoreLastCrash();
coreState = CoreState::CORE_RUNNING_CPU;
}
return UI::EVENT_DONE;
});
resumeButton_->SetVisibility(V_GONE);
@@ -1262,21 +1261,18 @@ void EmuScreen::CreateViews() {
if (coreState == CoreState::CORE_RUNTIME_ERROR) {
System_PostUIMessage(UIMessage::REQUEST_GAME_RESET);
}
return UI::EVENT_DONE;
});
resetButton_->SetVisibility(V_GONE);
backButton_ = buttons->Add(new Button(di->T("Back")));
backButton_->OnClick.Add([this](UI::EventParams &) {
this->pauseTrigger_ = true;
return UI::EVENT_DONE;
});
backButton_->SetVisibility(V_GONE);
cardboardDisableButton_ = root_->Add(new Button(sc->T("Cardboard VR OFF"), new AnchorLayoutParams(bounds.centerX(), NONE, NONE, 30, true)));
cardboardDisableButton_->OnClick.Add([](UI::EventParams &) {
g_Config.bEnableCardboardVR = false;
return UI::EVENT_DONE;
});
cardboardDisableButton_->SetVisibility(V_GONE);
cardboardDisableButton_->SetScale(0.65f); // make it smaller - this button can be in the way otherwise.
@@ -1338,7 +1334,6 @@ void EmuScreen::CreateViews() {
loadingBG->SetVisibility(V_GONE);
loadingSpinner->SetVisibility(V_GONE);
}
return EVENT_DONE;
});
// Will become visible along with the loadingView.
loadingBG->SetVisibility(V_INVISIBLE);
@@ -1362,15 +1357,14 @@ void EmuScreen::deviceRestored(Draw::DrawContext *draw) {
}
}
UI::EventReturn EmuScreen::OnDevTools(UI::EventParams &params) {
void EmuScreen::OnDevTools(UI::EventParams &params) {
DevMenuScreen *devMenu = new DevMenuScreen(gamePath_, I18NCat::DEVELOPER);
if (params.v)
devMenu->SetPopupOrigin(params.v);
screenManager()->push(devMenu);
return UI::EVENT_DONE;
}
UI::EventReturn EmuScreen::OnChat(UI::EventParams &params) {
void EmuScreen::OnChat(UI::EventParams &params) {
if (chatButton_ != nullptr && chatButton_->GetVisibility() == UI::V_VISIBLE) {
chatButton_->SetVisibility(UI::V_GONE);
}
@@ -1388,7 +1382,6 @@ UI::EventReturn EmuScreen::OnChat(UI::EventParams &params) {
}
#endif
}
return UI::EVENT_DONE;
}
// To avoid including proAdhoc.h, which includes a lot of stuff.
+2 -2
View File
@@ -73,8 +73,8 @@ protected:
private:
void CreateViews() override;
UI::EventReturn OnDevTools(UI::EventParams &params);
UI::EventReturn OnChat(UI::EventParams &params);
void OnDevTools(UI::EventParams &params);
void OnChat(UI::EventParams &params);
void HandleFlip();
void ProcessGameBoot(const Path &filename);
+11 -25
View File
@@ -227,7 +227,6 @@ void GameScreen::CreateViews() {
System_CopyStringToClipboard(buffer);
// Success indication. Not worth a translatable string.
g_OSD.Show(OSDType::MESSAGE_SUCCESS, buffer, 1.0f);
return UI::EVENT_DONE;
});
}
@@ -338,7 +337,6 @@ void GameScreen::CreateViews() {
System_CreateGameShortcut(gamePath_, info->GetTitle());
g_OSD.Show(OSDType::MESSAGE_SUCCESS, GetI18NCategory(I18NCat::DIALOG)->T("Desktop shortcut created"), 2.0f);
}
return UI::EVENT_DONE;
});
}
@@ -354,7 +352,6 @@ void GameScreen::CreateViews() {
if (System_GetPropertyBool(SYSPROP_CAN_SHOW_FILE)) {
rightColumnItems->Add(new Choice(di->T("Show in folder")))->OnClick.Add([this](UI::EventParams &e) {
System_ShowFileInFolder(gamePath_);
return UI::EVENT_DONE;
});
}
@@ -374,25 +371,23 @@ void GameScreen::CreateViews() {
btnCalcCRC->OnClick.Add([this](UI::EventParams &) {
CRC32string = "...";
Reporting::QueueCRC(gamePath_);
return UI::EVENT_DONE;
});
}
}
UI::EventReturn GameScreen::OnCreateConfig(UI::EventParams &e) {
void GameScreen::OnCreateConfig(UI::EventParams &e) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(nullptr, gamePath_, GameInfoFlags::PARAM_SFO);
if (!info->Ready(GameInfoFlags::PARAM_SFO)) {
return UI::EVENT_DONE;
return;
}
g_Config.createGameConfig(info->id);
g_Config.saveGameConfig(info->id, info->GetTitle());
info->hasConfig = true;
screenManager()->topScreen()->RecreateViews();
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnDeleteConfig(UI::EventParams &e) {
void GameScreen::OnDeleteConfig(UI::EventParams &e) {
auto di = GetI18NCategory(I18NCat::DIALOG);
const bool trashAvailable = System_GetPropertyBool(SYSPROP_HAS_TRASH_BIN);
screenManager()->push(
@@ -408,7 +403,6 @@ UI::EventReturn GameScreen::OnDeleteConfig(UI::EventParams &e) {
RecreateViews();
}
}));
return UI::EVENT_DONE;
}
ScreenRenderFlags GameScreen::render(ScreenRenderMode mode) {
@@ -455,22 +449,19 @@ ScreenRenderFlags GameScreen::render(ScreenRenderMode mode) {
return UIScreen::render(mode);
}
UI::EventReturn GameScreen::OnCwCheat(UI::EventParams &e) {
void GameScreen::OnCwCheat(UI::EventParams &e) {
screenManager()->push(new CwCheatScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnSwitchBack(UI::EventParams &e) {
void GameScreen::OnSwitchBack(UI::EventParams &e) {
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnPlay(UI::EventParams &e) {
void GameScreen::OnPlay(UI::EventParams &e) {
screenManager()->switchScreen(new EmuScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnGameSettings(UI::EventParams &e) {
void GameScreen::OnGameSettings(UI::EventParams &e) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(NULL, gamePath_, GameInfoFlags::PARAM_SFO);
if (info && info->Ready(GameInfoFlags::PARAM_SFO)) {
std::string discID = info->GetParamSFO().GetValueString("DISC_ID");
@@ -478,10 +469,9 @@ UI::EventReturn GameScreen::OnGameSettings(UI::EventParams &e) {
discID = g_paramSFO.GenerateFakeID(gamePath_);
screenManager()->push(new GameSettingsScreen(gamePath_, discID, true));
}
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnDeleteSaveData(UI::EventParams &e) {
void GameScreen::OnDeleteSaveData(UI::EventParams &e) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(NULL, gamePath_, GameInfoFlags::PARAM_SFO | GameInfoFlags::SIZE);
if (info) {
// Check that there's any savedata to delete
@@ -502,10 +492,9 @@ UI::EventReturn GameScreen::OnDeleteSaveData(UI::EventParams &e) {
}
}
RecreateViews();
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnDeleteGame(UI::EventParams &e) {
void GameScreen::OnDeleteGame(UI::EventParams &e) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(NULL, gamePath_, GameInfoFlags::PARAM_SFO);
if (info->Ready(GameInfoFlags::PARAM_SFO)) {
auto di = GetI18NCategory(I18NCat::DIALOG);
@@ -527,13 +516,11 @@ UI::EventReturn GameScreen::OnDeleteGame(UI::EventParams &e) {
}
}));
}
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnRemoveFromRecent(UI::EventParams &e) {
void GameScreen::OnRemoveFromRecent(UI::EventParams &e) {
g_recentFiles.Remove(gamePath_.ToString());
screenManager()->switchScreen(new MainScreen());
return UI::EVENT_DONE;
}
class SetBackgroundPopupScreen : public PopupScreen {
@@ -596,7 +583,7 @@ void SetBackgroundPopupScreen::update() {
}
}
UI::EventReturn GameScreen::OnSetBackground(UI::EventParams &e) {
void GameScreen::OnSetBackground(UI::EventParams &e) {
auto ga = GetI18NCategory(I18NCat::GAME);
// This popup is used to prevent any race condition:
// g_gameInfoCache may take time to load the data, and a crash could happen if they exit before then.
@@ -604,5 +591,4 @@ UI::EventReturn GameScreen::OnSetBackground(UI::EventParams &e) {
if (e.v)
pop->SetPopupOrigin(e.v);
screenManager()->push(pop);
return UI::EVENT_DONE;
}
+10 -10
View File
@@ -49,16 +49,16 @@ protected:
private:
// Event handlers
UI::EventReturn OnPlay(UI::EventParams &e);
UI::EventReturn OnGameSettings(UI::EventParams &e);
UI::EventReturn OnDeleteSaveData(UI::EventParams &e);
UI::EventReturn OnDeleteGame(UI::EventParams &e);
UI::EventReturn OnSwitchBack(UI::EventParams &e);
UI::EventReturn OnRemoveFromRecent(UI::EventParams &e);
UI::EventReturn OnCreateConfig(UI::EventParams &e);
UI::EventReturn OnDeleteConfig(UI::EventParams &e);
UI::EventReturn OnCwCheat(UI::EventParams &e);
UI::EventReturn OnSetBackground(UI::EventParams &e);
void OnPlay(UI::EventParams &e);
void OnGameSettings(UI::EventParams &e);
void OnDeleteSaveData(UI::EventParams &e);
void OnDeleteGame(UI::EventParams &e);
void OnSwitchBack(UI::EventParams &e);
void OnRemoveFromRecent(UI::EventParams &e);
void OnCreateConfig(UI::EventParams &e);
void OnDeleteConfig(UI::EventParams &e);
void OnCwCheat(UI::EventParams &e);
void OnSetBackground(UI::EventParams &e);
std::string CRC32string;
+42 -122
View File
@@ -313,9 +313,8 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
if (draw->GetDeviceCaps().multiSampleLevelsMask != 1) {
static const char *msaaModes[] = { "Off", "2x", "4x", "8x", "16x" };
auto msaaChoice = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iMultiSampleLevel, gr->T("Antialiasing (MSAA)"), msaaModes, 0, ARRAY_SIZE(msaaModes), I18NCat::GRAPHICS, screenManager()));
msaaChoice->OnChoice.Add([&](UI::EventParams &) -> UI::EventReturn {
msaaChoice->OnChoice.Add([&](UI::EventParams &) -> void {
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED);
return UI::EVENT_DONE;
});
msaaChoice->SetEnabledFunc([] {
return !g_Config.bSoftwareRendering && !g_Config.bSkipBufferEffects;
@@ -351,7 +350,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED);
System_PostUIMessage(UIMessage::GPU_DISPLAY_RESIZED);
System_RecreateActivity();
return UI::EVENT_DONE;
});
}
#endif
@@ -406,7 +404,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
presentationMode->OnChoice.Add([=](EventParams &e) {
NativeResized();
return UI::EVENT_CONTINUE;
});
} else {
// All backends support FIFO. Check if any immediate modes are supported, if so we can allow the user to choose.
@@ -414,7 +411,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
CheckBox *vSync = graphicsSettings->Add(new CheckBox(&g_Config.bVSync, gr->T("VSync")));
vSync->OnClick.Add([=](EventParams &e) {
NativeResized();
return UI::EVENT_CONTINUE;
});
}
}
@@ -428,9 +424,8 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
#endif
// Display Layout Editor: To avoid overlapping touch controls on large tablets, meet geeky demands for integer zoom/unstretched image etc.
displayEditor_ = graphicsSettings->Add(new Choice(gr->T("Display layout & effects")));
displayEditor_->OnClick.Add([&](UI::EventParams &) -> UI::EventReturn {
displayEditor_->OnClick.Add([&](UI::EventParams &) -> void {
screenManager()->push(new DisplayLayoutScreen(gamePath_));
return UI::EVENT_DONE;
});
}
@@ -468,7 +463,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
g_Config.bAutoFrameSkip = false;
}
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED);
return UI::EVENT_DONE;
});
skipBufferEffects->SetDisabledPtr(&g_Config.bSoftwareRendering);
@@ -492,7 +486,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
texBackoff->SetDisabledPtr(&g_Config.bSoftwareRendering);
texBackoff->OnClick.Add([=](EventParams& e) {
settingInfo_->Show(gr->T("Lazy texture caching Tip", "Faster, but can cause text problems in a few games"), e.v);
return UI::EVENT_CONTINUE;
});
static const char *quality[] = { "Low", "Medium", "High" };
@@ -501,14 +494,12 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
if (g_Config.iSplineBezierQuality != 0) {
settingInfo_->Show(gr->T("LowCurves Tip", "Only used by some games, controls smoothness of curves"), e.v);
}
return UI::EVENT_CONTINUE;
});
graphicsSettings->Add(new ItemHeader(gr->T("Performance")));
CheckBox *frameDuplication = graphicsSettings->Add(new CheckBox(&g_Config.bRenderDuplicateFrames, gr->T("Render duplicate frames to 60hz")));
frameDuplication->OnClick.Add([=](EventParams &e) {
settingInfo_->Show(gr->T("RenderDuplicateFrames Tip", "Can make framerate smoother in games that run at lower framerates"), e.v);
return UI::EVENT_CONTINUE;
});
frameDuplication->SetEnabledFunc([] {
return !g_Config.bSkipBufferEffects && g_Config.iFrameSkip == 0;
@@ -537,7 +528,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
CheckBox *swSkin = graphicsSettings->Add(new CheckBox(&g_Config.bSoftwareSkinning, gr->T("Software Skinning")));
swSkin->OnClick.Add([=](EventParams &e) {
settingInfo_->Show(gr->T("SoftwareSkinning Tip", "Combine skinned model draws on the CPU, faster in most games"), e.v);
return UI::EVENT_CONTINUE;
});
swSkin->SetDisabledPtr(&g_Config.bSoftwareRendering);
@@ -545,7 +535,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
CheckBox *tessellationHW = graphicsSettings->Add(new CheckBox(&g_Config.bHardwareTessellation, gr->T("Hardware Tessellation")));
tessellationHW->OnClick.Add([=](EventParams &e) {
settingInfo_->Show(gr->T("HardwareTessellation Tip", "Uses hardware to make curves"), e.v);
return UI::EVENT_CONTINUE;
});
tessellationHW->SetEnabledFunc([]() {
@@ -582,7 +571,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
if (g_Config.iTexScalingLevel != 1 && !UsingHardwareTextureScaling()) {
settingInfo_->Show(gr->T("UpscaleLevel Tip", "CPU heavy - some scaling may be delayed to avoid stutter"), e.v);
}
return UI::EVENT_CONTINUE;
});
texScalingChoice->SetEnabledFunc([]() {
return !g_Config.bSoftwareRendering && !UsingHardwareTextureScaling();
@@ -593,7 +581,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
if (g_Config.bTexDeposterize == true) {
settingInfo_->Show(gr->T("Deposterize Tip", "Fixes visual banding glitches in upscaled textures"), e.v);
}
return UI::EVENT_CONTINUE;
});
deposterize->SetEnabledFunc([]() {
return !g_Config.bSoftwareRendering && !UsingHardwareTextureScaling();
@@ -667,13 +654,11 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
CheckBox *respectSilentMode = audioSettings->Add(new CheckBox(&g_Config.bAudioRespectSilentMode, a->T("Respect silent mode")));
respectSilentMode->OnClick.Add([=](EventParams &e) {
System_Notify(SystemNotification::AUDIO_MODE_CHANGED);
return UI::EVENT_DONE;
});
respectSilentMode->SetEnabledPtr(&g_Config.bEnableSound);
CheckBox *mixWithOthers = audioSettings->Add(new CheckBox(&g_Config.bAudioMixWithOthers, a->T("Mix audio with other apps")));
mixWithOthers->OnClick.Add([=](EventParams &e) {
System_Notify(SystemNotification::AUDIO_MODE_CHANGED);
return UI::EVENT_DONE;
});
mixWithOthers->SetEnabledPtr(&g_Config.bEnableSound);
#endif
@@ -715,7 +700,6 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
// Audio preview
float achievementVolume = Volume100ToMultiplier(g_Config.iAchievementVolume);
g_BackgroundAudio.SFX().Play(UI::UISound::ACHIEVEMENT_UNLOCKED, achievementVolume);
return UI::EVENT_DONE;
});
audioSettings->Add(new ItemHeader(a->T("UI sound")));
@@ -728,7 +712,6 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
uiVolume->OnChange.Add([](UI::EventParams &e) {
// Audio preview
PlayUISound(UI::UISound::CONFIRM);
return UI::EVENT_DONE;
});
PopupSliderChoice *gamePreviewVolume = audioSettings->Add(new PopupSliderChoice(&g_Config.iGamePreviewVolume, VOLUME_OFF, VOLUMEHI_FULL, 75, a->T("Game preview volume"), screenManager()));
@@ -751,7 +734,6 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
bufferSize->RestrictChoices(bufferSizes, ARRAY_SIZE(bufferSizes));
bufferSize->OnChange.Add([=](EventParams& e) {
settingInfo_->Show(di->T("This change will not take effect until PPSSPP is restarted."), e.v);
return UI::EVENT_CONTINUE;
});
#endif
@@ -783,7 +765,6 @@ void GameSettingsScreen::CreateAudioSettings(UI::ViewGroup *audioSettings) {
} else {
WARN_LOG(Log::Audio, "InitOutputDevice failed");
}
return UI::EVENT_DONE;
});
CheckBox *autoAudio = audioSettings->Add(new CheckBox(&g_Config.bAutoAudioDevice, a->T("Use new audio devices automatically")));
autoAudio->SetEnabledFunc([]()->bool {
@@ -865,7 +846,6 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings)
Choice *gesture = controlsSettings->Add(new Choice(co->T("Gesture mapping")));
gesture->OnClick.Add([=](EventParams &e) {
screenManager()->push(new GestureMappingScreen(gamePath_));
return UI::EVENT_DONE;
});
gesture->SetEnabledPtr(&g_Config.bShowTouchControls);
@@ -926,7 +906,6 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings)
controlsSettings->Add(analogLimiter);
analogLimiter->OnChange.Add([=](EventParams &e) {
settingInfo_->Show(co->T("AnalogLimiter Tip", "When the analog limiter button is pressed"), e.v);
return UI::EVENT_CONTINUE;
});
controlsSettings->Add(new PopupSliderChoice(&g_Config.iRapidFireInterval, 1, 10, 5, co->T("Rapid fire interval"), screenManager(), "frames"));
#if defined(USING_WIN_UI) || defined(SDL) || PPSSPP_PLATFORM(ANDROID)
@@ -949,7 +928,6 @@ void GameSettingsScreen::CreateControlsSettings(UI::ViewGroup *controlsSettings)
mouseControl->OnClick.Add([=](EventParams &e) {
if (g_Config.bMouseControl)
settingInfo_->Show(co->T("MouseControl Tip", "You can now map mouse in control mapping screen by pressing the 'M' icon."), e.v);
return UI::EVENT_CONTINUE;
});
#if !PPSSPP_PLATFORM(ANDROID)
controlsSettings->Add(new CheckBox(&g_Config.bMouseConfine, co->T("Confine Mouse", "Trap mouse within window/display area")))->SetEnabledPtr(&g_Config.bMouseControl);
@@ -988,7 +966,6 @@ MacAddressChooser::MacAddressChooser(RequesterToken token, Path gamePath_, std::
// TODO: Alert the user
*value = initialValue;
}
return UI::EVENT_DONE;
});
Add(new Choice(n->T("Randomize"), new LinearLayoutParams(WRAP_CONTENT, ITEM_HEIGHT)))->OnClick.Add([=](UI::EventParams &) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
@@ -1007,7 +984,6 @@ MacAddressChooser::MacAddressChooser(RequesterToken token, Path gamePath_, std::
}}
);
screenManager->push(confirmScreen);
return UI::EVENT_DONE;
});
}
@@ -1039,7 +1015,6 @@ void GameSettingsScreen::CreateNetworkingSettings(UI::ViewGroup *networkingSetti
networkingSettings->Add(new CheckBox(&g_Config.bEnableAdhocServer, n->T("Enable built-in PRO Adhoc Server", "Enable built-in PRO Adhoc Server")));
networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address", "Change proAdhocServer Address (localhost = multiple instance)"), I18NCat::NONE))->OnClick.Add([=](UI::EventParams &) {
screenManager()->push(new HostnameSelectScreen(&g_Config.proAdhocServer, &g_Config.proAdhocServerList, n->T("proAdhocServer Address:")));
return UI::EVENT_DONE;
});
networkingSettings->Add(new ItemHeader(n->T("UPnP (port-forwarding)")));
@@ -1048,7 +1023,6 @@ void GameSettingsScreen::CreateNetworkingSettings(UI::ViewGroup *networkingSetti
useOriPort->OnClick.Add([=](EventParams& e) {
if (g_Config.bUPnPUseOriginalPort)
settingInfo_->Show(n->T("UseOriginalPort Tip", "May not work for all devices or games, see wiki."), e.v);
return UI::EVENT_CONTINUE;
});
useOriPort->SetEnabledPtr(&g_Config.bEnableUPnP);
@@ -1060,7 +1034,6 @@ void GameSettingsScreen::CreateNetworkingSettings(UI::ViewGroup *networkingSetti
usernameChoice->SetRestriction(StringRestriction::AlphaNumDashUnderscore, 3);
usernameChoice->OnChange.Add([this](UI::EventParams &e) {
RecreateViews();
return UI::EVENT_DONE;
});
networkingSettings->Add(new CheckBox(&g_Config.bInfrastructureAutoDNS, n->T("Autoconfigure")));
@@ -1139,9 +1112,8 @@ void GameSettingsScreen::CreateToolsSettings(UI::ViewGroup *tools) {
const bool showRetroAchievements = System_GetPropertyInt(SYSPROP_DEVICE_TYPE) != DEVICE_TYPE_VR;
if (showRetroAchievements) {
auto retro = tools->Add(new Choice(sy->T("RetroAchievements")));
retro->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn {
retro->OnClick.Add([=](UI::EventParams &) -> void {
screenManager()->push(new RetroAchievementsSettingsScreen(gamePath_));
return UI::EVENT_DONE;
});
retro->SetIcon(ImageID("I_RETROACHIEVEMENTS_LOGO"));
}
@@ -1149,19 +1121,15 @@ void GameSettingsScreen::CreateToolsSettings(UI::ViewGroup *tools) {
// These were moved here so use the wrong translation objects, to avoid having to change all inis... This isn't a sustainable situation :P
tools->Add(new Choice(sa->T("Savedata Manager")))->OnClick.Add([=](UI::EventParams &) {
screenManager()->push(new SavedataScreen(gamePath_));
return UI::EVENT_DONE;
});
tools->Add(new Choice(dev->T("System Information")))->OnClick.Add([=](UI::EventParams &) {
screenManager()->push(new SystemInfoScreen(gamePath_));
return UI::EVENT_DONE;
});
tools->Add(new Choice(sy->T("Developer Tools")))->OnClick.Add([=](UI::EventParams &) {
screenManager()->push(new DeveloperToolsScreen(gamePath_));
return UI::EVENT_DONE;
});
tools->Add(new Choice(ri->T("Remote disc streaming")))->OnClick.Add([=](UI::EventParams &) {
screenManager()->push(new RemoteISOScreen(gamePath_));
return UI::EVENT_DONE;
});
}
@@ -1191,12 +1159,10 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
langScreen->OnChoice.Add([&](UI::EventParams &e) {
screenManager()->RecreateAllViews();
System_Notify(SystemNotification::UI);
return UI::EVENT_DONE;
});
if (e.v)
langScreen->SetPopupOrigin(e.v);
screenManager()->push(langScreen);
return UI::EVENT_DONE;
});
#if PPSSPP_PLATFORM(IOS)
@@ -1207,7 +1173,6 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
PopupMultiChoice *switchMode = systemSettings->Add(new PopupMultiChoice(&g_Config.iAppSwitchMode, sy->T("App switching mode"), indicator, 0, ARRAY_SIZE(indicator), I18NCat::SYSTEM, screenManager()));
switchMode->OnChoice.Add([](EventParams &e) {
System_Notify(SystemNotification::APP_SWITCH_MODE_CHANGED);
return UI::EVENT_DONE;
});
#endif
@@ -1217,7 +1182,6 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
const float dpiMul = UIScaleFactorToMultiplier(g_Config.iUIScaleFactor);
g_display.Recalculate(-1, -1, -1, -1, dpiMul);
NativeResized();
return UI::EVENT_DONE;
});
const Path bgPng = GetSysDirectory(DIRECTORY_SYSTEM) / "background.png";
@@ -1251,7 +1215,6 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
g_Config.fUITint = 0.0f;
g_Config.fUISaturation = 1.0f;
}
return UI::EVENT_CONTINUE;
});
Draw::DrawContext *draw = screenManager()->getDrawContext();
@@ -1273,7 +1236,6 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
if (System_GetPropertyBool(SYSPROP_HAS_OPEN_DIRECTORY)) {
systemSettings->Add(new Choice(sy->T("Show Memory Stick folder")))->OnClick.Add([](UI::EventParams &p) {
System_ShowFileInFolder(g_Config.memStickDirectory);
return UI::EVENT_DONE;
});
}
@@ -1289,7 +1251,6 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
systemSettings->Add(new Choice(sy->T("Set Memory Stick folder")))->OnClick.Add(
[=](UI::EventParams &) {
SetMemStickDirDarwin(GetRequesterToken());
return UI::EVENT_DONE;
});
}
#endif
@@ -1384,7 +1345,6 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
PopupSliderChoice *lockedMhz = systemSettings->Add(new PopupSliderChoice(&g_Config.iLockedCPUSpeed, 0, 1000, 0, sy->T("Change CPU Clock", "Change CPU Clock (unstable)"), screenManager(), sy->T("MHz, 0:default")));
lockedMhz->OnChange.Add([&](UI::EventParams &) {
enableReportsCheckbox_->SetEnabled(Reporting::IsSupported());
return UI::EVENT_CONTINUE;
});
lockedMhz->SetZeroLabel(sy->T("Auto"));
PopupSliderChoice *rewindInterval = systemSettings->Add(new PopupSliderChoice(&g_Config.iRewindSnapshotInterval, 0, 60, 0, sy->T("Rewind Snapshot Interval"), screenManager(), di->T("seconds, 0:off")));
@@ -1434,7 +1394,6 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
CheckBox *enableCheats = systemSettings->Add(new CheckBox(&g_Config.bEnableCheats, sy->T("Enable Cheats")));
enableCheats->OnClick.Add([&](UI::EventParams &) {
enableReportsCheckbox_->SetEnabled(Reporting::IsSupported());
return UI::EVENT_CONTINUE;
});
systemSettings->Add(new CheckBox(&g_Config.bEnablePlugins, sy->T("Enable plugins")));
@@ -1452,7 +1411,6 @@ void GameSettingsScreen::CreateSystemSettings(UI::ViewGroup *systemSettings) {
g_Config.sInfrastructureUsername = g_Config.sNickName;
}
}
return UI::EVENT_DONE;
});
systemSettings->Add(new CheckBox(&g_Config.bDayLightSavings, sy->T("Daylight savings")));
static const char *dateFormat[] = { "YYYYMMDD", "MMDDYYYY", "DDMMYYYY" };
@@ -1502,52 +1460,45 @@ void GameSettingsScreen::CreateVRSettings(UI::ViewGroup *vrSettings) {
vrSettings->Add(new CheckBox(&g_Config.bManualForceVR, vr->T("Manual switching between flat screen and VR using SCREEN key")));
}
UI::EventReturn GameSettingsScreen::OnAutoFrameskip(UI::EventParams &e) {
void GameSettingsScreen::OnAutoFrameskip(UI::EventParams &e) {
g_Config.UpdateAfterSettingAutoFrameSkip();
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnScreenRotation(UI::EventParams &e) {
void GameSettingsScreen::OnScreenRotation(UI::EventParams &e) {
INFO_LOG(Log::System, "New display rotation: %d", g_Config.iScreenRotation);
INFO_LOG(Log::System, "Sending rotate");
System_Notify(SystemNotification::ROTATE_UPDATED);
INFO_LOG(Log::System, "Got back from rotate");
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnAdhocGuides(UI::EventParams &e) {
void GameSettingsScreen::OnAdhocGuides(UI::EventParams &e) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
std::string url(n->T("MultiplayerHowToURL", "https://github.com/hrydgard/ppsspp/wiki/How-to-play-multiplayer-games-with-PPSSPP"));
System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str());
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnImmersiveModeChange(UI::EventParams &e) {
void GameSettingsScreen::OnImmersiveModeChange(UI::EventParams &e) {
System_Notify(SystemNotification::IMMERSIVE_MODE_CHANGE);
if (g_Config.iAndroidHwScale != 0) {
System_RecreateActivity();
}
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnSustainedPerformanceModeChange(UI::EventParams &e) {
void GameSettingsScreen::OnSustainedPerformanceModeChange(UI::EventParams &e) {
System_Notify(SystemNotification::SUSTAINED_PERF_CHANGE);
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnJitAffectingSetting(UI::EventParams &e) {
void GameSettingsScreen::OnJitAffectingSetting(UI::EventParams &e) {
System_PostUIMessage(UIMessage::REQUEST_CLEAR_JIT);
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnShowMemstickScreen(UI::EventParams &e) {
void GameSettingsScreen::OnShowMemstickScreen(UI::EventParams &e) {
screenManager()->push(new MemStickScreen(false));
return UI::EVENT_DONE;
}
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
UI::EventReturn GameSettingsScreen::OnMemoryStickMyDoc(UI::EventParams &e) {
void GameSettingsScreen::OnMemoryStickMyDoc(UI::EventParams &e) {
const Path &PPSSPPpath = File::GetExeDirectory();
const Path installedFile = PPSSPPpath / "installed.txt";
installed_ = File::Exists(installedFile);
@@ -1571,10 +1522,9 @@ UI::EventReturn GameSettingsScreen::OnMemoryStickMyDoc(UI::EventParams &e) {
g_Config.memStickDirectory = Path(myDocsPath);
installed_ = true;
}
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnMemoryStickOther(UI::EventParams &e) {
void GameSettingsScreen::OnMemoryStickOther(UI::EventParams &e) {
const Path &PPSSPPpath = File::GetExeDirectory();
if (otherinstalled_) {
auto di = GetI18NCategory(I18NCat::DIALOG);
@@ -1601,12 +1551,11 @@ UI::EventReturn GameSettingsScreen::OnMemoryStickOther(UI::EventParams &e) {
installed_ = false;
g_Config.memStickDirectory = PPSSPPpath / "memstick";
}
return UI::EVENT_DONE;
}
#endif
UI::EventReturn GameSettingsScreen::OnChangeBackground(UI::EventParams &e) {
void GameSettingsScreen::OnChangeBackground(UI::EventParams &e) {
const Path bgPng = GetSysDirectory(DIRECTORY_SYSTEM) / "background.png";
const Path bgJpg = GetSysDirectory(DIRECTORY_SYSTEM) / "background.jpg";
@@ -1617,7 +1566,7 @@ UI::EventReturn GameSettingsScreen::OnChangeBackground(UI::EventParams &e) {
File::Delete(bgJpg);
UIBackgroundShutdown();
RecreateViews();
return UI::EVENT_DONE;
return;
}
auto sy = GetI18NCategory(I18NCat::SYSTEM);
@@ -1661,27 +1610,23 @@ UI::EventReturn GameSettingsScreen::OnChangeBackground(UI::EventParams &e) {
});
// Change to a browse or clear button.
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnFullscreenChange(UI::EventParams &e) {
void GameSettingsScreen::OnFullscreenChange(UI::EventParams &e) {
g_Config.iForceFullScreen = -1;
System_ToggleFullscreenState(g_Config.UseFullScreen() ? "1" : "0");
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnFullscreenMultiChange(UI::EventParams &e) {
void GameSettingsScreen::OnFullscreenMultiChange(UI::EventParams &e) {
System_ToggleFullscreenState(g_Config.UseFullScreen() ? "1" : "0");
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnResolutionChange(UI::EventParams &e) {
void GameSettingsScreen::OnResolutionChange(UI::EventParams &e) {
if (g_Config.iAndroidHwScale == 1) {
System_RecreateActivity();
}
Reporting::UpdateConfig();
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED);
return UI::EVENT_DONE;
}
void GameSettingsScreen::onFinish(DialogResult result) {
@@ -1767,7 +1712,7 @@ void TriggerRestart(const char *why, bool editThenRestore, const Path &gamePath)
System_RestartApp(param);
}
UI::EventReturn GameSettingsScreen::OnRenderingBackend(UI::EventParams &e) {
void GameSettingsScreen::OnRenderingBackend(UI::EventParams &e) {
// It only makes sense to show the restart prompt if the backend was actually changed.
if (g_Config.iGPUBackend != (int)GetGPUBackend()) {
auto di = GetI18NCategory(I18NCat::DIALOG);
@@ -1779,10 +1724,9 @@ UI::EventReturn GameSettingsScreen::OnRenderingBackend(UI::EventParams &e) {
}
}));
}
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnRenderingDevice(UI::EventParams &e) {
void GameSettingsScreen::OnRenderingDevice(UI::EventParams &e) {
// It only makes sense to show the restart prompt if the device was actually changed.
std::string *deviceNameSetting = GPUDeviceNameSetting();
if (deviceNameSetting && *deviceNameSetting != GetGPUBackendDevice()) {
@@ -1801,10 +1745,9 @@ UI::EventReturn GameSettingsScreen::OnRenderingDevice(UI::EventParams &e) {
}
}));
}
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnInflightFramesChoice(UI::EventParams &e) {
void GameSettingsScreen::OnInflightFramesChoice(UI::EventParams &e) {
if (g_Config.iInflightFrames != prevInflightFrames_) {
auto di = GetI18NCategory(I18NCat::DIALOG);
screenManager()->push(new PromptScreen(gamePath_, di->T("Changing this setting requires PPSSPP to restart."), di->T("Restart"), di->T("Cancel"), [=](bool yes) {
@@ -1815,103 +1758,88 @@ UI::EventReturn GameSettingsScreen::OnInflightFramesChoice(UI::EventParams &e) {
}
}));
}
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnCameraDeviceChange(UI::EventParams& e) {
void GameSettingsScreen::OnCameraDeviceChange(UI::EventParams& e) {
Camera::onCameraDeviceChange();
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnMicDeviceChange(UI::EventParams& e) {
void GameSettingsScreen::OnMicDeviceChange(UI::EventParams& e) {
Microphone::onMicDeviceChange();
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnAudioDevice(UI::EventParams &e) {
void GameSettingsScreen::OnAudioDevice(UI::EventParams &e) {
auto a = GetI18NCategory(I18NCat::AUDIO);
if (g_Config.sAudioDevice == a->T("Auto")) {
g_Config.sAudioDevice.clear();
}
System_Notify(SystemNotification::AUDIO_RESET_DEVICE);
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnChangeQuickChat0(UI::EventParams &e) {
void GameSettingsScreen::OnChangeQuickChat0(UI::EventParams &e) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
System_InputBoxGetString(GetRequesterToken(), n->T("Enter Quick Chat 1"), g_Config.sQuickChat0, false, [](const std::string &value, int) {
g_Config.sQuickChat0 = value;
});
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnChangeQuickChat1(UI::EventParams &e) {
void GameSettingsScreen::OnChangeQuickChat1(UI::EventParams &e) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
System_InputBoxGetString(GetRequesterToken(), n->T("Enter Quick Chat 2"), g_Config.sQuickChat1, false, [](const std::string &value, int) {
g_Config.sQuickChat1 = value;
});
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnChangeQuickChat2(UI::EventParams &e) {
void GameSettingsScreen::OnChangeQuickChat2(UI::EventParams &e) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
System_InputBoxGetString(GetRequesterToken(), n->T("Enter Quick Chat 3"), g_Config.sQuickChat2, false, [](const std::string &value, int) {
g_Config.sQuickChat2 = value;
});
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnChangeQuickChat3(UI::EventParams &e) {
void GameSettingsScreen::OnChangeQuickChat3(UI::EventParams &e) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
System_InputBoxGetString(GetRequesterToken(), n->T("Enter Quick Chat 4"), g_Config.sQuickChat3, false, [](const std::string &value, int) {
g_Config.sQuickChat3 = value;
});
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnChangeQuickChat4(UI::EventParams &e) {
void GameSettingsScreen::OnChangeQuickChat4(UI::EventParams &e) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
System_InputBoxGetString(GetRequesterToken(), n->T("Enter Quick Chat 5"), g_Config.sQuickChat4, false, [](const std::string &value, int) {
g_Config.sQuickChat4 = value;
});
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnTextureShader(UI::EventParams &e) {
void GameSettingsScreen::OnTextureShader(UI::EventParams &e) {
auto gr = GetI18NCategory(I18NCat::GRAPHICS);
auto shaderScreen = new TextureShaderScreen(gr->T("GPU texture upscaler (fast)"));
shaderScreen->OnChoice.Handle(this, &GameSettingsScreen::OnTextureShaderChange);
if (e.v)
shaderScreen->SetPopupOrigin(e.v);
screenManager()->push(shaderScreen);
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnTextureShaderChange(UI::EventParams &e) {
void GameSettingsScreen::OnTextureShaderChange(UI::EventParams &e) {
System_PostUIMessage(UIMessage::GPU_CONFIG_CHANGED);
RecreateViews(); // Update setting name
g_Config.bTexHardwareScaling = g_Config.sTextureShaderName != "Off";
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnControlMapping(UI::EventParams &e) {
void GameSettingsScreen::OnControlMapping(UI::EventParams &e) {
screenManager()->push(new ControlMappingScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnCalibrateAnalogs(UI::EventParams &e) {
void GameSettingsScreen::OnCalibrateAnalogs(UI::EventParams &e) {
screenManager()->push(new AnalogSetupScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnTouchControlLayout(UI::EventParams &e) {
void GameSettingsScreen::OnTouchControlLayout(UI::EventParams &e) {
screenManager()->push(new TouchControlLayoutScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn GameSettingsScreen::OnTiltCustomize(UI::EventParams &e) {
void GameSettingsScreen::OnTiltCustomize(UI::EventParams &e) {
screenManager()->push(new TiltAnalogSettingsScreen(gamePath_));
return UI::EVENT_DONE;
};
void GameSettingsScreen::CallbackRestoreDefaults(bool yes) {
@@ -1921,7 +1849,7 @@ void GameSettingsScreen::CallbackRestoreDefaults(bool yes) {
System_Notify(SystemNotification::UI);
}
UI::EventReturn GameSettingsScreen::OnRestoreDefaultSettings(UI::EventParams &e) {
void GameSettingsScreen::OnRestoreDefaultSettings(UI::EventParams &e) {
auto sy = GetI18NCategory(I18NCat::SYSTEM);
if (g_Config.bGameSpecific) {
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
@@ -1933,7 +1861,6 @@ UI::EventReturn GameSettingsScreen::OnRestoreDefaultSettings(UI::EventParams &e)
std::string_view title = sy->T("Restore Default Settings");
screenManager()->push(new RestoreSettingsScreen(title));
}
return UI::EVENT_DONE;
}
void HostnameSelectScreen::CreatePopupContents(UI::ViewGroup *parent) {
@@ -2012,55 +1939,48 @@ void HostnameSelectScreen::SendEditKey(InputKeyCode keyCode, int flags) {
UI::SetFocusedView(oldView);
}
UI::EventReturn HostnameSelectScreen::OnNumberClick(UI::EventParams &e) {
void HostnameSelectScreen::OnNumberClick(UI::EventParams &e) {
std::string text = e.v ? e.v->Tag() : "";
if (text.length() == 1 && text[0] >= '0' && text[0] <= '9') {
SendEditKey((InputKeyCode)text[0], KEY_CHAR); // ASCII for digits match keycodes.
}
return UI::EVENT_DONE;
}
UI::EventReturn HostnameSelectScreen::OnPointClick(UI::EventParams &e) {
void HostnameSelectScreen::OnPointClick(UI::EventParams &e) {
SendEditKey((InputKeyCode)'.', KEY_CHAR);
return UI::EVENT_DONE;
}
UI::EventReturn HostnameSelectScreen::OnDeleteClick(UI::EventParams &e) {
void HostnameSelectScreen::OnDeleteClick(UI::EventParams &e) {
SendEditKey(NKCODE_DEL);
return UI::EVENT_DONE;
}
UI::EventReturn HostnameSelectScreen::OnDeleteAllClick(UI::EventParams &e) {
void HostnameSelectScreen::OnDeleteAllClick(UI::EventParams &e) {
addrView_->SetText("");
return UI::EVENT_DONE;
}
UI::EventReturn HostnameSelectScreen::OnEditClick(UI::EventParams& e) {
void HostnameSelectScreen::OnEditClick(UI::EventParams& e) {
auto n = GetI18NCategory(I18NCat::NETWORKING);
System_InputBoxGetString(GetRequesterToken(), n->T("proAdhocServer Address:"), addrView_->GetText(), false, [this](const std::string& value, int) {
addrView_->SetText(value);
});
return UI::EVENT_DONE;
}
UI::EventReturn HostnameSelectScreen::OnShowIPListClick(UI::EventParams& e) {
void HostnameSelectScreen::OnShowIPListClick(UI::EventParams& e) {
if (ipRows_->GetVisibility() == UI::V_GONE) {
ipRows_->SetVisibility(UI::V_VISIBLE);
}
else {
ipRows_->SetVisibility(UI::V_GONE);
}
return UI::EVENT_DONE;
}
UI::EventReturn HostnameSelectScreen::OnIPClick(UI::EventParams& e) {
void HostnameSelectScreen::OnIPClick(UI::EventParams& e) {
std::string text = e.v ? e.v->Tag() : "";
if (text.length() > 0) {
addrView_->SetText(text);
// Copy the IP to clipboard for the host to easily share their IP through chatting apps.
System_CopyStringToClipboard(text);
}
return UI::EVENT_DONE;
}
void HostnameSelectScreen::ResolverThread() {
+38 -38
View File
@@ -75,42 +75,42 @@ private:
std::string memstickDisplay_;
// Event handlers
UI::EventReturn OnControlMapping(UI::EventParams &e);
UI::EventReturn OnCalibrateAnalogs(UI::EventParams &e);
UI::EventReturn OnTouchControlLayout(UI::EventParams &e);
UI::EventReturn OnTiltCustomize(UI::EventParams &e);
void OnControlMapping(UI::EventParams &e);
void OnCalibrateAnalogs(UI::EventParams &e);
void OnTouchControlLayout(UI::EventParams &e);
void OnTiltCustomize(UI::EventParams &e);
// Global settings handlers
UI::EventReturn OnAutoFrameskip(UI::EventParams &e);
UI::EventReturn OnTextureShader(UI::EventParams &e);
UI::EventReturn OnTextureShaderChange(UI::EventParams &e);
UI::EventReturn OnChangeQuickChat0(UI::EventParams &e);
UI::EventReturn OnChangeQuickChat1(UI::EventParams &e);
UI::EventReturn OnChangeQuickChat2(UI::EventParams &e);
UI::EventReturn OnChangeQuickChat3(UI::EventParams &e);
UI::EventReturn OnChangeQuickChat4(UI::EventParams &e);
UI::EventReturn OnChangeBackground(UI::EventParams &e);
UI::EventReturn OnFullscreenChange(UI::EventParams &e);
UI::EventReturn OnFullscreenMultiChange(UI::EventParams &e);
UI::EventReturn OnResolutionChange(UI::EventParams &e);
UI::EventReturn OnRestoreDefaultSettings(UI::EventParams &e);
UI::EventReturn OnRenderingBackend(UI::EventParams &e);
UI::EventReturn OnRenderingDevice(UI::EventParams &e);
UI::EventReturn OnInflightFramesChoice(UI::EventParams &e);
UI::EventReturn OnCameraDeviceChange(UI::EventParams& e);
UI::EventReturn OnMicDeviceChange(UI::EventParams& e);
UI::EventReturn OnAudioDevice(UI::EventParams &e);
UI::EventReturn OnJitAffectingSetting(UI::EventParams &e);
UI::EventReturn OnShowMemstickScreen(UI::EventParams &e);
void OnAutoFrameskip(UI::EventParams &e);
void OnTextureShader(UI::EventParams &e);
void OnTextureShaderChange(UI::EventParams &e);
void OnChangeQuickChat0(UI::EventParams &e);
void OnChangeQuickChat1(UI::EventParams &e);
void OnChangeQuickChat2(UI::EventParams &e);
void OnChangeQuickChat3(UI::EventParams &e);
void OnChangeQuickChat4(UI::EventParams &e);
void OnChangeBackground(UI::EventParams &e);
void OnFullscreenChange(UI::EventParams &e);
void OnFullscreenMultiChange(UI::EventParams &e);
void OnResolutionChange(UI::EventParams &e);
void OnRestoreDefaultSettings(UI::EventParams &e);
void OnRenderingBackend(UI::EventParams &e);
void OnRenderingDevice(UI::EventParams &e);
void OnInflightFramesChoice(UI::EventParams &e);
void OnCameraDeviceChange(UI::EventParams& e);
void OnMicDeviceChange(UI::EventParams& e);
void OnAudioDevice(UI::EventParams &e);
void OnJitAffectingSetting(UI::EventParams &e);
void OnShowMemstickScreen(UI::EventParams &e);
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
UI::EventReturn OnMemoryStickMyDoc(UI::EventParams &e);
UI::EventReturn OnMemoryStickOther(UI::EventParams &e);
void OnMemoryStickMyDoc(UI::EventParams &e);
void OnMemoryStickOther(UI::EventParams &e);
#endif
UI::EventReturn OnScreenRotation(UI::EventParams &e);
UI::EventReturn OnImmersiveModeChange(UI::EventParams &e);
UI::EventReturn OnSustainedPerformanceModeChange(UI::EventParams &e);
void OnScreenRotation(UI::EventParams &e);
void OnImmersiveModeChange(UI::EventParams &e);
void OnSustainedPerformanceModeChange(UI::EventParams &e);
UI::EventReturn OnAdhocGuides(UI::EventParams &e);
void OnAdhocGuides(UI::EventParams &e);
// Temporaries to convert setting types, cache enabled, etc.
int iAlternateSpeedPercent1_ = 0;
@@ -157,13 +157,13 @@ private:
void ResolverThread();
void SendEditKey(InputKeyCode keyCode, int flags = 0);
UI::EventReturn OnNumberClick(UI::EventParams &e);
UI::EventReturn OnPointClick(UI::EventParams &e);
UI::EventReturn OnDeleteClick(UI::EventParams &e);
UI::EventReturn OnDeleteAllClick(UI::EventParams &e);
UI::EventReturn OnEditClick(UI::EventParams& e);
UI::EventReturn OnShowIPListClick(UI::EventParams& e);
UI::EventReturn OnIPClick(UI::EventParams& e);
void OnNumberClick(UI::EventParams &e);
void OnPointClick(UI::EventParams &e);
void OnDeleteClick(UI::EventParams &e);
void OnDeleteAllClick(UI::EventParams &e);
void OnEditClick(UI::EventParams& e);
void OnShowIPListClick(UI::EventParams& e);
void OnIPClick(UI::EventParams& e);
enum class ResolverState {
WAITING,
-1
View File
@@ -940,7 +940,6 @@ UI::ViewGroup *CreatePadLayout(float xres, float yres, bool *pause, bool showPau
if (e.a && coreState == CORE_STEPPING_CPU) {
Core_Resume();
}
return UI::EVENT_DONE;
});
}
-3
View File
@@ -63,14 +63,12 @@ void IAPScreen::CreateViews() {
WARN_LOG(Log::System, "Purchase failed or cancelled!");
});
// TODO: What do we do here?
return UI::EVENT_DONE;
});
}
Choice *moreInfo = rightColumnItems->Add(new Choice(di->T("More info")));
moreInfo->OnClick.Add([](UI::EventParams &) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/buygold_ios");
return UI::EVENT_DONE;
});
Choice *backButton = rightColumnItems->Add(new Choice(di->T("Back")));
@@ -89,7 +87,6 @@ void IAPScreen::CreateViews() {
}, []() {
WARN_LOG(Log::System, "Failed restoring purchases");
});
return UI::EVENT_DONE;
});
rightColumnItems->Add(restorePurchases);
}
+2 -5
View File
@@ -158,7 +158,6 @@ void InstallZipScreen::CreateViews() {
if (System_GetPropertyBool(SYSPROP_CAN_SHOW_FILE)) {
rightCompare->Add(new Button(di->T("Show in folder")))->OnClick.Add([=](UI::EventParams &) {
System_ShowFileInFolder(savedataToOverwrite_);
return UI::EVENT_DONE;
});
}
}
@@ -207,7 +206,7 @@ bool InstallZipScreen::key(const KeyInput &key) {
return false;
}
UI::EventReturn InstallZipScreen::OnInstall(UI::EventParams &params) {
void InstallZipScreen::OnInstall(UI::EventParams &params) {
ZipFileTask task;
task.url = zipPath_;
task.fileName = zipPath_;
@@ -225,12 +224,10 @@ UI::EventReturn InstallZipScreen::OnInstall(UI::EventParams &params) {
installChoice_->SetEnabled(false);
}
}
return UI::EVENT_DONE;
}
UI::EventReturn InstallZipScreen::OnPlay(UI::EventParams &params) {
void InstallZipScreen::OnPlay(UI::EventParams &params) {
screenManager()->switchScreen(new EmuScreen(zipPath_));
return UI::EVENT_DONE;
}
void InstallZipScreen::update() {
+2 -2
View File
@@ -40,8 +40,8 @@ protected:
void CreateViews() override;
private:
UI::EventReturn OnInstall(UI::EventParams &params);
UI::EventReturn OnPlay(UI::EventParams &params);
void OnInstall(UI::EventParams &params);
void OnPlay(UI::EventParams &params);
UI::Choice *installChoice_ = nullptr;
UI::Choice *playChoice_ = nullptr;
+15 -31
View File
@@ -62,27 +62,23 @@ void JitCompareScreen::CreateViews() {
blockTopBar->Add(new Button("", ImageID("I_ARROW_UP")))->OnClick.Add([this](UI::EventParams &e) {
viewMode_ = ViewMode::BLOCK_LIST;
Flip();
return UI::EVENT_DONE;
});
blockTopBar->Add(new Button("", ImageID("I_ARROW_LEFT")))->OnClick.Add([=](UI::EventParams &e) {
if (currentBlock_ >= 1)
currentBlock_--;
UpdateDisasm();
return UI::EVENT_DONE;
});
blockTopBar->Add(new Button("", ImageID("I_ARROW_RIGHT")))->OnClick.Add([=](UI::EventParams &e) {
if (currentBlock_ < blockList_.size() - 1)
currentBlock_++;
UpdateDisasm();
return UI::EVENT_DONE;
});
blockTopBar->Add(new Button(dev->T("Random")))->OnClick.Add([=](UI::EventParams &e) {
if (blockList_.empty()) {
return UI::EVENT_DONE;
return;
}
currentBlock_ = rand() % blockList_.size();
UpdateDisasm();
return UI::EVENT_DONE;
});
blockAddr_ = blockTopBar->Add(new TextEdit("", dev->T("Block address"), ""));
@@ -128,14 +124,12 @@ void JitCompareScreen::CreateViews() {
listTopBar->Add(sortButton)->OnClick.Add([this, sortButton, sortCount](UI::EventParams &e) {
PopupContextMenuScreen *contextMenu = new UI::PopupContextMenuScreen(sortMenu, sortCount, I18NCat::DEVELOPER, sortButton);
screenManager()->push(contextMenu);
contextMenu->OnChoice.Add([=](EventParams &e) -> UI::EventReturn {
contextMenu->OnChoice.Add([=](EventParams &e) -> void {
if (e.a < (int)ListSort::MAX) {
listSort_ = (ListSort)e.a;
UpdateDisasm();
}
return UI::EVENT_DONE;
});
return UI::EVENT_DONE;
});
ScrollView *blockScroll = blockListView_->Add(new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
@@ -153,19 +147,16 @@ void JitCompareScreen::CreateViews() {
listType_ = ListType::ALL_BLOCKS;
viewMode_ = ViewMode::BLOCK_LIST;
UpdateDisasm();
return UI::EVENT_DONE;
});
leftColumn->Add(new Choice(dev->T("FPU")))->OnClick.Add([=](UI::EventParams &e) {
listType_ = ListType::FPU_BLOCKS;
viewMode_ = ViewMode::BLOCK_LIST;
UpdateDisasm();
return UI::EVENT_DONE;
});
leftColumn->Add(new Choice(dev->T("VFPU")))->OnClick.Add([=](UI::EventParams &e) {
listType_ = ListType::VFPU_BLOCKS;
viewMode_ = ViewMode::BLOCK_LIST;
UpdateDisasm();
return UI::EVENT_DONE;
});
leftColumn->Add(new Choice(dev->T("Stats")))->OnClick.Handle(this, &JitCompareScreen::OnShowStats);
@@ -365,66 +356,62 @@ void JitCompareScreen::UpdateDisasm() {
}
}
UI::EventReturn JitCompareScreen::OnBlockClick(UI::EventParams &e) {
void JitCompareScreen::OnBlockClick(UI::EventParams &e) {
int blockIndex = blockListContainer_->IndexOfSubview(e.v);
if (blockIndex >= 0) {
viewMode_ = ViewMode::DISASM;
currentBlock_ = blockIndex;
UpdateDisasm();
}
return UI::EVENT_DONE;
}
UI::EventReturn JitCompareScreen::OnAddressChange(UI::EventParams &e) {
void JitCompareScreen::OnAddressChange(UI::EventParams &e) {
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
if (!MIPSComp::jit) {
return UI::EVENT_DONE;
return;
}
JitBlockCacheDebugInterface *blockCache = MIPSComp::jit->GetBlockCacheDebugInterface();
if (!blockCache)
return UI::EVENT_DONE;
return;
u32 addr;
if (blockAddr_->GetText().size() > 8)
return UI::EVENT_DONE;
return;
if (1 == sscanf(blockAddr_->GetText().c_str(), "%08x", &addr)) {
if (Memory::IsValidAddress(addr)) {
currentBlock_ = blockCache->GetBlockNumberFromStartAddress(addr);
UpdateDisasm();
}
}
return UI::EVENT_DONE;
}
UI::EventReturn JitCompareScreen::OnShowStats(UI::EventParams &e) {
void JitCompareScreen::OnShowStats(UI::EventParams &e) {
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
if (!MIPSComp::jit) {
return UI::EVENT_DONE;
return;
}
viewMode_ = ViewMode::STATS;
UpdateDisasm();
return UI::EVENT_DONE;
}
UI::EventReturn JitCompareScreen::OnSelectBlock(UI::EventParams &e) {
void JitCompareScreen::OnSelectBlock(UI::EventParams &e) {
auto dev = GetI18NCategory(I18NCat::DEVELOPER);
auto addressPrompt = new AddressPromptScreen(dev->T("Block address"));
addressPrompt->OnChoice.Handle(this, &JitCompareScreen::OnBlockAddress);
screenManager()->push(addressPrompt);
return UI::EVENT_DONE;
}
UI::EventReturn JitCompareScreen::OnBlockAddress(UI::EventParams &e) {
void JitCompareScreen::OnBlockAddress(UI::EventParams &e) {
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
if (!MIPSComp::jit) {
return UI::EVENT_DONE;
return;
}
JitBlockCacheDebugInterface *blockCache = MIPSComp::jit->GetBlockCacheDebugInterface();
if (!blockCache)
return UI::EVENT_DONE;
return;
if (Memory::IsValidAddress(e.a)) {
currentBlock_ = blockCache->GetBlockNumberFromStartAddress(e.a);
@@ -432,7 +419,6 @@ UI::EventReturn JitCompareScreen::OnBlockAddress(UI::EventParams &e) {
currentBlock_ = -1;
}
UpdateDisasm();
return UI::EVENT_DONE;
}
/*
@@ -504,18 +490,16 @@ void AddressPromptScreen::OnCompleted(DialogResult result) {
}
}
UI::EventReturn AddressPromptScreen::OnDigitButton(UI::EventParams &e) {
void AddressPromptScreen::OnDigitButton(UI::EventParams &e) {
for (int i = 0; i < 16; ++i) {
if (buttons_[i] == e.v) {
AddDigit(i);
}
}
return UI::EVENT_DONE;
}
UI::EventReturn AddressPromptScreen::OnBackspace(UI::EventParams &e) {
void AddressPromptScreen::OnBackspace(UI::EventParams &e) {
BackspaceDigit();
return UI::EVENT_DONE;
}
void AddressPromptScreen::AddDigit(int n) {
+7 -7
View File
@@ -26,11 +26,11 @@ private:
UI::LinearLayout *statsView_ = nullptr;
UI::LinearLayout *statsContainer_ = nullptr;
UI::EventReturn OnSelectBlock(UI::EventParams &e);
UI::EventReturn OnBlockAddress(UI::EventParams &e);
UI::EventReturn OnAddressChange(UI::EventParams &e);
UI::EventReturn OnShowStats(UI::EventParams &e);
UI::EventReturn OnBlockClick(UI::EventParams &e);
void OnSelectBlock(UI::EventParams &e);
void OnBlockAddress(UI::EventParams &e);
void OnAddressChange(UI::EventParams &e);
void OnShowStats(UI::EventParams &e);
void OnBlockClick(UI::EventParams &e);
// To switch, change the below things and call RecreateViews();
enum class ViewMode {
@@ -78,8 +78,8 @@ public:
protected:
void CreatePopupContents(UI::ViewGroup *parent) override;
void OnCompleted(DialogResult result) override;
UI::EventReturn OnDigitButton(UI::EventParams &e);
UI::EventReturn OnBackspace(UI::EventParams &e);
void OnDigitButton(UI::EventParams &e);
void OnBackspace(UI::EventParams &e);
private:
void AddDigit(int n);
+34 -69
View File
@@ -597,30 +597,27 @@ void GameBrowser::ApplySearchFilter() {
}
}
UI::EventReturn GameBrowser::LayoutChange(UI::EventParams &e) {
void GameBrowser::LayoutChange(UI::EventParams &e) {
*gridStyle_ = e.a == 0 ? true : false;
Refresh();
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::LastClick(UI::EventParams &e) {
void GameBrowser::LastClick(UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, lastLink_.c_str());
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::BrowseClick(UI::EventParams &e) {
void GameBrowser::BrowseClick(UI::EventParams &e) {
auto mm = GetI18NCategory(I18NCat::MAINMENU);
System_BrowseForFolder(token_, mm->T("Choose folder"), path_.GetPath(), [this](const std::string &filename, int) {
this->SetPath(Path(filename));
});
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::StorageClick(UI::EventParams &e) {
void GameBrowser::StorageClick(UI::EventParams &e) {
std::vector<std::string> storageDirs = System_GetPropertyStringVec(SYSPROP_ADDITIONAL_STORAGE_DIRS);
if (storageDirs.empty()) {
// Shouldn't happen - this button shouldn't be clickable.
return UI::EVENT_DONE;
return;
}
if (storageDirs.size() == 1) {
SetPath(Path(storageDirs[0]));
@@ -628,24 +625,22 @@ UI::EventReturn GameBrowser::StorageClick(UI::EventParams &e) {
// TODO: We should popup a dialog letting the user choose one.
SetPath(Path(storageDirs[0]));
}
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::OnHomeClick(UI::EventParams &e) {
void GameBrowser::OnHomeClick(UI::EventParams &e) {
if (path_.GetPath().Type() == PathType::CONTENT_URI) {
Path rootPath = path_.GetPath().GetRootVolume();
if (rootPath != path_.GetPath()) {
SetPath(rootPath);
return UI::EVENT_DONE;
return;
}
if (System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) {
// There'll be no sensible home, ignore.
return UI::EVENT_DONE;
return;
}
}
SetPath(HomePath());
return UI::EVENT_DONE;
}
// TODO: This doesn't make that much sense for Android, especially after scoped storage..
@@ -662,7 +657,7 @@ Path GameBrowser::HomePath() {
#endif
}
UI::EventReturn GameBrowser::PinToggleClick(UI::EventParams &e) {
void GameBrowser::PinToggleClick(UI::EventParams &e) {
auto &pinnedPaths = g_Config.vPinnedPaths;
const std::string path = File::ResolvePath(path_.GetPath().ToString());
if (IsCurrentPathPinned()) {
@@ -671,7 +666,6 @@ UI::EventReturn GameBrowser::PinToggleClick(UI::EventParams &e) {
pinnedPaths.push_back(path);
}
Refresh();
return UI::EVENT_DONE;
}
bool GameBrowser::DisplayTopBar() {
@@ -801,7 +795,6 @@ void GameBrowser::Refresh() {
System_InputBoxGetString(token_, mm->T("Enter Path"), path_.GetPath().ToString(), false, [=](const char *responseString, int responseValue) {
this->SetPath(Path(responseString));
});
return UI::EVENT_DONE;
});
}
#endif
@@ -821,7 +814,6 @@ void GameBrowser::Refresh() {
topBar->Add(new Choice(ImageID("I_ROTATE_LEFT"), new LayoutParams(64.0f, 64.0f)))->OnClick.Add([=](UI::EventParams &e) {
path_.Refresh();
Refresh();
return UI::EVENT_DONE;
});
topBar->Add(new Choice(ImageID("I_GEAR"), new LayoutParams(64.0f, 64.0f)))->OnClick.Handle(this, &GameBrowser::GridSettingsClick);
Add(topBar);
@@ -1028,31 +1020,28 @@ std::string GameBrowser::GetBaseName(const std::string &path) const {
return path;
}
UI::EventReturn GameBrowser::GameButtonClick(UI::EventParams &e) {
void GameBrowser::GameButtonClick(UI::EventParams &e) {
GameButton *button = static_cast<GameButton *>(e.v);
UI::EventParams e2{};
e2.s = button->GamePath().ToString();
// Insta-update - here we know we are already on the right thread.
OnChoice.Trigger(e2);
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::GameButtonHoldClick(UI::EventParams &e) {
void GameBrowser::GameButtonHoldClick(UI::EventParams &e) {
GameButton *button = static_cast<GameButton *>(e.v);
UI::EventParams e2{};
e2.s = button->GamePath().ToString();
// Insta-update - here we know we are already on the right thread.
OnHoldChoice.Trigger(e2);
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::GameButtonHighlight(UI::EventParams &e) {
void GameBrowser::GameButtonHighlight(UI::EventParams &e) {
// Insta-update - here we know we are already on the right thread.
OnHighlight.Trigger(e);
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::NavigateClick(UI::EventParams &e) {
void GameBrowser::NavigateClick(UI::EventParams &e) {
DirButton *button = static_cast<DirButton *>(e.v);
Path text = button->GetPath();
if (button->PathAbsolute()) {
@@ -1062,10 +1051,9 @@ UI::EventReturn GameBrowser::NavigateClick(UI::EventParams &e) {
}
g_Config.currentDirectory = path_.GetPath();
Refresh();
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::GridSettingsClick(UI::EventParams &e) {
void GameBrowser::GridSettingsClick(UI::EventParams &e) {
auto sy = GetI18NCategory(I18NCat::SYSTEM);
auto gridSettings = new GridSettingsPopupScreen(sy->T("Games list settings"));
gridSettings->OnRecentChanged.Handle(this, &GameBrowser::OnRecentClear);
@@ -1073,18 +1061,15 @@ UI::EventReturn GameBrowser::GridSettingsClick(UI::EventParams &e) {
gridSettings->SetPopupOrigin(e.v);
screenManager_->push(gridSettings);
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::OnRecentClear(UI::EventParams &e) {
void GameBrowser::OnRecentClear(UI::EventParams &e) {
screenManager_->RecreateAllViews();
System_Notify(SystemNotification::UI);
return UI::EVENT_DONE;
}
UI::EventReturn GameBrowser::OnHomebrewStore(UI::EventParams &e) {
void GameBrowser::OnHomebrewStore(UI::EventParams &e) {
screenManager_->push(new StoreScreen());
return UI::EVENT_DONE;
}
MainScreen::MainScreen() {
@@ -1218,7 +1203,6 @@ void MainScreen::CreateViews() {
buttonHolder->Add(focusButton)->OnClick.Add([this](UI::EventParams &e) {
confirmedTemporary_ = true;
RecreateViews();
return UI::EVENT_DONE;
});
buttonHolder->Add(new Spacer(new LinearLayoutParams(1.0f)));
@@ -1298,7 +1282,6 @@ void MainScreen::CreateViews() {
auto di = GetI18NCategory(I18NCat::DIALOG);
System_CopyStringToClipboard(PPSSPP_GIT_VERSION);
g_OSD.Show(OSDType::MESSAGE_INFO, ApplySafeSubstitutions(di->T("Copied to clipboard: %1"), PPSSPP_GIT_VERSION));
return UI::EVENT_DONE;
});
}
@@ -1323,7 +1306,6 @@ void MainScreen::CreateViews() {
ScreenManager *sm = screenManager();
gold->OnClick.Add([sm](UI::EventParams &) {
LaunchBuyGold(sm);
return UI::EVENT_DONE;
});
gold->SetIcon(ImageID("I_ICONGOLD"), 0.5f);
gold->SetShine(true);
@@ -1378,9 +1360,8 @@ bool MainScreen::key(const KeyInput &touch) {
return UIScreenWithBackground::key(touch);
}
UI::EventReturn MainScreen::OnAllowStorage(UI::EventParams &e) {
void MainScreen::OnAllowStorage(UI::EventParams &e) {
System_AskForPermission(SYSTEM_PERMISSION_STORAGE);
return UI::EVENT_DONE;
}
void MainScreen::sendMessage(UIMessage message, const char *value) {
@@ -1407,17 +1388,16 @@ void MainScreen::update() {
}
}
UI::EventReturn MainScreen::OnLoadFile(UI::EventParams &e) {
void MainScreen::OnLoadFile(UI::EventParams &e) {
if (System_GetPropertyBool(SYSPROP_HAS_FILE_BROWSER)) {
auto mm = GetI18NCategory(I18NCat::MAINMENU);
System_BrowseForFile(GetRequesterToken(), mm->T("Load"), BrowseFileType::BOOTABLE, [](const std::string &value, int) {
System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, value);
});
}
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnFullScreenToggle(UI::EventParams &e) {
void MainScreen::OnFullScreenToggle(UI::EventParams &e) {
if (g_Config.iForceFullScreen != -1)
g_Config.bFullScreen = g_Config.UseFullScreen();
if (fullscreenButton_) {
@@ -1427,7 +1407,6 @@ UI::EventReturn MainScreen::OnFullScreenToggle(UI::EventParams &e) {
g_Config.bFullScreen = !g_Config.bFullScreen;
System_ToggleFullscreenState("");
#endif
return UI::EVENT_DONE;
}
void MainScreen::DrawBackground(UIContext &dc) {
@@ -1479,24 +1458,23 @@ bool MainScreen::DrawBackgroundFor(UIContext &dc, const Path &gamePath, float pr
return true;
}
UI::EventReturn MainScreen::OnGameSelected(UI::EventParams &e) {
void MainScreen::OnGameSelected(UI::EventParams &e) {
Path path(e.s);
std::shared_ptr<GameInfo> ginfo = g_gameInfoCache->GetInfo(nullptr, path, GameInfoFlags::FILE_TYPE);
if (ginfo->fileType == IdentifiedFileType::PSP_SAVEDATA_DIRECTORY) {
return UI::EVENT_DONE;
return;
}
if (g_GameManager.GetState() == GameManagerState::INSTALLING)
return UI::EVENT_DONE;
return;
// Restore focus if it was highlighted (e.g. by gamepad.)
restoreFocusGamePath_ = highlightedGamePath_;
g_BackgroundAudio.SetGame(path);
lockBackgroundAudio_ = true;
screenManager()->push(new GameScreen(path, false));
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnGameHighlight(UI::EventParams &e) {
void MainScreen::OnGameHighlight(UI::EventParams &e) {
using namespace UI;
Path path(e.s);
@@ -1521,23 +1499,19 @@ UI::EventReturn MainScreen::OnGameHighlight(UI::EventParams &e) {
}
lockBackgroundAudio_ = false;
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnGameSelectedInstant(UI::EventParams &e) {
void MainScreen::OnGameSelectedInstant(UI::EventParams &e) {
ScreenManager *screen = screenManager();
LaunchFile(screen, nullptr, Path(e.s));
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnGameSettings(UI::EventParams &e) {
void MainScreen::OnGameSettings(UI::EventParams &e) {
screenManager()->push(new GameSettingsScreen(Path(), ""));
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnCredits(UI::EventParams &e) {
void MainScreen::OnCredits(UI::EventParams &e) {
screenManager()->push(new CreditsScreen());
return UI::EVENT_DONE;
}
void LaunchBuyGold(ScreenManager *screenManager) {
@@ -1554,17 +1528,15 @@ void LaunchBuyGold(ScreenManager *screenManager) {
}
}
UI::EventReturn MainScreen::OnPPSSPPOrg(UI::EventParams &e) {
void MainScreen::OnPPSSPPOrg(UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org");
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnForums(UI::EventParams &e) {
void MainScreen::OnForums(UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://forums.ppsspp.org");
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnExit(UI::EventParams &e) {
void MainScreen::OnExit(UI::EventParams &e) {
// Let's make sure the config was saved, since it may not have been.
if (!g_Config.Save("MainScreen::OnExit")) {
System_Toast("Failed to save settings!\nCheck permissions, or try to restart the device.");
@@ -1574,7 +1546,6 @@ UI::EventReturn MainScreen::OnExit(UI::EventParams &e) {
System_ExitApp();
UpdateUIState(UISTATE_EXIT);
return UI::EVENT_DONE;
}
void MainScreen::dialogFinished(const Screen *dialog, DialogResult result) {
@@ -1659,7 +1630,6 @@ void UmdReplaceScreen::CreateViews() {
__UmdReplace(Path(value));
TriggerFinish(DR_OK);
});
return EVENT_DONE;
});
}
@@ -1683,15 +1653,13 @@ void UmdReplaceScreen::update() {
UIScreen::update();
}
UI::EventReturn UmdReplaceScreen::OnGameSelected(UI::EventParams &e) {
void UmdReplaceScreen::OnGameSelected(UI::EventParams &e) {
__UmdReplace(Path(e.s));
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
}
UI::EventReturn UmdReplaceScreen::OnGameSettings(UI::EventParams &e) {
void UmdReplaceScreen::OnGameSettings(UI::EventParams &e) {
screenManager()->push(new GameSettingsScreen(Path()));
return UI::EVENT_DONE;
}
void GridSettingsPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
@@ -1727,19 +1695,16 @@ void GridSettingsPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
parent->Add(scroll);
}
UI::EventReturn GridSettingsPopupScreen::GridPlusClick(UI::EventParams &e) {
void GridSettingsPopupScreen::GridPlusClick(UI::EventParams &e) {
g_Config.fGameGridScale = std::min(g_Config.fGameGridScale*1.25f, MAX_GAME_GRID_SCALE);
return UI::EVENT_DONE;
}
UI::EventReturn GridSettingsPopupScreen::GridMinusClick(UI::EventParams &e) {
void GridSettingsPopupScreen::GridMinusClick(UI::EventParams &e) {
g_Config.fGameGridScale = std::max(g_Config.fGameGridScale/1.25f, MIN_GAME_GRID_SCALE);
return UI::EVENT_DONE;
}
UI::EventReturn GridSettingsPopupScreen::OnRecentClearClick(UI::EventParams &e) {
void GridSettingsPopupScreen::OnRecentClearClick(UI::EventParams &e) {
g_recentFiles.Clear();
OnRecentChanged.Trigger(e);
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
}
+29 -29
View File
@@ -76,19 +76,19 @@ private:
std::vector<Path> GetPinnedPaths() const;
std::string GetBaseName(const std::string &path) const;
UI::EventReturn GameButtonClick(UI::EventParams &e);
UI::EventReturn GameButtonHoldClick(UI::EventParams &e);
UI::EventReturn GameButtonHighlight(UI::EventParams &e);
UI::EventReturn NavigateClick(UI::EventParams &e);
UI::EventReturn LayoutChange(UI::EventParams &e);
UI::EventReturn LastClick(UI::EventParams &e);
UI::EventReturn BrowseClick(UI::EventParams &e);
UI::EventReturn StorageClick(UI::EventParams &e);
UI::EventReturn OnHomeClick(UI::EventParams &e);
UI::EventReturn PinToggleClick(UI::EventParams &e);
UI::EventReturn GridSettingsClick(UI::EventParams &e);
UI::EventReturn OnRecentClear(UI::EventParams &e);
UI::EventReturn OnHomebrewStore(UI::EventParams &e);
void GameButtonClick(UI::EventParams &e);
void GameButtonHoldClick(UI::EventParams &e);
void GameButtonHighlight(UI::EventParams &e);
void NavigateClick(UI::EventParams &e);
void LayoutChange(UI::EventParams &e);
void LastClick(UI::EventParams &e);
void BrowseClick(UI::EventParams &e);
void StorageClick(UI::EventParams &e);
void OnHomeClick(UI::EventParams &e);
void PinToggleClick(UI::EventParams &e);
void GridSettingsClick(UI::EventParams &e);
void OnRecentClear(UI::EventParams &e);
void OnHomebrewStore(UI::EventParams &e);
enum class SearchState {
MATCH,
@@ -139,18 +139,18 @@ protected:
bool DrawBackgroundFor(UIContext &dc, const Path &gamePath, float progress);
UI::EventReturn OnGameSelected(UI::EventParams &e);
UI::EventReturn OnGameSelectedInstant(UI::EventParams &e);
UI::EventReturn OnGameHighlight(UI::EventParams &e);
void OnGameSelected(UI::EventParams &e);
void OnGameSelectedInstant(UI::EventParams &e);
void OnGameHighlight(UI::EventParams &e);
// Event handlers
UI::EventReturn OnLoadFile(UI::EventParams &e);
UI::EventReturn OnGameSettings(UI::EventParams &e);
UI::EventReturn OnCredits(UI::EventParams &e);
UI::EventReturn OnPPSSPPOrg(UI::EventParams &e);
UI::EventReturn OnForums(UI::EventParams &e);
UI::EventReturn OnExit(UI::EventParams &e);
UI::EventReturn OnAllowStorage(UI::EventParams &e);
UI::EventReturn OnFullScreenToggle(UI::EventParams &e);
void OnLoadFile(UI::EventParams &e);
void OnGameSettings(UI::EventParams &e);
void OnCredits(UI::EventParams &e);
void OnPPSSPPOrg(UI::EventParams &e);
void OnForums(UI::EventParams &e);
void OnExit(UI::EventParams &e);
void OnAllowStorage(UI::EventParams &e);
void OnFullScreenToggle(UI::EventParams &e);
UI::TabHolder *tabHolder_ = nullptr;
UI::Button *fullscreenButton_ = nullptr;
@@ -183,8 +183,8 @@ protected:
void update() override;
private:
UI::EventReturn OnGameSelected(UI::EventParams &e);
UI::EventReturn OnGameSettings(UI::EventParams &e);
void OnGameSelected(UI::EventParams &e);
void OnGameSettings(UI::EventParams &e);
};
class GridSettingsPopupScreen : public PopupScreen {
@@ -196,9 +196,9 @@ public:
const char *tag() const override { return "GridSettings"; }
private:
UI::EventReturn GridPlusClick(UI::EventParams &e);
UI::EventReturn GridMinusClick(UI::EventParams &e);
UI::EventReturn OnRecentClearClick(UI::EventParams &e);
void GridPlusClick(UI::EventParams &e);
void GridMinusClick(UI::EventParams &e);
void OnRecentClearClick(UI::EventParams &e);
const float MAX_GAME_GRID_SCALE = 3.0f;
const float MIN_GAME_GRID_SCALE = 0.8f;
};
+11 -22
View File
@@ -277,23 +277,20 @@ void MemStickScreen::CreateViews() {
INFO_LOG(Log::System, "MemStickScreen: initialSetup=%d", (int)initialSetup_);
}
UI::EventReturn MemStickScreen::OnHelp(UI::EventParams &params) {
void MemStickScreen::OnHelp(UI::EventParams &params) {
// I'm letting the old redirect handle this one, as the target is within /docs on the website,
// and that structure may change a bit.
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/guide_storage.html");
return UI::EVENT_DONE;
}
UI::EventReturn MemStickScreen::OnChoiceClick(UI::EventParams &params) {
void MemStickScreen::OnChoiceClick(UI::EventParams &params) {
// Change the confirm button to match the choice,
// and change the text that we show.
RecreateViews();
return UI::EVENT_DONE;
}
UI::EventReturn MemStickScreen::OnConfirmClick(UI::EventParams &params) {
void MemStickScreen::OnConfirmClick(UI::EventParams &params) {
switch (choice_) {
case CHOICE_SET_MANUAL:
return SetFolderManually(params);
@@ -304,10 +301,9 @@ UI::EventReturn MemStickScreen::OnConfirmClick(UI::EventParams &params) {
case CHOICE_BROWSE_FOLDER:
return Browse(params);
}
return UI::EVENT_DONE;
}
UI::EventReturn MemStickScreen::SetFolderManually(UI::EventParams &params) {
void MemStickScreen::SetFolderManually(UI::EventParams &params) {
// The old way, from before scoped storage. Write in the full path.
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(SWITCH)
auto sy = GetI18NCategory(I18NCat::SYSTEM);
@@ -369,10 +365,9 @@ UI::EventReturn MemStickScreen::SetFolderManually(UI::EventParams &params) {
screenManager()->push(new ConfirmMemstickMoveScreen(pendingMemStickFolder, false));
});
#endif
return UI::EVENT_DONE;
}
UI::EventReturn MemStickScreen::UseInternalStorage(UI::EventParams &params) {
void MemStickScreen::UseInternalStorage(UI::EventParams &params) {
#if PPSSPP_PLATFORM(UWP)
Path pendingMemStickFolder = g_Config.internalDataDirectory;
#else
@@ -397,10 +392,9 @@ UI::EventReturn MemStickScreen::UseInternalStorage(UI::EventParams &params) {
// User chose the same directory it's already in. Let's just bail.
TriggerFinish(DialogResult::DR_OK);
}
return UI::EVENT_DONE;
}
UI::EventReturn MemStickScreen::UseStorageRoot(UI::EventParams &params) {
void MemStickScreen::UseStorageRoot(UI::EventParams &params) {
Path pendingMemStickFolder = Path(g_externalDir);
if (initialSetup_) {
@@ -419,10 +413,9 @@ UI::EventReturn MemStickScreen::UseStorageRoot(UI::EventParams &params) {
// User chose the same directory it's already in. Let's just bail.
TriggerFinish(DialogResult::DR_OK);
}
return UI::EVENT_DONE;
}
UI::EventReturn MemStickScreen::Browse(UI::EventParams &params) {
void MemStickScreen::Browse(UI::EventParams &params) {
auto mm = GetI18NCategory(I18NCat::MAINMENU);
System_BrowseForFolder(GetRequesterToken(), mm->T("Choose folder"), g_Config.memStickDirectory, [=](const std::string &value, int) {
Path pendingMemStickFolder = Path(value);
@@ -441,7 +434,6 @@ UI::EventReturn MemStickScreen::Browse(UI::EventParams &params) {
}, [=]() {
errorNoticeView_->SetVisibility(UI::V_VISIBLE);
});
return UI::EVENT_DONE;
}
void MemStickScreen::dialogFinished(const Screen *dialog, DialogResult result) {
@@ -563,16 +555,15 @@ void ConfirmMemstickMoveScreen::CreateViews() {
leftColumn->Add(new Choice(di->T("OK")))->OnClick.Handle(this, &ConfirmMemstickMoveScreen::OnConfirm);
leftColumn->Add(new Choice(di->T("Back")))->OnClick.Add([this](UI::EventParams &params) {
if (moveDataTask_ && !moveDataTask_->Poll()) {
return UI::EVENT_DONE;
return;
}
return UIScreen::OnBack(params);
UIScreen::OnBack(params);
});
}
}
UI::EventReturn ConfirmMemstickMoveScreen::OnMoveDataClick(UI::EventParams &params) {
void ConfirmMemstickMoveScreen::OnMoveDataClick(UI::EventParams &params) {
RecreateViews();
return UI::EVENT_DONE;
}
void ConfirmMemstickMoveScreen::update() {
@@ -613,7 +604,7 @@ void ConfirmMemstickMoveScreen::update() {
}
}
UI::EventReturn ConfirmMemstickMoveScreen::OnConfirm(UI::EventParams &params) {
void ConfirmMemstickMoveScreen::OnConfirm(UI::EventParams &params) {
// Transfer all the files in /PSP from the original directory.
// Should probably be done on a background thread so we can show some UI.
// So we probably need another screen for this with a progress bar..
@@ -634,8 +625,6 @@ UI::EventReturn ConfirmMemstickMoveScreen::OnConfirm(UI::EventParams &params) {
} else {
FinishFolderMove();
}
return UI::EVENT_DONE;
}
void ConfirmMemstickMoveScreen::FinishFolderMove() {
+9 -9
View File
@@ -67,17 +67,17 @@ protected:
private:
// Event handlers
UI::EventReturn OnHelp(UI::EventParams &e);
void OnHelp(UI::EventParams &e);
// Confirm button sub handlers
UI::EventReturn Browse(UI::EventParams &e);
UI::EventReturn UseInternalStorage(UI::EventParams &params);
UI::EventReturn UseStorageRoot(UI::EventParams &params);
UI::EventReturn SetFolderManually(UI::EventParams &params);
void Browse(UI::EventParams &e);
void UseInternalStorage(UI::EventParams &params);
void UseStorageRoot(UI::EventParams &params);
void SetFolderManually(UI::EventParams &params);
// Button handlers.
UI::EventReturn OnConfirmClick(UI::EventParams &params);
UI::EventReturn OnChoiceClick(UI::EventParams &params);
void OnConfirmClick(UI::EventParams &params);
void OnChoiceClick(UI::EventParams &params);
SettingInfoMessage *settingInfo_ = nullptr;
NoticeView *errorNoticeView_ = nullptr;
@@ -109,10 +109,10 @@ protected:
void CreateViews() override;
private:
UI::EventReturn OnMoveDataClick(UI::EventParams &params);
void OnMoveDataClick(UI::EventParams &params);
void FinishFolderMove();
UI::EventReturn OnConfirm(UI::EventParams &params);
void OnConfirm(UI::EventParams &params);
Path newMemstickFolder_;
bool existingFilesInNewFolder_;
+6 -16
View File
@@ -531,7 +531,6 @@ void HandleCommonMessages(UIMessage message, const char *value, ScreenManager *m
langScreen->OnChoice.Add([](UI::EventParams &) {
System_PostUIMessage(UIMessage::RECREATE_VIEWS);
System_Notify(SystemNotification::UI);
return UI::EVENT_DONE;
});
manager->push(langScreen);
} else if (message == UIMessage::WINDOW_MINIMIZED) {
@@ -649,14 +648,12 @@ void PromptScreen::CreateViews() {
yesButton->SetCentered(vertical);
yesButton->OnClick.Add([this](UI::EventParams &e) {
TriggerFinish(DR_OK);
return UI::EVENT_DONE;
});
if (!noButtonText_.empty()) {
Choice *noButton = rightColumnItems->Add(new Choice(noButtonText_, vertical ? new LinearLayoutParams(1.0f) : nullptr));
noButton->SetCentered(vertical);
noButton->OnClick.Add([this](UI::EventParams &e) {
TriggerFinish(DR_CANCEL);
return UI::EVENT_DONE;
});
root_->SetDefaultFocusView(noButton);
} else {
@@ -930,7 +927,6 @@ void CreditsScreen::CreateViews() {
ScreenManager *sm = screenManager();
root_->Add(new Button(mm->T("Buy PPSSPP Gold"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 84, false)))->OnClick.Add([sm](UI::EventParams) {
LaunchBuyGold(sm);
return UI::EVENT_DONE;
});
rightYOffset = 74;
}
@@ -951,36 +947,30 @@ void CreditsScreen::CreateViews() {
}
}
UI::EventReturn CreditsScreen::OnX(UI::EventParams &e) {
void CreditsScreen::OnX(UI::EventParams &e) {
// Not sure we should change to x.com here, given various platform URL handlers etc. We can probably change it soon.
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://twitter.com/PPSSPP_emu");
return UI::EVENT_DONE;
}
UI::EventReturn CreditsScreen::OnPPSSPPOrg(UI::EventParams &e) {
void CreditsScreen::OnPPSSPPOrg(UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org");
return UI::EVENT_DONE;
}
UI::EventReturn CreditsScreen::OnPrivacy(UI::EventParams &e) {
void CreditsScreen::OnPrivacy(UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/privacy");
return UI::EVENT_DONE;
}
UI::EventReturn CreditsScreen::OnForums(UI::EventParams &e) {
void CreditsScreen::OnForums(UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://forums.ppsspp.org");
return UI::EVENT_DONE;
}
UI::EventReturn CreditsScreen::OnDiscord(UI::EventParams &e) {
void CreditsScreen::OnDiscord(UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://discord.gg/5NJB6dD");
return UI::EVENT_DONE;
}
UI::EventReturn CreditsScreen::OnShare(UI::EventParams &e) {
void CreditsScreen::OnShare(UI::EventParams &e) {
auto cr = GetI18NCategory(I18NCat::PSPCREDITS);
System_ShareText(cr->T("CheckOutPPSSPP", "Check out PPSSPP, the awesome PSP emulator: https://www.ppsspp.org/"));
return UI::EVENT_DONE;
}
CreditsScreen::CreditsScreen() {
+6 -6
View File
@@ -167,12 +167,12 @@ public:
const char *tag() const override { return "Credits"; }
private:
UI::EventReturn OnPPSSPPOrg(UI::EventParams &e);
UI::EventReturn OnPrivacy(UI::EventParams &e);
UI::EventReturn OnForums(UI::EventParams &e);
UI::EventReturn OnDiscord(UI::EventParams &e);
UI::EventReturn OnShare(UI::EventParams &e);
UI::EventReturn OnX(UI::EventParams &e);
void OnPPSSPPOrg(UI::EventParams &e);
void OnPrivacy(UI::EventParams &e);
void OnForums(UI::EventParams &e);
void OnDiscord(UI::EventParams &e);
void OnShare(UI::EventParams &e);
void OnX(UI::EventParams &e);
double startTime_ = 0.0;
};
+26 -55
View File
@@ -129,10 +129,10 @@ protected:
}
private:
UI::EventReturn OnSaveState(UI::EventParams &e);
UI::EventReturn OnLoadState(UI::EventParams &e);
UI::EventReturn OnUndoState(UI::EventParams &e);
UI::EventReturn OnDeleteState(UI::EventParams &e);
void OnSaveState(UI::EventParams &e);
void OnLoadState(UI::EventParams &e);
void OnUndoState(UI::EventParams &e);
void OnDeleteState(UI::EventParams &e);
Path filename_;
Path gamePath_;
@@ -140,33 +140,30 @@ private:
int slot_;
};
UI::EventReturn ScreenshotViewScreen::OnSaveState(UI::EventParams &e) {
void ScreenshotViewScreen::OnSaveState(UI::EventParams &e) {
if (!NetworkWarnUserIfOnlineAndCantSavestate()) {
g_Config.iCurrentStateSlot = slot_;
SaveState::SaveSlot(gamePath_, slot_, &AfterSaveStateAction);
TriggerFinish(DR_OK); //OK will close the pause screen as well
}
return UI::EVENT_DONE;
}
UI::EventReturn ScreenshotViewScreen::OnLoadState(UI::EventParams &e) {
void ScreenshotViewScreen::OnLoadState(UI::EventParams &e) {
if (!NetworkWarnUserIfOnlineAndCantSavestate()) {
g_Config.iCurrentStateSlot = slot_;
SaveState::LoadSlot(gamePath_, slot_, &AfterSaveStateAction);
TriggerFinish(DR_OK);
}
return UI::EVENT_DONE;
}
UI::EventReturn ScreenshotViewScreen::OnUndoState(UI::EventParams &e) {
void ScreenshotViewScreen::OnUndoState(UI::EventParams &e) {
if (!NetworkWarnUserIfOnlineAndCantSavestate()) {
SaveState::UndoSaveSlot(gamePath_, slot_);
TriggerFinish(DR_CANCEL);
}
return UI::EVENT_DONE;
}
UI::EventReturn ScreenshotViewScreen::OnDeleteState(UI::EventParams &e) {
void ScreenshotViewScreen::OnDeleteState(UI::EventParams &e) {
auto di = GetI18NCategory(I18NCat::DIALOG);
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(NULL, gamePath_, GameInfoFlags::PARAM_SFO);
@@ -183,8 +180,6 @@ UI::EventReturn ScreenshotViewScreen::OnDeleteState(UI::EventParams &e) {
TriggerFinish(DR_CANCEL);
}
}));
return UI::EVENT_DONE;
}
class SaveSlotView : public UI::LinearLayout {
@@ -214,9 +209,9 @@ public:
UI::Event OnScreenshotClicked;
private:
UI::EventReturn OnScreenshotClick(UI::EventParams &e);
UI::EventReturn OnSaveState(UI::EventParams &e);
UI::EventReturn OnLoadState(UI::EventParams &e);
void OnScreenshotClick(UI::EventParams &e);
void OnSaveState(UI::EventParams &e);
void OnLoadState(UI::EventParams &e);
UI::Button *saveStateButton_ = nullptr;
UI::Button *loadStateButton_ = nullptr;
@@ -279,7 +274,7 @@ void SaveSlotView::Draw(UIContext &dc) {
UI::LinearLayout::Draw(dc);
}
UI::EventReturn SaveSlotView::OnLoadState(UI::EventParams &e) {
void SaveSlotView::OnLoadState(UI::EventParams &e) {
if (!NetworkWarnUserIfOnlineAndCantSavestate()) {
g_Config.iCurrentStateSlot = slot_;
SaveState::LoadSlot(gamePath_, slot_, &AfterSaveStateAction);
@@ -287,10 +282,9 @@ UI::EventReturn SaveSlotView::OnLoadState(UI::EventParams &e) {
e2.v = this;
OnStateLoaded.Trigger(e2);
}
return UI::EVENT_DONE;
}
UI::EventReturn SaveSlotView::OnSaveState(UI::EventParams &e) {
void SaveSlotView::OnSaveState(UI::EventParams &e) {
if (!NetworkWarnUserIfOnlineAndCantSavestate()) {
g_Config.iCurrentStateSlot = slot_;
SaveState::SaveSlot(gamePath_, slot_, &AfterSaveStateAction);
@@ -298,14 +292,12 @@ UI::EventReturn SaveSlotView::OnSaveState(UI::EventParams &e) {
e2.v = this;
OnStateSaved.Trigger(e2);
}
return UI::EVENT_DONE;
}
UI::EventReturn SaveSlotView::OnScreenshotClick(UI::EventParams &e) {
void SaveSlotView::OnScreenshotClick(UI::EventParams &e) {
UI::EventParams e2{};
e2.v = this;
OnScreenshotClicked.Trigger(e2);
return UI::EVENT_DONE;
}
void GamePauseScreen::update() {
@@ -463,7 +455,6 @@ void GamePauseScreen::CreateViews() {
if (!dnsConfig.revivalTeamURL.empty()) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, dnsConfig.revivalTeamURL.c_str());
}
return UI::EVENT_DONE;
});
}
}
@@ -489,7 +480,6 @@ void GamePauseScreen::CreateViews() {
horiz->Add(new NoticeView(NoticeLevel::WARN, pa->T("Using save states is not recommended in this game"), "", new LinearLayoutParams(1.0f)));
horiz->Add(new Button(di->T("More info")))->OnClick.Add([](UI::EventParams &e) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/docs/troubleshooting/save-state-time-warps");
return UI::EVENT_DONE;
});
}
@@ -536,7 +526,6 @@ void GamePauseScreen::CreateViews() {
if (getUMDReplacePermit()) {
rightColumnItems->Add(new Choice(pa->T("Switch UMD")))->OnClick.Add([=](UI::EventParams &) {
screenManager()->push(new UmdReplaceScreen());
return UI::EVENT_DONE;
});
}
Choice *continueChoice = rightColumnItems->Add(new Choice(pa->T("Continue")));
@@ -557,20 +546,17 @@ void GamePauseScreen::CreateViews() {
createGameConfig->SetEnabled(!bootPending_);
}
rightColumnItems->Add(new Choice(gr->T("Display layout & effects")))->OnClick.Add([&](UI::EventParams &) -> UI::EventReturn {
rightColumnItems->Add(new Choice(gr->T("Display layout & effects")))->OnClick.Add([&](UI::EventParams &) -> void {
screenManager()->push(new DisplayLayoutScreen(gamePath_));
return UI::EVENT_DONE;
});
if (g_Config.bEnableCheats) {
rightColumnItems->Add(new Choice(pa->T("Cheats")))->OnClick.Add([&](UI::EventParams &e) {
screenManager()->push(new CwCheatScreen(gamePath_));
return UI::EVENT_DONE;
});
}
if (g_Config.bAchievementsEnable && Achievements::HasAchievementsOrLeaderboards()) {
rightColumnItems->Add(new Choice(ac->T("Achievements")))->OnClick.Add([&](UI::EventParams &e) {
screenManager()->push(new RetroAchievementsListScreen(gamePath_));
return UI::EVENT_DONE;
});
}
@@ -596,7 +582,6 @@ void GamePauseScreen::CreateViews() {
playButton_->OnClick.Add([=](UI::EventParams &e) {
g_Config.bRunBehindPauseMenu = !g_Config.bRunBehindPauseMenu;
playButton_->SetImageID(g_Config.bRunBehindPauseMenu ? ImageID("I_PAUSE") : ImageID("I_PLAY"));
return UI::EVENT_DONE;
});
bool mustRunBehind = MustRunBehind();
@@ -605,7 +590,6 @@ void GamePauseScreen::CreateViews() {
Button *infoButton = middleColumn->Add(new Button("", ImageID("I_INFO"), new LinearLayoutParams(64, 64)));
infoButton->OnClick.Add([=](UI::EventParams &e) {
screenManager()->push(new GameScreen(gamePath_, true));
return UI::EVENT_DONE;
});
Button *menuButton = middleColumn->Add(new Button("", ImageID("I_THREE_DOTS"), new LinearLayoutParams(64, 64)));
@@ -616,7 +600,7 @@ void GamePauseScreen::CreateViews() {
};
PopupContextMenuScreen *contextMenu = new UI::PopupContextMenuScreen(ingameContextMenu, ARRAY_SIZE(ingameContextMenu), I18NCat::DIALOG, menuButton);
screenManager()->push(contextMenu);
contextMenu->OnChoice.Add([=](EventParams &e) -> UI::EventReturn {
contextMenu->OnChoice.Add([=](EventParams &e) -> void {
switch (e.a) {
case 0: // Reset
{
@@ -636,24 +620,19 @@ void GamePauseScreen::CreateViews() {
default:
break;
}
return UI::EVENT_DONE;
});
return UI::EVENT_DONE;
});
// What's this for?
rightColumnHolder->Add(new Spacer(10.0f));
}
UI::EventReturn GamePauseScreen::OnGameSettings(UI::EventParams &e) {
void GamePauseScreen::OnGameSettings(UI::EventParams &e) {
screenManager()->push(new GameSettingsScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnState(UI::EventParams &e) {
void GamePauseScreen::OnState(UI::EventParams &e) {
TriggerFinish(DR_CANCEL);
return UI::EVENT_DONE;
}
void GamePauseScreen::dialogFinished(const Screen *dialog, DialogResult dr) {
@@ -670,7 +649,7 @@ void GamePauseScreen::dialogFinished(const Screen *dialog, DialogResult dr) {
}
}
UI::EventReturn GamePauseScreen::OnScreenshotClicked(UI::EventParams &e) {
void GamePauseScreen::OnScreenshotClicked(UI::EventParams &e) {
SaveSlotView *v = static_cast<SaveSlotView *>(e.v);
int slot = v->GetSlot();
g_Config.iCurrentStateSlot = v->GetSlot();
@@ -680,7 +659,6 @@ UI::EventReturn GamePauseScreen::OnScreenshotClicked(UI::EventParams &e) {
Screen *screen = new ScreenshotViewScreen(fn, title, v->GetSlot(), gamePath_);
screenManager()->push(screen);
}
return UI::EVENT_DONE;
}
int GetUnsavedProgressSeconds() {
@@ -725,7 +703,7 @@ std::string GetConfirmExitMessage() {
return confirmMessage;
}
UI::EventReturn GamePauseScreen::OnExit(UI::EventParams &e) {
void GamePauseScreen::OnExit(UI::EventParams &e) {
std::string confirmExitMessage = GetConfirmExitMessage();
if (!confirmExitMessage.empty()) {
@@ -749,33 +727,28 @@ UI::EventReturn GamePauseScreen::OnExit(UI::EventParams &e) {
TriggerFinish(DR_OK);
}
}
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnReportFeedback(UI::EventParams &e) {
void GamePauseScreen::OnReportFeedback(UI::EventParams &e) {
screenManager()->push(new ReportScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnRewind(UI::EventParams &e) {
void GamePauseScreen::OnRewind(UI::EventParams &e) {
SaveState::Rewind(&AfterSaveStateAction);
TriggerFinish(DR_CANCEL);
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnLoadUndo(UI::EventParams &e) {
void GamePauseScreen::OnLoadUndo(UI::EventParams &e) {
SaveState::UndoLoad(gamePath_, &AfterSaveStateAction);
TriggerFinish(DR_CANCEL);
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnLastSaveUndo(UI::EventParams &e) {
void GamePauseScreen::OnLastSaveUndo(UI::EventParams &e) {
SaveState::UndoLastSave(gamePath_);
RecreateViews();
return UI::EVENT_DONE;
}
void GamePauseScreen::CallbackDeleteConfig(bool yes) {
@@ -790,7 +763,7 @@ void GamePauseScreen::CallbackDeleteConfig(bool yes) {
}
}
UI::EventReturn GamePauseScreen::OnCreateConfig(UI::EventParams &e) {
void GamePauseScreen::OnCreateConfig(UI::EventParams &e) {
std::shared_ptr<GameInfo> info = g_gameInfoCache->GetInfo(NULL, gamePath_, GameInfoFlags::PARAM_SFO);
if (info->Ready(GameInfoFlags::PARAM_SFO)) {
std::string gameId = info->id;
@@ -802,13 +775,11 @@ UI::EventReturn GamePauseScreen::OnCreateConfig(UI::EventParams &e) {
}
screenManager()->topScreen()->RecreateViews();
}
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnDeleteConfig(UI::EventParams &e) {
void GamePauseScreen::OnDeleteConfig(UI::EventParams &e) {
auto di = GetI18NCategory(I18NCat::DIALOG);
screenManager()->push(
new PromptScreen(gamePath_, di->T("DeleteConfirmGameConfig", "Do you really want to delete the settings for this game?"), di->T("Delete"), di->T("Cancel"),
std::bind(&GamePauseScreen::CallbackDeleteConfig, this, std::placeholders::_1)));
return UI::EVENT_DONE;
}
+10 -10
View File
@@ -44,20 +44,20 @@ protected:
private:
void CreateSavestateControls(UI::LinearLayout *viewGroup, bool vertical);
UI::EventReturn OnGameSettings(UI::EventParams &e);
UI::EventReturn OnExit(UI::EventParams &e);
UI::EventReturn OnReportFeedback(UI::EventParams &e);
void OnGameSettings(UI::EventParams &e);
void OnExit(UI::EventParams &e);
void OnReportFeedback(UI::EventParams &e);
UI::EventReturn OnRewind(UI::EventParams &e);
UI::EventReturn OnLoadUndo(UI::EventParams &e);
UI::EventReturn OnLastSaveUndo(UI::EventParams &e);
void OnRewind(UI::EventParams &e);
void OnLoadUndo(UI::EventParams &e);
void OnLastSaveUndo(UI::EventParams &e);
UI::EventReturn OnScreenshotClicked(UI::EventParams &e);
void OnScreenshotClicked(UI::EventParams &e);
UI::EventReturn OnCreateConfig(UI::EventParams &e);
UI::EventReturn OnDeleteConfig(UI::EventParams &e);
void OnCreateConfig(UI::EventParams &e);
void OnDeleteConfig(UI::EventParams &e);
UI::EventReturn OnState(UI::EventParams &e);
void OnState(UI::EventParams &e);
// hack
bool finishNextFrame_ = false;
+6 -12
View File
@@ -421,34 +421,28 @@ static void CleanupRemoteISOSubdir() {
}
UI::EventReturn RemoteISOScreen::OnChangeRemoteISOSubdir(UI::EventParams &e) {
void RemoteISOScreen::OnChangeRemoteISOSubdir(UI::EventParams &e) {
CleanupRemoteISOSubdir();
return UI::EVENT_DONE;
}
UI::EventReturn RemoteISOScreen::HandleStartServer(UI::EventParams &e) {
void RemoteISOScreen::HandleStartServer(UI::EventParams &e) {
frameCount_ = 0;
if (!StartWebServer(WebServerFlags::DISCS)) {
return UI::EVENT_DONE;
return;
}
return UI::EVENT_DONE;
}
UI::EventReturn RemoteISOScreen::HandleStopServer(UI::EventParams &e) {
void RemoteISOScreen::HandleStopServer(UI::EventParams &e) {
if (!StopWebServer(WebServerFlags::DISCS)) {
return UI::EVENT_DONE;
return;
}
serverStopping_ = true;
RecreateViews();
return UI::EVENT_DONE;
}
UI::EventReturn RemoteISOScreen::HandleBrowse(UI::EventParams &e) {
void RemoteISOScreen::HandleBrowse(UI::EventParams &e) {
screenManager()->push(new RemoteISOConnectScreen());
return UI::EVENT_DONE;
}
RemoteISOConnectScreen::RemoteISOConnectScreen() {
+4 -4
View File
@@ -34,7 +34,7 @@ public:
void CreateTabs() override;
protected:
UI::EventReturn OnChangeRemoteISOSubdir(UI::EventParams &e);
void OnChangeRemoteISOSubdir(UI::EventParams &e);
void CreateConnectTab(UI::ViewGroup *viewGroup);
void CreateSettingsTab(UI::ViewGroup *viewGroup);
@@ -42,9 +42,9 @@ protected:
void update() override;
UI::EventReturn HandleStartServer(UI::EventParams &e);
UI::EventReturn HandleStopServer(UI::EventParams &e);
UI::EventReturn HandleBrowse(UI::EventParams &e);
void HandleStartServer(UI::EventParams &e);
void HandleStopServer(UI::EventParams &e);
void HandleBrowse(UI::EventParams &e);
UI::TextView *firewallWarning_ = nullptr;
bool serverRunning_ = false;
+7 -13
View File
@@ -62,7 +62,7 @@ protected:
LinearLayout *group_;
private:
EventReturn OnChoiceClick(EventParams &e);
void OnChoiceClick(EventParams &e);
int *value_;
};
@@ -114,7 +114,7 @@ void RatingChoice::AddChoice(int i, std::string_view title) {
c->OnClick.Handle(this, &RatingChoice::OnChoiceClick);
}
EventReturn RatingChoice::OnChoiceClick(EventParams &e) {
void RatingChoice::OnChoiceClick(EventParams &e) {
// Unstick the other choices that weren't clicked.
int total = TotalChoices();
for (int i = 0; i < total; i++) {
@@ -131,7 +131,6 @@ EventReturn RatingChoice::OnChoiceClick(EventParams &e) {
e2.a = *value_;
// Dispatch immediately (we're already on the UI thread as we're in an event handler).
OnChoice.Dispatch(e2);
return EVENT_DONE;
}
class CompatRatingChoice : public RatingChoice {
@@ -218,7 +217,7 @@ void ReportScreen::resized() {
RecreateViews();
}
EventReturn ReportScreen::HandleChoice(EventParams &e) {
void ReportScreen::HandleChoice(EventParams &e) {
if (overall_ == ReportingOverallScore::NONE) {
graphics_ = 0;
speed_ = 0;
@@ -243,10 +242,9 @@ EventReturn ReportScreen::HandleChoice(EventParams &e) {
UpdateSubmit();
UpdateOverallDescription();
return EVENT_DONE;
}
EventReturn ReportScreen::HandleReportingChange(EventParams &e) {
void ReportScreen::HandleReportingChange(EventParams &e) {
if (overall_ == ReportingOverallScore::NONE) {
ratingEnabled_ = false;
} else {
@@ -256,7 +254,6 @@ EventReturn ReportScreen::HandleReportingChange(EventParams &e) {
reportingNotice_->SetTextColor(enableReporting_ ? 0xFFFFFFFF : 0xFF3030FF);
}
UpdateSubmit();
return EVENT_DONE;
}
void ReportScreen::CreateViews() {
@@ -379,7 +376,7 @@ void ReportScreen::UpdateOverallDescription() {
overallDescription_->SetTextColor(c);
}
EventReturn ReportScreen::HandleSubmit(EventParams &e) {
void ReportScreen::HandleSubmit(EventParams &e) {
const char *compat;
switch (overall_) {
case ReportingOverallScore::PERFECT: compat = "perfect"; break;
@@ -399,13 +396,11 @@ EventReturn ReportScreen::HandleSubmit(EventParams &e) {
Reporting::ReportCompatibility(compat, graphics_ + 1, speed_ + 1, gameplay_ + 1, filename);
TriggerFinish(DR_OK);
screenManager()->push(new ReportFinishScreen(gamePath_, overall_));
return EVENT_DONE;
}
EventReturn ReportScreen::HandleBrowser(EventParams &e) {
void ReportScreen::HandleBrowser(EventParams &e) {
const std::string url = "https://" + Reporting::ServerHost() + "/";
System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str());
return EVENT_DONE;
}
ReportFinishScreen::ReportFinishScreen(const Path &gamePath, ReportingOverallScore score)
@@ -519,8 +514,7 @@ void ReportFinishScreen::ShowSuggestions() {
}
}
UI::EventReturn ReportFinishScreen::HandleViewFeedback(UI::EventParams &e) {
void ReportFinishScreen::HandleViewFeedback(UI::EventParams &e) {
const std::string url = "https://" + Reporting::ServerHost() + "/game/" + Reporting::CurrentGameID();
System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str());
return EVENT_DONE;
}
+5 -5
View File
@@ -51,10 +51,10 @@ protected:
void UpdateCRCInfo();
void UpdateOverallDescription();
UI::EventReturn HandleChoice(UI::EventParams &e);
UI::EventReturn HandleSubmit(UI::EventParams &e);
UI::EventReturn HandleBrowser(UI::EventParams &e);
UI::EventReturn HandleReportingChange(UI::EventParams &e);
void HandleChoice(UI::EventParams &e);
void HandleSubmit(UI::EventParams &e);
void HandleBrowser(UI::EventParams &e);
void HandleReportingChange(UI::EventParams &e);
UI::Choice *submit_ = nullptr;
UI::View *screenshot_ = nullptr;
@@ -85,7 +85,7 @@ protected:
void CreateViews() override;
void ShowSuggestions();
UI::EventReturn HandleViewFeedback(UI::EventParams &e);
void HandleViewFeedback(UI::EventParams &e);
UI::TextView *resultNotice_ = nullptr;
UI::LinearLayout *resultItems_ = nullptr;
+9 -22
View File
@@ -38,7 +38,6 @@ AudioFileChooser::AudioFileChooser(RequesterToken token, std::string *value, std
Add(new Choice(ImageID("I_PLAY"), new LinearLayoutParams(ITEM_HEIGHT, ITEM_HEIGHT)))->OnClick.Add([=](UI::EventParams &) {
float achievementVolume = Volume100ToMultiplier(g_Config.iAchievementVolume);
g_BackgroundAudio.SFX().Play(sound_, achievementVolume);
return UI::EVENT_DONE;
});
Add(new FileChooserChoice(token, value, title, BrowseFileType::SOUND_EFFECT, new LinearLayoutParams(1.0f)))->OnChange.Add([=](UI::EventParams &e) {
std::string path = e.s;
@@ -50,12 +49,10 @@ AudioFileChooser::AudioFileChooser(RequesterToken token, std::string *value, std
g_OSD.Show(OSDType::MESSAGE_ERROR, au->T("Audio file format not supported. Must be WAV or MP3."));
value->clear();
}
return UI::EVENT_DONE;
});
Add(new Choice(ImageID("I_TRASHCAN"), new LinearLayoutParams(ITEM_HEIGHT, ITEM_HEIGHT)))->OnClick.Add([=](UI::EventParams &) {
g_BackgroundAudio.SFX().UpdateSample(sound, nullptr);
value->clear();
return UI::EVENT_DONE;
});
}
@@ -149,9 +146,8 @@ void RetroAchievementsListScreen::CreateLeaderboardsTab(UI::ViewGroup *viewGroup
for (auto &leaderboard : leaderboards) {
int leaderboardID = leaderboard->id;
viewGroup->Add(new LeaderboardSummaryView(leaderboard))->OnClick.Add([=](UI::EventParams &e) -> UI::EventReturn {
viewGroup->Add(new LeaderboardSummaryView(leaderboard))->OnClick.Add([=](UI::EventParams &e) -> void {
screenManager()->push(new RetroAchievementsLeaderboardScreen(gamePath_, leaderboardID));
return UI::EVENT_DONE;
});
}
}
@@ -224,7 +220,6 @@ void RetroAchievementsLeaderboardScreen::CreateLeaderboardTab(UI::LinearLayout *
strip->SetSelection(e.a, false);
nearMe_ = e.a != 0;
FetchEntries();
return UI::EVENT_DONE;
});
strip->SetSelection(nearMe_ ? 1 : 0, false);
@@ -304,20 +299,18 @@ void RetroAchievementsSettingsScreen::CreateAccountTab(UI::ViewGroup *viewGroup)
}
viewGroup->Add(new InfoItem(di->T("Username"), info->username));
// viewGroup->Add(new InfoItem(ac->T("Unread messages"), info.numUnreadMessages));
viewGroup->Add(new Choice(di->T("Log out")))->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn {
viewGroup->Add(new Choice(di->T("Log out")))->OnClick.Add([=](UI::EventParams &) -> void {
Achievements::Logout();
return UI::EVENT_DONE;
});
} else {
std::string errorMessage;
if (Achievements::LoginProblems(&errorMessage)) {
viewGroup->Add(new NoticeView(NoticeLevel::WARN, ac->T("Failed logging in to RetroAchievements"), errorMessage));
viewGroup->Add(new Choice(di->T("Log out")))->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn {
viewGroup->Add(new Choice(di->T("Log out")))->OnClick.Add([=](UI::EventParams &) -> void {
Achievements::Logout();
return UI::EVENT_DONE;
});
} else if (System_GetPropertyBool(SYSPROP_HAS_LOGIN_DIALOG)) {
viewGroup->Add(new Choice(di->T("Log in")))->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn {
viewGroup->Add(new Choice(di->T("Log in")))->OnClick.Add([=](UI::EventParams &) -> void {
std::string title = StringFromFormat("RetroAchievements: %s", di->T_cstr("Log in"));
System_AskUsernamePassword(GetRequesterToken(), title, g_Config.sAchievementsUserName, [](const std::string &value, int) {
std::vector<std::string> parts;
@@ -326,49 +319,43 @@ void RetroAchievementsSettingsScreen::CreateAccountTab(UI::ViewGroup *viewGroup)
Achievements::LoginAsync(parts[0].c_str(), parts[1].c_str());
}
});
return UI::EVENT_DONE;
});
} else {
// Hack up a temporary quick login-form-ish-thing
viewGroup->Add(new PopupTextInputChoice(GetRequesterToken(), &g_Config.sAchievementsUserName, di->T("Username"), "", 128, screenManager()));
viewGroup->Add(new PopupTextInputChoice(GetRequesterToken(), &password_, di->T("Password"), "", 128, screenManager()))->SetPasswordDisplay();
Choice *loginButton = viewGroup->Add(new Choice(di->T("Log in")));
loginButton->OnClick.Add([=](UI::EventParams &) -> UI::EventReturn {
loginButton->OnClick.Add([=](UI::EventParams &) -> void {
if (!g_Config.sAchievementsUserName.empty() && !password_.empty()) {
Achievements::LoginAsync(g_Config.sAchievementsUserName.c_str(), password_.c_str());
memset(&password_[0], 0, password_.size());
password_.clear();
}
return UI::EVENT_DONE;
});
loginButton->SetEnabledFunc([&]() {
return !g_Config.sAchievementsUserName.empty() && !password_.empty();
});
}
viewGroup->Add(new Choice(ac->T("Register on www.retroachievements.org")))->OnClick.Add([&](UI::EventParams &) -> UI::EventReturn {
viewGroup->Add(new Choice(ac->T("Register on www.retroachievements.org")))->OnClick.Add([&](UI::EventParams &) -> void {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://retroachievements.org/createaccount.php");
return UI::EVENT_DONE;
});
}
using namespace UI;
viewGroup->Add(new ItemHeader(di->T("Settings")));
viewGroup->Add(new CheckBox(&g_Config.bAchievementsEnable, ac->T("Achievements enabled")))->OnClick.Add([&](UI::EventParams &e) -> UI::EventReturn {
viewGroup->Add(new CheckBox(&g_Config.bAchievementsEnable, ac->T("Achievements enabled")))->OnClick.Add([&](UI::EventParams &e) -> void {
Achievements::UpdateSettings();
RecreateViews();
return UI::EVENT_DONE;
});
viewGroup->Add(new CheckBox(&g_Config.bAchievementsHardcoreMode, ac->T("Hardcore Mode (no savestates)")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
viewGroup->Add(new CheckBox(&g_Config.bAchievementsSoundEffects, ac->T("Sound Effects")))->SetEnabledPtr(&g_Config.bAchievementsEnable);
viewGroup->Add(new ItemHeader(di->T("Links")));
viewGroup->Add(new Choice(ac->T("RetroAchievements website")))->OnClick.Add([&](UI::EventParams &) -> UI::EventReturn {
viewGroup->Add(new Choice(ac->T("RetroAchievements website")))->OnClick.Add([&](UI::EventParams &) -> void {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.retroachievements.org/");
return UI::EVENT_DONE;
});
viewGroup->Add(new Choice(ac->T("How to use RetroAchievements")))->OnClick.Add([&](UI::EventParams &) -> UI::EventReturn {
viewGroup->Add(new Choice(ac->T("How to use RetroAchievements")))->OnClick.Add([&](UI::EventParams &) -> void {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, "https://www.ppsspp.org/docs/reference/retro-achievements");
return UI::EVENT_DONE;
});
}
+5 -12
View File
@@ -182,12 +182,10 @@ public:
TriggerFinish(DR_NO);
}
}));
return UI::EVENT_DONE;
});
if (System_GetPropertyBool(SYSPROP_CAN_SHOW_FILE)) {
buttonRow->Add(new Button(di->T("Show in folder"), new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Add([this](UI::EventParams &e) {
System_ShowFileInFolder(savePath_);
return UI::EVENT_DONE;
});
}
parent->Add(buttonRow);
@@ -597,14 +595,13 @@ void SavedataBrowser::Refresh() {
SetSearchFilter(searchFilter_);
}
UI::EventReturn SavedataBrowser::SavedataButtonClick(UI::EventParams &e) {
void SavedataBrowser::SavedataButtonClick(UI::EventParams &e) {
SavedataButton *button = static_cast<SavedataButton *>(e.v);
UI::EventParams e2{};
e2.v = e.v;
e2.s = button->GamePath().ToString();
// Insta-update - here we know we are already on the right thread.
OnChoice.Trigger(e2);
return UI::EVENT_DONE;
}
SavedataScreen::~SavedataScreen() {
@@ -627,7 +624,6 @@ void SavedataScreen::CreateSavedataTab(UI::ViewGroup *savedata) {
sortStrip->OnChoice.Add([this](UI::EventParams &e) {
sortOption_ = SavedataSortOption(e.a);
dataBrowser_->SetSortOption(sortOption_);
return UI::EVENT_DONE;
});
savedata->Add(sortStrip);
@@ -651,7 +647,6 @@ void SavedataScreen::CreateSavestateTab(UI::ViewGroup *savestate) {
sortStrip->OnChoice.Add([this](UI::EventParams &e) {
sortOption_ = SavedataSortOption(e.a);
stateBrowser_->SetSortOption(sortOption_);
return UI::EVENT_DONE;
});
savestate->Add(sortStrip);
@@ -684,20 +679,20 @@ void SavedataScreen::CreateExtraButtons(UI::LinearLayout *verticalLayout, int ma
}
}
UI::EventReturn SavedataScreen::OnSearch(UI::EventParams &e) {
void SavedataScreen::OnSearch(UI::EventParams &e) {
if (System_GetPropertyBool(SYSPROP_HAS_TEXT_INPUT_DIALOG)) {
auto di = GetI18NCategory(I18NCat::DIALOG);
System_InputBoxGetString(GetRequesterToken(), di->T("Filter"), searchFilter_, false, [](const std::string &value, int ivalue) {
System_PostUIMessage(UIMessage::SAVEDATA_SEARCH, value);
});
}
return UI::EVENT_DONE;
}
UI::EventReturn SavedataScreen::OnSavedataButtonClick(UI::EventParams &e) {
void SavedataScreen::OnSavedataButtonClick(UI::EventParams &e) {
// the game path: e.s;
std::shared_ptr<GameInfo> ginfo = g_gameInfoCache->GetInfo(screenManager()->getDrawContext(), Path(e.s), GameInfoFlags::PARAM_SFO);
if (!ginfo->Ready(GameInfoFlags::PARAM_SFO)) {
return UI::EVENT_DONE;
return;
}
// Sanitize the title.
@@ -707,8 +702,6 @@ UI::EventReturn SavedataScreen::OnSavedataButtonClick(UI::EventParams &e) {
popupScreen->SetPopupOrigin(e.v);
}
screenManager()->push(popupScreen);
// the game path: e.s;
return UI::EVENT_DONE;
}
void SavedataScreen::dialogFinished(const Screen *dialog, DialogResult result) {
+3 -3
View File
@@ -56,7 +56,7 @@ private:
static bool ByDate(const UI::View *, const UI::View *);
void Refresh();
UI::EventReturn SavedataButtonClick(UI::EventParams &e);
void SavedataButtonClick(UI::EventParams &e);
SavedataSortOption sortOption_ = SavedataSortOption::FILENAME;
UI::ViewGroup *gameList_ = nullptr;
@@ -85,8 +85,8 @@ protected:
bool ShowSearchControls() const override { return false; }
private:
UI::EventReturn OnSavedataButtonClick(UI::EventParams &e);
UI::EventReturn OnSearch(UI::EventParams &e);
void OnSavedataButtonClick(UI::EventParams &e);
void OnSearch(UI::EventParams &e);
void CreateSavedataTab(UI::ViewGroup *savedata);
void CreateSavestateTab(UI::ViewGroup *savestate);
+11 -20
View File
@@ -264,9 +264,9 @@ public:
private:
void CreateViews();
UI::EventReturn OnInstall(UI::EventParams &e);
UI::EventReturn OnCancel(UI::EventParams &e);
UI::EventReturn OnLaunchClick(UI::EventParams &e);
void OnInstall(UI::EventParams &e);
void OnCancel(UI::EventParams &e);
void OnLaunchClick(UI::EventParams &e);
bool IsGameInstalled() const {
return g_GameManager.IsGameInstalled(entry_.file);
@@ -311,7 +311,6 @@ void ProductView::CreateViews() {
uninstallButton_ = new Button(st->T("Uninstall"));
Add(uninstallButton_)->OnClick.Add([=](UI::EventParams &e) {
g_GameManager.UninstallGameOnThread(entry_.file);
return UI::EVENT_DONE;
});
// Add(new TextView(st->T("Installed"))); // Not really needed
}
@@ -338,7 +337,6 @@ void ProductView::CreateViews() {
horiz->Add(new Button(di->T("More info"), new LinearLayoutParams(0.0, G_VCENTER)))->OnClick.Add([this](UI::EventParams) {
std::string url = StringFromFormat("https://www.ppsspp.org/docs/reference/homebrew-store-distribution/#%s", entry_.file.c_str());
System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str());
return UI::EVENT_DONE;
});
}
if (!entry_.websiteURL.empty()) {
@@ -359,7 +357,6 @@ void ProductView::CreateViews() {
}
Add(new Button(buttonText))->OnClick.Add([this](UI::EventParams) {
System_LaunchUrl(LaunchUrlType::BROWSER_URL, entry_.websiteURL.c_str());
return UI::EVENT_DONE;
});
}
}
@@ -393,7 +390,7 @@ std::string ProductView::DownloadURL() const {
}
}
UI::EventReturn ProductView::OnInstall(UI::EventParams &e) {
void ProductView::OnInstall(UI::EventParams &e) {
std::string fileUrl = DownloadURL();
if (installButton_) {
installButton_->SetEnabled(false);
@@ -403,18 +400,16 @@ UI::EventReturn ProductView::OnInstall(UI::EventParams &e) {
}
INFO_LOG(Log::System, "Triggering install of '%s'", fileUrl.c_str());
g_GameManager.DownloadAndInstall(fileUrl);
return UI::EVENT_DONE;
}
UI::EventReturn ProductView::OnCancel(UI::EventParams &e) {
void ProductView::OnCancel(UI::EventParams &e) {
g_GameManager.CancelDownload();
return UI::EVENT_DONE;
}
UI::EventReturn ProductView::OnLaunchClick(UI::EventParams &e) {
void ProductView::OnLaunchClick(UI::EventParams &e) {
if (g_GameManager.GetState() != GameManagerState::IDLE) {
// Button should have been disabled. Just a safety check.
return UI::EVENT_DONE;
return;
}
Path pspGame = GetSysDirectory(DIRECTORY_GAME);
@@ -424,7 +419,6 @@ UI::EventReturn ProductView::OnLaunchClick(UI::EventParams &e) {
e2.s = path.ToString();
// Insta-update - here we know we are already on the right thread.
OnClickLaunch.Trigger(e2);
return UI::EVENT_DONE;
}
StoreScreen::StoreScreen() {
@@ -584,10 +578,10 @@ ProductItemView *StoreScreen::GetSelectedItem() {
return nullptr;
}
UI::EventReturn StoreScreen::OnGameSelected(UI::EventParams &e) {
void StoreScreen::OnGameSelected(UI::EventParams &e) {
ProductItemView *item = static_cast<ProductItemView *>(e.v);
if (!item)
return UI::EVENT_DONE;
return;
productPanel_->Clear();
ProductView *productView = new ProductView(item->GetEntry());
@@ -598,18 +592,15 @@ UI::EventReturn StoreScreen::OnGameSelected(UI::EventParams &e) {
if (previousItem && previousItem != item)
previousItem->Release();
lastSelectedName_ = item->GetEntry().name;
return UI::EVENT_DONE;
}
UI::EventReturn StoreScreen::OnGameLaunch(UI::EventParams &e) {
void StoreScreen::OnGameLaunch(UI::EventParams &e) {
std::string path = e.s;
screenManager()->switchScreen(new EmuScreen(Path(path)));
return UI::EVENT_DONE;
}
UI::EventReturn StoreScreen::OnRetry(UI::EventParams &e) {
void StoreScreen::OnRetry(UI::EventParams &e) {
RecreateViews();
return UI::EVENT_DONE;
}
std::string StoreScreen::GetTranslatedString(const json::JsonGet json, const std::string &key, const char *fallback) const {
+3 -3
View File
@@ -70,9 +70,9 @@ public:
protected:
void CreateViews() override;
UI::EventReturn OnGameSelected(UI::EventParams &e);
UI::EventReturn OnRetry(UI::EventParams &e);
UI::EventReturn OnGameLaunch(UI::EventParams &e);
void OnGameSelected(UI::EventParams &e);
void OnRetry(UI::EventParams &e);
void OnGameLaunch(UI::EventParams &e);
private:
void ParseListing(const std::string &json);
-2
View File
@@ -83,13 +83,11 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() {
searchSettings->Add(new ItemHeader(se->T("Find settings")));
searchSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &searchFilter_, se->T("Filter"), "", 64, screenManager()))->OnChange.Add([=](UI::EventParams &e) {
System_PostUIMessage(UIMessage::GAMESETTINGS_SEARCH, StripSpaces(searchFilter_));
return UI::EVENT_DONE;
});
clearSearchChoice_ = searchSettings->Add(new Choice(se->T("Clear filter")));
clearSearchChoice_->OnClick.Add([=](UI::EventParams &e) {
System_PostUIMessage(UIMessage::GAMESETTINGS_SEARCH, "");
return UI::EVENT_DONE;
});
clearSearchChoice_->SetVisibility(searchFilter_.empty() ? UI::V_GONE : UI::V_VISIBLE);
+1 -3
View File
@@ -105,7 +105,6 @@ void TiltAnalogSettingsScreen::CreateViews() {
//refer to the ResetTiltEvents() function for a detailed explanation.
TiltEventProcessor::ResetTiltEvents();
RecreateViews();
return UI::EVENT_DONE;
});
settings->Add(new ItemHeader(co->T("Calibration")));
TextView *calibrationInfo = new TextView(co->T("To Calibrate", "Hold device at your preferred angle and press Calibrate."));
@@ -134,9 +133,8 @@ void TiltAnalogSettingsScreen::CreateViews() {
settings->Add(new Choice(di->T("Back")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
}
UI::EventReturn TiltAnalogSettingsScreen::OnCalibrate(UI::EventParams &e) {
void TiltAnalogSettingsScreen::OnCalibrate(UI::EventParams &e) {
g_Config.fTiltBaseAngleY = TiltEventProcessor::GetCurrentYAngle();
return UI::EVENT_DONE;
}
void TiltAnalogSettingsScreen::update() {
+1 -1
View File
@@ -33,7 +33,7 @@ public:
const char *tag() const override { return "TiltAnalogSettings"; }
private:
UI::EventReturn OnCalibrate(UI::EventParams &e);
void OnCalibrate(UI::EventParams &e);
Lin::Vec3 down_{};
JoystickHistoryView *tilt_ = nullptr;
+3 -6
View File
@@ -581,30 +581,27 @@ void TouchControlLayoutScreen::onFinish(DialogResult reason) {
g_Config.Save("TouchControlLayoutScreen::onFinish");
}
UI::EventReturn TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) {
void TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) {
screenManager()->push(new TouchControlVisibilityScreen(gamePath_));
return UI::EVENT_DONE;
}
UI::EventReturn TouchControlLayoutScreen::OnReset(UI::EventParams &e) {
void TouchControlLayoutScreen::OnReset(UI::EventParams &e) {
INFO_LOG(Log::G3D, "Resetting touch control layout");
g_Config.ResetControlLayout();
const Bounds &bounds = screenManager()->getUIContext()->GetBounds();
InitPadLayout(bounds.w, bounds.h);
RecreateViews();
return UI::EVENT_DONE;
};
void TouchControlLayoutScreen::dialogFinished(const Screen *dialog, DialogResult result) {
RecreateViews();
}
UI::EventReturn TouchControlLayoutScreen::OnMode(UI::EventParams &e) {
void TouchControlLayoutScreen::OnMode(UI::EventParams &e) {
int mode = mode_->GetSelection();
if (layoutView_) {
layoutView_->mode_ = mode;
}
return UI::EVENT_DONE;
}
void TouchControlLayoutScreen::update() {
+3 -3
View File
@@ -36,9 +36,9 @@ public:
const char *tag() const override { return "TouchControlLayout"; }
protected:
UI::EventReturn OnReset(UI::EventParams &e);
UI::EventReturn OnVisibility(UI::EventParams &e);
UI::EventReturn OnMode(UI::EventParams &e);
void OnReset(UI::EventParams &e);
void OnVisibility(UI::EventParams &e);
void OnMode(UI::EventParams &e);
private:
UI::ChoiceStrip *mode_ = nullptr;
+3 -9
View File
@@ -38,7 +38,7 @@ public:
}
private:
UI::EventReturn HandleClick(UI::EventParams &e);
void HandleClick(UI::EventParams &e);
UI::CheckBox *checkbox_;
};
@@ -87,7 +87,6 @@ void TouchControlVisibilityScreen::CreateViews() {
toggles_.push_back({ "Analog Stick", &g_Config.touchAnalogStick.show, ImageID::invalid(), nullptr });
toggles_.push_back({ "Right Analog Stick", &g_Config.touchRightAnalogStick.show, ImageID::invalid(), [=](EventParams &e) {
screenManager()->push(new RightAnalogMappingScreen(gamePath_));
return UI::EVENT_DONE;
}});
toggles_.push_back({ "Fast-forward", &g_Config.touchFastForwardKey.show, ImageID::invalid(), nullptr });
@@ -96,7 +95,6 @@ void TouchControlVisibilityScreen::CreateViews() {
snprintf(temp, sizeof(temp), "Custom %d", i + 1);
toggles_.push_back({ temp, &g_Config.touchCustom[i].show, ImageID::invalid(), [=](EventParams &e) {
screenManager()->push(new CustomButtonMappingScreen(gamePath_, i));
return UI::EVENT_DONE;
} });
}
@@ -171,17 +169,13 @@ void RightAnalogMappingScreen::CreateViews() {
rightAnalogPress->SetEnabledPtr(&g_Config.bRightAnalogCustom);
}
UI::EventReturn TouchControlVisibilityScreen::OnToggleAll(UI::EventParams &e) {
void TouchControlVisibilityScreen::OnToggleAll(UI::EventParams &e) {
for (auto toggle : toggles_) {
*toggle.show = nextToggleAll_;
}
nextToggleAll_ = !nextToggleAll_;
return UI::EVENT_DONE;
}
UI::EventReturn CheckBoxChoice::HandleClick(UI::EventParams &e) {
void CheckBoxChoice::HandleClick(UI::EventParams &e) {
checkbox_->Toggle();
return UI::EVENT_DONE;
};
+2 -2
View File
@@ -28,7 +28,7 @@ struct TouchButtonToggle {
std::string key;
bool *show;
ImageID img;
std::function<UI::EventReturn(UI::EventParams&)> handle;
std::function<void(UI::EventParams&)> handle;
};
class TouchControlVisibilityScreen : public UIDialogScreenWithGameBackground {
@@ -40,7 +40,7 @@ public:
const char *tag() const override { return "TouchControlVisibility"; }
protected:
UI::EventReturn OnToggleAll(UI::EventParams &e);
void OnToggleAll(UI::EventParams &e);
private:
std::vector<TouchButtonToggle> toggles_;