Fixed linux dependency donwloads, fixed slow download speeds

This commit is contained in:
2026-03-28 10:22:10 +01:00
parent a251eeaed5
commit 62bf7d8b2d
4 changed files with 45 additions and 67 deletions

View File

@@ -37,7 +37,7 @@ namespace SplashEdit.EditorCode
{
if (Application.platform == RuntimePlatform.WindowsEditor)
return Path.Combine(MkpsxisoDir, "mkpsxiso.exe");
return Path.Combine(MkpsxisoDir, "mkpsxiso");
return Path.Combine(MkpsxisoDir, "bin", "mkpsxiso");
}
}
@@ -76,30 +76,18 @@ namespace SplashEdit.EditorCode
string tempFile = Path.Combine(Path.GetTempPath(), archiveName);
EditorUtility.DisplayProgressBar("Downloading mkpsxiso", "Downloading...", 0.1f);
using (var response = await _http.GetAsync(downloadUrl,
HttpCompletionOption.ResponseHeadersRead))
using (var client = new System.Net.WebClient())
{
response.EnsureSuccessStatusCode();
long? totalBytes = response.Content.Headers.ContentLength;
long downloaded = 0;
client.Headers.Add("User-Agent", "SplashEdit/1.0");
using (var fs = File.Create(tempFile))
using (var stream = await response.Content.ReadAsStreamAsync())
client.DownloadProgressChanged += (s, e) =>
{
byte[] buffer = new byte[81920];
int bytesRead;
while ((bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length)) > 0)
{
await fs.WriteAsync(buffer, 0, bytesRead);
downloaded += bytesRead;
if (totalBytes.HasValue)
{
float progress = (float)downloaded / totalBytes.Value;
EditorUtility.DisplayProgressBar("Downloading mkpsxiso",
$"{downloaded / 1024}/{totalBytes.Value / 1024} KB", progress);
}
}
}
float progress = 0.1f + 0.8f * (e.ProgressPercentage / 100f);
string sizeMB = $"{e.BytesReceived / (1024 * 1024)}/{e.TotalBytesToReceive / (1024 * 1024)} MB";
EditorUtility.DisplayProgressBar("Downloading mkpsxiso", $"Downloading... {sizeMB}", progress);
};
await client.DownloadFileTaskAsync(new Uri(downloadUrl), tempFile);
}
log?.Invoke("Extracting...");
@@ -121,7 +109,7 @@ namespace SplashEdit.EditorCode
if (IsInstalled())
{
// Make executable on Linux/Mac
// Make executable on Linux
if (Application.platform != RuntimePlatform.WindowsEditor)
{
var chmod = Process.Start("chmod", $"+x \"{MkpsxisoBinary}\"");