Skip to content

Downloads

Ahmed Castro edited this page Feb 26, 2019 · 24 revisions

downloadMod

void Instance::downloadMod(u32 mod_id)

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 setDownloadListener function, mods will be installed automatically on startup when calling modio_instance.init() or by manually calling installDownloadedMods.

Function parameters

Name Type Description
mod_id u32 Mod's unique identifier.

Example

modio_instance.downloadMod(mod_id);

installDownloadedMods

void Instance::installDownloadedMods()

Extracts and installs all mods downloaded either by automatic installs or by calling downloadMod.

Example

modio_instance.installDownloadedMods();

uninstallMod

void Instance::uninstallMod(u32 mod_id)

Removes the corresponding mod from the local storage.

Function parameters

Name Type Description
mod_id u32 Mod's unique identifier.

Example

modio_instance.uninstallMod(mod_id);

pauseDownloads

void Instance::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

modio_instance.pauseDownloads();

resumeDownloads

void Instance::resumeDownloads()

Resumes the downloads after a pause.

Example

modio_instance.resumeDownloads();

prioritizeModDownload

void Instance::prioritizeModDownload(u32 mod_id)

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

modio_instance.prioritizeModDownload(mod_id);

setDownloadListener

void Instance::setDownloadListener(const std::function<void(u32 response_code, u32 mod_id)> &callback);

Registers a function to be called every time a mod finished downloading.

Function parameters

Name Type Description
callback const std::function<void(u32 response_code, u32 mod_id)>& Function to be called every time a mod finished downloading.

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 downloaded.

Example

modio_instance.setDownloadListener([&](u32 response_code, u32 mod_id) {
  if (response_code == 200)
  {
    //Mod successfully downloaded
  }
});

getModDownloadQueue

std::list<QueuedModDownload*> Instance::getModDownloadQueue();

Returns a std::list of modio::QueuedModDownload objects which represents the mods that are currently queued to be downloaded.

Example

std::list<modio::QueuedModDownload *> mod_download_queue = modio_instance.getModDownloadQueue();

getAllInstalledMods

std::vector<modio::InstalledMod> Instance::getAllInstalledMods();

Returns a std::vector of modio::InstalledMod objects which represents the mods that are locally installed.

Example

std::vector installed_mods = modio_instance.getAllInstalledMods();

getModState

u32 Instance::getModState(u32 mod_id);

Returns the state of the corresponding mod, see Mod states.

Example

u32 mod_state = modio_instance.getModState(mod_id);

Contents

Clone this wiki locally
You can’t perform that action at this time.