Downloads (C compatible) - modio/modio-sdk-legacy GitHub Wiki
modioDownloadMod
void modioDownloadMod(u32 mod_id);
C++ wrapper: Downloads#downloadmod
Adds the corresponding mod to download queue to be downloaded locally. Once downloaded it will trigger the download listener that can be set by calling the modioSetDownloadListener function, mods will be installed automatically on startup when calling modioInit()
or by manually calling modioInstallDownloadedMods.
Function parameters
Name | Type | Description |
---|---|---|
mod_id | u32 |
Mod's unique identifier. |
Example
modioDownloadMod(mod_id);
modioInstallDownloadedMods
void modioInstallDownloadedMods();
C++ wrapper: Downloads#installdownloadedmods
Extracts and installs all mods downloaded either by automatic installs or by calling modioDownloadMod.
Example
modioInstallDownloadedMods();
modioUninstallMod
void modioUninstallMod(u32 mod_id);
C++ wrapper: Downloads#uninstallmod
Removes the corresponding mod from the local storage.
Function parameters
Name | Type | Description |
---|---|---|
mod_id | u32 |
Mod's unique identifier. |
Example
modioUninstallMod(mod_id);
modioPauseDownloads
void modioPauseDownloads();
C++ wrapper: Downloads#pausedownloads
Pauses the current downloads. The state of the download queue is stored to it can be continued even after the mod.io SDK is shutdown.
Example
modioPauseDownloads();
modioResumeDownloads
void modioResumeDownloads();
C++ wrapper: Downloads#resumedownloads
Resumes the downloads after a pause.
Example
modioResumeDownloads();
modioPrioritizeModDownload
void modioPrioritizeModDownload(u32 mod_id);
C++ wrapper: Downloads#prioritizemoddownload
Puts the corresponding mod download to the front of the download queue.
Function parameters
Name | Type | Description |
---|---|---|
mod_id | u32 |
Mod's unique identifier. |
Example
modioPrioritizeModDownload(mod_id);
modioSetDownloadListener
void modioSetDownloadListener(void (*callback)(u32 response_code, u32 mod_id));
C++ wrapper: Downloads#setdownloadlistener
Registers a function to be called every time a mod is installed.
Function parameters
Name | Type | Description |
---|---|---|
callback | void (*callback)(u32 response_code, u32 mod_id) |
Function to be called every time a mod is installed. |
Callback parameters
Name | Type | Description |
---|---|---|
response_code | u32 |
Response code from mod.io backend. See Response Codes. |
mod_id | u32 |
Id of the mod that was just installed. |
Example
void onModInstalled(u32 response_code, u32 mod_id)
{
if (response_code == 200)
{
//Mod installed successfully
}
}
[...]
modioSetDownloadListener(&onModInstalled);
modioGetModDownloadQueueCount
u32 modioGetModDownloadQueueCount();
C++ wrapper: n/a
Returns the size of the download queue.
Example
u32 queue_size = modioGetModDownloadQueueCount();
modioGetModDownloadQueue
void modioGetModDownloadQueue(ModioQueuedModDownload* download_queue);
C++ wrapper: Downloads#getmoddownloadqueue
Returns an array of ModioQueuedModDownload objects which represents the mods that are currently queued to be installed.
Function parameters
Name | Type | Description |
---|---|---|
download_queue | ModioQueuedModDownload* |
Array where the contents of the queue will be copied. |
Example
u32 queue_size = modioGetModDownloadQueueCount();
ModioQueuedModDownload *download_queue = malloc(queue_size * sizeof(*download_queue));
modioGetModDownloadQueue(download_queue);
[...]
free(download_queue);
modioGetInstalledMod
void modioGetInstalledMod(u32 mod_id, ModioInstalledMod *installed_mod);
C++ wrapper: Downloads#getinstalledmod
Returns a ModioInstalledMod object which represents a mod installed locally.
Example
ModioInstalledMod installed_mod;
modioGetInstalledMod(mod_id, &installed_mod);
modioGetAllInstalledModsCount
u32 modioGetAllInstalledModsCount();
C++ wrapper: Downloads#getallinstalledmodssize
Returns the amounts of mods installed locally.
Example
u32 installed_mods_size = modioGetAllInstalledModsCount();
modioGetAllInstalledMods
void modioGetAllInstalledMods(ModioInstalledMod* installed_mods);
C++ wrapper: Downloads#getallinstalledmods
Returns an array of ModioInstalledMod objects which represents the mods that are locally installed.
Function parameters
Name | Type | Description |
---|---|---|
installed_mods | ModioInstalledMod* |
Array where the contents of the installed mods data will be copied. |
Example
u32 installed_mods_size = modioGetallInstalledModsCount();
ModioInstalledMod* installed_mods = malloc(installed_mods_size * sizeof(*installed_mods));
modioGetallInstalledMods(installed_mods);
[...]
free(installed_mods);
modioGetAllDownloadedModsCount
u32 modioGetAllDownloadedModsCount();
C++ wrapper: Downloads#getalldownloadedmodssize
Returns the amount of mods that are downloaded locally but are still not extracted and installed. To install them use modioInstallDownloadedMods.
Example
u32 downloaded_mods_count = modioGetAllDownloadedModsCount();
modioGetAllDownloadedMods
void modioGetAllDownloadedMods(u32* downloaded_mods);
C++ wrapper: Downloads#getalldownloadedmods
Returns an array of ids of mods that are downloaded locally but are still not extracted and installed. To install them use modioInstallDownloadedMods.
Function parameters
Name | Type | Description |
---|---|---|
installed_mods | ModioInstalledMod* |
Array where the contents of the installed mods data will be copied. |
Example
u32 installed_mods_size = modioGetallInstalledModsCount();
ModioInstalledMod* installed_mods = malloc(installed_mods_size * sizeof(*installed_mods));
modioGetallInstalledMods(installed_mods);
[...]
free(installed_mods);
modioGetModState
u32 modioGetModState(u32 mod_id);
C++ wrapper: Downloads#getmodstate
Returns the state of the corresponding mod, see Mod states.
Function parameters
Name | Type | Description |
---|---|---|
mod_id | u32 |
Mod's unique identifier. |
Example
u32 mod_state = modioGetModState(mod_id);
modioFreeInstalledMod
void modioFreeInstalledMod(ModioInstalledMod* installed_mod);
C++ wrapper: n/a
Frees the privided ModioInstalledMod, use this to free the returned queue from modioGetAllInstalledMods.
Function parameters
Name | Type | Description |
---|---|---|
installed_mod | ModioInstalledMod |
ModioInstalledMod object to be freed. |
modioFreeQueuedModDownload
void modioFreeQueuedModDownload(ModioQueuedModDownload* queued_mod_download);
C++ wrapper: n/a
Frees the privided ModioQueuedModDownload, use this to free the returned queue from modioGetModDownloadQueue.
Function parameters
Name | Type | Description |
---|---|---|
queued_mod_download | ModioQueuedModDownload |
ModioQueuedModDownload object to be freed. |