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-04-28 08:56:46 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2021-04-28 08:56:46 +0300
commit048cd5cdfa4cf81bed4a96ad1973f32d3e7a0837 (patch)
treeee3446c7170363c7a1576cd7ab2f347fe5a274b8
parent9a9710790414f3d13e3be23c946ad841ad4e8cc7 (diff)
Removed unused usings
-rw-r--r--Crc32Calculator.cs8
-rw-r--r--FdsBlockFileData.cs4
-rw-r--r--FdsBlockFileHeader.cs6
-rw-r--r--FdsDiskFile.cs5
-rw-r--r--FdsFile.cs5
-rw-r--r--IFdsBlock.cs9
-rw-r--r--NesHeaderFixer.cs228
-rw-r--r--UnifFile.cs10
8 files changed, 122 insertions, 153 deletions
diff --git a/Crc32Calculator.cs b/Crc32Calculator.cs
index 532c9c2..d1bd837 100644
--- a/Crc32Calculator.cs
+++ b/Crc32Calculator.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace com.clusterrr.Famicom.Containers
+namespace com.clusterrr.Famicom.Containers
{
public static class Crc32Calculator
{
diff --git a/FdsBlockFileData.cs b/FdsBlockFileData.cs
index 452f6ed..6b2b280 100644
--- a/FdsBlockFileData.cs
+++ b/FdsBlockFileData.cs
@@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
-using System.IO;
using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
namespace com.clusterrr.Famicom.Containers
{
diff --git a/FdsBlockFileHeader.cs b/FdsBlockFileHeader.cs
index e005642..60994a6 100644
--- a/FdsBlockFileHeader.cs
+++ b/FdsBlockFileHeader.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
-using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
namespace com.clusterrr.Famicom.Containers
{
@@ -13,7 +9,7 @@ namespace com.clusterrr.Famicom.Containers
{
public enum Kind
{
- Program = 0,
+ Program = 0,
Character = 1,
NameTable = 2
}
diff --git a/FdsDiskFile.cs b/FdsDiskFile.cs
index 9637162..14cd7ff 100644
--- a/FdsDiskFile.cs
+++ b/FdsDiskFile.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace com.clusterrr.Famicom.Containers
{
diff --git a/FdsFile.cs b/FdsFile.cs
index e374f82..b5ca2bb 100644
--- a/FdsFile.cs
+++ b/FdsFile.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace com.clusterrr.Famicom.Containers
{
diff --git a/IFdsBlock.cs b/IFdsBlock.cs
index 6171d65..8943469 100644
--- a/IFdsBlock.cs
+++ b/IFdsBlock.cs
@@ -1,11 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace com.clusterrr.Famicom.Containers
+namespace com.clusterrr.Famicom.Containers
{
public interface IFdsBlock
{
diff --git a/NesHeaderFixer.cs b/NesHeaderFixer.cs
index 03d4d35..a75a9a7 100644
--- a/NesHeaderFixer.cs
+++ b/NesHeaderFixer.cs
@@ -1,103 +1,99 @@
-using com.clusterrr.Famicom.Containers;
-using System;
-using System.Collections.Generic;
+using System;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace com.clusterrr.Famicom.Containers.HeaderFixer
{
public static class NesHeaderFixer
{
- [Flags]
- public enum NesFixType
- {
- NoFix = 0,
- Mapper = 1,
- Mirroring = 2,
- Battery = 4,
- NoChr = 8
- };
+ [Flags]
+ public enum NesFixType
+ {
+ NoFix = 0,
+ Mapper = 1,
+ Mirroring = 2,
+ Battery = 4,
+ NoChr = 8
+ };
- /// <summary>
- /// Fix ROM header using database of popular incorrect ROMs
- /// </summary>
- /// <returns>Flags showing what has been changed</returns>
- public static NesFixType CorrectRom(this NesFile nes)
- {
- NesFixType fixType = NesFixType.NoFix;
- var crc32 = nes.CalculateCRC32();
- for (int i = 0; i < correct.Length; i += 3)
- {
- if (crc32 == correct[i])
- {
- var mapper = correct[i + 1];
- var mirroring = correct[i + 2];
- if (mapper >= 0)
- {
- // no CHR
- if (((mapper & 0x800) != 0) && (nes.CHR?.Count() ?? 0) > 0)
- {
- nes.CHR = new byte[0];
- fixType |= NesFixType.NoChr;
- }
- // invalid mapper
- if (nes.Mapper != mapper)
- {
- nes.Mapper = (ushort)mapper;
- fixType |= NesFixType.Mapper;
- }
- }
- if (mirroring >= 0)
- {
- if (mirroring == 8 && nes.Mirroring == NesFile.MirroringType.FourScreenVram)
- {
- // no four-screen
- nes.Mirroring = NesFile.MirroringType.Horizontal;
- fixType |= NesFixType.Mirroring;
- }
- NesFile.MirroringType needMirroring = NesFile.MirroringType.Unknown;
- switch (mirroring)
- {
- case 0:
- needMirroring = NesFile.MirroringType.Horizontal;
- break;
- case 1:
- needMirroring = NesFile.MirroringType.Vertical;
- break;
- case 2:
- needMirroring = NesFile.MirroringType.FourScreenVram;
- break;
- }
- if (needMirroring != NesFile.MirroringType.Unknown && needMirroring != nes.Mirroring)
- {
- nes.Mirroring = needMirroring;
- fixType |= NesFixType.Mirroring;
- }
- }
- }
- }
+ /// <summary>
+ /// Fix ROM header using database of popular incorrect ROMs
+ /// </summary>
+ /// <returns>Flags showing what has been changed</returns>
+ public static NesFixType CorrectRom(this NesFile nes)
+ {
+ NesFixType fixType = NesFixType.NoFix;
+ var crc32 = nes.CalculateCRC32();
+ for (int i = 0; i < correct.Length; i += 3)
+ {
+ if (crc32 == correct[i])
+ {
+ var mapper = correct[i + 1];
+ var mirroring = correct[i + 2];
+ if (mapper >= 0)
+ {
+ // no CHR
+ if (((mapper & 0x800) != 0) && (nes.CHR?.Count() ?? 0) > 0)
+ {
+ nes.CHR = new byte[0];
+ fixType |= NesFixType.NoChr;
+ }
+ // invalid mapper
+ if (nes.Mapper != mapper)
+ {
+ nes.Mapper = (ushort)mapper;
+ fixType |= NesFixType.Mapper;
+ }
+ }
+ if (mirroring >= 0)
+ {
+ if (mirroring == 8 && nes.Mirroring == NesFile.MirroringType.FourScreenVram)
+ {
+ // no four-screen
+ nes.Mirroring = NesFile.MirroringType.Horizontal;
+ fixType |= NesFixType.Mirroring;
+ }
+ NesFile.MirroringType needMirroring = NesFile.MirroringType.Unknown;
+ switch (mirroring)
+ {
+ case 0:
+ needMirroring = NesFile.MirroringType.Horizontal;
+ break;
+ case 1:
+ needMirroring = NesFile.MirroringType.Vertical;
+ break;
+ case 2:
+ needMirroring = NesFile.MirroringType.FourScreenVram;
+ break;
+ }
+ if (needMirroring != NesFile.MirroringType.Unknown && needMirroring != nes.Mirroring)
+ {
+ nes.Mirroring = needMirroring;
+ fixType |= NesFixType.Mirroring;
+ }
+ }
+ }
+ }
- var md5 = nes.CalculateMD5();
- ulong partialmd5 = 0;
- for (int x = 0; x < 8; x++)
- partialmd5 |= (ulong)md5[15 - x] << (x * 8);
- // maybe this games uses battery saves?
- foreach (var sav in savie)
- {
- if (!nes.Battery && sav == partialmd5)
- {
- nes.Battery = true;
- fixType |= NesFixType.Battery;
- }
- }
+ var md5 = nes.CalculateMD5();
+ ulong partialmd5 = 0;
+ for (int x = 0; x < 8; x++)
+ partialmd5 |= (ulong)md5[15 - x] << (x * 8);
+ // maybe this games uses battery saves?
+ foreach (var sav in savie)
+ {
+ if (!nes.Battery && sav == partialmd5)
+ {
+ nes.Battery = true;
+ fixType |= NesFixType.Battery;
+ }
+ }
- return fixType;
- }
+ return fixType;
+ }
- static long[] correct = new long[]
- {
- 0xaf5d7aa2, -1, 0, /* Clu Clu Land */
+ static long[] correct = new long[]
+ {
+ 0xaf5d7aa2, -1, 0, /* Clu Clu Land */
0xcfb224e6, -1, 1, /* Dragon Ninja (J) [p1][!].nes */
0x4f2f1846, -1, 1, /* Famista '89 - Kaimaku Han!! (J) */
0x82f204ae, -1, 1, /* Liang Shan Ying Xiong (NJ023) (Ch) [!] */
@@ -162,7 +158,7 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0xc9ee15a7, 3, -1, /* 3 is probably best. 41 WILL NOT WORK. */
0x13e09d7a, 4, 0, /*Dragon Wars (U) (proto) - comes with erroneous 4-screen mirroring set*/
0x22d6d5bd, 4, 1,
- 0xd97c31b0, 4, 1, //Rasaaru Ishii no Childs Quest (J)
+ 0xd97c31b0, 4, 1, //Rasaaru Ishii no Childs Quest (J)
0x404b2e8b, 4, 2, /* Rad Racer 2 */
0x15141401, 4, 8, /* Asmik Kun Land */
0x4cccd878, 4, 8, /* Cat Ninden Teyandee */
@@ -179,7 +175,7 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0x5e66eaea, 13, 1, /* Videomation */
0xcd373baa, 14, -1, /* Samurai Spirits (Rex Soft) */
0xbfc7a2e9, 16, 8,
- 0x6e68e31a, 16, 8, /* Dragon Ball 3*/
+ 0x6e68e31a, 16, 8, /* Dragon Ball 3*/
0x33b899c9, 16, -1, /* Dragon Ball - Dai Maou Fukkatsu (J) [!] */
0xa262a81f, 16, -1, /* Rokudenashi Blues (J) */
0x286fcd20, 23, -1, /* Ganbare Goemon Gaiden 2 - Tenka no Zaihou (J) [!] */
@@ -191,7 +187,7 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0x5b3de3d1, 27, -1, /* -- */
0x511e73f8, 27, -1, /* -- */
0x5555fca3, 32, 8,
- 0x283ad224, 32, 8, /* Ai Sensei no Oshiete */
+ 0x283ad224, 32, 8, /* Ai Sensei no Oshiete */
0x243a8735, 32, 0x10|4, /* Major League */
0xbc7b1d0f, 33, -1, /* Bakushou!! Jinsei Gekijou 2 (J) [!] */
0xc2730c30, 34, 0, /* Deadly Towers */ // Duplicate value? WTF?
@@ -211,7 +207,7 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0xb19a55dd, 64, 8, /* Road Runner */
0xf92be3ec, 64, -1, /* Rolling Thunder */
0xe84274c5, 66, 1,
- 0xbde3ae9b, 66, 1, /* Doraemon */
+ 0xbde3ae9b, 66, 1, /* Doraemon */
0x9552e8df, 66, 1, /* Dragon Ball */
0x811f06d9, 66, 1, /* Dragon Power */
0xd26efd78, 66, 1, /* SMB Duck Hunt */
@@ -224,9 +220,9 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0x496ac8f7, 74, -1, /* Ji Jia Zhan Shi (As) */
0xae854cef, 74, -1, /* Jia A Fung Yun (Chinese) */
0xba51ac6f, 78, 2,
- 0x3d1c3137, 78, 8, /* Uchuusen - Cosmo Carrier */
+ 0x3d1c3137, 78, 8, /* Uchuusen - Cosmo Carrier */
0xa4fbb438, 79, 0,
- 0xd4a76b07, 79, 0, /* F-15 City Wars*/
+ 0xd4a76b07, 79, 0, /* F-15 City Wars*/
0x1eb4a920, 79, 1, /* Double Strike */
0x3e1271d5, 79, 1, /* Tiles of Fate */
0xd2699893, 88, 0, /* Dragon Spirit */
@@ -234,11 +230,11 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0x0da5e32e, 101, -1, /* new Uruusey Yatsura */
0x8eab381c, 113, 1, /* Death Bots */
0x6a03d3f3, 114, -1,
- 0x0d98db53, 114, -1, /* Pocahontas */
+ 0x0d98db53, 114, -1, /* Pocahontas */
0x4e7729ff, 114, -1, /* Super Donkey Kong */
0xc5e5c5b2, 115, -1, /* Bao Qing Tian (As).nes */
0xa1dc16c0, 116, -1,
- 0xe40dfb7e, 116, -1, /* Somari (P conf.) */
+ 0xe40dfb7e, 116, -1, /* Somari (P conf.) */
0xc9371ebb, 116, -1, /* Somari (W conf.) */
0xcbf4366f, 118, 8, /* Alien Syndrome (U.S. unlicensed) */
0x78b657ac, 118, -1, /* Armadillo */
@@ -259,8 +255,8 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0xa62b79e1, 146, -1, /* Side Winder (HES) [!] */
0xcc868d4e, 149, -1, /* 16 Mahjong [p1][!] */
0x29582ca1, 150, -1,
- 0x40dbf7a2, 150, -1,
- 0x73fb55ac, 150, -1, /* 2-in-1 Cosmo Cop + Cyber Monster (Sachen) [!] */
+ 0x40dbf7a2, 150, -1,
+ 0x73fb55ac, 150, -1, /* 2-in-1 Cosmo Cop + Cyber Monster (Sachen) [!] */
0xddcbda16, 150, -1, /* 2-in-1 Tough Cop + Super Tough Cop (Sachen) [!] */
0x47918d84, 150, -1, /* auto-upturn */
0x0f141525, 152, 8, /* Arkanoid 2 (Japanese) */
@@ -272,7 +268,7 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0xcfd4a281, 155, 8, /* Money Game. Yay for money! */
0x2f27cdef, 155, 8, /* Tatakae!! Rahmen Man */
0xccc03440, 156, -1,
- 0x983d8175, 157, 8, /* Datach Battle Rush */
+ 0x983d8175, 157, 8, /* Datach Battle Rush */
0x894efdbc, 157, 8, /* Datach Crayon Shin Chan */
0x19e81461, 157, 8, /* Datach DBZ */
0xbe06853f, 157, 8, /* Datach J-League */
@@ -294,27 +290,27 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0x0f05ff0a, 181, -1, /* Seicross (redump) */
0x96ce586e, 189, 8, /* Street Fighter 2 YOKO */
0x555a555e, 191, -1,
- 0x2cc381f6, 191, -1, /* Sugoro Quest - Dice no Senshitachi (As) */
+ 0x2cc381f6, 191, -1, /* Sugoro Quest - Dice no Senshitachi (As) */
0xa145fae6, 192, -1,
- 0xa9115bc1, 192, -1,
- 0x4c7bbb0e, 192, -1,
- 0x98c1cd4b, 192, -1, /* Ying Lie Qun Xia Zhuan (Chinese) */
+ 0xa9115bc1, 192, -1,
+ 0x4c7bbb0e, 192, -1,
+ 0x98c1cd4b, 192, -1, /* Ying Lie Qun Xia Zhuan (Chinese) */
0xee810d55, 192, -1, /* You Ling Xing Dong (Ch) */
0x442f1a29, 192, -1, /* Young chivalry */
0x637134e8, 193, 1, /* Fighting Hero */
0xa925226c, 194, -1, /* Dai-2-Ji - Super Robot Taisen (As) */
0x7f3dbf1b, 195, 0,
- 0xb616885c, 195, 0, /* CHaos WOrld (Ch)*/
+ 0xb616885c, 195, 0, /* CHaos WOrld (Ch)*/
0x33c5df92, 195, -1,
- 0x1bc0be6c, 195, -1, /* Captain Tsubasa Vol 2 - Super Striker (C) */
+ 0x1bc0be6c, 195, -1, /* Captain Tsubasa Vol 2 - Super Striker (C) */
0xd5224fde, 195, -1, /* Crystalis (c) */
0xfdec419f, 196, -1, /* Street Fighter VI 16 Peoples (Unl) [!] */
0x700705f4, 198, -1,
- 0x9a2cf02c, 198, -1,
- 0xd8b401a7, 198, -1,
- 0x28192599, 198, -1,
- 0x19b9e732, 198, -1,
- 0xdd431ba7, 198, -1, /* Tenchi wo kurau 2 (c) */
+ 0x9a2cf02c, 198, -1,
+ 0xd8b401a7, 198, -1,
+ 0x28192599, 198, -1,
+ 0x19b9e732, 198, -1,
+ 0xdd431ba7, 198, -1, /* Tenchi wo kurau 2 (c) */
0xd871d3e6, 199, -1, /* Dragon Ball Z 2 - Gekishin Freeza! (C) */
0xed481b7c, 199, -1, /* Dragon Ball Z Gaiden - Saiya Jin Zetsumetsu Keikaku (C) */
0x44c20420, 199, -1, /* San Guo Zhi 2 (C) */
@@ -361,9 +357,9 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0x59977a46, 0, 1, /* Mach Rider */
0x79f80127, 0, 1, /* Mach Rider (rus) */
};
- static ulong[] savie = new ulong[]
- {
- 0xc04361e499748382, /* AD&D Heroes of the Lance */
+ static ulong[] savie = new ulong[]
+ {
+ 0xc04361e499748382, /* AD&D Heroes of the Lance */
0xb72ee2337ced5792, /* AD&D Hillsfar */
0x2b7103b7a27bd72f, /* AD&D Pool of Radiance */
0x498c10dc463cfe95, /* Battle Fleet */
@@ -396,5 +392,5 @@ namespace com.clusterrr.Famicom.Containers.HeaderFixer
0xa70b495314f4d075, /* Ys 3 */
0x836c0ff4f3e06e45, /* Zelda 2 */
};
- }
+ }
}
diff --git a/UnifFile.cs b/UnifFile.cs
index c5d2448..4e36c12 100644
--- a/UnifFile.cs
+++ b/UnifFile.cs
@@ -309,11 +309,11 @@ namespace com.clusterrr.Famicom.Containers
{
var num = key[3];
var crc32 = Crc32Calculator.CalculateCRC32(Fields[key]);
- Fields[$"PCK{num}"] = new byte[] {
- (byte)(crc32 & 0xFF),
- (byte)((crc32 >> 8) & 0xFF),
- (byte)((crc32 >> 16) & 0xFF),
- (byte)((crc32 >> 24) & 0xFF)
+ Fields[$"PCK{num}"] = new byte[] {
+ (byte)(crc32 & 0xFF),
+ (byte)((crc32 >> 8) & 0xFF),
+ (byte)((crc32 >> 16) & 0xFF),
+ (byte)((crc32 >> 24) & 0xFF)
};
}
foreach (var key in Fields.Keys.Where(k => k.StartsWith("CHR")))