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

github.com/coolgirl-multicart/coolgirl-multirom-builder.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-07 19:48:43 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2022-11-07 19:48:43 +0300
commitc53a18883742bbf3cf33c093d13f5427e563d637 (patch)
tree1f59e15ff4b540eca3dce6f11cd5df0e8033a9cf
parenteee8ef253c3286d7904328fc040672f58548c56c (diff)
MD5 fixes
-rw-r--r--tools_sources/CoolgirlCombiner/Game.cs21
-rw-r--r--tools_sources/CoolgirlCombiner/Program.cs21
-rw-r--r--tools_sources/CoolgirlCombiner/coolgirl-fixes.json36
3 files changed, 40 insertions, 38 deletions
diff --git a/tools_sources/CoolgirlCombiner/Game.cs b/tools_sources/CoolgirlCombiner/Game.cs
index 859c90c..85e57cd 100644
--- a/tools_sources/CoolgirlCombiner/Game.cs
+++ b/tools_sources/CoolgirlCombiner/Game.cs
@@ -79,7 +79,7 @@ namespace com.clusterrr.Famicom.CoolGirl
{
}
- public Game(string fileName, string menuName = null, Dictionary<uint, GameFix> fixes = null)
+ public Game(string fileName, string menuName = null, Dictionary<string, GameFix> fixes = null)
{
// Separators
if (fileName == "-")
@@ -102,7 +102,8 @@ namespace com.clusterrr.Famicom.CoolGirl
MenuName = Limit(menuName.Trim());
if (MenuName == "?") Flags |= GameFlags.Hidden;
}
- uint crc;
+ string crc32;
+ string md5;
try
{
var nesFile = new NesFile(fileName);
@@ -110,20 +111,22 @@ namespace com.clusterrr.Famicom.CoolGirl
if (fixResult != 0)
Console.WriteLine(" Invalid header. Fix: " + fixResult);
PRG = nesFile.PRG;
- PrgSize = (uint)nesFile.PRG.Count();
+ PrgSize = (uint)nesFile.PRG.Length;
CHR = nesFile.CHR;
- ChrSize = (uint)nesFile.CHR?.Count();
+ ChrSize = (uint)nesFile.CHR.Length;
Battery = nesFile.Battery;
Mapper = $"{nesFile.Mapper:D3}" + ((nesFile.Submapper > 0) ? $":{nesFile.Submapper}" : "");
Mirroring = nesFile.Mirroring;
ContainerType = NesContainerType.iNES;
- Trained = nesFile.Trainer != null && nesFile.Trainer.Count() > 0;
+ Trained = nesFile.Trainer != null && nesFile.Trainer.Length > 0;
if (nesFile.Version == NesFile.iNesVersion.NES20)
{
PrgRamSize = nesFile.PrgRamSize + nesFile.PrgNvRamSize;
ChrRamSize = nesFile.ChrRamSize + nesFile.ChrNvRamSize;
}
- crc = nesFile.CalculateCRC32();
+ crc32 = $"{nesFile.CalculateCRC32():x08}";
+ var md5full = nesFile.CalculateMD5();
+ md5 = $"{md5full[0]:x02}{md5full[1]:x02}{md5full[2]:x02}{md5full[3]:x02}";
}
catch (InvalidDataException)
{
@@ -139,13 +142,15 @@ namespace com.clusterrr.Famicom.CoolGirl
Mapper = mapper;
Mirroring = unifFile.Mirroring ?? MirroringType.MapperControlled;
ContainerType = NesContainerType.UNIF;
- crc = unifFile.CalculateCRC32();
+ crc32 = $"{unifFile.CalculateCRC32():x08}";
+ var md5full = unifFile.CalculateMD5();
+ md5 = $"{md5full[0]:x02}{md5full[1]:x02}{md5full[2]:x02}{md5full[3]:x02}";
}
// Check for fixes database
if (fixes != null)
{
GameFix fix = null;
- if (fixes.TryGetValue(crc, out fix))
+ if (fixes.TryGetValue(crc32, out fix) || fixes.TryGetValue(md5, out fix))
{
if (fix.PrgRamSize.HasValue)
{
diff --git a/tools_sources/CoolgirlCombiner/Program.cs b/tools_sources/CoolgirlCombiner/Program.cs
index 9c02c03..079437a 100644
--- a/tools_sources/CoolgirlCombiner/Program.cs
+++ b/tools_sources/CoolgirlCombiner/Program.cs
@@ -257,21 +257,18 @@ namespace com.clusterrr.Famicom.CoolGirl
}
// Loading fixes file
- Dictionary<uint, GameFix> fixes;
+ Dictionary<string, GameFix> fixes;
if (File.Exists(optionFixesFile))
{
var fixesJson = File.ReadAllText(optionFixesFile);
var fixesStr = JsonSerializer.Deserialize<Dictionary<string, GameFix>>(fixesJson, jsonOptions);
// Convert string CRC32 to uint
- fixes = fixesStr.Select(kv =>
- {
- return new KeyValuePair<uint, GameFix>(
- // Check for hexademical values
- kv.Key.ToLower().StartsWith("0x")
- ? Convert.ToUInt32(kv.Key.Substring(2), 16)
- : uint.Parse(kv.Key),
- kv.Value);
- }).ToDictionary(kv => kv.Key, kv => kv.Value);
+ fixes = fixesStr.ToDictionary(
+ // Check for hexademical values
+ kv => kv.Key.ToLower().StartsWith("0x")
+ ? kv.Key.Substring(2).ToLower()
+ : kv.Key.ToLower(),
+ kv => kv.Value);
}
else
{
@@ -309,7 +306,7 @@ namespace com.clusterrr.Famicom.CoolGirl
// Skip empty lines
if (string.IsNullOrWhiteSpace(line)) continue;
// Skip comments
- if (line.StartsWith(";")) continue;
+ if (line.Trim().StartsWith(";")) continue;
if (line.Trim().ToUpper() == "!NOSORT")
{
optionNoSort = true;
@@ -322,7 +319,7 @@ namespace com.clusterrr.Famicom.CoolGirl
// Is it a directory?
if (fileName.EndsWith("/") || fileName.EndsWith("\\"))
{
- Console.WriteLine("Loading directory: {0}", fileName);
+ Console.WriteLine($"Loading directory: {fileName}");
var files = Enumerable.Concat(Enumerable.Concat(Directory.GetFiles(fileName, "*.nes"), Directory.GetFiles(fileName, "*.unf")), Directory.GetFiles(fileName, "*.unif"));
foreach (var file in files)
{
diff --git a/tools_sources/CoolgirlCombiner/coolgirl-fixes.json b/tools_sources/CoolgirlCombiner/coolgirl-fixes.json
index 6669c3e..b0bd1a2 100644
--- a/tools_sources/CoolgirlCombiner/coolgirl-fixes.json
+++ b/tools_sources/CoolgirlCombiner/coolgirl-fixes.json
@@ -1,73 +1,73 @@
{
- "0xc6182024": {
+ "c6182024": {
"description": "Romance of the 3 Kingdoms",
"prg_ram_size": 16
},
- "0xabbf7217": {
+ "abbf7217": {
"description": "??? (J) (PRG0)",
"prg_ram_size": 16
},
- "0xccf35c02": {
+ "ccf35c02": {
"description": "??? (J) (PRG1)",
"prg_ram_size": 16
},
- "0x2225c20f": {
+ "2225c20f": {
"description": "Genghis Khan",
"prg_ram_size": 16
},
- "0xfb69743a": {
+ "fb69743a": {
"description": "??? (J)",
"prg_ram_size": 16
},
- "0x4642dda6": {
+ "4642dda6": {
"description": "Nobunaga's Ambition",
"prg_ram_size": 16
},
- "0x3f7ad415": {
+ "3f7ad415": {
"description": "??? (J) (PRG0)",
"prg_ram_size": 16
},
- "0x2b11e0b0": {
+ "2b11e0b0": {
"description": "??? (J) (PRG1)",
"prg_ram_size": 16
},
- "0xb8747abf": {
+ "b8747abf": {
"description": "Best Play Pro Yakyuu Special (J) (PRG0)",
"prg_ram_size": 32
},
- "0xc3de7c69": {
+ "c3de7c69": {
"description": "??? (J) (PRG1)",
"prg_ram_size": 32
},
- "0xc9556b36": {
+ "c9556b36": {
"description": "Final Fantasy I & II (J) [!]",
"prg_ram_size": 32
},
- "0x93991433": {
+ "93991433": {
"description": "Low-G-Man",
"prg_ram_size": 0
},
- "0xaf65aa84": {
+ "af65aa84": {
"description": "Low-G-Man",
"prg_ram_size": 0
},
- "0x78b657ac": {
+ "78b657ac": {
"description": "Armadillo (J) [!]",
"will_not_work_on_dendy": true
},
- "0xb3d92e78": {
+ "b3d92e78": {
"description": "Armadillo (J) [T+Eng1.01_Vice Translations]",
"will_not_work_on_dendy": true
},
- "0x0fe6e6a5": {
+ "0fe6e6a5": {
"description": "Armadillo (J) [T+Rus1.00 Chief-Net (23.05.2012)]",
"will_not_work_on_dendy": true
},
- "0xe62e3382": {
+ "e62e3382": {
"description": "MiG 29 - Soviet Fighter (Camerica) [!]",
"will_not_work_on_dendy": true
},
- "0x1bc686a8": {
+ "1bc686a8": {
"description": "Fire Hawk (Camerica) [!]",
"will_not_work_on_dendy": true
}