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-13 02:23:21 +0300
committerElie Rodrigue <elie.rodrigue@nubik.ca>2017-05-13 02:23:21 +0300
commite0f4c379a1f2d2639e6f07a9ac5d9fd6533a4e91 (patch)
tree9f68c3653af64ffc7a47b4fab353cb4c022d66f2
parentc216212881638cc6ac5d19c6ef069f02d25b90f5 (diff)
Eased off the procedure to add system
Added some systems Fixed an issue with checking unchecking system in the treeview that made it really slow.
-rw-r--r--Apps/AppTypeCollection.cs52
-rw-r--r--Apps/NesMiniApplication.cs1
-rw-r--r--Apps/UnknowSystem.cs21
-rw-r--r--MainForm.cs15
-rw-r--r--Manager/EventBus.cs11
-rw-r--r--Manager/GameManager.cs22
-rw-r--r--UI/Components/GameSelecter.cs17
-rw-r--r--hakchi_gui.csproj1
8 files changed, 134 insertions, 6 deletions
diff --git a/Apps/AppTypeCollection.cs b/Apps/AppTypeCollection.cs
index 6da98620..3c3402e7 100644
--- a/Apps/AppTypeCollection.cs
+++ b/Apps/AppTypeCollection.cs
@@ -104,6 +104,54 @@ namespace com.clusterrr.hakchi_gui
Prefix = 'B',
DefaultCover = Resources.blank_gb
},
+ ///bin/a78 /usr/share/games/nes/kachikachi/CLV-Z-AGEPI/Ms._Pac-Man__USA_.7z
+ new AppInfo
+ {
+ SystemName = "Atari 7800",
+ Class = new List<Type>(){typeof(UnknowSystem) },
+ Extensions = new string[]{".a78"},
+ DefaultApps = new string[]{ "/bin/a78" },
+ Prefix = 'Z',
+ DefaultCover = Resources.blank_app
+ },
+ new AppInfo
+ {
+ SystemName = "Atari Lynx",
+ Class = new List<Type>(){typeof(UnknowSystem) },
+ Extensions = new string[]{".lnx"},
+ DefaultApps = new string[]{ "/bin/lnx" },
+ Prefix = 'Z',
+ DefaultCover = Resources.blank_app
+ },
+
+ new AppInfo
+ {
+ SystemName = "SuperGrafx",
+ Class = new List<Type>(){typeof(UnknowSystem) },
+ Extensions = new string[]{".pce"},
+ DefaultApps = new string[]{ "/bin/sgfx" },
+ Prefix = 'E',
+ DefaultCover = Resources.blank_pce
+ },
+
+ new AppInfo
+ {
+ SystemName = "NeoGeo Pocket (Color)",
+ Class = new List<Type>(){typeof(UnknowSystem) },
+ Extensions = new string[]{".ngc"},
+ DefaultApps = new string[]{ "/bin/ngc" },
+ Prefix = 'E',
+ DefaultCover = Resources.blank_app
+ },
+ new AppInfo
+ {
+ SystemName = "NeoGeo Pocket",
+ Class = new List<Type>(){typeof(UnknowSystem) },
+ Extensions = new string[]{".ngp"},
+ DefaultApps = new string[]{ "/bin/ngp" },
+ Prefix = 'E',
+ DefaultCover = Resources.blank_app
+ },
new AppInfo
{
SystemName = "GameBoy Color",
@@ -182,7 +230,9 @@ namespace com.clusterrr.hakchi_gui
foreach (var cmd in app.DefaultApps)
if (exec.StartsWith(cmd + " "))
return app;
- return null;
+ AppInfo inf = new AppInfo();
+ inf.SystemName = "Unknow";
+ return inf;
}
}
}
diff --git a/Apps/NesMiniApplication.cs b/Apps/NesMiniApplication.cs
index 965687b8..b67ad869 100644
--- a/Apps/NesMiniApplication.cs
+++ b/Apps/NesMiniApplication.cs
@@ -14,6 +14,7 @@ namespace com.clusterrr.hakchi_gui
{
public class NesMiniApplication : INesMenuElement
{
+
public readonly static string GamesDirectory = Path.Combine(Program.BaseDirectoryExternal, "games");
const string DefaultReleaseDate = "1900-01-01";
const string DefaultPublisher = "UNKNOWN";
diff --git a/Apps/UnknowSystem.cs b/Apps/UnknowSystem.cs
new file mode 100644
index 00000000..8023b31d
--- /dev/null
+++ b/Apps/UnknowSystem.cs
@@ -0,0 +1,21 @@
+#pragma warning disable 0108
+using com.clusterrr.hakchi_gui.Properties;
+using System.Drawing;
+
+namespace com.clusterrr.hakchi_gui
+{
+ public class UnknowSystem : NesMiniApplication
+ {
+ public override string GoogleSuffix
+ {
+ get
+ {
+ return "";
+ }
+ }
+ public UnknowSystem(string path, bool ignoreEmptyConfig = false)
+ : base(path, ignoreEmptyConfig)
+ {
+ }
+ }
+}
diff --git a/MainForm.cs b/MainForm.cs
index 9a568882..f2a671f1 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -58,6 +58,7 @@ namespace com.clusterrr.hakchi_gui
InternalMods = from m in Directory.GetFiles(Path.Combine(Program.BaseDirectoryInternal, "mods/hmods")) select Path.GetFileNameWithoutExtension(m);
gameSelecter1.Init();
gameSelecter1.SelectedAppChanged += GameSelecter1_SelectedAppChanged;
+ Manager.EventBus.getInstance().SizeRecalculationRequired += MainForm_SizeRecalculationRequired;
Manager.GameManager.GetInstance().SelectedChanged += MainForm_SelectedChanged;
Manager.GameManager.GetInstance().GamesRemoved += MainForm_GamesRemoved;
Manager.GameManager.GetInstance().NewGamesAdded += MainForm_NewGamesAdded;
@@ -141,14 +142,24 @@ namespace com.clusterrr.hakchi_gui
}
}
- private void MainForm_SelectedChanged(NesMiniApplication app)
+ private void MainForm_SizeRecalculationRequired()
{
ShowStats();
}
+ private void MainForm_SelectedChanged(NesMiniApplication app)
+ {
+ if (!Manager.GameManager.GetInstance().SelectedChangeBatch)
+ {
+ ShowStats();
+ }
+ }
+
private void GameSelecter1_SelectedAppChanged(NesMiniApplication app)
{
- ShowSelected();
+
+ ShowSelected();
+
}
void Clovershell_OnConnected()
diff --git a/Manager/EventBus.cs b/Manager/EventBus.cs
index a4d5854e..9b1f4076 100644
--- a/Manager/EventBus.cs
+++ b/Manager/EventBus.cs
@@ -8,7 +8,7 @@ namespace com.clusterrr.hakchi_gui.Manager
public class EventBus
{
public delegate void TextRequest(string text);
-
+ public delegate void VoidRequest();
public static EventBus getInstance()
{
if(instance == null)
@@ -17,11 +17,20 @@ namespace com.clusterrr.hakchi_gui.Manager
}
return instance;
}
+
private static EventBus instance;
private EventBus()
{
}
+ public event VoidRequest SizeRecalculationRequired;
+ public void SizeRecalculationRequest()
+ {
+ if(SizeRecalculationRequired!=null)
+ {
+ SizeRecalculationRequired();
+ }
+ }
public event TextRequest SearchRequest;
public void Search(string text)
{
diff --git a/Manager/GameManager.cs b/Manager/GameManager.cs
index 5e227154..c55d1286 100644
--- a/Manager/GameManager.cs
+++ b/Manager/GameManager.cs
@@ -218,6 +218,14 @@ namespace com.clusterrr.hakchi_gui.Manager
gameLibrary.Add(g);
reallyAdded.Add(g);
AppTypeCollection.AppInfo inf = AppTypeCollection.GetAppByClass(g.GetType());
+ if (inf.Class[0] == typeof(UnknowSystem))
+ {
+ inf = AppTypeCollection.GetAppByExec(g.Command);
+ }
+ if (inf == null)
+ {
+ Console.Write("");
+ }
if (!systemClassifiedGames.ContainsKey(inf))
{
systemClassifiedGames[inf] = new List<NesMiniApplication>();
@@ -233,10 +241,14 @@ namespace com.clusterrr.hakchi_gui.Manager
}
}
}
+ public bool SelectedChangeBatch = false;
public event NesMiniApplication.ValueChangedHandler SelectedChanged;
private void G_SelectedChanged(NesMiniApplication app)
{
- SaveChanges();
+ if (!SelectedChangeBatch)
+ {
+ SaveChanges();
+ }
if(SelectedChanged != null)
{
SelectedChanged(app);
@@ -336,7 +348,15 @@ namespace com.clusterrr.hakchi_gui.Manager
// Removing empty directories without errors
try
{
+ if(gameDir == "C:\\Users\\elier\\Documents\\latesteliehakchi2\\bin\\Debug\\games\\CLV-E-ELHEW")
+ {
+ Console.Write("");
+ }
var game = NesMiniApplication.FromDirectory(gameDir);
+ if(game.GetType() == typeof(NesMiniApplication))
+ {
+ Console.Write("");
+ }
game.Selected = selectedGames.Contains(game.Code);
toAdd.Add(game);
diff --git a/UI/Components/GameSelecter.cs b/UI/Components/GameSelecter.cs
index eb2c6673..9a6118c9 100644
--- a/UI/Components/GameSelecter.cs
+++ b/UI/Components/GameSelecter.cs
@@ -249,7 +249,12 @@ namespace com.clusterrr.hakchi_gui.UI.Components
/*Add to treeview*/
foreach(var game in e.OrderBy(o => o.Name))
{
- string systemName = AppTypeCollection.GetAppByClass(game.GetType()).SystemName;
+ AppTypeCollection.AppInfo inf = AppTypeCollection.GetAppByClass(game.GetType());
+ if (inf.Class[0] == typeof(UnknowSystem))
+ {
+ inf = AppTypeCollection.GetAppByExec(game.Command);
+ }
+ string systemName = inf.SystemName;
TreeNode tn = getSystemTreeNode(systemName);
TreeNode gameNode = new TreeNode(game.Name);
gameNode.Tag = game;
@@ -377,7 +382,9 @@ namespace com.clusterrr.hakchi_gui.UI.Components
{
if (!InFolderUncheck)
{
+ NesMiniApplication last = null;
Debug.WriteLine(e.Node.Text + " - " + e.Node.Checked.ToString());
+ Manager.GameManager.GetInstance().SelectedChangeBatch = true;
treeView1.BeginUpdate();
if(e.Node.Checked)
{
@@ -385,6 +392,10 @@ namespace com.clusterrr.hakchi_gui.UI.Components
}
foreach (TreeNode tn in e.Node.Nodes)
{
+ if(tn.Tag != null && tn.Tag is NesMiniApplication)
+ {
+ last = tn.Tag as NesMiniApplication;
+ }
if (tn.Checked != e.Node.Checked)
{
tn.Checked = e.Node.Checked;
@@ -395,6 +406,10 @@ namespace com.clusterrr.hakchi_gui.UI.Components
InMassCheck = false;
}
treeView1.EndUpdate();
+ Manager.GameManager.GetInstance().SelectedChangeBatch = false;
+ Manager.EventBus.getInstance().SizeRecalculationRequest();
+
+
}
}
}
diff --git a/hakchi_gui.csproj b/hakchi_gui.csproj
index 3b1302b9..f7ff718d 100644
--- a/hakchi_gui.csproj
+++ b/hakchi_gui.csproj
@@ -133,6 +133,7 @@
<Compile Include="Apps\SmsGame.cs" />
<Compile Include="Apps\SnesGame.cs" />
<Compile Include="Apps\NesUGame.cs" />
+ <Compile Include="Apps\UnknowSystem.cs" />
<Compile Include="Clovershell\ClovershellConnection.cs" />
<Compile Include="Clovershell\ClovershellException.cs" />
<Compile Include="Clovershell\ExecConnection.cs" />