im looking for a data type.
this might sound a bit strange, so i will try to explain it to you.
i want to write a dll for a game, which reads some memoryvalues.
but strings are stored in a very weird way.
if the length of the string is smaller than 7 the string is directly stored in the object. But if the length of the string is bigger than 6 it is stored as a pointer to the string.
so here is what i do:
i wrote my own class which trys to recreate this behavior: cMyString
it looks like this:
cMyString.h
PHP Code:
#ifndef CMYCLASS_H
#define CMYCLASS_H
class cMyString
{
public:
std::wstring getText();
private:
std::wstring text;
DWORD nothing[3];//to get the right offset for len
int len;
};
#endif
PHP Code:
#include "stdafx.h"
#include "cMyString.h"
std::wstring cMyString::getText()
{
if(len < 7)
{
return text; //i would need to dereference this and make it into a wstring
}else{
return text;//only this works
}
}
e.g. to get the name of the mob: i search the mob's address in memory, cast it to my mob class, and then i add a offset to get to its name and cast this to a cMyString* and try to get the text
PHP Code:
std::wstring cEntity::getName()
{
return ((cMyString*)(this+NameOffset))->getText();
}
So my question is, how could i make it work
or even better
is there already a data type which beheaves like that, because i can hardly believe the game developers made up such a weird data type






