MCPcopy Create free account
hub / github.com/XorTroll/uLaunch / OnLayoutInput

Method OnLayoutInput

projects/uMenu/source/ul/menu/ui/ui_IMenuLayout.cpp:146–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144 }
145
146 void IMenuLayout::OnLayoutInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const pu::ui::TouchPoint touch_pos) {
147 {
148 ScopedLock lk(this->msg_queue_lock);
149
150 if(!this->msg_queue.empty()) {
151 const auto first_msg = this->msg_queue.front();
152
153 switch(first_msg.msg) {
154 case smi::MenuMessage::HomeRequest: {
155 g_HomeButtonPressHandleCount++;
156 if(g_HomeButtonPressHandleCount == 1) {
157 if(this->OnHomeButtonPress()) {
158 g_HomeButtonPressHandleCount = 0;
159 this->msg_queue.pop();
160 }
161 }
162 break;
163 }
164 case smi::MenuMessage::GameCardMountFailure: {
165 g_MenuApplication->NotifyGameCardMountFailure(first_msg.gc_mount_failure.mount_rc);
166 this->msg_queue.pop();
167 break;
168 }
169 case smi::MenuMessage::SdCardEjected: {
170 this->msg_queue.pop();
171 while(true) {
172 const auto option = g_MenuApplication->DisplayDialog(GetLanguageString("sd_card"), GetLanguageString("sd_card_ejected"), { GetLanguageString("shutdown"), GetLanguageString("reboot") }, false);
173 if(option == 0) {
174 ShutdownSystem();
175 }
176 else if(option == 1) {
177 RebootSystem();
178 }
179 }
180 break;
181 }
182 case smi::MenuMessage::PreviousLaunchFailure: {
183 g_MenuApplication->NotifyLaunchFailed();
184 this->msg_queue.pop();
185 break;
186 }
187 case smi::MenuMessage::ChosenHomebrew: {
188 g_MenuApplication->NotifyHomebrewChosen(first_msg.chosen_hb.nro_path);
189 this->msg_queue.pop();
190 break;
191 }
192 case smi::MenuMessage::FinishedSleep: {
193 this->msg_queue.pop();
194 OnFinishedSleep();
195 break;
196 }
197 case smi::MenuMessage::ApplicationRecordsChanged: {
198 g_MenuApplication->NotifyApplicationRecordReloadNeeded();
199 if(first_msg.app_records_changed.records_added_or_deleted) {
200 // Need to also reload entries as well
201 g_MenuApplication->NotifyApplicationEntryReloadNeeded();
202 }
203 this->msg_queue.pop();

Callers

nothing calls this directly

Calls 14

ShutdownSystemFunction · 0.85
OnFinishedSleepFunction · 0.85
DisplayDialogMethod · 0.80
NotifyLaunchFailedMethod · 0.80
NotifyHomebrewChosenMethod · 0.80
NotifyVerifyFinishedMethod · 0.80
GetLanguageStringFunction · 0.70
RebootSystemFunction · 0.70

Tested by

no test coverage detected