summaryrefslogtreecommitdiff
path: root/mm/2s2h/SaveManager/Migrations/5.cpp
blob: 6fdeb7a1cf1f4f70e0f44943feaad011dab1b8fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "2s2h/SaveManager/SaveManager.h"
#include "z64.h"

// This is the base migration, binary saves are imported as this version.
void SaveManager_Migration_5(nlohmann::json& j) {
    nlohmann::json dpadEquips;
    for (int i = 0; i < EQUIP_SLOT_D_MAX; i++) {
        for (int j = 0; j < EQUIP_SLOT_D_MAX; j++) {
            dpadEquips["dpadItems"][i][j] = ITEM_NONE;
            dpadEquips["dpadSlots"][i][j] = SLOT_NONE;
        }
    }

    // if shipSaveInfo doesn't exist, create it
    if (!j["save"].contains("shipSaveInfo")) {
        j["save"]["shipSaveInfo"]["dpadEquips"] = dpadEquips;
        j["save"]["shipSaveInfo"]["pauseSaveEntrance"] = -1;
    }
}