Skip to content

Commit

Permalink
gamedata
Browse files Browse the repository at this point in the history
  • Loading branch information
Katsute committed Apr 21, 2024
1 parent 7620ba3 commit fff0880
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 57 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: SourcePawn CI

on: [push]

jobs:
Expand All @@ -16,12 +17,5 @@ jobs:
shell: bash
run: mkdir -p addons/sourcemod/include

- name: Install SourceScramble
uses: KatsuteTF/Workflows/actions/curl@main
with:
url: https://raw.githubusercontent.com/nosoop/SMExt-SourceScramble/master/scripting/include/sourcescramble.inc
file: addons/sourcemod/include/sourcescramble.inc

- name: Compile Plugin
run: |
spcomp -i addons/sourcemod/include TF100.sp
run: spcomp -i addons/sourcemod/include TF100.sp
12 changes: 3 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Release

on:
release:
types: [published]
Expand All @@ -18,18 +19,11 @@ jobs:
shell: bash
run: mkdir -p addons/sourcemod/include

- name: Install SourceScramble
uses: KatsuteTF/Workflows/actions/curl@main
with:
url: https://raw.githubusercontent.com/nosoop/SMExt-SourceScramble/master/scripting/include/sourcescramble.inc
file: addons/sourcemod/include/sourcescramble.inc

- name: Compile Plugin
run: |
spcomp -i addons/sourcemod/include TF100.sp
run: spcomp -i addons/sourcemod/include TF100.sp

- name: Prepare Files
run: |
run: |-
mkdir addons/sourcemod/scripting
mv TF100.smx addons/sourcemod/scripting
mkdir addons/sourcemod/gamedata
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

100 player server optimization plugin; removes several map entities and optimizes network configurations

Requires [SourceScramble](https://github.com/nosoop/SMExt-SourceScramble)

Requires [SourceMod](https://www.sourcemod.net/) 1.12 or higher

Start using `srcds.exe -console -game tf +randommap -unrestricted_maxplayers 100 +maxplayers 100 -nocrashdialog -timeout 0 -refreshrate 30`
Expand Down
31 changes: 28 additions & 3 deletions TF100.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

#pragma semicolon 1

#include <dhooks>
#include <sourcemod>
#include <sdktools>
#include <sourcescramble>

ConVar mp_tournament;

static const int len = 23;

Expand Down Expand Up @@ -126,9 +128,22 @@ public void OnPluginStart(){
// Voice Commands
AddCommandListener(DisableCommand, "voicemenu");

// Whitelist Patch
// Whitelist Patch https://forums.alliedmods.net/showthread.php?t=346702

mp_tournament = FindConVar("mp_tournament");
mp_tournament.Flags &= ~FCVAR_NOTIFY;

Handle gamedata = LoadGameConfigFile("tf2.100");

// broken ↓
Handle hookReload = DHookCreateFromConf(gamedata, "ReloadWhitelist");
DHookEnableDetour(hookReload, false, TournamentEnable);
DHookEnableDetour(hookReload, true, TournamentDisable);

// todo
// broken ↓
Handle hookLoadout = DHookCreateFromConf(gamedata, "GetLoadoutItem");
DHookEnableDetour(hookLoadout, false, TournamentEnable);
DHookEnableDetour(hookLoadout, true, TournamentDisable);
}

public void OnEntityCreated(int entity, const char[] classname){
Expand Down Expand Up @@ -161,4 +176,14 @@ public void DeleteEntities(const char[] classname){

public Action DisableCommand(const int client, const char[] command, const int args){
return Plugin_Stop;
}

MRESReturn TournamentEnable(int entity, DHookReturn hReturn) {
mp_tournament.SetBool(true, true, false);
return MRES_Ignored;
}

MRESReturn TournamentDisable(int entity, DHookReturn hReturn) {
mp_tournament.SetBool(false, true, false);
return MRES_Ignored;
}
70 changes: 35 additions & 35 deletions tf2.100.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
"Games"
{
"tf"
{
"Signatures"
{
"GetLoadoutItem"
{
"library" "server"
"windows" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x3C\x8B\x45\x14\x8B\x7D\x08\x8B\x5D\x0C"
"linux" "@_ZN9CTFPlayer14GetLoadoutItemEiib"
}
"tf"
{
"Signatures"
{
"GetLoadoutItem"
{
"library" "server"
"windows" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x3C\x8B\x45\x14\x8B\x7D\x08\x8B\x5D\x0C"
"linux" "@_ZN9CTFPlayer14GetLoadoutItemEiib"
}

"ReloadWhitelist"
{
"library" "server"
"windows" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\xC7\x04\x24\x20\x00\x00\x00\x8B\x75\x08\xE8\x2A\x2A\x2A\x2A\xC7\x44\x24\x04\x2A\x2A\x2A\x2A\x89\x04\x24\x89\xC3"
"linux" "@_ZN15CEconItemSystem15ReloadWhitelistEv"
}
}
"ReloadWhitelist"
{
"library" "server"
"windows" "\x55\x89\xE5\x57\x56\x53\x83\xEC\x2C\xC7\x04\x24\x20\x00\x00\x00\x8B\x75\x08\xE8\x2A\x2A\x2A\x2A\xC7\x44\x24\x04\x2A\x2A\x2A\x2A\x89\x04\x24\x89\xC3"
"linux" "@_ZN15CEconItemSystem15ReloadWhitelistEv"
}
}

"Functions"
{
"GetLoadoutItem"
{
"signature" "GetLoadoutItem"
"callconv" "thiscall"
"this" "entity"
"return" "int"
}
"Functions"
{
"GetLoadoutItem"
{
"signature" "GetLoadoutItem"
"callconv" "thiscall"
"this" "entity"
"return" "int"
}

"ReloadWhitelist"
{
"signature" "ReloadWhitelist"
"callconv" "thiscall"
"this" "ignore"
"return" "void"
}
}
}
"ReloadWhitelist"
{
"signature" "ReloadWhitelist"
"callconv" "thiscall"
"this" "ignore"
"return" "void"
}
}
}
}

0 comments on commit fff0880

Please sign in to comment.