diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-02-22 17:03:54 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-02-22 17:03:54 +0300 |
commit | 1c110985ebf3c65928ab976de83067149cce2946 (patch) | |
tree | 12a82fa78254ccbe3be13dbe06cc3296ef06b785 | |
parent | dca65b2c83fd8376fc0b20cfb794edb74c96c0a8 (diff) |
More fixes
-rw-r--r-- | MainForm.cs | 17 | ||||
-rw-r--r-- | WorkerForm.cs | 48 | ||||
-rwxr-xr-x | mods/mod_hakchi/hakchi/rootfs/bin/hsqs | 4 | ||||
-rw-r--r-- | mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions | 3 |
4 files changed, 47 insertions, 25 deletions
diff --git a/MainForm.cs b/MainForm.cs index 3f81a305..2480dae2 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -42,6 +42,7 @@ namespace com.clusterrr.hakchi_gui public static ClovershellConnection Clovershell;
mooftpserv.Server ftpServer;
public static bool? DownloadCover;
+ CountResult stats = new CountResult();
static NesDefaultGame[] defaultNesGames = new NesDefaultGame[] {
new NesDefaultGame { Code = "CLV-P-NAAAE", Name = "Super Mario Bros.", Size = 25000 },
@@ -667,7 +668,7 @@ namespace com.clusterrr.hakchi_gui {
try
{
- var stats = RecalculateSelectedGames();
+ stats = RecalculateSelectedGames();
showStats(stats);
}
catch
@@ -716,7 +717,8 @@ namespace com.clusterrr.hakchi_gui return;
}
var maxGamesSize = DefaultMaxGamesSize * 1024 * 1024;
- if (WorkerForm.NandCTotal > 0)
+ var usb = (Control.ModifierKeys == Keys.Shift) || ConfigIni.AlwaysWriteToUSB;
+ if (WorkerForm.NandCTotal > 0 && !usb)
{
maxGamesSize = (WorkerForm.NandCFree + WorkerForm.WritedGamesSize) - WorkerForm.ReservedMemory * 1024 * 1024;
toolStripStatusLabelSize.Text = string.Format("{0:F1}MB / {1:F1}MB", stats.Size / 1024.0 / 1024.0, maxGamesSize / 1024.0 / 1024.0);
@@ -727,9 +729,9 @@ namespace com.clusterrr.hakchi_gui }
toolStripStatusLabelSelected.Text = stats.Count + " " + Resources.GamesSelected;
toolStripProgressBar.Maximum = (int)maxGamesSize;
- toolStripProgressBar.Value = Math.Min((int)stats.Size, toolStripProgressBar.Maximum);
+ toolStripProgressBar.Value = !usb ? Math.Min((int)stats.Size, toolStripProgressBar.Maximum) : 0;
toolStripStatusLabelSize.ForeColor =
- (toolStripProgressBar.Value < toolStripProgressBar.Maximum) ?
+ ((toolStripProgressBar.Value < toolStripProgressBar.Maximum) || usb) ?
SystemColors.ControlText :
Color.Red;
}
@@ -1219,6 +1221,7 @@ namespace com.clusterrr.hakchi_gui private void alwaysWriteGamesToUSBDriveToolStripMenuItem_Click(object sender, EventArgs e)
{
ConfigIni.AlwaysWriteToUSB = alwaysWriteGamesToUSBDriveToolStripMenuItem.Checked;
+ showStats(stats);
buttonStart.Text = (Control.ModifierKeys == Keys.Shift) || ConfigIni.AlwaysWriteToUSB ? Resources.SyncronizeUSB : Resources.Syncronize;
}
@@ -1872,7 +1875,10 @@ namespace com.clusterrr.hakchi_gui private void MainForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.ShiftKey)
+ {
buttonStart.Text = Resources.SyncronizeUSB;
+ showStats(stats);
+ }
if (listViewGames.SelectedItems.Count != 1) return;
var selected = listViewGames.SelectedItems[0].Tag;
if ((e.KeyCode == Keys.E) && (e.Modifiers == (Keys.Alt | Keys.Control)) && (selected is SnesGame))
@@ -1885,7 +1891,10 @@ namespace com.clusterrr.hakchi_gui private void MainForm_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.ShiftKey)
+ {
buttonStart.Text = ConfigIni.AlwaysWriteToUSB ? Resources.SyncronizeUSB : Resources.Syncronize;
+ showStats(stats);
+ }
}
private void MainForm_Activated(object sender, EventArgs e)
diff --git a/WorkerForm.cs b/WorkerForm.cs index db01067d..2b353e90 100644 --- a/WorkerForm.cs +++ b/WorkerForm.cs @@ -1475,34 +1475,42 @@ namespace com.clusterrr.hakchi_gui Debug.WriteLine("Directory: " + directory);
var outputStr = new StringBuilder();
var errorStr = new StringBuilder();
- process.Start();
- var line = new StringBuilder();
- while (!process.HasExited || !process.StandardOutput.EndOfStream || !process.StandardError.EndOfStream)
+ try
{
- while (!process.StandardOutput.EndOfStream)
+ process.Start();
+ var line = new StringBuilder();
+ while (!process.HasExited || !process.StandardOutput.EndOfStream || !process.StandardError.EndOfStream)
{
- var b = process.StandardOutput.Read();
- if (b >= 0)
+ while (!process.StandardOutput.EndOfStream)
{
- if ((char)b != '\n' && (char)b != '\r')
- {
- line.Append((char)b);
- }
- else
+ var b = process.StandardOutput.Read();
+ if (b >= 0)
{
- if (onLineOutput != null && line.Length > 0)
- onLineOutput(line.ToString());
- line.Length = 0;
+ if ((char)b != '\n' && (char)b != '\r')
+ {
+ line.Append((char)b);
+ }
+ else
+ {
+ if (onLineOutput != null && line.Length > 0)
+ onLineOutput(line.ToString());
+ line.Length = 0;
+ }
+ outputStr.Append((char)b);
}
- outputStr.Append((char)b);
}
+ if (!process.StandardError.EndOfStream)
+ errorStr.Append(process.StandardError.ReadToEnd());
+ Thread.Sleep(100);
}
- if (!process.StandardError.EndOfStream)
- errorStr.Append(process.StandardError.ReadToEnd());
- Thread.Sleep(100);
+ if (onLineOutput != null && line.Length > 0)
+ onLineOutput(line.ToString());
+ }
+ catch (ThreadAbortException ex)
+ {
+ if (!process.HasExited) process.Kill();
+ throw ex;
}
- if (onLineOutput != null && line.Length > 0)
- onLineOutput(line.ToString());
output = Encoding.GetEncoding(866).GetBytes(outputStr.ToString());
Debug.WriteLineIf(outputStr.Length > 0 && outputStr.Length < 300, "Output:\r\n" + outputStr);
diff --git a/mods/mod_hakchi/hakchi/rootfs/bin/hsqs b/mods/mod_hakchi/hakchi/rootfs/bin/hsqs index 041654fc..879904c5 100755 --- a/mods/mod_hakchi/hakchi/rootfs/bin/hsqs +++ b/mods/mod_hakchi/hakchi/rootfs/bin/hsqs @@ -19,6 +19,10 @@ save_config [ "$(currentFirmware)" == "$firmware" ] && exit 0 [ "$(currentFirmware)" == "auto" ] && exit 0 #? +state_path="/var/saves/$modname" +state_file="$state_path/menu" +rm -f $state_file + echo "changing firmware to: $firmware" reboot exit 0 diff --git a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions index b29eda8c..af2cbe81 100644 --- a/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions +++ b/mods/mod_hakchi/hakchi/rootfs/etc/preinit.d/b0010_functions @@ -254,14 +254,15 @@ softwareCheck(){ repair_fonts(){ if [ "$sftype" == "nes" ]; then mkdir -p "$1" || return 1 + [ -w "$1" ] || return 1 ( [ $cfg_fontfix_enabled == "y" ] && copy "$rootfs/usr/share/fonts/title.fnt" "$1/" ) || copy "$rootfs$gamepath/title.fnt" "$1/" || copy "$squashfs$gamepath/title.fnt" "$1/" copy "$squashfs$gamepath/copyright.fnt" "$1/" fi } repair_games(){ - [ -w "$1" ] || return 0 [ -f "$1/.repair.flag" ] || return 0 + [ -w "$1" ] || return 1 cat "$rootfs/etc/pleasewait.fb" | gunzip -c - > "/dev/fb0" echo repairing games... local usesymlink='' |