SHA256
Localize FFmpeg Download And Driver Warning Dialogs
This commit is contained in:
1 parent
c56175bbc8
commit
abb6f729e4
4 files changed
+69
-23
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
|
using ADOFAIRenderer.Localization;
|
||||||
using ADOFAIRenderer.UI;
|
using ADOFAIRenderer.UI;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -45,18 +46,18 @@ internal class FirstUpdateHook : MonoBehaviour
|
|||||||
var currentVersion = driverVer.Value.ToString("F2");
|
var currentVersion = driverVer.Value.ToString("F2");
|
||||||
|
|
||||||
CommonWarningDialogUI.ShowDialog(
|
CommonWarningDialogUI.ShowDialog(
|
||||||
"NVIDIA Graphics Driver Update Recommended",
|
LocalizationManager.Get("ui.driver_warning.title"),
|
||||||
$"Currently detected NVIDIA graphics driver version: <b><color=#ff5555>{currentVersion}</color></b>\n\nDriver version <b><color=#55ff55>610.00 or higher</color></b> is required to render video using hardware acceleration (NVENC).\n\nIf the driver version is lower, encoding may fail or fallback to software (CPU) encoding, significantly slowing down rendering. Please update your graphics driver.",
|
LocalizationManager.Get("ui.driver_warning.body", currentVersion),
|
||||||
new DialogButton("Update Driver", () =>
|
new DialogButton(LocalizationManager.Get("ui.driver_warning.btn_update"), () =>
|
||||||
{
|
{
|
||||||
Application.OpenURL("https://www.nvidia.com/Download/index.aspx");
|
Application.OpenURL("https://www.nvidia.com/Download/index.aspx");
|
||||||
Application.Quit();
|
Application.Quit();
|
||||||
}, new Color(0.0f, 0.8f, 1.0f, 1.0f)),
|
}, new Color(0.0f, 0.8f, 1.0f, 1.0f)),
|
||||||
new DialogButton("Disable Feature", () =>
|
new DialogButton(LocalizationManager.Get("ui.driver_warning.btn_disable"), () =>
|
||||||
{
|
{
|
||||||
RenderMod.IsFeatureDisabled = true;
|
RenderMod.IsFeatureDisabled = true;
|
||||||
}),
|
}),
|
||||||
new DialogButton("Continue Anyway", () =>
|
new DialogButton(LocalizationManager.Get("ui.driver_warning.btn_continue"), () =>
|
||||||
{
|
{
|
||||||
// ignored
|
// ignored
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -51,5 +51,27 @@
|
|||||||
"ui.render_config.fire_planet": "Fire Planet",
|
"ui.render_config.fire_planet": "Fire Planet",
|
||||||
"ui.render_config.ice_planet": "Ice Planet",
|
"ui.render_config.ice_planet": "Ice Planet",
|
||||||
"ui.render_config.wind_planet": "Wind Planet",
|
"ui.render_config.wind_planet": "Wind Planet",
|
||||||
"ui.render_config.expired": "(Expired)"
|
"ui.render_config.expired": "(Expired)",
|
||||||
|
"ui.ffmpeg_download.title": "FFmpeg Library Installation Required",
|
||||||
|
"ui.ffmpeg_download.desc_required": "FFmpeg shared libraries are required to render video.",
|
||||||
|
"ui.ffmpeg_download.desc_mac_build": "For macOS, reliable public builds are unavailable, so FFmpeg 8.1 must be built manually.",
|
||||||
|
"ui.ffmpeg_download.desc_mac_open": "Click the button below to open the official FFmpeg website.",
|
||||||
|
"ui.ffmpeg_download.desc_download": "Click the button below to automatically download and install from the internet.",
|
||||||
|
"ui.ffmpeg_download.desc_size": "<color=#aaaaaa><size=13>(Download size: ~70MB, extracted to UserLibs folder)</size></color>",
|
||||||
|
"ui.ffmpeg_download.btn_download": "Download & Install",
|
||||||
|
"ui.ffmpeg_download.btn_open_site": "Open Website",
|
||||||
|
"ui.ffmpeg_download.btn_cancel": "Cancel",
|
||||||
|
"ui.ffmpeg_download.btn_retry": "Retry",
|
||||||
|
"ui.ffmpeg_download.status_starting": "Starting download...",
|
||||||
|
"ui.ffmpeg_download.status_downloading": "Downloading... ({0}%)",
|
||||||
|
"ui.ffmpeg_download.status_extracting": "Extracting and copying library files...",
|
||||||
|
"ui.ffmpeg_download.progress_extracting": "Extracting...",
|
||||||
|
"ui.ffmpeg_download.status_complete": "FFmpeg installation complete!",
|
||||||
|
"ui.ffmpeg_download.status_cancelled": "Download was cancelled.",
|
||||||
|
"ui.ffmpeg_download.status_failed": "Installation failed: {0}",
|
||||||
|
"ui.driver_warning.title": "NVIDIA Graphics Driver Update Recommended",
|
||||||
|
"ui.driver_warning.body": "Currently detected NVIDIA graphics driver version: <b><color=#ff5555>{0}</color></b>\n\nDriver version <b><color=#55ff55>610.00 or higher</color></b> is required to render video using hardware acceleration (NVENC).\n\nIf the driver version is lower, encoding may fail or fallback to software (CPU) encoding, significantly slowing down rendering. Please update your graphics driver.",
|
||||||
|
"ui.driver_warning.btn_update": "Update Driver",
|
||||||
|
"ui.driver_warning.btn_disable": "Disable Feature",
|
||||||
|
"ui.driver_warning.btn_continue": "Continue Anyway"
|
||||||
}
|
}
|
||||||
@@ -51,5 +51,27 @@
|
|||||||
"ui.render_config.fire_planet": "불 행성",
|
"ui.render_config.fire_planet": "불 행성",
|
||||||
"ui.render_config.ice_planet": "얼음 행성",
|
"ui.render_config.ice_planet": "얼음 행성",
|
||||||
"ui.render_config.wind_planet": "바람 행성",
|
"ui.render_config.wind_planet": "바람 행성",
|
||||||
"ui.render_config.expired": "(만료됨)"
|
"ui.render_config.expired": "(만료됨)",
|
||||||
|
"ui.ffmpeg_download.title": "FFmpeg 라이브러리 설치 필요",
|
||||||
|
"ui.ffmpeg_download.desc_required": "영상을 렌더링하려면 FFmpeg 공유 라이브러리가 필요해요.",
|
||||||
|
"ui.ffmpeg_download.desc_mac_build": "macOS는 신뢰할 수 있는 공개 빌드가 없어서 FFmpeg 8.1을 직접 빌드해야 해요.",
|
||||||
|
"ui.ffmpeg_download.desc_mac_open": "아래 버튼을 누르면 FFmpeg 공식 웹사이트가 열려요.",
|
||||||
|
"ui.ffmpeg_download.desc_download": "아래 버튼을 누르면 인터넷에서 자동으로 내려받아 설치해요.",
|
||||||
|
"ui.ffmpeg_download.desc_size": "<color=#aaaaaa><size=13>(다운로드 크기: 약 70MB, UserLibs 폴더에 압축 해제)</size></color>",
|
||||||
|
"ui.ffmpeg_download.btn_download": "다운로드 및 설치",
|
||||||
|
"ui.ffmpeg_download.btn_open_site": "웹사이트 열기",
|
||||||
|
"ui.ffmpeg_download.btn_cancel": "취소",
|
||||||
|
"ui.ffmpeg_download.btn_retry": "다시 시도",
|
||||||
|
"ui.ffmpeg_download.status_starting": "다운로드를 시작하는 중...",
|
||||||
|
"ui.ffmpeg_download.status_downloading": "다운로드 중... ({0}%)",
|
||||||
|
"ui.ffmpeg_download.status_extracting": "라이브러리 파일을 압축 해제하고 복사하는 중...",
|
||||||
|
"ui.ffmpeg_download.progress_extracting": "압축 해제 중...",
|
||||||
|
"ui.ffmpeg_download.status_complete": "FFmpeg 설치가 끝났어요!",
|
||||||
|
"ui.ffmpeg_download.status_cancelled": "다운로드가 취소되었어요.",
|
||||||
|
"ui.ffmpeg_download.status_failed": "설치에 실패했어요: {0}",
|
||||||
|
"ui.driver_warning.title": "NVIDIA 그래픽 드라이버 업데이트 권장",
|
||||||
|
"ui.driver_warning.body": "현재 감지된 NVIDIA 그래픽 드라이버 버전: <b><color=#ff5555>{0}</color></b>\n\n하드웨어 가속(NVENC)으로 영상을 렌더링하려면 드라이버 버전 <b><color=#55ff55>610.00 이상</color></b>이 필요해요.\n\n드라이버 버전이 더 낮으면 인코딩이 실패하거나 소프트웨어(CPU) 인코딩으로 바뀌어 렌더링이 훨씬 느려질 수 있어요. 그래픽 드라이버를 업데이트해 주세요.",
|
||||||
|
"ui.driver_warning.btn_update": "드라이버 업데이트",
|
||||||
|
"ui.driver_warning.btn_disable": "기능 끄기",
|
||||||
|
"ui.driver_warning.btn_continue": "그래도 계속"
|
||||||
}
|
}
|
||||||
+17
-16
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using ADOFAIRenderer.Localization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
@@ -128,7 +129,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
_window = O5Window.Create(ctx, bgPanelObj.transform, new O5WindowOptions
|
_window = O5Window.Create(ctx, bgPanelObj.transform, new O5WindowOptions
|
||||||
{
|
{
|
||||||
Id = "RendererMod_FFmpegDownloadDialog",
|
Id = "RendererMod_FFmpegDownloadDialog",
|
||||||
Title = "FFmpeg Library Installation Required",
|
Title = LocalizationManager.Get("ui.ffmpeg_download.title"),
|
||||||
Size = new Vector2(580, 270),
|
Size = new Vector2(580, 270),
|
||||||
Draggable = true,
|
Draggable = true,
|
||||||
Resizable = false,
|
Resizable = false,
|
||||||
@@ -150,16 +151,16 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
// 3. Description text
|
// 3. Description text
|
||||||
var descText = O5Factory.ControlText(ctx, content, 18f, noPad: true);
|
var descText = O5Factory.ControlText(ctx, content, 18f, noPad: true);
|
||||||
var descStrBuilder = new StringBuilder();
|
var descStrBuilder = new StringBuilder();
|
||||||
descStrBuilder.AppendLine("FFmpeg shared libraries are required to render video.");
|
descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_required"));
|
||||||
if (Application.platform == RuntimePlatform.OSXPlayer)
|
if (Application.platform == RuntimePlatform.OSXPlayer)
|
||||||
{
|
{
|
||||||
descStrBuilder.AppendLine("For macOS, reliable public builds are unavailable, so FFmpeg 8.1 must be built manually.");
|
descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_mac_build"));
|
||||||
descStrBuilder.AppendLine("Click the button below to open the official FFmpeg website.");
|
descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_mac_open"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
descStrBuilder.AppendLine("Click the button below to automatically download and install from the internet.");
|
descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_download"));
|
||||||
descStrBuilder.AppendLine("<color=#aaaaaa><size=13>(Download size: ~70MB, extracted to UserLibs folder)</size></color>");
|
descStrBuilder.AppendLine(LocalizationManager.Get("ui.ffmpeg_download.desc_size"));
|
||||||
}
|
}
|
||||||
descText.text = descStrBuilder.ToString();
|
descText.text = descStrBuilder.ToString();
|
||||||
descText.alignment = TextAlignmentOptions.Center;
|
descText.alignment = TextAlignmentOptions.Center;
|
||||||
@@ -196,7 +197,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
parent: _buttonContainerObj.transform,
|
parent: _buttonContainerObj.transform,
|
||||||
onClick: onDownloadClick,
|
onClick: onDownloadClick,
|
||||||
text: Application.platform != RuntimePlatform.OSXPlayer ? "Download & Install" : "Open Website",
|
text: LocalizationManager.Get(Application.platform != RuntimePlatform.OSXPlayer ? "ui.ffmpeg_download.btn_download" : "ui.ffmpeg_download.btn_open_site"),
|
||||||
id: "btn_ffmpeg_download",
|
id: "btn_ffmpeg_download",
|
||||||
height: 40f
|
height: 40f
|
||||||
);
|
);
|
||||||
@@ -211,7 +212,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
parent: _buttonContainerObj.transform,
|
parent: _buttonContainerObj.transform,
|
||||||
onClick: CancelProcess,
|
onClick: CancelProcess,
|
||||||
text: "Cancel",
|
text: LocalizationManager.Get("ui.ffmpeg_download.btn_cancel"),
|
||||||
id: "btn_ffmpeg_cancel",
|
id: "btn_ffmpeg_cancel",
|
||||||
height: 40f
|
height: 40f
|
||||||
);
|
);
|
||||||
@@ -341,7 +342,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
string tempZipPath = "";
|
string tempZipPath = "";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UpdateStatus("Starting download...", new Color(0.8f, 0.8f, 0.8f));
|
UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_starting"), new Color(0.8f, 0.8f, 0.8f));
|
||||||
UpdateProgress(0f, "0%");
|
UpdateProgress(0f, "0%");
|
||||||
|
|
||||||
var userLibsDir = MelonEnvironment.UserLibsDirectory;
|
var userLibsDir = MelonEnvironment.UserLibsDirectory;
|
||||||
@@ -361,19 +362,19 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
var progressReporter = new Progress<float>(percent =>
|
var progressReporter = new Progress<float>(percent =>
|
||||||
{
|
{
|
||||||
UpdateProgress(percent, $"{percent * 100f:F1}%");
|
UpdateProgress(percent, $"{percent * 100f:F1}%");
|
||||||
UpdateStatus($"Downloading... ({(percent * 100f):F1}%)", new Color(0f, 0.8f, 1f));
|
UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_downloading", $"{percent * 100f:F1}"), new Color(0f, 0.8f, 1f));
|
||||||
});
|
});
|
||||||
|
|
||||||
await DownloadFileAsync(DownloadUrl, tempZipPath, progressReporter, _cts.Token);
|
await DownloadFileAsync(DownloadUrl, tempZipPath, progressReporter, _cts.Token);
|
||||||
|
|
||||||
// Extract after download complete
|
// Extract after download complete
|
||||||
UpdateStatus("Extracting and copying library files...", new Color(0.9f, 0.9f, 0.2f));
|
UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_extracting"), new Color(0.9f, 0.9f, 0.2f));
|
||||||
UpdateProgress(0.99f, "Extracting...");
|
UpdateProgress(0.99f, LocalizationManager.Get("ui.ffmpeg_download.progress_extracting"));
|
||||||
|
|
||||||
await ExtractDllsAsync(tempZipPath, userLibsDir);
|
await ExtractDllsAsync(tempZipPath, userLibsDir);
|
||||||
|
|
||||||
// Update completion status
|
// Update completion status
|
||||||
UpdateStatus("FFmpeg installation complete!", new Color(0.2f, 0.9f, 0.2f));
|
UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_complete"), new Color(0.2f, 0.9f, 0.2f));
|
||||||
UpdateProgress(1f, "100%");
|
UpdateProgress(1f, "100%");
|
||||||
|
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
@@ -395,12 +396,12 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateStatus("Download was cancelled.", new Color(0.9f, 0.5f, 0.2f));
|
UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_cancelled"), new Color(0.9f, 0.5f, 0.2f));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Melon<RenderMod>.Logger.Error($"Error during FFmpeg download/installation: {ex}");
|
Melon<RenderMod>.Logger.Error($"Error during FFmpeg download/installation: {ex}");
|
||||||
UpdateStatus($"Installation failed: {ex.Message}", new Color(1f, 0.3f, 0.3f));
|
UpdateStatus(LocalizationManager.Get("ui.ffmpeg_download.status_failed", ex.Message), new Color(1f, 0.3f, 0.3f));
|
||||||
|
|
||||||
// Reset buttons on failure
|
// Reset buttons on failure
|
||||||
ExecuteOnMainThread(() =>
|
ExecuteOnMainThread(() =>
|
||||||
@@ -410,7 +411,7 @@ internal class FFmpegDownloadUI : MonoBehaviour
|
|||||||
var downloadBtnText = _buttonContainerObj.transform.Find("DownloadButton/DownloadText")?.GetComponent<TextMeshProUGUI>();
|
var downloadBtnText = _buttonContainerObj.transform.Find("DownloadButton/DownloadText")?.GetComponent<TextMeshProUGUI>();
|
||||||
if (downloadBtnText)
|
if (downloadBtnText)
|
||||||
{
|
{
|
||||||
downloadBtnText.text = "Retry";
|
downloadBtnText.text = LocalizationManager.Get("ui.ffmpeg_download.btn_retry");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user