Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
D4edalus committed Jul 3, 2016
1 parent de65973 commit aa3d155
Show file tree
Hide file tree
Showing 100 changed files with 5,595 additions and 886 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ git-status.sh
build_official*
bin/sys_error.txt
bin/logs/*

bin/main/*
bin/zone/*
bin/serverstatus.xml
bin/main_shared/*
bin/cod4x18_dedrun
Binary file removed bin/main/xbase_00.iwd
Binary file not shown.
1 change: 1 addition & 0 deletions build_updateable_elf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
echo Compiling C-code...

cd bin
rm cod4x18_dedrun

gcc -m32 -Wall -O0 -g -fno-omit-frame-pointer -mtune=nocona -I../lib_tomcrypt/headers -I../lib_tomcrypt/math/tommath -D _GNU_SOURCE -c ../src/unix/sys_unix.c
gcc -m32 -Wall -O0 -g -fno-omit-frame-pointer -mtune=nocona -I../lib_tomcrypt/headers -I../lib_tomcrypt/math/tommath -D _GNU_SOURCE -c ../src/unix/sys_linux.c
Expand Down
73 changes: 1 addition & 72 deletions dis/plugin_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define P_P_F __attribute__((__noinline__)) __attribute__((__cdecl__))

pluginWrapper_t pluginFunctions;
mainFunctions_t mainFunctions;

#include "plugin_com.c"

Expand All @@ -17,76 +16,6 @@ void Plugin_Init()
pluginFunctions.loadedPlugins=0;
pluginFunctions.enabled=qfalse;

ptr=(void*)&mainFunctions.Com_Printf;

// Copy the function pointers to mainFunctions struct
mainFunctions.Com_Printf = Com_Printf;
mainFunctions.Com_DPrintf = Com_DPrintf;
mainFunctions.Com_PrintWarning = Com_PrintWarning;
mainFunctions.Com_PrintError = Com_PrintError;
mainFunctions.Cmd_Argv = Cmd_Argv;
mainFunctions.Cmd_Argc = Cmd_Argc;
mainFunctions.FS_SV_FOpenFileRead = FS_SV_FOpenFileRead;
mainFunctions.FS_SV_FOpenFileWrite = FS_SV_FOpenFileWrite;
mainFunctions.FS_Read = FS_Read;
mainFunctions.FS_ReadLine = FS_ReadLine;
mainFunctions.FS_Write = FS_Write;
mainFunctions.FS_FCloseFile = FS_FCloseFile;
mainFunctions.Com_ParseGetToken = Com_ParseGetToken;
mainFunctions.Com_ParseTokenLength = Com_ParseTokenLength;
mainFunctions.Cvar_VariableValue = Cvar_VariableValue;
mainFunctions.Cvar_VariableIntegerValue = Cvar_VariableIntegerValue;
mainFunctions.Cvar_VariableString = Cvar_VariableString;
mainFunctions.Cvar_VariableStringBuffer = Cvar_VariableStringBuffer;
mainFunctions.Sys_Milliseconds = Sys_Milliseconds;

mainFunctions.Plugin_TcpConnect = Plugin_TcpConnect_p;
mainFunctions.Plugin_TcpGetData = Plugin_TcpGetData_p;
mainFunctions.Plugin_TcpSendData = Plugin_TcpSendData_p;
mainFunctions.Plugin_TcpCloseConnection = Plugin_TcpCloseConnection_p;
mainFunctions.Plugin_UdpSendData = Plugin_UdpSendData_p;
mainFunctions.Plugin_ServerPacketEvent = Plugin_ServerPacketEvent_p;
mainFunctions.NET_StringToAdr = NET_StringToAdr;
mainFunctions.Plugin_GetClientScoreboard = Plugin_GetClientScoreboard;
mainFunctions.Plugin_Cmd_GetInvokerUid = Plugin_Cmd_GetInvokerUid;
mainFunctions.Plugin_GetPlayerUid = Plugin_GetPlayerUid;
mainFunctions.Plugin_GetSlotCount = Plugin_GetSlotCount;
mainFunctions.Plugin_IsSvRunning = Plugin_IsSvRunning;
mainFunctions.Plugin_ChatPrintf = Plugin_ChatPrintf;
mainFunctions.Plugin_BoldPrintf = Plugin_BoldPrintf;
mainFunctions.Plugin_GetPlayerName = Plugin_GetPlayerName;
mainFunctions.Plugin_AddCommand = Plugin_AddCommand;
mainFunctions.Plugin_Malloc = Plugin_Malloc_p;
mainFunctions.Plugin_Free = Plugin_Free_p;
mainFunctions.Plugin_Error = Plugin_Error;
mainFunctions.Plugin_GetLevelTime = Plugin_GetLevelTime_p;
mainFunctions.Plugin_GetServerTime = Plugin_GetServerTime_p;

mainFunctions.Plugin_SetPlayerUID = Plugin_SetPlayerUID_p;
mainFunctions.Plugin_GetPlayerUID = Plugin_GetPlayerUID_p;
mainFunctions.Plugin_GetPlayerGUID = Plugin_GetPlayerGUID_p;
mainFunctions.Plugin_SetPlayerGUID = Plugin_SetPlayerGUID_p;
mainFunctions.Plugin_SetPlayerNoPB = Plugin_SetPlayerNoPB_p;
mainFunctions.Plugin_DoesServerUseUids = Plugin_DoesServerUseUids_p;
mainFunctions.Plugin_SetServerToUseUids = Plugin_SetServerToUseUids_p;
mainFunctions.Cvar_RegisterString = Cvar_RegisterString;
mainFunctions.Cvar_RegisterBool = Cvar_RegisterBool;
mainFunctions.Cvar_RegisterInt = Cvar_RegisterInt;
mainFunctions.Cvar_RegisterEnum = Cvar_RegisterEnum;
mainFunctions.Cvar_RegisterFloat = Cvar_RegisterFloat;

mainFunctions.Cvar_SetInt = Cvar_SetInt;
mainFunctions.Cvar_SetBool = Cvar_SetBool;
mainFunctions.Cvar_SetString = Cvar_SetString;
mainFunctions.Cvar_SetFloat = Cvar_SetFloat;

for(i=0;i<sizeof(mainFunctions_t);i+=sizeof(void*)){
if(ptr==NULL){
Com_Printf("Plugin_Init: Error initializing function pointers.\n");
return;
}
ptr++;
}
Com_Printf("Plugin_Init: Plugins initialization successfull.\n");
memset(&pluginFunctions,0x00,sizeof(pluginFunctions)); // 0 all data
pluginFunctions.enabled=qtrue;
Expand Down Expand Up @@ -198,7 +127,7 @@ void Plugin_Load(char* name, size_t size)
Com_Printf("Error loading plugin's OnInit function.\nPlugin load failed.\n");
return;
}
if((*pluginFunctions.plugins[i].OnInit)(mainFunctions)<0){
if((*pluginFunctions.plugins[i].OnInit)()<0){
Com_Printf("Error in plugin's OnInit function!\nPlugin load failed.\n");
pluginFunctions.plugins[i].loaded = qfalse;
pluginFunctions.initializing_plugin = qfalse;
Expand Down
Binary file removed lib/libmbedcrypto.a
Binary file not shown.
Binary file removed lib/libmbedtls.a
Binary file not shown.
Binary file removed lib/libmbedtls_win32.a
Binary file not shown.
Binary file removed lib/libmbedx509.a
Binary file not shown.
13 changes: 13 additions & 0 deletions lib/libs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
for a linux build this folder needs to contain the following libraries
the folders for the respective libraries contain build scripts for linux and windows

libmbedcrypto.a
libmbedtls_win32.a
libtomcrypt_linux.a
libtomcrypt_win32.a
libtommath_mach.a
libmbedtls.a
libmbedx509.a
libtomcrypt_mach.a
libtommath_linux.a
libtommath_win32.a
Binary file removed lib/libtomcrypt_linux.a
Binary file not shown.
Binary file removed lib/libtomcrypt_mach.a
Binary file not shown.
Binary file removed lib/libtomcrypt_win32.a
Binary file not shown.
Binary file removed lib/libtommath_linux.a
Binary file not shown.
Binary file removed lib/libtommath_mach.a
Binary file not shown.
Binary file removed lib/libtommath_win32.a
Binary file not shown.
11 changes: 11 additions & 0 deletions plugins/antinamesteal/makedll32.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
NAME='antinamesteal'

#Compiling: release
echo `gcc -m32 -Wall -O1 -s -fvisibility=hidden -mtune=core2 -c *.c`

#Linking
echo `gcc -m32 -s -shared -fvisibility=hidden -o $NAME''.so *.o`

#Cleaning up
echo `rm *.o`
7 changes: 0 additions & 7 deletions plugins/antispam/antispam_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ void Antispam_Initialize()
data.players = (userData_t *)Plugin_Malloc(sizeof(userData_t)*data.maxPlayers);
memset(data.players,0x00,sizeof(userData_t)*data.maxPlayers);
}
void Scr_Test();

PCL int OnInit(){ // Funciton called on server initiation

Expand All @@ -38,7 +37,6 @@ PCL int OnInit(){ // Funciton called on server initiation
data.minMD = Plugin_Cvar_RegisterInt("antispam_minMessageDelay",4,0,60,0,"Ammount of time after sending a message after which the player can chat again. 0 disables the limit.");
data.renMD = Plugin_Cvar_RegisterBool("antispam_renewedMessageDelay",qfalse,0,"Do messages sent before minMessageDelay passes make the delay prolonged?");
Antispam_Initialize();
//Plugin_ScrAddFunction("test", Scr_Test);
return 0;
}
PCL void OnMessageSent(char *message,int slot, qboolean *show, int type){
Expand Down Expand Up @@ -104,8 +102,3 @@ PCL void OnInfoRequest(pluginInfo_t *info){ // Function used to obtain informati
strncpy(info->longDescription,"This plugin is used to prevent spam in the ingame chat. To personalize the settings, set corresponding cvars. Copyright (c) 2013 IceOps",sizeof(info->longDescription));
}

void Scr_Test()
{
Plugin_Printf("Exec test--------");
Plugin_Scr_AddInt(7);
}
91 changes: 89 additions & 2 deletions plugins/censor/censor.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,18 +320,105 @@ char* censor_ignoreMultiple(char *output, char *string, size_t size)
}



/*****************************************************
*** Parsing files ***
*****************************************************/
static qboolean parse_inquotes = qfalse;
static char* parse_lastpos;

void Com_ParseReset(){

parse_inquotes = qfalse;
parse_lastpos = NULL;
}

char* Com_ParseGetToken(char* line){

if(parse_lastpos == line){

if(parse_inquotes){//In case we are inside quotes step until the end quote forward

do{
line++;
}while(*line != '"' && *line != ';' && *line != '\n' && *line != '\0');

parse_inquotes = qfalse;
}

while(*line != ' '){
if(*line == '\0' || *line == '\n'){
parse_inquotes = qfalse;
parse_lastpos = NULL;
return NULL;
}
line++;
}


}

while(*line == ' ' || *line == ';'){
if(*line == '\0' || *line == '\n'){
parse_inquotes = qfalse;
parse_lastpos = NULL;
return NULL;
}
line++;
}

if(*line == '"'){ //Check if the next token is the beginning of a quoted string
parse_inquotes = qtrue;
line++; //Move over the quotes character to the 1st real character
}


if(*line == '\0' || *line == '\n'){
parse_inquotes = qfalse;
parse_lastpos = NULL;
return NULL;
}

parse_lastpos = line;
return line;
}


int Com_ParseTokenLength(char* token){
if(token == NULL) return 0;

char* pos = token;
int i = 0;
if(parse_inquotes){//In case we are inside quotes
while(*pos != '"' && *pos != ';' && *pos != '\n' && *pos != '\0'){
pos++;
i++;
}

}else{//Default case

while(*pos != ' ' && *pos != ';' && *pos != '\n' && *pos != '\0'){
pos++;
i++;
}
}
return i;
}



char* G_SayCensor(char *msg)
{
char token2[1024];
char token[1024];
badwordsList_t *this;
char* ret = msg;
while(1){
msg = Plugin_ParseGetToken(msg);
msg = Com_ParseGetToken(msg);
if(msg==NULL)
break;

int size = Plugin_ParseTokenLength(msg);
int size = Com_ParseTokenLength(msg);
Q_strncpyz(token,msg,size+1);

removeColors(token2,token,sizeof(token2));
Expand Down
3 changes: 2 additions & 1 deletion plugins/declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,8 @@ typedef struct client_s {//90b4f8c
uint64_t clanidPending;
uint64_t playerid;
int steamstatus;
int free1[3];
int free1[2];
int mutelevel;
int lastFollowedClient;
byte iidata[24];

Expand Down
1 change: 1 addition & 0 deletions plugins/dlang/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
## Plugin Interface for the D Programming Language
26 changes: 26 additions & 0 deletions plugins/dlang/cod4x/callback_declarations.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module cod4x.callback_declarations;

import cod4x.structs;
import cod4x.server;

extern (C) void OnInfoRequest(pluginInfo_t *info);
extern (C) int OnInit();
extern (C) void OnMessageSent(char* message, int slot, qboolean *show, int mode);
extern (C) void OnPreFastRestart();
extern (C) void OnExitLevel();
extern (C) void OnPostFastRestart();
extern (C) void OnSpawnServer();
extern (C) void OnFrame();
extern (C) void OnOneSecond();
extern (C) void OnTenSeconds();
extern (C) void OnUdpNetEvent(netadr_t* from, void* data, int size, qboolean* returnNow);
extern (C) void OnUdpNetSend(netadr_t* to, void* data, int len, qboolean* returnNow);
extern (C) void OnPlayerConnect(int clientnum, netadr_t* netaddress, char* pbguid, char* userinfo, int authstatus, char* deniedmsg, int deniedmsgbufmaxlen);
extern (C) void OnPlayerConnectAuthFail(netadr_t* netaddress, char* pbguid, char* userinfo, int* authstatus, qboolean *denied);
extern (C) void OnPlayerDC(client_t* client, const char* reason);
extern (C) void OnClientSpawn(gentity_t* ent);
extern (C) void OnClientEnterWorld(client_t* client);
extern (C) void OnClientUserinfoChanged(client_t* client);
extern (C) void OnClientMoveCommand(client_t* client, usercmd_t* ucmd);
extern (C) void OnPlayerWantReservedSlot(netadr_t* from, char* pbguid, char* userinfo, int authstate, qboolean *isallowed);
extern (C) void OnModuleLoaded(client_t* client, char* fullpath, long checksum);
Loading

0 comments on commit aa3d155

Please sign in to comment.