diff --git a/M2TWEOP Code/M2TWEOP library/realGameTypes.h b/M2TWEOP Code/M2TWEOP library/realGameTypes.h index 39f92a10..efec3c44 100644 --- a/M2TWEOP Code/M2TWEOP library/realGameTypes.h +++ b/M2TWEOP Code/M2TWEOP library/realGameTypes.h @@ -40,15 +40,38 @@ ReturnType callClassFunc(ClassType instance, const DWORD offset, TArgs ... args) struct basicStringGame { - char pad[0x1C]; + char pad[0x4]; + union + { + char* long_string; + char short_string[16]; + }; + int stringLength; + int stringCapacity; public: + char* getData () + { + if (stringCapacity < 16) + return short_string; + return long_string; + } + std::string getString() { - return *reinterpret_cast(this); + const char* str = getData(); + return {str}; } + void setString(const std::string& str) { - *reinterpret_cast(this) = str; + if (stringCapacity < 16) + { + strcpy(short_string, str.c_str()); + } + else + { + strcpy(long_string, str.c_str()); + } } }; diff --git a/M2TWEOP Code/M2TWEOP library/types/unit.h b/M2TWEOP Code/M2TWEOP library/types/unit.h index 382309af..2ef5b2a9 100644 --- a/M2TWEOP Code/M2TWEOP library/types/unit.h +++ b/M2TWEOP Code/M2TWEOP library/types/unit.h @@ -1280,7 +1280,8 @@ struct eduEntry { return ""; if (modelEntry->skeletons.empty()) return ""; - return modelEntry->skeletons[0].primary.getString(); + std::string name = modelEntry->skeletons[0].primary.getString(); + return name; } std::string getSecondaryAnim() @@ -1289,7 +1290,8 @@ struct eduEntry { return ""; if (modelEntry->skeletons.empty()) return ""; - return modelEntry->skeletons[0].secondary.getString(); + std::string name = modelEntry->skeletons[0].secondary.getString(); + return name; } bool getIsLegio() {