Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into sv_maxusrcmdprocessticks_w…
Browse files Browse the repository at this point in the history
…arning
  • Loading branch information
SergeyShorokhov committed Mar 24, 2024
2 parents ecfe8bb + ec47e4d commit 2f99919
Show file tree
Hide file tree
Showing 19 changed files with 558 additions and 206 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2
uses: microsoft/setup-msbuild@v1.1.3

- name: Build and Run unittests
run: |
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
move msvc\${{ env.buildRelease }}\director.pdb publish\debug\director.pdb
- name: Deploy artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3.1.1
with:
name: win32
path: publish/*
Expand All @@ -92,7 +92,7 @@ jobs:

steps:
- name: Deploying windows artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: win32

Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
shell: bash

- name: Deploy artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3.1.1
id: upload-job
with:
name: linux32
Expand All @@ -247,12 +247,12 @@ jobs:

steps:
- name: Deploying linux artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: linux32

- name: Deploying windows artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: win32

Expand Down
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ You can try playing on one of many servers that are using ReHLDS: [Game Tracker]
</ul>

## How can use it?
ReHLDS is fully compatible with latest official HLDS downloaded by steamcmd. All you have to do is to download rehlds binaries and replace original swds.dll/engine_i486.so. For windows you can also copy a swds.pdb file with a debug information.
<br /><b>Warning!</b> ReHLDS is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool.
ReHLDS is fully compatible with the official pre-anniversary edition of HLDS (engine version <= 8684) downloaded by steamcmd. All you have to do is to download rehlds binaries and replace original swds.dll/engine_i486.so. For windows you can also copy a swds.pdb file with a debug information.

<b>Warning!</b> ReHLDS is not compatible with an old 5xxx or below platforms downloaded by hldsupdatetool.

#### Downloading HLDS via steamcmd

```
app_set_config 90 mod cstrike
app_update 90 -beta steam_legacy validate
```

## Downloads
* [Release builds](https://github.com/dreamstalker/rehlds/releases)
Expand All @@ -31,37 +39,41 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
<details>
<summary>Click to expand</summary>
<ul>
<li>listipcfgfile <filename> // File for permanent ip bans. Default: listip.cfg
<li>syserror_logfile <filename> // File for the system error log. Default: sys_error.log
<li>sv_auto_precache_sounds_in_models <1|0> // Automatically precache sounds attached to models. Deault: 0
<li>sv_delayed_spray_upload <1|0> // Upload custom sprays after entering the game instead of when connecting. It increases upload speed. Default: 0
<li>sv_echo_unknown_cmd <1|0> // Echo in the console when trying execute an unknown command. Default: 0
<li>sv_rcon_condebug <1|0> // Print rcon debug in the console. Default: 1
<li>sv_force_ent_intersection <1|0> // In a 3-rd party plugins used to force colliding of SOLID_SLIDEBOX entities. Default: 0
<li>sv_rehlds_force_dlmax <1|0> // Force a client's cl_dlmax cvar to 1024. It avoids an excessive packets fragmentation. Default: 0
<li>sv_rehlds_hull_centering <1|0> // Use center of hull instead of corner. Default: 0
<li>listipcfgfile &lt;filename&gt; // File for permanent ip bans. Default: listip.cfg
<li>syserror_logfile &lt;filename&gt; // File for the system error log. Default: sys_error.log
<li>sv_auto_precache_sounds_in_models &lt;1|0&gt; // Automatically precache sounds attached to models. Deault: 0
<li>sv_delayed_spray_upload &lt;1|0&gt; // Upload custom sprays after entering the game instead of when connecting. It increases upload speed. Default: 0
<li>sv_echo_unknown_cmd &lt;1|0&gt; // Echo in the console when trying execute an unknown command. Default: 0
<li>sv_rcon_condebug &lt;1|0&gt; // Print rcon debug in the console. Default: 1
<li>sv_force_ent_intersection &lt;1|0&gt; // In a 3-rd party plugins used to force colliding of SOLID_SLIDEBOX entities. Default: 0
<li>sv_rehlds_force_dlmax &lt;1|0&gt; // Force a client's cl_dlmax cvar to 1024. It avoids an excessive packets fragmentation. Default: 0
<li>sv_rehlds_hull_centering &lt;1|0&gt; // Use center of hull instead of corner. Default: 0
<li>sv_rehlds_movecmdrate_max_avg // Max average level of 'move' cmds for ban. Default: 400
<li>sv_rehlds_movecmdrate_avg_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
<li>sv_rehlds_movecmdrate_max_burst // Max burst level of 'move' cmds for ban. Default: 2500
<li>sv_rehlds_movecmdrate_burst_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
<li>sv_rehlds_send_mapcycle <1|0> // Send mapcycle.txt in serverinfo message (HLDS behavior, but it is unused on the client). Default: 0
<li>sv_rehlds_send_mapcycle &lt;1|0&gt; // Send mapcycle.txt in serverinfo message (HLDS behavior, but it is unused on the client). Default: 0
<li>sv_rehlds_stringcmdrate_max_avg // Max average level of 'string' cmds for ban. Default: 80
<li>sv_rehlds_stringcmdrate_avg_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
<li>sv_rehlds_stringcmdrate_max_burst // Max burst level of 'string' cmds for ban. Default: 400
<li>sv_rehlds_stringcmdrate_burst_punish // Time in minutes for which the player will be banned (0 - Permanent, use a negative number for a kick). Default: 5
<li>sv_rehlds_userinfo_transmitted_fields // Userinfo fields only with these keys will be transmitted to clients via network. If not set then all fields will be transmitted (except prefixed with underscore). Each key must be prefixed by backslash, for example "\name\model\*sid\*hltv\bottomcolor\topcolor". See [wiki](https://github.com/dreamstalker/rehlds/wiki/Userinfo-keys) to collect sufficient set of keys for your server. Default: ""
<li>sv_rehlds_attachedentities_playeranimationspeed_fix // Fixes bug with gait animation speed increase when player has some attached entities (aiments). Can cause animation lags when cl_updaterate is low. Default: 0
<li>sv_rehlds_maxclients_from_single_ip // Limit number of connections at the same time from single IP address, not confuse to already connected players. Default: 5
<li>sv_rehlds_local_gametime <1|0> // A feature of local gametime which decrease "lags" if you run same map for a long time. Default: 0
<li>sv_rehlds_local_gametime &lt;1|0&gt; // A feature of local gametime which decrease "lags" if you run same map for a long time. Default: 0
<li>sv_use_entity_file // Use custom entity file for a map. Path to an entity file will be "maps/[map name].ent". 0 - use original entities. 1 - use .ent files from maps directory. 2 - use .ent files from maps directory and create new .ent file if not exist.
<li>sv_usercmd_custom_random_seed // When enabled server will populate an additional random seed independent of the client. Default: 0
<li>sv_tags &lt;comma-delimited string list of tags&gt; // Sets a string defining the "gametags" for this server, this is optional, but if it is set it allows users/scripts to filter in the matchmaking/server-browser interfaces based on the value. Default: ""
</ul>
</details>

## Commands
<ul>
<li>rescount // Prints the total count of precached resources in the server console
<li>reslist &lt;sound | model | decal | generic | event&gt; // Separately prints the details of the precached resources for sounds, models, decals, generic and events in server console. Useful for managing resources and dealing with the goldsource precache limits.
<li>rcon_adduser &lt;ipaddress/CIDR&gt; // Add a new IP address or CIDR range to RCON user list (This command adds a new IP address to the RCON user list. The specified IP or CIDR range is granted privileged access to server console. Without any Rcon users, access is allowed to anyone with a valid password)</li>
<li>rcon_deluser &lt;ipaddress&gt; {removeAll} // Remove an IP address or CIDR range from RCON user list</li>
<li>rcon_users // List all IP addresses and CIDR ranges in RCON user list</li>
</ul>

## Build instructions
Expand Down
14 changes: 5 additions & 9 deletions rehlds/engine/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ void Cbuf_Execute(void)
}

// execute the command line
Cmd_ExecuteString(line, src_command);
if (line[0])
Cmd_ExecuteString(line, src_command);

if (cmd_wait)
{
Expand Down Expand Up @@ -406,17 +407,12 @@ void Cmd_Exec_f(void)
else
{
char *pszDataPtr = configContents;
while (true)
while (pszDataPtr && *pszDataPtr)
{
Cbuf_Execute(); // TODO: This doesn't obey the rule to first execute commands from the file, and then the others in the buffer
pszDataPtr = COM_ParseLine(pszDataPtr); // TODO: COM_ParseLine can be const char*

if (com_token[0] == 0)
{
break;
}

Cbuf_InsertTextLines(com_token);
if (com_token[0])
Cbuf_InsertTextLines(com_token);
}
}

Expand Down
4 changes: 2 additions & 2 deletions rehlds/engine/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,9 @@ void MSG_WriteBitData(void *src, int length)

void MSG_WriteBitAngle(float fAngle, int numbits)
{
if (numbits >= 32)
if (numbits > 22)
{
Sys_Error("%s: Can't write bit angle with 32 bits precision\n", __func__);
Sys_Error("%s: Can't write bit angle with more than 22 bits precision\n", __func__);
}

uint32 shift = (1 << numbits);
Expand Down
69 changes: 30 additions & 39 deletions rehlds/engine/decals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,14 +717,9 @@ NOXREF qboolean Draw_CacheReload(cachewad_t *wad, int i, lumpinfo_t *pLump, cach
qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_t *lump)
{
texture_t tex;
miptex_t *mip;
miptex_t tmp;
int pix;
int pixoffset;
int paloffset;
int palettesize;
int nPalleteCount;
int nSize;
miptex_t *mip, tmp;
int i, pix, paloffset, palettesize;
int size;

if (wad->cacheExtra != DECAL_EXTRASIZE)
{
Expand All @@ -734,58 +729,54 @@ qboolean Draw_ValidateCustomLogo(cachewad_t *wad, unsigned char *data, lumpinfo_

tex = *(texture_t *)data;
mip = (miptex_t *)(data + wad->cacheExtra);
tmp = *mip;

// Copy mip texture data
tmp = *mip;
tex.width = LittleLong(tmp.width);
tex.height = LittleLong(tmp.height);
tex.anim_max = 0;
tex.anim_min = 0;
tex.anim_total = 0;
tex.alternate_anims = NULL;
tex.anim_next = NULL;
tex.anim_total = tex.anim_min = tex.anim_max = 0;
tex.alternate_anims = tex.anim_next = NULL;

if (!tex.width || tex.width > 256 || tex.height > 256)
for (i = 0; i < MIPLEVELS; i++)
tex.offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]);

if (tex.width <= 0 || tex.height <= 0 ||
// Check if texture dimensions exceed limits
tex.width > 256 || tex.height > 256)
{
Con_Printf("%s: Bad wad dimensions %s\n", __func__, wad->name);
Con_Printf("%s: Bad cached wad tex size %ux%u on %s\n", __func__, tex.width, tex.height, wad->name);
return FALSE;
}

for (int i = 0; i < MIPLEVELS; i++)
tex.offsets[i] = wad->cacheExtra + LittleLong(tmp.offsets[i]);

pix = tex.width * tex.height;
pixoffset = pix + (pix >> 2) + (pix >> 4) + (pix >> 6);
size = pix + (pix >> 2) + (pix >> 4) + (pix >> 6);

#ifdef REHLDS_FIXES
// Ensure that pixoffset won't be exceed the pre allocated buffer
// This can happen when there are no color palettes in payload
if ((pixoffset + sizeof(texture_t)) >= (unsigned)(wad->cacheExtra + lump->size))
if ((unsigned)(size + sizeof(miptex_t)) >= (unsigned)(lump->size + wad->cacheExtra))
{
Con_Printf("%s: Bad wad payload size %s\n", __func__, wad->name);
return FALSE;
Con_Printf("%s: Bad cached wad size %i/%i on %s\n", __func__, size + sizeof(miptex_t), lump->size + wad->cacheExtra, wad->name);
}
#endif

paloffset = (pix >> 2) + tmp.offsets[0] + pix;
palettesize = (pix >> 4) + paloffset;
paloffset = size + sizeof(lumpinfo_t) + sizeof(miptex_t);
palettesize = *(u_short *)(data + paloffset); // Get palette size

if ((tmp.offsets[0] + pix != tmp.offsets[1])
|| paloffset != tmp.offsets[2]
|| palettesize != tmp.offsets[3])
for (i = 0; i < 3; i++)
{
Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
return FALSE;
// Check if offsets are valid for mip levels
if (pix + tmp.offsets[i] != tmp.offsets[i + 1])
{
Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
return FALSE;
}
pix >>= 2;
}

nPalleteCount = *(u_short *)(data + pixoffset + sizeof(texture_t));
if (nPalleteCount > 256)
if (palettesize > 256)
{
Con_Printf("%s: Bad cached wad palette size %i on %s\n", __func__, nPalleteCount, wad->name);
Con_Printf("%s: Bad cached wad palette size %i on %s\n", __func__, palettesize, wad->name);
return FALSE;
}

nSize = pixoffset + LittleLong(tmp.offsets[0]) + 3 * nPalleteCount + 2;
if (nSize > lump->disksize)
if ((palettesize + 2 * (palettesize + 1) + size + LittleLong(tmp.offsets[0])) > lump->disksize)
{
Con_Printf("%s: Bad cached wad %s\n", __func__, wad->name);
return FALSE;
Expand Down
2 changes: 0 additions & 2 deletions rehlds/engine/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ typedef struct ipfilter_s
} compare;
float banEndTime;
float banTime;
#ifdef REHLDS_FIXES
int cidr;
#endif // REHLDS_FIXES
} ipfilter_t;

typedef struct userfilter_s
Expand Down
2 changes: 2 additions & 0 deletions rehlds/engine/hashpak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,9 @@ qboolean HPAK_ResourceForHash(char *pakname, unsigned char *hash, struct resourc
fp = FS_Open(name, "rb");
if (!fp)
{
#ifndef REHLDS_FIXES
Con_Printf("ERROR: couldn't open %s.\n", name);
#endif
return FALSE;
}
FS_Read(&header, sizeof(hash_pack_header_t), 1, fp);
Expand Down
4 changes: 4 additions & 0 deletions rehlds/engine/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,11 @@ int Host_Init(quakeparms_t *parms)
else
{
Cvar_RegisterVariable(&suitvolume);
#ifdef REHLDS_FIXES
Cvar_RegisterVariable(&r_cachestudio);
#endif
}

Cbuf_InsertText("exec valve.rc\n");
Hunk_AllocName(0, "-HOST_HUNKLEVEL-");
host_hunklevel = Hunk_LowMark();
Expand Down
Loading

0 comments on commit 2f99919

Please sign in to comment.