mirror of
https://github.com/XorTroll/uLaunch
synced 2024-11-10 06:24:12 +00:00
Some input changes, check for lack of controllers on menus
This commit is contained in:
parent
7b784b40b9
commit
0abf9fa1fa
10 changed files with 43 additions and 42 deletions
|
@ -121,7 +121,6 @@ namespace am
|
|||
Result QDaemon_QMenuWriteImpl(void *data, size_t size, bool wait)
|
||||
Q_AM_WAIT(LibraryAppletSend(data, size))
|
||||
|
||||
|
||||
Result QDaemon_QMenuReadImpl(void *data, size_t size, bool wait)
|
||||
Q_AM_WAIT(LibraryAppletRead(data, size))
|
||||
|
||||
|
|
|
@ -78,6 +78,8 @@ namespace ui
|
|||
|
||||
void SetSelectedUser(u128 user_id);
|
||||
u128 GetSelectedUser();
|
||||
|
||||
void CommonMenuOnLoop();
|
||||
private:
|
||||
am::QMenuStartMode stmode;
|
||||
StartupLayout::Ref startupLayout;
|
||||
|
@ -94,4 +96,9 @@ namespace ui
|
|||
u32 bgm_fade_out_ms;
|
||||
pu::audio::Music bgm;
|
||||
};
|
||||
|
||||
inline void QMenuApplication::CommonMenuOnLoop() // Stuff all menus should handle (currently just connected controllers)
|
||||
{
|
||||
if(!hidIsControllerConnected(CONTROLLER_HANDHELD) && !hidIsControllerConnected(CONTROLLER_PLAYER_1)) this->menuLayout->HandleControllerAppletOpen();
|
||||
}
|
||||
}
|
|
@ -46,6 +46,7 @@ namespace ui
|
|||
s32 GetWidth();
|
||||
s32 GetHeight();
|
||||
|
||||
void Toggle(); // Off if on, on if off (just change to the opposite state)
|
||||
bool IsOn();
|
||||
|
||||
void OnRender(pu::ui::render::Renderer::Ref &Drawer, s32 X, s32 Y);
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
"set_viewer_info": "You must enable this if you want to use the PC screen viewer (uViewer). It is not necessary otherwise.",
|
||||
"set_flog_info": "This must be enabled to be able to launch homebrew directly as applications. Note that this might involve BAN RISK.",
|
||||
"startup_welcome_info": "Welcome! Please select an account to use.",
|
||||
"startup_control_info": "Hold the L or R-stick in order to open menus easily from main menu.",
|
||||
"startup_control_info": "Hold the L / R-stick or Z / R / ZL / ZR in order to open menus easily from main menu.",
|
||||
"startup_login_error": "Invalid password. Please try again.",
|
||||
"startup_password": "(password)",
|
||||
"startup_new_user": "Create new user",
|
||||
|
@ -117,7 +117,7 @@
|
|||
"help_title": "uLaunch help",
|
||||
"help_launch": "Press A to launch the selected entry, or to return to it if suspended.",
|
||||
"help_close": "Press X to close the currently opened title.",
|
||||
"help_quick": "Hold a stick (L or R-stick) and move it while being held to select an option in the quick menu, then release it to open it.",
|
||||
"help_quick": "Press L / R-stick or L / R / ZL / ZR to open the quick menu. There press A having an option focused to select it or press B to cancel.",
|
||||
"help_multiselect": "Press Y to open the multiselect mode\n(with this mode open, press Y to select/deselect any title, Y to confirm the selection or B to cancel)",
|
||||
"help_back": "Press B or HOME on any menu (except the startup menu) to return to the main menu.",
|
||||
"help_minus": "Press Minus (-) on the main menu to swap between the normal menu and the homebrew menu\n(the first swap will take longer due to homebrew scanning!)",
|
||||
|
|
|
@ -128,6 +128,8 @@ namespace ui
|
|||
|
||||
void LanguagesMenuLayout::OnInput(u64 down, u64 up, u64 held, pu::ui::Touch pos)
|
||||
{
|
||||
qapp->CommonMenuOnLoop();
|
||||
|
||||
bool ret = am::QMenuIsHomePressed();
|
||||
if(down & KEY_B)
|
||||
{
|
||||
|
|
|
@ -604,6 +604,8 @@ namespace ui
|
|||
|
||||
void MenuLayout::OnInput(u64 down, u64 up, u64 held, pu::ui::Touch pos)
|
||||
{
|
||||
qapp->CommonMenuOnLoop();
|
||||
|
||||
auto quickon = this->quickMenu->IsOn();
|
||||
this->itemsMenu->SetEnabled(!quickon);
|
||||
if(quickon) return;
|
||||
|
@ -723,6 +725,7 @@ namespace ui
|
|||
}
|
||||
else if(down & KEY_PLUS) this->logo_Click();
|
||||
else if(down & KEY_MINUS) this->menuToggle_Click();
|
||||
else if((down & KEY_L) || (down & KEY_R) || (down & KEY_ZL) || (down & KEY_ZR) || (down & KEY_LSTICK) || (down & KEY_RSTICK)) this->quickMenu->Toggle();
|
||||
}
|
||||
|
||||
void MenuLayout::SetUser(u128 user)
|
||||
|
|
|
@ -48,6 +48,11 @@ namespace ui
|
|||
{
|
||||
return 720;
|
||||
}
|
||||
|
||||
void QuickMenu::Toggle()
|
||||
{
|
||||
this->on = !this->on;
|
||||
}
|
||||
|
||||
bool QuickMenu::IsOn()
|
||||
{
|
||||
|
@ -130,12 +135,14 @@ namespace ui
|
|||
}
|
||||
else
|
||||
{
|
||||
auto prevon = this->on;
|
||||
this->on = false;
|
||||
if(Held & KEY_LSTICK) this->on = true;
|
||||
if(Held & KEY_RSTICK) this->on = true;
|
||||
|
||||
if(prevon && !this->on) this->off_wait = prevheld;
|
||||
if(Down & KEY_A) this->Toggle();
|
||||
else if(Down & KEY_B)
|
||||
{
|
||||
prevheld = 0;
|
||||
this->Toggle();
|
||||
}
|
||||
|
||||
if(!this->on && (this->bgalpha > 0) && (this->fgalpha > 0)) this->off_wait = prevheld;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,40 +150,20 @@ namespace ui
|
|||
{
|
||||
QuickMenuDirection dir = QuickMenuDirection::None;
|
||||
|
||||
if(this->lastheld & KEY_RSTICK)
|
||||
if(this->lastheld & KEY_UP)
|
||||
{
|
||||
if(this->lastheld & KEY_RSTICK_UP)
|
||||
{
|
||||
dir = QuickMenuDirection::Up;
|
||||
if(this->lastheld & KEY_RSTICK_LEFT) dir = QuickMenuDirection::UpLeft;
|
||||
else if(this->lastheld & KEY_RSTICK_RIGHT) dir = QuickMenuDirection::UpRight;
|
||||
}
|
||||
else if(this->lastheld & KEY_RSTICK_DOWN)
|
||||
{
|
||||
dir = QuickMenuDirection::Down;
|
||||
if(this->lastheld & KEY_RSTICK_LEFT) dir = QuickMenuDirection::DownLeft;
|
||||
else if(this->lastheld & KEY_RSTICK_RIGHT) dir = QuickMenuDirection::DownRight;
|
||||
}
|
||||
else if(this->lastheld & KEY_RSTICK_LEFT) dir = QuickMenuDirection::Left;
|
||||
else if(this->lastheld & KEY_RSTICK_RIGHT) dir = QuickMenuDirection::Right;
|
||||
dir = QuickMenuDirection::Up;
|
||||
if(this->lastheld & KEY_LEFT) dir = QuickMenuDirection::UpLeft;
|
||||
else if(this->lastheld & KEY_RIGHT) dir = QuickMenuDirection::UpRight;
|
||||
}
|
||||
else if(this->lastheld & KEY_LSTICK)
|
||||
else if(this->lastheld & KEY_DOWN)
|
||||
{
|
||||
if(this->lastheld & KEY_LSTICK_UP)
|
||||
{
|
||||
dir = QuickMenuDirection::Up;
|
||||
if(this->lastheld & KEY_LSTICK_LEFT) dir = QuickMenuDirection::UpLeft;
|
||||
else if(this->lastheld & KEY_LSTICK_RIGHT) dir = QuickMenuDirection::UpRight;
|
||||
}
|
||||
else if(this->lastheld & KEY_LSTICK_DOWN)
|
||||
{
|
||||
dir = QuickMenuDirection::Down;
|
||||
if(this->lastheld & KEY_LSTICK_LEFT) dir = QuickMenuDirection::DownLeft;
|
||||
else if(this->lastheld & KEY_LSTICK_RIGHT) dir = QuickMenuDirection::DownRight;
|
||||
}
|
||||
else if(this->lastheld & KEY_LSTICK_LEFT) dir = QuickMenuDirection::Left;
|
||||
else if(this->lastheld & KEY_LSTICK_RIGHT) dir = QuickMenuDirection::Right;
|
||||
dir = QuickMenuDirection::Down;
|
||||
if(this->lastheld & KEY_LEFT) dir = QuickMenuDirection::DownLeft;
|
||||
else if(this->lastheld & KEY_RIGHT) dir = QuickMenuDirection::DownRight;
|
||||
}
|
||||
else if(this->lastheld & KEY_LEFT) dir = QuickMenuDirection::Left;
|
||||
else if(this->lastheld & KEY_RIGHT) dir = QuickMenuDirection::Right;
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
|
|
@ -268,6 +268,8 @@ namespace ui
|
|||
|
||||
void SettingsMenuLayout::OnInput(u64 down, u64 up, u64 held, pu::ui::Touch pos)
|
||||
{
|
||||
qapp->CommonMenuOnLoop();
|
||||
|
||||
bool ret = am::QMenuIsHomePressed();
|
||||
if(down & KEY_B) ret = true;
|
||||
if(ret)
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace ui
|
|||
|
||||
void StartupLayout::OnInput(u64 down, u64 up, u64 held, pu::ui::Touch pos)
|
||||
{
|
||||
qapp->CommonMenuOnLoop();
|
||||
|
||||
if(this->loadmenu)
|
||||
{
|
||||
this->loadmenu = false;
|
||||
|
|
|
@ -126,7 +126,7 @@ void HandleGeneralChannel()
|
|||
}
|
||||
}
|
||||
}
|
||||
svcSleepThread(100000000L);
|
||||
svcSleepThread(100'000'000L);
|
||||
}
|
||||
|
||||
void HandleAppletMessage()
|
||||
|
@ -434,8 +434,6 @@ namespace qdaemon
|
|||
svcSleepThread(10'000'000);
|
||||
}
|
||||
#endif
|
||||
|
||||
svcSleepThread(100'000'000); // Wait for proper moment
|
||||
}
|
||||
|
||||
void Exit()
|
||||
|
|
Loading…
Reference in a new issue