|
|
@ -104,14 +104,15 @@ std::string GetZIPFilePath(u64 title_id) {
|
|
|
|
|
|
|
|
|
|
|
|
// If the error is something the user should know about (build ID mismatch, bad client version),
|
|
|
|
// If the error is something the user should know about (build ID mismatch, bad client version),
|
|
|
|
// display an error.
|
|
|
|
// display an error.
|
|
|
|
void HandleDownloadDisplayResult(DownloadResult res) {
|
|
|
|
void HandleDownloadDisplayResult(const AM::Applets::AppletManager& applet_manager,
|
|
|
|
|
|
|
|
DownloadResult res) {
|
|
|
|
if (res == DownloadResult::Success || res == DownloadResult::NoResponse ||
|
|
|
|
if (res == DownloadResult::Success || res == DownloadResult::NoResponse ||
|
|
|
|
res == DownloadResult::GeneralWebError || res == DownloadResult::GeneralFSError ||
|
|
|
|
res == DownloadResult::GeneralWebError || res == DownloadResult::GeneralFSError ||
|
|
|
|
res == DownloadResult::NoMatchTitleId || res == DownloadResult::InvalidContentType) {
|
|
|
|
res == DownloadResult::NoMatchTitleId || res == DownloadResult::InvalidContentType) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const auto& frontend{Core::System::GetInstance().GetAppletManager().GetAppletFrontendSet()};
|
|
|
|
const auto& frontend{applet_manager.GetAppletFrontendSet()};
|
|
|
|
frontend.error->ShowCustomErrorText(
|
|
|
|
frontend.error->ShowCustomErrorText(
|
|
|
|
ResultCode(-1), "There was an error while attempting to use Boxcat.",
|
|
|
|
ResultCode(-1), "There was an error while attempting to use Boxcat.",
|
|
|
|
DOWNLOAD_RESULT_LOG_MESSAGES[static_cast<std::size_t>(res)], [] {});
|
|
|
|
DOWNLOAD_RESULT_LOG_MESSAGES[static_cast<std::size_t>(res)], [] {});
|
|
|
@ -264,12 +265,13 @@ private:
|
|
|
|
u64 build_id;
|
|
|
|
u64 build_id;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
Boxcat::Boxcat(DirectoryGetter getter) : Backend(std::move(getter)) {}
|
|
|
|
Boxcat::Boxcat(AM::Applets::AppletManager& applet_manager_, DirectoryGetter getter)
|
|
|
|
|
|
|
|
: Backend(std::move(getter)), applet_manager{applet_manager_} {}
|
|
|
|
|
|
|
|
|
|
|
|
Boxcat::~Boxcat() = default;
|
|
|
|
Boxcat::~Boxcat() = default;
|
|
|
|
|
|
|
|
|
|
|
|
void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title,
|
|
|
|
void SynchronizeInternal(AM::Applets::AppletManager& applet_manager, DirectoryGetter dir_getter,
|
|
|
|
ProgressServiceBackend& progress,
|
|
|
|
TitleIDVersion title, ProgressServiceBackend& progress,
|
|
|
|
std::optional<std::string> dir_name = {}) {
|
|
|
|
std::optional<std::string> dir_name = {}) {
|
|
|
|
progress.SetNeedHLELock(true);
|
|
|
|
progress.SetNeedHLELock(true);
|
|
|
|
|
|
|
|
|
|
|
@ -295,7 +297,7 @@ void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title,
|
|
|
|
FileUtil::Delete(zip_path);
|
|
|
|
FileUtil::Delete(zip_path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HandleDownloadDisplayResult(res);
|
|
|
|
HandleDownloadDisplayResult(applet_manager, res);
|
|
|
|
progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE);
|
|
|
|
progress.FinishDownload(ERROR_GENERAL_BCAT_FAILURE);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -364,17 +366,24 @@ void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title,
|
|
|
|
|
|
|
|
|
|
|
|
bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) {
|
|
|
|
bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) {
|
|
|
|
is_syncing.exchange(true);
|
|
|
|
is_syncing.exchange(true);
|
|
|
|
std::thread([this, title, &progress] { SynchronizeInternal(dir_getter, title, progress); })
|
|
|
|
|
|
|
|
|
|
|
|
std::thread([this, title, &progress] {
|
|
|
|
|
|
|
|
SynchronizeInternal(applet_manager, dir_getter, title, progress);
|
|
|
|
|
|
|
|
})
|
|
|
|
.detach();
|
|
|
|
.detach();
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name,
|
|
|
|
bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name,
|
|
|
|
ProgressServiceBackend& progress) {
|
|
|
|
ProgressServiceBackend& progress) {
|
|
|
|
is_syncing.exchange(true);
|
|
|
|
is_syncing.exchange(true);
|
|
|
|
std::thread(
|
|
|
|
|
|
|
|
[this, title, name, &progress] { SynchronizeInternal(dir_getter, title, progress, name); })
|
|
|
|
std::thread([this, title, name, &progress] {
|
|
|
|
|
|
|
|
SynchronizeInternal(applet_manager, dir_getter, title, progress, name);
|
|
|
|
|
|
|
|
})
|
|
|
|
.detach();
|
|
|
|
.detach();
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -420,7 +429,7 @@ std::optional<std::vector<u8>> Boxcat::GetLaunchParameter(TitleIDVersion title)
|
|
|
|
FileUtil::Delete(path);
|
|
|
|
FileUtil::Delete(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HandleDownloadDisplayResult(res);
|
|
|
|
HandleDownloadDisplayResult(applet_manager, res);
|
|
|
|
return std::nullopt;
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|