Advertisement
Guest User

Untitled

a guest
Sep 7th, 2021
711
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. From f16a2f182c8a7620a6c094dc7cc6418691e342de Mon Sep 17 00:00:00 2001
  2. Date: Tue, 7 Sep 2021 16:21:42 +0200
  3. Subject: [PATCH] Add support for lost ark kr version
  4.  
  5. ---
  6. Unreal/GameDatabase.cpp | 10 ++++++++++
  7. Unreal/GameDefines.h | 3 ++-
  8. Unreal/UnCore.h | 2 ++
  9. Unreal/UnCoreCompression.cpp | 21 ++++++++++++++++++++-
  10. Unreal/UnObject.cpp | 17 +++++++++++++++++
  11. Unreal/UnrealPackage/UnPackage.h | 8 ++++++++
  12. 6 files changed, 59 insertions(+), 2 deletions(-)
  13.  
  14. diff --git a/Unreal/GameDatabase.cpp b/Unreal/GameDatabase.cpp
  15. index 1829d18..bc068b8 100644
  16. --- a/Unreal/GameDatabase.cpp
  17. +++ b/Unreal/GameDatabase.cpp
  18. @@ -350,6 +350,9 @@ const GameInfo GListOfGames[] = {
  19. # if GRAV
  20. G("GRAV", grav, GAME_GRAV),
  21. # endif
  22. +# if LOSTARKKR
  23. + G("Lost Ark (Korean Version)", loakr, GAME_LostArk_KR),
  24. +# endif
  25. #endif // UNREAL3
  26.  
  27. // Unreal engine 4
  28. @@ -814,6 +817,13 @@ void FArchive::DetectGame()
  29. #if GUILTY
  30. if (ArVer == 868 && ArLicenseeVer == 2) SET(GAME_Guilty);
  31. #endif
  32. +#if LOSTARKKR
  33. + if (ArVer == 868 && ArLicenseeVer == 16)
  34. + {
  35. + SET(GAME_LostArk_KR);
  36. + GForceGame = GAME_LostArk_KR;
  37. + }
  38. +#endif
  39. #if ROCKET_LEAGUE
  40. if (ArVer == 868 && (ArLicenseeVer >= 18 && ArLicenseeVer <= 22)) SET(GAME_RocketLeague);
  41. #endif
  42. diff --git a/Unreal/GameDefines.h b/Unreal/GameDefines.h
  43. index 3c5fe09..e1edd2e 100644
  44. --- a/Unreal/GameDefines.h
  45. +++ b/Unreal/GameDefines.h
  46. @@ -135,6 +135,7 @@
  47. #define GRAV 1
  48. #define GEARSU 1 // Gears of War: Ultimate
  49. //#define USE_XDK 1 // use some proprietary code for XBox360 support
  50. +#define LOSTARKKR 1 // Lost Ark Kr Version
  51.  
  52. // Midway UE3 games -- make common define ??
  53. #define A51 1 // Blacksite: Area 51
  54. @@ -172,7 +173,7 @@
  55.  
  56. #endif // UNREAL4
  57.  
  58. -#if GEARS4 || BATMAN || UNREAL4
  59. +#if GEARS4 || BATMAN || UNREAL4 || LOSTARKKR
  60. #define USE_LZ4 1 // LZ4 compression
  61. #endif
  62.  
  63. diff --git a/Unreal/UnCore.h b/Unreal/UnCore.h
  64. index 131cc1b..f8ac75c 100644
  65. --- a/Unreal/UnCore.h
  66. +++ b/Unreal/UnCore.h
  67. @@ -454,6 +454,7 @@ enum EGame
  68. GAME_DevilsThird,
  69. GAME_RocketLeague,
  70. GAME_GRAV,
  71. + GAME_LostArk_KR,
  72.  
  73. GAME_MIDWAY3 = 0x0810000, // variant of UE3
  74. GAME_A51,
  75. @@ -2674,6 +2675,7 @@ struct FIntBulkData : public FByteBulkData
  76. #define COMPRESS_FIND 0xFF // use this flag for appDecompress when exact compression method is not known
  77. #if USE_LZ4
  78. #define COMPRESS_LZ4 0xFE // custom umodel's constant
  79. +#define COMPRESS_LZ4_AES 0xFC // custom umodel's constant
  80. #endif
  81. #if USE_OODLE
  82. #define COMPRESS_OODLE 0xFD // custom umodel's constant
  83. diff --git a/Unreal/UnCoreCompression.cpp b/Unreal/UnCoreCompression.cpp
  84. index 4ebc629..1d5a54e 100644
  85. --- a/Unreal/UnCoreCompression.cpp
  86. +++ b/Unreal/UnCoreCompression.cpp
  87. @@ -402,6 +402,18 @@ int appDecompress(byte *CompressedBuffer, int CompressedSize, byte *Uncompressed
  88. }
  89. #endif // DEVILS_THIRD
  90.  
  91. +#if LOSTARKKR
  92. + if (GForceGame == GAME_LostArk_KR)
  93. + {
  94. + if (Flags == 0x44) {
  95. + Flags = COMPRESS_LZ4_AES;
  96. + }
  97. + else {
  98. + Flags = COMPRESS_LZ4;
  99. + }
  100. + }
  101. +#endif // DEVILS_THIRD
  102. +
  103. if (Flags == COMPRESS_FIND && FoundCompression >= 0)
  104. {
  105. // Do not detect compression multiple times: there were cases (Sea of Thieves) when
  106. @@ -480,8 +492,15 @@ restart_decompress:
  107. }
  108.  
  109. #if USE_LZ4
  110. - if (Flags == COMPRESS_LZ4)
  111. + if (Flags == COMPRESS_LZ4 || Flags == COMPRESS_LZ4_AES)
  112. {
  113. +#if LOSTARKKR
  114. + if (GForceGame == GAME_LostArk_KR && Flags == COMPRESS_LZ4_AES)
  115. + {
  116. + appDecryptAES(CompressedBuffer, 4096, "V1ZEG1PL34V77SQW39A9I4VUW34T6L15", 32);
  117. + }
  118. +#endif
  119. +
  120. int newLen = LZ4_decompress_safe((const char*)CompressedBuffer, (char*)UncompressedBuffer, CompressedSize, UncompressedSize);
  121. if (newLen <= 0)
  122. appError("LZ4_decompress_safe returned %d\n", newLen);
  123. diff --git a/Unreal/UnObject.cpp b/Unreal/UnObject.cpp
  124. index 46f3fe2..a2ea1bd 100644
  125. --- a/Unreal/UnObject.cpp
  126. +++ b/Unreal/UnObject.cpp
  127. @@ -1023,6 +1023,12 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
  128.  
  129. int StopPos = Ar.Tell() + Tag.DataSize; // for verification
  130.  
  131. +#if LOSTARKKR
  132. + if (Ar.Game == GAME_LostArk_KR && Tag.Type == NAME_IntProperty) {
  133. + StopPos += 8;
  134. + }
  135. +#endif
  136. +
  137. const CPropInfo *Prop = FindProperty(Tag.Name);
  138. if (!Prop || Prop->Count == 0) // Prop->Count==0 when declared with PROP_DROP() macro
  139. {
  140. @@ -1039,6 +1045,7 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
  141. appPrintf("WARNING: skipping BoolProperty %s with Tag.Size=%d\n", *Tag.Name, Tag.DataSize);
  142. return;
  143. }
  144. +
  145. // skip property data
  146. Ar.Seek(StopPos);
  147. // serialize other properties
  148. @@ -1115,6 +1122,14 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
  149. CHECK_TYPE(PropType::Int);
  150. Ar << PROP(int);
  151. PROP_DBG("%d", PROP(int));
  152. +#if LOSTARKKR
  153. + if (Ar.Game = GAME_LostArk_KR)
  154. + {
  155. + int unk_1 = 0, unk_2 = 0;
  156. + Ar << unk_1 << unk_2; // Never used ?
  157. + }
  158. +#endif
  159. +
  160. break;
  161.  
  162. case NAME_BoolProperty:
  163. @@ -1364,6 +1379,7 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
  164. appError("Unknown property type %d, name %s", Tag.Type, *Tag.Name);
  165. break;
  166. }
  167. +
  168. // verification
  169. int Pos = Ar.Tell();
  170. if (Pos != StopPos)
  171. @@ -1377,6 +1393,7 @@ void CTypeInfo::ReadUnrealProperty(FArchive& Ar, FPropertyTag& Tag, void* Object
  172. appError("%s\'%s\'.%s: Property read error: %d unread bytes", Name, UObject::GLoadingObj->Name, *Tag.Name, StopPos - Pos);
  173. }
  174.  
  175. +
  176. unguardf("(%s.%s, Type=%d, Size=%d, TagPos=%X)", Name, *Tag.Name, Tag.Type, Tag.DataSize, PropTagPos);
  177. }
  178.  
  179. diff --git a/Unreal/UnrealPackage/UnPackage.h b/Unreal/UnrealPackage/UnPackage.h
  180. index 942456b..87ad9c6 100644
  181. --- a/Unreal/UnrealPackage/UnPackage.h
  182. +++ b/Unreal/UnrealPackage/UnPackage.h
  183. @@ -75,6 +75,14 @@ struct FCompressedChunk
  184. }
  185. #endif // BULLETSTORM
  186.  
  187. +#if LOSTARKKR
  188. + if (Ar.Game == GAME_LostArk_KR)
  189. + {
  190. + int32 unk10; // unused? could be 0 or 1
  191. + Ar << unk10;
  192. + }
  193. +#endif
  194. +
  195. return Ar;
  196.  
  197. unguard;
  198. --
  199. 2.24.1.windows.2
  200.  
  201.  
Advertisement
RAW Paste Data Copied
Advertisement