mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -05: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
@ -831,6 +831,7 @@ extern "C" void InitOTR() {
|
||||
|
||||
std::shared_ptr<LUS::Config> conf = OTRGlobals::Instance->context->GetConfig();
|
||||
conf->RegisterConfigVersionUpdater(std::make_shared<LUS::ConfigVersion1Updater>());
|
||||
conf->RegisterConfigVersionUpdater(std::make_shared<LUS::ConfigVersion2Updater>());
|
||||
conf->RunVersionUpdates();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "ConfigUpdaters.h"
|
||||
#include "soh/Enhancements/audio/AudioCollection.h"
|
||||
|
||||
namespace LUS {
|
||||
ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {}
|
||||
ConfigVersion2Updater::ConfigVersion2Updater() : ConfigVersionUpdater(2) {}
|
||||
|
||||
void ConfigVersion1Updater::Update(Config* conf) {
|
||||
if (conf->GetInt("Window.Width", 640) == 640) {
|
||||
@ -60,4 +62,10 @@ namespace LUS {
|
||||
}
|
||||
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"
|
||||
|
||||
namespace LUS {
|
||||
class ConfigVersion1Updater : public ConfigVersionUpdater {
|
||||
public:
|
||||
ConfigVersion1Updater();
|
||||
void Update(Config* conf);
|
||||
};
|
||||
class ConfigVersion1Updater : public ConfigVersionUpdater {
|
||||
public:
|
||||
ConfigVersion1Updater();
|
||||
void Update(Config* conf);
|
||||
};
|
||||
|
||||
class ConfigVersion2Updater : public ConfigVersionUpdater {
|
||||
public:
|
||||
ConfigVersion2Updater();
|
||||
void Update(Config* conf);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user