Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Initialization, Process and Shutdown (C compatible)

Ahmed Castro edited this page Oct 20, 2019 · 4 revisions

modioInit

void modioInit(u32 environment, u32 game_id, bool retrieve_mods_from_other_games, char const *api_key, char const *root_path);
Name Type Description
environment u32 Server Environment.
game_id u32 Your game unique identifier.
retrieve_mods_from_other_games bool If set to true, mods from other games will also be retrieved in the User's functions
api_key char* Your game unique API key, grab this from the mod.io website.
game_id char* Optional parameter: You can change the root path where the .modio directory will reside. The ./modio directory contains the installed mods as well as all the files the mod.io handles behind the scene. The root path will be the working directory if not explicitly defined.

Initializes mod.io SDK on your project to access API functionality. This will setup a .modio/ directory as mod.io working directory in your project path. This must be called before any other mod.io function.

Example:

modioInit(MODIO_ENVIRONMENT_TEST, 7, (char*)"e91c01b8882f4affeddd56c96111977b");

modioProcess

void modioProcess();

This function handles transfers and callbacks in an non-blocking way. We recommend calling it regularly when performance is not critical, for example in menus or modding tools. Be mindful this function may impact the frame rate and online latency, we recommend not calling it in-game or better yet you could let your players decide. Additionally does the following work behinds the scenes:

  • Installs mods when the logged user subscribed.
  • Uninstalls mods when the logged user unsubscribed.
  • Reinstalls modfiles when a new version is available regardless if the user is logged in.
  • Redownloads installed mods cache regardless if the user is logged in. Mod cache information is accessible through the getInstalledMods function.

This functionality is achieved by polling the API events endpoints. Polling occur every 15s by default so it should take about that amount of time to reflect the changes.

Example:

modioProcess();

modioShutdown

void modioShutdown()

Call this to close and release mod.io SDK resources. No further SDK calls should be made after this.

Contents

Clone this wiki locally