mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-25 13:57:45 +00:00
Remove hardcoded "win32" string in repository filename functions
Second part to that recent refactor, so eventually it might be possible to read DATs from other platforms.
This commit is contained in:
parent
e146b31bd4
commit
57d13f0b21
3 changed files with 12 additions and 12 deletions
|
@ -66,3 +66,11 @@ pub enum Platform {
|
|||
PS3,
|
||||
PS4,
|
||||
}
|
||||
|
||||
pub fn get_platform_string(id: &Platform) -> &'static str {
|
||||
match &id {
|
||||
Platform::Win32 => "win32",
|
||||
Platform::PS3 => "ps3.d",
|
||||
Platform::PS4 => "ps4.d",
|
||||
}
|
||||
}
|
10
src/patch.rs
10
src/patch.rs
|
@ -12,7 +12,7 @@ use binrw::BinRead;
|
|||
use binrw::binrw;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use crate::common::{Platform, Region};
|
||||
use crate::common::{get_platform_string, Platform, Region};
|
||||
use crate::sqpack::read_data_block_patch;
|
||||
|
||||
#[binread]
|
||||
|
@ -263,14 +263,6 @@ struct SqpkFileOperationData {
|
|||
path: String,
|
||||
}
|
||||
|
||||
fn get_platform_string(id: &Platform) -> &'static str {
|
||||
match &id {
|
||||
Platform::Win32 => "win32",
|
||||
Platform::PS3 => "ps3.d",
|
||||
Platform::PS4 => "ps4.d",
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(BinRead, PartialEq, Debug)]
|
||||
#[br(big)]
|
||||
struct SqpkTargetInfo {
|
||||
|
|
|
@ -6,7 +6,7 @@ use std::cmp::Ordering::{Greater, Less};
|
|||
use std::path::{Path, PathBuf};
|
||||
use binrw::binrw;
|
||||
|
||||
use crate::common::{Platform, read_version};
|
||||
use crate::common::{get_platform_string, Platform, read_version};
|
||||
use crate::repository::RepositoryType::{Base, Expansion};
|
||||
|
||||
/// The type of repository, discerning game data from expansion data.
|
||||
|
@ -177,7 +177,7 @@ impl Repository {
|
|||
category as i32,
|
||||
self.expansion(),
|
||||
0,
|
||||
"win32"
|
||||
get_platform_string(&self.platform)
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ impl Repository {
|
|||
pub fn dat_filename(&self, category: Category, data_file_id: u32) -> String {
|
||||
let expansion = self.expansion();
|
||||
let chunk = 0;
|
||||
let platform = "win32";
|
||||
let platform = get_platform_string(&self.platform);
|
||||
|
||||
format!(
|
||||
"{:02x}{expansion:02}{chunk:02}.{platform}.dat{data_file_id}",
|
||||
|
|
Loading…
Add table
Reference in a new issue