mirror of
https://github.com/XorTroll/uLaunch
synced 2025-02-16 12:38:29 +00:00
Small fixes, support latest ams and libnx
This commit is contained in:
parent
e3f25760d7
commit
f0641556a3
15 changed files with 49 additions and 46 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 11ea38a7d7cc5d449ce9102544773b73e4586842
|
||||
Subproject commit eb667fea5142fd35caf539289603748dd6f4f87e
|
|
@ -1 +1 @@
|
|||
Subproject commit 716afb53b69218613083133f128cbd4b64e1d707
|
||||
Subproject commit 4ddfe0a01d4fb6d3b5ac300d615ec2847243be56
|
|
@ -445,7 +445,7 @@ namespace {
|
|||
}
|
||||
if(strlen(g_HbTargetLaunchFlag.nro_path)) {
|
||||
if(!am::LibraryAppletIsActive()) {
|
||||
auto params = hb::HbTargetParams::Create(g_HbTargetLaunchFlag.nro_path, g_HbTargetLaunchFlag.nro_argv, false);
|
||||
auto params = hb::HbTargetParams::Create(g_HbTargetLaunchFlag.nro_path, g_HbTargetLaunchFlag.nro_argv, true);
|
||||
UL_ASSERT(ecs::RegisterLaunchAsApplet(g_Config.homebrew_applet_program_id, 0, "/ulaunch/bin/uHbTarget/applet", ¶ms, sizeof(params)));
|
||||
|
||||
sth_done = true;
|
||||
|
|
|
@ -45,7 +45,7 @@ LIBS := -lpu -lfreetype -lSDL2_mixer -lopusfile -lopus -lmodplug -lmpg123 -lvorb
|
|||
# list of directories containing libraries, this must be the top level containing
|
||||
# include and lib
|
||||
#---------------------------------------------------------------------------------
|
||||
LIBDIRS := $(PORTLIBS) $(LIBNX) $(TOPDIR)/../Plutonium/Plutonium/Output
|
||||
LIBDIRS := $(PORTLIBS) $(LIBNX) $(TOPDIR)/../Plutonium/Plutonium/out
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace ui {
|
|||
|
||||
public:
|
||||
using Application::Application;
|
||||
|
||||
|
||||
~MenuApplication() {
|
||||
pu::audio::Delete(this->bgm);
|
||||
}
|
||||
|
|
|
@ -44,11 +44,6 @@ namespace {
|
|||
UL_ASSERT(setsysInitialize());
|
||||
UL_ASSERT(setInitialize());
|
||||
|
||||
// Register handlers for HOME button press detection
|
||||
am::RegisterLibAppletHomeButtonDetection();
|
||||
ui::MenuApplication::RegisterHomeButtonDetection();
|
||||
ui::QuickMenu::RegisterHomeButtonDetection();
|
||||
|
||||
// Initialize uDaemon message handling
|
||||
UL_ASSERT(am::InitializeDaemonMessageHandler());
|
||||
|
||||
|
@ -121,6 +116,11 @@ int main() {
|
|||
|
||||
g_MenuApplication->SetInformation(smode, status, uijson);
|
||||
g_MenuApplication->Prepare();
|
||||
|
||||
// Register handlers for HOME button press detection
|
||||
am::RegisterLibAppletHomeButtonDetection();
|
||||
ui::MenuApplication::RegisterHomeButtonDetection();
|
||||
ui::QuickMenu::RegisterHomeButtonDetection();
|
||||
|
||||
if(smode == dmi::MenuStartMode::MenuApplicationSuspended) {
|
||||
g_MenuApplication->Show();
|
||||
|
|
|
@ -75,8 +75,6 @@ namespace ui {
|
|||
}
|
||||
}
|
||||
else if(!touch_pos.IsEmpty()) {
|
||||
touchPosition tch;
|
||||
hidTouchRead(&tch, 0);
|
||||
if((touch_pos.X >= this->GetProcessedX()) && (touch_pos.X < (this->GetProcessedX() + w)) && (touch_pos.Y >= this->GetProcessedY()) && (touch_pos.Y < (this->GetProcessedY() + h))) {
|
||||
this->touchtp = std::chrono::steady_clock::now();
|
||||
this->touched = true;
|
||||
|
|
|
@ -15,9 +15,11 @@ namespace ui {
|
|||
if(home_press) {
|
||||
this->OnHomeButtonPress();
|
||||
}
|
||||
/* TODO
|
||||
if(!hidIsControllerConnected(CONTROLLER_HANDHELD) && !hidIsControllerConnected(CONTROLLER_PLAYER_1)) {
|
||||
actions::ShowControllerSupport();
|
||||
}
|
||||
*/
|
||||
this->OnMenuInput(down, up, held, touch_pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace ui {
|
|||
}
|
||||
|
||||
void LanguagesMenuLayout::OnMenuInput(u64 down, u64 up, u64 held, pu::ui::Touch touch_pos) {
|
||||
if(down & KEY_B) {
|
||||
if(down & HidNpadButton_B) {
|
||||
g_MenuApplication->FadeOut();
|
||||
g_MenuApplication->LoadSettingsMenu();
|
||||
g_MenuApplication->FadeIn();
|
||||
|
|
|
@ -149,7 +149,9 @@ namespace ui {
|
|||
if(this->bgm_fade_in_ms > 0) {
|
||||
pu::audio::PlayWithFadeIn(this->bgm, loops, this->bgm_fade_in_ms);
|
||||
}
|
||||
else pu::audio::Play(this->bgm, loops);
|
||||
else {
|
||||
pu::audio::Play(this->bgm, loops);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,15 +219,15 @@ namespace ui {
|
|||
}
|
||||
}
|
||||
|
||||
if(down & KEY_B) {
|
||||
if(down & HidNpadButton_B) {
|
||||
if(!this->curfolder.empty() && !this->homebrew_mode) {
|
||||
this->MoveFolder("", true);
|
||||
}
|
||||
}
|
||||
else if(down & KEY_PLUS) {
|
||||
else if(down & HidNpadButton_Plus) {
|
||||
actions::ShowAboutDialog();
|
||||
}
|
||||
else if(down & KEY_MINUS) {
|
||||
else if(down & HidNpadButton_Minus) {
|
||||
this->menuToggle_Click();
|
||||
}
|
||||
}
|
||||
|
@ -248,14 +248,14 @@ namespace ui {
|
|||
}
|
||||
|
||||
void MenuLayout::menu_Click(u64 down, u32 index) {
|
||||
if(this->select_on && (down & KEY_A)) {
|
||||
if(this->select_on && (down & HidNpadButton_A)) {
|
||||
if(!this->itemsMenu->IsAnyMultiselected()) {
|
||||
this->StopMultiselect();
|
||||
}
|
||||
}
|
||||
if(this->select_on) {
|
||||
if(select_dir) {
|
||||
if((down & KEY_A) || (down & KEY_Y)) {
|
||||
if((down & HidNpadButton_A) || (down & HidNpadButton_Y)) {
|
||||
if((!this->homebrew_mode) && this->curfolder.empty()) {
|
||||
if(index < g_EntryList.folders.size()) {
|
||||
auto &folder = g_EntryList.folders[index];
|
||||
|
@ -269,17 +269,17 @@ namespace ui {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(down & KEY_B) {
|
||||
else if(down & HidNpadButton_B) {
|
||||
this->select_dir = false;
|
||||
g_MenuApplication->ShowNotification(cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "menu_move_select_folder_cancel"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(down & KEY_B) {
|
||||
if(down & HidNpadButton_B) {
|
||||
g_MenuApplication->ShowNotification(cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "menu_multiselect_cancel"));
|
||||
this->StopMultiselect();
|
||||
}
|
||||
else if(down & KEY_Y) {
|
||||
else if(down & HidNpadButton_Y) {
|
||||
auto selectable = false;
|
||||
if(this->homebrew_mode) {
|
||||
selectable = true;
|
||||
|
@ -296,7 +296,7 @@ namespace ui {
|
|||
this->itemsMenu->SetItemMultiselected(index, !this->itemsMenu->IsItemMultiselected(index));
|
||||
}
|
||||
}
|
||||
else if(down & KEY_A) {
|
||||
else if(down & HidNpadButton_A) {
|
||||
if(this->homebrew_mode) {
|
||||
auto sopt = g_MenuApplication->CreateShowDialog(cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "menu_multiselect"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "hb_mode_entries_add"), { cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "yes"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "no"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "cancel") }, true);
|
||||
if(sopt == 0) {
|
||||
|
@ -380,7 +380,7 @@ namespace ui {
|
|||
}
|
||||
else {
|
||||
if((index == 0) && this->homebrew_mode) {
|
||||
if(down & KEY_A) {
|
||||
if(down & HidNpadButton_A) {
|
||||
pu::audio::Play(this->sfxTitleLaunch);
|
||||
|
||||
hb::HbTargetParams ipt = {};
|
||||
|
@ -407,7 +407,7 @@ namespace ui {
|
|||
if(this->homebrew_mode) {
|
||||
realidx--;
|
||||
auto hb = g_HomebrewRecordList[realidx];
|
||||
if(down & KEY_A) {
|
||||
if(down & HidNpadButton_A) {
|
||||
auto hblaunch = true;
|
||||
if(g_MenuApplication->IsHomebrewSuspended()) {
|
||||
if(g_MenuApplication->EqualsSuspendedHomebrewPath(hb.nro_target.nro_path)) {
|
||||
|
@ -426,14 +426,14 @@ namespace ui {
|
|||
this->HandleHomebrewLaunch(hb);
|
||||
}
|
||||
}
|
||||
else if(down & KEY_X) {
|
||||
else if(down & HidNpadButton_X) {
|
||||
if(g_MenuApplication->IsSuspended()) {
|
||||
if(g_MenuApplication->EqualsSuspendedHomebrewPath(hb.nro_target.nro_path)) {
|
||||
this->HandleCloseSuspended();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(down & KEY_Y) {
|
||||
else if(down & HidNpadButton_Y) {
|
||||
this->select_on = true;
|
||||
this->itemsMenu->SetItemMultiselected(this->itemsMenu->GetSelectedItem(), true);
|
||||
}
|
||||
|
@ -447,10 +447,10 @@ namespace ui {
|
|||
}
|
||||
else {
|
||||
auto &foldr = g_EntryList.folders[realidx];
|
||||
if(down & KEY_A) {
|
||||
if(down & HidNpadButton_A) {
|
||||
this->MoveFolder(foldr.name, true);
|
||||
}
|
||||
else if(down & KEY_Y) {
|
||||
else if(down & HidNpadButton_Y) {
|
||||
auto sopt = g_MenuApplication->CreateShowDialog(cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "menu_rename_folder"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "menu_rename_folder_conf"), { cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "yes"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "no") }, true);
|
||||
if(sopt == 0) {
|
||||
SwkbdConfig swkbd;
|
||||
|
@ -471,7 +471,7 @@ namespace ui {
|
|||
if(titleidx >= 0) {
|
||||
auto title = folder.titles[titleidx];
|
||||
const auto type = static_cast<cfg::TitleType>(title.title_type);
|
||||
if(down & KEY_A) {
|
||||
if(down & HidNpadButton_A) {
|
||||
bool titlelaunch = true;
|
||||
|
||||
if(g_MenuApplication->IsSuspended()) {
|
||||
|
@ -527,7 +527,7 @@ namespace ui {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(down & KEY_X) {
|
||||
else if(down & HidNpadButton_X) {
|
||||
if(g_MenuApplication->IsSuspended()) {
|
||||
if(type == cfg::TitleType::Homebrew) {
|
||||
if(g_MenuApplication->EqualsSuspendedHomebrewPath(title.nro_target.nro_path)) {
|
||||
|
@ -541,7 +541,7 @@ namespace ui {
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(down & KEY_Y) {
|
||||
else if(down & HidNpadButton_Y) {
|
||||
if(type == cfg::TitleType::Homebrew) {
|
||||
auto sopt = g_MenuApplication->CreateShowDialog(cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "entry_options"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "entry_action"), { cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "entry_move"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "entry_remove"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "cancel") }, true);
|
||||
if(sopt == 0) {
|
||||
|
@ -565,7 +565,7 @@ namespace ui {
|
|||
this->itemsMenu->SetItemMultiselected(this->itemsMenu->GetSelectedItem(), true);
|
||||
}
|
||||
}
|
||||
else if(down & KEY_UP) {
|
||||
else if(down & HidNpadButton_AnyUp) {
|
||||
if(type == cfg::TitleType::Installed) {
|
||||
auto sopt = g_MenuApplication->CreateShowDialog(cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "app_launch"), cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "app_take_over_select") + "\n" + cfg::GetLanguageString(g_Config.main_lang, g_Config.default_lang, "app_take_over_selected"), { "Yes", "Cancel" }, true);
|
||||
if(sopt == 0) {
|
||||
|
@ -828,13 +828,14 @@ namespace ui {
|
|||
if(launch) {
|
||||
pu::audio::Play(this->sfxTitleLaunch);
|
||||
hb::HbTargetParams ipt = {};
|
||||
strncpy(ipt.nro_path, rec.nro_target.nro_path, sizeof(ipt.nro_path));
|
||||
strncpy(ipt.nro_argv, rec.nro_target.nro_argv, sizeof(ipt.nro_argv));
|
||||
strncpy(ipt.nro_path, rec.nro_target.nro_path, sizeof(ipt.nro_path) - 1);
|
||||
if(strlen(rec.nro_target.nro_argv)) {
|
||||
auto new_argv = std::string(rec.nro_target.nro_path) + " " + rec.nro_target.nro_argv;
|
||||
strncpy(ipt.nro_argv, new_argv.c_str(), sizeof(ipt.nro_argv));
|
||||
strncpy(ipt.nro_argv, new_argv.c_str(), sizeof(ipt.nro_argv) - 1);
|
||||
}
|
||||
else {
|
||||
strncpy(ipt.nro_argv, rec.nro_target.nro_argv, sizeof(ipt.nro_argv) - 1);
|
||||
}
|
||||
|
||||
auto rc = dmi::menu::SendCommand(dmi::DaemonMessage::LaunchHomebrewApplication, [&](dmi::menu::MenuScopedStorageWriter &writer) {
|
||||
writer.Push(g_Config.homebrew_title_application_id);
|
||||
writer.Push(ipt);
|
||||
|
|
|
@ -135,10 +135,10 @@ namespace ui {
|
|||
this->options_menu->OnInput(down, up, held, touch_pos);
|
||||
}
|
||||
|
||||
if((down & KEY_L) || (down & KEY_R) || (down & KEY_ZL) || (down & KEY_ZR)) {
|
||||
if((down & HidNpadButton_L) || (down & HidNpadButton_R) || (down & HidNpadButton_ZL) || (down & HidNpadButton_ZR)) {
|
||||
this->Toggle();
|
||||
}
|
||||
else if((down & KEY_B) || (down & KEY_A)) {
|
||||
else if((down & HidNpadButton_B) || (down & HidNpadButton_A)) {
|
||||
// B only valid for toggling off
|
||||
// A = something selected in the menu
|
||||
if(this->on) {
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace ui {
|
|||
}
|
||||
|
||||
void SettingsMenuLayout::OnMenuInput(u64 down, u64 up, u64 held, pu::ui::Touch pos) {
|
||||
if(down & KEY_B) {
|
||||
if(down & HidNpadButton_B) {
|
||||
g_MenuApplication->FadeOut();
|
||||
g_MenuApplication->LoadMenu();
|
||||
g_MenuApplication->FadeIn();
|
||||
|
|
|
@ -115,10 +115,10 @@ namespace ui
|
|||
return;
|
||||
}
|
||||
|
||||
if(down & KEY_LEFT) {
|
||||
if(down & HidNpadButton_AnyLeft) {
|
||||
HandleMoveLeft();
|
||||
}
|
||||
else if(down & KEY_RIGHT) {
|
||||
else if(down & HidNpadButton_AnyRight) {
|
||||
HandleMoveRight();
|
||||
}
|
||||
else if(!touch_pos.IsEmpty()) {
|
||||
|
@ -130,7 +130,7 @@ namespace ui
|
|||
constexpr auto item_size = static_cast<s32>(ItemSize);
|
||||
if((touch_pos.X >= basex) && (touch_pos.X < (basex + item_size)) && (touch_pos.Y >= basey) && (touch_pos.Y < (basey + item_size))) {
|
||||
if((this->baseiconidx + i) == selitm) {
|
||||
(this->onselect)(KEY_A, this->selitm);
|
||||
(this->onselect)(HidNpadButton_A, this->selitm);
|
||||
}
|
||||
else {
|
||||
preselitm = selitm;
|
||||
|
@ -148,7 +148,7 @@ namespace ui
|
|||
(this->onselect)(down, this->selitm);
|
||||
}
|
||||
|
||||
if(held & KEY_LEFT) {
|
||||
if(held & HidNpadButton_AnyLeft) {
|
||||
if(this->scrollflag == 1) {
|
||||
auto curtp = std::chrono::steady_clock::now();
|
||||
auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(curtp - this->scrolltp).count();
|
||||
|
@ -176,7 +176,7 @@ namespace ui
|
|||
this->scrolltp = std::chrono::steady_clock::now();
|
||||
}
|
||||
}
|
||||
else if(held & KEY_RIGHT) {
|
||||
else if(held & HidNpadButton_AnyRight) {
|
||||
if(this->scrollflag == 2) {
|
||||
auto curtp = std::chrono::steady_clock::now();
|
||||
auto diff = std::chrono::duration_cast<std::chrono::milliseconds>(curtp - this->scrolltp).count();
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace ui {
|
|||
}
|
||||
|
||||
void ThemeMenuLayout::OnMenuInput(u64 down, u64 up, u64 held, pu::ui::Touch touch_pos) {
|
||||
if(down & KEY_B) {
|
||||
if(down & HidNpadButton_B) {
|
||||
g_MenuApplication->FadeOut();
|
||||
g_MenuApplication->LoadMenu();
|
||||
g_MenuApplication->FadeIn();
|
||||
|
|
Loading…
Add table
Reference in a new issue