aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/mods/autodownload/moddownloader.h
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2023-12-14 22:19:21 +0100
committerGitHub <noreply@github.com>2023-12-14 22:19:21 +0100
commit5a7ad2249b50470a84fc45eac95de2297ecc2da9 (patch)
tree0eddd7c63c57898160b362ddcf75ea93bc7bb8f2 /NorthstarDLL/mods/autodownload/moddownloader.h
parent43f0bce0596ec60434e48d8037ffed373bc13852 (diff)
downloadNorthstarLauncher-5a7ad2249b50470a84fc45eac95de2297ecc2da9.tar.gz
NorthstarLauncher-5a7ad2249b50470a84fc45eac95de2297ecc2da9.zip
Mod download UI integration (#595)v1.21.0-rc2v1.21.0
UI integration for the mod downloading feature. Feature activation locked behind a convar.
Diffstat (limited to 'NorthstarDLL/mods/autodownload/moddownloader.h')
-rw-r--r--NorthstarDLL/mods/autodownload/moddownloader.h38
1 files changed, 24 insertions, 14 deletions
diff --git a/NorthstarDLL/mods/autodownload/moddownloader.h b/NorthstarDLL/mods/autodownload/moddownloader.h
index ae4f603a..747b3c01 100644
--- a/NorthstarDLL/mods/autodownload/moddownloader.h
+++ b/NorthstarDLL/mods/autodownload/moddownloader.h
@@ -19,6 +19,16 @@ class ModDownloader
std::unordered_map<std::string, VerifiedModDetails> verifiedMods = {};
/**
+ * Mod archive download callback.
+ *
+ * This function is called by curl as it's downloading the mod archive; this
+ * will retrieve the current `ModDownloader` instance and update its `modState`
+ * member accordingly.
+ */
+ static int ModFetchingProgressCallback(
+ void* ptr, curl_off_t totalDownloadSize, curl_off_t finishedDownloadSize, curl_off_t totalToUpload, curl_off_t nowUploaded);
+
+ /**
* Downloads a mod archive from distant store.
*
* This rebuilds the URI of the mod archive using both a predefined store URI
@@ -36,20 +46,6 @@ class ModDownloader
std::optional<fs::path> FetchModFromDistantStore(std::string_view modName, std::string_view modVersion);
/**
- * Checks whether a mod is verified.
- *
- * A mod is deemed verified/authorized through a manual validation process that is
- * described here: https://github.com/R2Northstar/VerifiedMods; in practice, a mod
- * is considered authorized if their name AND exact version appear in the
- * `verifiedMods` variable.
- *
- * @param modName name of the mod to be checked
- * @param modVersion version of the mod to be checked, must follow semantic versioning
- * @returns whether the mod is authorized and can be auto-downloaded
- */
- bool IsModAuthorized(std::string_view modName, std::string_view modVersion);
-
- /**
* Tells if a mod archive has not been corrupted.
*
* The mod validation procedure includes computing the SHA256 hash of the final
@@ -94,6 +90,20 @@ class ModDownloader
void FetchModsListFromAPI();
/**
+ * Checks whether a mod is verified.
+ *
+ * A mod is deemed verified/authorized through a manual validation process that is
+ * described here: https://github.com/R2Northstar/VerifiedMods; in practice, a mod
+ * is considered authorized if their name AND exact version appear in the
+ * `verifiedMods` variable.
+ *
+ * @param modName name of the mod to be checked
+ * @param modVersion version of the mod to be checked, must follow semantic versioning
+ * @returns whether the mod is authorized and can be auto-downloaded
+ */
+ bool IsModAuthorized(std::string_view modName, std::string_view modVersion);
+
+ /**
* Downloads a given mod from Thunderstore API to local game profile.
*
* @param modName name of the mod to be downloaded