Skip to content

Commit b99e2cc

Browse files
committed
update migration docs with deps and mod
1 parent eb6d024 commit b99e2cc

1 file changed

Lines changed: 63 additions & 1 deletion

File tree

tutorials/migrate-v5.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,66 @@ Almost all parts of geode that accepted a `std::function` (such as `queueInMainT
298298

299299
A ton of functions that accepted `std::string_view`, `std::string` or `std::string const&` have been written uncarefully and inefficiently before, which v5 aimed to fix. For many cases, you don't need to change anything, but conversion between string types isn't always possible, so this might break some code. This applies to return values as well, certain commonly used functions like `CCNode::getID` have been changed to return `geode::ZStringView`, which is a type that attempts to be API-compatible with `string_view`, while keeping a guarantee of null termination. Here are some examples of code that breaks and how to fix it:
300300

301-
TODO
301+
TODO
302+
303+
## Changes to dependencies and incompatibilities
304+
305+
Dependencies and incompatibilites have received some breaking changes. The first is that the old array syntax has now been fully removed, and the second is that the old `"importance"` keys have been replaced by `"required": boolean` for dependencies and `"breaking": boolean` for incompatibilities. Suggestions and recommendations have been removed, but will be added back in a later update as a separate key.
306+
307+
For example, the following v4 code:
308+
309+
```json
310+
{
311+
"dependencies": [
312+
{
313+
"id": "hjfod.gmd-api",
314+
"version": "1.2.1",
315+
"importance": "required"
316+
},
317+
{
318+
"id": "hjfod.trashcan",
319+
"version": "1.0.0",
320+
"importance": "recommended"
321+
},
322+
{
323+
"id": "alphalaneous.awesome_modifier_icons",
324+
"version": "1.0.3",
325+
"importance": "suggested"
326+
}
327+
],
328+
"incompatibilities": [
329+
{
330+
"id": "alphalaneous.improved_group_view",
331+
"version": "1.0.0",
332+
"importance": "breaking"
333+
}
334+
]
335+
}
336+
```
337+
338+
should now be written as:
339+
340+
```json
341+
{
342+
"dependencies": {
343+
// Required dependencies can be written with the shorthand syntax
344+
"hjfod.gmd-api": "1.2.1",
345+
"hjfod.trashcan": {
346+
"version": "1.0.0",
347+
"required": false
348+
}
349+
},
350+
"incompatibilities": {
351+
// Or with the long form { "breaking": true, "version": "1.0.0" }
352+
"alphalaneous.improved_group_view": "1.0.0"
353+
}
354+
}
355+
```
356+
357+
## Changes to mod error reporting
358+
359+
* `Mod::isEnabled` has been renamed to `Mod::isLoaded` to better describe its purpose
360+
* `Mod::isOrWillBeEnabled` now reports whether the user has tried to enable the mod and does not consider if it succesfully loaded or not
361+
* The `LoadProblem` class now has significantly fewer variants.
362+
* All of the different functions related to checking different problems in `Mod` have been reduced to just `Mod::failedToLoad` (for major issues) and `Mod::getLoadProblem` (for all potential issues)
363+
* `ModMetadata` parsing has been reduced to just the `create` and `createFromGeodeFile` functions, which now always return a `ModMetadata` instead of a result. The returned `ModMetadata` represents a best-effort parse, and any errors are reported in the `ModMetadata` itself that you can check via `hasErrors()` and `getErrors()`.

0 commit comments

Comments
 (0)