0xa1baa1baa1baa1ba on Nostr: ``` static EFunctionMangleType COM_DetectMangleType( const char *str ) { // Itanium ...
```
static EFunctionMangleType COM_DetectMangleType( const char *str )
{
// Itanium C++ ABI mangling always start with _Z
// namespaces start with N, therefore _ZN
if( !Q_strncmp( str, "_ZN", 3 ) )
return MANGLE_ITANIUM;
// MSVC C++ mangling always start with ? and have
if( str[0] == '?' && Q_strstr( str, "@@" ))
return MANGLE_MSVC;
// allow offsets, we just silently ignore them on conversion
if( !Q_strncmp( str, "ofs:", 4 ))
return MANGLE_OFFSET;
// don't get confused by MSVC C mangling
if( str[0] != '@' && Q_strchr( str, '@' ))
return MANGLE_VALVE;
// not technically an error
return MANGLE_UNKNOWN;
}
```
maybe this detection is incorrect but it works for making Half-Life saves crossplatform
static EFunctionMangleType COM_DetectMangleType( const char *str )
{
// Itanium C++ ABI mangling always start with _Z
// namespaces start with N, therefore _ZN
if( !Q_strncmp( str, "_ZN", 3 ) )
return MANGLE_ITANIUM;
// MSVC C++ mangling always start with ? and have
if( str[0] == '?' && Q_strstr( str, "@@" ))
return MANGLE_MSVC;
// allow offsets, we just silently ignore them on conversion
if( !Q_strncmp( str, "ofs:", 4 ))
return MANGLE_OFFSET;
// don't get confused by MSVC C mangling
if( str[0] != '@' && Q_strchr( str, '@' ))
return MANGLE_VALVE;
// not technically an error
return MANGLE_UNKNOWN;
}
```
maybe this detection is incorrect but it works for making Half-Life saves crossplatform