76 lines
2.5 KiB
C#
76 lines
2.5 KiB
C#
using global::Newtonsoft.Json.Linq;
|
|
using global::System.IO;
|
|
using Newtonsoft.Json;
|
|
using SM64Lib.ASM;
|
|
using SM64Lib.Behaviors;
|
|
using SM64Lib.Objects.ObjectBanks;
|
|
using SM64Lib.Objects.ObjectBanks.Data;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace SM64Lib.Configuration;
|
|
|
|
public class RomConfig
|
|
{
|
|
// Levels
|
|
public Dictionary<byte, LevelConfig> LevelConfigs { get; } = [];
|
|
|
|
// Global Banks
|
|
[JsonProperty("GlobalObjectBankConfig")]
|
|
public ObjectModelConfig GlobalModelBank { get; } = new ObjectModelConfig();
|
|
public CustomAsmBankConfig GlobalCustomAsmBank { get; } = new CustomAsmBankConfig();
|
|
public BehaviorBankConfig GlobalBehaviorBank { get; } = new BehaviorBankConfig();
|
|
public CustomObjectCollection GlobalObjectBank { get; } = new CustomObjectCollection();
|
|
|
|
// Music
|
|
public MusicConfiguration MusicConfig { get; } = new MusicConfiguration();
|
|
|
|
// Texts
|
|
public Text.Profiles.TextProfileInfo TextProfileInfo { get; set; } = null;
|
|
|
|
// Patching
|
|
public PatchingConfig PatchingConfig { get; set; } = new PatchingConfig();
|
|
|
|
// Other
|
|
public ScrollTexConfig ScrollTexConfig { get; set; } = new ScrollTexConfig();
|
|
public ObjectBankDataListCollection ObjectBankInfoData { get; } = [];
|
|
public NPCConfig NPCConfig { get; } = new NPCConfig();
|
|
public CollisionBasicConfig CollisionBaseConfig { get; } = new CollisionBasicConfig();
|
|
|
|
/// <summary>
|
|
/// Contains custom configuration that isn't used by SM64Lib. E.g. Extra Object Combos.
|
|
/// </summary>
|
|
public Dictionary<string, string> CustomConfigs { get; } = [];
|
|
|
|
// F e a t u r e s
|
|
|
|
public LevelConfig GetLevelConfig(ushort levelID)
|
|
{
|
|
if (LevelConfigs.ContainsKey(Convert.ToByte(levelID)))
|
|
{
|
|
return LevelConfigs[Convert.ToByte(levelID)];
|
|
}
|
|
else
|
|
{
|
|
var conf = new LevelConfig();
|
|
LevelConfigs.Add(Convert.ToByte(levelID), conf);
|
|
return conf;
|
|
}
|
|
}
|
|
|
|
// L o a d / S a v e
|
|
|
|
public static RomConfig Load(string filePath)
|
|
{
|
|
var serializer = JsonSerializer.CreateDefault();
|
|
serializer.PreserveReferencesHandling = PreserveReferencesHandling.All;
|
|
return JObject.Parse(File.ReadAllText(filePath)).ToObject<RomConfig>(serializer);
|
|
}
|
|
|
|
public void Save(string filePath)
|
|
{
|
|
var serializer = JsonSerializer.CreateDefault();
|
|
serializer.PreserveReferencesHandling = PreserveReferencesHandling.All;
|
|
File.WriteAllText(filePath, JObject.FromObject(this, serializer).ToString());
|
|
}
|
|
} |