transfer to switch

This commit is contained in:
2024-11-22 00:09:18 +03:00
parent 3851d474d0
commit 97c460fb5a
3 changed files with 68 additions and 15 deletions

View File

@@ -3,6 +3,7 @@
#include <main.hpp>
#include <const.h>
#include <client.hpp>
#include <server.hpp>
static std::vector<uint64_t> accSids, devSids, bcatSids, cacheSids;
@@ -34,11 +35,11 @@ namespace ui {
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" }, true);
// 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: {
printf("path is %s\n", title.fullPath(0).c_str());
// Transfer selected
auto result = io::backup(index, g_currentUId);
if (std::get<0>(result)) {
@@ -51,6 +52,18 @@ namespace ui {
}
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;
}
}