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

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-10 10:17:00 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-10 10:17:00 +0300
commitc69fe813667edb0c3161c00ec3adfddaced2e375 (patch)
tree7ae9e32130722cb5927cbdc52de9480a95cde51f /Apps/NesGame.cs
parentd54bdf45f08e0772eb53de7ea2e18b69924804b2 (diff)
Added GameGenie for SNES but it glitchy and commented out
Diffstat (limited to 'Apps/NesGame.cs')
-rw-r--r--Apps/NesGame.cs65
1 files changed, 18 insertions, 47 deletions
diff --git a/Apps/NesGame.cs b/Apps/NesGame.cs
index b184c010..3f1a1877 100644
--- a/Apps/NesGame.cs
+++ b/Apps/NesGame.cs
@@ -16,12 +16,10 @@ namespace com.clusterrr.hakchi_gui
public class NesGame : NesMiniApplication, ICloverAutofill, ISupportsGameGenie
{
public const char Prefix = 'H';
- public string GameGeniePath { private set; get; }
public static bool? IgnoreMapper;
const string DefaultArgs = "--guest-overscan-dimensions 0,0,9,3 --initial-fadein-durations 10,2 --volume 75 --enable-armet";
private static Dictionary<uint, CachedGameInfo> gameInfoCache = null;
- public const string GameGenieFileName = "gamegenie.txt";
private static byte[] supportedMappers = new byte[] { 0, 1, 2, 3, 4, 5, 7, 9, 10, 86, 87, 184 };
public override string GoogleSuffix
@@ -32,23 +30,9 @@ namespace com.clusterrr.hakchi_gui
}
}
- private string gameGenie = "";
- public string GameGenie
- {
- get { return gameGenie; }
- set
- {
- if (gameGenie != value) hasUnsavedChanges = true;
- gameGenie = value;
- }
- }
-
public NesGame(string path, bool ignoreEmptyConfig = false)
: base(path, ignoreEmptyConfig)
{
- GameGeniePath = System.IO.Path.Combine(path, GameGenieFileName);
- if (File.Exists(GameGeniePath))
- gameGenie = File.ReadAllText(GameGeniePath);
}
public static bool Patch(string inputFileName, ref byte[] rawRomData, ref char prefix, ref string application, ref string outputFileName, ref string args, ref Image cover, ref byte saveCount, ref uint crc32)
@@ -149,37 +133,6 @@ namespace com.clusterrr.hakchi_gui
return false;
}
- public override bool Save()
- {
- var old = hasUnsavedChanges;
- if (hasUnsavedChanges)
- {
- if (!string.IsNullOrEmpty(gameGenie))
- File.WriteAllText(GameGeniePath, gameGenie);
- else
- File.Delete(GameGeniePath);
- }
- return base.Save() || old;
- }
-
- public void ApplyGameGenie()
- {
- if (!string.IsNullOrEmpty(GameGenie))
- {
- var codes = GameGenie.Split(new char[] { ',', '\t', ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);
- var nesFiles = Directory.GetFiles(this.GamePath, "*.nes", SearchOption.TopDirectoryOnly);
- foreach (var f in nesFiles)
- {
- var nesFile = new NesFile(f);
- foreach (var code in codes)
- {
- nesFile.PRG = GameGeniePatcher.Patch(nesFile.PRG, code.Trim());
- }
- nesFile.Save(f);
- }
- }
- }
-
private struct CachedGameInfo
{
public string Name;
@@ -232,6 +185,24 @@ namespace com.clusterrr.hakchi_gui
Debug.WriteLine(ex.Message + ex.StackTrace);
}
}
+
+ public void ApplyGameGenie()
+ {
+ if (!string.IsNullOrEmpty(GameGenie))
+ {
+ var codes = GameGenie.Split(new char[] { ',', '\t', ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);
+ var nesFiles = Directory.GetFiles(this.GamePath, "*.nes", SearchOption.TopDirectoryOnly);
+ foreach (var f in nesFiles)
+ {
+ var nesFile = new NesFile(f);
+ foreach (var code in codes)
+ {
+ nesFile.PRG = GameGeniePatcherNes.Patch(nesFile.PRG, code.Trim());
+ }
+ nesFile.Save(f);
+ }
+ }
+ }
}
}