Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From f16a2f182c8a7620a6c094dc7cc6418691e342de Mon Sep 17 00:00:00 2001
- Date: Tue, 7 Sep 2021 16:21:42 +0200
- Subject: [PATCH] Add support for lost ark kr version
- ---
- Unreal/GameDatabase.cpp | 10 ++++++++++
- Unreal/GameDefines.h | 3 ++-
- Unreal/UnCore.h | 2 ++
- Unreal/UnCoreCompression.cpp | 21 ++++++++++++++++++++-
- Unreal/UnObject.cpp | 17 +++++++++++++++++
- Unreal/UnrealPackage/UnPackage.h | 8 ++++++++
- 6 files changed, 59 insertions(+), 2 deletions(-)
- diff --git a/Unreal/GameDatabase.cpp b/Unreal/GameDatabase.cpp
- index 1829d18..bc068b8 100644
- --- a/Unreal/GameDatabase.cpp
- +++ b/Unreal/GameDatabase.cpp
- @@ -350,6 +350,9 @@ const GameInfo GListOfGames[] = {
- # if GRAV
- G("GRAV", grav, GAME_GRAV),
- # endif
- +# if LOSTARKKR
- + G("Lost Ark (Korean Version)", loakr, GAME_LostArk_KR),
- +# endif
- #endif // UNREAL3
- // Unreal engine 4
- @@ -814,6 +817,13 @@ void FArchive::DetectGame()
- #if GUILTY
- if (ArVer == 868 && ArLicenseeVer == 2) SET(GAME_Guilty);
- #endif
- +#if LOSTARKKR
- + if (ArVer == 868 && ArLicenseeVer == 16)
- + {
- + SET(GAME_LostArk_KR);
- + GForceGame = GAME_LostArk_KR;
- + }
- +#endif
- #if ROCKET_LEAGUE
- if (ArVer == 868 && (ArLicenseeVer >= 18 && ArLicenseeVer <= 22)) SET(GAME_RocketLeague);
- #endif
- diff --git a/Unreal/GameDefines.h b/Unreal/GameDefines.h
- index 3c5fe09..e1edd2e 100644
- --- a/Unreal/GameDefines.h
- +++ b/Unreal/GameDefines.h
- @@ -135,6 +135,7 @@
- #define GRAV 1
- #define GEARSU 1 // Gears of War: Ultimate
- //#define USE_XDK 1 // use some proprietary code for XBox360 support
- +#define LOSTARKKR 1 // Lost Ark Kr Version
- // Midway UE3 games -- make common define ??
- #define A51 1 // Blacksite: Area 51
- @@ -172,7 +173,7 @@
- #endif // UNREAL4
- -#if GEARS4 || BATMAN || UNREAL4
- +#if GEARS4 || BATMAN || UNREAL4 || LOSTARKKR
- #define USE_LZ4 1 // LZ4 compression
- #endif
- diff --git a/Unreal/UnCore.h b/Unreal/UnCore.h
- index 131cc1b..f8ac75c 100644
- --- a/Unreal/UnCore.h
- +++ b/Unreal/UnCore.h
- @@ -454,6 +454,7 @@ enum EGame
- GAME_DevilsThird,
- GAME_RocketLeague,
- GAME_GRAV,
- + GAME_LostArk_KR,
- GAME_MIDWAY3 = 0x0810000, // variant of UE3
- GAME_A51,
- @@ -2674,6 +2675,7 @@ struct FIntBulkData : public FByteBulkData
- #define COMPRESS_FIND 0xFF // use this flag for appDecompress when exact compression method is not known
- #if USE_LZ4
- #define COMPRESS_LZ4 0xFE // custom umodel's constant
- +#define COMPRESS_LZ4_AES 0xFC // custom umodel's constant
- #endif
- #if USE_OODLE
- #define COMPRESS_OODLE 0xFD // custom umodel's constant
- diff --git a/Unreal/UnCoreCompression.cpp b/Unreal/UnCoreCompression.cpp
- index 4ebc629..1d5a54e 100644
- --- a/Unreal/UnCoreCompression.cpp
- +++ b/Unreal/UnCoreCompression.cpp
- @@ -402,6 +402,18 @@ int appDecompress(byte *CompressedBuffer, int CompressedSize, byte *Uncompressed
- }
- #endif // DEVILS_THIRD
- +#if LOSTARKKR
- + if (GForceGame == GAME_LostArk_KR)
- + {
- + if (Flags == 0x44) {
- + Flags = COMPRESS_LZ4_AES;
- + }
- + else {
- + Flags = COMPRESS_LZ4;
- + }
- + }
- +#endif // DEVILS_THIRD
- +
- if (Flags == COMPRESS_FIND && FoundCompression >= 0)
- {
- // Do not detect compression multiple times: there were cases (Sea of Thieves) when
- @@ -480,8 +492,15 @@ restart_decompress:
- }
- #if USE_LZ4
- - if (Flags == COMPRESS_LZ4)
- + if (Flags == COMPRESS_LZ4 || Flags == COMPRESS_LZ4_AES)
- {
- +#if LOSTARKKR
- + if (GForceGame == GAME_LostArk_KR && Flags == COMPRESS_LZ4_AES)
- + {
- + appDecryptAES(CompressedBuffer, 4096, "V1ZEG1PL34V77SQW39A9I4VUW34T6L15", 32);
- + }
- +#endif
- +
- int newLen = LZ4_decompress_safe((const char*)CompressedBuffer, (char*)UncompressedBuffer, CompressedSize, UncompressedSize);
- if (newLen <= 0)
- appError("LZ4_decompress_safe returned %d\n", newLen);
- diff --git a/Unreal/UnObject.cpp b/Unreal/UnObject.cpp
- index 46f3fe2..a2ea1bd 100644
- --- a/Unreal/UnObject.cpp
- +++ b/Unreal/UnObject.cpp
- @@ -1023,6 +1023,12 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
- int StopPos = Ar.Tell() + Tag.DataSize; // for verification
- +#if LOSTARKKR
- + if (Ar.Game == GAME_LostArk_KR && Tag.Type == NAME_IntProperty) {
- + StopPos += 8;
- + }
- +#endif
- +
- const CPropInfo *Prop = FindProperty(Tag.Name);
- if (!Prop || Prop->Count == 0) // Prop->Count==0 when declared with PROP_DROP() macro
- {
- @@ -1039,6 +1045,7 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
- appPrintf("WARNING: skipping BoolProperty %s with Tag.Size=%d\n", *Tag.Name, Tag.DataSize);
- return;
- }
- +
- // skip property data
- Ar.Seek(StopPos);
- // serialize other properties
- @@ -1115,6 +1122,14 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
- CHECK_TYPE(PropType::Int);
- Ar << PROP(int);
- PROP_DBG("%d", PROP(int));
- +#if LOSTARKKR
- + if (Ar.Game = GAME_LostArk_KR)
- + {
- + int unk_1 = 0, unk_2 = 0;
- + Ar << unk_1 << unk_2; // Never used ?
- + }
- +#endif
- +
- break;
- case NAME_BoolProperty:
- @@ -1364,6 +1379,7 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
- appError("Unknown property type %d, name %s", Tag.Type, *Tag.Name);
- break;
- }
- +
- // verification
- int Pos = Ar.Tell();
- if (Pos != StopPos)
- @@ -1377,6 +1393,7 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
- appError("%s\'%s\'.%s: Property read error: %d unread bytes", Name, UObject::GLoadingObj->Name, *Tag.Name, StopPos - Pos);
- }
- +
- unguardf("(%s.%s, Type=%d, Size=%d, TagPos=%X)", Name, *Tag.Name, Tag.Type, Tag.DataSize, PropTagPos);
- }
- diff --git a/Unreal/UnrealPackage/UnPackage.h b/Unreal/UnrealPackage/UnPackage.h
- index 942456b..87ad9c6 100644
- --- a/Unreal/UnrealPackage/UnPackage.h
- +++ b/Unreal/UnrealPackage/UnPackage.h
- @@ -75,6 +75,14 @@ struct FCompressedChunk
- }
- #endif // BULLETSTORM
- +#if LOSTARKKR
- + if (Ar.Game == GAME_LostArk_KR)
- + {
- + int32 unk10; // unused? could be 0 or 1
- + Ar << unk10;
- + }
- +#endif
- +
- return Ar;
- unguard;
- --
- 2.24.1.windows.2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement