mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 21:03:42 -07:00
[Bugfix] Prevent crash in audio editor when shuffling over old CVar format (#3337)
* Add a `CVarClear` inside the check for a sequence's lock to get rid of old data. * Rework all replacement and lock `CVarSetInteger` calls to call a function which checks for previous format with `CVarGet` to know if it needs clearing before setting either the lock or the sequence * Swapped everything over to a migrator where it loops through the `sequenceMap` and just clears everything from there in "gAudioEditor.ReplacedSequences"
This commit is contained in:
parent
e60761eb61
commit
39a7437fc8
3 changed files with 21 additions and 6 deletions
|
@ -831,6 +831,7 @@ extern "C" void InitOTR() {
|
||||||
|
|
||||||
std::shared_ptr<LUS::Config> conf = OTRGlobals::Instance->context->GetConfig();
|
std::shared_ptr<LUS::Config> conf = OTRGlobals::Instance->context->GetConfig();
|
||||||
conf->RegisterConfigVersionUpdater(std::make_shared<LUS::ConfigVersion1Updater>());
|
conf->RegisterConfigVersionUpdater(std::make_shared<LUS::ConfigVersion1Updater>());
|
||||||
|
conf->RegisterConfigVersionUpdater(std::make_shared<LUS::ConfigVersion2Updater>());
|
||||||
conf->RunVersionUpdates();
|
conf->RunVersionUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
#include "ConfigUpdaters.h"
|
#include "ConfigUpdaters.h"
|
||||||
|
#include "soh/Enhancements/audio/AudioCollection.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {}
|
ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {}
|
||||||
|
ConfigVersion2Updater::ConfigVersion2Updater() : ConfigVersionUpdater(2) {}
|
||||||
|
|
||||||
void ConfigVersion1Updater::Update(Config* conf) {
|
void ConfigVersion1Updater::Update(Config* conf) {
|
||||||
if (conf->GetInt("Window.Width", 640) == 640) {
|
if (conf->GetInt("Window.Width", 640) == 640) {
|
||||||
|
@ -60,4 +62,10 @@ namespace LUS {
|
||||||
}
|
}
|
||||||
CVarClear("gSeededRandomizedEnemies");
|
CVarClear("gSeededRandomizedEnemies");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void ConfigVersion2Updater::Update(Config* conf) {
|
||||||
|
for (auto seq : AudioCollection::Instance->GetAllSequences()) {
|
||||||
|
CVarClear(std::string("gAudioEditor.ReplacedSequences." + seq.second.sfxKey).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
#include "libultraship/libultraship.h"
|
#include "libultraship/libultraship.h"
|
||||||
|
|
||||||
namespace LUS {
|
namespace LUS {
|
||||||
class ConfigVersion1Updater : public ConfigVersionUpdater {
|
class ConfigVersion1Updater : public ConfigVersionUpdater {
|
||||||
public:
|
public:
|
||||||
ConfigVersion1Updater();
|
ConfigVersion1Updater();
|
||||||
void Update(Config* conf);
|
void Update(Config* conf);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ConfigVersion2Updater : public ConfigVersionUpdater {
|
||||||
|
public:
|
||||||
|
ConfigVersion2Updater();
|
||||||
|
void Update(Config* conf);
|
||||||
|
};
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue