mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-25 05:47:45 +00:00
Oops, apparently index and patch platform id sizes are different!
This commit is contained in:
parent
2784935409
commit
22569cf09d
3 changed files with 28 additions and 19 deletions
|
@ -37,23 +37,6 @@ pub fn get_language_code(lang: &Language) -> &'static str {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[binrw]
|
|
||||||
#[brw(repr = u16)]
|
|
||||||
#[derive(Debug, PartialEq)]
|
|
||||||
pub enum PlatformId {
|
|
||||||
Windows,
|
|
||||||
PS3,
|
|
||||||
PS4,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_platform_string(id: &PlatformId) -> &'static str {
|
|
||||||
match &id {
|
|
||||||
PlatformId::Windows => "win32",
|
|
||||||
PlatformId::PS3 => "ps3", // TODO: lol are these even correct? i have no idea
|
|
||||||
PlatformId::PS4 => "ps4"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[brw(repr = i16)]
|
#[brw(repr = i16)]
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
|
10
src/index.rs
10
src/index.rs
|
@ -2,7 +2,15 @@ use std::io::SeekFrom;
|
||||||
use binrw::binrw;
|
use binrw::binrw;
|
||||||
use binrw::BinRead;
|
use binrw::BinRead;
|
||||||
use bitfield_struct::bitfield;
|
use bitfield_struct::bitfield;
|
||||||
use crate::common::PlatformId;
|
|
||||||
|
#[binrw]
|
||||||
|
#[brw(repr = u8)]
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
enum PlatformId {
|
||||||
|
Windows,
|
||||||
|
PS3,
|
||||||
|
PS4,
|
||||||
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[br(magic = b"SqPack")]
|
#[br(magic = b"SqPack")]
|
||||||
|
|
20
src/patch.rs
20
src/patch.rs
|
@ -3,10 +3,11 @@ use std::fs::{File, OpenOptions};
|
||||||
use std::io::{Seek, SeekFrom, Write};
|
use std::io::{Seek, SeekFrom, Write};
|
||||||
use binrw::BinRead;
|
use binrw::BinRead;
|
||||||
use binrw::binread;
|
use binrw::binread;
|
||||||
|
use binrw::binrw;
|
||||||
use crate::sqpack::read_data_block_patch;
|
use crate::sqpack::read_data_block_patch;
|
||||||
use core::cmp::min;
|
use core::cmp::min;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use crate::common::{get_platform_string, PlatformId, Region};
|
use crate::common::Region;
|
||||||
|
|
||||||
#[binread]
|
#[binread]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -248,6 +249,23 @@ struct SqpkFileOperationData {
|
||||||
path: String,
|
path: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[binrw]
|
||||||
|
#[brw(repr = u16)]
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
enum PlatformId {
|
||||||
|
Windows,
|
||||||
|
PS3,
|
||||||
|
PS4,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_platform_string(id: &PlatformId) -> &'static str {
|
||||||
|
match &id {
|
||||||
|
PlatformId::Windows => "win32",
|
||||||
|
PlatformId::PS3 => "ps3", // TODO: lol are these even correct? i have no idea
|
||||||
|
PlatformId::PS4 => "ps4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(BinRead, PartialEq, Debug)]
|
#[derive(BinRead, PartialEq, Debug)]
|
||||||
#[br(big)]
|
#[br(big)]
|
||||||
struct SqpkTargetInfo {
|
struct SqpkTargetInfo {
|
||||||
|
|
Loading…
Add table
Reference in a new issue