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>2022-11-04 13:44:32 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2022-11-04 13:44:32 +0300
commitb83e538bbb7160798b0410b18509486017c920b9 (patch)
treec8d053dfbbcc9ce9a8dfcf573c41b7750ae01340
parentd898125e32d37dc830b96c8d20a082fca130ea7d (diff)
Removed dumper specific properties
-rw-r--r--FdsBlockDiskInfo.cs36
-rw-r--r--FdsBlockFileAmount.cs10
-rw-r--r--FdsBlockFileHeader.cs22
-rw-r--r--FdsDiskFile.cs2
4 files changed, 10 insertions, 60 deletions
diff --git a/FdsBlockDiskInfo.cs b/FdsBlockDiskInfo.cs
index acef5e3..9f91957 100644
--- a/FdsBlockDiskInfo.cs
+++ b/FdsBlockDiskInfo.cs
@@ -9,7 +9,7 @@ namespace com.clusterrr.Famicom.Containers
/// <summary>
/// Disk info FDS block (block type 1)
/// </summary>
- [StructLayout(LayoutKind.Sequential, Size = 58, Pack = 1)]
+ [StructLayout(LayoutKind.Sequential, Size = 56, Pack = 1)]
public class FdsBlockDiskInfo : IFdsBlock, IEquatable<FdsBlockDiskInfo>
{
/// <summary>
@@ -856,20 +856,6 @@ namespace com.clusterrr.Famicom.Containers
/// </summary>
public byte Price { get => price; set => price = value; }
- [MarshalAs(UnmanagedType.U1)]
- private bool crcOk = true;
- /// <summary>
- /// Set by dumper. True when checksum is ok
- /// </summary>
- public bool CrcOk { get => crcOk; set => crcOk = value; }
-
- [MarshalAs(UnmanagedType.U1)]
- private bool endOfHeadMeet = false;
- /// <summary>
- /// Set by dumper. True when "end of head" flag was meet during dumping
- /// </summary>
- public bool EndOfHeadMeet { get => endOfHeadMeet; set => endOfHeadMeet = value; }
-
/// <summary>
/// Length of the block
/// </summary>
@@ -886,19 +872,7 @@ namespace com.clusterrr.Famicom.Containers
{
int rawsize = Marshal.SizeOf(typeof(FdsBlockDiskInfo));
if (rawsize > data.Length - offset)
- {
- if (rawsize <= data.Length - offset + 2)
- {
- var newRawData = new byte[rawsize];
- Array.Copy(data, offset, newRawData, 0, rawsize - 2);
- data = newRawData;
- offset = 0;
- }
- else
- {
- throw new InvalidDataException("Not enough data to fill FdsDiskInfoBlock class. Array length from position: " + (data.Length - offset) + ", struct length: " + rawsize);
- }
- }
+ throw new InvalidDataException("Not enough data to fill FdsDiskInfoBlock class. Array length from position: " + (data.Length - offset) + ", struct length: " + rawsize);
IntPtr buffer = Marshal.AllocHGlobal(rawsize);
Marshal.Copy(data, offset, buffer, rawsize);
FdsBlockDiskInfo retobj = (FdsBlockDiskInfo)Marshal.PtrToStructure(buffer, typeof(FdsBlockDiskInfo));
@@ -915,10 +889,10 @@ namespace com.clusterrr.Famicom.Containers
int rawSize = Marshal.SizeOf(this);
IntPtr buffer = Marshal.AllocHGlobal(rawSize);
Marshal.StructureToPtr(this, buffer, false);
- byte[] rawDatas = new byte[rawSize - 2];
- Marshal.Copy(buffer, rawDatas, 0, rawSize - 2);
+ byte[] data = new byte[rawSize];
+ Marshal.Copy(buffer, data, 0, rawSize);
Marshal.FreeHGlobal(buffer);
- return rawDatas;
+ return data;
}
/// <summary>
diff --git a/FdsBlockFileAmount.cs b/FdsBlockFileAmount.cs
index 47a9d55..868b22e 100644
--- a/FdsBlockFileAmount.cs
+++ b/FdsBlockFileAmount.cs
@@ -26,16 +26,6 @@ namespace com.clusterrr.Famicom.Containers
public byte FileAmount { get => fileAmount; set => fileAmount = value; }
/// <summary>
- /// Set by dumper. True when checksum is ok
- /// </summary>
- public bool CrcOk { get; set; } = true;
-
- /// <summary>
- /// Set by dumper. True when "end of head" flag was meet during dumping
- /// </summary>
- public bool EndOfHeadMeet { get; set; } = false;
-
- /// <summary>
/// Length of the block
/// </summary>
public uint Length { get => 2; }
diff --git a/FdsBlockFileHeader.cs b/FdsBlockFileHeader.cs
index 6de2f1b..ee0233c 100644
--- a/FdsBlockFileHeader.cs
+++ b/FdsBlockFileHeader.cs
@@ -9,7 +9,7 @@ namespace com.clusterrr.Famicom.Containers
/// <summary>
/// File header FDS block (block type 3)
/// </summary>
- [StructLayout(LayoutKind.Sequential, Size = 18, Pack = 1)]
+ [StructLayout(LayoutKind.Sequential, Size = 16, Pack = 1)]
public class FdsBlockFileHeader : IFdsBlock, IEquatable<FdsBlockFileHeader>
{
/// <summary>
@@ -85,20 +85,6 @@ namespace com.clusterrr.Famicom.Containers
/// </summary>
public Kind FileKind { get => (Kind)fileKind; set => fileKind = (byte)value; }
- [MarshalAs(UnmanagedType.U1)]
- private bool crcOk = true;
- /// <summary>
- /// Set by dumper. True when checksum is ok
- /// </summary>
- public bool CrcOk { get => crcOk; set => crcOk = value; }
-
- [MarshalAs(UnmanagedType.U1)]
- private bool endOfHeadMeet = false;
- /// <summary>
- /// Set by dumper. True when "end of head" flag was meet during dumping
- /// </summary>
- public bool EndOfHeadMeet { get => endOfHeadMeet; set => endOfHeadMeet = value; }
-
/// <summary>
/// Length of the block
/// </summary>
@@ -144,10 +130,10 @@ namespace com.clusterrr.Famicom.Containers
int rawSize = Marshal.SizeOf(this);
IntPtr buffer = Marshal.AllocHGlobal(rawSize);
Marshal.StructureToPtr(this, buffer, false);
- byte[] rawDatas = new byte[rawSize - 2];
- Marshal.Copy(buffer, rawDatas, 0, rawSize - 2);
+ byte[] data = new byte[rawSize];
+ Marshal.Copy(buffer, data, 0, rawSize);
Marshal.FreeHGlobal(buffer);
- return rawDatas;
+ return data;
}
/// <summary>
diff --git a/FdsDiskFile.cs b/FdsDiskFile.cs
index e05591b..c3c2e53 100644
--- a/FdsDiskFile.cs
+++ b/FdsDiskFile.cs
@@ -68,7 +68,7 @@ namespace com.clusterrr.Famicom.Containers
}
/// <summary>
- /// Construcor for empty file
+ /// Construcor for empty FdsDiskFile object
/// </summary>
public FdsDiskFile()
{