mirror of
https://github.com/redstrate/Miscel.git
synced 2025-05-20 12:07:46 +00:00
Remove installer module
This is no longer used by Astra.
This commit is contained in:
parent
67e12b5ac7
commit
1b71646570
4 changed files with 1 additions and 330 deletions
167
Cargo.lock
generated
167
Cargo.lock
generated
|
@ -28,7 +28,7 @@ dependencies = [
|
||||||
"either",
|
"either",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 1.0.109",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -43,16 +43,6 @@ version = "1.23.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c"
|
checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-expr"
|
|
||||||
version = "0.17.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8d4ba6e40bd1184518716a6e1a781bf9160e286d219ccdb8ab2612e74cfe4789"
|
|
||||||
dependencies = [
|
|
||||||
"smallvec",
|
|
||||||
"target-lexicon",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
@ -71,12 +61,6 @@ version = "1.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "equivalent"
|
|
||||||
version = "1.0.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "half"
|
name = "half"
|
||||||
version = "2.6.0"
|
version = "2.6.0"
|
||||||
|
@ -87,28 +71,6 @@ dependencies = [
|
||||||
"crunchy",
|
"crunchy",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hashbrown"
|
|
||||||
version = "0.15.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "heck"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "indexmap"
|
|
||||||
version = "2.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
|
|
||||||
dependencies = [
|
|
||||||
"equivalent",
|
|
||||||
"hashbrown",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-rs-sys"
|
name = "libz-rs-sys"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
|
@ -118,18 +80,11 @@ dependencies = [
|
||||||
"zlib-rs",
|
"zlib-rs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memchr"
|
|
||||||
version = "2.7.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miscel"
|
name = "miscel"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"physis",
|
"physis",
|
||||||
"system-deps",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -156,12 +111,6 @@ version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
|
checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pkg-config"
|
|
||||||
version = "0.3.32"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.95"
|
version = "1.0.95"
|
||||||
|
@ -180,41 +129,6 @@ dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde"
|
|
||||||
version = "1.0.219"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
|
||||||
dependencies = [
|
|
||||||
"serde_derive",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_derive"
|
|
||||||
version = "1.0.219"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 2.0.101",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_spanned"
|
|
||||||
version = "0.6.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "smallvec"
|
|
||||||
version = "1.15.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.109"
|
version = "1.0.109"
|
||||||
|
@ -226,70 +140,6 @@ dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "2.0.101"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"unicode-ident",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "system-deps"
|
|
||||||
version = "7.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-expr",
|
|
||||||
"heck",
|
|
||||||
"pkg-config",
|
|
||||||
"toml",
|
|
||||||
"version-compare",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "target-lexicon"
|
|
||||||
version = "0.12.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.8.22"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime",
|
|
||||||
"toml_edit",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_datetime"
|
|
||||||
version = "0.6.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3"
|
|
||||||
dependencies = [
|
|
||||||
"serde",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml_edit"
|
|
||||||
version = "0.22.26"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e"
|
|
||||||
dependencies = [
|
|
||||||
"indexmap",
|
|
||||||
"serde",
|
|
||||||
"serde_spanned",
|
|
||||||
"toml_datetime",
|
|
||||||
"winnow",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing"
|
name = "tracing"
|
||||||
version = "0.1.41"
|
version = "0.1.41"
|
||||||
|
@ -315,21 +165,6 @@ version = "1.0.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "version-compare"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winnow"
|
|
||||||
version = "0.7.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6cb8234a863ea0e8cd7284fcdd4f145233eb00fee02bbdd9861aec44e6477bc5"
|
|
||||||
dependencies = [
|
|
||||||
"memchr",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zlib-rs"
|
name = "zlib-rs"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
|
|
12
Cargo.toml
12
Cargo.toml
|
@ -4,17 +4,5 @@ version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
system-deps = "7"
|
|
||||||
|
|
||||||
[package.metadata.system-deps]
|
|
||||||
libunshield = { version = "1.4", feature = "game_install" }
|
|
||||||
|
|
||||||
[features]
|
|
||||||
default = []
|
|
||||||
|
|
||||||
# enables game installation support using unshield (only supported on Linux and macOS)
|
|
||||||
game_install = []
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
physis = { git = "https://github.com/redstrate/Physis" }
|
physis = { git = "https://github.com/redstrate/Physis" }
|
||||||
|
|
148
src/installer.rs
148
src/installer.rs
|
@ -1,148 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
use std::ffi::{CStr, CString, NulError};
|
|
||||||
use std::fs;
|
|
||||||
use std::fs::File;
|
|
||||||
use std::io::Write;
|
|
||||||
use std::os::raw::c_char;
|
|
||||||
|
|
||||||
const FILES_TO_EXTRACT: [&str; 3] = ["data1.cab", "data1.hdr", "data2.cab"];
|
|
||||||
|
|
||||||
const BOOT_COMPONENT_FILES: [&str; 18] = [
|
|
||||||
"cef_license.txt",
|
|
||||||
"FFXIV.ico",
|
|
||||||
"ffxivboot.exe",
|
|
||||||
"ffxivboot.ver",
|
|
||||||
"ffxivboot64.exe",
|
|
||||||
"ffxivconfig.exe",
|
|
||||||
"ffxivconfig64.exe",
|
|
||||||
"ffxivlauncher.exe",
|
|
||||||
"ffxivlauncher64.exe",
|
|
||||||
"ffxivsysinfo.exe",
|
|
||||||
"ffxivsysinfo64.exe",
|
|
||||||
"ffxivupdater.exe",
|
|
||||||
"ffxivupdater64.exe",
|
|
||||||
"FFXIV_sysinfo.ico",
|
|
||||||
"icudt.dll",
|
|
||||||
"libcef.dll",
|
|
||||||
"license.txt",
|
|
||||||
"locales/reserved.txt",
|
|
||||||
];
|
|
||||||
|
|
||||||
const GAME_COMPONENT_FILES: [&str; 1] = ["ffxivgame.ver"];
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
struct Unshield {
|
|
||||||
_private: [u8; 0],
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe extern "C" {
|
|
||||||
fn unshield_open(filename: *const c_char) -> *mut Unshield;
|
|
||||||
fn unshield_close(unshield: *mut Unshield);
|
|
||||||
|
|
||||||
fn unshield_set_log_level(level: i32);
|
|
||||||
|
|
||||||
fn unshield_file_count(unshield: *mut Unshield) -> i32;
|
|
||||||
fn unshield_file_name(unshield: *mut Unshield, index: i32) -> *const c_char;
|
|
||||||
fn unshield_file_save(unshield: *mut Unshield, index: i32, filename: *const c_char) -> bool;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum InstallError {
|
|
||||||
IOFailure,
|
|
||||||
FFIFailure,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<std::io::Error> for InstallError {
|
|
||||||
fn from(_: std::io::Error) -> Self {
|
|
||||||
InstallError::IOFailure
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<NulError> for InstallError {
|
|
||||||
fn from(_: NulError) -> Self {
|
|
||||||
InstallError::FFIFailure
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Installs the game from the provided retail installer.
|
|
||||||
pub fn install_game(installer_path: &str, game_directory: &str) -> Result<(), InstallError> {
|
|
||||||
let installer_file = fs::read(installer_path).unwrap();
|
|
||||||
|
|
||||||
let mut last_position = 0;
|
|
||||||
let mut last_filename = "";
|
|
||||||
for filename in FILES_TO_EXTRACT {
|
|
||||||
let needle = format!("Disk1\\{}", filename);
|
|
||||||
|
|
||||||
let position = installer_file
|
|
||||||
.windows(needle.len())
|
|
||||||
.position(|window| window == needle.as_str().as_bytes());
|
|
||||||
if position == None {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
let position = position.unwrap();
|
|
||||||
|
|
||||||
if last_position != 0 {
|
|
||||||
let mut temp_dir = std::env::temp_dir();
|
|
||||||
temp_dir.push(last_filename);
|
|
||||||
|
|
||||||
let mut new_file = File::create(temp_dir).unwrap();
|
|
||||||
|
|
||||||
if last_filename == "data1.hdr" {
|
|
||||||
new_file.write_all(&installer_file[last_position + 30..position - 42])?;
|
|
||||||
} else {
|
|
||||||
new_file.write_all(&installer_file[last_position + 33..position - 42])?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
last_position = position;
|
|
||||||
last_filename = filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut temp_dir = std::env::temp_dir();
|
|
||||||
temp_dir.push(last_filename);
|
|
||||||
|
|
||||||
let mut new_file = File::create(temp_dir).unwrap();
|
|
||||||
|
|
||||||
new_file.write_all(&installer_file[last_position + 33..installer_file.len() - 42])?;
|
|
||||||
|
|
||||||
fs::create_dir_all(format!("{game_directory}/boot"))?;
|
|
||||||
fs::create_dir_all(format!("{game_directory}/game"))?;
|
|
||||||
|
|
||||||
// set unshield to shut up
|
|
||||||
unsafe { unshield_set_log_level(0) };
|
|
||||||
|
|
||||||
let mut temp_dir = std::env::temp_dir();
|
|
||||||
temp_dir.push("data1.cab");
|
|
||||||
let temp_dir_string = CString::new(temp_dir.to_str().unwrap())?;
|
|
||||||
|
|
||||||
let unshield = unsafe { unshield_open(temp_dir_string.as_ptr()) };
|
|
||||||
let file_count = unsafe { unshield_file_count(unshield) };
|
|
||||||
|
|
||||||
for i in 0..file_count {
|
|
||||||
let filename = unsafe { CStr::from_ptr(unshield_file_name(unshield, i)).to_string_lossy() };
|
|
||||||
|
|
||||||
for boot_name in BOOT_COMPONENT_FILES {
|
|
||||||
if boot_name == filename {
|
|
||||||
let save_filename = format!("{game_directory}/boot/{boot_name}");
|
|
||||||
let save_filename_c = CString::new(save_filename)?;
|
|
||||||
unsafe { unshield_file_save(unshield, i, save_filename_c.as_ptr()) };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for game_name in GAME_COMPONENT_FILES {
|
|
||||||
if game_name == filename {
|
|
||||||
let save_filename = format!("{game_directory}/game/{game_name}");
|
|
||||||
let save_filename_c = CString::new(save_filename)?;
|
|
||||||
unsafe { unshield_file_save(unshield, i, save_filename_c.as_ptr()) };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe {
|
|
||||||
unshield_close(unshield);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
|
@ -4,9 +4,5 @@ pub mod existing_dirs;
|
||||||
/// Reading data from executables
|
/// Reading data from executables
|
||||||
pub mod execlookup;
|
pub mod execlookup;
|
||||||
|
|
||||||
/// Initializing a new retail game install from the official retail installer. No execution required!
|
|
||||||
#[cfg(feature = "game_install")]
|
|
||||||
pub mod installer;
|
|
||||||
|
|
||||||
/// Steam ticket blowfish encryption.
|
/// Steam ticket blowfish encryption.
|
||||||
pub mod blowfish;
|
pub mod blowfish;
|
||||||
|
|
Loading…
Add table
Reference in a new issue