Skip to content

Commit

Permalink
TextFormatArgumentData64bitSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
scottanderson authored and localcc committed Dec 17, 2024
1 parent 40af662 commit 969c4e3
Show file tree
Hide file tree
Showing 6 changed files with 229 additions and 8 deletions.
Binary file added resources/test/ro_64bit_fav.sav
Binary file not shown.
167 changes: 167 additions & 0 deletions src/custom_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,170 @@ impl_custom_version_trait!(
VER_UE4_12: GatheredTextPackageCacheFixesV1,
VER_UE4_OLDEST_LOADABLE_PACKAGE: BeforeCustomVersionWasAdded
);

/// Custom serialization version for changes made in //UE5/Release-* stream
#[derive(IntoPrimitive)]
#[repr(u32)]
pub enum FUE5ReleaseStreamObjectVersion {
/// Before any version changes were made
BeforeCustomVersionWasAdded = 0,

/// Added Lumen reflections to new reflection enum, changed defaults
ReflectionMethodEnum,

/// Serialize HLOD info in WorldPartitionActorDesc
WorldPartitionActorDescSerializeHLODInfo,

/// Removing Tessellation from materials and meshes.
RemovingTessellation,

/// LevelInstance serialize runtime behavior
LevelInstanceSerializeRuntimeBehavior,

/// Refactoring Pose Asset runtime data structures
PoseAssetRuntimeRefactor,

/// Serialize the folder path of actor descs
WorldPartitionActorDescSerializeActorFolderPath,

/// Change hair strands vertex format
HairStrandsVertexFormatChange,

/// Added max linear and angular speed to Chaos bodies
AddChaosMaxLinearAngularSpeed,

/// PackedLevelInstance version
PackedLevelInstanceVersion,

/// PackedLevelInstance bounds fix
PackedLevelInstanceBoundsFix,

/// Custom property anim graph nodes (linked anim graphs, control rig etc.) now use optional pin manager
CustomPropertyAnimGraphNodesUseOptionalPinManager,

/// Add native double and int64 support to FFormatArgumentData
TextFormatArgumentData64bitSupport,

/// Material layer stacks are no longer considered 'static parameters'
MaterialLayerStacksAreNotParameters,

/// CachedExpressionData is moved from UMaterial to UMaterialInterface
MaterialInterfaceSavedCachedData,

/// Add support for multiple cloth deformer LODs to be able to raytrace cloth with a different LOD than the one it is rendered with
AddClothMappingLODBias,

/// Add support for different external actor packaging schemes
AddLevelActorPackagingScheme,

/// Add support for linking to the attached parent actor in WorldPartitionActorDesc
WorldPartitionActorDescSerializeAttachParent,

/// Converted AActor GridPlacement to bIsSpatiallyLoaded flag
ConvertedActorGridPlacementToSpatiallyLoadedFlag,

/// Fixup for bad default value for GridPlacement_DEPRECATED
ActorGridPlacementDeprecateDefaultValueFixup,

/// PackedLevelActor started using FWorldPartitionActorDesc (not currently checked against but added as a security)
PackedLevelActorUseWorldPartitionActorDesc,

/// Add support for actor folder objects
AddLevelActorFolders,

/// Remove FSkeletalMeshLODModel bulk datas
RemoveSkeletalMeshLODModelBulkDatas,

/// Exclude brightness from the EncodedHDRCubemap,
ExcludeBrightnessFromEncodedHDRCubemap,

/// Unified volumetric cloud component quality sample count slider between main and reflection views for consistency
VolumetricCloudSampleCountUnification,

/// Pose asset GUID generated from source AnimationSequence
PoseAssetRawDataGUID,

/// Convolution bloom now take into account FPostProcessSettings::BloomIntensity for scatter dispersion.
ConvolutionBloomIntensity,

/// Serialize FHLODSubActors instead of FGuids in WorldPartition HLODActorDesc
WorldPartitionHLODActorDescSerializeHLODSubActors,

/// Large Worlds - serialize double types as doubles
LargeWorldCoordinates,

/// Deserialize old BP float&double types as real numbers for pins
BlueprintPinsUseRealNumbers,

/// Changed shadow defaults for directional light components, version needed to not affect old things
UpdatedDirectionalLightShadowDefaults,

/// Refresh geometry collections that had not already generated convex bodies.
GeometryCollectionConvexDefaults,

/// Add faster damping calculations to the cloth simulation and rename previous Damping parameter to LocalDamping.
ChaosClothFasterDamping,

/// Serialize LandscapeActorGuid in FLandscapeActorDesc sub class.
WorldPartitionLandscapeActorDescSerializeLandscapeActorGuid,

/// add inertia tensor and rotation of mass to convex
AddedInertiaTensorAndRotationOfMassAddedToConvex,

/// Storing inertia tensor as vec3 instead of matrix.
ChaosInertiaConvertedToVec3,

/// For Blueprint real numbers, ensure that legacy float data is serialized as single-precision
SerializeFloatPinDefaultValuesAsSinglePrecision,

/// Upgrade the BlendMasks array in existing LayeredBoneBlend nodes
AnimLayeredBoneBlendMasks,

/// Uses RG11B10 format to store the encoded reflection capture data on mobile
StoreReflectionCaptureEncodedHDRDataInRG11B10Format,

/// Add WithSerializer type trait and implementation for FRawAnimSequenceTrack
RawAnimSequenceTrackSerializer,

/// Removed font from FEditableTextBoxStyle, and added FTextBlockStyle instead.
RemoveDuplicatedStyleInfo,

/// Added member reference to linked anim graphs
LinkedAnimGraphMemberReference,

/// Changed default tangent behavior for new dynamic mesh components
DynamicMeshComponentsDefaultUseExternalTangents,

/// Added resize methods to media capture
MediaCaptureNewResizeMethods,

/// Function data stores a map from work to debug operands
RigVMSaveDebugMapInGraphFunctionData,

/// Changed default Local Exposure Contrast Scale from 1.0 to 0.8
LocalExposureDefaultChangeFrom1,

/// Serialize bActorIsListedInSceneOutliner in WorldPartitionActorDesc
WorldPartitionActorDescSerializeActorIsListedInSceneOutliner,

/// Disabled opencolorio display configuration by default
OpenColorIODisabledDisplayConfigurationDefault,

/// Serialize ExternalDataLayerAsset in WorldPartitionActorDesc
WorldPartitionExternalDataLayers,

/// Fix Chaos Cloth fictitious angular scale bug that requires existing parameter rescaling.
ChaosClothFictitiousAngularVelocitySubframeFix,

/// Store physics thread particles data in single precision
SinglePrecisonParticleDataPT,

/// Orthographic Near and Far Plane Auto-resolve enabled by default
OrthographicAutoNearFarPlane,
}

impl_custom_version_trait!(
FUE5ReleaseStreamObjectVersion,
"FUE5ReleaseStreamObjectVersion",
Guid::from_u32([0xD89B5E42, 0x24BD4D46, 0x8412ACA8, 0xDF641779]),
);
59 changes: 51 additions & 8 deletions src/properties/text_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use num_enum::{IntoPrimitive, TryFromPrimitive};
use ordered_float::OrderedFloat;

use crate::custom_version::FEditorObjectVersion;
use crate::custom_version::{FEditorObjectVersion, FUE5ReleaseStreamObjectVersion};
use crate::properties::int_property::UInt64Property;
use crate::properties::struct_types::DateTime;
use crate::types::map::HashableIndexMap;
Expand Down Expand Up @@ -742,6 +742,10 @@ pub enum FormatArgumentValue {
Double(OrderedFloat<f64>),
/// FText
Text(FText),
/// 64-bit integer
Int64(i64),
/// 64-bit unsigned integer
UInt64(u64),
}

impl FormatArgumentValue {
Expand All @@ -754,13 +758,18 @@ impl FormatArgumentValue {
let format_argument_type = cursor.read_enum()?;

Ok(match format_argument_type {
FormatArgumentType::Int => {
// todo: hogwarts legacy support
FormatArgumentValue::Int(cursor.read_i32::<LittleEndian>()?)
}
FormatArgumentType::UInt => {
FormatArgumentValue::UInt(cursor.read_u32::<LittleEndian>()?)
}
FormatArgumentType::Int => match options.supports_version(
FUE5ReleaseStreamObjectVersion::TextFormatArgumentData64bitSupport,
) {
true => FormatArgumentValue::Int64(cursor.read_i64::<LittleEndian>()?),
false => FormatArgumentValue::Int(cursor.read_i32::<LittleEndian>()?),
},
FormatArgumentType::UInt => match options.supports_version(
FUE5ReleaseStreamObjectVersion::TextFormatArgumentData64bitSupport,
) {
true => FormatArgumentValue::UInt64(cursor.read_u64::<LittleEndian>()?),
false => FormatArgumentValue::UInt(cursor.read_u32::<LittleEndian>()?),
},
FormatArgumentType::Float => {
FormatArgumentValue::Float(cursor.read_f32::<LittleEndian>()?.into())
}
Expand All @@ -781,15 +790,49 @@ impl FormatArgumentValue {
) -> Result<usize, Error> {
match self {
FormatArgumentValue::Int(value) => {
assert!(
!options.supports_version(
FUE5ReleaseStreamObjectVersion::TextFormatArgumentData64bitSupport,
),
"FormatArgumentValue::Int is not compatible with TextFormatArgumentData64bitSupport"
);
cursor.write_enum(FormatArgumentType::Int)?;
cursor.write_i32::<LittleEndian>(*value)?;
Ok(5)
}
FormatArgumentValue::Int64(value) => {
assert!(
options.supports_version(
FUE5ReleaseStreamObjectVersion::TextFormatArgumentData64bitSupport,
),
"FormatArgumentValue::Int64 requires TextFormatArgumentData64bitSupport"
);
cursor.write_enum(FormatArgumentType::Int)?;
cursor.write_i64::<LittleEndian>(*value)?;
Ok(9)
}
FormatArgumentValue::UInt(value) => {
assert!(
!options.supports_version(
FUE5ReleaseStreamObjectVersion::TextFormatArgumentData64bitSupport,
),
"FormatArgumentValue::UInt is not compatible with TextFormatArgumentData64bitSupport"
);
cursor.write_enum(FormatArgumentType::UInt)?;
cursor.write_u32::<LittleEndian>(*value)?;
Ok(5)
}
FormatArgumentValue::UInt64(value) => {
assert!(
options.supports_version(
FUE5ReleaseStreamObjectVersion::TextFormatArgumentData64bitSupport,
),
"FormatArgumentValue::UInt64 requires TextFormatArgumentData64bitSupport"
);
cursor.write_enum(FormatArgumentType::UInt)?;
cursor.write_u64::<LittleEndian>(*value)?;
Ok(9)
}
FormatArgumentValue::Float(value) => {
cursor.write_enum(FormatArgumentType::Float)?;
cursor.write_f32::<LittleEndian>(value.0)?;
Expand Down
1 change: 1 addition & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub const PALWORLD_ZLIB_PATH: &str = "resources/test/palworld_zlib.sav";
pub const PALWORLD_ZLIB_TWICE_PATH: &str = "resources/test/palworld_zlib_twice.sav";
pub const PROFILE_0_PATH: &str = "resources/test/Profile_0.sav";
pub const REGRESSION_01_PATH: &str = "resources/test/regression_01.bin";
pub const RO_64BIT_FAV_PATH: &str = "resources/test/ro_64bit_fav.sav";
pub const SAVESLOT_03_PATH: &str = "resources/test/SaveSlot_03.sav";
pub const SLOT1_PATH: &str = "resources/test/Slot1.sav";
pub const SLOT2_PATH: &str = "resources/test/Slot2.sav";
Expand Down
5 changes: 5 additions & 0 deletions tests/gvas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ fn regression_01() {
test_gvas_file(REGRESSION_01_PATH);
}

#[test]
fn ro_64bit_fav() {
test_gvas_file(RO_64BIT_FAV_PATH);
}

#[test]
fn saveslot03() {
assert_eq!(
Expand Down
5 changes: 5 additions & 0 deletions tests/serde_tests/serde_json_round_trip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ fn serde_regression_01() {
test_file(REGRESSION_01_PATH);
}

#[test]
fn serde_ro_64bit() {
test_file(RO_64BIT_FAV_PATH);
}

#[test]
fn serde_saveslot_03() {
test_file_with_hints(SAVESLOT_03_PATH, &saveslot3::hints());
Expand Down

0 comments on commit 969c4e3

Please sign in to comment.