Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/nes-containers.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-01-09 15:57:55 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-01-09 15:57:55 +0300
commit0509099f2fc7ea4c4bc1b351e6d1b3dd6d1fee27 (patch)
treec1cdafef1eecfb68db5151acc7a8fcd6c3d39d61
parentcdaad6e922bde2a5421e37177608bd59ecff2320 (diff)
parentf3c86d25b217ddb9bf420eadaf2479be3673f259 (diff)
Merge branch 'master' of https://github.com/ClusterM/nes-containers
-rw-r--r--NesFile.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/NesFile.cs b/NesFile.cs
index 51f1760..861d87e 100644
--- a/NesFile.cs
+++ b/NesFile.cs
@@ -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");