Skip to content

Commit

Permalink
Merge pull request #2 from shavitush/master
Browse files Browse the repository at this point in the history
aa
  • Loading branch information
rtldg authored Jan 6, 2024
2 parents 945282d + db62ed4 commit fb5d922
Show file tree
Hide file tree
Showing 39 changed files with 2,891 additions and 1,116 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Compile

on: [push, pull_request, workflow_dispatch]

jobs:
compile:
runs-on: ubuntu-latest
strategy:
matrix:
sm-version: [ '1.10', '1.11' ] #, '1.12'

name: "Build SM ${{ matrix.sm-version }}"
steps:
- name: Prepare env
shell: bash
run: echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV

- uses: actions/checkout@v3

- name: Setup SP
uses: rumblefrog/setup-sp@master
with:
version: ${{ matrix.sm-version }}

- name: Download and extract dependencies
shell: bash
run: |
# Mac zip just because it's smaller & we don't repack the extensions...
wget https://github.com/ErikMinekus/sm-ripext/releases/download/1.3.1/sm-ripext-1.3.1-mac.zip
unzip sm-ripext-1.3.1-mac.zip "addons/sourcemod/scripting/include/*"
wget https://github.com/clugg/sm-json/archive/refs/tags/v5.0.0.tar.gz
tar --strip-components=1 -xvzf v5.0.0.tar.gz sm-json-5.0.0/addons/sourcemod/scripting/include
wget https://github.com/hermansimensen/eventqueue-fix/archive/refs/tags/1.3.2.tar.gz
tar --strip-components=1 -xvzf 1.3.2.tar.gz -C addons/sourcemod
rm -rf *.zip *.tar.gz addons/sourcemod/.git* addons/sourcemod/LICENSE
- name: Run compiler
shell: bash
run: |
cd addons/sourcemod
mkdir plugins
for src in $(find scripting -maxdepth 1 -type f -name "*.sp");
do
spcomp $src -o=plugins/$(basename $src .sp)'.smx' -i=scripting/include -v2
done
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: bhoptimer-${{ github.head_ref || github.ref_name }}-sm${{ matrix.sm-version }}-${{ env.GITHUB_SHA_SHORT }}
path: |
addons
materials
sound
CHANGELOG.md
LICENSE
README.md
retention-days: 14

release:
name: Release
if: github.ref_type == 'tag'
needs: compile
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3

- name: Archive artifacts
shell: bash
run: find * -maxdepth 0 -type d -exec zip -rq {}.zip {} \;

- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
name: ${{ github.ref_name }}
artifacts: "*.zip"
297 changes: 222 additions & 75 deletions CHANGELOG.md

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

### RECOMPILE ALL YOUR PLUGINS THAT USE `#include <shavit>` OR STUFF WILL BREAK

[AlliedModders thread](https://forums.alliedmods.net/showthread.php?t=265456)
### CS:GO is dead. Support won't be removed and gamedata should:tm: still work but it isn't actively tested.

[AlliedModders thread](https://forums.alliedmods.net/showthread.php?t=265456) // !!! OUTDATED !!!

[Download](https://github.com/shavitush/bhoptimer/releases)

Expand All @@ -16,13 +18,14 @@ Includes a records system, map zones (start/end marks etc), bonuses, HUD with us

# Requirements:
* Steam version of Counter-Strike: Source, Counter-Strike: Global Offensive, or Team Fortress 2.
* [Metamod:Source](https://www.sourcemm.net/downloads.php?branch=stable) and [SourceMod 1.10 or above](https://www.sourcemod.net/downloads.php?branch=stable) installed.
* [Metamod:Source](https://www.sourcemm.net/downloads.php?branch=stable) and [SourceMod](https://www.sourcemod.net/downloads.php?branch=stable) 1.10 or higher ([1.10](https://www.sourcemod.net/downloads.php?branch=1.10-dev&all=1), [1.11](https://www.sourcemod.net/downloads.php?branch=1.11-dev&all=1), [1.12](https://www.sourcemod.net/downloads.php?branch=1.12-dev&all=1)).
* A MySQL database (preferably locally hosted) if your database is likely to grow big, or if you want to use the rankings plugin. MySQL server version of 5.5.5 or above (MariaDB equivalent works too) is required.
* [DHooks](https://github.com/peace-maker/DHooks2/releases)
* [DHooks](https://github.com/peace-maker/DHooks2/releases) (included with SourceMod 1.11 and higher).

# Optional requirements, for the best experience:
* [eventqueuefix](https://github.com/hermansimensen/eventqueue-fix)
* Allows for timescaling boosters and is used to fix some exploits. (Use this instead of `boosterfix`)
* (included in bhoptimer release zips)
* [SteamWorks](https://forums.alliedmods.net/showthread.php?t=229556)
* Used to grab `{serverip}` in advertisements.
* [DynamicChannels](https://github.com/Vauff/DynamicChannels)
Expand Down Expand Up @@ -271,6 +274,8 @@ Player commands:
- Allows players to toggle trigger visibility.
* [ShowPlayerClips](https://forums.alliedmods.net/showthread.php?p=2661942) ([github](https://github.com/GAMMACASE/ShowPlayerClips))
- Allows players to toggle player clip visibility.
* [JumpStats](https://github.com/Nimmy2222/bhop-get-stats)
- Covers SSJ, Jhud, StrafeTrainer, Strafe Offsets and FJT. Colors, HUD positioning editor, cookies, etc
* [shavit-ssj](https://github.com/Nairdaa/shavit-ssj)
- Speed of Sixth Jump + more, customisable settings with cookies remembering user prefered settings.
* [shavit-jhud](https://github.com/blankbhop/jhud)
Expand Down
10 changes: 9 additions & 1 deletion addons/sourcemod/configs/shavit-mapfixes.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
{
"shavit_zones_resettargetname_main" "lol"
}
"bhop_wasd"
{
"shavit_zones_resettargetname_main" "default"
}

"bhop_solitude"
{
Expand All @@ -54,4 +58,8 @@
"shavit_zones_resettargetname_main" "tped"
"shavit_zones_resetclassname_main" "cp0filter"
}
}
"bhop_avantasia"
{
"rngfix_triggerjump" "0"
}
}
6 changes: 3 additions & 3 deletions addons/sourcemod/configs/shavit-styles.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"min_velocity" "0.0" // Minimum amount of horizontal velocity to keep per jump. If set to 600.0, the player can't have less than 600 velocity per jump.
"jump_multiplier" "0.0" // Mulitplier for the vertical velocity per jump. 0.0 for disabled.
"jump_bonus" "0.0" // Bonus vertical velocity to gain per jump. If set to e.g. 100.0, the player will gain 100 bonus vertial velocity per jump.
"startinair" "0" // 0 = Start-zones will only start the timer if the player is on the ground. 1 = timer will start without requiring the player to be on the ground in the start zone. This means with 1 that it will basically only start the timer counter once you've left the start-zone. This should only be used on gamemodes that are intended for this kind of mechanic (i.e. not bhop). Also it might be easily abusable. GL.
"startinair" "0" // 0 = Start-zones will only start the timer if the player is on the ground. 1 = timer will start without requiring the player to be on the ground in the start zone. This means with 1 that it will basically only start the timer counter once you've left the start-zone. This should only be used on gamemodes that are intended for this kind of mechanic (i.e. not bhop). Also it might be easily abusable. GL. Also this probably won't work unless you set either `"prespeed" "1"` or `"nozaxisspeed" "0"`.

// Mode settings
"block_w" "0" // Block +forward (W).
Expand Down Expand Up @@ -93,7 +93,7 @@
"segments" "0" // Segments styled checkpoints. 0 for disabled.
"tas" "0" // 0 = Do nothing. 1 = Currently sets the following keys unless they are explicity disabled: `tas_timescale -1`, `autostrafe 1`, `autoprestrafe 1`, `edgejump 1`, and `autojumponstart 1`
"tas_timescale" "0" // TAS-like timescaling. 0 = Disabled. -1 = User can edit the timescale (TAS menu, sm_ts, sm_tsplus, sm_tsminus). >0 = Fixed tas-timescale value for the style (e.g. 0.5 for a fixed timescale). Total time-increase-rate for the player = timescale * tas_timescale
"autostrafe" "0" // 0 = Disabled. 1 = 1tick autostrafer. 2 = velocity/autogain. 3 = velocity/autogain (no speed loss). -1 = Lets players toggle between 1tick and velocity/autogain.
"autostrafe" "0" // 0 = Disabled. 1 = 1tick autostrafer. 2 = velocity/autogain. 3 = velocity/autogain (no speed loss). 4 = a basic +moveleft/+moveright presser when turning. -1 = Lets players toggle between 1tick and velocity/autogain.
"autoprestrafe" "0" // 0 = Disabled. 1 = Enables TAS prestrafer on the ground to reach.
"edgejump" "0" // 0 = Disabled. 1 = Automatically jumps when the player will fall off a ledge next tick.
"autojumponstart" "0" // 0 = Disabled. 1 = Automatically jumps when the player will leave the start zone.
Expand Down Expand Up @@ -243,7 +243,7 @@
"command" "lg; lowgrav"
"clantag" "LG"
"gravity" "0.6"
"gravity" "0.5"
}
"9"
Expand Down
79 changes: 60 additions & 19 deletions addons/sourcemod/gamedata/shavit.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@

"csgo"
{
"Addresses"
{
"m_surfaceFriction"
{
"signature" "CBasePlayer->m_surfaceFriction"
"read" "4" // skip the first 4 bytes
}
}
"Offsets"
{
// search string: "func_pushable" and you can find CBaseTrigger::PassesTriggerFilters / CBaseVPhysicsTrigger::PassesTriggerFilters. Follow references to these functions to find the vtable and then calculate the offset...
Expand Down Expand Up @@ -106,39 +114,63 @@
"Player::DoAnimationEvent"
{
"windows" "\x55\x8B\xEC\x56\x8B\xF1\x57\x80\xBE\x2A\x2A\x2A\x2A\x00\x74\x2A\x51"
"linux" "\x55\x89\xE5\x83\xEC\x28\x89\x5D\xF4\x8B\x5D\x08\x89\x75\xF8\x8B\x75\x0C\x89\x7D\xFC\x8B\x7D\x10\x80\xBB\x44\x23\x00\x00\x00"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x0C\x8B\x5D\x2A\x8B\x75\x2A\x8B\x7D\x2A\x80\xBB\x2A\x2A\x2A\x2A\x00\x75"
}
// search string: "-nobots"
// search string: "-nobots". On Linux this leads to `AreBotsAllowed()`, which can check the references to find MaintainBotQuota
"BotManager::MaintainBotQuota"
{
"windows" "\x55\x8B\xEC\x83\xEC\x18\x89\x4D\x2A\xFF\x15"
"linux" "\x55\x89\xE5\x83\xEC\x78\x89\x7D\x2A\x8B\x7D\x2A\x89\x5D\x2A\x89\x75\x2A"
"windows" "\x55\x8B\xEC\x83\xEC\x14\x89\x4D\x2A\xFF\x15"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\xE8\x2A\x2A\x2A\x2A\x84\xC0\x74\x2A\xA1"
}
// search string: "Error - no profile for '%s' exists."
"CCSBotManager::BotAddCommand"
{
"windows" "\x55\x8B\xEC\xA1\x2A\x2A\x2A\x2A\x53\x56\x57\x80\x78\x2A\x00"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x4C\x8B\x15\x2A\x2A\x2A\x2A\x8B\x7D\x2A\x8B\x75\x2A\x0F\xB6\x5D\x2A"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x1C\x8B\x45\x2A\x89\x45\x2A\xA1\x2A\x2A\x2A\x2A\x0F\xB6\x70"
}
// search string: "remove 0x%p: %s-%s" to find PhysicsRemoveToucher.
// Find PhysicsCheckForEntityUntouch by checking the functions that call PhysicsRemoveToucher.
// This sucks to find.
"PhysicsCheckForEntityUntouch"
{
"windows" "\x55\x8B\xEC\x83\xEC\x08\x56\x8B\xF1\x8B\x86\xD0\x00\x00\x00"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\x8B\x5D\x08\xC7\x44\x24\x04\x01\x00\x00\x00\x89\x1C\x24"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x24\x8B\x75\x2A\x6A\x01\x56"
}
// search string: "remove 0x%p: %s-%s (%d-%d) [%d in play, %d max]\n".
// function with one argument is PhysicsRemoveTouchedList
// Also, this function is referenced (at least on linux) by `CPhysicsPropRespawnable::Event_Killed()` (which includes the string "PROP_CLEARFLAGS"
"PhysicsRemoveTouchedList"
{
"windows" "\x55\x8B\xEC\x83\xEC\x0C\x57\x8B\xF9\x8B\x87\x2A\x2A\x2A\x2A\xD1\xE8\xA8\x01\x0F\x84"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x5C\x8B\x55\x08\xC7\x44\x24\x2A\x2A\x2A\x2A\x2A\x89\x14\x24\xE8"
"linux" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x34\x6A\x01\xFF\x75\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x10"
}
// search string: "sv_friction", look for instruction like this: "mov some_register, offset sv_friction_cvar"
// xref sv_friction_cvar, look for the place that it gets called and has this:
// *(float*)(a1[1] + some_offset) * (float(__thiscall)(void*))(*(uintptr_t*)sv_friction + GetFloatIndex*sizeof(void*))(sv_friction)
// make a signature for some_offset
// if it's unclear: https://youtu.be/xiNQ00X4R_I
// On Ghidra + Windows CSGO, the references are sometimes missing.
// You can find a variable/memory-location holding -25.0 with a memory search.
// This variable is referenced in the same function as where you can find this signature.
"CBasePlayer->m_surfaceFriction"
{
"windows" "\xF3\x0F\x10\x80\x2A\x2A\x2A\x2A\xF3\x0F\x59\x45\x2A\xF3\x0F\x11\x45"
"linux" "\xF3\x0F\x10\xB8\x2A\x2A\x2A\x2A\xA1"
}
}
}

"cstrike"
{
"Addresses"
{
"m_surfaceFriction"
{
"signature" "CBasePlayer->m_surfaceFriction"
"read" "2" // skip the first 2 bytes
}
}

"Offsets"
{
// https://asherkin.github.io/vtable/
Expand Down Expand Up @@ -174,12 +206,6 @@
"windows" "358"
"linux" "359"
}
// TODO
"m_surfaceFriction"
{
"windows" "104"
"linux" "104"
}
// find in CCSGameMovement::CheckForLadders which references CCSPlayer::CanGrabLadder
"CCSPlayer::m_lastStandingPos"
{
Expand Down Expand Up @@ -266,6 +292,14 @@
"windows" "\x55\x8B\xEC\x83\xEC\x08\x57\x8B\x7D\x08\x8B\x87\x2A\x2A\x2A\x2A\xD1\xE8\xA8\x01\x0F\x84"
"linux" "@_ZN11CBaseEntity24PhysicsRemoveTouchedListEPS_"
}
// look for function CGameMovement::CategorizePosition
// and you will see something something *(_DWORD*)(a1[1] + some_offset) = 0x3F800000
// make a signature at "mov dword ptr[eax+some_offset], 3F800000h"
"CBasePlayer->m_surfaceFriction"
{
"windows" "\xC7\x80\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x07\xFF\x90"
"linux" "\xC7\x80\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x03\x89\x1C\x24\xFF\x90\x2A\x2A\x2A\x2A\x8B\x53\x04"
}
}
}

Expand All @@ -276,8 +310,8 @@
// https://asherkin.github.io/vtable/
"CBaseTrigger::PassesTriggerFilters"
{
"windows" "204"
"linux" "205"
"windows" "207"
"linux" "208"
}
// https://asherkin.github.io/vtable/
"CGameRules::IsSpawnPointValid"
Expand All @@ -288,13 +322,20 @@
// https://asherkin.github.io/vtable/
"CBasePlayer::UpdateStepSound"
{
"windows" "365"
"linux" "366"
"windows" "368"
"linux" "369"
}
}

"Signatures"
{
// search string: "BumperCar.Jump" to find CTFGameMovement::CheckJumpButton.
// Then the call to PreventBunnyJumping is right above the string reference somewhere...
"CTFGameMovement::PreventBunnyJumping"
{
"windows" "\x56\x8B\xF1\x6A\x52\x8B\x8E\x2A\x2A\x2A\x2A\x81\xC1\xE0\x1A\x00\x00\xE8\x2A\x2A\x2A\x2A\x84\xC0\x75"
"linux" "@_ZN15CTFGameMovement19PreventBunnyJumpingEv"
}
// search string: "Usage: setang_exact pitch yaw" to find setang_exact's handler. Then the last function call in the handler is DoAnimationEvent.
"Player::DoAnimationEvent"
{
Expand All @@ -317,7 +358,7 @@
// Find PhysicsCheckForEntityUntouch by checking the functions that call PhysicsRemoveToucher.
"PhysicsCheckForEntityUntouch"
{
"windows" "\x55\x8B\xEC\x83\xEC\x08\x56\x8B\xF1\x8B\x86\x2A\x2A\x2A\x2A\xD1\xE8"
"windows" "\x55\x8B\xEC\x51\x56\x8B\xF1\x8B\x86\x2A\x2A\x2A\x2A\xD1\xE8\xA8\x01"
"linux" "@_ZN11CBaseEntity28PhysicsCheckForEntityUntouchEv"
}
// search string: "scoreboard_minigame"
Expand All @@ -330,7 +371,7 @@
// function with one argument is PhysicsRemoveTouchedList
"PhysicsRemoveTouchedList"
{
"windows" "\x55\x8B\xEC\x83\xEC\x08\x57\x8B\x7D\x08\x8B\x87\x2A\x2A\x2A\x2A\xD1\xE8\xA8\x01\x0F\x84"
"windows" "\x55\x8B\xEC\x83\xEC\x08\x53\x8B\x5D\x2A\x8B\x83"
"linux" "@_ZN11CBaseEntity24PhysicsRemoveTouchedListEPS_"
}
}
Expand Down
3 changes: 1 addition & 2 deletions addons/sourcemod/scripting/include/shavit/checkpoints.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
#endif
#define _shavit_checkpoints_included

// disabled for now since it's a lot of bytes to add
#define MORE_LADDER_CHECKPOINT_STUFF 0
#define MORE_LADDER_CHECKPOINT_STUFF 1

enum struct cp_cache_t
{
Expand Down
Loading

0 comments on commit fb5d922

Please sign in to comment.