Skip to content

Commit

Permalink
UE4: added UE4.20 support:
Browse files Browse the repository at this point in the history
- different FPackedNormal format (no more offset when decoding uint8 to float, now works as int8 to float)
- changed UTexture2D format (added 3rd dimension, changed offset value from int32 to int64)
  • Loading branch information
gildor2 committed Jul 16, 2018
1 parent 9c29d56 commit 50fc777
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 7 deletions.
1 change: 1 addition & 0 deletions Unreal/GameDatabase.cpp
Expand Up @@ -912,6 +912,7 @@ static const int ue4Versions[] =
VER_UE4_5, VER_UE4_6, VER_UE4_7, VER_UE4_8, VER_UE4_9,
VER_UE4_10, VER_UE4_11, VER_UE4_12, VER_UE4_13, VER_UE4_14,
VER_UE4_15, VER_UE4_16, VER_UE4_17, VER_UE4_18, VER_UE4_19,
VER_UE4_20,
// NEW_ENGINE_VERSION
};

Expand Down
50 changes: 45 additions & 5 deletions Unreal/UnCore.h
Expand Up @@ -395,7 +395,7 @@ enum EGame
GAME_ENGINE = 0xFFF0000 // mask for game engine
};

#define LATEST_SUPPORTED_UE4_VERSION 19 // UE4.XX
#define LATEST_SUPPORTED_UE4_VERSION 20 // UE4.XX

enum EPlatform
{
Expand Down Expand Up @@ -1165,7 +1165,18 @@ struct FPackedNormal

friend FArchive& operator<<(FArchive &Ar, FPackedNormal &N)
{
return Ar << N.Data;
Ar << N.Data;
#if UNREAL4
if (Ar.Game >= GAME_UE4(20))
{
// UE4.20 no longer has offset, it uses conversion from int16 to float instead of uint16 to float
//?? TODO: possible const: FRenderingObjectVersion::IncreaseNormalPrecision
//?? TODO: review, may be use new PackedNormal format for UE code, it is compatible with CPackedNormal
//?? (will need to change CVT function for it)
N.Data ^= 0x80808080;
}
#endif // UNREAL4
return Ar;
}

operator FVector() const
Expand Down Expand Up @@ -1220,7 +1231,19 @@ struct FPackedRGBA16N

friend FArchive& operator<<(FArchive &Ar, FPackedRGBA16N &V)
{
return Ar << V.X << V.Y << V.Z << V.W;
Ar << V.X << V.Y << V.Z << V.W;
if (Ar.Game >= GAME_UE4(20))
{
// UE4.20 no longer has offset, it uses conversion from int16 to float instead of uint16 to float
//?? TODO: possible const: FRenderingObjectVersion::IncreaseNormalPrecision
//?? TODO: review, may be use new PackedNormal format for UE code, it is compatible with CPackedNormal
//?? (will need to change CVT function for it)
V.X ^= 0x8000;
V.Y ^= 0x8000;
V.Z ^= 0x8000;
V.W ^= 0x8000;
}
return Ar;
}
};

Expand Down Expand Up @@ -1341,11 +1364,11 @@ SIMPLE_TYPE(FVector4, float)
SIMPLE_TYPE(FQuat, float)
SIMPLE_TYPE(FCoords, float)
SIMPLE_TYPE(FColor, byte)
SIMPLE_TYPE(FPackedNormal, uint32)
//SIMPLE_TYPE(FPackedNormal, uint32) - has complex serialization

#if UNREAL4

SIMPLE_TYPE(FPackedRGBA16N, uint16)
//SIMPLE_TYPE(FPackedRGBA16N, uint16) - has complex serialization
SIMPLE_TYPE(FIntPoint, int)
SIMPLE_TYPE(FIntVector, int)
SIMPLE_TYPE(FVector2D, float)
Expand Down Expand Up @@ -2435,6 +2458,7 @@ enum
VER_UE4_18 = 514,
VER_UE4_ADDED_PACKAGE_SUMMARY_LOCALIZATION_ID = 516,
VER_UE4_19 = 516,
VER_UE4_20 = 516,
// look for NEW_ENGINE_VERSION over the code to find places where version constants should be inserted.
// LATEST_SUPPORTED_UE4_VERSION should be updated too.
};
Expand All @@ -2460,6 +2484,7 @@ struct FFrameworkObjectVersion
// UE4.17 = 28
// UE4.18 = 30
// UE4.19 = 33
// UE4.20 = 34

VersionPlusOne,
LatestVersion = VersionPlusOne - 1
Expand Down Expand Up @@ -2494,6 +2519,8 @@ struct FFrameworkObjectVersion
return (Type)30;
if (Ar.Game < GAME_UE4(20))
return (Type)33;
if (Ar.Game < GAME_UE4(21))
return (Type)34;
// NEW_ENGINE_VERSION
return LatestVersion;
}
Expand All @@ -2513,6 +2540,7 @@ struct FEditorObjectVersion
// UE4.16 = 17
// UE4.17, UE4.18 = 20
// UE4.19 = 23
// UE4.20 = 24

VersionPlusOne,
LatestVersion = VersionPlusOne - 1
Expand Down Expand Up @@ -2545,6 +2573,8 @@ struct FEditorObjectVersion
return (Type)20;
if (Ar.Game < GAME_UE4(20))
return (Type)23;
if (Ar.Game < GAME_UE4(21))
return (Type)24;
// NEW_ENGINE_VERSION
return LatestVersion;
}
Expand Down Expand Up @@ -2574,6 +2604,7 @@ struct FSkeletalMeshCustomVersion
RemoveDuplicatedClothingSections = 14,
DeprecateSectionDisabledFlag = 15,
// UE4.19 = 15
// UE4.20 = 16

VersionPlusOne,
LatestVersion = VersionPlusOne - 1
Expand Down Expand Up @@ -2603,6 +2634,8 @@ struct FSkeletalMeshCustomVersion
return CompactClothVertexBuffer;
if (Ar.Game < GAME_UE4(20))
return DeprecateSectionDisabledFlag;
if (Ar.Game < GAME_UE4(21))
return (Type)16;
// NEW_ENGINE_VERSION
return LatestVersion;
}
Expand All @@ -2619,6 +2652,8 @@ struct FRenderingObjectVersion
// UE4.17 = 19
// UE4.18 = 20
// UE4.19 = 25
// UE4.20
IncreaseNormalPrecision = 26,

VersionPlusOne,
LatestVersion = VersionPlusOne - 1
Expand Down Expand Up @@ -2651,6 +2686,8 @@ struct FRenderingObjectVersion
return (Type)20;
if (Ar.Game < GAME_UE4(20))
return (Type)25;
if (Ar.Game < GAME_UE4(21))
return IncreaseNormalPrecision;
// NEW_ENGINE_VERSION
return LatestVersion;
}
Expand All @@ -2668,6 +2705,7 @@ struct FAnimPhysObjectVersion
// UE4.18 = 12
AddLODToCurveMetaData = 12,
// UE4.19 = 16
// UE4.20 = 17
VersionPlusOne,
LatestVersion = VersionPlusOne - 1
};
Expand All @@ -2688,6 +2726,8 @@ struct FAnimPhysObjectVersion
return AddLODToCurveMetaData;
if (Ar.Game < GAME_UE4(20))
return (Type)16;
if (Ar.Game < GAME_UE4(21))
return (Type)17;
// NEW_ENGINE_VERSION
return LatestVersion;
}
Expand Down
12 changes: 12 additions & 0 deletions Unreal/UnTexture4.cpp
Expand Up @@ -38,6 +38,11 @@ void FTexture2DMipMap::Serialize4(FArchive &Ar, FTexture2DMipMap& Mip)
//?? with reading 4-byte ints at different locations.
Mip.Data.Serialize(Ar);
Ar << Mip.SizeX << Mip.SizeY;
if (Ar.Game >= GAME_UE4(20))
{
int32 SizeZ;
Ar << SizeZ;
}
if (Ar.ArVer >= VER_UE4_TEXTURE_DERIVED_DATA2 && !cooked)
{
FString DerivedDataKey;
Expand Down Expand Up @@ -144,6 +149,13 @@ void UTexture2D::Serialize4(FArchive& Ar)
{
int32 SkipOffset;
Ar << SkipOffset;
if (Ar.Game >= GAME_UE4(20))
{
int32 SkipOffsetH;
Ar << SkipOffsetH;
assert(SkipOffsetH == 0);
}

EPixelFormat PixelFormat = (EPixelFormat)NameToEnum("EPixelFormat", PixelFormatEnum);

if (Format == PF_Unknown)
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Expand Up @@ -199,8 +199,11 @@ detex

Changes
~~~~~~~
16.07.2018
- updated UE4.20 support

15.07.2018
- make package selection and package version report windows resizable
- package selection and package version report windows are now resizable

11.07.2018
- exporting a .props.txt file next to .mat, it contains all material's properties
Expand Down
2 changes: 1 addition & 1 deletion test.sh
Expand Up @@ -172,7 +172,7 @@ function paragon()
function fortnite()
{
CheckDir C:/3-UnrealEngine/Fortnite/FortniteGame/Content/Paks
run -game=ue4.19 $*
run -game=ue4.20 $*
}
function ue3()
{
Expand Down
Binary file modified umodel
Binary file not shown.
Binary file modified umodel.exe
Binary file not shown.

0 comments on commit 50fc777

Please sign in to comment.