UKismetStringLibrary
Added 2023-06-18 18:49:42 +0000 UTCUnreal Engine's UKismetStringLibrary offers an array of functions for manipulating FString objects. FString is an internal data type used to store wide-char characters as arrays. Unlike C++ strings, FString length encompasses the null terminator, effectively increasing the string length by one. This functionality is particularly relevant in reverse engineering. An example FString "Hello" has a size of 6 (5 characters + 1 null terminator), leading to a total allocated byte count of 12.
Complete tutorial here: Unreal Engine's UKismetStringLibrary
UKismetStringLibrary Functions
The library has a plethora of functions for FString manipulation. A particularly noteworthy function is Conv_StringToName, which converts an FString object to an FName object. If the FName is already in existence, the function returns its number. If not, a new FName is generated. Additional key functions are listed and elaborated in the Unreal Engine documentation, such as GetFNameFromString and FreeFString.
Managing FString Objects
Creating your own FString in Lua is fairly simple. This requires allocation of memory and writing a Unicode string. Memory must be deallocated before code execution stops to prevent memory leaks in the target process. Two methods for this process are provided in the tutorial. The first method uses the allocated memory as the FString object, and the second method stores memory as wchar_t* in a Lua-table.
Utility of the Library
With UKismetStringLibrary, FString creation, modification, and freeing become straightforward tasks. The GetFNameFromString function is invaluable in converting FString to FName when a NameProperty or FName is needed to invoke a function or overwrite a class field. In addition, UKismetStringLibrary plays a crucial role in generating and reading FText objects in the UKismetTextLibrary. Therefore, a comprehensive understanding of this library can substantially boost your prowess in using Unreal Engine and its applications in reverse engineering.
More Unreal Engine
- Unreal Engine Game Hacking Megathread
- Unreal Engine Object Spawner
- How to Use WorldToScreen in Unreal Engine Games
- How to Find what Unreal Engine Version a Game Uses
- Unreal Engine SDK Dumping Tutorial
- Unreal Engine Doc: UGameplayStatics