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-03-18 04:41:54 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-03-18 04:41:54 +0300
commitd1227b9af15cbf3fc8d09c1af0945b06457ef727 (patch)
tree3691c3e74603532ec41129fbbe65739bb0fda755 /MainForm.cs
parent24d29a664710d19107b23a3430995daf648c54ff (diff)
NES/Famicom autodetection
Diffstat (limited to 'MainForm.cs')
-rw-r--r--MainForm.cs44
1 files changed, 33 insertions, 11 deletions
diff --git a/MainForm.cs b/MainForm.cs
index e88837a3..18508874 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -93,17 +93,6 @@ namespace com.clusterrr.hakchi_gui
{
InitializeComponent();
ConfigIni.Load();
- Clovershell = new ClovershellConnection() { AutoReconnect = true, Enabled = true };
-#if DEBUG
- try
- {
- Clovershell.ShellEnabled = true;
- }
- catch (Exception ex)
- {
- Debug.WriteLine(ex.Message + ex.StackTrace);
- }
-#endif
BaseDirectory = Path.GetDirectoryName(Application.ExecutablePath);
KernelDump = Path.Combine(Path.Combine(BaseDirectory, "dump"), "kernel.img");
LoadGames();
@@ -165,6 +154,19 @@ namespace com.clusterrr.hakchi_gui
new Thread(NesGame.LoadCache).Start();
// Recalculate games in background
new Thread(RecalculateSelectedGamesThread).Start();
+
+ Clovershell = new ClovershellConnection() { AutoReconnect = true, Enabled = true };
+ Clovershell.OnConnected += Clovershell_OnConnected;
+#if DEBUG
+ try
+ {
+ Clovershell.ShellEnabled = true;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex.Message + ex.StackTrace);
+ }
+#endif
}
catch (Exception ex)
{
@@ -173,6 +175,26 @@ namespace com.clusterrr.hakchi_gui
}
}
+ void Clovershell_OnConnected()
+ {
+ try
+ {
+ var region = Clovershell.ExecuteSimple("cat /etc/clover/REGION", 500, true);
+ if (region == "JPN")
+ Invoke(new Action(delegate {
+ famicomMiniToolStripMenuItem.PerformClick();
+ }));
+ if (region == "EUR_USA")
+ Invoke(new Action(delegate {
+ nESMiniToolStripMenuItem.PerformClick();
+ }));
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine(ex.Message + ex.StackTrace);
+ }
+ }
+
public void LoadGames()
{
Debug.WriteLine("Loading games");