mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-17 08:20:30 +02:00
Fetch the public adhoc server list from metadata.ppsspp.org/adhoc-servers.json
This commit is contained in:
1 parent
3d50bf4b7d
commit
1a95e9e4e9
8 files changed
+74
-69
No files matched your search
@@ -71,7 +71,7 @@ static std::shared_ptr<Request> CreateRequest(RequestMethod method, std::string_
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Request> RequestManager::StartDownload(std::string_view url, const Path &outfile, RequestFlags flags, const char *acceptMime) {
|
||||
std::shared_ptr<Request> RequestManager::StartDownload(std::string_view url, const Path &outfile, RequestFlags flags, const char *acceptMime, std::string_view name, std::function<void(Request &)> callback) {
|
||||
const bool enableCache = !cacheDir_.empty() && (flags & RequestFlags::Cached24H);
|
||||
|
||||
// Come up with a cache file path.
|
||||
@@ -93,6 +93,7 @@ std::shared_ptr<Request> RequestManager::StartDownload(std::string_view url, con
|
||||
// All is well, but we've indented a bit much here.
|
||||
std::shared_ptr<Request> dl(new CachedRequest(RequestMethod::GET, url, KeepAfterLast(url, '/'), nullptr, flags, contents));
|
||||
newDownloads_.push_back(dl);
|
||||
dl->SetCallback(callback);
|
||||
return dl;
|
||||
} else {
|
||||
INFO_LOG(Log::sceNet, "Failed reading from cache, proceeding with request");
|
||||
@@ -105,7 +106,7 @@ std::shared_ptr<Request> RequestManager::StartDownload(std::string_view url, con
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Request> dl = CreateRequest(RequestMethod::GET, url, "", "", outfile, flags, nullptr, "");
|
||||
std::shared_ptr<Request> dl = CreateRequest(RequestMethod::GET, url, "", "", outfile, flags, nullptr, name);
|
||||
|
||||
// OK, didn't get it from cache, so let's continue with the download, putting it in the cache.
|
||||
if (enableCache) {
|
||||
@@ -119,24 +120,6 @@ std::shared_ptr<Request> RequestManager::StartDownload(std::string_view url, con
|
||||
if (acceptMime) {
|
||||
dl->SetAccept(acceptMime);
|
||||
}
|
||||
newDownloads_.push_back(dl);
|
||||
dl->Start();
|
||||
return dl;
|
||||
}
|
||||
|
||||
std::shared_ptr<Request> RequestManager::StartDownloadWithCallback(
|
||||
std::string_view url,
|
||||
const Path &outfile,
|
||||
RequestFlags flags,
|
||||
std::function<void(Request &)> callback,
|
||||
std::string_view name,
|
||||
const char *acceptMime) {
|
||||
std::shared_ptr<Request> dl = CreateRequest(RequestMethod::GET, url, "", "", outfile, flags, nullptr, name);
|
||||
|
||||
if (!userAgent_.empty())
|
||||
dl->SetUserAgent(userAgent_);
|
||||
if (acceptMime)
|
||||
dl->SetAccept(acceptMime);
|
||||
dl->SetCallback(callback);
|
||||
newDownloads_.push_back(dl);
|
||||
dl->Start();
|
||||
|
||||
Reference in new issue
Block a user