diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-01-09 15:57:55 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2021-01-09 15:57:55 +0300 |
commit | 0509099f2fc7ea4c4bc1b351e6d1b3dd6d1fee27 (patch) | |
tree | c1cdafef1eecfb68db5151acc7a8fcd6c3d39d61 | |
parent | cdaad6e922bde2a5421e37177608bd59ecff2320 (diff) | |
parent | f3c86d25b217ddb9bf420eadaf2479be3673f259 (diff) |
Merge branch 'master' of https://github.com/ClusterM/nes-containers
-rw-r--r-- | NesFile.cs | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -34,7 +34,7 @@ namespace com.clusterrr.Famicom.Containers /// <summary>
/// Miscellaneous ROM (NES 2.0 only, can be null if none)
/// </summary>
- public byte[] MiscellaneousROM { get; set; } = null;
+ public IEnumerable<byte> MiscellaneousROM { get => Array.AsReadOnly(miscellaneousROM); set => miscellaneousROM = value.ToArray(); }
/// <summary>
/// Mapper number
/// </summary>
@@ -86,6 +86,7 @@ namespace com.clusterrr.Famicom.Containers private byte[] prg = new byte[0];
private byte[] chr = new byte[0];
private byte[] trainer = new byte[0];
+ private byte[] miscellaneousROM = new byte[0];
/// <summary>
/// CHR NVRAM Size (NES 2.0 only)
@@ -678,11 +679,11 @@ namespace com.clusterrr.Famicom.Containers if (MiscellaneousROMsCount > 0)
{
MiscellaneousROM = new byte[data.Length - offset];
- Array.Copy(data, offset, MiscellaneousROM, 0, MiscellaneousROM.Length);
+ Array.Copy(data, offset, miscellaneousROM, 0, miscellaneousROM.Length);
}
else
{
- MiscellaneousROM = null;
+ MiscellaneousROM = new byte[0];
}
}
@@ -858,7 +859,7 @@ namespace com.clusterrr.Famicom.Containers data.AddRange(Trainer);
data.AddRange(prg);
data.AddRange(chr);
- if (MiscellaneousROMsCount > 0 || (MiscellaneousROM != null && MiscellaneousROM.Length > 0))
+ if (MiscellaneousROMsCount > 0 || (MiscellaneousROM != null && MiscellaneousROM.Count() > 0))
{
if (MiscellaneousROMsCount == 0)
throw new InvalidDataException("MiscellaneousROMsCount is zero while MiscellaneousROM is not empty");
|