code optimization

This commit is contained in:
2024-06-05 19:21:19 +02:00
parent 04c965ca80
commit 547dfc95bd
225 changed files with 17925 additions and 18561 deletions

View File

@@ -1,17 +1,15 @@
using System;
namespace SM64Lib.LIBMIO0;
namespace SM64Lib.LIBMIO0
public struct MIO0_Header
{
public struct MIO0_Header
{
public uint dest_size;
public uint comp_offset;
public uint uncomp_offset;
public bool big_endian;
};
};
public class MIO0
{
public class MIO0
{
private const int MIO0_HEADER_LENGTH = 16;
@@ -147,5 +145,4 @@ namespace SM64Lib.LIBMIO0
return decoded;
}
}
}

View File

@@ -1,6 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von

View File

@@ -1,12 +1,12 @@
using System.Drawing;
namespace SM64Lib.N64Graphics
{
public enum N64Codec { RGBA16, RGBA32, IA16, IA8, IA4, I8, I4, CI8, CI4, ONEBPP };
public enum N64IMode { AlphaCopyIntensity, AlphaBinary, AlphaOne };
namespace SM64Lib.N64Graphics;
public class N64Graphics
{
public enum N64Codec { RGBA16, RGBA32, IA16, IA8, IA4, I8, I4, CI8, CI4, ONEBPP };
public enum N64IMode { AlphaCopyIntensity, AlphaBinary, AlphaOne };
public class N64Graphics
{
private static int SCALE_5_8(int val)
{
return (val * 0xFF) / 0x1F;
@@ -520,5 +520,4 @@ namespace SM64Lib.N64Graphics
break;
}
}
}
}

View File

@@ -1,6 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von

View File

@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.N64Graphics
namespace SM64Lib.N64Graphics;
public class TextureFormats
{
public class TextureFormats
{
public static Bitmap createColorTexture(Color color)
{
Bitmap tex = new Bitmap(1, 1);
@@ -594,5 +590,4 @@ namespace SM64Lib.N64Graphics
"Height: " + height };
return tex;
}
}
}

View File

@@ -1,15 +1,12 @@
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Text.Exporters
namespace SM64Lib.Text.Exporters;
public class ExcelExporter
{
public class ExcelExporter
{
public ExcelExporter()
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
@@ -98,5 +95,4 @@ namespace SM64Lib.Text.Exporters
{
}
}
}
}

View File

@@ -1,6 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von

View File

@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
namespace SM64Lib.Text.Exporters
namespace SM64Lib.Text.Exporters;
public class TxtExporter
{
public class TxtExporter
{
public async Task Export(string destFilePath, TextGroup[] groups)
{
var sw = new StreamWriter(destFilePath);
@@ -44,5 +40,4 @@ namespace SM64Lib.Text.Exporters
await sw.FlushAsync();
sw.Close();
}
}
}

View File

@@ -1,5 +1,4 @@
using global::System;
using global::System.Reflection;
using global::System.Runtime.InteropServices;
[assembly: ComVisible(false)]

View File

@@ -1,10 +1,9 @@
using System;
using Microsoft.VisualBasic.CompilerServices;
namespace SM64Lib.TextValueConverter
namespace SM64Lib.TextValueConverter;
public static class TextValueConverter
{
public static class TextValueConverter
{
public static event WantIntegerValueModeEventHandler WantIntegerValueMode;
public delegate void WantIntegerValueModeEventHandler(WantIntegerValueModeEventArgs e);
@@ -80,10 +79,9 @@ namespace SM64Lib.TextValueConverter
WantIntegerValueMode?.Invoke(e);
return e.IntegerValueMode;
}
}
public class WantIntegerValueModeEventArgs : EventArgs
{
public int IntegerValueMode { get; set; }
}
}
public class WantIntegerValueModeEventArgs : EventArgs
{
public int IntegerValueMode { get; set; }
}

View File

@@ -1,15 +1,10 @@
using Newtonsoft.Json;
using SM64Lib.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.ASM
namespace SM64Lib.ASM;
public class CustomAsmArea
{
public class CustomAsmArea
{
public byte[] AreaBytes { get; set; }
[JsonProperty(nameof(Config))]
@@ -79,5 +74,4 @@ namespace SM64Lib.ASM
Config.RamAddress = address - bankConfig.GetRomStartAddress() + bankConfig.GetRamStartAddress();
return Config.Length;
}
}
}

View File

@@ -1,16 +1,11 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Pilz.Cryptography;
using Pilz.Json.Converters;
namespace SM64Lib.ASM
namespace SM64Lib.ASM;
public class CustomAsmAreaConfig
{
public class CustomAsmAreaConfig
{
internal delegate void RequestCustomAsmAreaEventHandler(CustomAsmAreaConfig config, RequestCustomAsmAreaEventArgs request);
internal static event RequestCustomAsmAreaEventHandler RequestCustomAsmArea;
@@ -35,5 +30,4 @@ namespace SM64Lib.ASM
{
public CustomAsmArea CustomAsmArea { get; set; }
}
}
}

View File

@@ -1,14 +1,11 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.ASM
namespace SM64Lib.ASM;
public class CustomAsmBank
{
public class CustomAsmBank
{
public CustomAsmBankConfig Config { get; }
[JsonIgnore]
public List<CustomAsmArea> Areas { get; } = new List<CustomAsmArea>();
@@ -81,5 +78,4 @@ namespace SM64Lib.ASM
Config.Areas.Clear();
Config.Areas.AddRange(Areas.Select(n => n.Config));
}
}
}

View File

@@ -1,14 +1,10 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.ASM
namespace SM64Lib.ASM;
public class CustomAsmBankConfig
{
public class CustomAsmBankConfig
{
public static int DefaultMaxLength { get; set; } = 0xA000;
public static int DefaultRomStartAddress { get; internal set; } = 0x1206000;
public static int DefaultRamStartAddress { get; internal set; } = 0x406000;
@@ -46,5 +42,4 @@ namespace SM64Lib.ASM
bool isDefault = RamStartAddress == -1;
return (isDefault ? DefaultMaxLength : MaxLength, isDefault);
}
}
}

View File

@@ -1,14 +1,10 @@
using SM64Lib.Patching;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib
namespace SM64Lib;
public class BaseTweakScriptInfo
{
public class BaseTweakScriptInfo
{
public PatchScript Script { get; private set; }
public int Priority { get; private set; }
public bool IsReadOnly { get; private set; }
@@ -26,5 +22,4 @@ namespace SM64Lib
Name = infos[3];
Script = script;
}
}
}

View File

@@ -5,15 +5,13 @@ using SM64Lib.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Z.Collections.Extensions;
using static SM64Lib.Extensions.ObjectExtensions;
namespace SM64Lib.Behaviors
namespace SM64Lib.Behaviors;
public class Behavior
{
public class Behavior
{
private readonly Dictionary<CustomAsmAreaConfig, BehaviorscriptCommand> knownCustomAsmCommands = new Dictionary<CustomAsmAreaConfig, BehaviorscriptCommand>();
[JsonProperty]
@@ -237,5 +235,4 @@ namespace SM64Lib.Behaviors
Config.ParamsInfo.CloneTo(dest.Config.ParamsInfo);
}
}
}

View File

@@ -1,18 +1,15 @@
using Newtonsoft.Json;
using SM64Lib.Data;
using SM64Lib.SegmentedBanking;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Z.Collections.Extensions;
namespace SM64Lib.Behaviors
namespace SM64Lib.Behaviors;
public class BehaviorBank
{
public class BehaviorBank
{
public BehaviorBankConfig Config { get; private set; }
public List<Behavior> Behaviors { get; } = new List<Behavior>();
@@ -216,5 +213,4 @@ namespace SM64Lib.Behaviors
// Update addresses
UpdateBehaviorAddresses(rommgr, addressUpdates);
}
}
}

View File

@@ -1,14 +1,10 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Behaviors
namespace SM64Lib.Behaviors;
public class BehaviorBankConfig
{
public class BehaviorBankConfig
{
public bool IsVanilla { get; set; } = true;
public List<BehaviorConfig> BehaviorConfigs { get; } = new List<BehaviorConfig>();
@@ -32,5 +28,4 @@ namespace SM64Lib.Behaviors
return enabled;
}
}
}
}

View File

@@ -1,16 +1,12 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Pilz.Cryptography;
using Pilz.Json.Converters;
using System.Collections.Generic;
namespace SM64Lib.Behaviors
namespace SM64Lib.Behaviors;
public class BehaviorConfig
{
public class BehaviorConfig
{
internal delegate void RequestModelEventHandler(BehaviorConfig config, RequestBehaviorEventArgs request);
internal static event RequestModelEventHandler RequestBehavior;
@@ -35,5 +31,4 @@ namespace SM64Lib.Behaviors
{
public Behavior Behavior { get; set; }
}
}
}

View File

@@ -1,13 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Behaviors;
namespace SM64Lib.Behaviors
public enum BehaviorCreationTypes
{
public enum BehaviorCreationTypes
{
SolidObject
}
}

View File

@@ -1,15 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace SM64Lib.Behaviors
namespace SM64Lib.Behaviors;
public class BehaviorParamInfo
{
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>();
}
}

View File

@@ -1,14 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Behaviors;
namespace SM64Lib.Behaviors
public class BehaviorParamValue
{
public class BehaviorParamValue
{
public string Name { get; set; } = "";
public byte Value { get; set; } = 0;
}
}

View File

@@ -1,16 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Behaviors;
namespace SM64Lib.Behaviors
public class BehaviorParamsInfo
{
public class BehaviorParamsInfo
{
public BehaviorParamInfo Param1 { get; } = new();
public BehaviorParamInfo Param2 { get; } = new();
public BehaviorParamInfo Param3 { get; } = new();
public BehaviorParamInfo Param4 { get; } = new();
}
}

View File

@@ -1,15 +1,10 @@
using Newtonsoft.Json;
using SM64Lib.ASM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Behaviors
namespace SM64Lib.Behaviors;
public class CustomAsmAreaLinkOptions
{
public class CustomAsmAreaLinkOptions
{
// Temporary fix - Remove custom property code and make it auto property in v1.?
private CustomAsmAreaConfig customAsmAreaConfig;
public CustomAsmAreaConfig CustomAsmAreaConfig
@@ -21,5 +16,4 @@ namespace SM64Lib.Behaviors
[JsonProperty]
public CustomAsmArea CustomAsm { get; private set; }
public bool Loop { get; set; }
}
}

View File

@@ -1,13 +1,12 @@
using SM64Lib.Data;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace SM64Lib.Behaviors.Script
namespace SM64Lib.Behaviors.Script;
public class Behaviorscript : BehaviorscriptCommandCollection
{
public class Behaviorscript : BehaviorscriptCommandCollection
{
public bool Read(BinaryData data, int address, bool detectJumpsAsEnd = false, bool ignoreEndCmds = false, int expectedLength = -1)
{
bool ende = false;
@@ -102,5 +101,4 @@ namespace SM64Lib.Behaviors.Script
return (BehaviorscriptCommand)this.FirstOrDefault(n => n.CommandType == cmdType);
}
}
}

View File

@@ -2,11 +2,11 @@
using Newtonsoft.Json;
using SM64Lib.Json;
namespace SM64Lib.Behaviors.Script
namespace SM64Lib.Behaviors.Script;
[JsonConverter(typeof(BehaviorscriptCommandJsonConverter))]
public class BehaviorscriptCommand : SM64Lib.Script.BaseCommand<BehaviorscriptCommandTypes>
{
[JsonConverter(typeof(BehaviorscriptCommandJsonConverter))]
public class BehaviorscriptCommand : SM64Lib.Script.BaseCommand<BehaviorscriptCommandTypes>
{
public override BehaviorscriptCommandTypes CommandType
{
@@ -116,5 +116,4 @@ namespace SM64Lib.Behaviors.Script
}
}
}
}

View File

@@ -1,7 +1,6 @@
namespace SM64Lib.Behaviors.Script
namespace SM64Lib.Behaviors.Script;
public class BehaviorscriptCommandCollection : SM64Lib.Script.BaseCommandCollection<BehaviorscriptCommand, BehaviorscriptCommandTypes>
{
public class BehaviorscriptCommandCollection : SM64Lib.Script.BaseCommandCollection<BehaviorscriptCommand, BehaviorscriptCommandTypes>
{
}
}

View File

@@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Behaviors.Script;
namespace SM64Lib.Behaviors.Script
public static class BehaviorscriptCommandFactory
{
public static class BehaviorscriptCommandFactory
{
public static BehaviorscriptCommand Build_x2A(int collisionPointer = -1)
{
var cmd = new BehaviorscriptCommand("2a 00 00 00 00 00 00 00");
@@ -28,5 +22,4 @@ namespace SM64Lib.Behaviors.Script
BehaviorscriptCommandFunctions.X2A.SetCollisionPointer(cmd, asmPointer);
return cmd;
}
}
}

View File

@@ -1,14 +1,7 @@
using SM64Lib.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Behaviors.Script;
namespace SM64Lib.Behaviors.Script
public class BehaviorscriptCommandFunctions
{
public class BehaviorscriptCommandFunctions
{
public class X2A
{
public static int GetCollisionPointer(BehaviorscriptCommand cmd)
@@ -35,5 +28,4 @@ namespace SM64Lib.Behaviors.Script
cmd.Write(pointer);
}
}
}
}

View File

@@ -1,7 +1,7 @@
namespace SM64Lib.Behaviors.Script
namespace SM64Lib.Behaviors.Script;
public enum BehaviorscriptCommandTypes
{
public enum BehaviorscriptCommandTypes
{
x00_Start,
x01_StateLoop,
x02_JumpandLink,
@@ -58,5 +58,4 @@
x35_ClearGraphFlag,
x36_SetValue,
x37_SpawnSomething
}
}

View File

@@ -1,14 +1,11 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Configuration
namespace SM64Lib.Configuration;
public class CollisionBasicConfig
{
public class CollisionBasicConfig
{
private List<byte> collisionTypesWithParams = new List<byte>()
{ 4, 14, 44, 36, 37, 39, 45 };
@@ -18,5 +15,4 @@ namespace SM64Lib.Configuration
get => collisionTypesWithParams;
private set => collisionTypesWithParams = value.Distinct().ToList();
}
}
}

View File

@@ -1,13 +1,13 @@
using Newtonsoft.Json;
using SM64Lib.Objects.ModelBanks;
using System.Collections.Generic;
using Pilz.Cryptography;
using Pilz.Json.Converters;
using SM64Lib.Objects.ModelBanks;
using System.Collections.Generic;
namespace SM64Lib.Configuration
namespace SM64Lib.Configuration;
public class CustomModelConfig
{
public class CustomModelConfig
{
internal delegate void RequestModelEventHandler(CustomModelConfig config, RequestModelEventArgs request);
internal static event RequestModelEventHandler RequestModel;
@@ -27,5 +27,4 @@ namespace SM64Lib.Configuration
{
public CustomModel Model { get; set; }
}
}
}

View File

@@ -1,10 +1,9 @@
using System.Collections.Generic;
namespace SM64Lib.Configuration
namespace SM64Lib.Configuration;
public class LevelAreaConfig
{
public class LevelAreaConfig
{
public string AreaName { get; set; }
public Dictionary<short, string> ScrollingNames { get; set; } = new Dictionary<short, string>();
}
}

View File

@@ -1,9 +1,9 @@
using System.Collections.Generic;
namespace SM64Lib.Configuration
namespace SM64Lib.Configuration;
public class LevelConfig
{
public class LevelConfig
{
public string LevelName { get; set; }
public bool EnableLocalObjectBank { get; set; } = false;
public ObjectModelConfig LocalObjectBank { get; set; } = new ObjectModelConfig();
@@ -22,5 +22,4 @@ namespace SM64Lib.Configuration
return conf;
}
}
}
}

View File

@@ -1,9 +1,8 @@
using System.Collections.Generic;
namespace SM64Lib.Configuration
namespace SM64Lib.Configuration;
public class MusicConfiguration
{
public class MusicConfiguration
{
public List<string> SqeuenceNames { get; private set; } = new List<string>();
}
}

View File

@@ -1,13 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Configuration;
namespace SM64Lib.Configuration
public class NPCConfig
{
public class NPCConfig
{
public bool Enabled3DCoins { get; set; } = false;
}
}

View File

@@ -1,9 +1,9 @@
using System.Collections.Generic;
namespace SM64Lib.Configuration
namespace SM64Lib.Configuration;
public class ObjectModelConfig
{
public class ObjectModelConfig
{
public Dictionary<int, CustomModelConfig> CustomObjectConfigs { get; private set; } = new Dictionary<int, CustomModelConfig>();
public CustomModelConfig GetCustomObjectConfig(int id)
@@ -16,5 +16,4 @@ namespace SM64Lib.Configuration
return conf;
}
}
}

View File

@@ -1,15 +1,9 @@
using Pilz.IO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Configuration
namespace SM64Lib.Configuration;
public class PatchingConfig
{
public class PatchingConfig
{
public EmbeddedFilesContainer TweakBackups { get; } = new EmbeddedFilesContainer();
public bool Patched2DCamera { get; set; } = false;
}
}

View File

@@ -1,18 +1,17 @@
using System.Collections.Generic;
using global::Newtonsoft.Json.Linq;
using global::System.IO;
using Microsoft.VisualBasic.CompilerServices;
using global::Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using SM64Lib.ASM;
using SM64Lib.Behaviors;
using SM64Lib.Objects.ObjectBanks;
using SM64Lib.ASM;
using SM64Lib.Objects.ObjectBanks.Data;
using System;
using System.Collections.Generic;
namespace SM64Lib.Configuration
namespace SM64Lib.Configuration;
public class RomConfig
{
public class RomConfig
{
// Levels
public Dictionary<byte, LevelConfig> LevelConfigs { get; } = new Dictionary<byte, LevelConfig>();
@@ -74,5 +73,4 @@ namespace SM64Lib.Configuration
serializer.PreserveReferencesHandling = PreserveReferencesHandling.All;
File.WriteAllText(filePath, JObject.FromObject(this, serializer).ToString());
}
}
}

View File

@@ -1,14 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Configuration;
namespace SM64Lib.Configuration
public class ScrollTexConfig
{
public class ScrollTexConfig
{
public bool UseCustomBehavior { get; set; } = false;
public int CustomBehaviorAddress { get; set; } = -1;
}
}

View File

@@ -1,9 +1,9 @@
using global::System.IO;
namespace SM64Lib.Data
namespace SM64Lib.Data;
public class BinaryArrayData : BinaryStreamData
{
public class BinaryArrayData : BinaryStreamData
{
public FileAccess RomAccess { get; private set; } = FileAccess.Read;
public BinaryArrayData(byte[] buffer) : base(new MemoryStream(buffer))
@@ -24,5 +24,4 @@ namespace SM64Lib.Data
// Return myBaseStream
// End Function
}
}

View File

@@ -2,10 +2,10 @@
using SM64Lib.Data.System;
using System;
namespace SM64Lib.Data
namespace SM64Lib.Data;
public abstract class BinaryData : IDisposable
{
public abstract class BinaryData : IDisposable
{
public delegate void AnyBinaryDataEventHandler(BinaryData data);
public static event AnyBinaryDataEventHandler AnyBinaryDataOpened;
@@ -276,5 +276,4 @@ namespace SM64Lib.Data
{
Close();
}
}
}

View File

@@ -1,11 +1,10 @@
using global::System.IO;
namespace SM64Lib.Data
namespace SM64Lib.Data;
public class BinaryFile : BinaryStreamData
{
public class BinaryFile : BinaryStreamData
{
public BinaryFile(string filePath, FileMode fileMode, FileAccess fileAccess) : base(new FileStream(filePath, fileMode, fileAccess))
{
}
}
}

View File

@@ -1,9 +1,9 @@
using global::System.IO;
namespace SM64Lib.Data
namespace SM64Lib.Data;
public class BinaryRom : BinaryFile
{
public class BinaryRom : BinaryFile
{
public BinaryRom(RomManager rommgr, FileAccess romAccess) : base(rommgr.RomFile, FileMode.Open, romAccess)
{
SetRomManager(rommgr);
@@ -22,5 +22,4 @@ namespace SM64Lib.Data
// Return RomManager.GetStream(RomAccess)
// End Function
}
}

View File

@@ -1,10 +1,10 @@
using global::System.IO;
using global::SM64Lib.SegmentedBanking;
using global::SM64Lib.SegmentedBanking;
using global::System.IO;
namespace SM64Lib.Data
namespace SM64Lib.Data;
public class BinarySegBank : BinaryData
{
public class BinarySegBank : BinaryData
{
public SegmentedBank SegBank { get; private set; }
public BinarySegBank(SegmentedBank segBank, RomManager rommgr)
@@ -29,5 +29,4 @@ namespace SM64Lib.Data
return SegBank.Data;
}
}
}

View File

@@ -1,9 +1,9 @@
using global::System.IO;
namespace SM64Lib.Data
namespace SM64Lib.Data;
public class BinaryStreamData : BinaryData
{
public class BinaryStreamData : BinaryData
{
protected readonly Stream myBaseStream;
public BinaryStreamData(Stream stream)
@@ -16,5 +16,4 @@ namespace SM64Lib.Data
{
return myBaseStream;
}
}
}

View File

@@ -1,12 +1,11 @@
using System;
using System.Collections;
using System.Linq;
using Microsoft.VisualBasic.CompilerServices;
namespace SM64Lib.Data.System
namespace SM64Lib.Data.System;
public class Bits
{
public class Bits
{
public static byte[] ByteToBitArray(byte b)
{
var bitarray = new BitArray(new[] { b });
@@ -94,5 +93,4 @@ namespace SM64Lib.Data.System
{
return ByteToBoolArray(b)[index];
}
}
}

View File

@@ -1,9 +1,9 @@
using System;
namespace SM64Lib.Data.System
namespace SM64Lib.Data.System;
internal static class SwapInts
{
internal static class SwapInts
{
public static short SwapInt16(short value)
{
var bytes = BitConverter.GetBytes(value);
@@ -58,5 +58,4 @@ namespace SM64Lib.Data.System
Array.Reverse(bytes);
return BitConverter.ToSingle(bytes, 0);
}
}
}

View File

@@ -1,9 +1,9 @@
using global::System.Runtime.InteropServices;
namespace SM64Lib
namespace SM64Lib;
static class Datatypecastes
{
static class Datatypecastes
{
public static short LongToInt16(long value)
{
var cast = default(CasterLongInt16);
@@ -35,5 +35,4 @@ namespace SM64Lib
[FieldOffset(0)]
public byte ByteValue;
}
}
}

View File

@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.EventArguments
namespace SM64Lib.EventArguments;
public class GetTextProfileInfoEventArgs : EventArgs
{
public class GetTextProfileInfoEventArgs : EventArgs
{
public Text.Profiles.TextProfileInfo ProfileInfo { get; set; }
}
}

View File

@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.EventArguments
namespace SM64Lib.EventArguments;
public class PrepairingRomEventArgs : EventArgs
{
public class PrepairingRomEventArgs : EventArgs
{
public IEnumerable<BaseTweakScriptInfo> ScriptInfos { get; set; }
}
}

View File

@@ -1,14 +1,13 @@
using System;
namespace SM64Lib.EventArguments
namespace SM64Lib.EventArguments;
public class RomVersionEventArgs : EventArgs
{
public class RomVersionEventArgs : EventArgs
{
public RomVersion RomVersion { get; set; }
internal RomVersionEventArgs(RomVersion romVersion)
{
RomVersion = romVersion;
}
}
}

View File

@@ -1,8 +1,7 @@
using System;
namespace SM64Lib.Exceptions
namespace SM64Lib.Exceptions;
public class InvalidMD5HashException : Exception
{
public class InvalidMD5HashException : Exception
{
}
}

View File

@@ -1,11 +1,10 @@
using System;
namespace SM64Lib.Exceptions
namespace SM64Lib.Exceptions;
public class RomCompatiblityException : Exception
{
public class RomCompatiblityException : Exception
{
public RomCompatiblityException(string msg) : base(msg)
{
}
}
}

View File

@@ -2,32 +2,31 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace SM64Lib.Extensions
namespace SM64Lib.Extensions;
public static class Int16Extensions
{
public static class Int16Extensions
{
public static bool IsInRange(this short value, short min, short max)
{
return value >= min && value <= max;
}
}
}
public static class ObjectExtensions
{
public static class ObjectExtensions
{
public static void CloneTo<T>(this T source, T destination) where T : class
{
var json = JsonSerializer.CreateDefault();
var jobj = JObject.FromObject(source);
jobj.Populate(destination);
}
}
}
public static class JsonExtensions
{
public static class JsonExtensions
{
public static void Populate(this JToken value, object target)
{
using (var sr = value.CreateReader())
JsonSerializer.CreateDefault().Populate(sr, target);
}
}
}

View File

@@ -1,9 +1,9 @@
using System.Collections.Generic;
namespace SM64Lib
namespace SM64Lib;
public class FilePathsConfiguration
{
public class FilePathsConfiguration
{
// S T A T I C M E M B E R S
@@ -13,7 +13,7 @@ namespace SM64Lib
{
get
{
return new[] { "rn64crc.exe","ApplyPPF3.exe", "Level Tabel.json", "Update-Patches.json", "Update Patches Folder", "Text Profiles.json", "BaseTweak", "sm64extend.exe", "Original Level Pointers.bin", "armips.exe", "Flips.exe", "nconvert.exe" };
return new[] { "rn64crc.exe", "ApplyPPF3.exe", "Level Tabel.json", "Update-Patches.json", "Update Patches Folder", "Text Profiles.json", "BaseTweak", "sm64extend.exe", "Original Level Pointers.bin", "armips.exe", "Flips.exe", "nconvert.exe" };
}
}
@@ -45,5 +45,4 @@ namespace SM64Lib
{
dic[key] = path;
}
}
}

View File

@@ -8,10 +8,10 @@ using System.IO.Compression;
using System.Linq;
using System.Security.Cryptography;
namespace SM64Lib
namespace SM64Lib;
public static class General
{
public static class General
{
public static byte[] DisplayListCommandsWithPointerList { get; private set; } = new byte[] { 0x1, 0x3, 0x4, 0x6, 0xFD };
public static bool[] ActSelectorDefaultValues { get; private set; } = new bool[] { false, false, false, true, true, false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, true, true, true, false, false, false, false, false, false, false, false, false, false, false };
public static PatchClass PatchClass { get; private set; } = new PatchClass();
@@ -599,5 +599,4 @@ namespace SM64Lib
decompressor.CopyTo(output);
}
}
}
}

View File

@@ -1,8 +1,8 @@
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public enum BackgroundIDs : byte
{
public enum BackgroundIDs : byte
{
HauntedForest = 0x6,
SnowyMountains = 0x4,
Desert = 0x5,
@@ -14,5 +14,4 @@ namespace SM64Lib.Geolayout
FlamingSky = 0x1,
PurpleClouds = 0x9,
Custom = 0xA
}
}

View File

@@ -1,8 +1,8 @@
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public enum BackgroundPointers
{
public enum BackgroundPointers
{
HauntedForestStart = 0xC3B030, // &HC3AFD5
HauntedForestEnd = 0xC4F970, // &HC4F915
SnowyMountainsStart = 0xB5D8B0, // &HB5D855
@@ -23,5 +23,4 @@ namespace SM64Lib.Geolayout
FlamingSkyEnd = 0xBBAC70, // &HBBAC15
PurpleCloudsStart = 0xC7FAB0, // &HC7FA55
PurpleCloudsEnd = 0xC9FBF0 // &HC9FB95
}
}

View File

@@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Geolayout;
namespace SM64Lib.Geolayout
public class CameraFrustrum
{
public class CameraFrustrum
{
/// <summary>
/// This is essentially render distance of geometry.
/// </summary>
@@ -16,5 +10,4 @@ namespace SM64Lib.Geolayout
/// Defines how close to the camera geometry will render.
/// </summary>
public short CameraNear { get; set; } = 0x64;
}
}

View File

@@ -1,8 +1,8 @@
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public enum CameraPresets
{
public enum CameraPresets
{
OpenCamera = 0x1,
TickTockClock,
SecretAquarium,
@@ -19,5 +19,4 @@ namespace SM64Lib.Geolayout
PlattfromLevels,
Unmoving2,
FreeRoamCamera
}
}

View File

@@ -1,8 +1,8 @@
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public enum DefaultGeolayers
{
public enum DefaultGeolayers
{
SolidNoAntiAlias,
Solid,
SolidDecal,
@@ -11,5 +11,4 @@ namespace SM64Lib.Geolayout
Translucent,
TranslucentDecal2,
TranslucentDecal3
}
}

View File

@@ -1,8 +1,8 @@
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public enum EnvironmentEffects
{
public enum EnvironmentEffects
{
NoEffect = 0x0,
Snow = 0x1,
Bllizard = 0x3,
@@ -10,5 +10,4 @@ namespace SM64Lib.Geolayout
Lava = 0xC,
WaterRelated1 = 0xD,
WaterRelated2 = 0x2
}
}

View File

@@ -1,10 +1,9 @@
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public enum GeoAsmPointer : uint
{
public enum GeoAsmPointer : uint
{
EnvironmentEffect = 0x802761D0,
Water = 0x802D104C,
Unknown = 0x802CD1E8
}
}

View File

@@ -1,16 +1,15 @@
using System.Collections.Generic;
using global::SM64Lib.Geolayout.Script;
using global::SM64Lib.Geolayout.Script.Commands;
using global::System.IO;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using global::SM64Lib.Geolayout.Script;
using global::SM64Lib.Geolayout.Script.Commands;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public class Geolayout
{
public class Geolayout
{
[JsonProperty]
private int IndexForGeopointers = -1;
@@ -376,5 +375,4 @@ namespace SM64Lib.Geolayout
Level,
Object
}
}
}

View File

@@ -1,10 +1,10 @@
using Newtonsoft.Json;
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public class Geopointer
{
public class Geopointer
{
public byte Layer { get; set; } = default;
public int SegPointer { get; set; } = 0;
public int Index { get; set; } = -1;
@@ -38,5 +38,4 @@ namespace SM64Lib.Geolayout
ModelOffset = mdloffset;
Index = index;
}
}
}

View File

@@ -1,16 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Geolayout;
namespace SM64Lib.Geolayout
public class ObjectShadow
{
public class ObjectShadow
{
public bool Enabled { get; set; } = false;
public ObjectShadowType Type { get; set; } = ObjectShadowType.Circle_9Verts;
public short Scale { get; set; }
public byte Solidity { get; set; } = 0xFF;
}
}

View File

@@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Geolayout;
namespace SM64Lib.Geolayout
public enum ObjectShadowType
{
public enum ObjectShadowType
{
Circle_9Verts = 0,
Circle_4Verts = 1,
Circle_4Verts_Flat_Unused = 2,
@@ -20,5 +14,4 @@ namespace SM64Lib.Geolayout
*/
RectangleHardcodedOffset = 50,
CirclePlayer = 99
}
}

View File

@@ -2,11 +2,11 @@
using Newtonsoft.Json;
using SM64Lib.Json;
namespace SM64Lib.Geolayout.Script
namespace SM64Lib.Geolayout.Script;
[JsonConverter(typeof(GeolayoutscriptCommandJsonConverter))]
public class GeolayoutCommand : BaseCommand<GeolayoutCommandTypes>
{
[JsonConverter(typeof(GeolayoutscriptCommandJsonConverter))]
public class GeolayoutCommand : BaseCommand<GeolayoutCommandTypes>
{
public GeolayoutCommand(byte[] bytes) : base(bytes)
{
}
@@ -36,5 +36,4 @@ namespace SM64Lib.Geolayout.Script
Position = 0;
}
}
}
}

View File

@@ -1,9 +1,9 @@
using global::SM64Lib.Script;
namespace SM64Lib.Geolayout.Script
namespace SM64Lib.Geolayout.Script;
public class GeolayoutCommandCollection : BaseCommandCollection<GeolayoutCommand, GeolayoutCommandTypes>
{
public class GeolayoutCommandCollection : BaseCommandCollection<GeolayoutCommand, GeolayoutCommandTypes>
{
public int IndexOfFirst(GeolayoutCommandTypes cmdType)
{
for (int index = 0, loopTo = Count - 1; index <= loopTo; index++)
@@ -14,5 +14,4 @@ namespace SM64Lib.Geolayout.Script
return -1;
}
}
}

View File

@@ -1,5 +1,4 @@
using global::System.Numerics;
using Microsoft.VisualBasic.CompilerServices;
using System;
namespace SM64Lib.Geolayout.Script

View File

@@ -1,8 +1,8 @@
namespace SM64Lib.Geolayout.Script
namespace SM64Lib.Geolayout.Script;
public enum GeolayoutCommandTypes
{
public enum GeolayoutCommandTypes
{
BranchAndStore = 0x0,
EndOfGeolayout = 0x1,
JumpToSegAddr = 0x2,
@@ -33,5 +33,4 @@ namespace SM64Lib.Geolayout.Script
x1E = 0xE,
x1f = 0xF,
DrawingDistance = 0x20
}
}

View File

@@ -1,15 +1,14 @@
using System.Collections.Generic;
using global::SM64Lib.Data;
using global::System.IO;
using System.Threading.Tasks;
using Microsoft.VisualBasic.CompilerServices;
using global::SM64Lib.Data;
using SM64Lib.SegmentedBanking;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace SM64Lib.Geolayout.Script
namespace SM64Lib.Geolayout.Script;
public class Geolayoutscript : GeolayoutCommandCollection
{
public class Geolayoutscript : GeolayoutCommandCollection
{
public List<int> GeopointerOffsets = new List<int>();
public Geolayoutscript()
@@ -235,5 +234,4 @@ namespace SM64Lib.Geolayout.Script
return null;
}
}
}

View File

@@ -1,8 +1,8 @@
namespace SM64Lib.Geolayout
namespace SM64Lib.Geolayout;
public enum TerrainTypes
{
public enum TerrainTypes
{
NoramlA = 0x0,
NoramlB,
SnowTerrain,
@@ -10,5 +10,4 @@ namespace SM64Lib.Geolayout
BigBoosHount,
WaterLevels,
SlipperySlide
}
}

View File

@@ -1,16 +1,13 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
namespace SM64Lib.Json
namespace SM64Lib.Json;
public class ArrayReferencePreservngConverter : JsonConverter
{
public class ArrayReferencePreservngConverter : JsonConverter
{
const string refProperty = "$ref";
const string idProperty = "$id";
const string valuesProperty = "$values";
@@ -83,5 +80,4 @@ namespace SM64Lib.Json
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,17 +1,11 @@
using Newtonsoft.Json;
using SM64Lib.Behaviors.Script;
using SM64Lib.Geolayout.Script;
using SM64Lib.Model.Fast3D;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Json
namespace SM64Lib.Json;
internal class BaseCommandJsonConverter : JsonConverter
{
internal class BaseCommandJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(GeolayoutscriptCommandJsonConverter).IsAssignableFrom(objectType);
@@ -57,5 +51,4 @@ namespace SM64Lib.Json
public byte[] Buffer { get; set; }
public int BankAddress { get; set; }
}
}
}

View File

@@ -1,16 +1,11 @@
using Newtonsoft.Json;
using SM64Lib.Behaviors.Script;
using SM64Lib.Model.Fast3D;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Json
namespace SM64Lib.Json;
internal class BehaviorscriptCommandJsonConverter : JsonConverter
{
internal class BehaviorscriptCommandJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(BehaviorscriptCommand).IsAssignableFrom(objectType);
@@ -56,5 +51,4 @@ namespace SM64Lib.Json
public byte[] Buffer { get; set; }
public int BankAddress { get; set; }
}
}
}

View File

@@ -1,17 +1,13 @@
using Newtonsoft.Json;
using SM64Lib.Model.Fast3D;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Z.Collections.Extensions;
namespace SM64Lib.Json
namespace SM64Lib.Json;
internal class ComplexDictionarJsonConverter<TKey, TValue> : JsonConverter
{
internal class ComplexDictionarJsonConverter<TKey, TValue> : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(List<KeyValuePair<TKey, TValue>>).IsAssignableFrom(objectType);
@@ -31,5 +27,4 @@ namespace SM64Lib.Json
if (value is Dictionary<TKey, TValue>)
serializer.Serialize(writer, ((Dictionary<TKey, TValue>)value).ToArray());
}
}
}

View File

@@ -2,16 +2,13 @@
using SM64Lib.Model.Fast3D;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Json
namespace SM64Lib.Json;
internal class Fast3DBufferJsonConverter : JsonConverter
{
internal class Fast3DBufferJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(Fast3DBuffer).IsAssignableFrom(objectType);
@@ -67,5 +64,4 @@ namespace SM64Lib.Json
public List<Geolayout.Geopointer> DLPointers { get; set; }
public bool IsDeflateStream { get; set; } = false;
}
}
}

View File

@@ -1,17 +1,11 @@
using Newtonsoft.Json;
using SM64Lib.Behaviors.Script;
using SM64Lib.Geolayout.Script;
using SM64Lib.Model.Fast3D;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Json
namespace SM64Lib.Json;
internal class GeolayoutscriptCommandJsonConverter : JsonConverter
{
internal class GeolayoutscriptCommandJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(GeolayoutCommand).IsAssignableFrom(objectType);
@@ -57,5 +51,4 @@ namespace SM64Lib.Json
public byte[] Buffer { get; set; }
public int BankAddress { get; set; }
}
}
}

View File

@@ -1,14 +1,9 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Json
namespace SM64Lib.Json;
internal class JsonHelper
{
internal class JsonHelper
{
public static JsonSerializer CreateJsonSerializer(
bool allowReferences = false,
bool rememberTypeNames = false,
@@ -32,5 +27,4 @@ namespace SM64Lib.Json
return serializer;
}
}
}

View File

@@ -1,18 +1,11 @@
using Newtonsoft.Json;
using SM64Lib.Behaviors.Script;
using SM64Lib.Geolayout.Script;
using SM64Lib.Levels.Script;
using SM64Lib.Model.Fast3D;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Json
namespace SM64Lib.Json;
internal class LevelscriptCommandJsonConverter : JsonConverter
{
internal class LevelscriptCommandJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(LevelscriptCommand).IsAssignableFrom(objectType);
@@ -58,5 +51,4 @@ namespace SM64Lib.Json
public byte[] Buffer { get; set; }
public int BankAddress { get; set; }
}
}
}

View File

@@ -1,19 +1,11 @@
using Newtonsoft.Json;
using SM64Lib.Behaviors.Script;
using SM64Lib.Geolayout.Script;
using SM64Lib.Levels.Script;
using SM64Lib.Model.Fast3D;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Json
namespace SM64Lib.Json;
internal class MemoryStreamJsonConverter : JsonConverter
{
internal class MemoryStreamJsonConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return typeof(MemoryStream).IsAssignableFrom(objectType);
@@ -33,5 +25,4 @@ namespace SM64Lib.Json
var ms = (MemoryStream)value;
serializer.Serialize(writer, ms.ToArray());
}
}
}

View File

@@ -1,16 +1,15 @@
using global::System.Drawing;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public class AreaBG
{
public class AreaBG
{
public AreaBGs Type { get; set; } = AreaBGs.Levelbackground;
public Color Color { get; set; } = Color.Black;
}
}
public enum AreaBGs
{
public enum AreaBGs
{
Levelbackground,
Color
}
}

View File

@@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Levels;
namespace SM64Lib.Levels
public enum AreaReverbLevel : byte
{
public enum AreaReverbLevel : byte
{
None,
Level01 = 0x8,
Level02 = 0xC,
@@ -19,5 +13,4 @@ namespace SM64Lib.Levels
Level08 = 0x38,
Level09 = 0x40,
Level10 = 0x70
}
}

View File

@@ -1,8 +1,8 @@
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public enum ObjectBank0x0C
{
public enum ObjectBank0x0C
{
Disabled,
HauntedObjects,
SnowObjects,
@@ -15,10 +15,10 @@ namespace SM64Lib.Levels
PeachYoshi,
Switches,
LavaObjects
}
}
public enum ObjectBank0x0D
{
public enum ObjectBank0x0D
{
Disabled,
AssortedEnemies4,
Moneybags,
@@ -26,10 +26,10 @@ namespace SM64Lib.Levels
GroundEnemies,
WaterObjects2,
Bowser
}
}
public enum ObjectBank0x0E
{
public enum ObjectBank0x0E
{
Disabled,
HaundetHouse,
CoolCoolMountain,
@@ -56,17 +56,17 @@ namespace SM64Lib.Levels
Bowser2Battle,
Bowser3Battle,
TallTallMountain
}
}
public enum ObjectBanks
{
public enum ObjectBanks
{
Bank0x0C,
Bank0x0D,
Bank0x0E
}
}
public enum Levels : byte
{
public enum Levels : byte
{
HaundetHouse = 0x4,
CoolCoolMountain,
InsideCastle,
@@ -98,26 +98,25 @@ namespace SM64Lib.Levels
Bowser2Battle = 0x21,
Bowser3Battle,
TallTallMountain = 0x24
}
}
public enum ScrollingTextureAxis
{
public enum ScrollingTextureAxis
{
X,
Y
}
}
public enum SpecialBoxType
{
public enum SpecialBoxType
{
Water,
ToxicHaze,
Mist
}
}
public enum WaterType
{
public enum WaterType
{
Default = 0x0,
JRBWater = 0x20000,
GreenWater = 0x30000,
LavaWater = 0x40000
}
}

View File

@@ -1,10 +1,9 @@
using global::SM64Lib.Data;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public interface ILevelManager
{
public interface ILevelManager
{
void LoadLevel(Level lvl, RomManager rommgr, ushort LevelID, uint segAddress);
LevelSaveResult SaveLevel(Level lvl, RomManager rommgr, BinaryData output, ref uint curOff);
}
}

View File

@@ -1,21 +1,19 @@
using System.Collections.Generic;
using System.Data;
using global::System.IO;
using System.Linq;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using global::SM64Lib.Levels.Script;
using global::SM64Lib.Levels.Script;
using global::SM64Lib.Levels.Script.Commands;
using global::SM64Lib.Objects.ObjectBanks.Data;
using global::SM64Lib.SegmentedBanking;
using SM64Lib.Objects.ModelBanks;
using Microsoft.VisualBasic;
using Newtonsoft.Json;
using SM64Lib.Objects.ModelBanks;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public abstract class Level
{
public abstract class Level
{
// S h a r e d M e m b e r s
@@ -325,5 +323,4 @@ namespace SM64Lib.Levels
return output;
}
}
}

View File

@@ -1,17 +1,15 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualBasic.CompilerServices;
using global::SM64Lib.Levels.Script;
using global::SM64Lib.Levels.Script;
using global::SM64Lib.Levels.Script.Commands;
using global::SM64Lib.Levels.ScrolTex;
using global::SM64Lib.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public abstract class LevelArea
{
public abstract class LevelArea
{
// S h a r e d M e m b e r s
@@ -174,5 +172,4 @@ namespace SM64Lib.Levels
protected LevelArea(JsonConstructorAttribute attr)
{
}
}
}

View File

@@ -1,15 +1,14 @@
using global::System.Drawing;
using global::SM64Lib.Model.Fast3D;
using global::System.Drawing;
using global::System.IO;
using Microsoft.VisualBasic.CompilerServices;
using SM64Lib.Data.System;
using global::SM64Lib.Model.Fast3D;
using Newtonsoft.Json;
using SM64Lib.Data.System;
using System;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public class LevelBG
{
public class LevelBG
{
private Bitmap _Image = null;
// A u t o P r o p e r t i e s
@@ -232,5 +231,4 @@ namespace SM64Lib.Levels
}
}
}
}
}

View File

@@ -1,17 +1,13 @@
using Newtonsoft.Json;
using SM64Lib.Levels.Script;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public class LevelExport
{
public class LevelExport
{
// P r o p e r t i e s
[JsonProperty]
@@ -75,5 +71,4 @@ namespace SM64Lib.Levels
return export;
}
}
}

View File

@@ -1,17 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Levels;
namespace SM64Lib.Levels
public enum LevelExportContentType
{
public enum LevelExportContentType
{
Unknown,
Level,
Area,
Objects,
Warps
}
}

View File

@@ -1,14 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Levels;
namespace SM64Lib.Levels
public enum LevelExportFileFormat
{
public enum LevelExportFileFormat
{
JSON,
PlainText
}
}

View File

@@ -2,13 +2,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public static class LevelExportImporter
{
public static class LevelExportImporter
{
public static void ImportLevel(LevelExport export, RomManager destRomManager, KeyValuePair<Level, short>[] levelIDs)
{
var levels = export.Content as Level[];
@@ -71,5 +69,4 @@ namespace SM64Lib.Levels
else
throw new NotSupportedException();
}
}
}

View File

@@ -1,13 +1,13 @@
using System.Collections.Generic;
using global::Newtonsoft.Json.Linq;
using global::System.IO;
using System.Collections.Generic;
using System.Linq;
using global::Newtonsoft.Json.Linq;
using static SM64Lib.TextValueConverter.TextValueConverter;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public class LevelInfoDataTabelList : List<LevelInfoDataTabelList.Level>
{
public class LevelInfoDataTabelList : List<LevelInfoDataTabelList.Level>
{
public void ReadFromFile(string FileName)
{
var jobj = JObject.Parse(File.ReadAllText(FileName));
@@ -139,5 +139,4 @@ namespace SM64Lib.Levels
Bowsercourse,
Bowserbattle
}
}
}

View File

@@ -2,10 +2,10 @@
using System.Data;
using System.Linq;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public class LevelList : List<Level>
{
public class LevelList : List<Level>
{
public bool NeedToSave
{
get
@@ -18,5 +18,4 @@ namespace SM64Lib.Levels
{
get => this.Sum(n => n.Length);
}
}
}

View File

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Data;
using global::System.IO;
using System.Linq;
using Microsoft.VisualBasic.CompilerServices;
using global::SM64Lib.Data;
using global::SM64Lib.Data;
using global::SM64Lib.Data.System;
using global::SM64Lib.Geolayout.Script;
using global::SM64Lib.Geolayout.Script.Commands;
@@ -13,11 +7,16 @@ using global::SM64Lib.Levels.Script.Commands;
using global::SM64Lib.Levels.ScrolTex;
using global::SM64Lib.Model;
using global::SM64Lib.SegmentedBanking;
using global::System.IO;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public class LevelManager : ILevelManager
{
public class LevelManager : ILevelManager
{
public bool EnableLoadingAreaReverb { get; set; } = true;
public bool SortSpecialBoxesByHeight { get; set; } = true;
@@ -649,7 +648,7 @@ namespace SM64Lib.Levels
case LevelscriptCommandTypes.JumpToSegAddr:
{
int bankID = clJumpToSegAddr.GetSegJumpAddr((LevelscriptCommand)c) >> 24;
switch(bankID)
switch (bankID)
{
case 0x7:
cmdGobJump = (LevelscriptCommand)c;
@@ -890,5 +889,4 @@ namespace SM64Lib.Levels
return saveres;
}
}
}

View File

@@ -1,12 +1,11 @@
using System;
using global::System.IO;
using System;
using System.Collections.Generic;
using global::System.IO;
using Microsoft.VisualBasic.CompilerServices;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public class LevelNumberTable : List<byte>
{
public class LevelNumberTable : List<byte>
{
public void ReadFromROM(string Romfile, int Address = 0xE8D98)
{
var fs = new FileStream(Romfile, FileMode.Open, FileAccess.Read);
@@ -23,5 +22,4 @@ namespace SM64Lib.Levels
Add(Convert.ToByte(fs.ReadByte()));
}
}
}
}

View File

@@ -1,9 +1,8 @@
using global::SM64Lib.SegmentedBanking;
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public class LevelSaveResult
{
public class LevelSaveResult
{
public SegmentedBank Bank0x19 { get; set; } = null;
}
}

View File

@@ -1,10 +1,9 @@
namespace SM64Lib.Levels
namespace SM64Lib.Levels;
public enum LevelType
{
public enum LevelType
{
Original,
SM64RomManager,
SM64Editor
}
}

Some files were not shown because too many files have changed in this diff Show More