update nugets & code optimization
This commit is contained in:
@@ -93,7 +93,7 @@ public class MIO0
|
||||
public static byte[] mio0_decode(byte[] mio0_buf)
|
||||
{
|
||||
|
||||
MIO0_Header head = new MIO0_Header();
|
||||
MIO0_Header head = new();
|
||||
uint bytes_written = 0;
|
||||
int bit_idx = 0;
|
||||
int comp_idx = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@ public class TextureFormats
|
||||
{
|
||||
public static Bitmap createColorTexture(Color color)
|
||||
{
|
||||
Bitmap tex = new Bitmap(1, 1);
|
||||
Bitmap tex = new(1, 1);
|
||||
Graphics.FromImage(tex).Clear(color);
|
||||
return tex;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ public class TextureFormats
|
||||
|
||||
public static Bitmap decode1BPP(byte[] data, int width, int height)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
if (data.Length >= (width * height) / 8) // Sanity Check
|
||||
{
|
||||
int len = (width * height) / 8;
|
||||
@@ -332,7 +332,7 @@ public class TextureFormats
|
||||
{
|
||||
Console.WriteLine("Texture size = (" + width + "x" + height + ")");
|
||||
Console.WriteLine("data.Length = (" + data.Length + ")");
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
|
||||
if (data.Length >= width * height * 4) // Sanity Check
|
||||
{
|
||||
@@ -358,7 +358,7 @@ public class TextureFormats
|
||||
|
||||
public static Bitmap decodeRGBA16(byte[] data, int width, int height)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
if (data.Length >= width * height * 2) // Sanity Check
|
||||
{
|
||||
BitmapData bitmapData = tex.LockBits(new Rectangle(0, 0, width, height),
|
||||
@@ -385,7 +385,7 @@ public class TextureFormats
|
||||
|
||||
public static Bitmap decodeIA16(byte[] data, int width, int height)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
if (data.Length >= width * height * 2) // Sanity Check
|
||||
{
|
||||
BitmapData bitmapData = tex.LockBits(new Rectangle(0, 0, width, height),
|
||||
@@ -410,7 +410,7 @@ public class TextureFormats
|
||||
|
||||
public static Bitmap decodeIA8(byte[] data, int width, int height)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
if (data.Length >= width * height) // Sanity Check
|
||||
{
|
||||
BitmapData bitmapData = tex.LockBits(new Rectangle(0, 0, width, height),
|
||||
@@ -435,7 +435,7 @@ public class TextureFormats
|
||||
}
|
||||
public static Bitmap decodeIA4(byte[] data, int width, int height)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
|
||||
if (data.Length >= (width * height) / 2) // Sanity Check
|
||||
{
|
||||
@@ -469,7 +469,7 @@ public class TextureFormats
|
||||
}
|
||||
public static Bitmap decodeI8(byte[] data, int width, int height)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
|
||||
if (data.Length >= width * height) // Sanity Check
|
||||
{
|
||||
@@ -496,7 +496,7 @@ public class TextureFormats
|
||||
}
|
||||
public static Bitmap decodeI4(byte[] data, int width, int height)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
|
||||
if (data.Length >= (width * height) / 2) // Sanity Check
|
||||
{
|
||||
@@ -531,7 +531,7 @@ public class TextureFormats
|
||||
|
||||
public static Bitmap decodeCI4(byte[] data, int width, int height, ushort[] palette)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
|
||||
if (data.Length >= (width * height) / 2) // Sanity Check
|
||||
{
|
||||
@@ -565,7 +565,7 @@ public class TextureFormats
|
||||
|
||||
public static Bitmap decodeCI8(byte[] data, int width, int height, ushort[] palette)
|
||||
{
|
||||
Bitmap tex = new Bitmap(width, height);
|
||||
Bitmap tex = new(width, height);
|
||||
|
||||
if (data.Length >= width * height) // Sanity Check
|
||||
{
|
||||
|
||||
@@ -15,8 +15,7 @@ public class CustomAsmArea
|
||||
{
|
||||
get
|
||||
{
|
||||
if (config == null)
|
||||
config = new CustomAsmAreaConfig();
|
||||
config ??= new CustomAsmAreaConfig();
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public class CustomAsmBank
|
||||
{
|
||||
public CustomAsmBankConfig Config { get; }
|
||||
[JsonIgnore]
|
||||
public List<CustomAsmArea> Areas { get; } = new List<CustomAsmArea>();
|
||||
public List<CustomAsmArea> Areas { get; } = [];
|
||||
|
||||
public CustomAsmBank() : this(new CustomAsmBankConfig())
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@ public class CustomAsmBankConfig
|
||||
public static int DefaultRomStartAddress { get; internal set; } = 0x1206000;
|
||||
public static int DefaultRamStartAddress { get; internal set; } = 0x406000;
|
||||
|
||||
public List<CustomAsmAreaConfig> Areas { get; } = new List<CustomAsmAreaConfig>();
|
||||
public List<CustomAsmAreaConfig> Areas { get; } = [];
|
||||
public int MaxLength { get; set; } = -1;
|
||||
[JsonProperty]
|
||||
public int Length { get; internal set; } = -1;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace SM64Lib.Behaviors;
|
||||
|
||||
public class Behavior
|
||||
{
|
||||
private readonly Dictionary<CustomAsmAreaConfig, BehaviorscriptCommand> knownCustomAsmCommands = new Dictionary<CustomAsmAreaConfig, BehaviorscriptCommand>();
|
||||
private readonly Dictionary<CustomAsmAreaConfig, BehaviorscriptCommand> knownCustomAsmCommands = [];
|
||||
|
||||
[JsonProperty]
|
||||
public BehaviorConfig Config { get; private set; }
|
||||
@@ -20,7 +20,7 @@ public class Behavior
|
||||
public Behaviorscript Script { get; private set; }
|
||||
public int CollisionPointer { get; set; }
|
||||
public bool EnableCollisionPointer { get; set; }
|
||||
public List<int> BehaviorAddressDestinations { get; set; } = new List<int>();
|
||||
public List<int> BehaviorAddressDestinations { get; set; } = [];
|
||||
|
||||
[JsonIgnore]
|
||||
public long Length
|
||||
@@ -72,7 +72,7 @@ public class Behavior
|
||||
{
|
||||
if (Script != null)
|
||||
Script.Close();
|
||||
Script = new Behaviorscript();
|
||||
Script = [];
|
||||
}
|
||||
|
||||
public bool Read(BinaryData data, int address)
|
||||
@@ -154,7 +154,7 @@ public class Behavior
|
||||
if (cmdStartLoop is not null)
|
||||
iInsert = cmdStartLoopIndex;
|
||||
else
|
||||
iInsert = (int)Script.Count - 2;
|
||||
iInsert = Script.Count - 2;
|
||||
}
|
||||
|
||||
if (knownCustomAsmCommands.ContainsKey(link.CustomAsmAreaConfig))
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace SM64Lib.Behaviors;
|
||||
public class BehaviorBank
|
||||
{
|
||||
public BehaviorBankConfig Config { get; private set; }
|
||||
public List<Behavior> Behaviors { get; } = new List<Behavior>();
|
||||
public List<Behavior> Behaviors { get; } = [];
|
||||
|
||||
[JsonIgnore]
|
||||
public long Length
|
||||
@@ -36,8 +36,10 @@ public class BehaviorBank
|
||||
|
||||
private void ReadBank(SegmentedBank seg, int offset, bool isVanilla)
|
||||
{
|
||||
var data = new BinaryStreamData(seg.Data);
|
||||
data.Position = offset;
|
||||
var data = new BinaryStreamData(seg.Data)
|
||||
{
|
||||
Position = offset
|
||||
};
|
||||
ReadBank(data, isVanilla, seg.Length, (sbyte)seg.BankID);
|
||||
}
|
||||
|
||||
@@ -69,7 +71,7 @@ public class BehaviorBank
|
||||
void readBehavior(BehaviorConfig config)
|
||||
{
|
||||
int bankOffset;
|
||||
Behavior behav = new Behavior(config);
|
||||
Behavior behav = new(config);
|
||||
|
||||
if (isVanilla)
|
||||
{
|
||||
@@ -108,8 +110,10 @@ public class BehaviorBank
|
||||
{
|
||||
var addressUpdates = new Dictionary<int, int>();
|
||||
var segStartAddress = seg.BankAddress | offset;
|
||||
var data = new BinaryStreamData(seg.Data);
|
||||
data.Position = offset;
|
||||
var data = new BinaryStreamData(seg.Data)
|
||||
{
|
||||
Position = offset
|
||||
};
|
||||
|
||||
if (Behaviors.Any())
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace SM64Lib.Behaviors;
|
||||
public class BehaviorBankConfig
|
||||
{
|
||||
public bool IsVanilla { get; set; } = true;
|
||||
public List<BehaviorConfig> BehaviorConfigs { get; } = new List<BehaviorConfig>();
|
||||
public List<BehaviorConfig> BehaviorConfigs { get; } = [];
|
||||
|
||||
[JsonProperty(nameof(Enabled))]
|
||||
private bool enabled = false;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class BehaviorConfig
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public int FixedLength { get; set; } = -1;
|
||||
public int ExpectedLength { get; set; } = -1;
|
||||
public List<CustomAsmAreaLinkOptions> CustomAsmLinks { get; } = new List<CustomAsmAreaLinkOptions>();
|
||||
public List<CustomAsmAreaLinkOptions> CustomAsmLinks { get; } = [];
|
||||
public BehaviorParamsInfo ParamsInfo { get; } = new BehaviorParamsInfo();
|
||||
|
||||
public Behavior FindBehavior()
|
||||
|
||||
@@ -6,5 +6,5 @@ public class BehaviorParamInfo
|
||||
{
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
public List<BehaviorParamValue> Values { get; } = new List<BehaviorParamValue>();
|
||||
public List<BehaviorParamValue> Values { get; } = [];
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Behaviorscript : BehaviorscriptCommandCollection
|
||||
|
||||
public BehaviorscriptCommand FirstOfType(BehaviorscriptCommandTypes cmdType)
|
||||
{
|
||||
return (BehaviorscriptCommand)this.FirstOrDefault(n => n.CommandType == cmdType);
|
||||
return this.FirstOrDefault(n => n.CommandType == cmdType);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,8 +6,7 @@ namespace SM64Lib.Configuration;
|
||||
|
||||
public class CollisionBasicConfig
|
||||
{
|
||||
private List<byte> collisionTypesWithParams = new List<byte>()
|
||||
{ 4, 14, 44, 36, 37, 39, 45 };
|
||||
private List<byte> collisionTypesWithParams = [4, 14, 44, 36, 37, 39, 45];
|
||||
|
||||
[JsonProperty("CollisionTypesWithParamsV2", ObjectCreationHandling = ObjectCreationHandling.Replace)]
|
||||
public List<byte> CollisionTypesWithParams
|
||||
|
||||
@@ -14,7 +14,7 @@ public class CustomModelConfig
|
||||
[JsonConverter(typeof(UniquieIDStringJsonConverter))]
|
||||
public UniquieID ID { get; set; } = new();
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public List<int> CollisionPointerDestinations { get; private set; } = new List<int>();
|
||||
public List<int> CollisionPointerDestinations { get; private set; } = [];
|
||||
|
||||
public CustomModel FindModel()
|
||||
{
|
||||
|
||||
@@ -5,5 +5,5 @@ namespace SM64Lib.Configuration;
|
||||
public class LevelAreaConfig
|
||||
{
|
||||
public string AreaName { get; set; }
|
||||
public Dictionary<short, string> ScrollingNames { get; set; } = new Dictionary<short, string>();
|
||||
public Dictionary<short, string> ScrollingNames { get; set; } = [];
|
||||
}
|
||||
@@ -7,7 +7,7 @@ public class LevelConfig
|
||||
public string LevelName { get; set; }
|
||||
public bool EnableLocalObjectBank { get; set; } = false;
|
||||
public ObjectModelConfig LocalObjectBank { get; set; } = new ObjectModelConfig();
|
||||
public Dictionary<byte, LevelAreaConfig> AreaConfigs { get; private set; } = new Dictionary<byte, LevelAreaConfig>();
|
||||
public Dictionary<byte, LevelAreaConfig> AreaConfigs { get; private set; } = [];
|
||||
|
||||
public LevelAreaConfig GetLevelAreaConfig(byte areaID)
|
||||
{
|
||||
|
||||
@@ -4,5 +4,5 @@ namespace SM64Lib.Configuration;
|
||||
|
||||
public class MusicConfiguration
|
||||
{
|
||||
public List<string> SqeuenceNames { get; private set; } = new List<string>();
|
||||
public List<string> SqeuenceNames { get; private set; } = [];
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace SM64Lib.Configuration;
|
||||
|
||||
public class ObjectModelConfig
|
||||
{
|
||||
public Dictionary<int, CustomModelConfig> CustomObjectConfigs { get; private set; } = new Dictionary<int, CustomModelConfig>();
|
||||
public Dictionary<int, CustomModelConfig> CustomObjectConfigs { get; private set; } = [];
|
||||
|
||||
public CustomModelConfig GetCustomObjectConfig(int id)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace SM64Lib.Configuration;
|
||||
public class RomConfig
|
||||
{
|
||||
// Levels
|
||||
public Dictionary<byte, LevelConfig> LevelConfigs { get; } = new Dictionary<byte, LevelConfig>();
|
||||
public Dictionary<byte, LevelConfig> LevelConfigs { get; } = [];
|
||||
|
||||
// Global Banks
|
||||
[JsonProperty("GlobalObjectBankConfig")]
|
||||
@@ -33,14 +33,14 @@ public class RomConfig
|
||||
|
||||
// Other
|
||||
public ScrollTexConfig ScrollTexConfig { get; set; } = new ScrollTexConfig();
|
||||
public ObjectBankDataListCollection ObjectBankInfoData { get; } = new ObjectBankDataListCollection();
|
||||
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; } = new Dictionary<string, string>();
|
||||
public Dictionary<string, string> CustomConfigs { get; } = [];
|
||||
|
||||
// F e a t u r e s
|
||||
|
||||
|
||||
@@ -27,10 +27,7 @@ public abstract class BinaryData : IDisposable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_writer is null)
|
||||
{
|
||||
_writer = new BinaryWriter(BaseStream);
|
||||
}
|
||||
_writer ??= new BinaryWriter(BaseStream);
|
||||
|
||||
return _writer;
|
||||
}
|
||||
@@ -40,10 +37,7 @@ public abstract class BinaryData : IDisposable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_reader is null)
|
||||
{
|
||||
_reader = new BinaryReader(BaseStream);
|
||||
}
|
||||
_reader ??= new BinaryReader(BaseStream);
|
||||
|
||||
return _reader;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class FilePathsConfiguration
|
||||
|
||||
// F I E L D S
|
||||
|
||||
private readonly Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
private readonly Dictionary<string, string> dic = [];
|
||||
|
||||
// P R O P E R T I E S
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ public class Geolayout
|
||||
[JsonProperty]
|
||||
private int IndexForGeopointers = -1;
|
||||
|
||||
public Geolayoutscript Geolayoutscript { get; set; } = new Geolayoutscript();
|
||||
public Geolayoutscript Geolayoutscript { get; set; } = [];
|
||||
public CameraPresets CameraPreset { get; set; } = CameraPresets.OpenCamera;
|
||||
public EnvironmentEffects EnvironmentEffect { get; set; } = default;
|
||||
public List<int> GeopointerOffsets { get; set; } = new List<int>();
|
||||
public List<Geopointer> Geopointers { get; set; } = new List<Geopointer>();
|
||||
public List<int> GeopointerOffsets { get; set; } = [];
|
||||
public List<Geopointer> Geopointers { get; set; } = [];
|
||||
public int NewGeoOffset { get; set; } = 0;
|
||||
public bool Closed { get; set; } = false;
|
||||
public ObjectShadow ObjectShadow { get; set; } = new ObjectShadow();
|
||||
@@ -54,7 +54,7 @@ public class Geolayout
|
||||
|
||||
private List<Geopointer> GetGeopointersFromGeolayoutScript(Geolayoutscript script)
|
||||
{
|
||||
List<Geopointer> geopointers = new List<Geopointer>();
|
||||
List<Geopointer> geopointers = [];
|
||||
int geolayoutCommandIndex = 0;
|
||||
var curMdlScale = System.Numerics.Vector3.One;
|
||||
var curMdlOffset = System.Numerics.Vector3.Zero;
|
||||
@@ -157,7 +157,7 @@ public class Geolayout
|
||||
Geolayoutscript.Clear();
|
||||
Geopointers.Clear();
|
||||
GeopointerOffsets.Clear();
|
||||
Geolayoutscript = new Geolayoutscript();
|
||||
Geolayoutscript = [];
|
||||
ObjectShadow = new ObjectShadow();
|
||||
CameraFrustrum = new CameraFrustrum();
|
||||
}
|
||||
|
||||
@@ -161,10 +161,12 @@ namespace SM64Lib.Geolayout.Script
|
||||
public static Vector3 GetOffset(ref GeolayoutCommand command)
|
||||
{
|
||||
command.Position = 2;
|
||||
var value = new Vector3();
|
||||
value.X = command.ReadInt16();
|
||||
value.Y = command.ReadInt16();
|
||||
value.Z = command.ReadInt16();
|
||||
var value = new Vector3
|
||||
{
|
||||
X = command.ReadInt16(),
|
||||
Y = command.ReadInt16(),
|
||||
Z = command.ReadInt16()
|
||||
};
|
||||
command.Position = 0;
|
||||
return value;
|
||||
}
|
||||
@@ -204,9 +206,11 @@ namespace SM64Lib.Geolayout.Script
|
||||
public static Vector3 GetOffset(ref GeolayoutCommand command)
|
||||
{
|
||||
command.Position = 2;
|
||||
var value = new Vector3();
|
||||
value.X = command.ReadInt16();
|
||||
value.Y = command.ReadInt16();
|
||||
var value = new Vector3
|
||||
{
|
||||
X = command.ReadInt16(),
|
||||
Y = command.ReadInt16()
|
||||
};
|
||||
command.Position += 2;
|
||||
value.Z = command.ReadInt16();
|
||||
command.Position = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SM64Lib.Geolayout.Script;
|
||||
|
||||
public class Geolayoutscript : GeolayoutCommandCollection
|
||||
{
|
||||
public List<int> GeopointerOffsets = new List<int>();
|
||||
public List<int> GeopointerOffsets = [];
|
||||
|
||||
public Geolayoutscript()
|
||||
{
|
||||
@@ -43,8 +43,10 @@ public class Geolayoutscript : GeolayoutCommandCollection
|
||||
GeopointerOffsets.Clear();
|
||||
if (segBank is null)
|
||||
return;
|
||||
var data = new BinaryStreamData(segBank.Data);
|
||||
data.Position = offset;
|
||||
var data = new BinaryStreamData(segBank.Data)
|
||||
{
|
||||
Position = offset
|
||||
};
|
||||
var tb = new List<byte>();
|
||||
GeolayoutCommandTypes cb = default;
|
||||
int subNodeIndex = 0;
|
||||
|
||||
@@ -28,9 +28,9 @@ public abstract class Level
|
||||
internal LevelscriptCommand LastGobCmdSegLoad { get; set; } = null;
|
||||
internal LevelscriptCommand LastLobCmdSegLoad { get; set; } = null;
|
||||
[JsonIgnore]
|
||||
internal Dictionary<byte, ObjectBankData> MyObjectBanks { get; private set; } = new Dictionary<byte, ObjectBankData>();
|
||||
public Levelscript Levelscript { get; set; } = new Levelscript();
|
||||
public List<LevelArea> Areas { get; private set; } = new List<LevelArea>();
|
||||
internal Dictionary<byte, ObjectBankData> MyObjectBanks { get; private set; } = [];
|
||||
public Levelscript Levelscript { get; set; } = [];
|
||||
public List<LevelArea> Areas { get; private set; } = [];
|
||||
public ushort LevelID { get; set; } = 0;
|
||||
public LevelBG Background { get; private set; } = new LevelBG();
|
||||
public bool ActSelector { get; set; } = false;
|
||||
@@ -217,7 +217,7 @@ public abstract class Level
|
||||
|
||||
public LevelscriptCommand GetDefaultPositionCmd()
|
||||
{
|
||||
return (LevelscriptCommand)Levelscript.FirstOrDefault(n => n.CommandType == LevelscriptCommandTypes.DefaultPosition);
|
||||
return Levelscript.FirstOrDefault(n => n.CommandType == LevelscriptCommandTypes.DefaultPosition);
|
||||
}
|
||||
|
||||
public void ChangeObjectBankData(byte bankID, ObjectBankData newObd)
|
||||
|
||||
@@ -21,15 +21,15 @@ public abstract class LevelArea
|
||||
|
||||
// A u t o P r o p e r t i e s
|
||||
|
||||
public SpecialBoxList SpecialBoxes { get; private set; } = new SpecialBoxList();
|
||||
public List<ManagedScrollingTexture> ScrollingTextures { get; private set; } = new List<ManagedScrollingTexture>();
|
||||
public List<LevelscriptCommand> Objects { get; private set; } = new List<LevelscriptCommand>();
|
||||
public List<LevelscriptCommand> MacroObjects { get; private set; } = new List<LevelscriptCommand>();
|
||||
public List<LevelscriptCommand> Warps { get; private set; } = new List<LevelscriptCommand>();
|
||||
public List<LevelscriptCommand> WarpsForGame { get; private set; } = new List<LevelscriptCommand>();
|
||||
public SpecialBoxList SpecialBoxes { get; private set; } = [];
|
||||
public List<ManagedScrollingTexture> ScrollingTextures { get; private set; } = [];
|
||||
public List<LevelscriptCommand> Objects { get; private set; } = [];
|
||||
public List<LevelscriptCommand> MacroObjects { get; private set; } = [];
|
||||
public List<LevelscriptCommand> Warps { get; private set; } = [];
|
||||
public List<LevelscriptCommand> WarpsForGame { get; private set; } = [];
|
||||
public ShowMessage ShowMessage { get; private set; } = new ShowMessage();
|
||||
public AreaBG Background { get; private set; } = new AreaBG();
|
||||
public LevelscriptCommandCollection Levelscript { get; set; } = new LevelscriptCommandCollection();
|
||||
public LevelscriptCommandCollection Levelscript { get; set; } = [];
|
||||
public Geolayout.Geolayout Geolayout { get; set; } = new Geolayout.Geolayout(SM64Lib.Geolayout.Geolayout.NewScriptCreationMode.None);
|
||||
public Geolayout.TerrainTypes TerrainType { get; set; } = SM64Lib.Geolayout.TerrainTypes.NoramlA;
|
||||
public byte BGMusic { get; set; } = 0;
|
||||
@@ -80,7 +80,7 @@ public abstract class LevelArea
|
||||
{
|
||||
if (cmd.CommandType == LevelscriptCommandTypes.AreaCollision)
|
||||
{
|
||||
CollisionPointerRet = Convert.ToInt32(clAreaCollision.GetAreaCollision((LevelscriptCommand)cmd));
|
||||
CollisionPointerRet = Convert.ToInt32(clAreaCollision.GetAreaCollision(cmd));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public abstract class LevelArea
|
||||
{
|
||||
if (cmd.CommandType == LevelscriptCommandTypes.AreaCollision)
|
||||
{
|
||||
clAreaCollision.SetAreaCollision((LevelscriptCommand)cmd, Convert.ToUInt32(value));
|
||||
clAreaCollision.SetAreaCollision(cmd, Convert.ToUInt32(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class LevelManager : ILevelManager
|
||||
lvl.Closed = false;
|
||||
|
||||
// Lade Levelscript
|
||||
lvl.Levelscript = new Levelscript();
|
||||
lvl.Levelscript = [];
|
||||
lvl.Levelscript.Read(rommgr, Convert.ToInt32(segAddress));
|
||||
|
||||
// Erstelle Areas / Lade Einstellungen
|
||||
@@ -57,9 +57,11 @@ public class LevelManager : ILevelManager
|
||||
{
|
||||
case LevelscriptCommandTypes.StartArea:
|
||||
AreaOnFly = true;
|
||||
tArea = new RMLevelArea();
|
||||
tArea.AreaID = clStartArea.GetAreaID(c);
|
||||
tArea.GeolayoutOffset = clStartArea.GetSegGeolayoutAddr(c); // - bank0x19.BankAddress + bank0x19.RomStart
|
||||
tArea = new RMLevelArea
|
||||
{
|
||||
AreaID = clStartArea.GetAreaID(c),
|
||||
GeolayoutOffset = clStartArea.GetSegGeolayoutAddr(c) // - bank0x19.BankAddress + bank0x19.RomStart
|
||||
};
|
||||
tArea.Geolayout.Read(rommgr, Convert.ToInt32(tArea.GeolayoutOffset));
|
||||
break;
|
||||
case LevelscriptCommandTypes.EndOfArea:
|
||||
@@ -490,9 +492,9 @@ public class LevelManager : ILevelManager
|
||||
uint curFirstBank0xEOffset = 0;
|
||||
|
||||
// Add Objects and Warps to new Levelscript
|
||||
lvlScript0E = new Levelscript();
|
||||
lvlScript0E = [];
|
||||
firstBank0xE = rommgr.SetSegBank(0xE, Convert.ToInt32(curOff), 0);
|
||||
areaobjwarpoffsetdic = new Dictionary<byte, uint>();
|
||||
areaobjwarpoffsetdic = [];
|
||||
foreach (LevelArea a in lvl.Areas)
|
||||
{
|
||||
areaobjwarpoffsetdic.Add(a.AreaID, (uint)(firstBank0xE.BankAddress + curFirstBank0xEOffset));
|
||||
@@ -574,7 +576,7 @@ public class LevelManager : ILevelManager
|
||||
if (!foundCmdShowMsg && tArea.ShowMessage.Enabled)
|
||||
{
|
||||
var cmdShowMsg = new LevelscriptCommand($"30 04 00 {tArea.ShowMessage.DialogID.ToString("X2")}");
|
||||
cmdsToInsertAt.Add((LevelscriptCommand)c, cmdShowMsg);
|
||||
cmdsToInsertAt.Add(c, cmdShowMsg);
|
||||
}
|
||||
|
||||
foundCmdShowMsg = false;
|
||||
@@ -585,44 +587,44 @@ public class LevelManager : ILevelManager
|
||||
|
||||
case LevelscriptCommandTypes.AreaMusic:
|
||||
{
|
||||
clAreaMusic.SetMusicID((LevelscriptCommand)c, lvl.Areas[CurrentAreaIndex].BGMusic);
|
||||
clAreaMusic.SetMusicID(c, lvl.Areas[CurrentAreaIndex].BGMusic);
|
||||
break;
|
||||
}
|
||||
|
||||
case LevelscriptCommandTypes.AreaMusicSimple:
|
||||
{
|
||||
clAreaMusicSimple.SetMusicID((LevelscriptCommand)c, lvl.Areas[CurrentAreaIndex].BGMusic);
|
||||
clAreaMusicSimple.SetMusicID(c, lvl.Areas[CurrentAreaIndex].BGMusic);
|
||||
break;
|
||||
}
|
||||
|
||||
case LevelscriptCommandTypes.Tarrain:
|
||||
{
|
||||
clTerrian.SetTerrainType((LevelscriptCommand)c, (byte)lvl.Areas[CurrentAreaIndex].TerrainType);
|
||||
clTerrian.SetTerrainType(c, (byte)lvl.Areas[CurrentAreaIndex].TerrainType);
|
||||
break;
|
||||
}
|
||||
|
||||
case LevelscriptCommandTypes.LoadRomToRam:
|
||||
{
|
||||
var switchExpr2 = clLoadRomToRam.GetSegmentedID((LevelscriptCommand)c);
|
||||
var switchExpr2 = clLoadRomToRam.GetSegmentedID(c);
|
||||
switch (switchExpr2)
|
||||
{
|
||||
case 0xE: // Bank 0xE
|
||||
clLoadRomToRam.SetRomStart((LevelscriptCommand)c, firstBank0xE.RomStart);
|
||||
clLoadRomToRam.SetRomEnd((LevelscriptCommand)c, firstBank0xE.RomEnd);
|
||||
clLoadRomToRam.SetRomStart(c, firstBank0xE.RomStart);
|
||||
clLoadRomToRam.SetRomEnd(c, firstBank0xE.RomEnd);
|
||||
break;
|
||||
case 0xA:
|
||||
cmdBgSegLoad = (LevelscriptCommand)c;
|
||||
cmdBgSegLoad = c;
|
||||
break;
|
||||
case 0x7:
|
||||
if (lvl.LastGobCmdSegLoad == c)
|
||||
{
|
||||
cmdGobSegLoad = (LevelscriptCommand)c;
|
||||
cmdGobSegLoad = c;
|
||||
}
|
||||
break;
|
||||
case 0x9:
|
||||
if (lvl.LastLobCmdSegLoad == c)
|
||||
{
|
||||
cmdLobSegLoad = (LevelscriptCommand)c;
|
||||
cmdLobSegLoad = c;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -634,12 +636,12 @@ public class LevelManager : ILevelManager
|
||||
{
|
||||
if ((bool)tArea?.ShowMessage.Enabled && !foundCmdShowMsg)
|
||||
{
|
||||
clShowDialog.SetDialogID((LevelscriptCommand)c, tArea.ShowMessage.DialogID);
|
||||
clShowDialog.SetDialogID(c, tArea.ShowMessage.DialogID);
|
||||
foundCmdShowMsg = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdsToRemove.Add((LevelscriptCommand)c);
|
||||
cmdsToRemove.Add(c);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -647,14 +649,14 @@ public class LevelManager : ILevelManager
|
||||
|
||||
case LevelscriptCommandTypes.JumpToSegAddr:
|
||||
{
|
||||
int bankID = clJumpToSegAddr.GetSegJumpAddr((LevelscriptCommand)c) >> 24;
|
||||
int bankID = clJumpToSegAddr.GetSegJumpAddr(c) >> 24;
|
||||
switch (bankID)
|
||||
{
|
||||
case 0x7:
|
||||
cmdGobJump = (LevelscriptCommand)c;
|
||||
cmdGobJump = c;
|
||||
break;
|
||||
case 0x9:
|
||||
cmdLobJump = (LevelscriptCommand)c;
|
||||
cmdLobJump = c;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -666,7 +668,7 @@ public class LevelManager : ILevelManager
|
||||
foreach (var e in areaobjwarpindextoinsertdic.OrderByDescending(n => n.Value))
|
||||
{
|
||||
uint segStartAddr = areaobjwarpoffsetdic[e.Key];
|
||||
lvl.Levelscript.Insert(e.Value, new LevelscriptCommand(new byte[] { 0x6, 8, 0, 0, Convert.ToByte((long)(segStartAddr >> 24) & (long)0xFF), Convert.ToByte((long)(segStartAddr >> 16) & (long)0xFF), Convert.ToByte((long)(segStartAddr >> 8) & (long)0xFF), Convert.ToByte((long)segStartAddr & (long)0xFF) }));
|
||||
lvl.Levelscript.Insert(e.Value, new LevelscriptCommand(new byte[] { 0x6, 8, 0, 0, Convert.ToByte(segStartAddr >> 24 & (long)0xFF), Convert.ToByte(segStartAddr >> 16 & (long)0xFF), Convert.ToByte(segStartAddr >> 8 & (long)0xFF), Convert.ToByte(segStartAddr & (long)0xFF) }));
|
||||
}
|
||||
|
||||
// Lösche Commands
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SM64EditorLevelManager : ILevelManager
|
||||
lvl.Closed = false;
|
||||
|
||||
// Lade Levelscript
|
||||
lvl.Levelscript = new Levelscript();
|
||||
lvl.Levelscript = [];
|
||||
lvl.Levelscript.Read(rommgr, Convert.ToInt32(segAddress));
|
||||
|
||||
// Erstelle Areas / Lade Einstellungen
|
||||
@@ -59,8 +59,7 @@ public class SM64EditorLevelManager : ILevelManager
|
||||
{
|
||||
AreaOnFly = true;
|
||||
tArea = new SM64ELevelArea();
|
||||
if (firstArea is null)
|
||||
firstArea = tArea;
|
||||
firstArea ??= tArea;
|
||||
tArea.AreaID = clStartArea.GetAreaID(c);
|
||||
tArea.GeolayoutOffset = clStartArea.GetSegGeolayoutAddr(c);
|
||||
tArea.Geolayout.Read(rommgr, Convert.ToInt32(tArea.GeolayoutOffset));
|
||||
|
||||
@@ -167,10 +167,8 @@ public class Levelscript : LevelscriptCommandCollection
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fs is null)
|
||||
fs = new FileStream(rommgr.RomFile, FileMode.Open, FileAccess.Read);
|
||||
if (brfs is null)
|
||||
brfs = new BinaryReader(fs);
|
||||
fs ??= new FileStream(rommgr.RomFile, FileMode.Open, FileAccess.Read);
|
||||
brfs ??= new BinaryReader(fs);
|
||||
s = fs;
|
||||
br = brfs;
|
||||
}
|
||||
|
||||
@@ -113,10 +113,12 @@ namespace SM64Lib.Levels.Script
|
||||
public static Vector3 GetPosition(LevelscriptCommand Command)
|
||||
{
|
||||
Command.Position = 4;
|
||||
var Pos = new Vector3();
|
||||
Pos.X = Command.ReadInt16();
|
||||
Pos.Y = Command.ReadInt16();
|
||||
Pos.Z = Command.ReadInt16();
|
||||
var Pos = new Vector3
|
||||
{
|
||||
X = Command.ReadInt16(),
|
||||
Y = Command.ReadInt16(),
|
||||
Z = Command.ReadInt16()
|
||||
};
|
||||
Command.Position = 0;
|
||||
return Pos;
|
||||
}
|
||||
@@ -133,10 +135,12 @@ namespace SM64Lib.Levels.Script
|
||||
public static Vector3 GetRotation(LevelscriptCommand Command)
|
||||
{
|
||||
Command.Position = 10;
|
||||
var Rot = new Vector3();
|
||||
Rot.X = Command.ReadInt16();
|
||||
Rot.Y = Command.ReadInt16();
|
||||
Rot.Z = Command.ReadInt16();
|
||||
var Rot = new Vector3
|
||||
{
|
||||
X = Command.ReadInt16(),
|
||||
Y = Command.ReadInt16(),
|
||||
Z = Command.ReadInt16()
|
||||
};
|
||||
Command.Position = 0;
|
||||
return Rot;
|
||||
}
|
||||
@@ -153,11 +157,13 @@ namespace SM64Lib.Levels.Script
|
||||
public static ObjBParams GetParams(LevelscriptCommand Command)
|
||||
{
|
||||
Command.Position = 16;
|
||||
var Params = new ObjBParams();
|
||||
Params.BParam1 = Command.ReadByte();
|
||||
Params.BParam2 = Command.ReadByte();
|
||||
Params.BParam3 = Command.ReadByte();
|
||||
Params.BParam4 = Command.ReadByte();
|
||||
var Params = new ObjBParams
|
||||
{
|
||||
BParam1 = Command.ReadByte(),
|
||||
BParam2 = Command.ReadByte(),
|
||||
BParam3 = Command.ReadByte(),
|
||||
BParam4 = Command.ReadByte()
|
||||
};
|
||||
Command.Position = 0;
|
||||
return Params;
|
||||
}
|
||||
@@ -498,10 +504,12 @@ namespace SM64Lib.Levels.Script
|
||||
public static Vector3 GetPosition(LevelscriptCommand Command)
|
||||
{
|
||||
Command.Position = 6;
|
||||
var value = new Vector3();
|
||||
value.X = Command.ReadInt16();
|
||||
value.Y = Command.ReadInt16();
|
||||
value.Z = Command.ReadInt16();
|
||||
var value = new Vector3
|
||||
{
|
||||
X = Command.ReadInt16(),
|
||||
Y = Command.ReadInt16(),
|
||||
Z = Command.ReadInt16()
|
||||
};
|
||||
Command.Position = 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -37,8 +37,10 @@ public class SpecialBoxList : List<SpecialBox>
|
||||
while (SwapInts.SwapUInt16(br.ReadUInt16()) != 0xFFFF)
|
||||
{
|
||||
s.Position += 0x2;
|
||||
var tbox = new SpecialBox();
|
||||
tbox.Type = Type;
|
||||
var tbox = new SpecialBox
|
||||
{
|
||||
Type = Type
|
||||
};
|
||||
int lastpos = (int)(s.Position + 0x4);
|
||||
s.Position = SwapInts.SwapInt32(br.ReadInt32()) - 0x19000000 + Levelscriptstart;
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace SM64Lib.Model.Collision;
|
||||
|
||||
public class ColMesh
|
||||
{
|
||||
public VertexList Vertices { get; set; } = new VertexList();
|
||||
public TriangleList Triangles { get; set; } = new TriangleList();
|
||||
public VertexList Vertices { get; set; } = [];
|
||||
public TriangleList Triangles { get; set; } = [];
|
||||
|
||||
public ColMesh[] SplitMesh()
|
||||
{
|
||||
@@ -21,8 +21,10 @@ public class ColMesh
|
||||
var curVertCopies = new Dictionary<Vertex, Vertex>();
|
||||
foreach (Triangle t in mesh.Triangles)
|
||||
{
|
||||
var newTri = new Triangle();
|
||||
newTri.CollisionType = t.CollisionType;
|
||||
var newTri = new Triangle
|
||||
{
|
||||
CollisionType = t.CollisionType
|
||||
};
|
||||
for (int i = 0, loopTo = t.ColParams.Length - 1; i <= loopTo; i++)
|
||||
newTri.ColParams[i] = t.ColParams[i];
|
||||
for (int i = 0, loopTo1 = t.Vertices.Length - 1; i <= loopTo1; i++)
|
||||
@@ -34,10 +36,12 @@ public class ColMesh
|
||||
}
|
||||
else
|
||||
{
|
||||
var newVert = new Vertex();
|
||||
newVert.X = v.X;
|
||||
newVert.Y = v.Y;
|
||||
newVert.Z = v.Z;
|
||||
var newVert = new Vertex
|
||||
{
|
||||
X = v.X,
|
||||
Y = v.Y,
|
||||
Z = v.Z
|
||||
};
|
||||
curMesh.Vertices.Add(newVert);
|
||||
curVertCopies.Add(v, newVert);
|
||||
newTri.Vertices[i] = newVert;
|
||||
|
||||
@@ -17,7 +17,7 @@ public class CollisionMap : IToObject3D
|
||||
private int _Length = 0;
|
||||
|
||||
public ColMesh Mesh { get; set; } = new ColMesh();
|
||||
public List<BoxData> SpecialBoxes { get; set; } = new List<BoxData>();
|
||||
public List<BoxData> SpecialBoxes { get; set; } = [];
|
||||
|
||||
public void FromRom(string FileName, int RomOffset, CollisionBasicConfig config)
|
||||
{
|
||||
@@ -171,8 +171,10 @@ public class CollisionMap : IToObject3D
|
||||
var cs = colSettings.GetEntry(dicMatNames[f.Material]);
|
||||
if (!cs.IsNonSolid)
|
||||
{
|
||||
var t = new Triangle();
|
||||
t.CollisionType = cs.CollisionType;
|
||||
var t = new Triangle
|
||||
{
|
||||
CollisionType = cs.CollisionType
|
||||
};
|
||||
t.ColParams[0] = cs.CollisionParam1;
|
||||
t.ColParams[1] = cs.CollisionParam2;
|
||||
for (int i = 0, loopTo = Math.Min(f.Points.Count - 1, 2); i <= loopTo; i++)
|
||||
@@ -185,10 +187,12 @@ public class CollisionMap : IToObject3D
|
||||
}
|
||||
else
|
||||
{
|
||||
v = new Vertex();
|
||||
v.X = General.KeepInInt16Range(General.Round(curVert.X * ObjSettings.Scaling));
|
||||
v.Y = General.KeepInInt16Range(General.Round(curVert.Y * ObjSettings.Scaling));
|
||||
v.Z = General.KeepInInt16Range(General.Round(curVert.Z * ObjSettings.Scaling));
|
||||
v = new Vertex
|
||||
{
|
||||
X = General.KeepInInt16Range(General.Round(curVert.X * ObjSettings.Scaling)),
|
||||
Y = General.KeepInInt16Range(General.Round(curVert.Y * ObjSettings.Scaling)),
|
||||
Z = General.KeepInInt16Range(General.Round(curVert.Z * ObjSettings.Scaling))
|
||||
};
|
||||
Mesh.Vertices.Add(v);
|
||||
dicVertices.Add(curVert, v);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace SM64Lib.Model.Collision;
|
||||
|
||||
public class CollisionSettings
|
||||
{
|
||||
public List<Entry> Entries { get; private set; } = new List<Entry>();
|
||||
public List<Entry> Entries { get; private set; } = [];
|
||||
|
||||
public async Task Load(string fileName)
|
||||
{
|
||||
@@ -48,8 +48,10 @@ public class CollisionSettings
|
||||
}
|
||||
}
|
||||
|
||||
var ne = new Entry();
|
||||
ne.MaterialName = matName;
|
||||
var ne = new Entry
|
||||
{
|
||||
MaterialName = matName
|
||||
};
|
||||
Entries.Add(ne);
|
||||
return ne;
|
||||
}
|
||||
|
||||
@@ -80,13 +80,13 @@ public class Fast3DParser
|
||||
|
||||
case CommandTypes.ClearGeometryMode:
|
||||
{
|
||||
curGeometryMode = curGeometryMode & ~F3D_CLEARGEOMETRYMODE.GetGeometryMode(cmd);
|
||||
curGeometryMode &= ~F3D_CLEARGEOMETRYMODE.GetGeometryMode(cmd);
|
||||
break;
|
||||
}
|
||||
|
||||
case CommandTypes.SetGeometryMode:
|
||||
{
|
||||
curGeometryMode = curGeometryMode | F3D_CLEARGEOMETRYMODE.GetGeometryMode(cmd);
|
||||
curGeometryMode |= F3D_CLEARGEOMETRYMODE.GetGeometryMode(cmd);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -362,10 +362,12 @@ public class Fast3DParser
|
||||
{
|
||||
try
|
||||
{
|
||||
var mat = new Material();
|
||||
mat.Wrap = new System.Numerics.Vector2(curTexWrapT, curTexWrapS);
|
||||
mat.Scale = curTexScale;
|
||||
mat.Color = curColor;
|
||||
var mat = new Material
|
||||
{
|
||||
Wrap = new System.Numerics.Vector2(curTexWrapT, curTexWrapS),
|
||||
Scale = curTexScale,
|
||||
Color = curColor
|
||||
};
|
||||
var seg = GetSegBank(rommgr, curTexSegAddr, AreaID);
|
||||
if (seg is null)
|
||||
return;
|
||||
|
||||
@@ -53,9 +53,9 @@ public class ConvertResult
|
||||
public States State { get; set; } = States.Successfully;
|
||||
public uint PtrStart { get; set; } = 0;
|
||||
public uint PtrVertex { get; set; } = 0;
|
||||
public List<SM64Lib.Geolayout.Geopointer> PtrGeometry { get; private set; } = new List<SM64Lib.Geolayout.Geopointer>();
|
||||
public List<SM64Lib.Levels.ScrolTex.ManagedScrollingTexture> ScrollingCommands { get; private set; } = new List<SM64Lib.Levels.ScrolTex.ManagedScrollingTexture>();
|
||||
public Dictionary<short, string> ScrollingNames { get; private set; } = new Dictionary<short, string>();
|
||||
public List<SM64Lib.Geolayout.Geopointer> PtrGeometry { get; private set; } = [];
|
||||
public List<SM64Lib.Levels.ScrolTex.ManagedScrollingTexture> ScrollingCommands { get; private set; } = [];
|
||||
public Dictionary<short, string> ScrollingNames { get; private set; } = [];
|
||||
public MemoryStream Data { get; private set; } = new MemoryStream();
|
||||
|
||||
public enum States
|
||||
@@ -205,7 +205,7 @@ public class Fast3DWriter
|
||||
|
||||
public sbyte[] indexList = new sbyte[2049];
|
||||
|
||||
public List<FinalVertexData> FinalVertexData { get; private set; } = new List<FinalVertexData>();
|
||||
public List<FinalVertexData> FinalVertexData { get; private set; } = [];
|
||||
|
||||
public short VertexDataCount
|
||||
{
|
||||
@@ -264,7 +264,7 @@ public class Fast3DWriter
|
||||
}
|
||||
|
||||
public int StartIndex { get; set; } = 0;
|
||||
public List<FvGroup> FinalVertexGroups { get; private set; } = new List<FvGroup>();
|
||||
public List<FvGroup> FinalVertexGroups { get; private set; } = [];
|
||||
|
||||
public bool EnableVertexColors
|
||||
{
|
||||
@@ -344,17 +344,17 @@ public class Fast3DWriter
|
||||
}
|
||||
}
|
||||
|
||||
private List<Vertex> verts = new List<Vertex>();
|
||||
private List<Normal> norms = new List<Normal>();
|
||||
private List<VertexColor> vertexColors = new List<VertexColor>();
|
||||
private List<TexCord> uvs = new List<TexCord>();
|
||||
private List<Material> materials = new List<Material>();
|
||||
private List<Pilz.S3DFileParser.Material> ignoreFacesWithMaterial = new List<Pilz.S3DFileParser.Material>();
|
||||
private Dictionary<Pilz.S3DFileParser.Material, Material> materialBindings = new Dictionary<Pilz.S3DFileParser.Material, Material>();
|
||||
private List<VertexGroupList> vertexGroups = new List<VertexGroupList>();
|
||||
private List<FinalVertexData> finalVertData = new List<FinalVertexData>();
|
||||
private List<TextureEntry> textureBank = new List<TextureEntry>();
|
||||
private List<ScrollTex> scrollTexts = new List<ScrollTex>();
|
||||
private List<Vertex> verts = [];
|
||||
private List<Normal> norms = [];
|
||||
private List<VertexColor> vertexColors = [];
|
||||
private List<TexCord> uvs = [];
|
||||
private List<Material> materials = [];
|
||||
private List<Pilz.S3DFileParser.Material> ignoreFacesWithMaterial = [];
|
||||
private Dictionary<Pilz.S3DFileParser.Material, Material> materialBindings = [];
|
||||
private List<VertexGroupList> vertexGroups = [];
|
||||
private List<FinalVertexData> finalVertData = [];
|
||||
private List<TextureEntry> textureBank = [];
|
||||
private List<ScrollTex> scrollTexts = [];
|
||||
private Material currentMaterial;
|
||||
private int currentFace = 0;
|
||||
private const byte GEOLAYER_SOLID = 1;
|
||||
@@ -365,7 +365,7 @@ public class Fast3DWriter
|
||||
private byte[] defaultColor = new byte[24];
|
||||
private ConvertSettings settings = null;
|
||||
private SM64Lib.Data.BinaryData impdata = null;
|
||||
private ConvertResult conRes = new ConvertResult();
|
||||
private ConvertResult conRes = new();
|
||||
private readonly byte[] ColtypesWithParams = new byte[] { 14, 44, 36, 37, 39, 45 };
|
||||
|
||||
private uint CurSegAddress
|
||||
@@ -506,8 +506,8 @@ public class Fast3DWriter
|
||||
|
||||
private void processMaterialColorAlpha(float alpha, Material mat)
|
||||
{
|
||||
mat.Color = mat.Color & 0xFFFFFF00U;
|
||||
mat.Color = mat.Color | Convert.ToByte(Convert.ToInt64(0xFF * alpha) & 0xFF);
|
||||
mat.Color &= 0xFFFFFF00U;
|
||||
mat.Color |= Convert.ToByte(Convert.ToInt64(0xFF * alpha) & 0xFF);
|
||||
if (alpha < 1.0F)
|
||||
{
|
||||
mat.Type = MaterialType.ColorTransparent;
|
||||
@@ -672,15 +672,12 @@ public class Fast3DWriter
|
||||
}
|
||||
|
||||
// Create & Add texture entry
|
||||
if (entry is null)
|
||||
{
|
||||
entry = new TextureEntry()
|
||||
entry ??= new TextureEntry()
|
||||
{
|
||||
Width = mat.TexWidth,
|
||||
Height = mat.TexHeight,
|
||||
OriginalImage = img
|
||||
};
|
||||
}
|
||||
|
||||
// Load Texture from File
|
||||
var bmp = new Bitmap(img);
|
||||
@@ -2104,7 +2101,7 @@ public class Fast3DWriter
|
||||
var dlsToCreate = new List<DisplaylistProps>();
|
||||
var dicMatDlIDs = new Dictionary<Material, int>();
|
||||
ProcessObject3DModel(model);
|
||||
conRes.PtrStart = Convert.ToUInt32((long)CurSegAddress | impdata.Position);
|
||||
conRes.PtrStart = Convert.ToUInt32(CurSegAddress | impdata.Position);
|
||||
importStart = Convert.ToUInt32(impdata.Position);
|
||||
|
||||
// Write default color
|
||||
@@ -2136,7 +2133,7 @@ public class Fast3DWriter
|
||||
removeDuplicateVertices(settings.ReduceVertLevel);
|
||||
|
||||
// Write vertices
|
||||
conRes.PtrVertex = Convert.ToUInt32((long)CurSegAddress | impdata.Position);
|
||||
conRes.PtrVertex = Convert.ToUInt32(CurSegAddress | impdata.Position);
|
||||
startVerts = Convert.ToUInt32(impdata.Position);
|
||||
foreach (VertexGroupList mp in vertexGroups)
|
||||
{
|
||||
@@ -2163,8 +2160,7 @@ public class Fast3DWriter
|
||||
dlProp = dl;
|
||||
}
|
||||
|
||||
if (dlProp is null)
|
||||
dlProp = new DisplaylistProps(newLayerID);
|
||||
dlProp ??= new DisplaylistProps(newLayerID);
|
||||
|
||||
dlProp.Layer = layerID;
|
||||
if (!dlsToCreate.Contains(dlProp))
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace SM64Lib.Model.Fast3D.DisplayLists;
|
||||
|
||||
public class DisplayList
|
||||
{
|
||||
public DisplayListScript Script { get; private set; } = new DisplayListScript();
|
||||
public DisplayListScript Script { get; private set; } = [];
|
||||
public Geopointer GeoPointer { get; set; } = null;
|
||||
// Public Property Data As Stream = Nothing
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace SM64Lib.Model.Fast3D;
|
||||
|
||||
public class TextureFormatSettings
|
||||
{
|
||||
public List<Entry> Entries { get; private set; } = new List<Entry>();
|
||||
public List<DisplaylistProps> CustomDisplayLists { get; private set; } = new List<DisplaylistProps>();
|
||||
public List<Entry> Entries { get; private set; } = [];
|
||||
public List<DisplaylistProps> CustomDisplayLists { get; private set; } = [];
|
||||
|
||||
public async Task Load(string fileName)
|
||||
{
|
||||
@@ -69,8 +69,10 @@ public class TextureFormatSettings
|
||||
}
|
||||
}
|
||||
|
||||
var ne = new Entry();
|
||||
ne.MaterialName = matName;
|
||||
var ne = new Entry
|
||||
{
|
||||
MaterialName = matName
|
||||
};
|
||||
Entries.Add(ne);
|
||||
return ne;
|
||||
}
|
||||
|
||||
@@ -97,10 +97,12 @@ public static class TextureManager
|
||||
break;
|
||||
case TextureConverters.NConvert:
|
||||
{
|
||||
var arguments = new List<string>();
|
||||
arguments.Add("-out png");
|
||||
arguments.Add($"-resize {result.Width} {result.Height}");
|
||||
arguments.Add("-overwrite");
|
||||
var arguments = new List<string>
|
||||
{
|
||||
"-out png",
|
||||
$"-resize {result.Width} {result.Height}",
|
||||
"-overwrite"
|
||||
};
|
||||
|
||||
var sourceFilePath = Path.GetTempFileName();
|
||||
using (var fs = new FileStream(sourceFilePath, FileMode.Create, FileAccess.ReadWrite))
|
||||
|
||||
@@ -127,7 +127,7 @@ public class ObjectModel
|
||||
public class SaveResult
|
||||
{
|
||||
public int CollisionPointer { get; set; } = -1;
|
||||
public List<Geopointer> GeoPointers { get; set; } = new List<Geopointer>();
|
||||
public List<Geopointer> GeoPointers { get; set; } = [];
|
||||
public long Length { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace SM64Lib.Music;
|
||||
|
||||
public class InstrumentSetList
|
||||
{
|
||||
public List<byte> Sets { get; private set; } = new List<byte>();
|
||||
public List<byte> Sets { get; private set; } = [];
|
||||
|
||||
public int Count
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace SM64Lib.Music;
|
||||
|
||||
public class MusicSequence
|
||||
{
|
||||
private InstrumentSetList _InstrumentSets = new InstrumentSetList();
|
||||
private InstrumentSetList _InstrumentSets = new();
|
||||
|
||||
public byte[] BinaryData { get; set; } = Array.Empty<byte>();
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ItemBoxContentManager
|
||||
|
||||
public ItemBoxContentManager()
|
||||
{
|
||||
ContentTable = new ItemBoxContentTable();
|
||||
ContentTable = [];
|
||||
}
|
||||
|
||||
public ItemBoxContentManager(ItemBoxContentTable table)
|
||||
@@ -66,7 +66,7 @@ public class ItemBoxContentManager
|
||||
rom.Position = 0x7C8E2;
|
||||
address = Convert.ToUInt32(rom.ReadUInt16()) << 16;
|
||||
rom.Position = 0x7C8E6;
|
||||
address = address | rom.ReadUInt16();
|
||||
address |= rom.ReadUInt16();
|
||||
return address;
|
||||
}
|
||||
|
||||
@@ -230,8 +230,10 @@ public class ItemBoxContentManager
|
||||
foreach (string line in File.ReadAllLines(fileName))
|
||||
{
|
||||
var vals = line.Split(',');
|
||||
var entry = new ItemBoxContentEntry();
|
||||
entry.ID = Convert.ToByte(vals[0].Trim(), 16);
|
||||
var entry = new ItemBoxContentEntry
|
||||
{
|
||||
ID = Convert.ToByte(vals[0].Trim(), 16)
|
||||
};
|
||||
vals[1] = vals[1].Trim();
|
||||
entry.BParam1 = Convert.ToByte(vals[1].Substring(0, 2), 16);
|
||||
entry.BParam2 = Convert.ToByte(vals[1].Substring(2, 2), 16);
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace SM64Lib.Objects.ModelBanks;
|
||||
public class CustomModelBank
|
||||
{
|
||||
public ObjectModelConfig Config { get; private set; } = new ObjectModelConfig();
|
||||
public List<CustomModel> Models { get; private set; } = new List<CustomModel>();
|
||||
public List<CustomModel> Models { get; private set; } = [];
|
||||
public SegmentedBank CurSeg { get; private set; } = null;
|
||||
public bool NeedToSave { get; set; } = false;
|
||||
public Levelscript Levelscript { get; private set; } = new Levelscript();
|
||||
public Levelscript Levelscript { get; private set; } = [];
|
||||
|
||||
[JsonIgnore]
|
||||
public int Length
|
||||
@@ -159,15 +159,16 @@ public class CustomModelBank
|
||||
// Parse Levelscript & Load Models
|
||||
for (int i = 0, loopTo = Levelscript.Count - 1; i <= loopTo; i++)
|
||||
{
|
||||
LevelscriptCommand cmd = (LevelscriptCommand)Levelscript[i];
|
||||
LevelscriptCommand cmd = Levelscript[i];
|
||||
|
||||
switch (cmd.CommandType)
|
||||
{
|
||||
case LevelscriptCommandTypes.LoadPolygonWithGeo:
|
||||
var obj = new CustomModel() { Config = config.GetCustomObjectConfig(i) };
|
||||
|
||||
// Load Model ID & Geolayout Offset
|
||||
obj.ModelID = clLoadPolygonWithGeo.GetModelID(cmd);
|
||||
var obj = new CustomModel
|
||||
{
|
||||
Config = config.GetCustomObjectConfig(i), // Load Model ID & Geolayout Offset
|
||||
ModelID = clLoadPolygonWithGeo.GetModelID(cmd)
|
||||
};
|
||||
int geoAddr = clLoadPolygonWithGeo.GetSegAddress(cmd);
|
||||
obj.GeolayoutBankOffset = geoAddr & 0xFFFFFF;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace SM64Lib.Objects.ObjectBanks;
|
||||
|
||||
public class CustomObjectCollection
|
||||
{
|
||||
public List<CustomObject> CustomObjects { get; } = new List<CustomObject>();
|
||||
public List<CustomObject> CustomObjects { get; } = [];
|
||||
|
||||
public void TakeoverProperties(RomManager rommgr)
|
||||
{
|
||||
|
||||
@@ -12,13 +12,13 @@ namespace SM64Lib.Objects.ObjectBanks;
|
||||
|
||||
public class CustomObjectExportData
|
||||
{
|
||||
public List<CustomObject> CustomObjects { get; set; } = new List<CustomObject>();
|
||||
public List<CustomObject> CustomObjects { get; set; } = [];
|
||||
[JsonConverter(typeof(ComplexDictionarJsonConverter<CustomModelConfig, CustomModel>))]
|
||||
public Dictionary<CustomModelConfig, CustomModel> CustomModels { get; set; } = new Dictionary<CustomModelConfig, CustomModel>();
|
||||
public Dictionary<CustomModelConfig, CustomModel> CustomModels { get; set; } = [];
|
||||
[JsonConverter(typeof(ComplexDictionarJsonConverter<BehaviorConfig, Behavior>))]
|
||||
public Dictionary<BehaviorConfig, Behavior> Behaviors { get; set; } = new Dictionary<BehaviorConfig, Behavior>();
|
||||
public Dictionary<BehaviorConfig, Behavior> Behaviors { get; set; } = [];
|
||||
[JsonConverter(typeof(ComplexDictionarJsonConverter<CustomAsmAreaConfig, CustomAsmArea>))]
|
||||
public Dictionary<CustomAsmAreaConfig, CustomAsmArea> CustomAsmAreas { get; set; } = new Dictionary<CustomAsmAreaConfig, CustomAsmArea>();
|
||||
public Dictionary<CustomAsmAreaConfig, CustomAsmArea> CustomAsmAreas { get; set; } = [];
|
||||
public EmbeddedFilesContainer EmbeddedFiles { get; set; }
|
||||
public PatchScript Script { get; set; }
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ namespace SM64Lib.Objects.ObjectBanks;
|
||||
public class CustomObjectImport : CustomObjectExport
|
||||
{
|
||||
[JsonIgnore]
|
||||
public Dictionary<CustomModelConfig, CustomModelBank> DestModelBanks { get; } = new Dictionary<CustomModelConfig, CustomModelBank>();
|
||||
public Dictionary<CustomModelConfig, CustomModelBank> DestModelBanks { get; } = [];
|
||||
[JsonIgnore]
|
||||
public CustomAsmBank DestCustomAsmBank { get; set; } = null;
|
||||
[JsonIgnore]
|
||||
public BehaviorBank DestBehaviorBank { get; set; } = null;
|
||||
[JsonIgnore]
|
||||
public List<CustomObject> IgnoreCustomObjects { get; } = new List<CustomObject>();
|
||||
public List<CustomObject> IgnoreCustomObjects { get; } = [];
|
||||
[JsonIgnore]
|
||||
public bool OverwriteExistingObjecs { get; set; } = true;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace SM64Lib.Objects.ObjectBanks.Data;
|
||||
public class ObjectBankData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public List<string> Objects { get; private set; } = new List<string>();
|
||||
public List<ObjectBankDataCommand> Commands { get; private set; } = new List<ObjectBankDataCommand>();
|
||||
public List<string> Objects { get; private set; } = [];
|
||||
public List<ObjectBankDataCommand> Commands { get; private set; } = [];
|
||||
|
||||
public ObjectBankData()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PatchProfile
|
||||
/// A list with scripts.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<PatchScript> Scripts { get; set; } = new List<PatchScript>();
|
||||
public List<PatchScript> Scripts { get; set; } = [];
|
||||
/// <summary>
|
||||
/// The version of this profile.
|
||||
/// </summary>
|
||||
|
||||
@@ -10,6 +10,6 @@ public class PatchScriptExecuteParams
|
||||
public RomManager RomManager { get; set; }
|
||||
public EmbeddedFilesContainer EmbeddedFiles { get; set; }
|
||||
public string ProfilePath { get; set; }
|
||||
public Dictionary<string, object> OtherParameters { get; set; } = new();
|
||||
public Dictionary<string, object> OtherParameters { get; set; } = [];
|
||||
public IWin32Window WindowOwner { get; set; }
|
||||
}
|
||||
|
||||
@@ -121,8 +121,10 @@ public class PatchingManager
|
||||
|
||||
public PatchScript XElementToScript(XElement element)
|
||||
{
|
||||
var script = new PatchScript();
|
||||
script.Script = element.Value;
|
||||
var script = new PatchScript
|
||||
{
|
||||
Script = element.Value
|
||||
};
|
||||
foreach (XAttribute attr in element.Attributes())
|
||||
{
|
||||
var switchExpr = attr.Name;
|
||||
@@ -238,7 +240,7 @@ public class PatchingManager
|
||||
CompilationOptions compilationOptions;
|
||||
Compilation compilation = null;
|
||||
SyntaxTree syntaxTree = null;
|
||||
Dictionary<string, MetadataReference> references = new();
|
||||
Dictionary<string, MetadataReference> references = [];
|
||||
EmitResult resultEmit = null;
|
||||
Assembly resultAssembly = null;
|
||||
|
||||
|
||||
@@ -64,22 +64,22 @@ public class RomManager
|
||||
|
||||
// F i e l d s
|
||||
|
||||
private readonly Dictionary<byte, SegmentedBank> segBankList = new Dictionary<byte, SegmentedBank>();
|
||||
private readonly Dictionary<byte, Dictionary<byte, SegmentedBank>> areaSegBankList = new Dictionary<byte, Dictionary<byte, SegmentedBank>>();
|
||||
private Dictionary<string, RomVersion> dicUpdatePatches = new Dictionary<string, RomVersion>();
|
||||
private RomVersion myProgramVersion = new RomVersion();
|
||||
private readonly List<ushort> levelIDsToReset = new List<ushort>();
|
||||
private readonly List<Text.TextGroup> myTextGroups = new List<Text.TextGroup>();
|
||||
private readonly Dictionary<byte, SegmentedBank> segBankList = [];
|
||||
private readonly Dictionary<byte, Dictionary<byte, SegmentedBank>> areaSegBankList = [];
|
||||
private Dictionary<string, RomVersion> dicUpdatePatches = [];
|
||||
private RomVersion myProgramVersion = new();
|
||||
private readonly List<ushort> levelIDsToReset = [];
|
||||
private readonly List<Text.TextGroup> myTextGroups = [];
|
||||
private string myGameName = null;
|
||||
private bool programVersion_loadedVersion = false;
|
||||
|
||||
// P r o p e r t i e s
|
||||
|
||||
public LevelInfoDataTabelList LevelInfoData { get; private set; } = new LevelInfoDataTabelList();
|
||||
public LevelList Levels { get; private set; } = new LevelList();
|
||||
public LevelInfoDataTabelList LevelInfoData { get; private set; } = [];
|
||||
public LevelList Levels { get; private set; } = [];
|
||||
public string RomFile { get; set; } = string.Empty;
|
||||
public bool IsSM64EditorMode { get; private set; } = false;
|
||||
public MusicList MusicList { get; private set; } = new MusicList();
|
||||
public MusicList MusicList { get; private set; } = [];
|
||||
public CustomModelBank GlobalModelBank { get; private set; } = new CustomModelBank();
|
||||
public CustomAsmBank GlobalCustomAsmBank { get; private set; } = null;
|
||||
public BehaviorBank GlobalBehaviorBank { get; private set; } = null;
|
||||
@@ -347,8 +347,10 @@ public class RomManager
|
||||
{
|
||||
if (myGameName is null)
|
||||
{
|
||||
var fs = new BinaryRom(this, FileAccess.Read);
|
||||
fs.Position = 0x20;
|
||||
var fs = new BinaryRom(this, FileAccess.Read)
|
||||
{
|
||||
Position = 0x20
|
||||
};
|
||||
myGameName = Encoding.ASCII.GetString(fs.Read(0x14)).Trim();
|
||||
fs.Close();
|
||||
}
|
||||
@@ -358,8 +360,10 @@ public class RomManager
|
||||
|
||||
set
|
||||
{
|
||||
var fs = new BinaryRom(this, FileAccess.Write);
|
||||
fs.Position = 0x20;
|
||||
var fs = new BinaryRom(this, FileAccess.Write)
|
||||
{
|
||||
Position = 0x20
|
||||
};
|
||||
foreach (byte b in Encoding.ASCII.GetBytes(value))
|
||||
fs.Write(b);
|
||||
while (fs.Position < 0x34)
|
||||
@@ -381,12 +385,14 @@ public class RomManager
|
||||
|
||||
public RomSpaceInfo GetRomSpaceInfo()
|
||||
{
|
||||
var info = new RomSpaceInfo();
|
||||
info.MaxAvailableSpace = 0x4000000 - 0x1210000;
|
||||
info.UsedLevelsSpace = Levels.Length;
|
||||
info.UsedMusicSpace = MusicList.Length;
|
||||
info.UsedGlobalBehaviorSpace = GlobalBehaviorBank.Length;
|
||||
info.UsedGlobalModelsSpace = GlobalModelBank is object ? GlobalModelBank.Length : 0;
|
||||
var info = new RomSpaceInfo
|
||||
{
|
||||
MaxAvailableSpace = 0x4000000 - 0x1210000,
|
||||
UsedLevelsSpace = Levels.Length,
|
||||
UsedMusicSpace = MusicList.Length,
|
||||
UsedGlobalBehaviorSpace = GlobalBehaviorBank.Length,
|
||||
UsedGlobalModelsSpace = GlobalModelBank is object ? GlobalModelBank.Length : 0
|
||||
};
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -539,8 +545,10 @@ public class RomManager
|
||||
private void WriteVersion(RomVersion newVersion)
|
||||
{
|
||||
myProgramVersion = newVersion;
|
||||
var fs = new BinaryRom(this, FileAccess.ReadWrite);
|
||||
fs.Position = 0x1201FF8;
|
||||
var fs = new BinaryRom(this, FileAccess.ReadWrite)
|
||||
{
|
||||
Position = 0x1201FF8
|
||||
};
|
||||
fs.Write(newVersion.DevelopmentStage << 24 | newVersion.DevelopmentBuild);
|
||||
fs.WriteByte(Convert.ToByte(newVersion.Version.Major));
|
||||
fs.WriteByte(Convert.ToByte(newVersion.Version.Minor));
|
||||
@@ -551,8 +559,10 @@ public class RomManager
|
||||
|
||||
private RomVersion LoadVersion()
|
||||
{
|
||||
var fs = new BinaryRom(this, FileAccess.Read);
|
||||
fs.Position = 0x1201FF8;
|
||||
var fs = new BinaryRom(this, FileAccess.Read)
|
||||
{
|
||||
Position = 0x1201FF8
|
||||
};
|
||||
int devInfo = fs.ReadInt32();
|
||||
byte major = fs.ReadByte();
|
||||
byte minor = fs.ReadByte();
|
||||
@@ -655,7 +665,7 @@ public class RomManager
|
||||
table.NeedToSave = false;
|
||||
if (prof is Text.Profiles.TextTableGroupInfo)
|
||||
{
|
||||
needUpdateChecksum = needUpdateChecksum | ((Text.Profiles.TextTableGroupInfo)prof).Segmented.BankAddress == 0x80245000U;
|
||||
needUpdateChecksum |= ((Text.Profiles.TextTableGroupInfo)prof).Segmented.BankAddress == 0x80245000U;
|
||||
}
|
||||
else if (prof is Text.Profiles.TextArrayGroupInfo)
|
||||
{
|
||||
@@ -788,13 +798,16 @@ public class RomManager
|
||||
/// </summary>
|
||||
public void LoadGlobalModelBank()
|
||||
{
|
||||
var fs = new BinaryRom(this, FileAccess.Read);
|
||||
|
||||
var fs = new BinaryRom(this, FileAccess.Read)
|
||||
{
|
||||
// Read Bank Addres & Length from Rom
|
||||
fs.Position = 0x120FFF0;
|
||||
var seg = new SegmentedBank(0x7);
|
||||
seg.RomStart = fs.ReadInt32();
|
||||
seg.RomEnd = fs.ReadInt32();
|
||||
Position = 0x120FFF0
|
||||
};
|
||||
var seg = new SegmentedBank(0x7)
|
||||
{
|
||||
RomStart = fs.ReadInt32(),
|
||||
RomEnd = fs.ReadInt32()
|
||||
};
|
||||
if (seg.RomStart != 0x1010101 && seg.RomStart > -1)
|
||||
{
|
||||
// Set Segmented Bank
|
||||
@@ -1010,8 +1023,10 @@ public class RomManager
|
||||
}
|
||||
}
|
||||
|
||||
var br = new BinaryRom(this, FileAccess.Read);
|
||||
br.Position = 0x1200000;
|
||||
var br = new BinaryRom(this, FileAccess.Read)
|
||||
{
|
||||
Position = 0x1200000
|
||||
};
|
||||
long tCheckData = br.ReadInt64();
|
||||
br.Close();
|
||||
IsSM64EditorMode = new[] { 0x800800001900001C, 0x800800000E0000C4 }.Contains((ulong)tCheckData);
|
||||
@@ -1179,7 +1194,7 @@ public class RomManager
|
||||
}
|
||||
else
|
||||
{
|
||||
sbl = new Dictionary<byte, SegmentedBank>();
|
||||
sbl = [];
|
||||
areaSegBankList.Add((byte)AreaID, sbl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace SM64Lib;
|
||||
|
||||
public static class RomManagerInstances
|
||||
{
|
||||
private static readonly List<RomManager> romManagers = new List<RomManager>();
|
||||
private static readonly List<RomManager> romManagers = [];
|
||||
|
||||
public static IEnumerable<RomManager> CurrentInstances
|
||||
{
|
||||
|
||||
@@ -44,8 +44,8 @@
|
||||
<DefineConstants>TRACE;RelMono</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.10.0" />
|
||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||
<PackageReference Include="Pilz.Cryptography" Version="2.0.1" />
|
||||
<PackageReference Include="Pilz.IO" Version="2.0.0" />
|
||||
|
||||
@@ -4,5 +4,5 @@ namespace SM64Lib.Text.Profiles;
|
||||
|
||||
public class TextArrayGroupInfo : TextGroupInfo
|
||||
{
|
||||
public List<TextArrayItemInfo> Texts { get; set; } = new List<TextArrayItemInfo>();
|
||||
public List<TextArrayItemInfo> Texts { get; set; } = [];
|
||||
}
|
||||
@@ -9,8 +9,8 @@ namespace SM64Lib.Text.Profiles;
|
||||
public class TextProfileInfo
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public List<TextTableGroupInfo> TextTableGroups { get; set; } = new List<TextTableGroupInfo>();
|
||||
public List<TextArrayGroupInfo> TextArrayGroups { get; set; } = new List<TextArrayGroupInfo>();
|
||||
public List<TextTableGroupInfo> TextTableGroups { get; set; } = [];
|
||||
public List<TextArrayGroupInfo> TextArrayGroups { get; set; } = [];
|
||||
|
||||
public TextGroupInfo GetGroup(string name)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ public class TextTableGroupInfo : TextGroupInfo
|
||||
public TextTableDialogDataInfo DialogData { get; set; } = new TextTableDialogDataInfo();
|
||||
[JsonIgnore]
|
||||
[Browsable(false)]
|
||||
public List<string> ItemDescriptionsList { get; set; } = new List<string>();
|
||||
public List<string> ItemDescriptionsList { get; set; } = [];
|
||||
|
||||
[Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]
|
||||
public string ItemDescriptions
|
||||
|
||||
@@ -183,8 +183,10 @@ public class Trajectories : List<Trajectory>
|
||||
data.Position = addr - (int)addrToSubstract + 0x1200000;
|
||||
for (int i = 1, loopTo = count; i <= loopTo; i++)
|
||||
{
|
||||
var trajectory = new Trajectory();
|
||||
trajectory.Name = name;
|
||||
var trajectory = new Trajectory
|
||||
{
|
||||
Name = name
|
||||
};
|
||||
trajectory.Read(data, (uint)(data.Position));
|
||||
Add(trajectory);
|
||||
}
|
||||
@@ -212,14 +214,14 @@ public class Trajectories : List<Trajectory>
|
||||
data.Position = 0xCCA6E;
|
||||
addr = data.ReadUInt16() << 16;
|
||||
data.Position = 0xCCA76;
|
||||
addr = addr | data.ReadUInt16();
|
||||
addr |= data.ReadUInt16();
|
||||
AddTrajectory(data, addr, TrajectoryName.RacingPenguin);
|
||||
|
||||
// Snowman's Bottom
|
||||
data.Position = 0xABC9E;
|
||||
addr = data.ReadUInt16() << 16;
|
||||
data.Position = 0xABCA6;
|
||||
addr = addr | data.ReadUInt16();
|
||||
addr |= data.ReadUInt16();
|
||||
AddTrajectory(data, addr, TrajectoryName.SnowmansBottom);
|
||||
|
||||
// Platform on Tracks Behavior (B.Param 2 = 0 - 8)
|
||||
@@ -235,42 +237,42 @@ public class Trajectories : List<Trajectory>
|
||||
addr = data.ReadUInt16() << 16;
|
||||
data.Position = 0xA9ABC + 2;
|
||||
var val3 = data.ReadUInt16();
|
||||
addr = addr | val3;
|
||||
addr |= val3;
|
||||
AddTrajectory(data, addr, TrajectoryName.MetalBallsGenerators_BParam2_00);
|
||||
|
||||
// Metal Balls Generators - B.Param 2 = 01
|
||||
data.Position = 0xA9AD4 + 2;
|
||||
addr = data.ReadUInt16() << 16;
|
||||
data.Position = 0xA9ADC + 2;
|
||||
addr = addr | data.ReadUInt16();
|
||||
addr |= data.ReadUInt16();
|
||||
AddTrajectory(data, addr, TrajectoryName.MetalBallsGenerators_BParam2_01);
|
||||
|
||||
// Metal Balls Generators - B.Param 2 = 02
|
||||
data.Position = 0xA9AF4 + 2;
|
||||
addr = data.ReadUInt16() << 16;
|
||||
data.Position = 0xA9AFC + 2;
|
||||
addr = addr | data.ReadUInt16();
|
||||
addr |= data.ReadUInt16();
|
||||
AddTrajectory(data, addr, TrajectoryName.MetalBallsGenerators_BParam2_02);
|
||||
|
||||
// Mini-Metal Ball Generator - B.Param 2 = 03
|
||||
data.Position = 0xA9B1C + 2;
|
||||
addr = data.ReadUInt16() << 16;
|
||||
data.Position += 2;
|
||||
addr = addr | data.ReadUInt16();
|
||||
addr |= data.ReadUInt16();
|
||||
AddTrajectory(data, addr, TrajectoryName.MiniMetalBallGenerator_BParam2_03);
|
||||
|
||||
// Mini-Metal Ball Generator - B.Param 2 = 04
|
||||
data.Position = 0xA9B1C + 2;
|
||||
addr = data.ReadUInt16() << 16;
|
||||
data.Position += 2;
|
||||
addr = addr | data.ReadUInt16();
|
||||
addr |= data.ReadUInt16();
|
||||
AddTrajectory(data, addr, TrajectoryName.MiniMetalBallGenerator_BParam2_04);
|
||||
|
||||
// Mips the Rabbit
|
||||
data.Position = 0xB3816;
|
||||
addr = data.ReadUInt16() << 16;
|
||||
data.Position += 6;
|
||||
addr = addr | data.ReadUInt16();
|
||||
addr |= data.ReadUInt16();
|
||||
data.Position = 0xB371E;
|
||||
ushort numOfPaths = data.ReadUInt16();
|
||||
AddTrajectory(data, addr, TrajectoryName.MipsTheRabbit, numOfPaths);
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace SM64Lib.Trajectorys;
|
||||
|
||||
public class Trajectory
|
||||
{
|
||||
public List<Vector3> Points { get; private set; } = new List<Vector3>();
|
||||
public List<Vector3> Points { get; private set; } = [];
|
||||
public bool NeedToSave { get; set; } = false;
|
||||
public TrajectoryName Name { get; set; } = TrajectoryName.None;
|
||||
|
||||
@@ -46,10 +46,12 @@ public class Trajectory
|
||||
if ((ulong)data.ReadInt64() != 0xFFFFFFFFFFFFFFFF)
|
||||
{
|
||||
data.Position -= 6;
|
||||
var point = new Vector3();
|
||||
point.X = data.ReadInt16();
|
||||
point.Y = data.ReadInt16();
|
||||
point.Z = data.ReadInt16();
|
||||
var point = new Vector3
|
||||
{
|
||||
X = data.ReadInt16(),
|
||||
Y = data.ReadInt16(),
|
||||
Z = data.ReadInt16()
|
||||
};
|
||||
Points.Add(point);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user