This repository has been archived by the owner on Dec 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
RadWolfie
committed
Nov 2, 2013
1 parent
305b47e
commit a23e0d4
Showing
11 changed files
with
1,691 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#ifndef addonH | ||
#define addonH | ||
|
||
#include <Windows.h> | ||
#include <wchar.h> | ||
|
||
#define dllport __declspec(dllimport) | ||
#define dllAPI __declspec(dllexport) | ||
#define WINAPIC __cdecl | ||
#if _ATL_VER >= 0xA00 | ||
#define static_assert_check static_assert //This is needed to verify correctly and prevent to compile if something is incorrect. | ||
#else | ||
#define static_assert_check(a, b) //Only nessary for Visual Studio 2008 and below to compile. | ||
#endif | ||
|
||
#include "struct.h" | ||
#include "util.h" | ||
#include "iniFile.h" | ||
#include "database.h" | ||
#include "object.h" | ||
#include "player.h" | ||
typedef toggle (WINAPIC *CmdFunc)(Player::PlayerInfo plI, util::ArgContainer arg,char chatRconRemote, short stage, LPVOID stack, bool* showChat); | ||
#include "admin.h" | ||
#include "command.h" | ||
|
||
extern "C" dllport void WINAPI haloOutput(int r, const char *text,...); | ||
|
||
#define EAOONETIMEUPDATE 2 | ||
#define EAOOVERRIDE 1 | ||
#define EAOCONTINUE 0 | ||
#define EAOFAIL -1 | ||
|
||
#define CMDSUCC 1 | ||
#define CMDFAIL -1 | ||
#define CMDNOMATCH 0 | ||
typedef void (WINAPIC *addonTimerFunc)(DWORD id, void* param); | ||
|
||
namespace addon { | ||
|
||
#pragma pack(push,1) | ||
struct sectNames { | ||
wchar_t sect_name1[24]; | ||
wchar_t sect_name2[24]; | ||
wchar_t sect_name3[24]; | ||
wchar_t sect_name4[24]; | ||
wchar_t sect_name5[24]; | ||
}; | ||
struct addonInfo { | ||
wchar_t name[128]; | ||
wchar_t version[15]; | ||
wchar_t author[128]; | ||
wchar_t description[255]; | ||
wchar_t config_folder[24]; | ||
sectNames sectors; | ||
}; | ||
struct addonTimer { | ||
DWORD id; | ||
DWORD execTime; | ||
void* param; | ||
addonTimerFunc func; | ||
}; | ||
struct versionEAO { | ||
WORD size; //Used by sizeof(versionEAO); | ||
WORD requiredAPI; //API requirement revision (Including command interface) | ||
WORD general; //General revision specifically for events in Halo. | ||
WORD iniFile; //CiniFile revision | ||
WORD database; //Database revision | ||
WORD external; //External account revision | ||
WORD reserved1; //Reserved | ||
WORD reserved2; //Reserved | ||
}; | ||
#pragma pack(pop) | ||
|
||
extern "C" dllport DWORD WINAPIC EXTAddOnTimerAdd(addonTimer params); | ||
extern "C" dllport void WINAPIC EXTAddOnTimerDelete(DWORD id); | ||
} | ||
extern "C" dllAPI addon::versionEAO EXTversion = { | ||
sizeof(addon::versionEAO), //size | ||
3, //requiredAPI (required) | ||
3, //general (optional, set to 0 if not using) | ||
1, //iniFile (optional, set to 0 if not using) | ||
2, //database (optional, set to 0 if not using) | ||
0, //external (optional, set to 0 if not using) | ||
0, //reserved | ||
0 }; //reserved | ||
#include "haloEngine.h" | ||
#endif | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef adminH | ||
#define adminH | ||
|
||
#define LOGININVALID -1 | ||
#define LOGINFAIL 0 | ||
#define LOGINPASS 1 | ||
|
||
extern "C" class dllport Admin { | ||
public: | ||
Admin(); | ||
~Admin(); | ||
Admin(Admin const &); | ||
short unlimit; | ||
bool reqUser; | ||
bool reqAddr; | ||
bool reqPort; | ||
bool reqLoginAddr; | ||
bool reqLoginPort; | ||
bool reqRemoteAddr; | ||
bool reqRemotePort; | ||
toggle WINAPIC isPlayerAuthorized(Player::PlayerInfo* plI, wchar_t* cmd, util::ArgContainer* arg, CmdFunc* func); | ||
toggle WINAPIC UsernameExist(wchar_t username[]); | ||
toggle WINAPIC Add(wchar_t hashW[], wchar_t IP_Addr[], wchar_t IP_Port[], wchar_t username[],wchar_t password[],short level,bool remote, bool pass_force); | ||
toggle WINAPIC Del(wchar_t username[]); | ||
toggle WINAPIC Login(Player::PlayerInfo& plI, char chatRconRemote, wchar_t user[], wchar_t pass[]); | ||
}; | ||
extern "C" dllport Admin* admin; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#ifndef commandH | ||
#define commandH | ||
|
||
|
||
#pragma pack(push,1) | ||
struct helpInfo { | ||
wchar_t info[4][255]; | ||
}; | ||
#pragma pack(pop) | ||
extern "C" class Command { | ||
public: | ||
Command(); | ||
~Command(); | ||
dllport bool WINAPIC Add(const wchar_t command[], CmdFunc func, const wchar_t section[], unsigned short min, unsigned short max, bool allowOverride, GAME_MODE_S mode); | ||
dllport bool WINAPIC Del(CmdFunc func, const wchar_t funcName[]); | ||
dllport bool WINAPIC ReloadLevel(); | ||
dllport bool WINAPIC AliasAdd(const wchar_t* command, const wchar_t* alias); | ||
dllport bool WINAPIC AliasDel(const wchar_t* command, const wchar_t* alias); | ||
}; | ||
extern "C" dllport Command* command; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#ifndef databaseH | ||
#define databaseH | ||
|
||
extern const char dbErrorConnectionLost[]; | ||
|
||
extern "C" namespace DBSQL { | ||
//-- | ||
//#pragma comment(lib,"Msvcrt.lib") //Basically bypass the error of vsnprintf... Replace the odbccp32.lib file with vista SDK!!! | ||
#pragma comment(lib,"odbc32.lib") | ||
//#pragma comment(lib,"odbcbcp.lib") | ||
#pragma comment(lib,"odbccp32.lib") | ||
//-- | ||
#include <sql.h> | ||
#include <sqlext.h> | ||
#include <odbcinst.h> | ||
|
||
#define IS_SQL_ERR !IS_SQL_OK | ||
#define IS_SQL_OK(res) (res==SQL_SUCCESS_WITH_INFO || res==SQL_SUCCESS) | ||
#define SAFE_STR(str) ((str==NULL) ? _T("") : str) | ||
//-- | ||
void EXTHookDatabaseEnabled(); | ||
void EXTHookDatabaseDisabled(); | ||
bool EXTIsHookDatabase(); | ||
void EXTUnloadDatabase(); | ||
|
||
class dllport DBConnection { | ||
public: | ||
bool WINAPIC Connect(LPCWSTR MDBPath,LPCWSTR User=L"", LPCWSTR Pass=L"",bool Exclusive=0); | ||
//bool Connect(LPCTSTR svSource); | ||
DBConnection(); | ||
~DBConnection(); | ||
DBConnection& operator=(DBConnection const&); | ||
void WINAPIC Disconnect(); | ||
void WINAPIC STMTStatus(); | ||
void WINAPIC Check(); | ||
SQLHDBC WINAPIC HDBC() { | ||
return m_hDBC; | ||
} | ||
private: | ||
SQLRETURN m_nReturn; // Internal SQL Error code | ||
SQLHENV m_hEnv; // Handle to environment | ||
SQLHDBC m_hDBC; // Handle to database connection | ||
}; | ||
/*extern "C" class MDBConnection { | ||
};*/ | ||
class dllport DBStmt { | ||
private: | ||
SQLHSTMT m_hStmt; | ||
int m_nStmt; | ||
public: | ||
DBStmt(); | ||
~DBStmt(); | ||
DBStmt& operator=(DBStmt const&); | ||
DBStmt(SQLHDBC hDBCLink); | ||
bool WINAPIC IsValid(); | ||
USHORT WINAPIC GetColumnCount(); | ||
DWORD WINAPIC GetChangedRowCount(); | ||
bool WINAPIC Query(LPCWSTR strSQL); | ||
bool WINAPIC Fetch(); | ||
bool WINAPIC FetchRow(UINT nRow); | ||
bool WINAPIC FetchPrevious(); | ||
bool WINAPIC FetchNext(); | ||
bool WINAPIC FetchRow(ULONG nRow,bool Absolute=1); | ||
bool WINAPIC FetchFirst(); | ||
bool WINAPIC FetchLast(); | ||
bool WINAPIC Cancel(); | ||
/*bool SetPos(SQLSETPOSIROW irow); | ||
bool OpenCursor(); | ||
bool CloseCursor();*/ | ||
|
||
bool WINAPIC BindColumn(USHORT Column, LPVOID pBuffer, ULONG pBufferSize, LONG * pReturnedBufferSize=NULL, USHORT nType=SQL_C_TCHAR); | ||
USHORT WINAPIC GetColumnByName(LPCTSTR Column); | ||
bool WINAPIC GetData(USHORT Column, LPVOID pBuffer, ULONG pBufLen, LONG * dataLen=NULL, int Type=SQL_C_DEFAULT); | ||
int WINAPIC GetColumnType( USHORT Column ); | ||
DWORD WINAPIC GetColumnSize( USHORT Column ); | ||
DWORD WINAPIC GetColumnScale( USHORT Column ); | ||
bool WINAPIC GetColumnName( USHORT Column, LPTSTR Name, SHORT NameLen ); | ||
bool WINAPIC IsColumnNullable( USHORT Column ); | ||
}; | ||
}; | ||
extern "C" dllport DBSQL::DBConnection iDB; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
#ifndef haloEngineH | ||
#define haloEngineH | ||
|
||
#define CANTJOINSERVER 0 | ||
#define INVALIDCONREQUEST 1 | ||
#define PASSWORDREJECTED 2 | ||
#define SERVERFULL 3 | ||
#define CDINVALID 4 | ||
#define CDINUSED 5 | ||
#define OPBANNED 6 | ||
#define OPKICKED 7 | ||
#define VIDEOTEST 8 | ||
#define CPSAVED 9 | ||
#define ADDRESSINVALID 10 | ||
#define PROFILEREQUIRED 11 | ||
#define INCOMPATIBLENETWORK 12 | ||
#define OLDERCVER 13 | ||
#define NEWERCVER 14 | ||
#define ADMINREQUIREDPATCH 15 | ||
#define REQUESTDELETESAVED 16 | ||
|
||
#define HALO_UNKNOWN 0 | ||
#define HALO_TRIAL 1 | ||
#define HALO_PC 2 | ||
#define HALO_CE 3 | ||
|
||
#ifndef DIRECT3D_VERSION | ||
#define DIRECTX9 DWORD | ||
#else | ||
#define DIRECTX9 IDirect3D9 | ||
#endif | ||
#ifndef DIRECTINPUT_VERSION | ||
#define DIRECTI8 DWORD | ||
#else | ||
#define DIRECTI8 IDirectInput8 | ||
#endif | ||
#ifndef DIRECTSOUND_VERSION | ||
#define DIRECTS8 DWORD | ||
#else | ||
#define DIRECTS8 IDirectSound | ||
#endif | ||
|
||
extern "C" class dllport HaloEngine { // For Add-on API interface support | ||
public: | ||
GlobalServer* globalServer; | ||
PlayerAlter* playerAlter; | ||
MachineHeader* machineHeader; | ||
BYTE machineHeaderSize; | ||
DWORD* player_base; | ||
GameType* gameTypeLive; | ||
CheatHeader* cheatHeader; | ||
MapStruct* mapCurrent; | ||
ConsoleStruct* console; | ||
DWORD* serverUpTimeLive; | ||
DWORD* mapUpTimeLive; | ||
DWORD* mapTimeLimitLive; | ||
DWORD* mapTimeLimitPermament; | ||
BYTE haloGameVersion; | ||
bool isDedi; | ||
ConsoleColorStruct* consoleColor; | ||
DIRECTX9** DirectX9; | ||
DIRECTI8** DirectInput8; | ||
DIRECTS8** DirectSound8; | ||
HaloEngine(); | ||
//Halo Simulate Functions Begin | ||
DWORD WINAPIC BuildPacket(LPBYTE output, DWORD arg1, DWORD packettype, DWORD arg3, LPBYTE dataPtr, DWORD arg4, DWORD arg5, DWORD arg6); | ||
void WINAPIC AddPacketToPlayerQueue(DWORD player, LPBYTE packet, DWORD packetCode, DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5); | ||
void WINAPIC AddPacketToGlobalQueue(LPBYTE packet, DWORD packetCode, DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5); | ||
void WINAPIC DispatchRcon(rconData& d, Player::PlayerInfo& plI); | ||
void WINAPIC DispatchPlayer(chatData& d, int len, Player::PlayerInfo& plI); | ||
void WINAPIC DispatchGlobal(chatData& d, int len); | ||
bool WINAPIC sendRejectCode(MachineHeader* mH, DWORD code); | ||
void WINAPIC GetCDHash(MachineHeader &mH, char hashKey[33]); | ||
void WINAPIC SetObjectSpawnPlayerX(playerindex pl_ind); | ||
void WINAPIC Kill(Player::PlayerInfo plI); | ||
bool WINAPIC SetIdle(); | ||
bool WINAPIC MapNext(); | ||
bool WINAPIC Exec(const char* cmd); | ||
void WINAPIC GetServerPassword(wchar_t pass[8]); | ||
void WINAPIC SetServerPassword(wchar_t pass[8]); | ||
void WINAPIC GetRconPassword(char pass[8]); | ||
void WINAPIC SetRconPassword(char pass[8]); | ||
bool WINAPIC BanPlayer(Player::PlayerExtended &plEx, tm &gmtm); | ||
bool WINAPIC BanCDkey(wchar_t CDHash[33], tm &gmtm); | ||
bool WINAPIC BanIP(wchar_t IP_Addr[16], tm &gmtm); | ||
int WINAPIC BanIPGetId(wchar_t IP_Addr[16]); | ||
int WINAPIC BanCDkeyGetId(wchar_t CDHash[33]); | ||
bool WINAPIC UnbanID(int ID); | ||
//char* WINAPIC GetCDHash(Player::PlayerInfo& plI); | ||
void WINAPIC GetIP(MachineHeader& mH, BYTE m_ip[4]); | ||
void WINAPIC GetPort(MachineHeader& mH, WORD& m_port); | ||
//Halo Simulate Functions End | ||
bool WINAPIC EXTAddOnGetInfoIndex(size_t index, addon::addonInfo &getInfo); | ||
bool WINAPIC EXTAddOnGetInfoByName(wchar_t name[], addon::addonInfo &getInfo); | ||
bool WINAPIC EXTAddOnReloadDll(wchar_t name[128]); | ||
}; | ||
extern "C" dllport HaloEngine* haloEngine; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#ifndef iniFileH | ||
#define iniFileH | ||
|
||
#define INIFILELENMAX 512 | ||
|
||
extern "C" class dllport CIniFile { | ||
public: | ||
#pragma pack(push,1) | ||
struct Record { | ||
wchar_t comments[256]; | ||
wchar_t commented; | ||
wchar_t section[128]; | ||
wchar_t key[128]; | ||
wchar_t value[256]; | ||
}; | ||
#pragma pack(pop) | ||
enum commentChar { | ||
pound = L'#', | ||
semiColon = L';' | ||
}; | ||
CIniFile(); | ||
~CIniFile(); | ||
CIniFile(CIniFile const&); | ||
CIniFile& operator=(CIniFile const&); | ||
void WINAPIC Close(); | ||
bool WINAPIC Open(wchar_t const fileName[]); | ||
bool WINAPIC Create(wchar_t const fileName[]); | ||
bool WINAPIC Delete(wchar_t const fileName[]); | ||
bool WINAPIC Content(const wchar_t*& content, size_t &len); | ||
bool WINAPIC SectionAdd(wchar_t const sectionName[]); | ||
bool WINAPIC SectionDelete(wchar_t const sectionName[]); | ||
bool WINAPIC SectionExist(wchar_t const sectionName[]); | ||
bool WINAPIC ValueExist(wchar_t const keyName[], const wchar_t sectionName[]); | ||
bool WINAPIC ValueSet(wchar_t const keyName[], wchar_t valueName[], const wchar_t sectionName[]); | ||
bool WINAPIC ValueGet(wchar_t const keyName[], wchar_t valueName[], const wchar_t sectionName[]); | ||
bool WINAPIC Save(); | ||
bool WINAPIC Load(); | ||
void WINAPIC Clear(); | ||
private: | ||
wchar_t tempFileName[INIFILELENMAX]; | ||
const wchar_t* strFileContentW; | ||
DWORD size; | ||
HANDLE hFile; | ||
HANDLE hFileMap; | ||
#pragma warning( push ) | ||
#pragma warning( disable : 4251) | ||
util::dynamicStack<Record>* content; | ||
#pragma warning( pop ) | ||
}; | ||
|
||
#endif |
Oops, something went wrong.