22
22
#include < unordered_map>
23
23
#include < vector>
24
24
25
- namespace geode {
25
+ namespace geode {
26
26
template <class T >
27
27
struct HandleToSaved : public T {
28
28
Mod* m_mod;
@@ -99,7 +99,11 @@ namespace geode {
99
99
bool isOrWillBeEnabled () const ;
100
100
bool isInternal () const ;
101
101
bool needsEarlyLoad () const ;
102
- ModMetadata getMetadata () const ;
102
+
103
+ [[deprecated(" Use Mod::getMetadataRef which is better for efficiency" )]]
104
+ ModMetadata getMetadata () const ; // TODO: remove in v5
105
+ ModMetadata const & getMetadataRef () const ;
106
+
103
107
std::filesystem::path getTempDir () const ;
104
108
/* *
105
109
* Get the path to the mod's platform binary (.dll on Windows, .dylib
@@ -113,11 +117,11 @@ namespace geode {
113
117
std::filesystem::path getResourcesDir () const ;
114
118
115
119
/* *
116
- * Get the dependency settings for a specific dependency via its ID. For
117
- * example, if this mod depends on Custom Keybinds, it can specify the
118
- * keybinds it wants to add in `mod.json` under
120
+ * Get the dependency settings for a specific dependency via its ID. For
121
+ * example, if this mod depends on Custom Keybinds, it can specify the
122
+ * keybinds it wants to add in `mod.json` under
119
123
* `dependencies."geode.custom-keybinds".settings.keybinds`
120
- * @returns Null JSON value if there are no settings or if the mod
124
+ * @returns Null JSON value if there are no settings or if the mod
121
125
* doesn't depend on the given mod ID
122
126
*/
123
127
matjson::Value getDependencySettingsFor (std::string_view dependencyID) const ;
@@ -129,13 +133,13 @@ namespace geode {
129
133
130
134
using CheckUpdatesTask = Task<Result<std::optional<VersionInfo>, std::string>>;
131
135
/* *
132
- * Check if this Mod has updates available on the mods index. If
133
- * you're using this for automatic update checking, use
134
- * `openInfoPopup` from the `ui/GeodeUI.hpp` header to open the Mod's
136
+ * Check if this Mod has updates available on the mods index. If
137
+ * you're using this for automatic update checking, use
138
+ * `openInfoPopup` from the `ui/GeodeUI.hpp` header to open the Mod's
135
139
* page to let the user install the update
136
- * @returns A task that resolves to an option, either the latest
137
- * available version on the index if there are updates available, or
138
- * `std::nullopt` if there are no updates. On error, the Task returns
140
+ * @returns A task that resolves to an option, either the latest
141
+ * available version on the index if there are updates available, or
142
+ * `std::nullopt` if there are no updates. On error, the Task returns
139
143
* an error
140
144
*/
141
145
CheckUpdatesTask checkUpdates () const ;
@@ -162,26 +166,26 @@ namespace geode {
162
166
*/
163
167
bool hasSettings () const ;
164
168
/* *
165
- * Get a list of all this mod's setting keys (in the order they were
169
+ * Get a list of all this mod's setting keys (in the order they were
166
170
* declared in `mod.json`)
167
171
*/
168
172
std::vector<std::string> getSettingKeys () const ;
169
173
bool hasSetting (std::string_view key) const ;
170
174
171
175
/* *
172
- * Get the definition of a setting, or null if the setting was not found,
173
- * or if it's a custom setting that has not yet been registered using
176
+ * Get the definition of a setting, or null if the setting was not found,
177
+ * or if it's a custom setting that has not yet been registered using
174
178
* `Mod::registerCustomSettingType`
175
179
* @param key The key of the setting as defined in `mod.json`
176
180
*/
177
181
std::shared_ptr<Setting> getSetting (std::string_view key) const ;
178
182
179
183
/* *
180
- * Register a custom setting type. See
184
+ * Register a custom setting type. See
181
185
* [the setting docs](https://docs.geode-sdk.org/mods/settings) for more
182
- * @param type The type of the setting. This should **not** include the
186
+ * @param type The type of the setting. This should **not** include the
183
187
* `custom:` prefix!
184
- * @param generator A pointer to a function that, when called, returns a
188
+ * @param generator A pointer to a function that, when called, returns a
185
189
* newly-created instance of the setting type
186
190
*/
187
191
Result<> registerCustomSettingType (std::string_view type, SettingGenerator generator);
@@ -229,9 +233,9 @@ namespace geode {
229
233
matjson::Value& getSavedSettingsData ();
230
234
231
235
/* *
232
- * Get the value of a [setting](https://docs.geode-sdk.org/mods/settings).
233
- * To use this for custom settings, first specialize the
234
- * `SettingTypeForValueType` class, and then make sure your custom
236
+ * Get the value of a [setting](https://docs.geode-sdk.org/mods/settings).
237
+ * To use this for custom settings, first specialize the
238
+ * `SettingTypeForValueType` class, and then make sure your custom
235
239
* setting type has a `getValue` function which returns the value
236
240
*/
237
241
template <class T >
@@ -475,13 +479,13 @@ namespace geode {
475
479
void setLogLevel (Severity level);
476
480
477
481
/* *
478
- * If this mod is built for an outdated GD or Geode version, returns the
479
- * `LoadProblem` describing the situation. Otherwise `nullopt` if the
482
+ * If this mod is built for an outdated GD or Geode version, returns the
483
+ * `LoadProblem` describing the situation. Otherwise `nullopt` if the
480
484
* mod is made for the correct version of the game and Geode
481
485
*/
482
486
std::optional<LoadProblem> targetsOutdatedVersion () const ;
483
487
/* *
484
- * @note Make sure to also call `targetsOutdatedVersion` if you want to
488
+ * @note Make sure to also call `targetsOutdatedVersion` if you want to
485
489
* make sure the mod is actually loadable
486
490
*/
487
491
bool hasLoadProblems () const ;
0 commit comments