Skip to content

Commit

Permalink
Merge pull request #2 from XorTroll/master
Browse files Browse the repository at this point in the history
更新到最新
  • Loading branch information
Releed authored Dec 1, 2019
2 parents f19a271 + 04f45d0 commit 8e8b29e
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 125 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Update repo.
- name: Update repo
run: |
git submodule update --init --recursive
Expand All @@ -19,17 +19,13 @@ jobs:
sudo dpkg -i devkitpro-pacman.deb
sudo dkp-pacman -S $(dkp-pacman -Ssq switch-*) --noconfirm
- name: Building uLaunch
- name: Build uLaunch
run: |
echo ##########################
echo # SETTING PATH #
echo ##########################
echo
export DEVKITPRO=/opt/devkitpro
export DEVKITARM=${DEVKITPRO}/devkitARM
export DEVKITPPC=${DEVKITPRO}/devkitPPC
export PATH=${DEVKITPRO}/tools/bin:$PATH
make -j$(nproc)
make -j
- uses: actions/upload-artifact@master
with:
Expand Down
1 change: 0 additions & 1 deletion Common/Source/am/am_QCommunications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
47 changes: 0 additions & 47 deletions CurrentChangelog.md

This file was deleted.

4 changes: 2 additions & 2 deletions LibraryAppletQMenu/Include/ui/ui_MenuLayout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace ui
void settings_Click();
void themes_Click();
void users_Click();
void web_Click();
void controller_Click();
void MoveFolder(std::string name, bool fade);
void OnInput(u64 down, u64 up, u64 held, pu::ui::Touch pos);
void SetUser(u128 user);
Expand All @@ -48,7 +48,7 @@ namespace ui
pu::ui::elm::Image::Ref topMenuImage;
pu::ui::elm::Image::Ref connIcon;
ClickableImage::Ref users;
ClickableImage::Ref web;
ClickableImage::Ref controller;
ClickableImage::Ref logo;
pu::ui::elm::TextBlock::Ref timeText;
pu::ui::elm::TextBlock::Ref batteryText;
Expand Down
7 changes: 7 additions & 0 deletions LibraryAppletQMenu/Include/ui/ui_QMenuApplication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ namespace ui

void SetSelectedUser(u128 user_id);
u128 GetSelectedUser();

void CommonMenuOnLoop();
private:
am::QMenuStartMode stmode;
StartupLayout::Ref startupLayout;
Expand All @@ -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();
}
}
1 change: 1 addition & 0 deletions LibraryAppletQMenu/Include/ui/ui_QuickMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions LibraryAppletQMenu/RomFs/LangDefault.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -117,9 +117,9 @@
"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_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_quick": "Press L / R-stick or L / R / ZL / ZR to open the quick menu. Then, press A having an option focused, or press B to cancel.",
"help_multiselect": "Press Y to open the multiselect mode. Then, press Y to (de)select 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!)",
"help_minus": "Press Minus (-) on the main menu to swap between the normal menu and the homebrew menu.",
"help_plus": "Press Plus (+) to see uLaunch's information (project version, description...)"
}
6 changes: 3 additions & 3 deletions LibraryAppletQMenu/Source/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ int main()

if(smode == am::QMenuStartMode::MenuApplicationSuspended) qapp->Show();
else qapp->ShowWithFadeIn();
}

delete[] app_buf;
qmenu::Exit();
delete[] app_buf;
qmenu::Exit();
}
}

return 0;
Expand Down
2 changes: 2 additions & 0 deletions LibraryAppletQMenu/Source/ui/ui_LanguagesMenuLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
39 changes: 21 additions & 18 deletions LibraryAppletQMenu/Source/ui/ui_MenuLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ namespace ui
this->users->SetOnClick(std::bind(&MenuLayout::users_Click, this));
qapp->ApplyConfigForElement("main_menu", "user_icon", this->users);
this->Add(this->users);
this->web = ClickableImage::New(340, 53, cfg::GetAssetByTheme(theme, "ui/WebIcon.png"));
this->web->SetOnClick(std::bind(&MenuLayout::web_Click, this));
qapp->ApplyConfigForElement("main_menu", "web_icon", this->web);
this->Add(this->web);
this->controller = ClickableImage::New(340, 53, cfg::GetAssetByTheme(theme, "ui/ControllerIcon.png"));
this->controller->SetOnClick(std::bind(&MenuLayout::controller_Click, this));
qapp->ApplyConfigForElement("main_menu", "controller_icon", this->controller);
this->Add(this->controller);

auto curtime = util::GetCurrentTime();
this->timeText = pu::ui::elm::TextBlock::New(515, 68, curtime);
Expand Down Expand Up @@ -126,13 +126,13 @@ namespace ui
this->quickMenu = QuickMenu::New(cfg::GetAssetByTheme(theme, "ui/QuickMenuMain.png"));

this->quickMenu->SetEntry(QuickMenuDirection::Up, cfg::GetAssetByTheme(theme, "ui/UserIcon.png"), std::bind(&MenuLayout::users_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Down, cfg::GetAssetByTheme(theme, "ui/SettingsIcon.png"), std::bind(&MenuLayout::settings_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Left, cfg::GetAssetByTheme(theme, "ui/WebIcon.png"), std::bind(&MenuLayout::web_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::UpLeft, cfg::GetAssetByTheme(theme, "ui/PowerIcon.png"), std::bind(&MenuLayout::HandlePowerDialog, this));
this->quickMenu->SetEntry(QuickMenuDirection::UpRight, cfg::GetAssetByTheme(theme, "ui/SettingsIcon.png"), std::bind(&MenuLayout::settings_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Left, cfg::GetAssetByTheme(theme, "ui/ControllerIcon.png"), std::bind(&MenuLayout::controller_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::Right, cfg::GetAssetByTheme(theme, "ui/ThemesIcon.png"), std::bind(&MenuLayout::themes_Click, this));
this->quickMenu->SetEntry(QuickMenuDirection::UpLeft, cfg::GetAssetByTheme(theme, "ui/ControllerIcon.png"), std::bind(&MenuLayout::HandleControllerAppletOpen, this));
this->quickMenu->SetEntry(QuickMenuDirection::UpRight, cfg::GetAssetByTheme(theme, "ui/AlbumIcon.png"), std::bind(&MenuLayout::HandleOpenAlbum, this));
this->quickMenu->SetEntry(QuickMenuDirection::DownLeft, cfg::GetAssetByTheme(theme, "ui/PowerIcon.png"), std::bind(&MenuLayout::HandlePowerDialog, this));
this->quickMenu->SetEntry(QuickMenuDirection::DownRight, cfg::GetAssetByTheme(theme, "ui/HelpIcon.png"), std::bind(&MenuLayout::HandleShowHelp, this));
this->quickMenu->SetEntry(QuickMenuDirection::DownLeft, cfg::GetAssetByTheme(theme, "ui/WebIcon.png"), std::bind(&MenuLayout::HandleWebPageOpen, this));
this->quickMenu->SetEntry(QuickMenuDirection::DownRight, cfg::GetAssetByTheme(theme, "ui/AlbumIcon.png"), std::bind(&MenuLayout::HandleOpenAlbum, this));
this->quickMenu->SetEntry(QuickMenuDirection::Down, cfg::GetAssetByTheme(theme, "ui/HelpIcon.png"), std::bind(&MenuLayout::HandleShowHelp, this));

this->Add(this->quickMenu);

Expand Down Expand Up @@ -292,14 +292,14 @@ namespace ui
{
if(down & KEY_A)
{
pu::audio::Play(this->sfxTitleLaunch);
am::QMenuCommandWriter writer(am::QDaemonMessage::LaunchHomebrewLibApplet);
hb::TargetInput ipt = {};
strcpy(ipt.nro_path, "sdmc:/hbmenu.nro"); // Launch normal hbmenu
strcpy(ipt.argv, "sdmc:/hbmenu.nro");
writer.Write<hb::TargetInput>(ipt);
writer.FinishWrite();

pu::audio::Play(this->sfxTitleLaunch);
qapp->StopPlayBGM();
qapp->CloseWithFadeOut();
return;
Expand Down Expand Up @@ -401,14 +401,14 @@ namespace ui
if((cfg::TitleType)title.title_type == cfg::TitleType::Homebrew) this->HandleHomebrewLaunch(title);
else
{
pu::audio::Play(this->sfxTitleLaunch);
am::QMenuCommandWriter writer(am::QDaemonMessage::LaunchApplication);
writer.Write<u64>(title.app_id);
writer.FinishWrite();

am::QMenuCommandResultReader reader;
if(reader && R_SUCCEEDED(reader.GetReadResult()))
{
pu::audio::Play(this->sfxTitleLaunch);
qapp->StopPlayBGM();
qapp->CloseWithFadeOut();
return;
Expand Down Expand Up @@ -542,8 +542,8 @@ namespace ui
if((cfg::TitleType)title.title_type == cfg::TitleType::Homebrew) this->bannerImage->SetImage(cfg::GetAssetByTheme(theme, "ui/BannerHomebrew.png"));
else this->bannerImage->SetImage(cfg::GetAssetByTheme(theme, "ui/BannerInstalled.png"));
}
if(!this->curfolder.empty()) this->bannerImage->SetImage(cfg::GetAssetByTheme(theme, "ui/BannerFolder.png")); // This way user always knows he's inside a folder
}
if(!this->curfolder.empty()) this->bannerImage->SetImage(cfg::GetAssetByTheme(theme, "ui/BannerFolder.png")); // This way user always knows he's inside a folder
}

void MenuLayout::MoveFolder(std::string name, bool fade)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -719,10 +721,11 @@ namespace ui

if(down & KEY_B)
{
if(!this->curfolder.empty()) this->MoveFolder("", true);
if(!this->curfolder.empty() && !this->homebrew_mode) this->MoveFolder("", true);
}
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)
Expand Down Expand Up @@ -765,9 +768,9 @@ namespace ui
this->HandleUserMenu();
}

void MenuLayout::web_Click()
void MenuLayout::controller_Click()
{
this->HandleWebPageOpen();
this->HandleControllerAppletOpen();
}

void MenuLayout::HandleCloseSuspended()
Expand Down Expand Up @@ -796,6 +799,7 @@ namespace ui
else launchmode = 1;
if(launchmode == 1)
{
pu::audio::Play(this->sfxTitleLaunch);
hb::TargetInput ipt = {};
strcpy(ipt.nro_path, rec.nro_target.nro_path);
strcpy(ipt.argv, rec.nro_target.nro_path);
Expand All @@ -805,7 +809,6 @@ namespace ui
writer.Write<hb::TargetInput>(ipt);
writer.FinishWrite();

pu::audio::Play(this->sfxTitleLaunch);
qapp->StopPlayBGM();
qapp->CloseWithFadeOut();
return;
Expand All @@ -821,6 +824,7 @@ namespace ui
}
if(launch)
{
pu::audio::Play(this->sfxTitleLaunch);
hb::TargetInput ipt = {};
strcpy(ipt.nro_path, rec.nro_target.nro_path);
strcpy(ipt.argv, rec.nro_target.nro_path);
Expand All @@ -833,7 +837,6 @@ namespace ui
am::QMenuCommandResultReader reader;
if(reader && R_SUCCEEDED(reader.GetReadResult()))
{
pu::audio::Play(this->sfxTitleLaunch);
qapp->StopPlayBGM();
qapp->CloseWithFadeOut();
return;
Expand Down
Loading

0 comments on commit 8e8b29e

Please sign in to comment.