diff options
author | Alexey Cluster <cluster@cluster.wtf> | 2024-01-01 22:38:03 +0300 |
---|---|---|
committer | Alexey Cluster <cluster@cluster.wtf> | 2024-01-01 22:38:03 +0300 |
commit | 8b635cf2de621f0e617463ecb900c66d4b481da2 (patch) | |
tree | 918d111ea1d356620077680a3404d1560adedd73 | |
parent | 1105093ebc9f47b68d9e43e86ea85b3cb0e41f7c (diff) |
ROM size check fix
-rw-r--r-- | tools_sources/CoolgirlCombiner/Program.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools_sources/CoolgirlCombiner/Program.cs b/tools_sources/CoolgirlCombiner/Program.cs index 03bb589..a2fd2d3 100644 --- a/tools_sources/CoolgirlCombiner/Program.cs +++ b/tools_sources/CoolgirlCombiner/Program.cs @@ -193,7 +193,7 @@ namespace com.clusterrr.Famicom.CoolGirl }
}
- int usedSpace = LOADER_SIZE;
+ int usedSpace = LOADER_OFFSET + LOADER_SIZE;
int notFittedSize = 0;
var sortedPrgs = games.OrderByDescending(g => g.PRG.Length).Where(g => g.PRG.Length > 0);
foreach (var game in sortedPrgs)
@@ -206,7 +206,7 @@ namespace com.clusterrr.Famicom.CoolGirl {
game.PrgOffset = pos;
Array.Copy(game.PRG, 0, result, pos, game.PRG.Length);
- usedSpace = Math.Max(LOADER_OFFSET + LOADER_SIZE, Math.Max(usedSpace, pos + game.PRG.Length));
+ usedSpace = Math.Max(usedSpace, pos + game.PRG.Length);
fitted = true;
Console.WriteLine($"offset: 0x{pos:X8}");
break;
@@ -231,7 +231,7 @@ namespace com.clusterrr.Famicom.CoolGirl {
game.ChrOffset = pos;
Array.Copy(game.CHR, 0, result, pos, game.CHR.Length);
- usedSpace = Math.Max(LOADER_OFFSET + LOADER_SIZE, Math.Max(usedSpace, pos + game.CHR.Length));
+ usedSpace = Math.Max(usedSpace, pos + game.CHR.Length);
fitted = true;
Console.WriteLine($"offset: 0x{pos:X8}");
break;
@@ -324,8 +324,8 @@ namespace com.clusterrr.Famicom.CoolGirl // Error collection
var problems = new List<Exception>();
- if ((notFittedSize > 0) && (usedSpace > config.MaxRomSizeMB * 1024 * 1024))
- problems.Add(new OutOfMemoryException($"ROM is too big: {Math.Round(usedSpace / 1024.0 / 1024.0, 3)}MB"));
+ if (usedSpace > config.MaxRomSizeMB * 1024 * 1024)
+ problems.Add(new OutOfMemoryException($"ROM is too big: ~{Math.Round(usedSpace / 1024.0 / 1024.0, 3)}MB"));
if (games.Count > MAX_GAME_COUNT)
problems.Add(new InvalidDataException($"Too many ROMs: {games.Count} (maximum {MAX_GAME_COUNT})"));
if (saveId > MAX_SAVE_COUNT)
|