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:
authorElie Rodrigue <elie.rodrigue@nubik.ca>2017-05-17 16:33:46 +0300
committerElie Rodrigue <elie.rodrigue@nubik.ca>2017-05-17 16:33:46 +0300
commitb79b03ad062904d49e62e3aa37a861a1dd41f1cc (patch)
tree35716f6a7038d61ddd1444d74a1b3d76bc7548dd
parent65059831109f0a764df561b8ec0fa16336dd9a10 (diff)
Moved the showsplashscreen method to clovershell wrapper instead of workerfrom.
Removed the add games method from workerform and made it an Async task Optimised the emulator manager to handle default image of unknow emulator based on file type. added .suo to git ignore
-rw-r--r--Clovershell/ClovershellWrapper.cs15
-rw-r--r--MainForm.cs15
-rw-r--r--Manager/EmulatorManager.cs52
-rw-r--r--SaveStateManager.cs3
-rw-r--r--Tooling/Tasks/FetchOriginalGames.cs1
-rw-r--r--Tooling/Tasks/ImportGames.cs228
-rw-r--r--WorkerForm.cs186
-rw-r--r--hakchi_gui.csproj1
8 files changed, 308 insertions, 193 deletions
diff --git a/Clovershell/ClovershellWrapper.cs b/Clovershell/ClovershellWrapper.cs
index 4bf2da77..6d5620ec 100644
--- a/Clovershell/ClovershellWrapper.cs
+++ b/Clovershell/ClovershellWrapper.cs
@@ -217,6 +217,21 @@ namespace com.clusterrr.clovershell
UploadFile(path, ms2);
ms2.Close();
}
+ public void ShowSplashScreen()
+ {
+
+ var splashScreenPath = Path.Combine(Path.Combine(com.clusterrr.hakchi_gui.Program.BaseDirectoryInternal, "data"), "splash.gz");
+ conn.ExecuteSimple("pkill -KILL clover-mcp");
+ conn.ExecuteSimple("pkill -KILL ReedPlayer-Clover");
+ conn.ExecuteSimple("pkill -KILL kachikachi");
+ if (File.Exists(splashScreenPath))
+ {
+ using (var splash = new FileStream(splashScreenPath, FileMode.Open))
+ {
+ conn.Execute("gunzip -c - > /dev/fb0", splash, null, null, 3000);
+ }
+ }
+ }
public void UploadFile(string path, byte[] data)
{
System.IO.MemoryStream mstr = new MemoryStream();
diff --git a/MainForm.cs b/MainForm.cs
index 85423ba7..e1f672a9 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -520,19 +520,16 @@ namespace com.clusterrr.hakchi_gui
void AddGames(IEnumerable<string> files)
{
- List<NesMiniApplication> addedApps;
- var workerForm = new WorkerForm();
- workerForm.Text = Resources.LoadingGames;
- workerForm.Task = WorkerForm.Tasks.AddGames;
- workerForm.GamesToAdd = files;
- workerForm.Start();
- addedApps = workerForm.addedApplications;
+ Tooling.Tasks.ImportGames ig = new Tooling.Tasks.ImportGames(files);
+ UI.Forms.AsyncTask at = new UI.Forms.AsyncTask(ig);
+ at.ShowDialog();
+
- foreach (NesMiniApplication g in addedApps)
+ foreach (NesMiniApplication g in ig.addedApplications)
{
g.Selected = true;
}
- Manager.GameManager.GetInstance().AddGames(addedApps);
+ Manager.GameManager.GetInstance().AddGames(ig.addedApplications);
ShowStats();
}
diff --git a/Manager/EmulatorManager.cs b/Manager/EmulatorManager.cs
index e5cc6dca..74d9ac10 100644
--- a/Manager/EmulatorManager.cs
+++ b/Manager/EmulatorManager.cs
@@ -77,12 +77,44 @@ namespace com.clusterrr.hakchi_gui.Manager
return ret;
}
+ private Emulator getUnknowEmulator(string fileName)
+ {
+ Emulator emu = new Emulator();
+ emu.Extensions = new List<string>();
+
+ emu.AvailableArguments = new List<string>();
+ string exeName = fileName;
+ if(System.IO.Path.GetExtension(fileName) !="")
+ {
+ emu.Extensions.Add(System.IO.Path.GetExtension(fileName));
+ exeName = System.IO.Path.GetExtension(fileName).Substring(1);
+ }
+ emu.Executable = "/bin/" + exeName;
+
+ if (emu.Extensions.Count > 0)
+ {
+ emu.SystemName = "Unknow / " + exeName;
+ }
+ else
+ {
+ emu.SystemName = "Application";
+ }
+
+ emu.Name = emu.SystemName;
+ emu.DefaultImage = "blank_"+exeName+".png";
+ emu.Prefix = "Z";
+ emu.SupportZip = true;
+ emulators.Add(emu);
+ SaveSettings();
+ return emu;
+ }
private Emulator getUnknowEmulator(NesMiniApplication game)
{
Emulator emu = new Emulator();
emu.Extensions = new List<string>();
emu.Extensions.Add(System.IO.Path.GetExtension(game.RomFile));
emu.AvailableArguments = new List<string>();
+
if((game.Command == null || game.Command == "" )&& emu.Extensions[0].Trim() != "")
{
emu.Executable = "/bin/" + emu.Extensions[0].Substring(1);
@@ -111,7 +143,12 @@ namespace com.clusterrr.hakchi_gui.Manager
emu.SystemName = "Unknow";
}
emu.Name = emu.Executable;
- emu.DefaultImage = "blank_app.png";
+ string exeName = "app";
+ if(emu.Executable.StartsWith("/bin/"))
+ {
+ exeName = emu.Executable.Substring(5);
+ }
+ emu.DefaultImage = "blank_"+exeName+".png";
emu.Prefix = "Z";
emu.SupportZip = true;
emulators.Add(emu);
@@ -160,10 +197,13 @@ namespace com.clusterrr.hakchi_gui.Manager
bool apply = false;
foreach (string s in e.Extensions)
{
- if (fileName.EndsWith(s) || (e.SupportZip && fileName.EndsWith(".7z")))
+ if (s != "")
{
- apply = true;
- break;
+ if (fileName.EndsWith(s) || (e.SupportZip && fileName.EndsWith(".7z")))
+ {
+ apply = true;
+ break;
+ }
}
}
if (apply)
@@ -172,6 +212,10 @@ namespace com.clusterrr.hakchi_gui.Manager
}
}
+ if(fileTypeAppliable.Count==0)
+ {
+ fileTypeAppliable.Add(getUnknowEmulator(fileName));
+ }
return fileTypeAppliable;
}
}
diff --git a/SaveStateManager.cs b/SaveStateManager.cs
index dd651e54..ecc6aa06 100644
--- a/SaveStateManager.cs
+++ b/SaveStateManager.cs
@@ -56,7 +56,8 @@ namespace com.clusterrr.hakchi_gui
}
var clovershell = MainForm.Clovershell;
- WorkerForm.ShowSplashScreen();
+ new clovershell.ClovershellWrapper(clovershell).ShowSplashScreen();
+
var listSavesScript =
"#!/bin/sh\n" +
"savespath=/var/lib/clover/profiles/0\n" +
diff --git a/Tooling/Tasks/FetchOriginalGames.cs b/Tooling/Tasks/FetchOriginalGames.cs
index abd514d0..e1690111 100644
--- a/Tooling/Tasks/FetchOriginalGames.cs
+++ b/Tooling/Tasks/FetchOriginalGames.cs
@@ -7,7 +7,6 @@ namespace com.clusterrr.hakchi_gui.Tooling.Tasks
{
class FetchOriginalGames:TaskableTool
{
- clovershell.ClovershellConnection theConnection;
clovershell.ClovershellWrapper wrapper;
public FetchOriginalGames(clovershell.ClovershellConnection conn):base("Fetching orignal games")
{
diff --git a/Tooling/Tasks/ImportGames.cs b/Tooling/Tasks/ImportGames.cs
new file mode 100644
index 00000000..9ac5e280
--- /dev/null
+++ b/Tooling/Tasks/ImportGames.cs
@@ -0,0 +1,228 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using SevenZip;
+using System.Windows.Forms;
+using System.Diagnostics;
+namespace com.clusterrr.hakchi_gui.Tooling.Tasks
+{
+ public class ImportGames : TaskableTool
+ {
+ public List<NesMiniApplication> addedApplications;
+ private IEnumerable<string> _GamesToAdd;
+ public ImportGames(IEnumerable<string> GamesToAdd) : base("Importing games")
+ {
+ _GamesToAdd = GamesToAdd;
+ }
+ bool YesForAllPatches;
+ public override void Execute()
+ {
+
+ ReportProgress(0);
+ try
+ {
+
+ var apps = new List<NesMiniApplication>();
+ addedApplications = null;
+ //bool NoForAllUnsupportedMappers = false;
+ bool YesForAllUnsupportedMappers = false;
+ YesForAllPatches = false;
+ int count = 0;
+ ReportStatus(Properties.Resources.AddingGames);
+ foreach (var sourceFileName in _GamesToAdd)
+ {
+ NesMiniApplication app = null;
+ try
+ {
+ var fileName = sourceFileName;
+ var ext = Path.GetExtension(sourceFileName).ToLower();
+ bool? needPatch = YesForAllPatches ? (bool?)true : null;
+ byte[] rawData = null;
+ string tmp = null;
+ if (ext == ".7z" || ext == ".zip" || ext == ".rar")
+ {
+ SevenZipExtractor.SetLibraryPath(Path.Combine(Program.BaseDirectoryInternal, IntPtr.Size == 8 ? @"tools\7z64.dll" : @"tools\7z.dll"));
+ using (var szExtractor = new SevenZipExtractor(sourceFileName))
+ {
+ var filesInArchive = new List<string>();
+ var gameFilesInArchive = new List<string>();
+ foreach (var f in szExtractor.ArchiveFileNames)
+ {
+ var e = Path.GetExtension(f).ToLower();
+ if (e == ".desktop" || Manager.EmulatorManager.getInstance().isFileValidRom(e))
+ gameFilesInArchive.Add(f);
+ filesInArchive.Add(f);
+ }
+ if (gameFilesInArchive.Count == 1) // Only one NES file (or app)
+ {
+ fileName = gameFilesInArchive[0];
+ }
+ else if (gameFilesInArchive.Count > 1) // Many NES files, need to select
+ {
+ var r = SelectFile(gameFilesInArchive.ToArray());
+ if (r == DialogResult.OK)
+ fileName = selectedFile;
+ else if (r == DialogResult.Ignore)
+ fileName = sourceFileName;
+ else continue;
+ }
+ else if (filesInArchive.Count == 1) // No NES files but only one another file
+ {
+ fileName = filesInArchive[0];
+ }
+ else // Need to select
+ {
+ var r = SelectFile(filesInArchive.ToArray());
+ if (r == DialogResult.OK)
+ fileName = selectedFile;
+ else if (r == DialogResult.Ignore)
+ fileName = sourceFileName;
+ else continue;
+ }
+ if (fileName != sourceFileName)
+ {
+ var o = new MemoryStream();
+ if (Path.GetExtension(fileName).ToLower() == ".desktop" // App in archive, need the whole directory
+ || szExtractor.ArchiveFileNames.Contains(Path.GetFileNameWithoutExtension(fileName) + ".jpg") // Or it has cover in archive
+ || szExtractor.ArchiveFileNames.Contains(Path.GetFileNameWithoutExtension(fileName) + ".png"))
+ {
+ tmp = Path.Combine(Path.GetTempPath(), fileName);
+ Directory.CreateDirectory(tmp);
+ szExtractor.ExtractArchive(tmp);
+ fileName = Path.Combine(tmp, fileName);
+ }
+ else
+ {
+ szExtractor.ExtractFile(fileName, o);
+ rawData = new byte[o.Length];
+ o.Seek(0, SeekOrigin.Begin);
+ o.Read(rawData, 0, (int)o.Length);
+ }
+ }
+ }
+ }
+ if (Path.GetExtension(fileName).ToLower() == ".nes")
+ {
+ try
+ {
+ app = NesGame.Import(fileName, sourceFileName, YesForAllUnsupportedMappers ? (bool?)true : null, ref needPatch, needPatchCallback, null, rawData);
+
+ // Trying to import Game Genie codes
+ var lGameGeniePath = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".xml");
+ if (File.Exists(lGameGeniePath))
+ {
+ GameGenieDataBase lGameGenieDataBase = new GameGenieDataBase(app);
+ lGameGenieDataBase.ImportCodes(lGameGeniePath, true);
+ lGameGenieDataBase.Save();
+ }
+ }
+ catch (Exception ex)
+ {
+ if (ex is UnsupportedMapperException || ex is UnsupportedFourScreenException)
+ {
+ var r = MessageBoxFromThread(
+ (ex is UnsupportedMapperException)
+ ? string.Format(Properties.Resources.MapperNotSupported, Path.GetFileName(fileName), (ex as UnsupportedMapperException).ROM.Mapper)
+ : string.Format(Properties.Resources.FourScreenNotSupported, Path.GetFileName(fileName)),
+ Properties.Resources.AreYouSure,
+ _GamesToAdd.Count() <= 1 ? MessageBoxButtons.YesNo : MessageBoxButtons.AbortRetryIgnore,
+ MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, true);
+ if (r == DialogResult.Abort)
+ YesForAllUnsupportedMappers = true;
+ if (r == DialogResult.Yes || r == DialogResult.Abort || r == DialogResult.Retry)
+ app = NesGame.Import(fileName, sourceFileName, true, ref needPatch, needPatchCallback, null, rawData);
+ else
+ continue;
+ }
+ else throw ex;
+ }
+ }
+ else
+ {
+ app = NesMiniApplication.Import(fileName, sourceFileName, rawData);
+ }
+ if (!string.IsNullOrEmpty(tmp) && Directory.Exists(tmp)) Directory.Delete(tmp, true);
+ ConfigIni.SelectedGames += ";" + app.Code;
+ }
+ catch (Exception ex)
+ {
+ if (ex is System.Threading.ThreadAbortException)
+ {
+ ReportCompleted();
+
+ }
+ Debug.WriteLine(ex.Message + ex.StackTrace);
+ ReportError(ex.Message,false);
+ }
+ if (app != null)
+ apps.Add(app);
+ ReportProgress((++count*100/ _GamesToAdd.Count()));
+ }
+ addedApplications = apps;
+
+ ReportCompleted();
+
+ }
+ catch (Exception exc)
+ {
+
+ ReportError(exc.Message, true);
+ }
+
+
+ }
+ private delegate DialogResult MessageBoxFromThreadDelegate( string text, string caption, MessageBoxButtons buttons,
+ MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool tweak);
+ DialogResult MessageBoxFromThread(string text, string caption, MessageBoxButtons buttons,
+ MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, bool tweak)
+ {
+
+ if (tweak) MessageBoxManager.Register(); // Tweak button names
+ var result = MessageBox.Show( text, caption, buttons, icon, defaultButton);
+ if (tweak) MessageBoxManager.Unregister();
+
+ return result;
+ }
+ private bool needPatchCallback(Form parentForm, string nesFileName)
+ {
+ if (_GamesToAdd == null || _GamesToAdd.Count() <= 1)
+ {
+ return MessageBoxFromThread(
+ string.Format(Properties.Resources.PatchQ, Path.GetFileName(nesFileName)),
+ Properties.Resources.PatchAvailable,
+ MessageBoxButtons.YesNo,
+ MessageBoxIcon.Question,
+ MessageBoxDefaultButton.Button1, false) == DialogResult.Yes;
+ }
+ else
+ {
+ var r = MessageBoxFromThread(
+ string.Format(Properties.Resources.PatchQ, Path.GetFileName(nesFileName)),
+ Properties.Resources.PatchAvailable,
+ MessageBoxButtons.AbortRetryIgnore,
+ MessageBoxIcon.Question,
+ MessageBoxDefaultButton.Button2, true);
+ if (r == DialogResult.Abort)
+ YesForAllPatches = true;
+ return r != DialogResult.Ignore;
+ }
+ }
+ string selectedFile = null;
+ DialogResult SelectFile(string[] files)
+ {
+
+ var form = new SelectFileForm(files);
+
+ var result = form.ShowDialog();
+
+ if (form.listBoxFiles.SelectedItem != null)
+ selectedFile = form.listBoxFiles.SelectedItem.ToString();
+ else
+ selectedFile = null;
+
+ return result;
+ }
+ }
+}
diff --git a/WorkerForm.cs b/WorkerForm.cs
index 132572ca..2917b16e 100644
--- a/WorkerForm.cs
+++ b/WorkerForm.cs
@@ -19,7 +19,7 @@ namespace com.clusterrr.hakchi_gui
{
public partial class WorkerForm : Form
{
- public enum Tasks { DumpKernel, FlashKernel, Memboot, UploadGames, DownloadAllCovers, AddGames };
+ public enum Tasks { DumpKernel, FlashKernel, Memboot, UploadGames, DownloadAllCovers };
public Tasks Task;
//public string UBootDump;
public string KernelDump;
@@ -63,7 +63,7 @@ namespace com.clusterrr.hakchi_gui
string[] correctKernels;
const long maxCompressedsRamfsSize = 30 * 1024 * 1024;
string selectedFile = null;
- public List<NesMiniApplication> addedApplications;
+
public static int NandCTotal, NandCUsed, NandCFree, WritedGamesSize, SaveStatesSize;
public const long ReservedMemory = 10;
@@ -187,24 +187,7 @@ namespace com.clusterrr.hakchi_gui
return result;
}
- DialogResult SelectFileFromThread(string[] files)
- {
- if (InvokeRequired)
- {
- return (DialogResult)Invoke(new Func<string[], DialogResult>(SelectFileFromThread), new object[] { files });
- }
- var form = new SelectFileForm(files);
- TaskbarProgress.SetState(this, TaskbarProgress.TaskbarStates.Paused);
- var result = form.ShowDialog();
- TaskbarProgress.SetState(this, TaskbarProgress.TaskbarStates.Normal);
- if (form.listBoxFiles.SelectedItem != null)
- selectedFile = form.listBoxFiles.SelectedItem.ToString();
- else
- selectedFile = null;
- TaskbarProgress.SetState(this, TaskbarProgress.TaskbarStates.Normal);
- return result;
- }
-
+
public void StartThread()
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(ConfigIni.Language);
@@ -230,9 +213,7 @@ namespace com.clusterrr.hakchi_gui
case Tasks.DownloadAllCovers:
DownloadAllCovers();
break;
- case Tasks.AddGames:
- AddGames(GamesToAdd);
- break;
+
}
if (DialogResult == DialogResult.None)
DialogResult = DialogResult.OK;
@@ -501,22 +482,7 @@ namespace com.clusterrr.hakchi_gui
Debug.WriteLine(string.Format("Available for games: {0:F1}MB", (NandCFree + WritedGamesSize) / 1024.0 / 1024.0));
}
- public static void ShowSplashScreen()
- {
- var clovershell = MainForm.Clovershell;
- var splashScreenPath = Path.Combine(Path.Combine(Program.BaseDirectoryInternal, "data"), "splash.gz");
- clovershell.ExecuteSimple("pkill -KILL clover-mcp");
- clovershell.ExecuteSimple("pkill -KILL ReedPlayer-Clover");
- clovershell.ExecuteSimple("pkill -KILL kachikachi");
- if (File.Exists(splashScreenPath))
- {
- using (var splash = new FileStream(splashScreenPath, FileMode.Open))
- {
- clovershell.Execute("gunzip -c - > /dev/fb0", splash, null, null, 3000);
- }
- }
- }
-
+
public void UploadGames()
{
const string gamesPath = "/usr/share/games/nes/kachikachi";
@@ -551,7 +517,8 @@ namespace com.clusterrr.hakchi_gui
progress += 5;
SetProgress(progress, maxProgress);
- ShowSplashScreen();
+ new clovershell.ClovershellWrapper(clovershell).ShowSplashScreen();
+
SetStatus(Resources.BuildingFolders);
if (Directory.Exists(tempDirectory))
@@ -1013,144 +980,7 @@ namespace com.clusterrr.hakchi_gui
bool YesForAllPatches = false;
- public ICollection<NesMiniApplication> AddGames(IEnumerable<string> files, Form parentForm = null)
- {
- var apps = new List<NesMiniApplication>();
- addedApplications = null;
- //bool NoForAllUnsupportedMappers = false;
- bool YesForAllUnsupportedMappers = false;
- YesForAllPatches = false;
- int count = 0;
- SetStatus(Resources.AddingGames);
- foreach (var sourceFileName in files)
- {
- NesMiniApplication app = null;
- try
- {
- var fileName = sourceFileName;
- var ext = Path.GetExtension(sourceFileName).ToLower();
- bool? needPatch = YesForAllPatches ? (bool?)true : null;
- byte[] rawData = null;
- string tmp = null;
- if (ext == ".7z" || ext == ".zip" || ext == ".rar")
- {
- SevenZipExtractor.SetLibraryPath(Path.Combine(baseDirectoryInternal, IntPtr.Size == 8 ? @"tools\7z64.dll" : @"tools\7z.dll"));
- using (var szExtractor = new SevenZipExtractor(sourceFileName))
- {
- var filesInArchive = new List<string>();
- var gameFilesInArchive = new List<string>();
- foreach (var f in szExtractor.ArchiveFileNames)
- {
- var e = Path.GetExtension(f).ToLower();
- if (e == ".desktop" || Manager.EmulatorManager.getInstance().isFileValidRom(e))
- gameFilesInArchive.Add(f);
- filesInArchive.Add(f);
- }
- if (gameFilesInArchive.Count == 1) // Only one NES file (or app)
- {
- fileName = gameFilesInArchive[0];
- }
- else if (gameFilesInArchive.Count > 1) // Many NES files, need to select
- {
- var r = SelectFileFromThread(gameFilesInArchive.ToArray());
- if (r == DialogResult.OK)
- fileName = selectedFile;
- else if (r == DialogResult.Ignore)
- fileName = sourceFileName;
- else continue;
- }
- else if (filesInArchive.Count == 1) // No NES files but only one another file
- {
- fileName = filesInArchive[0];
- }
- else // Need to select
- {
- var r = SelectFileFromThread(filesInArchive.ToArray());
- if (r == DialogResult.OK)
- fileName = selectedFile;
- else if (r == DialogResult.Ignore)
- fileName = sourceFileName;
- else continue;
- }
- if (fileName != sourceFileName)
- {
- var o = new MemoryStream();
- if (Path.GetExtension(fileName).ToLower() == ".desktop" // App in archive, need the whole directory
- || szExtractor.ArchiveFileNames.Contains(Path.GetFileNameWithoutExtension(fileName) + ".jpg") // Or it has cover in archive
- || szExtractor.ArchiveFileNames.Contains(Path.GetFileNameWithoutExtension(fileName) + ".png"))
- {
- tmp = Path.Combine(Path.GetTempPath(), fileName);
- Directory.CreateDirectory(tmp);
- szExtractor.ExtractArchive(tmp);
- fileName = Path.Combine(tmp, fileName);
- }
- else
- {
- szExtractor.ExtractFile(fileName, o);
- rawData = new byte[o.Length];
- o.Seek(0, SeekOrigin.Begin);
- o.Read(rawData, 0, (int)o.Length);
- }
- }
- }
- }
- if (Path.GetExtension(fileName).ToLower() == ".nes")
- {
- try
- {
- app = NesGame.Import(fileName, sourceFileName, YesForAllUnsupportedMappers ? (bool?)true : null, ref needPatch, needPatchCallback, this, rawData);
-
- // Trying to import Game Genie codes
- var lGameGeniePath = Path.Combine(Path.GetDirectoryName(fileName), Path.GetFileNameWithoutExtension(fileName) + ".xml");
- if (File.Exists(lGameGeniePath))
- {
- GameGenieDataBase lGameGenieDataBase = new GameGenieDataBase(app);
- lGameGenieDataBase.ImportCodes(lGameGeniePath, true);
- lGameGenieDataBase.Save();
- }
- }
- catch (Exception ex)
- {
- if (ex is UnsupportedMapperException || ex is UnsupportedFourScreenException)
- {
- var r = MessageBoxFromThread(this,
- (ex is UnsupportedMapperException)
- ? string.Format(Resources.MapperNotSupported, Path.GetFileName(fileName), (ex as UnsupportedMapperException).ROM.Mapper)
- : string.Format(Resources.FourScreenNotSupported, Path.GetFileName(fileName)),
- Resources.AreYouSure,
- files.Count() <= 1 ? MessageBoxButtons.YesNo : MessageBoxButtons.AbortRetryIgnore,
- MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, true);
- if (r == DialogResult.Abort)
- YesForAllUnsupportedMappers = true;
- if (r == DialogResult.Yes || r == DialogResult.Abort || r == DialogResult.Retry)
- app = NesGame.Import(fileName, sourceFileName, true, ref needPatch, needPatchCallback, this, rawData);
- else
- continue;
- }
- else throw ex;
- }
- }
- else
- {
- app = NesMiniApplication.Import(fileName, sourceFileName, rawData);
- }
- if (!string.IsNullOrEmpty(tmp) && Directory.Exists(tmp)) Directory.Delete(tmp, true);
- ConfigIni.SelectedGames += ";" + app.Code;
- }
- catch (Exception ex)
- {
- if (ex is ThreadAbortException) return null;
- Debug.WriteLine(ex.Message + ex.StackTrace);
- ShowError(ex, true);
- }
- if (app != null)
- apps.Add(app);
- SetProgress(++count, files.Count());
- }
- addedApplications = apps;
- return apps; // Added games/apps
- }
-
+
private bool needPatchCallback(Form parentForm, string nesFileName)
{
if (GamesToAdd == null || GamesToAdd.Count() <= 1)
diff --git a/hakchi_gui.csproj b/hakchi_gui.csproj
index af398eed..66a12f33 100644
--- a/hakchi_gui.csproj
+++ b/hakchi_gui.csproj
@@ -445,6 +445,7 @@
</Compile>
<Compile Include="Tooling\TaskableTool.cs" />
<Compile Include="Tooling\Tasks\FetchOriginalGames.cs" />
+ <Compile Include="Tooling\Tasks\ImportGames.cs" />
<Compile Include="UI\Components\GameDetail.cs">
<SubType>UserControl</SubType>
</Compile>