#include #include #include #include #include #include static std::vector accSids, devSids, bcatSids, cacheSids; namespace ui { extern MainApplication *mainApp; void TitlesLayout::InitTitles() { this->titlesMenu = pu::ui::elm::Menu::New(0, 0, 1280, COLOR("#67000000"), COLOR("#170909FF"), 94, 7); for (size_t i = 0; i < getTitleCount(g_currentUId); i++) { Title title; getTitle(title, g_currentUId, i); auto titleItem = pu::ui::elm::MenuItem::New(title.name().c_str()); titleItem->SetColor(COLOR("#FFFFFFFF")); this->titlesMenu->AddItem(titleItem); } this->Add(this->titlesMenu); this->SetBackgroundColor(BACKGROUND_COLOR); } void TitlesLayout::onInput(u64 Down, u64 Up, u64 Held, pu::ui::TouchPoint Pos) { if (Down & HidNpadButton_Plus) { mainApp->Close(); return; } if (Down & HidNpadButton_A) { auto index = this->titlesMenu->GetSelectedIndex(); Title title; getTitle(title, g_currentUId, index); printf("userid is 0x%lX%lX\n", title.userId().uid[1], title.userId().uid[0]); // printf("current game index is %i\n", index); int opt = mainApp->CreateShowDialog(title.name().c_str(), "What do you want?", { "Transfer", "Receive" }, false); printf("opt is %i\n", opt); switch (opt) { case 0: { // Transfer selected auto result = io::backup(index, g_currentUId); if (std::get<0>(result)) { printf("path is %s\n", std::get<2>(result).c_str()); std::string path = std::get<2>(result); auto directory = std::filesystem::path(path); transfer_files(directory); } break; } case 1: { // Receive selected printf("startSendingThread\n"); int result = startSendingThread(); printf("result is %i\n", result); if (result == 0) { auto restoreResult = io::restore(index, g_currentUId, 0, title.name()); if (std::get<0>(restoreResult)) { printf("%s\n", std::get<2>(restoreResult).c_str()); } else { printf("Failed to restore with error %s\n", std::get<2>(restoreResult).c_str()); } } break; } } } } }