Skip to content
This repository has been archived by the owner on Dec 27, 2020. It is now read-only.

Commit

Permalink
Add-on API 3.1.1
Browse files Browse the repository at this point in the history
Specifically for H-Ext 0.5.2.2
* Fixed dynamicStack class
* Fixed IObject class for cloning objects
* Changed method to use "defined" class(es) to maintain which class
versioning during compile time. (More easier and better knowing which
class are being in used.)
* Added Timer class
* Added Admin class to versioning (was missing)

NOTICE: Add-on Converter haven't initialized yet. Reverted back to
standard Windows load system method.
  • Loading branch information
RadWolfie committed May 29, 2014
1 parent d4a6706 commit 037a7ee
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 70 deletions.
136 changes: 109 additions & 27 deletions Add-on API.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,59 @@
#define dllport __declspec(dllimport)
#define dllAPI __declspec(dllexport)
#define WINAPIC __cdecl
#if _ATL_VER >= 0xA00
#if _MSC_VER >= 1600
#define static_assert_check static_assert //This is needed to verify correctly and prevent to compile if something is incorrect.
/*#elif _MSC_VER >=1500
//TODO: Need find a way to add assert support for older than Visual Studio 2010.
#define static_assert_check(a, b)*/
#else
#define static_assert_check(a, b) //Only nessary for Visual Studio 2008 and below to compile.
#define static_assert_check(a, b) //Only necessary for Visual Studio 2008 and below to compile.
#endif


#ifdef __cplusplus
#define CNATIVE extern "C"
#else
#define CNATIVE
#endif

#include "struct.h"
#include "util.h"

#ifdef EXT_ICINIFILE
#include "iniFile.h"
#endif

#ifdef EXT_IDATABASE
#include "database.h"
#endif

#ifdef EXT_IOBJECT
#include "object.h"
#endif

#include "player.h"
typedef toggle (WINAPIC *CmdFunc)(IPlayer::PlayerInfo plI, util::ArgContainer arg,char chatRconRemote, short stage, LPVOID stack, bool* showChat);
typedef toggle (WINAPIC *CmdFunc)(IPlayer::PlayerInfo plI, util::ArgContainer& arg,char chatRconRemote, DWORD idTimer, bool* showChat);

#ifdef EXT_IADMIN
#include "admin.h"
#endif

#ifdef EXT_ICOMMAND
#include "command.h"
#endif

extern "C" dllport void WINAPI haloOutput(int r, const char *text,...);
CNATIVE 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);
#define CMDSUCC 1
#define CMDSUCCDELAY 2

namespace addon {

Expand All @@ -53,36 +79,92 @@ namespace addon {
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 requiredAPI; //API requirement revision (Including command functions)
WORD general; //General revision specifically for events in Halo.
WORD iniFile; //CiniFile revision
WORD database; //Database revision
WORD pICIniFile; //CiniFile interface revision
WORD pIDatabase; //Database interface revision
WORD external; //External account revision
WORD reserved1; //Reserved
WORD reserved2; //Reserved
WORD pIHaloEngine; //Halo Engine interface revision
WORD pIObject; //Object interface revision
WORD pIPlayer; //Player interface revision
WORD pICommand; //Command interface revision
WORD pITimer; //Timer interface revision
WORD pIAdmin; //Admin interface revision
WORD reserved2; //reserved
WORD reserved3; //reserved
WORD reserved4; //reserved
WORD reserved5; //reserved
};
#pragma pack(pop)

extern "C" dllport DWORD WINAPIC EXTAddOnTimerAdd(addonTimer params);
extern "C" dllport void WINAPIC EXTAddOnTimerDelete(DWORD id);
#ifdef EXT_ITIMER
CNATIVE class ITimer {
public:
DWORD WINAPIC EXTAddOnTimerAdd(IPlayer::PlayerInfo plI, DWORD execTime);
void WINAPIC EXTAddOnTimerDelete(DWORD id);
};
CNATIVE dllport ITimer* pITimer;
#endif
}
extern "C" dllAPI addon::versionEAO EXTversion = {
sizeof(addon::versionEAO), //size
4, //requiredAPI (required)
4, //general (optional, set to 0 if not using)
2, //iniFile (optional, set to 0 if not using)
3, //database (optional, set to 0 if not using)
0, //external (optional, set to 0 if not using)
CNATIVE dllAPI addon::versionEAO EXTversion = {
sizeof(addon::versionEAO), //size
5, //requiredAPI - API requirement revision (Including command interface)
4, //general - General revision specifically for events in Halo.
#ifdef EXT_ICINIFILE
2, //iniFile - CiniFile class revision
#else
0, //iniFile - excluded
#endif
#ifdef EXT_IDATABASE
3, //pIDatabase - Database class revision
#else
0, //pIDatabase - excluded
#endif
#ifdef EXT_IEXTERNAL
0, //external - External account revision (for Remote Control or other external possiblities)
#else
0, //external - excluded
#endif
#ifdef EXT_IHALOENGINE
1, //pIHaloEngine - Halo Engine class revision
#else
0, //pIHaloEngine - excluded
#endif
#ifdef EXT_IOBJECT
2, //pIObject - Object class revision
#else
0, //pIObject - excluded
#endif
#ifdef EXT_IPLAYER
3, //pIPlayer - Player class revision
#else
0, //pIPlayer - excluded
#endif
#ifdef EXT_ICOMMAND
1, //pICommand - Command class revision
#else
0, //pICommand - excluded
#endif
#ifdef EXT_ITIMER
1, //pITimer - Timer class revision
#else
0, //pITimer - excluded
#endif
#ifdef EXT_IADMIN
1, //pIAdmin - Admin class revision
#else
0, //pIAdmin - excluded
#endif
0, //reserved
0, //reserved
0, //reserved
0 }; //reserved
static_assert_check(sizeof(addon::versionEAO)==32, "Error, incorrect size of versionEAO struct");

#ifdef EXT_IHALOENGINE
#include "haloEngine.h"
#endif

#endif

Binary file modified Add-on API.lib
Binary file not shown.
4 changes: 2 additions & 2 deletions admin.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
#define LOGINFAIL 0
#define LOGINPASS 1

extern "C" class IAdmin {
CNATIVE class IAdmin {
public:
virtual toggle WINAPIC isPlayerAuthorized(IPlayer::PlayerInfo* plI, const wchar_t* cmd, util::ArgContainer* arg, CmdFunc* func)=0;
virtual toggle WINAPIC UsernameExist(wchar_t username[])=0;
virtual toggle WINAPIC Add(wchar_t hashW[32], wchar_t IP_Addr[15], wchar_t IP_Port[6], wchar_t username[24],wchar_t password[],short level,bool remote, bool pass_force)=0;
virtual toggle WINAPIC Del(wchar_t username[24])=0;
virtual toggle WINAPIC Login(IPlayer::PlayerInfo& plI, char chatRconRemote, wchar_t user[], wchar_t pass[])=0;
};
extern "C" dllport IAdmin* pIAdmin;
CNATIVE dllport IAdmin* pIAdmin;

#endif
4 changes: 2 additions & 2 deletions command.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ struct helpInfo {
wchar_t info[4][255];
};
#pragma pack(pop)
extern "C" class ICommand {
CNATIVE class ICommand {
public:
virtual 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)=0;
virtual bool WINAPIC Del(CmdFunc func, const wchar_t funcName[])=0;
virtual bool WINAPIC ReloadLevel()=0;
virtual bool WINAPIC AliasAdd(const wchar_t* command, const wchar_t* alias)=0;
virtual bool WINAPIC AliasDel(const wchar_t* command, const wchar_t* alias)=0;
};
extern "C" dllport ICommand* pICommand;
CNATIVE dllport ICommand* pICommand;
#endif
4 changes: 3 additions & 1 deletion database.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef databaseH
#define databaseH

extern "C" namespace DBSQL {
CNATIVE 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")
Expand Down Expand Up @@ -56,7 +56,9 @@ extern "C" namespace DBSQL {
virtual bool WINAPIC GetColumnName( USHORT Column, LPTSTR Name, SHORT NameLen )=0;
virtual bool WINAPIC IsColumnNullable( USHORT Column )=0;
};
#ifdef EXT_IDATABASE
dllport IDBConnection* WINAPIC getIDBConnection();
dllport IDBStmt* WINAPIC getIDBStmt();
#endif
};
#endif
3 changes: 2 additions & 1 deletion haloEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extern "C" class IHaloEngine { // For Add-on API interface support
CheatHeader* cheatHeader;
MapStruct* mapCurrent;
ConsoleStruct* console;
DWORD* serverUpTimeLive;
DWORD* gameUpTimeLive;
DWORD* mapUpTimeLive;
DWORD* mapTimeLimitLive;
DWORD* mapTimeLimitPermament;
Expand All @@ -62,6 +62,7 @@ extern "C" class IHaloEngine { // For Add-on API interface support
DIRECTX9* DirectX9;
DIRECTI8* DirectInput8;
DIRECTS8* DirectSound8;
bool* cheatVEject;
//Halo Simulate Functions Begin
virtual DWORD WINAPIC BuildPacket(LPBYTE output, DWORD arg1, DWORD packettype, DWORD arg3, LPBYTE dataPtr, DWORD arg4, DWORD arg5, DWORD arg6)=0;
virtual void WINAPIC AddPacketToPlayerQueue(DWORD player, LPBYTE packet, DWORD packetCode, DWORD arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5)=0;
Expand Down
6 changes: 4 additions & 2 deletions iniFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define INIFILELENMAX 512

extern "C" class ICIniFile {
CNATIVE class ICIniFile {
public:
#pragma pack(push,1)
struct Record {
Expand Down Expand Up @@ -34,6 +34,8 @@ extern "C" class ICIniFile {
virtual bool WINAPIC Load()=0;
virtual void WINAPIC Clear()=0;
};
extern "C" dllport ICIniFile* WINAPIC getICIniFile();
#ifdef EXT_ICINIFILE
CNATIVE dllport ICIniFile* WINAPIC getICIniFile();
#endif

#endif
9 changes: 5 additions & 4 deletions object.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef objectH
#define objectH
#include "player.h" //Required in order to obtain playerInfo structure.
extern "C" class IObject {
CNATIVE class IObject {
public:
// Structure definitions
#pragma pack(push, 1)
Expand Down Expand Up @@ -68,11 +68,12 @@ extern "C" class IObject {
virtual ObjectS* WINAPIC GetObjectAddress(int mode, ident obj_id)=0;
virtual hTagHeader* WINAPIC LookupTag(ident objectTag)=0;
virtual hTagHeader* WINAPIC LookupTagTypeName(const char* tagType, const char* tag)=0;
virtual void WINAPIC Delete(ident obj_id)=0;
virtual void WINAPIC Copy(ident obj_id, IPlayer::PlayerInfo plI)=0;
virtual bool WINAPIC Delete(ident obj_id)=0;
virtual bool WINAPIC Copy(ident* model_Tag, IPlayer::PlayerInfo plI)=0;
virtual bool WINAPIC Eject(ident obj_id)=0;
virtual void WINAPIC Update(ident obj_id)=0;
virtual void WINAPIC Swap(ident biped_id, IPlayer::PlayerInfo plI)=0;
};
extern "C" dllport IObject* pIObject;
CNATIVE dllport IObject* pIObject;

#endif
7 changes: 5 additions & 2 deletions player.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define MSG_ERROR 6
#define MSG_ALERT 7

extern "C" class IPlayer {
CNATIVE class IPlayer {
public:
#pragma pack(push,1)
struct PlayerExtended {
Expand Down Expand Up @@ -93,7 +93,10 @@ extern "C" class IPlayer {
virtual bool WINAPIC isAdmin(machineindex m_ind)=0;
virtual PlayerInfo WINAPIC getPlayerByBipedTagCurrent(ident bipedTag)=0;
virtual PlayerInfo WINAPIC getPlayerByBipedTagPrevious(ident bipedTag)=0;
virtual bool WINAPIC sendCustomMsgBroadcast(char formatMsg, const wchar_t *Msg, ...)=0;
};
extern "C" dllport IPlayer* pIPlayer;
#ifdef EXT_IPLAYER
CNATIVE dllport IPlayer* pIPlayer;
#endif

#endif
Loading

0 comments on commit 037a7ee

Please sign in to comment.