mirror of
https://github.com/Novattz/creamlinux-installer.git
synced 2025-12-06 03:55:37 -05:00
use dynamic DLL matching for SmokeAPI installation
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "creamlinux",
|
"name": "creamlinux",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": "Tickbase",
|
"author": "Tickbase",
|
||||||
"repository": "https://github.com/Novattz/creamlinux-installer",
|
"repository": "https://github.com/Novattz/creamlinux-installer",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "app"
|
name = "app"
|
||||||
version = "1.0.4"
|
version = "1.0.5"
|
||||||
description = "DLC Manager for Steam games on Linux"
|
description = "DLC Manager for Steam games on Linux"
|
||||||
authors = ["tickbase"]
|
authors = ["tickbase"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -1001,27 +1001,48 @@ where
|
|||||||
info!("Created backup: {}", backup_path.display());
|
info!("Created backup: {}", backup_path.display());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Map the Steam API DLL name to the corresponding SmokeAPI DLL name
|
// Determine if we need 32-bit or 64-bit SmokeAPI DLL based on the original Steam API DLL
|
||||||
let smoke_dll_name = match api_name.to_string_lossy().as_ref() {
|
let is_64bit = api_name.to_string_lossy().contains("64");
|
||||||
"steam_api.dll" => "SmokeAPI32.dll",
|
let target_arch = if is_64bit { "64" } else { "32" };
|
||||||
"steam_api64.dll" => "SmokeAPI64.dll",
|
|
||||||
_ => {
|
|
||||||
return Err(InstallerError::InstallationError(format!(
|
|
||||||
"Unknown Steam API DLL: {}",
|
|
||||||
api_name.to_string_lossy()
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Extract the appropriate SmokeAPI DLL and rename it to the original Steam API DLL name
|
// Search through all files in the archive to find the matching SmokeAPI DLL
|
||||||
if let Ok(mut file) = archive.by_name(smoke_dll_name) {
|
let mut found_dll = false;
|
||||||
let mut outfile = fs::File::create(&original_path)?;
|
let mut tried_files = Vec::new();
|
||||||
io::copy(&mut file, &mut outfile)?;
|
let mut matching_dll_name: Option<String> = None;
|
||||||
info!("Installed {} as: {}", smoke_dll_name, original_path.display());
|
|
||||||
} else {
|
// First pass: find the matching DLL name
|
||||||
|
for i in 0..archive.len() {
|
||||||
|
if let Ok(file) = archive.by_index(i) {
|
||||||
|
let file_name = file.name();
|
||||||
|
tried_files.push(file_name.to_string());
|
||||||
|
|
||||||
|
// Check if this is SmokeAPI DLL file with the correct architecture
|
||||||
|
if file_name.to_lowercase().ends_with(".dll")
|
||||||
|
&& file_name.to_lowercase().contains("smoke")
|
||||||
|
&& file_name.contains(target_arch) {
|
||||||
|
|
||||||
|
matching_dll_name = Some(file_name.to_string());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Second pass: extract the matching DLL if found
|
||||||
|
if let Some(dll_name) = matching_dll_name {
|
||||||
|
if let Ok(mut smoke_file) = archive.by_name(&dll_name) {
|
||||||
|
let mut outfile = fs::File::create(&original_path)?;
|
||||||
|
io::copy(&mut smoke_file, &mut outfile)?;
|
||||||
|
info!("Installed {} as: {}", dll_name, original_path.display());
|
||||||
|
found_dll = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !found_dll {
|
||||||
return Err(InstallerError::InstallationError(format!(
|
return Err(InstallerError::InstallationError(format!(
|
||||||
"Could not find {} in the SmokeAPI zip file",
|
"Could not find {}-bit SmokeAPI DLL for {} in the zip file. Archive contains: {}",
|
||||||
smoke_dll_name
|
target_arch,
|
||||||
|
api_name.to_string_lossy(),
|
||||||
|
tried_files.join(", ")
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"productName": "Creamlinux",
|
"productName": "Creamlinux",
|
||||||
"mainBinaryName": "creamlinux",
|
"mainBinaryName": "creamlinux",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"identifier": "com.creamlinux.dev",
|
"identifier": "com.creamlinux.dev",
|
||||||
"app": {
|
"app": {
|
||||||
"withGlobalTauri": false,
|
"withGlobalTauri": false,
|
||||||
|
|||||||
Reference in New Issue
Block a user