@@ -391,6 +391,12 @@ void NeuralAmpModeler::OnIdle()
391391
392392bool NeuralAmpModeler::SerializeState (IByteChunk& chunk) const
393393{
394+ // If this isn't here when unserializing, then we know we're dealing with something before v0.8.0.
395+ WDL_String header (" ###NeuralAmpModeler###" ); // Don't change this!
396+ chunk.PutStr (header.Get ());
397+ // Plugin version, so we can load legacy serialized states in the future!
398+ WDL_String version (PLUG_VERSION_STR);
399+ chunk.PutStr (version.Get ());
394400 // Model directory (don't serialize the model itself; we'll just load it again
395401 // when we unserialize)
396402 chunk.PutStr (mNAMPath .Get ());
@@ -400,7 +406,19 @@ bool NeuralAmpModeler::SerializeState(IByteChunk& chunk) const
400406
401407int NeuralAmpModeler::UnserializeState (const IByteChunk& chunk, int startPos)
402408{
403- WDL_String dir;
409+ WDL_String header;
410+ startPos = chunk.GetStr (header, startPos);
411+ // TODO: Handle legacy plugin serialized states.
412+ // if strncmp (header.Get(), "###NeuralAmpModeler###")
413+ // {
414+ // return UnserializeStateLegacy(header, startPos); // (We'll assume 0.7.9).
415+ // }
416+ WDL_String version;
417+ startPos = chunk.GetStr (version, startPos);
418+ // Version-specific loading here if needed.
419+ // ...
420+
421+ // Current version loading:
404422 startPos = chunk.GetStr (mNAMPath , startPos);
405423 startPos = chunk.GetStr (mIRPath , startPos);
406424 int retcode = UnserializeParams (chunk, startPos);
0 commit comments