| Deleted User | where did you find the class names? |
| Deleted User | does the engine have some sort of reflection like unreal engine? |
| AdrienTD | The class names were the more interesting and ground breaking parts 😃 |
| AdrienTD | There are some class names left in the EXE |
| AdrienTD | And that's because the engine has some way to identify classes |
| AdrienTD | When the game is started, it will run several code that will register these classes. |
| AdrienTD | |
| AdrienTD | For example this will call a function that will register the class CKSpeechManager. |
| AdrienTD | The first two arguments are IDs for this call. |
| AdrienTD | So the game can refer to a class by their ID, which is the case in the game files. |
| AdrienTD | Also it associates to the class functions that will create an instance of this class, and functions to destroy ones, which happen to be the same for all classes (DestroyKCL1/2 in the screenshot) |
| AdrienTD | Actually, the destructor just calls the virtual destructor from the vft. |
| AdrienTD | Also all the registered classes are subclasses to a common class. In my XXL inspector I call it KClass:
```C++
struct KClass {
virtual void destructor_placeholder() = 0;
virtual char isSubclass(int cls) = 0;
virtual void unknown1() = 0;
#if XXLVER >= 2
virtual void unknown2() = 0;
#endif
virtual int getClassGroup() = 0;
virtual int getClassID() = 0;
}
``` |
| Deleted User | yeah it's similar in unreal engine |
| AdrienTD | I have never used Unreal Engine, but nice to learn this. |
| AdrienTD | The KClass also has virtual functions for saving and loading from KWN files. |
| AdrienTD | So often KWN files are just files containing serialized instances of these registered classes. |
| Deleted User | https://www.unrealengine.com/en-US/blog/unreal-property-system-reflection |
| AdrienTD | Looks more complicated in Unreal than in XXL 😄 |
| AdrienTD | I see Unreal also has names for data members and functions |