Class Mod

#include <Geode/loader/Mod.hpp>
classMod{ ... }

Represents a Mod ingame.

Examples0
Public static methods1
template<class = void>staticgeode::Mod*get()

Get the Mod of the current mod being developed

Return value
The current mod
Public member functions71
geode::Modoperator=()
No description provided
std::stringgetID()const
No description provided
std::stringgetName()const
No description provided
std::vector<std::string>getDevelopers()const
No description provided
std::optional<std::string>getDescription()const
No description provided
std::optional<std::string>getDetails()const
No description provided
std::filesystem::pathgetPackagePath()const
No description provided
geode::VersionInfogetVersion()const
No description provided
boolisEnabled()const
No description provided
boolisOrWillBeEnabled()const
No description provided
boolisInternal()const
No description provided
boolneedsEarlyLoad()const
No description provided
geode::ModMetadatagetMetadata()const
No description provided
std::filesystem::pathgetTempDir()const
No description provided
std::filesystem::pathgetBinaryPath()const

Get the path to the mod’s platform binary (.dll on Windows, .dylib on Mac & iOS, .so on Android)

std::filesystem::pathgetResourcesDir()const

Get the path to the mod’s runtime resources directory (contains all of its resources)

voidsetMetadata()
No description provided
std::vector<geode::Mod*>getDependants()const
No description provided
geode::Mod::CheckUpdatesTaskcheckUpdates()const

Check if this Mod has updates available on the mods index. If you’re using this for automatic update checking, use [openInfoPopup](/functions/geode/openInfoPopup) from the ui/GeodeUI.hpp header to open the Mod’s page to let the user install the update

Return value
A task that resolves to an option, either the latest available version on the index if there are updates available, or `std::nullopt` if there are no updates. On error, the Task returns an error
geode::Result<>saveData()
No description provided
geode::Result<>loadData()
No description provided
std::filesystem::pathgetSaveDir()const

Get the mod’s save directory path

std::filesystem::pathgetConfigDir(
boolcreate
)
const

Get the mod’s config directory path

std::filesystem::pathgetPersistentDir(
boolcreate
)
const

Get the mod’s persistent directory path This directory is not deleted even when Geode/mod is uninstalled

boolhasSettings()const

Returns true if this mod has any settings

std::vector<std::string>getSettingKeys()const

Get a list of all this mod’s setting keys (in the order they were declared in mod.json)

boolhasSetting()const
No description provided
std::shared_ptr<geode::Setting>getSetting()const

Get the definition of a setting, or null if the setting was not found, or if it’s a custom setting that has not yet been registered using [Mod](/classes/geode/Mod)::registerCustomSettingType

Parameters

key

The key of the setting as defined in `mod.json`
geode::Result<>registerCustomSettingType(,)

Register a custom setting type. See the setting docs for more

Parameters

type

The type of the setting. This should **not** include the `custom:` prefix!

generator

A pointer to a function that, when called, returns a newly-created instance of the setting type
std::stringgetLaunchArgumentName()const

Returns a prefixed launch argument name. See [Mod](/classes/geode/Mod)::getLaunchArgument for details about mod-specific launch arguments.

std::vector<std::string>getLaunchArgumentNames()const

Returns the names of the available mod-specific launch arguments.

boolhasLaunchArgument()const

Equivalent to a prefixed [Loader](/classes/geode/Loader)::hasLaunchArgument call. See [Mod](/classes/geode/Mod)::getLaunchArgument for details about mod-specific launch arguments.

Parameters

name

The argument name
std::optional<std::string>getLaunchArgument()const

Get a mod-specific launch argument. This is equivalent to [Loader](/classes/geode/Loader)::getLaunchArgument with the argument name prefixed by the mod ID. For example, a launch argument named mod-arg for the mod author.test would be specified with --geode:author.test.mod-arg=value.

Parameters

name

The argument name
Return value
The value, if present
boolgetLaunchFlag()const

Equivalent to a prefixed [Loader](/classes/geode/Loader)::getLaunchFlag call. See [Mod](/classes/geode/Mod)::getLaunchArgument for details about mod-specific launch arguments.

Parameters

name

The argument name
template<class T>std::optional<T>parseLaunchArgument()const

Equivalent to a prefixed [Loader](/classes/geode/Loader)::parseLaunchArgument call. See [Mod](/classes/geode/Mod)::getLaunchArgument for details about mod-specific launch arguments.

Parameters

name

The argument name
matjson::Value&getSaveContainer()
No description provided
matjson::Value&getSavedSettingsData()
No description provided
template<class T>TgetSettingValue()const

Get the value of a setting. To use this for custom settings, first specialize the SettingTypeForValueType class, and then make sure your custom setting type has a getValue function which returns the value

template<class T>TsetSettingValue(,)
No description provided
boolhasSavedValue()
No description provided
template<class T>TgetSavedValue()
No description provided
template<class T>TgetSavedValue(,
const Tconst&defaultValue
)
No description provided
template<class T>TsetSavedValue(,)

Set the value of an automatically saved variable. When the game is closed, the value is automatically saved under the key

Parameters

key

Key of the saved value

value

Value
Return value
The old value
template<class DetourType>geode::Result<geode::Hook*>hook(
void*address
,,,,)

Create a hook at an address. Call the original function by calling the original function – no trampoline needed

Parameters

address

The absolute address of the function to hook, i.e. gd_base + 0xXXXX

detour

Pointer to your detour function

displayName

Name of the hook that will be displayed in the hook list

convention

Calling convention of the hook

hookMetadata

Metadata of the hook
Return value
Successful result containing the Hook pointer, errorful result with info on error
geode::Result<geode::Hook*>hook(
void*address
,
void*detour
,,,)
No description provided
geode::Result<geode::Hook*>claimHook()

Claims an existing hook object, marking this mod as its owner. If the hook has “auto enable” set, this will enable the hook.

Return value
Returns a pointer to the hook, or an error if the hook already has an owner, or was unable to enable the hook.
geode::Result<>disownHook()

Disowns a hook which this mod owns, making this mod no longer its owner. If the hook has “auto enable” set, this will disable the hook.

Return value
Returns an error if this mod doesn't own the hook, or if disabling the hook failed.
std::vector<geode::Hook*>getHooks()const

Get all hooks owned by this Mod

Return value
Vector of hooks
geode::Result<geode::Patch*>patch(
void*address
,)

Write a patch at an address

Parameters

address

The address to write into

data

The data to write there
Return value
Successful result on success, errorful result with info on error
geode::Result<geode::Patch*>claimPatch()

Claims an existing patch object, marking this mod as its owner. If the patch has “auto enable” set, this will enable the patch.

Return value
Returns a pointer to the patch, or an error if the patch already has an owner, or was unable to enable the patch.
geode::Result<>disownPatch()

Disowns a patch which this mod owns, making this mod no longer its owner. If the patch has “auto enable” set, this will disable the patch.

Return value
Returns an error if this mod doesn't own the patch, or if disabling the patch failed.
std::vector<geode::Patch*>getPatches()const

Get all patches owned by this Mod

Return value
Vector of patches
geode::Result<>enable()

Enable this mod

Return value
Successful result on success, errorful result with info on error
geode::Result<>disable()

Disable this mod

Return value
Successful result on success, errorful result with info on error
geode::Result<>uninstall(
booldeleteSaveData
)

Delete the mod’s .geode package.

Parameters

deleteSaveData

Whether should also delete the mod's save data
Return value
Successful result on success, errorful result with info on error
boolisUninstalled()const
No description provided
geode::ModRequestedActiongetRequestedAction()const
No description provided
booldepends()const

Check whether or not this Mod depends on another mod

boolhasUnresolvedDependencies()const

Check whether all the required dependencies for this mod have been loaded or not

Return value
True if the mod has unresolved dependencies, false if not.
boolhasUnresolvedIncompatibilities()const

Check whether none of the incompatibilities with this mod are loaded

Return value
True if the mod has unresolved incompatibilities, false if not.
std::string_viewexpandSpriteName()
No description provided
geode::ModJsongetRuntimeInfo()const

Get info about the mod as JSON

ℹ For IPC

boolisLoggingEnabled()const
No description provided
voidsetLoggingEnabled(
boolenabled
)
No description provided
std::optional<geode::LoadProblem>targetsOutdatedVersion()const

If this mod is built for an outdated GD or Geode version, returns the [LoadProblem](/classes/geode/LoadProblem) describing the situation. Otherwise nullopt if the mod is made for the correct version of the game and Geode

boolhasLoadProblems()const
No description provided

ℹ Make sure to also call `targetsOutdatedVersion` if you want to make sure the mod is actually loadable

std::vector<geode::LoadProblem>getAllProblems()const
No description provided
std::vector<geode::LoadProblem>getProblems()const
No description provided
std::vector<geode::LoadProblem>getRecommendations()const
No description provided
boolshouldLoad()const
No description provided
boolisCurrentlyLoading()const
No description provided
Fields0
Protected member functions0
Protected fields1
;
No description provided