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 functions73
geode::Modoperator=()
No description provided
std::stringgetID()const
No description provided
std::stringgetName()const
No description provided
std::stringgetDeveloper()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
std::optional<geode::VersionInfo>hasAvailableUpdate()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

boolhasSettings()const
No description provided
std::vector<std::string>getSettingKeys()const
No description provided
boolhasSetting()const
No description provided
std::optional<geode::Setting>getSettingDefinition()const
No description provided
geode::SettingValue*getSetting()const
No description provided
voidregisterCustomSetting(,)

Register a custom setting’s value class. See Mod::addCustomSetting for a convenience wrapper that creates the value in-place to avoid code duplication. Also see the tutorial page for more information about custom settings

Parameters

key

The setting's key

value

The SettingValue class that shall handle this setting
template<class T,class V>voidaddCustomSetting(,)

Register a custom setting’s value class. The new SettingValue class will be created in-place using std::make_unique. See the tutorial page for more information about custom settings

Parameters

key

The setting's key

value

The value of the custom setting
$on_mod(Loaded) {
    Mod::get()->addCustomSetting<MySettingValue>("setting-key", DEFAULT_VALUE);
}
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
No description provided
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
boolhasProblems()const
No description provided
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