Merge branch 'themes-v2' of https://git.ez-pp.farm/EZPPFarm/EZPPLauncher into themes-v2

This commit is contained in:
HorizonCode committed 2026-11-04 22:36:53 +01:00
commit 746524d27e
1 file changed
+31 -13
+31 -13
View File
@@ -265,8 +265,7 @@ pub async fn read_file_chunk(path: String, offset: u64, length: u64) -> Result<V
#[tauri::command]
pub fn get_hwid() -> String {
get_id()
.unwrap_or("recorderinsandybridge".to_string())
get_id().unwrap_or("recorderinsandybridge".to_string())
}
/// Show the native macOS picker, which can select `osu!.app` bundles as files.
@@ -551,7 +550,8 @@ pub async fn get_skins_count(folder: String) -> Option<u64> {
if let Ok(mut entries) = fs::read_dir(skins_folder).await {
while let Ok(Some(entry)) = entries.next_entry().await {
if let Ok(ft) = entry.file_type().await
&& ft.is_dir() {
&& ft.is_dir()
{
let dir_path = entry.path();
let has_ini = tokio::fs::try_exists(dir_path.join("skin.ini"))
.await
@@ -759,7 +759,7 @@ pub async fn run_osu(
#[cfg(windows)]
if optimize {
#[link(name = "winmm")]
extern "system" {
unsafe extern "system" {
fn timeBeginPeriod(uPeriod: u32) -> u32;
}
unsafe {
@@ -906,7 +906,7 @@ pub async fn run_osu(
#[cfg(windows)]
if optimize {
#[link(name = "winmm")]
extern "system" {
unsafe extern "system" {
fn timeEndPeriod(uPeriod: u32) -> u32;
}
unsafe {
@@ -1062,7 +1062,10 @@ pub async fn download_ezpp_launcher_update_files(
#[cfg(target_os = "macos")]
{
let patcher_exe = osu_path.join("EZPPLauncher").join("patcher").join("osu!.patcher.exe");
let patcher_exe = osu_path
.join("EZPPLauncher")
.join("patcher")
.join("osu!.patcher.exe");
if patcher_exe.is_file() {
let _ = crate::utils::ensure_patcher_compatibility(&patcher_exe);
}
@@ -1938,7 +1941,8 @@ pub(crate) fn theme_root() -> Result<PathBuf, String> {
#[cfg(any(target_os = "linux", target_os = "macos"))]
fn loopback_theme_asset_base() -> String {
if crate::theme_server::base_url().is_none()
&& let Ok(root) = theme_root() {
&& let Ok(root) = theme_root()
{
match crate::theme_server::media_root() {
Ok(media) => {
if let Err(error) = crate::theme_server::start(root, media) {
@@ -2097,7 +2101,14 @@ pub async fn optimize_theme_media(app: AppHandle, source_url: String) -> Result<
};
tokio::task::spawn_blocking(move || {
optimize_theme_media_blocking(&ffmpeg, &source, &original, &cache_name, &destination, on_progress)
optimize_theme_media_blocking(
&ffmpeg,
&source,
&original,
&cache_name,
&destination,
on_progress,
)
})
.await
.map_err(|error| format!("Theme media optimizer thread failed: {error}"))?
@@ -2258,8 +2269,11 @@ async fn download_ffmpeg(app: &AppHandle) -> Result<PathBuf, String> {
.await
.map_err(|error| format!("Could not write the FFmpeg archive: {error}"))?;
if let Some(percent) = (received.min(total) * 100).checked_div(total).map(|v| v as u8)
&& percent != last_percent {
if let Some(percent) = (received.min(total) * 100)
.checked_div(total)
.map(|v| v as u8)
&& percent != last_percent
{
last_percent = percent;
let _ = app.emit(
"theme-media-progress",
@@ -2715,8 +2729,11 @@ pub async fn open_presence_editor(app: AppHandle) -> Result<(), String> {
return Ok(());
}
let window =
WebviewWindowBuilder::new(&app, "presence-editor", WebviewUrl::App("index.html".into()))
let window = WebviewWindowBuilder::new(
&app,
"presence-editor",
WebviewUrl::App("index.html".into()),
)
.title("EZPPLauncher — Discord Rich Presence Editor")
.inner_size(1200.0, 800.0)
.min_inner_size(980.0, 650.0)
@@ -3118,7 +3135,8 @@ fn collect_theme_asset_refs(value: &Value, assets: &mut HashSet<String>) {
for (key, value) in object {
if (key == "src" || key == "preview")
&& let Some(src) = value.as_str()
&& let Some(path) = theme_asset_reference(src) {
&& let Some(path) = theme_asset_reference(src)
{
assets.insert(path);
}
collect_theme_asset_refs(value, assets);