Skip to content

Commit

Permalink
API Update 37-6
Browse files Browse the repository at this point in the history
  • Loading branch information
Daztek committed Aug 21, 2024
1 parent e8d10a7 commit 0d777cb
Show file tree
Hide file tree
Showing 38 changed files with 182 additions and 253 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ find_package(Sanitizers)
execute_process(COMMAND git rev-parse --short HEAD OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE SHORT_HASH)
set(TARGET_NWN_BUILD 8193)
set(TARGET_NWN_BUILD_REVISION 37)
set(TARGET_NWN_BUILD_POSTFIX 5)
set(TARGET_NWN_BUILD_POSTFIX 6)
set(NWNX_BUILD_SHA ${SHORT_HASH})
set(PLUGIN_PREFIX NWNX_)

Expand Down
2 changes: 0 additions & 2 deletions NWNXLib/API/API/ALL_CLASSES.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ struct CNWSAreaGridTransTableEntry;
struct CNWSAreaInterTileSuccessors;
struct CNWSArea;
struct CNWSBarter;
struct CNWSClient;
struct CNWSCombatRoundAction;
struct CNWSCombatAttackData;
struct CNWSCombatRound;
Expand Down Expand Up @@ -278,7 +277,6 @@ struct CNWSSoundObject;
struct CNWSAreaOfEffectObject;
struct CStoreCustomer;
struct CNWSStore;
struct CNWSSysAdmin;
struct CNWSTile;
struct CNWSTileSet;
struct CNWSTransition;
Expand Down
6 changes: 3 additions & 3 deletions NWNXLib/API/API/CBaseExoApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ typedef int BOOL;
struct CBaseExoApp
{

virtual BOOL AdmitNetworkAddress(uint32_t nProtocol, CExoString sAddress);
virtual BOOL AdmitNetworkAddress(CExoString sAddress);
virtual BOOL AdmitPlayerName(CExoString sPlayerName);
virtual BOOL SetNetworkAddressBan(uint32_t nProtocol, CExoString sAddress, BOOL bBanPlayer);
virtual BOOL SetNetworkAddressBan(CExoString sAddress, BOOL bBanPlayer);
virtual void PlayerListChange(uint32_t nPlayerId, BOOL bEnter, BOOL bPrimaryPlayer = false);
virtual BOOL HandleMessage(uint32_t nPlayerId, uint8_t * pData, uint32_t dwSize, BOOL bRawMessage);
virtual void HandleMessage(uint32_t nPlayerId, uint8_t * pData, uint32_t dwSize);
virtual float GetFPS();
virtual BOOL ContinueMessageProcessing();
virtual class CNetLayer * GetNetLayer();
Expand Down
5 changes: 2 additions & 3 deletions NWNXLib/API/API/CNWMessage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ struct CNWMessage
CNWMessage();
virtual ~CNWMessage();
BOOL SetReadMessage(uint8_t * pMessage, uint32_t dwSize, uint32_t dwPlayerID = 0xffffffff, BOOL bHighPriority = true);
void ClearReadMessage();
void HandleExpectedTypeMismatch(MessageType expect, MessageType got);
void ExpectType(MessageType t);
BOOL ReadBOOL();
Expand All @@ -80,8 +79,8 @@ struct CNWMessage
CExoString ReadCExoString(int32_t nCount = 32);
void * ReadVOIDPtr(int32_t nSize);
json ReadJSON();
BOOL MessageReadOverflow(BOOL bWarn = true);
BOOL MessageReadUnderflow(BOOL bWarn = true);
BOOL MessageReadOverflow();
BOOL MessageReadUnderflow();
BOOL MessageMoreDataToRead();
void CreateWriteMessage(uint32_t nSize = 128, uint32_t dwPlayerID = 0xffffffff, BOOL bHighPriority = true);
void WriteType(MessageType t);
Expand Down
35 changes: 0 additions & 35 deletions NWNXLib/API/API/CNWSClient.hpp

This file was deleted.

5 changes: 3 additions & 2 deletions NWNXLib/API/API/CNWSEffectListHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ NWN_API_PROLOGUE(CNWSEffectListHandler)

struct CGameEffect;
struct CNWSObject;
typedef int32_t (*pfAECommands)(CNWSObject *, CGameEffect *, BOOL);
typedef int32_t (*pfRECommands)(CNWSObject *, CGameEffect *);



typedef int BOOL;
Expand All @@ -20,7 +19,9 @@ typedef uint32_t OBJECT_ID;

struct CNWSEffectListHandler : CGameEffectApplierRemover
{
typedef int32_t (CNWSEffectListHandler::*pfAECommands)(CNWSObject *, CGameEffect *, BOOL);
pfAECommands * m_pApplyEffectCommands;
typedef int32_t (CNWSEffectListHandler::*pfRECommands)(CNWSObject *, CGameEffect *);
pfRECommands * m_pRemoveEffectCommands;

~CNWSEffectListHandler();
Expand Down
4 changes: 2 additions & 2 deletions NWNXLib/API/API/CNWSItemPropertyHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ struct CNWSItem;
struct CNWSObject;
struct CNWSCreature;

typedef int32_t (*pfAIPCommands)(CNWSItem*, CNWItemProperty*, CNWSCreature*, uint32_t, BOOL);
typedef int32_t (*pfRIPCommands)(CNWSItem*, CNWItemProperty*, CNWSCreature*, uint32_t);
typedef int BOOL;
typedef uint32_t OBJECT_ID;


struct CNWSItemPropertyHandler : CItemPropertyApplierRemover
{
typedef int32_t (CNWSItemPropertyHandler::*pfAIPCommands)(CNWSItem*, CNWItemProperty*, CNWSCreature*, uint32_t, BOOL);
pfAIPCommands * m_pApplyItemPropertyCommands;
typedef int32_t (CNWSItemPropertyHandler::*pfRIPCommands)(CNWSItem*, CNWItemProperty*, CNWSCreature*, uint32_t);
pfRIPCommands * m_pRemoveItemPropertyCommands;

~CNWSItemPropertyHandler();
Expand Down
3 changes: 1 addition & 2 deletions NWNXLib/API/API/CNWSMessage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ struct CNWSMessage : CNWMessage
BOOL HandlePlayerToServerGoldMessage(CNWSPlayer * pPlayer, uint8_t nMinor);
BOOL HandlePlayerToServerInventoryMessage(CNWSPlayer * pPlayer, uint8_t nMinor);
BOOL HandlePlayerToServerLoginMessage(CNWSPlayer * pPlayer, uint8_t nMinor);
BOOL HandlePlayerToServerMessage(uint32_t nPlayerId, uint8_t * pBuffer, uint32_t nBufferSize);
void HandlePlayerToServerMessage(uint32_t nPlayerId, uint8_t * pBuffer, uint32_t nBufferSize);
BOOL HandlePlayerToServerModuleMessage(CNWSPlayer * pPlayer, uint8_t nMinor);
BOOL HandlePlayerToServerParty(CNWSPlayer * pPlayer, uint8_t nMinor);
BOOL HandlePlayerToServerServerChatMessage(CNWSPlayer * pPlayer, uint8_t nMinor);
BOOL HandlePlayerToServerServerStatusMessage(CNWSPlayer * pPlayer, uint8_t nMinor);
BOOL HandlePlayerToServerQuickChatMessage(CNWSPlayer * pPlayer, uint8_t nMinor);
BOOL HandlePlayerToServerJournalMessage(CNWSPlayer * pPlayer, uint8_t nMinor);
Expand Down
9 changes: 4 additions & 5 deletions NWNXLib/API/API/CNWSPlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "CExoString.hpp"
#include "CLastUpdateObject.hpp"
#include "CLastUpdatePartyObject.hpp"
#include "CNWSClient.hpp"
#include "CResRef.hpp"
#include <unordered_map>
#include <vector>
Expand Down Expand Up @@ -40,7 +39,7 @@ struct ExponentialSmoother
time_t m_prev;
};

struct CNWSPlayer : CNWSClient
struct CNWSPlayer
{
struct NuiState
{
Expand All @@ -66,6 +65,8 @@ struct CNWSPlayer : CNWSClient
BOOL m_bFloatyEffects;
int32_t m_nAreas;
OBJECT_ID * m_pAreas;
uint32_t m_nPlayerID;
int32_t m_nLanguage;
uint8_t m_nLoginState;
OBJECT_ID m_oidNWSObject;
uint64_t m_nLastUpdatedTime;
Expand Down Expand Up @@ -103,11 +104,9 @@ struct CNWSPlayer : CNWSClient
ExponentialSmoother m_cSmoothedLatency;

CNWSPlayer(uint32_t nPlayerID);
virtual ~CNWSPlayer();
~CNWSPlayer();
void ClearPlayerOnDestroyGame();
void Update();
virtual CNWSPlayer * AsNWSPlayer();
virtual CNWSPlayer * AsNWSDungeonMaster();
STRREF LoadLocalCharacter();
STRREF LoadDMCharacter();
STRREF LoadServerCharacter(CResRef cResRef, BOOL bSubDirChar = false);
Expand Down
32 changes: 0 additions & 32 deletions NWNXLib/API/API/CNWSSysAdmin.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion NWNXLib/API/API/CNWSVirtualMachineCommands.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ NWN_API_PROLOGUE(CNWSVirtualMachineCommands)
struct C2DA;
struct CResGFF;
struct CResStruct;
typedef int32_t (*pfCVMCommands)(int32_t, int32_t);


typedef int BOOL;
Expand All @@ -21,6 +20,7 @@ typedef uint32_t OBJECT_ID;

struct CNWSVirtualMachineCommands : CVirtualMachineCmdImplementer
{
typedef int32_t (CNWSVirtualMachineCommands::*pfCVMCommands)(int32_t, int32_t);
pfCVMCommands * m_pVirtualMachineCommands;

CNWSVirtualMachineCommands(CVirtualMachine* vm) : CVirtualMachineCmdImplementer(vm, VMContext::SERVER) {}
Expand Down
26 changes: 13 additions & 13 deletions NWNXLib/API/API/CNetLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,23 @@ struct CNetLayerSessionInfo;

typedef int BOOL;

enum class CNetInstance
{
INSTANCE_CLIENT,
INSTANCE_SERVER
};

struct CNetLayer
{
CNetLayerInternal * m_pcNetLayerInternal;

CNetLayer();
CNetLayer(CNetInstance);
~CNetLayer();
BOOL Initialize(CBaseExoApp * pcExoApp);
class CBaseExoApp * GetExoApp();
BOOL ShutDown();
BOOL StartProtocol(uint32_t nProtocol, uint32_t nPort, uint32_t nInstance);
BOOL EndProtocol(uint32_t nProtocol);
BOOL StartUDP(uint32_t nPort);
BOOL EndUDP();
void SetServerLanguage(int32_t nLanguage);
BOOL StartServerMode(CExoString sSessionName, uint32_t nMaxPlayers);
BOOL GetPasswordRequired();
Expand All @@ -47,7 +52,6 @@ struct CNetLayer
void SetDisconnectStrref(uint32_t nStrref);
CExoString GetDisconnectReason();
void SetDisconnectReason(const CExoString & sReason);
void SetUpPlayBackConnection();
void StartAddressTranslation(const CExoString & sInternetAddress);
BOOL GetAddressTranslationResult(const CExoString & sInternetAddress, CExoArrayList<uint32_t> & nIPv4);
void EndAddressTranslation(const CExoString & sInternetAddress);
Expand All @@ -63,8 +67,6 @@ struct CNetLayer
BOOL RequestServerDetails(uint32_t nConnectionId);
BOOL StartPing(uint32_t nSessionId);
BOOL EndPing(uint32_t nSessionId);
int32_t GetNumberLocalAdapters(uint32_t nProtocol);
CExoString GetLocalAdapterString(uint32_t nProtocol, uint32_t nAdapterNumber);
void SetSessionInfoChanged(uint32_t nSessionId, BOOL bHasChanged);
BOOL GetSessionInfoChanged(uint32_t nSessionSection);
void ClearSessionInfoChanged(uint32_t nSessionSection);
Expand All @@ -73,7 +75,6 @@ struct CNetLayer
CExoString GetSessionName();
void SetSessionName(CExoString sSessionName);
uint32_t GetUDPPort();
uint32_t GetPortBySessionId(uint32_t nSessionId);
CNetLayerSessionInfo * GetSessionInfo(uint32_t nSession);
BOOL EndConnectToSession();
uint32_t GetConnectionError();
Expand All @@ -84,25 +85,24 @@ struct CNetLayer
BOOL IsConnectedToLocalhost();
void ProcessReceivedFrames(BOOL bProcessReceivedMessage = true);
BOOL SendMessageToPlayer(uint32_t nPlayerId, uint8_t * pData, uint32_t nSize, uint32_t nFlags);
BOOL SendMessageToAddress(uint32_t nConnectionId, uint8_t * pData, uint32_t nSize);
BOOL SendMessageToAddress(CNetConnectionId nConnectionId, uint8_t * pData, uint32_t nSize);
BOOL UpdateStatusLoop(uint32_t nApplicationType);
BOOL GetPlayerAddressData(uint32_t nConnectionId, uint32_t * nProtocol, uint8_t * * pNetAddress1, uint8_t * * pNetAddress2, uint32_t * nPort);
//CNetPeer GetPlayerAddressData(uint32_t nConnectionId);
void StoreMessage(uint8_t * pData, uint32_t nMsgLength);
BOOL GetGameMasterPermision() const;
void SetGameMasterPermission(BOOL state);
BOOL TranslateAddressFromString(const char * szAddress, uint32_t * nProtocol, uint8_t * pNetAddress1, uint8_t * pNetAddress2, uint32_t * nWPort);
BOOL TranslateAddressFromString(const char * szAddress, uint8_t * pNetAddress1, uint32_t * nWPort);
class CExoNet * GetExoNet();
CExoString GetServerNetworkAddress();
void SetCurrentMasterServerInternetAddress(uint32_t nAddress, uint32_t nPort);
//void SetCurrentMasterServerInternetAddress(const CNetPeer& peer);
void ShutDownClientInterfaceWithReason(uint32_t nReason, const CExoString & sReason = "");
void SetMstServerPassword(CExoString szTemp);
BOOL PlayerIdToConnectionId(uint32_t nPlayerId, uint32_t * nConnectionId);
BOOL PlayerIdToConnectionId(uint32_t nPlayerId, CNetConnectionId * nConnectionId);
BOOL GetAnyWindowBehind();
BOOL OpenStandardConnection(int32_t nConnectionToUse, CExoString sHostName, int32_t nPort);
int32_t GetMessageFromStandardConnection(int32_t * nConnectionFrom, char * * pMessage, int32_t * nSize);
BOOL SendMessageToStandardConnection(int32_t nConnectionTo, char * pmessage, int32_t nSize);
BOOL CloseStandardConnection(int32_t nConnectonToClose);
BOOL GetIPBySessionId(uint32_t nSessionId, CExoString * sIPAddress);
void SetConnectionsDisallowed(BOOL bDisallowLoginWhileMasterServerIsDown);
BOOL GetConnectionsMustBeValidated();
void SetConnectionsMustBeValidated(BOOL bValidateLoginWhileMasterServerIsNotResponding);
Expand Down
3 changes: 1 addition & 2 deletions NWNXLib/API/API/CNetLayerSessionInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ typedef int BOOL;

struct CNetLayerSessionInfo
{
uint32_t m_nConnectionId;
CNetConnectionId m_nConnectionId;
CExoString m_sSessionName;
uint32_t m_nProtocol;
uint32_t m_nPort;
uint32_t m_nPingPacketSent[4];
uint32_t m_nPingPacketReceived[4];
Expand Down
14 changes: 6 additions & 8 deletions NWNXLib/API/API/CServerExoApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "CExoArrayList.hpp"
#include "CBaseExoApp.hpp"
#include "CExoArrayList.hpp"
#include "CExoLocString.hpp"
#include "CExoString.hpp"
#include "CResRef.hpp"
Expand All @@ -20,7 +19,6 @@ struct CGameObject;
struct CGameObjectArray;
struct CNWSArea;
struct CNWSAreaOfEffectObject;
struct CNWSClient;
struct CNWSCreature;
struct CNWSDoor;
struct CNWSEncounter;
Expand Down Expand Up @@ -51,8 +49,8 @@ struct CServerExoApp : CBaseExoApp

CServerExoApp(void );
virtual ~CServerExoApp();
BOOL AdmitNetworkAddress(uint32_t nProtocol, CExoString sAddress);
BOOL SetNetworkAddressBan(uint32_t nProtocol, CExoString sAddress, BOOL bBanPlayer);
BOOL AdmitNetworkAddress(CExoString sAddress);
BOOL SetNetworkAddressBan(CExoString sAddress, BOOL bBanPlayer);
BOOL AdmitPlayerName(CExoString sPlayerName);
void PlayerListChange(uint32_t nPlayerId, BOOL bEnter, BOOL bPrimaryPlayer = false);
void VomitServerOptionsToLog();
Expand Down Expand Up @@ -106,7 +104,7 @@ struct CServerExoApp : CBaseExoApp
int32_t GetModuleLanguage();
CServerAIMaster * GetServerAIMaster();
void * GetSysAdminList();
void * GetPlayerList();
const CExoArrayList<CNWSPlayer*> & GetPlayerList();
class CNWSMessage * GetNWSMessage();
CNetLayer * GetNetLayer();
class CNWPlaceMeshManager * GetPlaceMeshManager();
Expand All @@ -117,7 +115,7 @@ struct CServerExoApp : CBaseExoApp
CWorldTimer * GetWorldTimer();
CWorldTimer * GetTimestopTimer();
CWorldTimer * GetPauseTimer();
BOOL HandleMessage(uint32_t nPlayerId, uint8_t * pData, uint32_t dwSize, BOOL bRawMessage);
void HandleMessage(uint32_t nPlayerId, uint8_t * pData, uint32_t dwSize);
BOOL Initialize();
BOOL UnloadModule();
BOOL LoadModule(CExoString moduleResRef, CUUID uuidOverride, BOOL bIsSaveGame, CNWSPlayer * pPlayer, int32_t sourceType, const NWSync::Advertisement & nwsyncModuleSourceAdvert);
Expand Down Expand Up @@ -148,13 +146,13 @@ struct CServerExoApp : CBaseExoApp
void RemoveFromExclusionList(OBJECT_ID oidExclude, uint8_t nList);
BOOL IsOnActiveExclusionList(OBJECT_ID oidExclude);
BOOL GetIsControlledByPlayer(OBJECT_ID oidObject);
CNWSClient * GetClientObjectByPlayerId(uint32_t nPlayerId, uint8_t nClientType = 0);
CNWSPlayer * GetClientObjectByPlayerId(uint32_t nPlayerId);
BOOL ValidatePlayerLogin(void * pPlayer);
void MovePlayerToArea(void * pPlayer);
void InitiateModuleForPlayer(void * pPlayer);
CConnectionLib * GetConnectionLib();
CCampaignDB * GetCampaignDB();
BOOL GetPlayerAddressData(uint32_t nConnectionId, uint32_t * nProtocol, uint8_t * * pNetAddress1, uint8_t * * pNetAddress2, uint32_t * nPort);
//CNetPeer GetPlayerAddressData(CNetConnectionId nConnectionId);
BOOL GetFactionOfObject(OBJECT_ID oObject, int32_t * nFaction);
uint32_t ResolvePlayerByFirstName(const CExoString & sName);
BOOL GetMultiplayerEnabled(void );
Expand Down
Loading

0 comments on commit 0d777cb

Please sign in to comment.