correct SmokeAPI DLL name mapping during installation

This commit is contained in:
Novattz
2025-09-12 06:39:36 +02:00
parent a6f21c34b1
commit 653c301ba9

View File

@@ -1001,15 +1001,27 @@ where
info!("Created backup: {}", backup_path.display()); info!("Created backup: {}", backup_path.display());
} }
// Extract the appropriate DLL directly to the game directory // Map the Steam API DLL name to the corresponding SmokeAPI DLL name
if let Ok(mut file) = archive.by_name(&api_name.to_string_lossy()) { let smoke_dll_name = match api_name.to_string_lossy().as_ref() {
"steam_api.dll" => "SmokeAPI32.dll",
"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
if let Ok(mut file) = archive.by_name(smoke_dll_name) {
let mut outfile = fs::File::create(&original_path)?; let mut outfile = fs::File::create(&original_path)?;
io::copy(&mut file, &mut outfile)?; io::copy(&mut file, &mut outfile)?;
info!("Installed SmokeAPI as: {}", original_path.display()); info!("Installed {} as: {}", smoke_dll_name, original_path.display());
} else { } else {
return Err(InstallerError::InstallationError(format!( return Err(InstallerError::InstallationError(format!(
"Could not find {} in the SmokeAPI zip file", "Could not find {} in the SmokeAPI zip file",
api_name.to_string_lossy() smoke_dll_name
))); )));
} }
} }