Skip to content

Commit

Permalink
Add project
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lentq committed Dec 29, 2017
1 parent a89e7f4 commit a672305
Show file tree
Hide file tree
Showing 330 changed files with 54,743 additions and 34 deletions.
50 changes: 18 additions & 32 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app
*.bat
*.log
*.lnk
**/msvc/Debug*
**/msvc/Release*
**/msvc/Tests
**/msvc/*.sdf
**/msvc/*.opensdf
**/msvc/*.user
**/msvc/*.suo
**/msvc/*.db
**/msvc/*.opendb
**/msvc/*.txt
**/msvc/*.amplxeproj
**/msvc/.vs
**/msvc/ipch
**/msvc/PublishPath*.ini
publish
54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,52 @@
# hitboxtracker
Demonstrate position hitboxes calculated by server on client-side
# Description
Dev-tool that demonstrates on client-side true position of the hitboxes calculated by server

# Installation
* Install `hitboxtracker_mm.dll` on your HLDS as metamod plugin and put `delta.lst` to gamedir directory `cstrike/delta.lst`
* Put `hitboxtracker.dll` and `cs.exe` to working directory of the game CS 1.6 client
* Run `cs.exe`

# Requirements
* For `Client`: build 4554 and later
* For `HLDS`: Metamod 1.20 and later

# Configuring
<table>
<tbody>
<tr>
<th>r_drawentities</th>
<th align="left">Description</th>
</tr>
<tr>
<td>0</td>
<td align="left">No entities</td>
</tr>
<tr>
<td>1</td>
<td align="left">Default and draws entities normally</td>
</tr>
<tr>
<td>2</td>
<td align="left">Entities draws as skeletons</td>
</tr>
<tr>
<td>3</td>
<td align="left">Entities draws hitboxes</td>
</tr>
<tr>
<td>4</td>
<td align="left">Entities draws with translucent hitboxes and the model beneath the hitboxes</td>
</tr>
<tr>
<td>5</td>
<td align="left">Individual box for player and weapon</td>
</tr>
<tr>
<td>6</td>
<td align="left">Same as 4 but draws true position of the hitboxes calculated by server :new:</td>
</tr>
</tbody>
</table>

# Preview
![r_drawentities-preview](https://user-images.githubusercontent.com/5860435/34445881-52d2096a-ed09-11e7-90ad-78cfb38f3f40.gif)
37 changes: 37 additions & 0 deletions dep/ISysModule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once

#define PSAPI_VERSION 1
#include <psapi.h>

using module_handle_t = HINSTANCE;
using byteptr_t = uint8_t *;

enum OpCodes : int8_t
{
OP_ANY = '\x2A',
OP_PUSH = '\x68',
OP_JUMP = '\xE9',
OP_CALL = '\xE8',
};

class ISysModule
{
public:
virtual ~ISysModule() {}
virtual bool Init(const char *szModuleName, const char *pszFile = nullptr) = 0;

virtual module_handle_t load(void *addr) = 0;
virtual module_handle_t load(const char *filename) = 0;

virtual void Printf(const char *fmt, ...) = 0;
virtual void TraceLog(const char *fmt, ...) = 0;

virtual byteptr_t getsym(const char *name) const = 0;
virtual module_handle_t gethandle() const = 0;
virtual byteptr_t getbase() const = 0;
virtual size_t getsize() const = 0;
virtual bool is_opened() const = 0;

virtual byteptr_t find_string(const char *string, int8_t opcode = OP_ANY) const = 0;
virtual byteptr_t find_pattern(byteptr_t pStart, size_t range, const char *pattern) const = 0;
};
164 changes: 164 additions & 0 deletions dep/hlsdk/common/BaseSystemModule.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/

#include "precompiled.h"

BaseSystemModule::BaseSystemModule()
{
m_System = nullptr;
m_Serial = 0;
m_SystemTime = 0;
m_State = MODULE_UNDEFINED;

Q_memset(m_Name, 0, sizeof(m_Name));
}

char *BaseSystemModule::GetName()
{
return m_Name;
}

char *BaseSystemModule::GetType()
{
return "GenericModule";
}

char *BaseSystemModule::GetStatusLine()
{
return "No status available.\n";
}

void BaseSystemModule::ExecuteCommand(int commandID, char *commandLine)
{
m_System->DPrintf("WARNING! Undeclared ExecuteCommand().\n");
}

extern int COM_BuildNumber();

int BaseSystemModule::GetVersion()
{
return COM_BuildNumber();
}

int BaseSystemModule::GetSerial()
{
return m_Serial;
}

IBaseSystem *BaseSystemModule::GetSystem()
{
return m_System;
}

bool BaseSystemModule::Init(IBaseSystem *system, int serial, char *name)
{
if (!system)
return false;

m_State = MODULE_INITIALIZING;
m_System = system;
m_Serial = serial;
m_SystemTime = 0;

if (name) {
Q_strlcpy(m_Name, name);
}

return true;
}

void BaseSystemModule::RunFrame(double time)
{
m_SystemTime = time;
}

void BaseSystemModule::ShutDown()
{
if (m_State == MODULE_DISCONNECTED)
return;

m_Listener.Clear();
m_State = MODULE_DISCONNECTED;

if (!m_System->RemoveModule(this))
{
m_System->DPrintf("ERROR! BaseSystemModule::ShutDown: faild to remove module %s.\n", m_Name);
}
}

void BaseSystemModule::RegisterListener(ISystemModule *module)
{
ISystemModule *listener = (ISystemModule *)m_Listener.GetFirst();
while (listener)
{
if (listener->GetSerial() == module->GetSerial())
{
m_System->DPrintf("WARNING! BaseSystemModule::RegisterListener: module %s already added.\n", module->GetName());
return;
}

listener = (ISystemModule *)m_Listener.GetNext();
}

m_Listener.Add(module);
}

void BaseSystemModule::RemoveListener(ISystemModule *module)
{
ISystemModule *listener = (ISystemModule *)m_Listener.GetFirst();
while (listener)
{
if (listener->GetSerial() == module->GetSerial())
{
m_Listener.Remove(module);
return;
}

listener = (ISystemModule *)m_Listener.GetNext();
}
}

void BaseSystemModule::FireSignal(unsigned int signal, void *data)
{
ISystemModule *listener = (ISystemModule *)m_Listener.GetFirst();
while (listener)
{
listener->ReceiveSignal(this, signal, data);
listener = (ISystemModule *)m_Listener.GetNext();
}
}

void BaseSystemModule::ReceiveSignal(ISystemModule *module, unsigned int signal, void *data)
{
m_System->DPrintf("WARNING! Unhandled signal (%i) from module %s.\n", signal, module->GetName());
}

int BaseSystemModule::GetState()
{
return m_State;
}
75 changes: 75 additions & 0 deletions dep/hlsdk/common/BaseSystemModule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/

#pragma once

#include "ObjectList.h"
#include "IBaseSystem.h"

// C4250 - 'class1' : inherits 'BaseSystemModule::member' via dominance
#pragma warning(disable:4250)

class BaseSystemModule: virtual public ISystemModule {
public:
BaseSystemModule();
virtual ~BaseSystemModule() {}

EXT_FUNC virtual bool Init(IBaseSystem *system, int serial, char *name);
EXT_FUNC virtual void RunFrame(double time);
EXT_FUNC virtual void ReceiveSignal(ISystemModule *module, unsigned int signal, void *data);
EXT_FUNC virtual void ExecuteCommand(int commandID, char *commandLine);
EXT_FUNC virtual void RegisterListener(ISystemModule *module);
EXT_FUNC virtual void RemoveListener(ISystemModule *module);
EXT_FUNC virtual IBaseSystem *GetSystem();
EXT_FUNC virtual int GetSerial();
EXT_FUNC virtual char *GetStatusLine();
EXT_FUNC virtual char *GetType();
EXT_FUNC virtual char *GetName();

enum ModuleState {
MODULE_UNDEFINED = 0,
MODULE_INITIALIZING,
MODULE_CONNECTING,
MODULE_RUNNING,
MODULE_DISCONNECTED
};

EXT_FUNC virtual int GetState();
EXT_FUNC virtual int GetVersion();
EXT_FUNC virtual void ShutDown();
EXT_FUNC virtual char *GetBaseDir() { return ""; }
void FireSignal(unsigned int signal, void *data = nullptr);

protected:
IBaseSystem *m_System;
ObjectList m_Listener;
char m_Name[255];
unsigned int m_State;
unsigned int m_Serial;
double m_SystemTime;
};
Loading

0 comments on commit a672305

Please sign in to comment.