Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement WideString #34

Open
xPaw opened this issue Jan 19, 2021 · 1 comment
Open

Implement WideString #34

xPaw opened this issue Jan 19, 2021 · 1 comment

Comments

@xPaw
Copy link
Member

xPaw commented Jan 19, 2021

CS:GO implements it like this:

// write
{
	int nLength = dat->m_wsValue ? V_wcslen( dat->m_wsValue ) : 0;
	buffer.PutShort( nLength );
	for( int k = 0; k < nLength; ++ k )
	{
		buffer.PutShort( ( unsigned short ) dat->m_wsValue[k] );
	}
	break;
}

// read
{
	int nLength = buffer.GetShort();

	dat->m_wsValue = new wchar_t[nLength + 1];

	for( int k = 0; k < nLength; ++ k )
	{
		dat->m_wsValue[k] = buffer.GetShort();
	}
	dat->m_wsValue[ nLength ] = 0;
	break;
}
@xPaw xPaw added this to Not Started in Key Values 1 via automation Jan 19, 2021
@yaakov-h
Copy link
Member

So its just two bytes for length and then two bytes per char?

Seems simple enough, particularly given that char in .NET is already two bytes wide 😈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Not Started
Key Values 1
  
Not Started
Development

No branches or pull requests

2 participants