Halflife: [CS 1.6] ScrollTextUp does not form cyrillic pfnConsolePrint argument correctly

Created on 29 Nov 2018  路  5Comments  路  Source: ValveSoftware/halflife

Hi. There's a little problem in the client function ScrollTextUp: the Cyrillic text in the chat can't be printed to console.

int ScrollTextUp()
{
    // ...

    localize = vgui2::localize();
    (*(*localize + 24))(localize, g_sayTextLine, buf, 512);
    pEnd = &buf[strlen(buf)];
    pBuf2 = buf;
    *pEnd = 10;
    chr = buf[0];
    if ( buf[0] )
    {
      pbuf = buf;
      do
      {
        if ( chr > 5 )
          *pBuf2++ = chr;
        chr = *++pbuf;
      }
      while ( *pbuf );
    }
    *pBuf2 = 0;
    gEngfuncs.pfnConsolePrint(buf);

    // ...
}

Obviously, this code should delete characters that are responsible for the color of the text in the chat, however, with these characters it also deletes everything above 127, that is the Cyrillic character table. This is due to the fact that the variable chr has the type signed char. To solve this problem, it is necessary that chr has unsigned char type.

Counter-Strike

Most helpful comment

Hi @2010kohtep, this should be fixed in the current CS beta.

All 5 comments

Any info about fixing this annoying bug?
We still can't read console messages in native language.

I implemented the patcher in the form of an ASI module, which demonstrates the work of the fix by replacing type char with unsigned char of chr variable.

https://github.com/2010kohtep/ScrollTextUpFix

Hi @2010kohtep, this should be fixed in the current CS beta.

Confirm, fixed

image

Fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

magister4813 picture magister4813  路  3Comments

perforatorRU picture perforatorRU  路  3Comments

ArmynC picture ArmynC  路  3Comments

twisterniq picture twisterniq  路  4Comments

twisterniq picture twisterniq  路  4Comments