mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
DPad Items (#228)
* Initial Dpad * remove old hud stuff * and comment * s.. * add dpad equip macro back in * fix inputs * fix equipping (hopefully all) * finish some todos * add 2s2h asset header * check dpad macro * remove 2s2h_assets * re-add empty texture * use correct struct for default dpad equips * dpad save stuff * fix item offering, use correct equip offset values * finally figure out unk_154 and fix mask equipping * avoid ugly code * add necessary condition * correct save names for dpad items/slots * remove todos and sort out suggestions and rename cvar * func standardise renaming * Add dpad to hud presets * dpad save migration
This commit is contained in:
@@ -42,19 +42,21 @@ const std::filesystem::path savesFolderPath(Ship::Context::GetPathRelativeToAppD
|
||||
// - Increment CURRENT_SAVE_VERSION
|
||||
// - Create the migration file in the Migrations folder with the name `{CURRENT_SAVE_VERSION}.cpp`
|
||||
// - Add the migration function definition below and add it to the `migrations` map with the key being the previous version
|
||||
const uint32_t CURRENT_SAVE_VERSION = 1;
|
||||
const uint32_t CURRENT_SAVE_VERSION = 2;
|
||||
|
||||
void SaveManager_Migration_1(nlohmann::json& j);
|
||||
void SaveManager_Migration_2(nlohmann::json& j);
|
||||
|
||||
std::map<uint32_t, std::function<void(nlohmann::json&)>> migrations = {
|
||||
const std::unordered_map<uint32_t, std::function<void(nlohmann::json&)>> migrations = {
|
||||
{ 0, SaveManager_Migration_1 },
|
||||
{ 1, SaveManager_Migration_2 },
|
||||
};
|
||||
|
||||
void SaveManager_MigrateSave(nlohmann::json& j) {
|
||||
int version = j.value("version", 0);
|
||||
while (version != CURRENT_SAVE_VERSION) {
|
||||
if (migrations.contains(version)) {
|
||||
auto migration = migrations[version];
|
||||
auto migration = migrations.at(version);
|
||||
migration(j);
|
||||
}
|
||||
version = j["version"] = version + 1;
|
||||
|
||||
Reference in New Issue
Block a user