Skip to content

Commit

Permalink
Fix for plandos not loading properly
Browse files Browse the repository at this point in the history
  • Loading branch information
MattEqualsCoder committed Oct 18, 2024
1 parent c345200 commit 3b6d7fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,10 @@ public bool LoadPlando(string file, out string? error)
.WithNamingConvention(PascalCaseNamingConvention.Instance)
.IgnoreUnmatchedProperties()
.Build();
var configString = File.ReadAllText(file);
LoadPlando(deserializer.Deserialize<PlandoConfig>(configString));
var configString = File.ReadAllText(file, Encoding.UTF8);
var config = deserializer.Deserialize<PlandoConfig>(configString);
config.FileName = Path.GetFileNameWithoutExtension(file);
LoadPlando(config);
return true;
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public async Task<GeneratedRomResult> GeneratePreSeededRomAsync(RandomizerOption
{
var bytes = GenerateRomBytes(options, seed);
var config = seed.Playthrough.Config;
var safeSeed = seed.Seed.ReplaceAny(Path.GetInvalidFileNameChars(), '_');
var safeSeed = seed.Seed.ReplaceAny(Path.GetInvalidFileNameChars(), '_').Trim();

var folderPath = Path.Combine(options.RomOutputPath, $"{DateTimeOffset.Now:yyyyMMdd-HHmmss}_{safeSeed}");
Directory.CreateDirectory(folderPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public SeedData GenerateSeed(Config config, CancellationToken cancellationToken
playthrough = new Playthrough(config, Enumerable.Empty<Playthrough.Sphere>());
}

var plandoName = config.PlandoConfig?.FileName ?? "unknown";
var plandoName = string.IsNullOrEmpty(config.PlandoConfig?.FileName)
? config.Seed
: config.PlandoConfig.FileName;

// If matching base plando file name, just use the date for the seed name
if (Regex.IsMatch(plandoName, "^Spoiler_Plando_(.*)_[0-9]+$"))
Expand Down

0 comments on commit 3b6d7fd

Please sign in to comment.