Fixed linux dependency donwloads, fixed slow download speeds
This commit is contained in:
@@ -37,7 +37,7 @@ namespace SplashEdit.EditorCode
|
|||||||
{
|
{
|
||||||
if (Application.platform == RuntimePlatform.WindowsEditor)
|
if (Application.platform == RuntimePlatform.WindowsEditor)
|
||||||
return Path.Combine(MkpsxisoDir, "mkpsxiso.exe");
|
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);
|
string tempFile = Path.Combine(Path.GetTempPath(), archiveName);
|
||||||
EditorUtility.DisplayProgressBar("Downloading mkpsxiso", "Downloading...", 0.1f);
|
EditorUtility.DisplayProgressBar("Downloading mkpsxiso", "Downloading...", 0.1f);
|
||||||
|
|
||||||
using (var response = await _http.GetAsync(downloadUrl,
|
using (var client = new System.Net.WebClient())
|
||||||
HttpCompletionOption.ResponseHeadersRead))
|
|
||||||
{
|
{
|
||||||
response.EnsureSuccessStatusCode();
|
client.Headers.Add("User-Agent", "SplashEdit/1.0");
|
||||||
long? totalBytes = response.Content.Headers.ContentLength;
|
|
||||||
long downloaded = 0;
|
|
||||||
|
|
||||||
using (var fs = File.Create(tempFile))
|
client.DownloadProgressChanged += (s, e) =>
|
||||||
using (var stream = await response.Content.ReadAsStreamAsync())
|
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[81920];
|
float progress = 0.1f + 0.8f * (e.ProgressPercentage / 100f);
|
||||||
int bytesRead;
|
string sizeMB = $"{e.BytesReceived / (1024 * 1024)}/{e.TotalBytesToReceive / (1024 * 1024)} MB";
|
||||||
while ((bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length)) > 0)
|
EditorUtility.DisplayProgressBar("Downloading mkpsxiso", $"Downloading... {sizeMB}", progress);
|
||||||
{
|
};
|
||||||
await fs.WriteAsync(buffer, 0, bytesRead);
|
|
||||||
downloaded += bytesRead;
|
await client.DownloadFileTaskAsync(new Uri(downloadUrl), tempFile);
|
||||||
if (totalBytes.HasValue)
|
|
||||||
{
|
|
||||||
float progress = (float)downloaded / totalBytes.Value;
|
|
||||||
EditorUtility.DisplayProgressBar("Downloading mkpsxiso",
|
|
||||||
$"{downloaded / 1024}/{totalBytes.Value / 1024} KB", progress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log?.Invoke("Extracting...");
|
log?.Invoke("Extracting...");
|
||||||
@@ -121,7 +109,7 @@ namespace SplashEdit.EditorCode
|
|||||||
|
|
||||||
if (IsInstalled())
|
if (IsInstalled())
|
||||||
{
|
{
|
||||||
// Make executable on Linux/Mac
|
// Make executable on Linux
|
||||||
if (Application.platform != RuntimePlatform.WindowsEditor)
|
if (Application.platform != RuntimePlatform.WindowsEditor)
|
||||||
{
|
{
|
||||||
var chmod = Process.Start("chmod", $"+x \"{MkpsxisoBinary}\"");
|
var chmod = Process.Start("chmod", $"+x \"{MkpsxisoBinary}\"");
|
||||||
|
|||||||
@@ -94,34 +94,20 @@ namespace SplashEdit.EditorCode
|
|||||||
|
|
||||||
// Step 3: Download the file
|
// Step 3: Download the file
|
||||||
string tempFile = Path.Combine(Path.GetTempPath(), $"pcsx-redux-{latestBuildId}.zip");
|
string tempFile = Path.Combine(Path.GetTempPath(), $"pcsx-redux-{latestBuildId}.zip");
|
||||||
|
|
||||||
EditorUtility.DisplayProgressBar("Downloading PCSX-Redux", "Downloading...", 0.1f);
|
EditorUtility.DisplayProgressBar("Downloading PCSX-Redux", "Downloading...", 0.1f);
|
||||||
|
|
||||||
using (var response = await _http.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead))
|
using (var client = new System.Net.WebClient())
|
||||||
{
|
{
|
||||||
response.EnsureSuccessStatusCode();
|
client.Headers.Add("User-Agent", "SplashEdit/1.0");
|
||||||
long? totalBytes = response.Content.Headers.ContentLength;
|
|
||||||
long downloadedBytes = 0;
|
client.DownloadProgressChanged += (s, e) =>
|
||||||
|
|
||||||
using (var fileStream = File.Create(tempFile))
|
|
||||||
using (var downloadStream = await response.Content.ReadAsStreamAsync())
|
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[81920];
|
float progress = 0.1f + 0.8f * (e.ProgressPercentage / 100f);
|
||||||
int bytesRead;
|
string sizeMB = $"{e.BytesReceived / (1024 * 1024)}/{e.TotalBytesToReceive / (1024 * 1024)} MB";
|
||||||
while ((bytesRead = await downloadStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
|
EditorUtility.DisplayProgressBar("Downloading PCSX-Redux", $"Downloading... {sizeMB}", progress);
|
||||||
{
|
};
|
||||||
await fileStream.WriteAsync(buffer, 0, bytesRead);
|
|
||||||
downloadedBytes += bytesRead;
|
|
||||||
|
|
||||||
if (totalBytes.HasValue)
|
await client.DownloadFileTaskAsync(new Uri(downloadUrl), tempFile);
|
||||||
{
|
|
||||||
float progress = (float)downloadedBytes / totalBytes.Value;
|
|
||||||
string sizeMB = $"{downloadedBytes / (1024 * 1024)}/{totalBytes.Value / (1024 * 1024)} MB";
|
|
||||||
EditorUtility.DisplayProgressBar("Downloading PCSX-Redux",
|
|
||||||
$"Downloading... {sizeMB}", progress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log?.Invoke($"Downloaded to {tempFile}");
|
log?.Invoke($"Downloaded to {tempFile}");
|
||||||
@@ -144,6 +130,7 @@ namespace SplashEdit.EditorCode
|
|||||||
};
|
};
|
||||||
var proc = Process.Start(psi);
|
var proc = Process.Start(psi);
|
||||||
proc?.WaitForExit();
|
proc?.WaitForExit();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -151,6 +138,20 @@ namespace SplashEdit.EditorCode
|
|||||||
log?.Invoke($"Extracted to {installDir}");
|
log?.Invoke($"Extracted to {installDir}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make executable
|
||||||
|
|
||||||
|
if(Application.platform == RuntimePlatform.LinuxEditor) {
|
||||||
|
var psi = new ProcessStartInfo
|
||||||
|
{
|
||||||
|
FileName = "chmod",
|
||||||
|
Arguments = $"+x \"{SplashBuildPaths.PCSXReduxBinary}\"",
|
||||||
|
UseShellExecute = false,
|
||||||
|
CreateNoWindow = true
|
||||||
|
};
|
||||||
|
var proc = Process.Start(psi);
|
||||||
|
proc?.WaitForExit();
|
||||||
|
}
|
||||||
|
|
||||||
// Clean up temp file
|
// Clean up temp file
|
||||||
try { File.Delete(tempFile); } catch { }
|
try { File.Delete(tempFile); } catch { }
|
||||||
|
|
||||||
|
|||||||
@@ -74,29 +74,18 @@ namespace SplashEdit.EditorCode
|
|||||||
string tempFile = Path.Combine(Path.GetTempPath(), archiveName);
|
string tempFile = Path.Combine(Path.GetTempPath(), archiveName);
|
||||||
EditorUtility.DisplayProgressBar("Downloading psxavenc", "Downloading...", 0.1f);
|
EditorUtility.DisplayProgressBar("Downloading psxavenc", "Downloading...", 0.1f);
|
||||||
|
|
||||||
using (var response = await _http.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead))
|
using (var client = new System.Net.WebClient())
|
||||||
{
|
{
|
||||||
response.EnsureSuccessStatusCode();
|
client.Headers.Add("User-Agent", "SplashEdit/1.0");
|
||||||
long? totalBytes = response.Content.Headers.ContentLength;
|
|
||||||
long downloaded = 0;
|
|
||||||
|
|
||||||
using (var fs = File.Create(tempFile))
|
client.DownloadProgressChanged += (s, e) =>
|
||||||
using (var stream = await response.Content.ReadAsStreamAsync())
|
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[81920];
|
float progress = 0.1f + 0.8f * (e.ProgressPercentage / 100f);
|
||||||
int bytesRead;
|
string sizeMB = $"{e.BytesReceived / (1024 * 1024)}/{e.TotalBytesToReceive / (1024 * 1024)} MB";
|
||||||
while ((bytesRead = await stream.ReadAsync(buffer, 0, buffer.Length)) > 0)
|
EditorUtility.DisplayProgressBar("Downloading psxavenc", $"Downloading... {sizeMB}", progress);
|
||||||
{
|
};
|
||||||
await fs.WriteAsync(buffer, 0, bytesRead);
|
|
||||||
downloaded += bytesRead;
|
await client.DownloadFileTaskAsync(new Uri(downloadUrl), tempFile);
|
||||||
if (totalBytes.HasValue)
|
|
||||||
{
|
|
||||||
float progress = (float)downloaded / totalBytes.Value;
|
|
||||||
EditorUtility.DisplayProgressBar("Downloading psxavenc",
|
|
||||||
$"{downloaded / 1024}/{totalBytes.Value / 1024} KB", progress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log?.Invoke("Extracting...");
|
log?.Invoke("Extracting...");
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace SplashEdit.EditorCode
|
|||||||
case RuntimePlatform.WindowsEditor:
|
case RuntimePlatform.WindowsEditor:
|
||||||
return Path.Combine(PCSXReduxDir, "pcsx-redux.exe");
|
return Path.Combine(PCSXReduxDir, "pcsx-redux.exe");
|
||||||
case RuntimePlatform.LinuxEditor:
|
case RuntimePlatform.LinuxEditor:
|
||||||
return Path.Combine(ToolsDir, "PCSX-Redux-HEAD-x86_64.AppImage");
|
return Path.Combine(PCSXReduxDir, "PCSX-Redux-HEAD-x86_64.AppImage");
|
||||||
default:
|
default:
|
||||||
return Path.Combine(PCSXReduxDir, "pcsx-redux");
|
return Path.Combine(PCSXReduxDir, "pcsx-redux");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user