diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-07-24 01:37:31 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2018-07-24 01:37:31 +0300 |
commit | 1d18116378d23281c4ba18efb269592780e1b52b (patch) | |
tree | c0904aef1c778a07e0d32a37423908ec7d7df4d9 | |
parent | 66fab6d0bc42f560306fa4cee70d49a343649569 (diff) |
Fix for 'Cant unpack ramdisk' problem
-rw-r--r-- | Apps/NesMiniApplication.cs | 4 | ||||
-rw-r--r-- | FelLib/Fel.cs | 2 | ||||
-rw-r--r-- | WorkerForm.cs | 35 |
3 files changed, 35 insertions, 6 deletions
diff --git a/Apps/NesMiniApplication.cs b/Apps/NesMiniApplication.cs index c5c8c6f5..e5456cd2 100644 --- a/Apps/NesMiniApplication.cs +++ b/Apps/NesMiniApplication.cs @@ -639,7 +639,7 @@ namespace com.clusterrr.hakchi_gui {
if (skipFiles != null && skipFiles.Contains(file.Name))
continue;
- string temppath = System.IO.Path.Combine(destDirName, file.Name);
+ string temppath = Path.Combine(destDirName, file.Name);
size += file.CopyTo(temppath, true).Length;
}
@@ -648,7 +648,7 @@ namespace com.clusterrr.hakchi_gui {
foreach (DirectoryInfo subdir in dirs)
{
- string temppath = System.IO.Path.Combine(destDirName, subdir.Name);
+ string temppath = Path.Combine(destDirName, subdir.Name);
size += DirectoryCopy(subdir.FullName, temppath, copySubDirs, skipFiles);
}
}
diff --git a/FelLib/Fel.cs b/FelLib/Fel.cs index ae60468d..1111d00e 100644 --- a/FelLib/Fel.cs +++ b/FelLib/Fel.cs @@ -399,7 +399,7 @@ namespace com.clusterrr.FelLib public void RunUbootCmd(string command, bool noreturn = false, OnFelProgress callback = null)
{
callback?.Invoke(CurrentAction.RunningCommand, command);
- if (cmdOffset < 0) throw new Exception("Invalid Unoot binary, command variable not found");
+ if (cmdOffset < 0) throw new Exception("Invalid Uboot binary, command variable not found");
const UInt32 testSize = 0x20;
if (UBootBin == null || UBootBin.Length < testSize)
throw new FelException("Can't init Uboot, incorrect Uboot binary");
diff --git a/WorkerForm.cs b/WorkerForm.cs index 24db7e12..c5d1add5 100644 --- a/WorkerForm.cs +++ b/WorkerForm.cs @@ -455,10 +455,33 @@ namespace com.clusterrr.hakchi_gui SetProgress(progress, maxProgress);
}
);
-
var size = CalcKernelSize(kernel);
- if (size == 0 /*|| size > Fel.kernel_max_size*/)
+ if (size == 0)
throw new Exception(Resources.InvalidKernelSize + " " + size);
+
+ if (size > Fel.kernel_max_size) // Weird kernel size? Lets dump it again to avoid "can't unpack ramdisk" error.
+ {
+ SetStatus(Resources.DumpingKernel);
+ maxProgress += 100; // It will take some more time...
+ SetProgress(progress, maxProgress);
+ kernel = fel.ReadFlash(Fel.kernel_base_f, Fel.sector_size * (uint)Math.Ceiling(size * 1.0 / Fel.sector_size),
+ delegate (Fel.CurrentAction action, string command)
+ {
+ switch (action)
+ {
+ case Fel.CurrentAction.RunningCommand:
+ SetStatus(Resources.ExecutingCommand + " " + command);
+ break;
+ case Fel.CurrentAction.ReadingMemory:
+ SetStatus(Resources.DumpingKernel);
+ break;
+ }
+ progress++;
+ SetProgress(progress, maxProgress);
+ }
+ );
+ }
+
if (kernel.Length > size)
{
var sm_kernel = new byte[size];
@@ -1272,8 +1295,14 @@ namespace com.clusterrr.hakchi_gui UnpackRamfs(kernelPath);
if (Directory.Exists(hakchiDirectory))
Directory.Delete(hakchiDirectory, true);
+ string[] skipFiles = includeExtraBinaries ? new string[0] : new string[] { "rsync", "usleep" };
+ foreach(var hugeFile in skipFiles)
+ {
+ foreach (var f in Directory.GetFiles(ramfsDirectory, hugeFile, SearchOption.AllDirectories))
+ File.Delete(f);
+ }
NesMiniApplication.DirectoryCopy(Path.Combine(modsDirectory, Mod), ramfsDirectory, true,
- includeExtraBinaries ? null : new string[] { "rsync", "usleep" }); // Remove huge files
+ skipFiles); // Remove huge files
var ramfsFiles = Directory.GetFiles(ramfsDirectory, "*.*", SearchOption.AllDirectories);
foreach (var file in ramfsFiles)
{
|