halflife icon indicating copy to clipboard operation
halflife copied to clipboard

[GoldSource|CS 1.6] Fix avatar's on small resolution

Open afwn90cj93201nixr2e1re opened this issue 7 years ago • 48 comments

//unicode patch for console
			HexReplaceInLibrary("cstrike/cl_dlls/client.dll", "7ECC880A", "76CC880A", 0xCC, 0);
			//www x 768<= tab avatar fixes
			HexReplaceInLibrary("cstrike/cl_dlls/client.dll", "817C24CC00030000", "817C24CC01000000", 0xCC, 0); 
			HexReplaceInLibrary("cstrike/cl_dlls/client.dll", "3D000300CC8B4424CC", "3D010000CC8B4424CC", 0xCC, 0);
			//wad files download fix			
			HexReplaceInLibrary("hw.dll", "1885C07403C600008D85", "1885C07414C600008D85", 0, 0);
			//GetHullBounds Fix
			HexReplaceInLibrary("hw.dll", "8B4C240433C02BC87406497403497505B801000000C3", "837C240401750B8B44240CC7400800000042B001C3C3", 0, 0);

related to Scorebar. https://hastebin.com/rilekuyijo.php

afwn90cj93201nixr2e1re avatar Apr 20 '19 15:04 afwn90cj93201nixr2e1re

I guess developers need more information on how to fix this problem.

The game will not show player avatars if the height of the game window is less than 768 pixels. According to many, this is a very large number and you need to reduce it or remove this check at all.

The fix is required in the following functions:

  • CCSClientScoreBoardDialog::AddHeader
  • CCSClientScoreBoardDialog::AddSection
  • CCSClientScoreBoardDialog::UpdatePlayerInfo
  • CCSClientScoreBoardDialog::UpdatePlayerAvatar

kohtep avatar Apr 20 '19 15:04 kohtep

void PatchStuff()
{
    // Patch Unicode
    uintptr_t ptr = (clso_addr + clso_st["_Z12ScrollTextUpv"])+0x1D2;
    auto nint = *(uint8_t *)ptr;
    modify_1((void*)ptr, 0x76, PAGE_EXECUTE_READWRITE);
    nint = *(uint8_t *)ptr;
    // Patch avatars
    ptr = (clso_addr + clso_st["_ZN25CCSClientScoreBoardDialog16UpdatePlayerInfoEv"])+0x140;
    //ConsolePrintColor(0, 255,0, ">>>%d\n", *(uint32_t *)ptr);
    modify_4((void*)ptr, 1, PAGE_EXECUTE_READWRITE);
    ptr = (clso_addr + clso_st["_ZN25CCSClientScoreBoardDialog11ShowAvatarsEv"])+0x27;
    modify_4((void*)ptr, 1, PAGE_EXECUTE_READWRITE);
    ptr = (clso_addr + clso_st["_ZN25CCSClientScoreBoardDialog9AddHeaderEv"])+0xAA;
    modify_4((void*)ptr, 1, PAGE_EXECUTE_READWRITE);
    ptr = (clso_addr + clso_st["_ZN25CCSClientScoreBoardDialog10AddSectionEii"])+0x1BB;
    modify_4((void*)ptr, 1, PAGE_EXECUTE_READWRITE);
    ptr = (clso_addr + clso_st["_ZN25CCSClientScoreBoardDialog10AddSectionEii"])+0x475;
    modify_4((void*)ptr, 1, PAGE_EXECUTE_READWRITE);
    ptr = (clso_addr + clso_st["_ZN25CCSClientScoreBoardDialog18UpdatePlayerAvatarEiP9KeyValues"])+0x54;
    modify_4((void*)ptr, 1, PAGE_EXECUTE_READWRITE);
}
void cOffset::modify_1(void *addr, uint8_t hexCode, int prot) {
    addr = (void *)(((int)addr) & (-2));
    ProtectAddr((void *)addr, PROT_READ | PROT_WRITE);
    *(uint8_t *)addr = hexCode;
    ProtectAddr((void *)addr, prot );
}

void cOffset::modify_2(void *addr, uint16_t hexCode, int prot) {
    addr = (void *)(((int)addr) & (-2));
    ProtectAddr((void *)addr, PROT_READ | PROT_WRITE);
    *(uint16_t *)addr = hexCode;
    ProtectAddr((void *)addr, prot );
}

void cOffset::modify_4(void *addr, uint32_t hexCode, int prot) {
    addr = (void *)(((int)addr) & (-2));
    ProtectAddr((void *)addr, PROT_READ | PROT_WRITE);
    *(uint32_t *)addr = hexCode;
    ProtectAddr((void *)addr, prot );
}

@mikela-valve there simple fix.

afwn90cj93201nixr2e1re avatar Apr 20 '19 15:04 afwn90cj93201nixr2e1re

Thank's, waiting for fix.

afwn90cj93201nixr2e1re avatar Apr 20 '19 15:04 afwn90cj93201nixr2e1re

This is added as of beta 8279. See my post here.

mikela-valve avatar Jun 26 '19 03:06 mikela-valve

Im gonna test it in few day's. Wait please.

afwn90cj93201nixr2e1re avatar Jun 26 '19 07:06 afwn90cj93201nixr2e1re

resolution 640x480 when on server 24 or less players avatars looks good, when 25 and more is not centered

20190626171222_1 20190626171251_1 20190626171309_1

dager10 avatar Jun 26 '19 14:06 dager10

@dager10 It's actually not centered in any of those, it just looks a bit better with the larger icon when the line height is larger. It's currently using a fixed amount of space for the avatar that doesn't vary with the line height, so when the lines are smaller the avatar is smaller as well and so sits more to the right in the column. I'll probably just make the avatar column dynamically size based on the line height so it always looks centered.

mikela-valve avatar Jul 02 '19 22:07 mikela-valve

This should look better in beta build 8279.

mikela-valve avatar Jul 08 '19 21:07 mikela-valve

According to my observations, avatars of players are displayed correctly at high and medium resolutions, but at low resolutions such as 800x600 or 640x480 avatars continue to shift only for spectators. Example below on gif: asd

Splatt581 avatar Jul 09 '19 15:07 Splatt581

Thanks @Splatt581. Spectator rows are handled differently from T/CT rows and I'd missed updating the initial width of the column for them. That should be fixed in the next update.

mikela-valve avatar Jul 09 '19 17:07 mikela-valve

This should be fixed in the current beta. It did not require a full build so the build number is still 8279.

mikela-valve avatar Jul 10 '19 02:07 mikela-valve

Problem with shift of avatars in spectator rows is still exists in latest beta build.

Splatt581 avatar Jul 10 '19 18:07 Splatt581

Ok, this is actually fixed now in beta. I had tested this in CS:CZ after the last fix and it seems that CZ handles the scoreboard differently than CS does so I didn't notice that CS still had the issue. Thanks @Splatt581!

mikela-valve avatar Jul 11 '19 01:07 mikela-valve

I confirm, fixed.

Splatt581 avatar Jul 11 '19 12:07 Splatt581

Tested. This is bad fix. @mikela-valve

afwn90cj93201nixr2e1re avatar Jul 12 '19 07:07 afwn90cj93201nixr2e1re

How to disable avatars altogether?

BUXPb avatar Jul 12 '19 15:07 BUXPb

How to disable avatars altogether?

Why do you want to disable them?

twisterniq avatar Jul 12 '19 17:07 twisterniq

Tits, pussies and other things that I see on avatars make it difficult to concentrate on the game.

BUXPb avatar Jul 12 '19 17:07 BUXPb

@BUXPb That's a good question. Now that avatars are enabled for all screen sizes there's no way around having them there. I'm adding another cvar that you can use to disable them if you'd like either to avoid distraction or to have more space in the scoreboard.

scoreboard_showavatars will be 1 by default and 0 to disable showing avatars.

mikela-valve avatar Jul 12 '19 22:07 mikela-valve

I'm adding another cvar that you can use to disable them if you'd like either to avoid distraction or to have more space in the scoreboard.

And then u ask about unnecessary cvars. No one game have this cvar, cs 1.6 also shouldnt, if he wanna play without avatar's he must download nonsteam version or smthng like that, and steam also have lil protection agains tits and dicks on avatars.

So. Ur solution is bad. Don't make avatar sizes fixed. They shown nice at 640x480, 800x600 and etc with dynamic size, just replace 768 to 0, and all. That's better. 2 - 10 player's on server, medium size, more player's avatar sizes automaticaly reduce to small and etc.

afwn90cj93201nixr2e1re avatar Jul 13 '19 08:07 afwn90cj93201nixr2e1re