Compare commits

...

10 Commits

Author SHA1 Message Date
Roflmuffin
20bab7f4a8 feat: add PrintToCenterAlert player helper 2024-04-29 20:14:58 +10:00
Roflmuffin
c7eac71109 feat: add generic math operators to Vector 2024-04-29 00:56:00 +10:00
Roflmuffin
e3d2370e2e chore: use IDA style sigs for gamedata 2024-04-28 13:57:07 +10:00
Roflmuffin
142242744c chore: update give named item sig for linux 2024-04-28 09:44:51 +10:00
Nukoooo
0eebffd860 Copy bytes of a module to prevent signature scanning failures and some minor changes (#414)
Co-authored-by: Michael Wilson <roflmuffin@users.noreply.github.com>
2024-04-27 10:44:42 +00:00
Michael Wilson
25ca5dbe0c chore: use offsets for give named item (#427) 2024-04-27 19:56:07 +10:00
Nexd
7cae4be96d Fix: new game update broke signatures (#425)
Co-authored-by: KillStr3aK <KillStr3aK@users.noreply.github.com>
Co-authored-by: Roflmuffin <shortguy014@gmail.com>
2024-04-26 16:29:38 +10:00
Nexd
83bc1a95fb Make shared type loader less strict (#424)
Co-authored-by: KillStr3aK <KillStr3aK@users.noreply.github.com>
2024-04-26 10:26:39 +10:00
roflmuffin
71c694b52e [no ci] add windows install script 2024-04-14 13:25:43 +10:00
Michael Wilson
a452d79ba3 [no ci] feat: add install script 2024-04-14 12:58:24 +10:00
32 changed files with 102136 additions and 101919 deletions

View File

@@ -2,22 +2,22 @@
"UTIL_ClientPrintAll": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x08\\x48\\x89\\x6C\\x24\\x10\\x48\\x89\\x74\\x24\\x18\\x57\\x48\\x81\\xEC\\x70\\x01\\x2A\\x2A\\x8B\\xE9",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xD7\\x41\\x56\\x49\\x89\\xF6\\x41\\x55\\x41\\x89\\xFD"
"windows": "48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 81 EC 70 01 ? ? 8B E9",
"linux": "55 48 89 E5 41 57 49 89 D7 41 56 49 89 F6 41 55 41 89 FD"
}
},
"ClientPrint": {
"signatures": {
"library": "server",
"windows": "\\x48\\x85\\xC9\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\x48\\x8B\\xC4\\x48\\x89\\x58\\x18",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xCF\\x41\\x56\\x49\\x89\\xD6\\x41\\x55\\x41\\x89\\xF5\\x41\\x54\\x4C\\x8D\\xA5\\xA0\\xFE\\xFF\\xFF"
"windows": "48 85 C9 0F 84 ? ? ? ? 48 8B C4 48 89 58 18",
"linux": "55 48 89 E5 41 57 49 89 CF 41 56 49 89 D6 41 55 41 89 F5 41 54 4C 8D A5 A0 FE FF FF"
}
},
"CCSPlayerController_SwitchTeam": {
"signatures": {
"library": "server",
"windows": "\\x40\\x56\\x57\\x48\\x81\\xEC\\x2A\\x2A\\x2A\\x2A\\x48\\x8B\\xF9\\x8B\\xF2\\x8B\\xCA",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x55\\x49\\x89\\xFD\\x89\\xF7"
"windows": "40 56 57 48 81 EC ? ? ? ? 48 8B F9 8B F2 8B CA",
"linux": "55 48 89 E5 41 55 49 89 FD 89 F7"
}
},
"CCSPlayerController_ChangeTeam": {
@@ -28,110 +28,116 @@
},
"CCSPlayerController_Respawn": {
"offsets": {
"windows": 244,
"linux": 246
"windows": 244,
"linux": 246
}
},
"CBasePlayerController_SetPawn": {
"signatures": {
"library": "server",
"windows": "\\x44\\x88\\x4C\\x24\\x20\\x55\\x57\\x41\\x54\\x41\\x56\\x41\\x57\\x48\\x8D\\x6C\\x24\\x2A\\x48\\x81\\xEC\\x2A",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x89\\xF3\\x48\\x81\\xEC\\xC8\\x00\\x00\\x00"
"windows": "44 88 4C 24 20 55 57 41 54 41 56 41 57 48 8D 6C 24 ? 48 81 EC ?",
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 89 F3 48 81 EC C8 00 00 00"
}
},
"CCSPlayerPawnBase_PostThink": {
"signatures": {
"library": "server",
"windows": "\\x48\\x8B\\xC4\\x48\\x89\\x48\\x08\\x55\\x53\\x56\\x57\\x41\\x56\\x48\\x8D\\xA8\\xD8\\xFE\\xFF\\xFF",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x53\\x48\\x89\\xFB\\x48\\x81\\xEC\\x2A\\x2A\\x2A\\x2A\\xE8\\x2A\\x2A\\x2A\\x2A\\x48\\x89\\xDF"
"windows": "48 ? ? 55 53 56 57 41 ? 48 ? ? ? 48 ? ? ? ? ? ? 4C 89 68",
"linux": "55 48 89 E5 41 56 41 55 41 54 53 48 89 FB 48 83 EC 30 E8 ? ? ? ?"
}
},
"GiveNamedItem": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x18\\x48\\x89\\x74\\x24\\x20\\x55\\x57\\x41\\x54\\x41\\x56\\x41\\x57\\x48\\x8D\\x6C\\x24\\xD9",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\xCE\\x41\\x55\\x49\\x89\\xF5\\x41\\x54\\x49\\x89\\xD4"
"windows": "48 89 5C 24 ? 48 89 74 24 ? 55 57 41 ? 41 ? 41 ? 48 ? ? ? ? 48 ? ? ? ? ? ? 4D ? ? 48",
"linux": "55 48 89 E5 41 57 41 56 49 89 D6 41 55 49 89 FD 41 54 48"
}
},
"UTIL_Remove": {
"signatures": {
"library": "server",
"windows": "\\x48\\x85\\xC9\\x74\\x2A\\x48\\x8B\\xD1\\x48\\x8B\\x0D\\x2A\\x2A\\x2A\\x2A",
"linux": "\\x48\\x89\\xFE\\x48\\x85\\xFF\\x74\\x2A\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A\\x48"
"windows": "48 85 C9 74 ? 48 8B D1 48 8B 0D ? ? ? ?",
"linux": "48 89 FE 48 85 FF 74 ? 48 8D 05 ? ? ? ? 48"
}
},
"Host_Say": {
"signatures": {
"library": "server",
"windows": "\\x44\\x89\\x4C\\x24\\x20\\x44\\x88\\x44\\x24\\x18",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xFF\\x41\\x56\\x41\\x55\\x41\\x54\\x4D\\x89\\xC4"
"windows": "44 89 4C 24 20 44 88 44 24 18",
"linux": "55 48 89 E5 41 57 49 89 FF 41 56 41 55 41 54 4D 89 C4"
}
},
"CBaseModelEntity_SetModel": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x2A\\x48\\x89\\x7C\\x24\\x2A\\x55\\x48\\x8B\\xEC\\x48\\x83\\xEC\\x50\\x48\\x8B\\xF9\\x4C\\x8B\\xC2",
"linux": "\\x55\\x48\\x89\\xF2\\x48\\x89\\xE5\\x41\\x54\\x49\\x89\\xFC\\x48\\x8D\\x7D\\xE0\\x48\\x83\\xEC\\x2A\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A\\x48\\x8B\\x30\\x48\\x8B\\x06"
"library": "server",
"windows": "48 89 5C 24 ? 48 89 7C 24 ? 55 48 8B EC 48 83 EC 50 48 8B F9 4C 8B C2",
"linux": "55 48 89 F2 48 89 E5 41 54 49 89 FC 48 8D 7D E0 48 83 EC ? 48 8D 05 ? ? ? ? 48 8B 30 48 8B 06"
}
},
"CCSPlayer_WeaponServices_CanUse": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x10\\x48\\x89\\x6C\\x24\\x18\\x56\\x57\\x41\\x56\\x48\\x83\\xEC\\x30\\x80\\xB9\\xA0\\x00\\x00\\x00\\x00",
"linux": "\\x48\\x85\\xF6\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\x55\\x31\\xC9\\x48\\x89\\xE5\\x41\\x55\\x49\\x89\\xFD"
"windows": "48 89 5C 24 10 48 89 6C 24 18 56 57 41 56 48 83 EC 30 80 B9 A0 00 00 00 00",
"linux": "48 85 F6 0F 84 ? ? ? ? 55 31 C9 48 89 E5 41 55 49 89 FD"
}
},
"CCSPlayer_ItemServices_GiveNamedItem": {
"offsets": {
"windows": 17,
"linux": 18
}
},
"CCSPlayer_ItemServices_DropActivePlayerWeapon": {
"offsets": {
"windows": 18,
"linux": 19
"windows": 18,
"linux": 19
}
},
"CCSPlayer_ItemServices_RemoveWeapons": {
"offsets": {
"windows": 19,
"linux": 20
}
"offsets": {
"windows": 19,
"linux": 20
}
},
"CGameSceneNode_GetSkeletonInstance": {
"offsets": {
"windows": 8,
"linux": 8
"windows": 8,
"linux": 8
}
},
"CCSGameRules_TerminateRound": {
"signatures": {
"library": "server",
"windows": "\\x48\\x8B\\xC4\\x4C\\x89\\x48\\x20\\x55\\x57",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x81\\xEC\\xE8\\x01\\x00\\x00\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A"
}
"library": "server",
"windows": "48 ? ? 4C 89 48 ? 48 89 48 ? 55 41",
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 81 EC E8 01 00 00 48 8D 05 ? ? ? ?"
}
},
"UTIL_CreateEntityByName": {
"signatures": {
"library": "server",
"windows": "\\x48\\x83\\xEC\\x48\\xC6\\x44\\x24\\x30\\x00",
"linux": "\\x48\\x8D\\x05\\x2A\\x2A\\x2A\\x2A\\x55\\x48\\x89\\xFA"
}
"library": "server",
"windows": "48 83 EC 48 C6 44 24 30 00",
"linux": "48 8D 05 ? ? ? ? 55 48 89 FA"
}
},
"CBaseEntity_DispatchSpawn": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x10\\x57\\x48\\x83\\xEC\\x30\\x48\\x8B\\xDA\\x48\\x8B\\xF9\\x48\\x85\\xC9",
"linux": "\\x48\\x85\\xFF\\x74\\x2A\\x55\\x48\\x89\\xE5\\x41\\x56"
}
"library": "server",
"windows": "48 89 5C 24 10 57 48 83 EC 30 48 8B DA 48 8B F9 48 85 C9",
"linux": "48 85 FF 74 ? 55 48 89 E5 41 56"
}
},
"CEntityInstance_AcceptInput": {
"signatures": {
"library": "server",
"windows": "\\x48\\x89\\x5C\\x24\\x10\\x48\\x89\\x74\\x24\\x18\\x57\\x48\\x83\\xEC\\x40\\x49\\x8B\\xF0",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x49\\x89\\xFF\\x41\\x56\\x48\\x8D\\x7D\\xC0"
"windows": "48 89 5C 24 10 48 89 74 24 18 57 48 83 EC 40 49 8B F0",
"linux": "55 48 89 E5 41 57 49 89 FF 41 56 48 8D 7D C0"
}
},
"LegacyGameEventListener": {
"signatures": {
"library": "server",
"windows": "\\x48\\x8B\\x15\\x2A\\x2A\\x2A\\x2A\\x48\\x85\\xD2\\x74\\x2A\\x85\\xC9\\x74",
"linux": "\\x48\\x8B\\x05\\x2A\\x2A\\x2A\\x2A\\x48\\x85\\xC0\\x74\\x2A\\x83\\xFF\\x3F\\x76\\x2A\\x31\\xC0"
"windows": "48 8B 15 ? ? ? ? 48 85 D2 74 ? 85 C9 74",
"linux": "48 8B 05 ? ? ? ? 48 85 C0 74 ? 83 FF 3F 76 ? 31 C0"
}
},
"CBasePlayerPawn_CommitSuicide": {
@@ -143,8 +149,8 @@
"CBasePlayerPawn_RemovePlayerItem": {
"signatures": {
"library": "server",
"linux": "\\x55\\x48\\x89\\x2A\\x41\\x2A\\x49\\x89\\x2A\\x41\\x2A\\x49\\x89\\x2A\\xE8\\x2A\\x2A\\x2A\\x2A\\x49\\x39",
"windows": "\\x48\\x85\\xD2\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\x48\\x89\\x5C\\x24\\x08\\x57\\x48\\x83\\xEC\\x30\\x48\\x8B\\xDA"
"windows": "48 ? ? 0F 84 ? ? ? ? 48 89 5C 24 ? 57 48 ? ? ? 48 ? ? 48 ? ? E8",
"linux": "55 48 89 ? 41 ? 49 89 ? 41 ? 49 89 ? E8 ? ? ? ? 49 39"
}
},
"CBaseEntity_Teleport": {
@@ -156,36 +162,36 @@
"CBaseEntity_TakeDamageOld": {
"signatures": {
"library": "server",
"windows": "\\x40\\x56\\x57\\x48\\x83\\xEC\\x58\\x48\\x8B\\x41\\x10",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xFC\\x53\\x48\\x83\\xEC\\x38\\x4C\\x8D\\x2D\\x2A\\x2A\\x2A\\x2A\\x49\\x8B\\x7D\\x00\\x48\\x85\\xFF\\x0F\\x84\\x2A\\x2A\\x2A\\x2A"
"windows": "40 56 57 48 83 EC 58 48 8B 41 10",
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 FC 53 48 83 EC 38 4C 8D 2D ? ? ? ? 49 8B 7D 00 48 85 FF 0F 84 ? ? ? ?"
}
},
"CBaseTrigger_StartTouch": {
"signatures": {
"library": "server",
"windows": "\\x41\\x56\\x41\\x57\\x48\\x83\\xEC\\x58\\x48\\x8B\\x01",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x56\\x49\\x89\\xF6\\x41\\x55\\x49\\x89\\xFD\\x41\\x54\\x53\\xBB"
"windows": "41 56 41 57 48 83 EC 58 48 8B 01",
"linux": "55 48 89 E5 41 56 49 89 F6 41 55 49 89 FD 41 54 53 BB"
}
},
"CBaseTrigger_EndTouch": {
"signatures": {
"library": "server",
"windows": "\\x40\\x53\\x57\\x41\\x55\\x48\\x83\\xEC\\x40",
"linux": "\\x55\\xBA\\xFF\\xFF\\xFF\\xFF\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x49\\x89\\xF5\\x41"
"windows": "40 53 57 41 55 48 83 EC 40",
"linux": "55 BA FF FF FF FF 48 89 E5 41 57 41 56 41 55 49 89 F5 41"
}
},
"StateChanged": {
"signatures": {
"library": "server",
"windows": "\\x40\\x55\\x53\\x56\\x41\\x55\\x41\\x57\\x48\\x8D\\x6C\\x24\\xB0",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x53\\x89\\xD3"
"windows": "40 55 53 56 41 55 41 57 48 8D 6C 24 B0",
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 53 89 D3"
}
},
"NetworkStateChanged": {
"signatures": {
"library": "server",
"windows": "\\x4C\\x8B\\xC9\\x48\\x8B\\x09\\x48\\x85\\xC9\\x74\\x2A\\x48\\x8B\\x41\\x10",
"linux": "\\x4C\\x8B\\x07\\x4D\\x85\\xC0\\x74\\x2A\\x49\\x8B\\x40\\x10"
"windows": "4C 8B C9 48 8B 09 48 85 C9 74 ? 48 8B 41 10",
"linux": "4C 8B 07 4D 85 C0 74 ? 49 8B 40 10"
}
},
"GameEntitySystem": {
@@ -203,15 +209,15 @@
"CEntityIOOutput_FireOutputInternal": {
"signatures": {
"library": "server",
"windows": "\\x4C\\x89\\x4C\\x24\\x20\\x53\\x55\\x57\\x41\\x54\\x41\\x56\\x48\\x81\\xEC",
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x41\\x55\\x41\\x54\\x49\\x89\\xD4\\x53\\x48\\x89\\xF3\\x48\\x83\\xEC\\x58"
"windows": "4C 89 4C 24 20 53 55 57 41 54 41 56 48 81 EC",
"linux": "55 48 89 E5 41 57 41 56 41 55 41 54 49 89 D4 53 48 89 F3 48 83 EC 58"
}
},
"IGameSystem_InitAllSystems_pFirst": {
"signatures": {
"library": "server",
"windows": "\\x48\\x8B\\x1D\\x2A\\x2A\\x2A\\x2A\\x48\\x85\\xDB\\x0F\\x84\\x2A\\x2A\\x2A\\x2A\\xBE\\x2A\\x2A\\x2A\\x2A\\x0F\\x1F\\x00\\x48\\x8B\\x7B\\x10",
"linux": "\\x4C\\x8B\\x35\\x2A\\x2A\\x2A\\x2A\\x4D\\x85\\xF6\\x75\\x2D\\xE9\\x2A\\x2A\\x2A\\x2A\\x0F\\x1F\\x40\\x00\\x48\\x8B\\x05"
"windows": "48 8B 1D ? ? ? ? 48 85 DB 0F 84 ? ? ? ? BE ? ? ? ? 0F 1F 00 48 8B 7B 10",
"linux": "4C 8B 35 ? ? ? ? 4D 85 F6 75 2D E9 ? ? ? ? 0F 1F 40 00 48 8B 05"
}
},
"CEntityResourceManifest_AddResource": {

71
eng/install/install.ps1 Normal file
View File

@@ -0,0 +1,71 @@
# Install script that downloads Metamod:Source and Counter-Strike Sharp (with runtime)
$MM_DOWNLOAD_URL = "https://mms.alliedmods.net/mmsdrop/2.0/mmsource-2.0.0-git1286-windows.zip"
$TARGET_DIR = "./game/csgo"
$GAMEINFO_FILE = Join-Path $TARGET_DIR "gameinfo.gi"
$ProgressPreference = 'SilentlyContinue'
# Verification
if (-not (Test-Path $GAMEINFO_FILE)) {
Write-Error "Error: $GAMEINFO_FILE does not exist in the specified directory."
exit 1
}
# GitHub API for Counter-Strike Sharp Releases
$RELEASE_INFO = (Invoke-WebRequest -Uri "https://api.github.com/repos/roflmuffin/CounterStrikeSharp/releases/latest").Content | ConvertFrom-Json
# Filtering download URLs
$CSSHARP_DOWNLOAD_URL = $RELEASE_INFO.assets |
Where-Object { $_.browser_download_url -like '*windows*.zip*' -and $_.browser_download_url -notlike '*with-runtime*' } |
Select-Object -First 1 -ExpandProperty browser_download_url
$CSSHARP_RUNTIME_DOWNLOAD_URL = $RELEASE_INFO.assets |
Where-Object { $_.browser_download_url -like '*windows*.zip*' -and $_.browser_download_url -like '*with-runtime*' } |
Select-Object -First 1 -ExpandProperty browser_download_url
### METAMOD:SOURCE ###
Write-Output "Downloading Metamod:Source..."
Invoke-WebRequest -Uri $MM_DOWNLOAD_URL -OutFile metamod.zip
Write-Output "Extracting Metamod:Source to $TARGET_DIR..."
Expand-Archive -Force -Path metamod.zip -DestinationPath $TARGET_DIR
Remove-Item metamod.zip
### GAMEINFO.GI UPDATE ###
$NEW_ENTRY = " Game csgo/addons/metamod"
$FILE_CONTENT = Get-Content $GAMEINFO_FILE
Write-Output "Updating $GAMEINFO_FILE..."
if ($FILE_CONTENT -contains $NEW_ENTRY) {
Write-Output "The entry '$NEW_ENTRY' already exists in $GAMEINFO_FILE. No changes were made."
} else {
$Pattern = "Game_LowViolence"
$Modified = $false
$NewContent = @()
foreach ($line in $FILE_CONTENT) {
if ($line -match $Pattern -and -not $Modified) {
$NewContent += $line
$NewContent += $NEW_ENTRY
$Modified = $true
} else {
$NewContent += $line
}
}
$NewContent | Set-Content $GAMEINFO_FILE
Write-Host "The file $GAMEINFO_FILE has been modified successfully. '$NEW_ENTRY' has been added."
}
### COUNTER-STRIKE SHARP ###
Write-Output "Downloading Counter-Strike Sharp (with runtime)..."
# Determine if runtime needs to be downloaded
if (-not (Test-Path "./game/csgo/addons/CounterStrikeSharp/dotnet/dotnet.exe")) {
$CSSHARP_DOWNLOAD_URL = $CSSHARP_RUNTIME_DOWNLOAD_URL
}
Invoke-WebRequest -Uri $CSSHARP_DOWNLOAD_URL -OutFile cssharp.zip
Write-Output "Extracting Counter-Strike Sharp to $TARGET_DIR..."
Expand-Archive -Force -Path cssharp.zip -DestinationPath $TARGET_DIR
Remove-Item cssharp.zip

72
eng/install/install.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/bash
# Install script that downloads Metamod:Source and Counter-Strike Sharp (with runtime)
MM_DOWNLOAD_URL="https://mms.alliedmods.net/mmsdrop/2.0/mmsource-2.0.0-git1286-linux.tar.gz"
TARGET_DIR="./game/csgo"
GAMEINFO_FILE="${TARGET_DIR}/gameinfo.gi"
if [ ! -f "${GAMEINFO_FILE}" ]; then
printf "Error: %s does not exist in the specified directory.\n" "$GAMEINFO_FILE"
exit 1
fi
RELEASE_INFO=$(curl -s https://api.github.com/repos/roflmuffin/CounterStrikeSharp/releases/latest)
# Filter and store download URLs
CSSHARP_DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep -o "browser_download_url.*linux.*\.zip" | cut -d '"' -f 3 | grep -v "with-runtime")
CSSHARP_RUNTIME_DOWNLOAD_URL=$(echo "$RELEASE_INFO" | grep -o "browser_download_url.*linux.*\.zip" | cut -d '"' -f 3 | grep "with-runtime")
### METAMOD:SOURCE ###
printf "Downloading Metamod:Source...\n"
curl -s -L -o metamod.tar.gz "$MM_DOWNLOAD_URL"
if [ $? -eq 0 ]; then
printf "Extracting Metamod:Source to %s...\n" "$TARGET_DIR"
tar -xzf metamod.tar.gz -C "$TARGET_DIR"
rm metamod.tar.gz
else
echo "Download failed. Please check the URL and your connection."
fi
### GAMEINFO.GI UPDATE ###
NEW_ENTRY=" Game csgo/addons/metamod"
printf "Updating %s...\n" "$GAMEINFO_FILE"
if grep -Fxq "$NEW_ENTRY" "$GAMEINFO_FILE"; then
echo "The entry '$(echo $NEW_ENTRY | xargs)' already exists in ${GAMEINFO_FILE}. No changes were made."
else
awk -v new_entry="$NEW_ENTRY" '
BEGIN { found=0; }
// {
if (found) {
print new_entry;
found=0;
}
print;
}
/Game_LowViolence/ { found=1; }
' "$GAMEINFO_FILE" > "$GAMEINFO_FILE.tmp" && mv "$GAMEINFO_FILE.tmp" "$GAMEINFO_FILE"
printf "The file %s has been modified successfully. '%s' has been added.\n" "$GAMEINFO_FILE" "$(echo $NEW_ENTRY | xargs)"
fi
printf "Downloading Counter-Strike Sharp (with runtime)...\n"
# If ./game/csgo/addons/CounterStrikeSharp/dotnet/dotnet does not exist, use the runtime download url
if [ ! -f "./game/csgo/addons/CounterStrikeSharp/dotnet/dotnet" ]; then
CSSHARP_DOWNLOAD_URL="$CSSHARP_RUNTIME_DOWNLOAD_URL"
fi
curl -s -L -o cssharp.zip "$CSSHARP_DOWNLOAD_URL"
if [ $? -eq 0 ]; then
printf "Extracting Counter-Strike Sharp to %s...\n" "$TARGET_DIR"
unzip -q -o cssharp.zip -d "$TARGET_DIR"
rm cssharp.zip
else
echo "Download failed. Please check the URL and your connection."
fi

View File

@@ -11,7 +11,6 @@ set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING
FORCE
)
# TODO: Use C++20 instead.
set(CMAKE_CXX_STANDARD 20)
if (LINUX)

View File

@@ -1,22 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>F:CounterStrikeSharp.API.Core.BasePlugin.ConvarChangeHandlers</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:CounterStrikeSharp.API.Core.CC4.get_DroppedFromDeath</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:CounterStrikeSharp.API.Core.CCSGameRules.get_RoundStartTicks</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:CounterStrikeSharp.API.Core.CCSPlayerPawnBase.get_InvalidSteamLogonDelayed</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:CounterStrikeSharp.API.Core.CCSPlayerPawnBase.get_LastAction</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:CounterStrikeSharp.API.Core.CPlantedC4.get_PlantedAfterPickup</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0005</DiagnosticId>
<Target>M:CounterStrikeSharp.API.Modules.Menu.BaseMenu.Open(CounterStrikeSharp.API.Core.CCSPlayerController)</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Release\net8.0\CounterStrikeSharp.API.dll</Right>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:CounterStrikeSharp.API.Modules.Menu.IMenu.Open(CounterStrikeSharp.API.Core.CCSPlayerController)</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Release\net8.0\CounterStrikeSharp.API.dll</Right>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:CounterStrikeSharp.API.Modules.Menu.IMenu.OpenToAll</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Release\net8.0\CounterStrikeSharp.API.dll</Right>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0011</DiagnosticId>
<Target>F:CounterStrikeSharp.API.Core.PulseValueType_t.PVAL_COUNT</Target>
<Left>.\ApiCompat\v202.dll</Left>
<Right>obj\Debug\net8.0\CounterStrikeSharp.API.dll</Right>
</Suppression>
</Suppressions>

View File

@@ -4646,6 +4646,14 @@ namespace CounterStrikeSharp.API.Core
get => Get<int>("hitgroup");
set => Set<int>("hitgroup", value);
}
// attacker was in midair
public bool Attackerinair
{
get => Get<bool>("attackerinair");
set => Set<bool>("attackerinair", value);
}
}
[EventName("player_decal")]

View File

@@ -16,17 +16,22 @@ public partial class CCSPlayerController
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
public IntPtr GiveNamedItem(string item)
{
Guard.IsValidEntity(this);
if (!PlayerPawn.IsValid) return 0;
if (PlayerPawn.Value == null) return 0;
if (!PlayerPawn.Value.IsValid) return 0;
if (PlayerPawn.Value.ItemServices == null) return 0;
return VirtualFunctions.GiveNamedItem(PlayerPawn.Value.ItemServices.Handle, item, 0, 0, 0, 0);
return GiveNamedItem<CEntityInstance>(item)?.Handle ?? IntPtr.Zero;
}
public IntPtr GiveNamedItem(CsItem item)
public T? GiveNamedItem<T>(string item) where T : CEntityInstance
{
Guard.IsValidEntity(this);
if (!PlayerPawn.IsValid) return null;
if (PlayerPawn.Value == null) return null; ;
if (!PlayerPawn.Value.IsValid) return null;
if (PlayerPawn.Value.ItemServices == null) return null;
return PlayerPawn.Value.ItemServices.As<CCSPlayer_ItemServices>().GiveNamedItem<T>(item);
}
public IntPtr GiveNamedItem(CsItem item)
{
string? itemString = EnumUtils.GetEnumMemberAttributeValue(item);
if (string.IsNullOrWhiteSpace(itemString))
@@ -61,6 +66,14 @@ public partial class CCSPlayerController
VirtualFunctions.ClientPrint(Handle, HudDestination.Center, message, 0, 0, 0, 0);
}
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
public void PrintToCenterAlert(string message)
{
Guard.IsValidEntity(this);
VirtualFunctions.ClientPrint(Handle, HudDestination.Alert, message, 0, 0, 0, 0);
}
public void PrintToCenterHtml(string message) => PrintToCenterHtml(message, 5);
/// <exception cref="InvalidOperationException">Entity is not valid</exception>
@@ -94,7 +107,7 @@ public partial class CCSPlayerController
CCSPlayer_ItemServices itemServices = new CCSPlayer_ItemServices(PlayerPawn.Value.ItemServices.Handle);
CCSPlayer_WeaponServices weaponServices = new CCSPlayer_WeaponServices(PlayerPawn.Value.WeaponServices.Handle);
itemServices.DropActivePlayerWeapon(weaponServices.ActiveWeapon.Value);
}

View File

@@ -45,4 +45,13 @@ public partial class CCSPlayer_ItemServices
VirtualFunction.CreateVoid<nint>(Handle, GameData.GetOffset("CCSPlayer_ItemServices_RemoveWeapons"))(Handle);
}
}
public T? GiveNamedItem<T>(string item) where T : CEntityInstance
{
var pointer = VirtualFunction.Create<nint, string, nint>(Handle, GameData.GetOffset("CCSPlayer_ItemServices_GiveNamedItem"))(Handle, item);
if (pointer == IntPtr.Zero)
return null;
return (T)Activator.CreateInstance(typeof(T), pointer)!;
}
}

View File

@@ -36,7 +36,7 @@ public class PluginManager : IPluginManager
config => { config.PreferSharedTypes = true; });
var assembly = loader.LoadDefaultAssembly();
_sharedAssemblies[assembly.GetName().FullName] = assembly;
_sharedAssemblies[assembly.GetName().Name] = assembly;
}
private void LoadSharedLibraries()
@@ -76,7 +76,7 @@ public class PluginManager : IPluginManager
_loadedSharedLibs = true;
}
if (!_sharedAssemblies.TryGetValue(name.FullName, out var assembly))
if (!_sharedAssemblies.TryGetValue(name.Name, out var assembly))
{
return null;
}
@@ -124,4 +124,4 @@ public class PluginManager : IPluginManager
_loadedPluginContexts.Add(plugin);
plugin.Load();
}
}
}

View File

@@ -54,6 +54,10 @@ public partial class CBaseCSGrenade : CCSWeaponBase
[SchemaMember("CBaseCSGrenade", "m_fDropTime")]
public ref float DropTime => ref Schema.GetRef<float>(this.Handle, "CBaseCSGrenade", "m_fDropTime");
// m_fPinPullTime
[SchemaMember("CBaseCSGrenade", "m_fPinPullTime")]
public ref float PinPullTime => ref Schema.GetRef<float>(this.Handle, "CBaseCSGrenade", "m_fPinPullTime");
// m_bJustPulledPin
[SchemaMember("CBaseCSGrenade", "m_bJustPulledPin")]
public ref bool JustPulledPin => ref Schema.GetRef<bool>(this.Handle, "CBaseCSGrenade", "m_bJustPulledPin");

View File

@@ -31,7 +31,7 @@ public partial class CBaseIssue : NativeObject
public string DetailsString
{
get { return Schema.GetString(this.Handle, "CBaseIssue", "m_szDetailsString"); }
set { Schema.SetStringBytes(this.Handle, "CBaseIssue", "m_szDetailsString", value, 260); }
set { Schema.SetStringBytes(this.Handle, "CBaseIssue", "m_szDetailsString", value, 4096); }
}
// m_iNumYesVotes

View File

@@ -486,6 +486,10 @@ public partial class CCSGameRules : CTeamplayRules
[SchemaMember("CCSGameRules", "m_numQueuedMatchmakingAccounts")]
public ref UInt32 NumQueuedMatchmakingAccounts => ref Schema.GetRef<UInt32>(this.Handle, "CCSGameRules", "m_numQueuedMatchmakingAccounts");
// m_fAvgPlayerRank
[SchemaMember("CCSGameRules", "m_fAvgPlayerRank")]
public ref float AvgPlayerRank => ref Schema.GetRef<float>(this.Handle, "CCSGameRules", "m_fAvgPlayerRank");
// m_pQueuedMatchmakingReservationString
[SchemaMember("CCSGameRules", "m_pQueuedMatchmakingReservationString")]
public string QueuedMatchmakingReservationString

View File

@@ -22,9 +22,9 @@ public partial class CCSPlayerController_InGameMoneyServices : CPlayerController
[SchemaMember("CCSPlayerController_InGameMoneyServices", "m_bReceivesMoneyNextRound")]
public ref bool ReceivesMoneyNextRound => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerController_InGameMoneyServices", "m_bReceivesMoneyNextRound");
// m_iAccountMoneyEarnedForNextRound
[SchemaMember("CCSPlayerController_InGameMoneyServices", "m_iAccountMoneyEarnedForNextRound")]
public ref Int32 AccountMoneyEarnedForNextRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController_InGameMoneyServices", "m_iAccountMoneyEarnedForNextRound");
// m_iMoneyEarnedForNextRound
[SchemaMember("CCSPlayerController_InGameMoneyServices", "m_iMoneyEarnedForNextRound")]
public ref Int32 MoneyEarnedForNextRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerController_InGameMoneyServices", "m_iMoneyEarnedForNextRound");
// m_iAccount
[SchemaMember("CCSPlayerController_InGameMoneyServices", "m_iAccount")]

View File

@@ -46,10 +46,6 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_nCharacterDefIndex")]
public ref UInt16 CharacterDefIndex => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawn", "m_nCharacterDefIndex");
// m_hPreviousModel
[SchemaMember("CCSPlayerPawn", "m_hPreviousModel")]
public CStrongHandle<InfoForResourceTypeCModel> PreviousModel => Schema.GetDeclaredClass<CStrongHandle<InfoForResourceTypeCModel>>(this.Handle, "CCSPlayerPawn", "m_hPreviousModel");
// m_bHasFemaleVoice
[SchemaMember("CCSPlayerPawn", "m_bHasFemaleVoice")]
public ref bool HasFemaleVoice => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bHasFemaleVoice");
@@ -78,6 +74,10 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_bInBuyZone")]
public ref bool InBuyZone => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bInBuyZone");
// m_TouchingBuyZones
[SchemaMember("CCSPlayerPawn", "m_TouchingBuyZones")]
public NetworkedVector<CHandle<CBaseEntity>> TouchingBuyZones => Schema.GetDeclaredClass<NetworkedVector<CHandle<CBaseEntity>>>(this.Handle, "CCSPlayerPawn", "m_TouchingBuyZones");
// m_bWasInBuyZone
[SchemaMember("CCSPlayerPawn", "m_bWasInBuyZone")]
public ref bool WasInBuyZone => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bWasInBuyZone");
@@ -122,9 +122,9 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_flHealthShotBoostExpirationTime")]
public ref float HealthShotBoostExpirationTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flHealthShotBoostExpirationTime");
// m_flLandseconds
[SchemaMember("CCSPlayerPawn", "m_flLandseconds")]
public ref float Landseconds => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLandseconds");
// m_flLandingTimeSeconds
[SchemaMember("CCSPlayerPawn", "m_flLandingTimeSeconds")]
public ref float LandingTimeSeconds => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLandingTimeSeconds");
// m_aimPunchAngle
[SchemaMember("CCSPlayerPawn", "m_aimPunchAngle")]
@@ -226,4 +226,284 @@ public partial class CCSPlayerPawn : CCSPlayerPawnBase
[SchemaMember("CCSPlayerPawn", "m_bSkipOneHeadConstraintUpdate")]
public ref bool SkipOneHeadConstraintUpdate => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bSkipOneHeadConstraintUpdate");
// m_bLeftHanded
[SchemaMember("CCSPlayerPawn", "m_bLeftHanded")]
public ref bool LeftHanded => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bLeftHanded");
// m_fSwitchedHandednessTime
[SchemaMember("CCSPlayerPawn", "m_fSwitchedHandednessTime")]
public ref float SwitchedHandednessTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_fSwitchedHandednessTime");
// m_flViewmodelOffsetX
[SchemaMember("CCSPlayerPawn", "m_flViewmodelOffsetX")]
public ref float ViewmodelOffsetX => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flViewmodelOffsetX");
// m_flViewmodelOffsetY
[SchemaMember("CCSPlayerPawn", "m_flViewmodelOffsetY")]
public ref float ViewmodelOffsetY => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flViewmodelOffsetY");
// m_flViewmodelOffsetZ
[SchemaMember("CCSPlayerPawn", "m_flViewmodelOffsetZ")]
public ref float ViewmodelOffsetZ => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flViewmodelOffsetZ");
// m_flViewmodelFOV
[SchemaMember("CCSPlayerPawn", "m_flViewmodelFOV")]
public ref float ViewmodelFOV => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flViewmodelFOV");
// m_bIsWalking
[SchemaMember("CCSPlayerPawn", "m_bIsWalking")]
public ref bool IsWalking => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsWalking");
// m_fLastGivenDefuserTime
[SchemaMember("CCSPlayerPawn", "m_fLastGivenDefuserTime")]
public ref float LastGivenDefuserTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_fLastGivenDefuserTime");
// m_fLastGivenBombTime
[SchemaMember("CCSPlayerPawn", "m_fLastGivenBombTime")]
public ref float LastGivenBombTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_fLastGivenBombTime");
// m_flDealtDamageToEnemyMostRecentTimestamp
[SchemaMember("CCSPlayerPawn", "m_flDealtDamageToEnemyMostRecentTimestamp")]
public ref float DealtDamageToEnemyMostRecentTimestamp => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flDealtDamageToEnemyMostRecentTimestamp");
// m_iDisplayHistoryBits
[SchemaMember("CCSPlayerPawn", "m_iDisplayHistoryBits")]
public ref UInt32 DisplayHistoryBits => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerPawn", "m_iDisplayHistoryBits");
// m_flLastAttackedTeammate
[SchemaMember("CCSPlayerPawn", "m_flLastAttackedTeammate")]
public ref float LastAttackedTeammate => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLastAttackedTeammate");
// m_allowAutoFollowTime
[SchemaMember("CCSPlayerPawn", "m_allowAutoFollowTime")]
public ref float AllowAutoFollowTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_allowAutoFollowTime");
// m_bResetArmorNextSpawn
[SchemaMember("CCSPlayerPawn", "m_bResetArmorNextSpawn")]
public ref bool ResetArmorNextSpawn => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bResetArmorNextSpawn");
// m_nLastKillerIndex
[SchemaMember("CCSPlayerPawn", "m_nLastKillerIndex")]
public CEntityIndex LastKillerIndex => Schema.GetDeclaredClass<CEntityIndex>(this.Handle, "CCSPlayerPawn", "m_nLastKillerIndex");
// m_entitySpottedState
[SchemaMember("CCSPlayerPawn", "m_entitySpottedState")]
public EntitySpottedState_t EntitySpottedState => Schema.GetDeclaredClass<EntitySpottedState_t>(this.Handle, "CCSPlayerPawn", "m_entitySpottedState");
// m_nSpotRules
[SchemaMember("CCSPlayerPawn", "m_nSpotRules")]
public ref Int32 SpotRules => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_nSpotRules");
// m_bIsScoped
[SchemaMember("CCSPlayerPawn", "m_bIsScoped")]
public ref bool IsScoped => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsScoped");
// m_bResumeZoom
[SchemaMember("CCSPlayerPawn", "m_bResumeZoom")]
public ref bool ResumeZoom => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bResumeZoom");
// m_bIsDefusing
[SchemaMember("CCSPlayerPawn", "m_bIsDefusing")]
public ref bool IsDefusing => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsDefusing");
// m_bIsGrabbingHostage
[SchemaMember("CCSPlayerPawn", "m_bIsGrabbingHostage")]
public ref bool IsGrabbingHostage => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsGrabbingHostage");
// m_iBlockingUseActionInProgress
[SchemaMember("CCSPlayerPawn", "m_iBlockingUseActionInProgress")]
public ref CSPlayerBlockingUseAction_t BlockingUseActionInProgress => ref Schema.GetRef<CSPlayerBlockingUseAction_t>(this.Handle, "CCSPlayerPawn", "m_iBlockingUseActionInProgress");
// m_flEmitSoundTime
[SchemaMember("CCSPlayerPawn", "m_flEmitSoundTime")]
public ref float EmitSoundTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flEmitSoundTime");
// m_bInNoDefuseArea
[SchemaMember("CCSPlayerPawn", "m_bInNoDefuseArea")]
public ref bool InNoDefuseArea => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bInNoDefuseArea");
// m_iBombSiteIndex
[SchemaMember("CCSPlayerPawn", "m_iBombSiteIndex")]
public CEntityIndex BombSiteIndex => Schema.GetDeclaredClass<CEntityIndex>(this.Handle, "CCSPlayerPawn", "m_iBombSiteIndex");
// m_nWhichBombZone
[SchemaMember("CCSPlayerPawn", "m_nWhichBombZone")]
public ref Int32 WhichBombZone => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_nWhichBombZone");
// m_bInBombZoneTrigger
[SchemaMember("CCSPlayerPawn", "m_bInBombZoneTrigger")]
public ref bool InBombZoneTrigger => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bInBombZoneTrigger");
// m_bWasInBombZoneTrigger
[SchemaMember("CCSPlayerPawn", "m_bWasInBombZoneTrigger")]
public ref bool WasInBombZoneTrigger => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bWasInBombZoneTrigger");
// m_iShotsFired
[SchemaMember("CCSPlayerPawn", "m_iShotsFired")]
public ref Int32 ShotsFired => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_iShotsFired");
// m_flFlinchStack
[SchemaMember("CCSPlayerPawn", "m_flFlinchStack")]
public ref float FlinchStack => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flFlinchStack");
// m_flVelocityModifier
[SchemaMember("CCSPlayerPawn", "m_flVelocityModifier")]
public ref float VelocityModifier => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flVelocityModifier");
// m_flHitHeading
[SchemaMember("CCSPlayerPawn", "m_flHitHeading")]
public ref float HitHeading => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flHitHeading");
// m_nHitBodyPart
[SchemaMember("CCSPlayerPawn", "m_nHitBodyPart")]
public ref Int32 HitBodyPart => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_nHitBodyPart");
// m_vecTotalBulletForce
[SchemaMember("CCSPlayerPawn", "m_vecTotalBulletForce")]
public Vector TotalBulletForce => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vecTotalBulletForce");
// m_bWaitForNoAttack
[SchemaMember("CCSPlayerPawn", "m_bWaitForNoAttack")]
public ref bool WaitForNoAttack => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bWaitForNoAttack");
// m_ignoreLadderJumpTime
[SchemaMember("CCSPlayerPawn", "m_ignoreLadderJumpTime")]
public ref float IgnoreLadderJumpTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_ignoreLadderJumpTime");
// m_NumEnemiesKilledThisRound
[SchemaMember("CCSPlayerPawn", "m_NumEnemiesKilledThisRound")]
public ref Int32 NumEnemiesKilledThisRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_NumEnemiesKilledThisRound");
// m_bKilledByHeadshot
[SchemaMember("CCSPlayerPawn", "m_bKilledByHeadshot")]
public ref bool KilledByHeadshot => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bKilledByHeadshot");
// m_LastHitBox
[SchemaMember("CCSPlayerPawn", "m_LastHitBox")]
public ref Int32 LastHitBox => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_LastHitBox");
// m_LastHealth
[SchemaMember("CCSPlayerPawn", "m_LastHealth")]
public ref Int32 LastHealth => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_LastHealth");
// m_pBot
[SchemaMember("CCSPlayerPawn", "m_pBot")]
public CCSBot? Bot => Schema.GetPointer<CCSBot>(this.Handle, "CCSPlayerPawn", "m_pBot");
// m_bBotAllowActive
[SchemaMember("CCSPlayerPawn", "m_bBotAllowActive")]
public ref bool BotAllowActive => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bBotAllowActive");
// m_thirdPersonHeading
[SchemaMember("CCSPlayerPawn", "m_thirdPersonHeading")]
public QAngle ThirdPersonHeading => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawn", "m_thirdPersonHeading");
// m_flSlopeDropOffset
[SchemaMember("CCSPlayerPawn", "m_flSlopeDropOffset")]
public ref float SlopeDropOffset => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flSlopeDropOffset");
// m_flSlopeDropHeight
[SchemaMember("CCSPlayerPawn", "m_flSlopeDropHeight")]
public ref float SlopeDropHeight => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flSlopeDropHeight");
// m_vHeadConstraintOffset
[SchemaMember("CCSPlayerPawn", "m_vHeadConstraintOffset")]
public Vector HeadConstraintOffset => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vHeadConstraintOffset");
// m_nLastPickupPriority
[SchemaMember("CCSPlayerPawn", "m_nLastPickupPriority")]
public ref Int32 LastPickupPriority => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_nLastPickupPriority");
// m_flLastPickupPriorityTime
[SchemaMember("CCSPlayerPawn", "m_flLastPickupPriorityTime")]
public ref float LastPickupPriorityTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLastPickupPriorityTime");
// m_ArmorValue
[SchemaMember("CCSPlayerPawn", "m_ArmorValue")]
public ref Int32 ArmorValue => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_ArmorValue");
// m_unCurrentEquipmentValue
[SchemaMember("CCSPlayerPawn", "m_unCurrentEquipmentValue")]
public ref UInt16 CurrentEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawn", "m_unCurrentEquipmentValue");
// m_unRoundStartEquipmentValue
[SchemaMember("CCSPlayerPawn", "m_unRoundStartEquipmentValue")]
public ref UInt16 RoundStartEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawn", "m_unRoundStartEquipmentValue");
// m_unFreezetimeEndEquipmentValue
[SchemaMember("CCSPlayerPawn", "m_unFreezetimeEndEquipmentValue")]
public ref UInt16 FreezetimeEndEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawn", "m_unFreezetimeEndEquipmentValue");
// m_iLastWeaponFireUsercmd
[SchemaMember("CCSPlayerPawn", "m_iLastWeaponFireUsercmd")]
public ref Int32 LastWeaponFireUsercmd => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_iLastWeaponFireUsercmd");
// m_flLastFriendlyFireDamageReductionRatio
[SchemaMember("CCSPlayerPawn", "m_flLastFriendlyFireDamageReductionRatio")]
public ref float LastFriendlyFireDamageReductionRatio => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flLastFriendlyFireDamageReductionRatio");
// m_bIsSpawning
[SchemaMember("CCSPlayerPawn", "m_bIsSpawning")]
public ref bool IsSpawning => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bIsSpawning");
// m_iDeathFlags
[SchemaMember("CCSPlayerPawn", "m_iDeathFlags")]
public ref Int32 DeathFlags => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawn", "m_iDeathFlags");
// m_bHasDeathInfo
[SchemaMember("CCSPlayerPawn", "m_bHasDeathInfo")]
public ref bool HasDeathInfo => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bHasDeathInfo");
// m_flDeathInfoTime
[SchemaMember("CCSPlayerPawn", "m_flDeathInfoTime")]
public ref float DeathInfoTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_flDeathInfoTime");
// m_vecDeathInfoOrigin
[SchemaMember("CCSPlayerPawn", "m_vecDeathInfoOrigin")]
public Vector DeathInfoOrigin => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vecDeathInfoOrigin");
// m_vecPlayerPatchEconIndices
[SchemaMember("CCSPlayerPawn", "m_vecPlayerPatchEconIndices")]
public Span<UInt32> PlayerPatchEconIndices => Schema.GetFixedArray<UInt32>(this.Handle, "CCSPlayerPawn", "m_vecPlayerPatchEconIndices", 5);
// m_GunGameImmunityColor
[SchemaMember("CCSPlayerPawn", "m_GunGameImmunityColor")]
public Color GunGameImmunityColor
{
get { return Schema.GetCustomMarshalledType<Color>(this.Handle, "CCSPlayerPawn", "m_GunGameImmunityColor"); }
set { Schema.SetCustomMarshalledType<Color>(this.Handle, "CCSPlayerPawn", "m_GunGameImmunityColor", value); }
}
// m_grenadeParameterStashTime
[SchemaMember("CCSPlayerPawn", "m_grenadeParameterStashTime")]
public ref float GrenadeParameterStashTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawn", "m_grenadeParameterStashTime");
// m_bGrenadeParametersStashed
[SchemaMember("CCSPlayerPawn", "m_bGrenadeParametersStashed")]
public ref bool GrenadeParametersStashed => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawn", "m_bGrenadeParametersStashed");
// m_angStashedShootAngles
[SchemaMember("CCSPlayerPawn", "m_angStashedShootAngles")]
public QAngle StashedShootAngles => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawn", "m_angStashedShootAngles");
// m_vecStashedGrenadeThrowPosition
[SchemaMember("CCSPlayerPawn", "m_vecStashedGrenadeThrowPosition")]
public Vector StashedGrenadeThrowPosition => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vecStashedGrenadeThrowPosition");
// m_vecStashedVelocity
[SchemaMember("CCSPlayerPawn", "m_vecStashedVelocity")]
public Vector StashedVelocity => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawn", "m_vecStashedVelocity");
// m_angShootAngleHistory
[SchemaMember("CCSPlayerPawn", "m_angShootAngleHistory")]
public Span<QAngle> ShootAngleHistory => Schema.GetFixedArray<QAngle>(this.Handle, "CCSPlayerPawn", "m_angShootAngleHistory", 2);
// m_vecThrowPositionHistory
[SchemaMember("CCSPlayerPawn", "m_vecThrowPositionHistory")]
public Span<Vector> ThrowPositionHistory => Schema.GetFixedArray<Vector>(this.Handle, "CCSPlayerPawn", "m_vecThrowPositionHistory", 2);
// m_vecVelocityHistory
[SchemaMember("CCSPlayerPawn", "m_vecVelocityHistory")]
public Span<Vector> VelocityHistory => Schema.GetFixedArray<Vector>(this.Handle, "CCSPlayerPawn", "m_vecVelocityHistory", 2);
}

View File

@@ -30,18 +30,6 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_pViewModelServices")]
public CPlayer_ViewModelServices? ViewModelServices => Schema.GetPointer<CPlayer_ViewModelServices>(this.Handle, "CCSPlayerPawnBase", "m_pViewModelServices");
// m_iDisplayHistoryBits
[SchemaMember("CCSPlayerPawnBase", "m_iDisplayHistoryBits")]
public ref UInt32 DisplayHistoryBits => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayerPawnBase", "m_iDisplayHistoryBits");
// m_flLastAttackedTeammate
[SchemaMember("CCSPlayerPawnBase", "m_flLastAttackedTeammate")]
public ref float LastAttackedTeammate => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastAttackedTeammate");
// m_hOriginalController
[SchemaMember("CCSPlayerPawnBase", "m_hOriginalController")]
public CHandle<CCSPlayerController> OriginalController => Schema.GetDeclaredClass<CHandle<CCSPlayerController>>(this.Handle, "CCSPlayerPawnBase", "m_hOriginalController");
// m_blindUntilTime
[SchemaMember("CCSPlayerPawnBase", "m_blindUntilTime")]
public ref float BlindUntilTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_blindUntilTime");
@@ -50,82 +38,14 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_blindStartTime")]
public ref float BlindStartTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_blindStartTime");
// m_allowAutoFollowTime
[SchemaMember("CCSPlayerPawnBase", "m_allowAutoFollowTime")]
public ref float AllowAutoFollowTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_allowAutoFollowTime");
// m_entitySpottedState
[SchemaMember("CCSPlayerPawnBase", "m_entitySpottedState")]
public EntitySpottedState_t EntitySpottedState => Schema.GetDeclaredClass<EntitySpottedState_t>(this.Handle, "CCSPlayerPawnBase", "m_entitySpottedState");
// m_nSpotRules
[SchemaMember("CCSPlayerPawnBase", "m_nSpotRules")]
public ref Int32 SpotRules => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nSpotRules");
// m_iPlayerState
[SchemaMember("CCSPlayerPawnBase", "m_iPlayerState")]
public ref CSPlayerState PlayerState => ref Schema.GetRef<CSPlayerState>(this.Handle, "CCSPlayerPawnBase", "m_iPlayerState");
// m_chickenIdleSoundTimer
[SchemaMember("CCSPlayerPawnBase", "m_chickenIdleSoundTimer")]
public CountdownTimer ChickenIdleSoundTimer => Schema.GetDeclaredClass<CountdownTimer>(this.Handle, "CCSPlayerPawnBase", "m_chickenIdleSoundTimer");
// m_chickenJumpSoundTimer
[SchemaMember("CCSPlayerPawnBase", "m_chickenJumpSoundTimer")]
public CountdownTimer ChickenJumpSoundTimer => Schema.GetDeclaredClass<CountdownTimer>(this.Handle, "CCSPlayerPawnBase", "m_chickenJumpSoundTimer");
// m_vecLastBookmarkedPosition
[SchemaMember("CCSPlayerPawnBase", "m_vecLastBookmarkedPosition")]
public Vector LastBookmarkedPosition => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecLastBookmarkedPosition");
// m_flLastDistanceTraveledNotice
[SchemaMember("CCSPlayerPawnBase", "m_flLastDistanceTraveledNotice")]
public ref float LastDistanceTraveledNotice => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastDistanceTraveledNotice");
// m_flAccumulatedDistanceTraveled
[SchemaMember("CCSPlayerPawnBase", "m_flAccumulatedDistanceTraveled")]
public ref float AccumulatedDistanceTraveled => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flAccumulatedDistanceTraveled");
// m_flLastFriendlyFireDamageReductionRatio
[SchemaMember("CCSPlayerPawnBase", "m_flLastFriendlyFireDamageReductionRatio")]
public ref float LastFriendlyFireDamageReductionRatio => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastFriendlyFireDamageReductionRatio");
// m_bRespawning
[SchemaMember("CCSPlayerPawnBase", "m_bRespawning")]
public ref bool Respawning => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bRespawning");
// m_nLastPickupPriority
[SchemaMember("CCSPlayerPawnBase", "m_nLastPickupPriority")]
public ref Int32 LastPickupPriority => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nLastPickupPriority");
// m_flLastPickupPriorityTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastPickupPriorityTime")]
public ref float LastPickupPriorityTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastPickupPriorityTime");
// m_bIsScoped
[SchemaMember("CCSPlayerPawnBase", "m_bIsScoped")]
public ref bool IsScoped => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsScoped");
// m_bIsWalking
[SchemaMember("CCSPlayerPawnBase", "m_bIsWalking")]
public ref bool IsWalking => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsWalking");
// m_bResumeZoom
[SchemaMember("CCSPlayerPawnBase", "m_bResumeZoom")]
public ref bool ResumeZoom => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bResumeZoom");
// m_bIsDefusing
[SchemaMember("CCSPlayerPawnBase", "m_bIsDefusing")]
public ref bool IsDefusing => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsDefusing");
// m_bIsGrabbingHostage
[SchemaMember("CCSPlayerPawnBase", "m_bIsGrabbingHostage")]
public ref bool IsGrabbingHostage => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsGrabbingHostage");
// m_iBlockingUseActionInProgress
[SchemaMember("CCSPlayerPawnBase", "m_iBlockingUseActionInProgress")]
public ref CSPlayerBlockingUseAction_t BlockingUseActionInProgress => ref Schema.GetRef<CSPlayerBlockingUseAction_t>(this.Handle, "CCSPlayerPawnBase", "m_iBlockingUseActionInProgress");
// m_fImmuneToGunGameDamageTime
[SchemaMember("CCSPlayerPawnBase", "m_fImmuneToGunGameDamageTime")]
public ref float ImmuneToGunGameDamageTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fImmuneToGunGameDamageTime");
@@ -134,14 +54,6 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_bGunGameImmunity")]
public ref bool GunGameImmunity => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bGunGameImmunity");
// m_GunGameImmunityColor
[SchemaMember("CCSPlayerPawnBase", "m_GunGameImmunityColor")]
public Color GunGameImmunityColor
{
get { return Schema.GetCustomMarshalledType<Color>(this.Handle, "CCSPlayerPawnBase", "m_GunGameImmunityColor"); }
set { Schema.SetCustomMarshalledType<Color>(this.Handle, "CCSPlayerPawnBase", "m_GunGameImmunityColor", value); }
}
// m_fMolotovDamageTime
[SchemaMember("CCSPlayerPawnBase", "m_fMolotovDamageTime")]
public ref float MolotovDamageTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fMolotovDamageTime");
@@ -150,206 +62,18 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_bHasMovedSinceSpawn")]
public ref bool HasMovedSinceSpawn => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHasMovedSinceSpawn");
// m_bCanMoveDuringFreezePeriod
[SchemaMember("CCSPlayerPawnBase", "m_bCanMoveDuringFreezePeriod")]
public ref bool CanMoveDuringFreezePeriod => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bCanMoveDuringFreezePeriod");
// m_flGuardianTooFarDistFrac
[SchemaMember("CCSPlayerPawnBase", "m_flGuardianTooFarDistFrac")]
public ref float GuardianTooFarDistFrac => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flGuardianTooFarDistFrac");
// m_flNextGuardianTooFarHurtTime
[SchemaMember("CCSPlayerPawnBase", "m_flNextGuardianTooFarHurtTime")]
public ref float NextGuardianTooFarHurtTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flNextGuardianTooFarHurtTime");
// m_flDetectedByEnemySensorTime
[SchemaMember("CCSPlayerPawnBase", "m_flDetectedByEnemySensorTime")]
public ref float DetectedByEnemySensorTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flDetectedByEnemySensorTime");
// m_flDealtDamageToEnemyMostRecentTimestamp
[SchemaMember("CCSPlayerPawnBase", "m_flDealtDamageToEnemyMostRecentTimestamp")]
public ref float DealtDamageToEnemyMostRecentTimestamp => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flDealtDamageToEnemyMostRecentTimestamp");
// m_flLastEquippedHelmetTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastEquippedHelmetTime")]
public ref float LastEquippedHelmetTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastEquippedHelmetTime");
// m_flLastEquippedArmorTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastEquippedArmorTime")]
public ref float LastEquippedArmorTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastEquippedArmorTime");
// m_nHeavyAssaultSuitCooldownRemaining
[SchemaMember("CCSPlayerPawnBase", "m_nHeavyAssaultSuitCooldownRemaining")]
public ref Int32 HeavyAssaultSuitCooldownRemaining => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nHeavyAssaultSuitCooldownRemaining");
// m_bResetArmorNextSpawn
[SchemaMember("CCSPlayerPawnBase", "m_bResetArmorNextSpawn")]
public ref bool ResetArmorNextSpawn => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bResetArmorNextSpawn");
// m_flLastBumpMineBumpTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastBumpMineBumpTime")]
public ref float LastBumpMineBumpTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastBumpMineBumpTime");
// m_flEmitSoundTime
[SchemaMember("CCSPlayerPawnBase", "m_flEmitSoundTime")]
public ref float EmitSoundTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flEmitSoundTime");
// m_iNumSpawns
[SchemaMember("CCSPlayerPawnBase", "m_iNumSpawns")]
public ref Int32 NumSpawns => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iNumSpawns");
// m_iShouldHaveCash
[SchemaMember("CCSPlayerPawnBase", "m_iShouldHaveCash")]
public ref Int32 ShouldHaveCash => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iShouldHaveCash");
// m_flIdleTimeSinceLastAction
[SchemaMember("CCSPlayerPawnBase", "m_flIdleTimeSinceLastAction")]
public ref float IdleTimeSinceLastAction => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flIdleTimeSinceLastAction");
// m_flNameChangeHistory
[SchemaMember("CCSPlayerPawnBase", "m_flNameChangeHistory")]
public Span<float> NameChangeHistory => Schema.GetFixedArray<float>(this.Handle, "CCSPlayerPawnBase", "m_flNameChangeHistory", 5);
// m_fLastGivenDefuserTime
[SchemaMember("CCSPlayerPawnBase", "m_fLastGivenDefuserTime")]
public ref float LastGivenDefuserTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fLastGivenDefuserTime");
// m_fLastGivenBombTime
[SchemaMember("CCSPlayerPawnBase", "m_fLastGivenBombTime")]
public ref float LastGivenBombTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fLastGivenBombTime");
// m_bHasNightVision
[SchemaMember("CCSPlayerPawnBase", "m_bHasNightVision")]
public ref bool HasNightVision => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHasNightVision");
// m_bNightVisionOn
[SchemaMember("CCSPlayerPawnBase", "m_bNightVisionOn")]
public ref bool NightVisionOn => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bNightVisionOn");
// m_fNextRadarUpdateTime
[SchemaMember("CCSPlayerPawnBase", "m_fNextRadarUpdateTime")]
public ref float NextRadarUpdateTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fNextRadarUpdateTime");
// m_flLastMoneyUpdateTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastMoneyUpdateTime")]
public ref float LastMoneyUpdateTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastMoneyUpdateTime");
// m_MenuStringBuffer
[SchemaMember("CCSPlayerPawnBase", "m_MenuStringBuffer")]
public string MenuStringBuffer
{
get { return Schema.GetString(this.Handle, "CCSPlayerPawnBase", "m_MenuStringBuffer"); }
set { Schema.SetStringBytes(this.Handle, "CCSPlayerPawnBase", "m_MenuStringBuffer", value, 1024); }
}
// m_fIntroCamTime
[SchemaMember("CCSPlayerPawnBase", "m_fIntroCamTime")]
public ref float IntroCamTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_fIntroCamTime");
// m_nMyCollisionGroup
[SchemaMember("CCSPlayerPawnBase", "m_nMyCollisionGroup")]
public ref Int32 MyCollisionGroup => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nMyCollisionGroup");
// m_bInNoDefuseArea
[SchemaMember("CCSPlayerPawnBase", "m_bInNoDefuseArea")]
public ref bool InNoDefuseArea => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bInNoDefuseArea");
// m_bKilledByTaser
[SchemaMember("CCSPlayerPawnBase", "m_bKilledByTaser")]
public ref bool KilledByTaser => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bKilledByTaser");
// m_iMoveState
[SchemaMember("CCSPlayerPawnBase", "m_iMoveState")]
public ref Int32 MoveState => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iMoveState");
// m_grenadeParameterStashTime
[SchemaMember("CCSPlayerPawnBase", "m_grenadeParameterStashTime")]
public ref float GrenadeParameterStashTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_grenadeParameterStashTime");
// m_bGrenadeParametersStashed
[SchemaMember("CCSPlayerPawnBase", "m_bGrenadeParametersStashed")]
public ref bool GrenadeParametersStashed => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bGrenadeParametersStashed");
// m_angStashedShootAngles
[SchemaMember("CCSPlayerPawnBase", "m_angStashedShootAngles")]
public QAngle StashedShootAngles => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_angStashedShootAngles");
// m_vecStashedGrenadeThrowPosition
[SchemaMember("CCSPlayerPawnBase", "m_vecStashedGrenadeThrowPosition")]
public Vector StashedGrenadeThrowPosition => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecStashedGrenadeThrowPosition");
// m_vecStashedVelocity
[SchemaMember("CCSPlayerPawnBase", "m_vecStashedVelocity")]
public Vector StashedVelocity => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecStashedVelocity");
// m_angShootAngleHistory
[SchemaMember("CCSPlayerPawnBase", "m_angShootAngleHistory")]
public Span<QAngle> ShootAngleHistory => Schema.GetFixedArray<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_angShootAngleHistory", 2);
// m_vecThrowPositionHistory
[SchemaMember("CCSPlayerPawnBase", "m_vecThrowPositionHistory")]
public Span<Vector> ThrowPositionHistory => Schema.GetFixedArray<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecThrowPositionHistory", 2);
// m_vecVelocityHistory
[SchemaMember("CCSPlayerPawnBase", "m_vecVelocityHistory")]
public Span<Vector> VelocityHistory => Schema.GetFixedArray<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecVelocityHistory", 2);
// m_bDiedAirborne
[SchemaMember("CCSPlayerPawnBase", "m_bDiedAirborne")]
public ref bool DiedAirborne => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bDiedAirborne");
// m_iBombSiteIndex
[SchemaMember("CCSPlayerPawnBase", "m_iBombSiteIndex")]
public CEntityIndex BombSiteIndex => Schema.GetDeclaredClass<CEntityIndex>(this.Handle, "CCSPlayerPawnBase", "m_iBombSiteIndex");
// m_nWhichBombZone
[SchemaMember("CCSPlayerPawnBase", "m_nWhichBombZone")]
public ref Int32 WhichBombZone => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nWhichBombZone");
// m_bInBombZoneTrigger
[SchemaMember("CCSPlayerPawnBase", "m_bInBombZoneTrigger")]
public ref bool InBombZoneTrigger => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bInBombZoneTrigger");
// m_bWasInBombZoneTrigger
[SchemaMember("CCSPlayerPawnBase", "m_bWasInBombZoneTrigger")]
public ref bool WasInBombZoneTrigger => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bWasInBombZoneTrigger");
// m_iDirection
[SchemaMember("CCSPlayerPawnBase", "m_iDirection")]
public ref Int32 Direction => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iDirection");
// m_iShotsFired
[SchemaMember("CCSPlayerPawnBase", "m_iShotsFired")]
public ref Int32 ShotsFired => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iShotsFired");
// m_ArmorValue
[SchemaMember("CCSPlayerPawnBase", "m_ArmorValue")]
public ref Int32 ArmorValue => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_ArmorValue");
// m_flFlinchStack
[SchemaMember("CCSPlayerPawnBase", "m_flFlinchStack")]
public ref float FlinchStack => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flFlinchStack");
// m_flVelocityModifier
[SchemaMember("CCSPlayerPawnBase", "m_flVelocityModifier")]
public ref float VelocityModifier => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flVelocityModifier");
// m_flHitHeading
[SchemaMember("CCSPlayerPawnBase", "m_flHitHeading")]
public ref float HitHeading => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flHitHeading");
// m_nHitBodyPart
[SchemaMember("CCSPlayerPawnBase", "m_nHitBodyPart")]
public ref Int32 HitBodyPart => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nHitBodyPart");
// m_iHostagesKilled
[SchemaMember("CCSPlayerPawnBase", "m_iHostagesKilled")]
public ref Int32 HostagesKilled => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iHostagesKilled");
// m_vecTotalBulletForce
[SchemaMember("CCSPlayerPawnBase", "m_vecTotalBulletForce")]
public Vector TotalBulletForce => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecTotalBulletForce");
// m_flFlashDuration
[SchemaMember("CCSPlayerPawnBase", "m_flFlashDuration")]
public ref float FlashDuration => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flFlashDuration");
@@ -366,86 +90,10 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_iProgressBarDuration")]
public ref Int32 ProgressBarDuration => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iProgressBarDuration");
// m_bWaitForNoAttack
[SchemaMember("CCSPlayerPawnBase", "m_bWaitForNoAttack")]
public ref bool WaitForNoAttack => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bWaitForNoAttack");
// m_flLowerBodyYawTarget
[SchemaMember("CCSPlayerPawnBase", "m_flLowerBodyYawTarget")]
public ref float LowerBodyYawTarget => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLowerBodyYawTarget");
// m_bStrafing
[SchemaMember("CCSPlayerPawnBase", "m_bStrafing")]
public ref bool Strafing => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bStrafing");
// m_lastStandingPos
[SchemaMember("CCSPlayerPawnBase", "m_lastStandingPos")]
public Vector LastStandingPos => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_lastStandingPos");
// m_ignoreLadderJumpTime
[SchemaMember("CCSPlayerPawnBase", "m_ignoreLadderJumpTime")]
public ref float IgnoreLadderJumpTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_ignoreLadderJumpTime");
// m_ladderSurpressionTimer
[SchemaMember("CCSPlayerPawnBase", "m_ladderSurpressionTimer")]
public CountdownTimer LadderSurpressionTimer => Schema.GetDeclaredClass<CountdownTimer>(this.Handle, "CCSPlayerPawnBase", "m_ladderSurpressionTimer");
// m_lastLadderNormal
[SchemaMember("CCSPlayerPawnBase", "m_lastLadderNormal")]
public Vector LastLadderNormal => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_lastLadderNormal");
// m_lastLadderPos
[SchemaMember("CCSPlayerPawnBase", "m_lastLadderPos")]
public Vector LastLadderPos => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_lastLadderPos");
// m_thirdPersonHeading
[SchemaMember("CCSPlayerPawnBase", "m_thirdPersonHeading")]
public QAngle ThirdPersonHeading => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_thirdPersonHeading");
// m_flSlopeDropOffset
[SchemaMember("CCSPlayerPawnBase", "m_flSlopeDropOffset")]
public ref float SlopeDropOffset => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flSlopeDropOffset");
// m_flSlopeDropHeight
[SchemaMember("CCSPlayerPawnBase", "m_flSlopeDropHeight")]
public ref float SlopeDropHeight => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flSlopeDropHeight");
// m_vHeadConstraintOffset
[SchemaMember("CCSPlayerPawnBase", "m_vHeadConstraintOffset")]
public Vector HeadConstraintOffset => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vHeadConstraintOffset");
// m_iLastWeaponFireUsercmd
[SchemaMember("CCSPlayerPawnBase", "m_iLastWeaponFireUsercmd")]
public ref Int32 LastWeaponFireUsercmd => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iLastWeaponFireUsercmd");
// m_angEyeAngles
[SchemaMember("CCSPlayerPawnBase", "m_angEyeAngles")]
public QAngle EyeAngles => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_angEyeAngles");
// m_bVCollisionInitted
[SchemaMember("CCSPlayerPawnBase", "m_bVCollisionInitted")]
public ref bool VCollisionInitted => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bVCollisionInitted");
// m_storedSpawnPosition
[SchemaMember("CCSPlayerPawnBase", "m_storedSpawnPosition")]
public Vector StoredSpawnPosition => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_storedSpawnPosition");
// m_storedSpawnAngle
[SchemaMember("CCSPlayerPawnBase", "m_storedSpawnAngle")]
public QAngle StoredSpawnAngle => Schema.GetDeclaredClass<QAngle>(this.Handle, "CCSPlayerPawnBase", "m_storedSpawnAngle");
// m_bIsSpawning
[SchemaMember("CCSPlayerPawnBase", "m_bIsSpawning")]
public ref bool IsSpawning => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bIsSpawning");
// m_bHideTargetID
[SchemaMember("CCSPlayerPawnBase", "m_bHideTargetID")]
public ref bool HideTargetID => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHideTargetID");
// m_nNumDangerZoneDamageHits
[SchemaMember("CCSPlayerPawnBase", "m_nNumDangerZoneDamageHits")]
public ref Int32 NumDangerZoneDamageHits => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nNumDangerZoneDamageHits");
// m_bHud_MiniScoreHidden
[SchemaMember("CCSPlayerPawnBase", "m_bHud_MiniScoreHidden")]
public ref bool Hud_MiniScoreHidden => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHud_MiniScoreHidden");
@@ -454,42 +102,6 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_bHud_RadarHidden")]
public ref bool Hud_RadarHidden => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHud_RadarHidden");
// m_nLastKillerIndex
[SchemaMember("CCSPlayerPawnBase", "m_nLastKillerIndex")]
public CEntityIndex LastKillerIndex => Schema.GetDeclaredClass<CEntityIndex>(this.Handle, "CCSPlayerPawnBase", "m_nLastKillerIndex");
// m_nLastConcurrentKilled
[SchemaMember("CCSPlayerPawnBase", "m_nLastConcurrentKilled")]
public ref Int32 LastConcurrentKilled => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nLastConcurrentKilled");
// m_nDeathCamMusic
[SchemaMember("CCSPlayerPawnBase", "m_nDeathCamMusic")]
public ref Int32 DeathCamMusic => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nDeathCamMusic");
// m_iAddonBits
[SchemaMember("CCSPlayerPawnBase", "m_iAddonBits")]
public ref Int32 AddonBits => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iAddonBits");
// m_iPrimaryAddon
[SchemaMember("CCSPlayerPawnBase", "m_iPrimaryAddon")]
public ref Int32 PrimaryAddon => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iPrimaryAddon");
// m_iSecondaryAddon
[SchemaMember("CCSPlayerPawnBase", "m_iSecondaryAddon")]
public ref Int32 SecondaryAddon => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iSecondaryAddon");
// m_currentDeafnessFilter
[SchemaMember("CCSPlayerPawnBase", "m_currentDeafnessFilter")]
public CUtlStringToken CurrentDeafnessFilter => Schema.GetDeclaredClass<CUtlStringToken>(this.Handle, "CCSPlayerPawnBase", "m_currentDeafnessFilter");
// m_NumEnemiesKilledThisSpawn
[SchemaMember("CCSPlayerPawnBase", "m_NumEnemiesKilledThisSpawn")]
public ref Int32 NumEnemiesKilledThisSpawn => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_NumEnemiesKilledThisSpawn");
// m_NumEnemiesKilledThisRound
[SchemaMember("CCSPlayerPawnBase", "m_NumEnemiesKilledThisRound")]
public ref Int32 NumEnemiesKilledThisRound => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_NumEnemiesKilledThisRound");
// m_NumEnemiesAtRoundStart
[SchemaMember("CCSPlayerPawnBase", "m_NumEnemiesAtRoundStart")]
public ref Int32 NumEnemiesAtRoundStart => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_NumEnemiesAtRoundStart");
@@ -498,76 +110,16 @@ public partial class CCSPlayerPawnBase : CBasePlayerPawn
[SchemaMember("CCSPlayerPawnBase", "m_wasNotKilledNaturally")]
public ref bool WasNotKilledNaturally => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_wasNotKilledNaturally");
// m_vecPlayerPatchEconIndices
[SchemaMember("CCSPlayerPawnBase", "m_vecPlayerPatchEconIndices")]
public Span<UInt32> PlayerPatchEconIndices => Schema.GetFixedArray<UInt32>(this.Handle, "CCSPlayerPawnBase", "m_vecPlayerPatchEconIndices", 5);
// m_iDeathFlags
[SchemaMember("CCSPlayerPawnBase", "m_iDeathFlags")]
public ref Int32 DeathFlags => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_iDeathFlags");
// m_hPet
[SchemaMember("CCSPlayerPawnBase", "m_hPet")]
public CHandle<CChicken> Pet => Schema.GetDeclaredClass<CHandle<CChicken>>(this.Handle, "CCSPlayerPawnBase", "m_hPet");
// m_unCurrentEquipmentValue
[SchemaMember("CCSPlayerPawnBase", "m_unCurrentEquipmentValue")]
public ref UInt16 CurrentEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawnBase", "m_unCurrentEquipmentValue");
// m_unRoundStartEquipmentValue
[SchemaMember("CCSPlayerPawnBase", "m_unRoundStartEquipmentValue")]
public ref UInt16 RoundStartEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawnBase", "m_unRoundStartEquipmentValue");
// m_unFreezetimeEndEquipmentValue
[SchemaMember("CCSPlayerPawnBase", "m_unFreezetimeEndEquipmentValue")]
public ref UInt16 FreezetimeEndEquipmentValue => ref Schema.GetRef<UInt16>(this.Handle, "CCSPlayerPawnBase", "m_unFreezetimeEndEquipmentValue");
// m_nSurvivalTeamNumber
[SchemaMember("CCSPlayerPawnBase", "m_nSurvivalTeamNumber")]
public ref Int32 SurvivalTeamNumber => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_nSurvivalTeamNumber");
// m_bHasDeathInfo
[SchemaMember("CCSPlayerPawnBase", "m_bHasDeathInfo")]
public ref bool HasDeathInfo => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bHasDeathInfo");
// m_flDeathInfoTime
[SchemaMember("CCSPlayerPawnBase", "m_flDeathInfoTime")]
public ref float DeathInfoTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flDeathInfoTime");
// m_vecDeathInfoOrigin
[SchemaMember("CCSPlayerPawnBase", "m_vecDeathInfoOrigin")]
public Vector DeathInfoOrigin => Schema.GetDeclaredClass<Vector>(this.Handle, "CCSPlayerPawnBase", "m_vecDeathInfoOrigin");
// m_bKilledByHeadshot
[SchemaMember("CCSPlayerPawnBase", "m_bKilledByHeadshot")]
public ref bool KilledByHeadshot => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bKilledByHeadshot");
// m_LastHitBox
[SchemaMember("CCSPlayerPawnBase", "m_LastHitBox")]
public ref Int32 LastHitBox => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_LastHitBox");
// m_LastHealth
[SchemaMember("CCSPlayerPawnBase", "m_LastHealth")]
public ref Int32 LastHealth => ref Schema.GetRef<Int32>(this.Handle, "CCSPlayerPawnBase", "m_LastHealth");
// m_flLastCollisionCeiling
[SchemaMember("CCSPlayerPawnBase", "m_flLastCollisionCeiling")]
public ref float LastCollisionCeiling => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastCollisionCeiling");
// m_flLastCollisionCeilingChangeTime
[SchemaMember("CCSPlayerPawnBase", "m_flLastCollisionCeilingChangeTime")]
public ref float LastCollisionCeilingChangeTime => ref Schema.GetRef<float>(this.Handle, "CCSPlayerPawnBase", "m_flLastCollisionCeilingChangeTime");
// m_pBot
[SchemaMember("CCSPlayerPawnBase", "m_pBot")]
public CCSBot? Bot => Schema.GetPointer<CCSBot>(this.Handle, "CCSPlayerPawnBase", "m_pBot");
// m_bBotAllowActive
[SchemaMember("CCSPlayerPawnBase", "m_bBotAllowActive")]
public ref bool BotAllowActive => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bBotAllowActive");
// m_bCommittingSuicideOnTeamChange
[SchemaMember("CCSPlayerPawnBase", "m_bCommittingSuicideOnTeamChange")]
public ref bool CommittingSuicideOnTeamChange => ref Schema.GetRef<bool>(this.Handle, "CCSPlayerPawnBase", "m_bCommittingSuicideOnTeamChange");
// m_hOriginalController
[SchemaMember("CCSPlayerPawnBase", "m_hOriginalController")]
public CHandle<CCSPlayerController> OriginalController => Schema.GetDeclaredClass<CHandle<CCSPlayerController>>(this.Handle, "CCSPlayerPawnBase", "m_hOriginalController");
}

View File

@@ -26,10 +26,6 @@ public partial class CCSPlayer_UseServices : CPlayer_UseServices
[SchemaMember("CCSPlayer_UseServices", "m_flLastUseTimeStamp")]
public ref float LastUseTimeStamp => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_UseServices", "m_flLastUseTimeStamp");
// m_flTimeStartedHoldingUse
[SchemaMember("CCSPlayer_UseServices", "m_flTimeStartedHoldingUse")]
public ref float TimeStartedHoldingUse => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_UseServices", "m_flTimeStartedHoldingUse");
// m_flTimeLastUsedWindow
[SchemaMember("CCSPlayer_UseServices", "m_flTimeLastUsedWindow")]
public ref float TimeLastUsedWindow => ref Schema.GetRef<float>(this.Handle, "CCSPlayer_UseServices", "m_flTimeLastUsedWindow");

View File

@@ -66,6 +66,10 @@ public partial class CCSPlayer_WeaponServices : CPlayer_WeaponServices
[SchemaMember("CCSPlayer_WeaponServices", "m_bDisableAutoDeploy")]
public ref bool DisableAutoDeploy => ref Schema.GetRef<bool>(this.Handle, "CCSPlayer_WeaponServices", "m_bDisableAutoDeploy");
// m_bIsPickingUpGroundWeapon
[SchemaMember("CCSPlayer_WeaponServices", "m_bIsPickingUpGroundWeapon")]
public ref bool IsPickingUpGroundWeapon => ref Schema.GetRef<bool>(this.Handle, "CCSPlayer_WeaponServices", "m_bIsPickingUpGroundWeapon");
// m_nOldShootPositionHistoryCount
[SchemaMember("CCSPlayer_WeaponServices", "m_nOldShootPositionHistoryCount")]
public ref UInt32 OldShootPositionHistoryCount => ref Schema.GetRef<UInt32>(this.Handle, "CCSPlayer_WeaponServices", "m_nOldShootPositionHistoryCount");

View File

@@ -194,6 +194,14 @@ public partial class CCSWeaponBase : CBasePlayerWeapon
[SchemaMember("CCSWeaponBase", "m_iOriginalTeamNumber")]
public ref Int32 OriginalTeamNumber => ref Schema.GetRef<Int32>(this.Handle, "CCSWeaponBase", "m_iOriginalTeamNumber");
// m_iMostRecentTeamNumber
[SchemaMember("CCSWeaponBase", "m_iMostRecentTeamNumber")]
public ref Int32 MostRecentTeamNumber => ref Schema.GetRef<Int32>(this.Handle, "CCSWeaponBase", "m_iMostRecentTeamNumber");
// m_bDroppedNearBuyZone
[SchemaMember("CCSWeaponBase", "m_bDroppedNearBuyZone")]
public ref bool DroppedNearBuyZone => ref Schema.GetRef<bool>(this.Handle, "CCSWeaponBase", "m_bDroppedNearBuyZone");
// m_flNextAttackRenderTimeOffset
[SchemaMember("CCSWeaponBase", "m_flNextAttackRenderTimeOffset")]
public ref float NextAttackRenderTimeOffset => ref Schema.GetRef<float>(this.Handle, "CCSWeaponBase", "m_flNextAttackRenderTimeOffset");

View File

@@ -20,11 +20,11 @@ public partial class CDamageRecord : NativeObject
// m_PlayerDamager
[SchemaMember("CDamageRecord", "m_PlayerDamager")]
public CHandle<CCSPlayerPawnBase> PlayerDamager => Schema.GetDeclaredClass<CHandle<CCSPlayerPawnBase>>(this.Handle, "CDamageRecord", "m_PlayerDamager");
public CHandle<CCSPlayerPawn> PlayerDamager => Schema.GetDeclaredClass<CHandle<CCSPlayerPawn>>(this.Handle, "CDamageRecord", "m_PlayerDamager");
// m_PlayerRecipient
[SchemaMember("CDamageRecord", "m_PlayerRecipient")]
public CHandle<CCSPlayerPawnBase> PlayerRecipient => Schema.GetDeclaredClass<CHandle<CCSPlayerPawnBase>>(this.Handle, "CDamageRecord", "m_PlayerRecipient");
public CHandle<CCSPlayerPawn> PlayerRecipient => Schema.GetDeclaredClass<CHandle<CCSPlayerPawn>>(this.Handle, "CDamageRecord", "m_PlayerRecipient");
// m_hPlayerControllerDamager
[SchemaMember("CDamageRecord", "m_hPlayerControllerDamager")]

View File

@@ -22,4 +22,8 @@ public partial class CWeaponTaser : CCSWeaponBaseGun
[SchemaMember("CWeaponTaser", "m_fFireTime")]
public ref float FireTime => ref Schema.GetRef<float>(this.Handle, "CWeaponTaser", "m_fFireTime");
// m_nLastAttackTick
[SchemaMember("CWeaponTaser", "m_nLastAttackTick")]
public ref Int32 LastAttackTick => ref Schema.GetRef<Int32>(this.Handle, "CWeaponTaser", "m_nLastAttackTick");
}

View File

@@ -28,7 +28,7 @@ public enum SoundFlags_t : uint
SOUND_CONTEXT_DANGER_APPROACH = 0x2000000,
SOUND_CONTEXT_ALLIES_ONLY = 0x4000000,
SOUND_CONTEXT_PANIC_NPCS = 0x8000000,
ALL_CONTEXTS = 0xFFFFFFFF,
ALL_CONTEXTS = 0xFFF00000,
ALL_SCENTS = 0x0,
ALL_SOUNDS = 0xFFFFF,
}

View File

@@ -11,4 +11,5 @@ public enum WeaponSwitchReason_t : uint
eDrawn = 0x0,
eEquipped = 0x1,
eUserInitiatedSwitchToLast = 0x2,
eUserInitiatedSwitchHands = 0x3,
}

View File

@@ -14,6 +14,7 @@
* along with CounterStrikeSharp. If not, see <https://www.gnu.org/licenses/>. *
*/
using System.Numerics;
using System.Runtime.CompilerServices;
namespace CounterStrikeSharp.API.Modules.Utils
@@ -27,10 +28,14 @@ namespace CounterStrikeSharp.API.Modules.Utils
/// <item><term>Z</term><description>+up/-down</description></item>
/// </list>
/// </summary>
public class Vector : NativeObject
public class Vector : NativeObject,
IAdditionOperators<Vector, Vector, Vector>,
ISubtractionOperators<Vector, Vector, Vector>,
IMultiplyOperators<Vector, float, Vector>,
IDivisionOperators<Vector, float, Vector>
{
public static readonly Vector Zero = new();
public Vector(IntPtr pointer) : base(pointer)
{
}
@@ -45,7 +50,7 @@ namespace CounterStrikeSharp.API.Modules.Utils
public unsafe ref float X => ref Unsafe.Add(ref *(float*)Handle, 0);
public unsafe ref float Y => ref Unsafe.Add(ref *(float*)Handle, 1);
public unsafe ref float Z => ref Unsafe.Add(ref *(float*)Handle, 2);
/// <summary>
/// Returns a copy of the vector with values replaced.
/// </summary>
@@ -75,7 +80,7 @@ namespace CounterStrikeSharp.API.Modules.Utils
this.Z += vector.Z;
}
/// <summary>
/// Returns an angle that represents the normal of the vector.
/// </summary>
@@ -181,7 +186,7 @@ namespace CounterStrikeSharp.API.Modules.Utils
public bool IsZero() => NativeAPI.VectorIsZero(Handle);
/// <summary>
/// Returns the Euclidean length of the vector: √x² + y² + z²
/// Returns the Euclidean length of the vector: √x² + y² + z²
/// </summary>
/// <returns>Euclidean length of vector</returns>
public float Length() => NativeAPI.VectorLength(Handle);
@@ -235,7 +240,7 @@ namespace CounterStrikeSharp.API.Modules.Utils
var returnVal = new Vector();
NativePINVOKE.VectorRotate__SWIG_1(ptr, angle.Handle(), returnVal.Handle());
Set(returnVal);
}
}
/// <summary>
/// Copies X, Y and Z into this Vector
@@ -296,21 +301,23 @@ namespace CounterStrikeSharp.API.Modules.Utils
public float this[int i]
{
get {
get
{
switch (i)
{
case 0:
return this.X;
case 1:
return this.Y;
case 2:
return this.Z;
case 2:
return this.Z;
}
return 0;
}
set {
switch (i)
set
{
switch (i)
{
case 0:
this.X = value;
@@ -318,7 +325,7 @@ namespace CounterStrikeSharp.API.Modules.Utils
case 1:
this.Y = value;
break;
case 2:
case 2:
this.Z = value;
break;
}
@@ -368,8 +375,8 @@ namespace CounterStrikeSharp.API.Modules.Utils
return $"{X:n2} {Y:n2} {Z:n2}";
}
/*
/*
*/
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -157,19 +157,15 @@ void* CGameConfig::ResolveSignature(const char* name)
CSSHARP_CORE_ERROR("Invalid symbol for {}\n", name);
return nullptr;
}
address = dlsym((*module)->m_hModule, symbol);
address = (*module)->FindSymbol(symbol);
} else {
const char* signature = this->GetSignature(name);
if (!signature) {
CSSHARP_CORE_ERROR("Failed to find signature for {}\n", name);
return nullptr;
}
size_t iLength = 0;
auto pSignature = HexToByte(signature);
if (pSignature.empty()) {
return nullptr;
}
address = (*module)->FindSignature(pSignature);
address = (*module)->FindSignature(signature);
}
if (!address) {
@@ -235,6 +231,10 @@ std::vector<int16_t> CGameConfig::HexToByte(std::string_view src)
continue;
}
if (byte.size() < 2) [[unlikely]] {
return {};
}
const auto high = hex_char_to_byte(byte[0]);
const auto low = hex_char_to_byte(byte[1]);

View File

@@ -28,6 +28,7 @@
namespace counterstrikesharp {
namespace modules {
std::vector<std::unique_ptr<CModule>> moduleList{};
CModule* engine = nullptr;
CModule* tier0 = nullptr;
CModule* server = nullptr;
@@ -92,11 +93,13 @@ const float engine_fixed_tick_interval = 0.015625f;
void Initialize()
{
modules::engine = new modules::CModule(ROOTBIN, "engine2");
modules::tier0 = new modules::CModule(ROOTBIN, "tier0");
modules::server = new modules::CModule(GAMEBIN, "server");
modules::schemasystem = new modules::CModule(ROOTBIN, "schemasystem");
modules::vscript = new modules::CModule(ROOTBIN, "vscript");
modules::Initialize();
modules::engine = modules::GetModuleByName(MODULE_PREFIX "engine2" MODULE_EXT);
modules::tier0 = modules::GetModuleByName(MODULE_PREFIX "tier0" MODULE_EXT);
modules::server = modules::GetModuleByName(MODULE_PREFIX "server" MODULE_EXT);
modules::schemasystem = modules::GetModuleByName(MODULE_PREFIX "schemasystem" MODULE_EXT);
modules::vscript = modules::GetModuleByName(MODULE_PREFIX "vscript" MODULE_EXT);
interfaces::Initialize();

View File

@@ -8,6 +8,8 @@
#include <thread>
#include <memory>
#include "ISmmAPI.h"
#include "eiface.h"
#include "iserver.h"
@@ -131,6 +133,11 @@ CGlobalVars *getGlobalVars();
namespace modules {
class CModule;
void Initialize();
CModule* GetModuleByName(std::string name);
extern std::vector<std::unique_ptr<CModule>> moduleList;
extern CModule *engine;
extern CModule *tier0;
extern CModule *server;
@@ -143,4 +150,4 @@ extern CModule *vscript;
#undef SH_GLOB_SHPTR
#define SH_GLOB_SHPTR counterstrikesharp::globals::source_hook
#undef SH_GLOB_PLUGPTR
#define SH_GLOB_PLUGPTR counterstrikesharp::globals::source_hook_pluginid
#define SH_GLOB_PLUGPTR counterstrikesharp::globals::source_hook_pluginid

View File

@@ -19,8 +19,8 @@ private:
} // namespace counterstrikesharp
#define CSSHARP_CORE_TRACE(...) ::counterstrikesharp::Log::GetCoreLogger()->trace(__VA_ARGS__)
#define CSSHARP_CORE_DEBUG(...) _ ::counterstrikesharp::Log::GetCoreLogger()->debug(__VA_ARGS__)
#define CSSHARP_CORE_DEBUG(...) ::counterstrikesharp::Log::GetCoreLogger()->debug(__VA_ARGS__)
#define CSSHARP_CORE_INFO(...) ::counterstrikesharp::Log::GetCoreLogger()->info(__VA_ARGS__)
#define CSSHARP_CORE_WARN(...) ::counterstrikesharp::Log::GetCoreLogger()->warn(__VA_ARGS__)
#define CSSHARP_CORE_ERROR(...) ::counterstrikesharp::Log::GetCoreLogger()->error(__VA_ARGS__)
#define CSSHARP_CORE_CRITICAL(...) ::counterstrikesharp::Log::GetCoreLogger()->critical(__VA_ARGS__)
#define CSSHARP_CORE_CRITICAL(...) ::counterstrikesharp::Log::GetCoreLogger()->critical(__VA_ARGS__)

View File

@@ -19,158 +19,14 @@
* This file has been modified for use in CounterStrikeSharp.
*/
#include <cstdlib>
#include <cstring>
#if __linux__
#include <dlfcn.h>
#include <elf.h>
#include <link.h>
#else
#include <Windows.h>
#include <Psapi.h>
#endif
#include "gameconfig.h"
#include <cstdio>
#include "memory_module.h"
#include "metamod_oslink.h"
#include "wchartypes.h"
#include <vector>
#if __linux__
struct ModuleInfo {
const char *path; // in
uint8_t *base; // out
uint size; // out
};
#define PAGE_SIZE 4096
#define PAGE_ALIGN_UP(x) ((x + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
// https://github.com/alliedmodders/sourcemod/blob/master/core/logic/MemoryUtils.cpp#L502-L587
int GetModuleInformation(void *hModule, void **base, size_t *length) {
struct link_map *dlmap = (struct link_map *)hModule;
Dl_info info;
Elf64_Ehdr *file;
Elf64_Phdr *phdr;
uint16_t phdrCount;
if (!dladdr((void *)dlmap->l_addr, &info)) {
return 1;
}
if (!info.dli_fbase || !info.dli_fname) {
return 2;
}
/* This is for our insane sanity checks :o */
uintptr_t baseAddr = reinterpret_cast<uintptr_t>(info.dli_fbase);
file = reinterpret_cast<Elf64_Ehdr *>(baseAddr);
/* Check ELF magic */
if (memcmp(ELFMAG, file->e_ident, SELFMAG) != 0) {
return 3;
}
/* Check ELF version */
if (file->e_ident[EI_VERSION] != EV_CURRENT) {
return 4;
}
/* Check ELF endianness */
if (file->e_ident[EI_DATA] != ELFDATA2LSB) {
return 5;
}
/* Check ELF architecture */
if (file->e_ident[EI_CLASS] != ELFCLASS64 || file->e_machine != EM_X86_64) {
return 6;
}
/* For our purposes, this must be a dynamic library/shared object */
if (file->e_type != ET_DYN) {
return 7;
}
phdrCount = file->e_phnum;
phdr = reinterpret_cast<Elf64_Phdr *>(baseAddr + file->e_phoff);
for (uint16_t i = 0; i < phdrCount; i++) {
Elf64_Phdr &hdr = phdr[i];
/* We only really care about the segment with executable code */
if (hdr.p_type == PT_LOAD && hdr.p_flags == (PF_X | PF_R)) {
/* From glibc, elf/dl-load.c:
* c->mapend = ((ph->p_vaddr + ph->p_filesz + GLRO(dl_pagesize) - 1)
* & ~(GLRO(dl_pagesize) - 1));
*
* In glibc, the segment file size is aligned up to the nearest page size and
* added to the virtual address of the segment. We just want the size here.
*/
// lib.memorySize = PAGE_ALIGN_UP(hdr.p_filesz);
*length = PAGE_ALIGN_UP(hdr.p_filesz);
*base = (void *)(baseAddr + hdr.p_paddr);
break;
}
}
return 0;
}
#endif
void* FindSignature(const char* moduleName, const char* bytesStr) {
auto module = dlmount(moduleName);
auto module = counterstrikesharp::modules::GetModuleByName(moduleName);
if (module == nullptr) {
return nullptr;
}
void* moduleBase;
size_t moduleSize;
#if __linux__
if (GetModuleInformation(module, &moduleBase, &moduleSize) != 0) {
return nullptr;
}
#else
MODULEINFO m_hModuleInfo;
GetModuleInformation(GetCurrentProcess(), module, &m_hModuleInfo, sizeof(m_hModuleInfo));
moduleBase = (void*)m_hModuleInfo.lpBaseOfDll;
moduleSize = m_hModuleInfo.SizeOfImage;
#endif
auto sigBytes = counterstrikesharp::CGameConfig::HexToByte(bytesStr);
if (sigBytes.empty()) {
return nullptr;
}
void* returnAddr = nullptr;
const auto first_byte = sigBytes[0];
auto pMemory = (byte*)moduleBase;
std::uint8_t* end = pMemory + moduleSize - sigBytes.size();
for (std::uint8_t* current = pMemory; current <= end; ++current) {
if (first_byte != -1)
current = std::find(current, end, first_byte);
if (current == end) {
break;
}
if (std::equal(sigBytes.begin() + 1, sigBytes.end(), current + 1,
[](auto opt, auto byte) { return opt == -1 || opt == byte; })) {
return current;
}
}
if (returnAddr == nullptr) {
return nullptr;
}
return returnAddr;
return module->FindSignature(bytesStr);
}

View File

@@ -12,7 +12,4 @@
#define MODULE_EXT ".so"
#endif
#if __linux__
int GetModuleInformation(void *hModule, void **base, size_t *length);
#endif
void* FindSignature(const char* moduleName, const char* bytesStr);

View File

@@ -1,40 +1,437 @@
#include "core/memory_module.h"
#include "core/globals.h"
#include "platform.h"
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <memory>
#include <string_view>
#include <algorithm>
#if _WIN32
#include <Psapi.h>
#include <winternl.h>
#else
#include <link.h>
#include <elf.h>
#endif
#include "dbg.h"
#include "log.h"
#include "core/gameconfig.h"
#include "core/memory.h"
#include "metamod_oslink.h"
namespace counterstrikesharp::modules {
CModule::CModule(const char* path, const char* module) : m_pszModule(module), m_pszPath(path)
void Initialize()
{
char szModule[MAX_PATH];
V_snprintf(szModule, MAX_PATH, "%s%s%s%s%s", Plat_GetGameDirectory(), path, MODULE_PREFIX,
m_pszModule, MODULE_EXT);
m_hModule = dlmount(szModule);
if (!m_hModule)
Error("Could not find %s\n", szModule);
if (!moduleList.empty())
return;
#ifdef _WIN32
MODULEINFO m_hModuleInfo;
GetModuleInformation(GetCurrentProcess(), m_hModule, &m_hModuleInfo, sizeof(m_hModuleInfo));
// walk through peb to get modules
const auto pteb = reinterpret_cast<PTEB>(
__readgsqword(reinterpret_cast<DWORD_PTR>(&static_cast<NT_TIB*>(nullptr)->Self)));
const auto peb = pteb->ProcessEnvironmentBlock;
m_base = (void*)m_hModuleInfo.lpBaseOfDll;
m_size = m_hModuleInfo.SizeOfImage;
for (auto entry = peb->Ldr->InMemoryOrderModuleList.Flink;
entry != &peb->Ldr->InMemoryOrderModuleList; entry = entry->Flink) {
const auto module_entry =
CONTAINING_RECORD(entry, LDR_DATA_TABLE_ENTRY, InMemoryOrderLinks);
std::wstring_view w_name = module_entry->FullDllName.Buffer;
// a hack way to do so
std::string name(w_name.begin(), w_name.end());
std::ranges::replace(name, '\\', '/');
// check for extension first
if (!name.ends_with(MODULE_EXT))
continue;
// no addons
if (name.find(R"(csgo/addons/)") != std::string::npos)
continue;
// we need only modules from ROOTBIN and GAMEBIN
bool isFromRootBin = name.find(ROOTBIN) != std::string::npos;
bool isFromGameBin = name.find(GAMEBIN) != std::string::npos;
if (!isFromGameBin && !isFromRootBin)
continue;
auto mod = std::make_unique<CModule>(
name, reinterpret_cast<std::uintptr_t>(module_entry->DllBase));
// it will delete itself after going out of scope
if (!mod->IsInitialized())
continue;
moduleList.emplace_back(std::move(mod));
}
#else
if (int e = GetModuleInformation(m_hModule, &m_base, &m_size))
Error("Failed to get module info for %s, error %d\n", szModule, e);
dl_iterate_phdr(
[](struct dl_phdr_info* info, size_t, void*) {
std::string name = info->dlpi_name;
if (!name.ends_with(MODULE_EXT))
return 0;
if (name.find("csgo/addons") != std::string::npos)
return 0;
bool isFromRootBin = name.find(ROOTBIN) != std::string::npos;
bool isFromGameBin = name.find(GAMEBIN) != std::string::npos;
if (!isFromGameBin && !isFromRootBin)
return 0;
auto mod = std::make_unique<CModule>(name, info);
if (!mod->IsInitialized())
return 0;
moduleList.emplace_back(std::move(mod));
return 0;
},
nullptr);
#endif
}
CModule* GetModuleByName(std::string name)
{
#ifdef _WIN32
// or add this in GetGameDirectory()?
std::ranges::replace(name, '\\', '/');
#endif
const auto it = std::ranges::find_if(moduleList, [name](const std::unique_ptr<CModule>& i) {
return name.ends_with(i->m_pszModule);
});
if (it == moduleList.end()) {
CSSHARP_CORE_ERROR("Cannot find module {}", name);
return nullptr;
}
return it->get();
}
constexpr std::array modules_to_read_from_disk = {
MODULE_PREFIX "engine2" MODULE_EXT,
MODULE_PREFIX "server" MODULE_EXT,
};
#ifdef _WIN32
CModule::CModule(std::string_view path, std::uint64_t base)
{
const auto dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(base);
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE) {
return;
}
const auto nt_header = reinterpret_cast<PIMAGE_NT_HEADERS>(base + dos_header->e_lfanew);
if (nt_header->Signature != IMAGE_NT_SIGNATURE) {
return;
}
m_base = reinterpret_cast<std::uint8_t*>(base);
m_pszModule = path.substr(path.find_last_of('/') + 1);
m_pszPath = path;
m_baseAddress = base;
m_size = nt_header->OptionalHeader.SizeOfImage;
const bool should_read_from_disk = std::ranges::any_of(modules_to_read_from_disk,
[&](const auto& i) { return m_pszModule == i; });
std::vector<std::uint8_t> disk_data{};
if (should_read_from_disk) {
std::ifstream stream(m_pszPath, std::ios::in | std::ios::binary);
if (!stream.good()) {
CSSHARP_CORE_ERROR("Cannot open file {}", m_pszPath);
return;
}
disk_data.reserve(std::filesystem::file_size(m_pszPath));
disk_data.assign((std::istreambuf_iterator(stream)), std::istreambuf_iterator<char>());
}
auto section = IMAGE_FIRST_SECTION(nt_header);
for (auto i = 0; i < nt_header->FileHeader.NumberOfSections; i++, section++) {
const auto is_executable = (section->Characteristics & IMAGE_SCN_MEM_EXECUTE) != 0;
const auto is_readable = (section->Characteristics & IMAGE_SCN_MEM_READ) != 0;
if (is_executable && is_readable) {
const auto start = this->m_baseAddress + section->VirtualAddress;
const auto size = (std::min)(section->SizeOfRawData, section->Misc.VirtualSize);
const auto data = reinterpret_cast<std::uint8_t*>(start);
auto& segment = m_vecSegments.emplace_back();
segment.address = start;
segment.bytes.reserve(size);
if (should_read_from_disk) {
if (auto bytes = GetOriginalBytes(disk_data, start - m_baseAddress, size)) {
CSSHARP_CORE_INFO("Copying bytes from disk for {}", m_pszPath);
segment.bytes = bytes.value();
continue;
}
CSSHARP_CORE_ERROR("Cannot get original bytes for {}", m_pszPath);
return;
}
segment.bytes.assign(&data[0], &data[size]);
}
}
DumpSymbols();
if (m_fnCreateInterface == nullptr)
return;
m_bInitialized = true;
}
#else
CModule::CModule(std::string_view path, dl_phdr_info* info)
{
m_pszModule = path.substr(path.find_last_of('/') + 1);
m_pszPath = path.data();
m_baseAddress = info->dlpi_addr;
const bool should_read_from_disk = std::ranges::any_of(modules_to_read_from_disk,
[&](const auto& i) { return m_pszModule == i; });
std::vector<std::uint8_t> disk_data{};
if (should_read_from_disk) {
std::ifstream stream(m_pszPath, std::ios::in | std::ios::binary);
if (!stream.good()) {
CSSHARP_CORE_ERROR("Cannot open file {}", m_pszPath);
return;
}
disk_data.reserve(std::filesystem::file_size(m_pszPath));
disk_data.assign((std::istreambuf_iterator(stream)), std::istreambuf_iterator<char>());
}
for (auto i = 0; i < info->dlpi_phnum; i++) {
auto address = m_baseAddress + info->dlpi_phdr[i].p_paddr;
auto type = info->dlpi_phdr[i].p_type;
auto is_dynamic_section = type == PT_DYNAMIC;
if (is_dynamic_section) {
DumpSymbols(reinterpret_cast<ElfW(Dyn)*>(address));
continue;
}
if (type != PT_LOAD)
continue;
auto flags = info->dlpi_phdr[i].p_flags;
auto is_executable = (flags & PF_X) != 0;
auto is_readable = (flags & PF_R) != 0;
if (!is_executable || !is_readable)
continue;
auto size = info->dlpi_phdr[i].p_filesz;
auto* data = reinterpret_cast<std::uint8_t*>(address);
auto& segment = m_vecSegments.emplace_back();
segment.address = address;
segment.bytes.reserve(size);
if (should_read_from_disk) {
if (auto bytes = GetOriginalBytes(disk_data, address - m_baseAddress, size)) {
CSSHARP_CORE_INFO("Copying bytes from disk for {}", m_pszPath);
segment.bytes = bytes.value();
continue;
}
CSSHARP_CORE_ERROR("Cannot get original bytes for {}", m_pszPath);
return;
}
segment.bytes.assign(&data[0], &data[size]);
}
if (m_fnCreateInterface == nullptr)
return;
m_bInitialized = true;
}
#endif
#ifdef _WIN32
void CModule::DumpSymbols()
{
const auto dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(m_baseAddress);
const auto nt_header = reinterpret_cast<PIMAGE_NT_HEADERS>(
reinterpret_cast<std::uint8_t*>(m_baseAddress) + dos_header->e_lfanew);
const auto [export_address_rva, export_size] =
nt_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT];
if (export_size == 0 || export_address_rva == 0)
return;
auto export_directory =
reinterpret_cast<IMAGE_EXPORT_DIRECTORY*>(m_baseAddress + export_address_rva);
const auto names =
reinterpret_cast<uint32_t*>(m_baseAddress + export_directory->AddressOfNames);
const auto addresses =
reinterpret_cast<uint32_t*>(m_baseAddress + export_directory->AddressOfFunctions);
const auto ordinals =
reinterpret_cast<std::uint16_t*>(m_baseAddress + export_directory->AddressOfNameOrdinals);
for (auto i = 0ull; i < export_directory->NumberOfNames; i++) {
const auto export_name = reinterpret_cast<const char*>(m_baseAddress + names[i]);
const auto address = m_baseAddress + addresses[ordinals[i]];
if (address >= reinterpret_cast<uintptr_t>(export_directory) &&
address < reinterpret_cast<uintptr_t>(export_directory) + export_size)
continue;
if (std::string_view(export_name) == "CreateInterface") {
m_fnCreateInterface = reinterpret_cast<fnCreateInterface>(address);
}
_symbols[export_name] = address;
}
}
#else
void CModule::DumpSymbols(ElfW(Dyn) * dyn)
{
// thanks to https://stackoverflow.com/a/57099317
auto GetNumberOfSymbolsFromGnuHash = [](ElfW(Addr) gnuHashAddress) {
// See https://flapenguin.me/2017/05/10/elf-lookup-dt-gnu-hash/ and
// https://sourceware.org/ml/binutils/2006-10/msg00377.html
struct Header
{
uint32_t nbuckets;
uint32_t symoffset;
uint32_t bloom_size;
uint32_t bloom_shift;
};
auto header = (Header*)gnuHashAddress;
const auto bucketsAddress =
gnuHashAddress + sizeof(Header) + (sizeof(std::uintptr_t) * header->bloom_size);
// Locate the chain that handles the largest index bucket.
uint32_t lastSymbol = 0;
auto bucketAddress = (uint32_t*)bucketsAddress;
for (uint32_t i = 0; i < header->nbuckets; ++i) {
uint32_t bucket = *bucketAddress;
if (lastSymbol < bucket) {
lastSymbol = bucket;
}
bucketAddress++;
}
if (lastSymbol < header->symoffset) {
return header->symoffset;
}
// Walk the bucket's chain to add the chain length to the total.
const auto chainBaseAddress = bucketsAddress + (sizeof(uint32_t) * header->nbuckets);
for (;;) {
auto chainEntry =
(uint32_t*)(chainBaseAddress + (lastSymbol - header->symoffset) * sizeof(uint32_t));
lastSymbol++;
// If the low bit is set, this entry is the end of the chain.
if (*chainEntry & 1) {
break;
}
}
return lastSymbol;
};
ElfW(Sym) * symbols{};
ElfW(Word) * hash_ptr{};
char* string_table{};
std::size_t symbol_count{};
while (dyn->d_tag != DT_NULL) {
if (dyn->d_tag == DT_HASH) {
hash_ptr = reinterpret_cast<ElfW(Word)*>(dyn->d_un.d_ptr);
symbol_count = hash_ptr[1];
} else if (dyn->d_tag == DT_STRTAB) {
string_table = reinterpret_cast<char*>(dyn->d_un.d_ptr);
} else if (!symbol_count && dyn->d_tag == DT_GNU_HASH) {
symbol_count = GetNumberOfSymbolsFromGnuHash(dyn->d_un.d_ptr);
} else if (dyn->d_tag == DT_SYMTAB) {
symbols = reinterpret_cast<ElfW(Sym)*>(dyn->d_un.d_ptr);
for (auto i = 0; i < symbol_count; i++) {
if (!symbols[i].st_name) {
continue;
}
if (symbols[i].st_other != 0) {
continue;
}
auto address = symbols[i].st_value + m_baseAddress;
std::string_view name = &string_table[symbols[i].st_name];
if (name == "CreateInterface") {
m_fnCreateInterface = reinterpret_cast<fnCreateInterface>(address);
}
_symbols.insert({name.data(), address});
}
}
dyn++;
}
}
#endif
std::optional<std::vector<std::uint8_t>>
CModule::GetOriginalBytes(const std::vector<std::uint8_t>& disk_data, std::uintptr_t rva,
std::size_t size)
{
auto get_file_ptr_from_rva = [](std::uint8_t* data,
std::uintptr_t address) -> std::optional<std::uintptr_t> {
#ifdef _WIN32
// thank you praydog
// https://github.com/cursey/kananlib/blob/b0323a0b005fc9e3944e0ea36dcc98eda4b84eea/src/Module.cpp#L176
const auto dos_header = reinterpret_cast<PIMAGE_DOS_HEADER>(data);
const auto nt_header = reinterpret_cast<PIMAGE_NT_HEADERS>(&data[dos_header->e_lfanew]);
auto section = IMAGE_FIRST_SECTION(nt_header);
for (auto i = 0; i < nt_header->FileHeader.NumberOfSections; i++, section++) {
auto section_size = section->Misc.VirtualSize;
if (section_size == 0) {
section_size = section->SizeOfRawData;
}
if (address >= section->VirtualAddress &&
address < static_cast<uintptr_t>(section->VirtualAddress) + section_size) {
const auto delta = section->VirtualAddress - section->PointerToRawData;
return reinterpret_cast<std::uintptr_t>(data + (address - delta));
}
}
return std::nullopt;
#else
// on linux you can just read from rva
return reinterpret_cast<std::uintptr_t>(data + address);
#endif
};
const auto disk_ptr = get_file_ptr_from_rva(const_cast<std::uint8_t*>(disk_data.data()), rva);
if (!disk_ptr)
return std::nullopt;
const auto disk_bytes = reinterpret_cast<std::uint8_t*>(*disk_ptr);
std::vector<std::uint8_t> result{&disk_bytes[0], &disk_bytes[size]};
return result;
}
void* CModule::FindSignature(const char* signature)
{
if (signature == nullptr || strlen(signature) == 0) {
@@ -42,48 +439,107 @@ void* CModule::FindSignature(const char* signature)
}
auto pData = CGameConfig::HexToByte(signature);
if (pData.empty()) [[unlikely]]
if (pData.empty()) [[unlikely]] {
CSSHARP_CORE_ERROR("Cannot convert signture \"{}\" to bytes", signature);
return nullptr;
}
return this->FindSignature(pData);
}
void* CModule::FindSignature(const std::vector<int16_t>& sigBytes)
{
const auto first_byte = sigBytes[0];
for (auto&& segment : m_vecSegments) {
const auto size = segment.bytes.size();
auto* data = segment.bytes.data();
auto pMemory = (std::uint8_t*)m_base;
std::uint8_t* end = pMemory + m_size - sigBytes.size();
auto first_byte = sigBytes[0];
std::uint8_t* end = data + size - sigBytes.size();
for (std::uint8_t* current = pMemory; current <= end; ++current) {
if (first_byte != -1)
current = std::find(current, end, first_byte);
for (std::uint8_t* current = data; current <= end; ++current) {
if (first_byte != -1)
current = std::find(current, end, first_byte);
if (current == end) {
break;
}
if (current == end) {
break;
}
if (std::equal(sigBytes.begin() + 1, sigBytes.end(), current + 1,
[](auto opt, auto byte) { return opt == -1 || opt == byte; })) {
return current;
if (std::equal(sigBytes.begin() + 1, sigBytes.end(), current + 1,
[](auto opt, auto byte) {
return opt == -1 || opt == byte;
})) {
return reinterpret_cast<void*>(current - data + segment.address);
}
}
}
return nullptr;
}
void* CModule::FindInterface(const char* name)
void* CModule::FindInterface(std::string_view name)
{
CreateInterfaceFn fn = (CreateInterfaceFn)dlsym(m_hModule, "CreateInterface");
if (_interfaces.empty()) {
auto RelToAbs = [](std::uintptr_t address, int offset) {
const auto displacement = *reinterpret_cast<int32_t*>(address + offset);
return address + offset + displacement + sizeof(int32_t);
};
if (!fn)
Error("Could not find CreateInterface in %s\n", m_pszModule);
auto address = reinterpret_cast<std::uintptr_t>(m_fnCreateInterface);
void* pInterface = fn(name, nullptr);
#ifndef _WIN32
// CreateInterface on linux starts with a jmp instruciton
address = RelToAbs(address, 1);
// skipping 16 bytes to mov rax, interfaceRegisterList
address += 16;
#endif
if (!pInterface)
Error("Could not find %s in %s\n", name, m_pszModule);
using InstantiateInterfaceFn_t = void* (*)();
return pInterface;
class CInterfaceRegister
{
public:
InstantiateInterfaceFn_t fnCreate;
const char* szName;
CInterfaceRegister* pNext;
};
void* ret_interface{};
const auto interface_reg = *reinterpret_cast<CInterfaceRegister**>(RelToAbs(address, 3));
for (auto list = interface_reg; list != nullptr; list = list->pNext) {
auto interface_addrss = list->fnCreate();
if (const std::string_view interface_name = list->szName; interface_name == name)
ret_interface = interface_addrss;
_interfaces.insert({list->szName, reinterpret_cast<uintptr_t>(interface_addrss)});
}
if (ret_interface == nullptr) {
// Replace Error() from hl2sdk-cs2, it essentially calls Plat_ExitProcess
CSSHARP_CORE_ERROR("Could not find interface {} in {}", name, m_pszModule);
Plat_ExitProcess(1);
}
return ret_interface;
}
const auto it = _interfaces.find(name.data());
if (it == _interfaces.end()) {
CSSHARP_CORE_ERROR("Could not find interface {} in {}", name, m_pszModule);
Plat_ExitProcess(1);
}
return reinterpret_cast<void*>(it->second);
}
void* CModule::FindSymbol(const std::string& name)
{
if (const auto it = _symbols.find(name); it != _symbols.end()) {
return reinterpret_cast<void*>(it->second);
}
CSSHARP_CORE_ERROR("Cannot find symbol {}", name);
return nullptr;
}
} // namespace counterstrikesharp::modules

View File

@@ -19,32 +19,77 @@
#pragma once
#include <cstdio>
#include <cstdint>
#include <unordered_map>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#if __linux__
#include <link.h>
#endif
#include "interface.h"
#include "strtools.h"
#include "metamod_oslink.h"
#include <vector>
#undef snprintf
namespace counterstrikesharp::modules {
struct Segments
{
Segments() = default;
Segments(const Segments&) = default;
Segments(Segments&&) = default;
Segments& operator=(const Segments&) = default;
Segments& operator=(Segments&&) = default;
std::uintptr_t address{};
std::vector<std::uint8_t> bytes{};
};
class CModule
{
public:
CModule(const char* path, const char* module);
#ifdef _WIN32
CModule(std::string_view path, std::uint64_t base);
#else
CModule(std::string_view path, struct dl_phdr_info* info);
#endif
void* FindSignature(const char* signature);
void* FindInterface(std::string_view name);
void* FindSymbol(const std::string& name);
[[nodiscard]] bool IsInitialized() const { return m_bInitialized; }
std::string m_pszModule{};
std::string m_pszPath{};
void* m_base{};
size_t m_size{};
private:
bool m_bInitialized{};
std::vector<Segments> m_vecSegments{};
std::uintptr_t m_baseAddress{};
std::unordered_map<std::string, std::uintptr_t> _symbols{};
std::unordered_map<std::string, std::uintptr_t> _interfaces{};
using fnCreateInterface = void*(*)(const char*);
fnCreateInterface m_fnCreateInterface {};
#ifdef _WIN32
void DumpSymbols();
#else
void DumpSymbols(ElfW(Dyn) * dyn);
#endif
std::optional<std::vector<std::uint8_t>> GetOriginalBytes(const std::vector<std::uint8_t>& disk_data, std::uintptr_t rva, std::size_t size);
void* FindSignature(const std::vector<int16_t>& sigBytes);
void* FindInterface(const char* name);
const char* m_pszModule;
const char* m_pszPath;
HINSTANCE m_hModule;
void* m_base;
size_t m_size;
};
} // namespace counterstrikesharp::modules
} // namespace counterstrikesharp::modules