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-05 07:05:16 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-05 07:05:16 +0300
commit01c8b9149f139648ed53fe175bbc955443c2ef01 (patch)
tree5e9ae2af9d2cf2602bbf4ca40ee2348f4af06d2a /GameGenieCodeAddModForm.cs
parente0b2f51d15924c3353393072be25f8bb3d3e45d2 (diff)
Huge refactoring. Testing required. But need to sleep.
Diffstat (limited to 'GameGenieCodeAddModForm.cs')
-rw-r--r--GameGenieCodeAddModForm.cs18
1 files changed, 14 insertions, 4 deletions
diff --git a/GameGenieCodeAddModForm.cs b/GameGenieCodeAddModForm.cs
index 25e75736..99049933 100644
--- a/GameGenieCodeAddModForm.cs
+++ b/GameGenieCodeAddModForm.cs
@@ -1,15 +1,16 @@
using com.clusterrr.Famicom;
using com.clusterrr.hakchi_gui.Properties;
using System;
+using System.IO;
using System.Windows.Forms;
namespace com.clusterrr.hakchi_gui
{
public partial class GameGenieCodeAddModForm : Form
{
- readonly NesGame FGame = null;
+ readonly NesMiniApplication FGame = null;
- public GameGenieCodeAddModForm(NesGame game)
+ public GameGenieCodeAddModForm(NesMiniApplication game)
{
InitializeComponent();
FGame = game;
@@ -47,10 +48,14 @@ namespace com.clusterrr.hakchi_gui
if (FGame != null)
{
- NesFile lGame = new NesFile(FGame.NesPath);
+ var tmpPath = Path.Combine(Path.GetTempPath(), FGame.Code);
try
{
- lGame.PRG = GameGeniePatcher.Patch(lGame.PRG, textBoxCode.Text);
+ FGame.CopyTo(tmpPath);
+ var lGame = NesMiniApplication.FromDirectory(tmpPath);
+ (lGame as ISupportsGameGenie).GameGenie = textBoxCode.Text;
+ lGame.Save();
+ (lGame as ISupportsGameGenie).ApplyGameGenie();
}
catch (GameGenieFormatException)
{
@@ -62,6 +67,11 @@ namespace com.clusterrr.hakchi_gui
MessageBox.Show(this, string.Format(Resources.GameGenieNotFound, textBoxCode.Text, FGame.Name), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
+ finally
+ {
+ if (Directory.Exists(tmpPath))
+ Directory.Delete(tmpPath, true);
+ }
}
if (string.IsNullOrEmpty(textBoxDescription.Text.Trim()))