2023-08-06 08:25:04 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2024-04-20 13:18:03 -04:00
|
|
|
use hmac_sha512::Hash;
|
|
|
|
use physis::patch::apply_patch;
|
2022-08-16 11:52:07 -04:00
|
|
|
use std::env;
|
2024-04-20 11:13:40 -04:00
|
|
|
use std::fs::{read, read_dir};
|
2023-09-22 19:17:24 -04:00
|
|
|
use std::process::Command;
|
2022-07-19 19:29:41 -04:00
|
|
|
|
2024-04-15 19:40:34 -04:00
|
|
|
use physis::common::Platform;
|
2023-08-06 08:25:04 -04:00
|
|
|
use physis::fiin::FileInfo;
|
|
|
|
use physis::index;
|
2024-04-20 13:18:03 -04:00
|
|
|
use std::collections::HashMap;
|
|
|
|
use std::path::{Path, PathBuf};
|
2023-08-06 08:25:04 -04:00
|
|
|
|
2022-07-19 19:29:41 -04:00
|
|
|
#[test]
|
2022-07-27 20:58:12 -04:00
|
|
|
#[cfg_attr(not(feature = "retail_game_testing"), ignore)]
|
2022-07-19 19:29:41 -04:00
|
|
|
fn test_index_read() {
|
|
|
|
let game_dir = env::var("FFXIV_GAME_DIR").unwrap();
|
|
|
|
|
2022-08-16 11:52:07 -04:00
|
|
|
index::IndexFile::from_existing(
|
|
|
|
format!("{}/game/sqpack/ffxiv/000000.win32.index", game_dir).as_str(),
|
|
|
|
);
|
2022-07-19 19:29:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2022-07-27 20:58:12 -04:00
|
|
|
#[cfg_attr(not(feature = "retail_game_testing"), ignore)]
|
2022-07-19 19:29:41 -04:00
|
|
|
fn test_gamedata_extract() {
|
|
|
|
let game_dir = env::var("FFXIV_GAME_DIR").unwrap();
|
|
|
|
|
2024-04-20 13:18:03 -04:00
|
|
|
let mut gamedata = physis::gamedata::GameData::from_existing(
|
|
|
|
Platform::Win32,
|
|
|
|
format!("{}/game", game_dir).as_str(),
|
|
|
|
)
|
|
|
|
.unwrap();
|
|
|
|
|
2022-07-19 19:29:41 -04:00
|
|
|
assert!(gamedata.extract("exd/root.exl").is_some());
|
2022-08-16 11:52:07 -04:00
|
|
|
}
|
2022-10-13 15:45:23 -04:00
|
|
|
|
2022-10-20 11:44:54 -04:00
|
|
|
#[test]
|
|
|
|
#[cfg_attr(not(feature = "retail_game_testing"), ignore)]
|
|
|
|
fn test_fiin() {
|
|
|
|
let game_dir = env::var("FFXIV_GAME_DIR").unwrap();
|
|
|
|
|
|
|
|
let fiin_path = format!("{game_dir}/boot/fileinfo.fiin");
|
|
|
|
let fiin = FileInfo::from_existing(&read(fiin_path).unwrap()).unwrap();
|
|
|
|
|
2022-10-20 11:45:55 -04:00
|
|
|
assert_eq!(fiin.entries[0].file_name, "steam_api.dll");
|
|
|
|
assert_eq!(fiin.entries[1].file_name, "steam_api64.dll");
|
2022-10-20 11:44:54 -04:00
|
|
|
}
|