Skip to content

Commit

Permalink
Merge pull request #1712 from nwnxee/build8193.36
Browse files Browse the repository at this point in the history
Build8193.36-7 Support
  • Loading branch information
Daztek authored Dec 6, 2023
2 parents 51162c5 + b47919f commit 7155a00
Show file tree
Hide file tree
Showing 962 changed files with 1,193,123 additions and 4,532 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ build-nwnx/
build/
Documentation/

cmake-build-*/
.env

# Visual Studio
.vs/
out/
Expand Down
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,31 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased
https://github.com/nwnxee/unified/compare/build8193.35.40...HEAD
https://github.com/nwnxee/unified/compare/build8193.36.7...HEAD

### Added
- N/A

##### New Plugins
- N/A

##### New NWScript Functions
- N/A

### Changed
- N/A

### Deprecated
- N/A

### Removed
- N/A

### Fixed
- N/A

## 8193.36.7
https://github.com/nwnxee/unified/compare/build8193.35.40...build8193.36.7

### Added
- Feat: added modifier `NWNX_FEAT_MODIFIER_SPELLSAVEDCFORSCHOOL` to modify a creature's spell DC for a spell school
Expand All @@ -25,6 +49,7 @@ https://github.com/nwnxee/unified/compare/build8193.35.40...HEAD

##### New Plugins
- Resources: Adds `RESOURCES_*` variables for adding NWSync as a resource source, and specifying a replacement hak list.
- NWSQLiteExtensions: Adds various extensions for the game's built-in sqlite databases.

##### New NWScript Functions
- Object: GetLastSpellInstant()
Expand All @@ -35,6 +60,7 @@ https://github.com/nwnxee/unified/compare/build8193.35.40...HEAD
- Creature: NWNX_Creature_GetMaxAttackRange()
- Player: GetTURD()
- Item: {Get|Set}MinEquipLevel{Modifier|Override}()
- Util: UpdateClientObject()

### Changed
- Creature: Added an argument for passing a class package to `NWNX_Creature_LevelUp()`
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ 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 35)
set(TARGET_NWN_BUILD_POSTFIX 40)
set(TARGET_NWN_BUILD_REVISION 36)
set(TARGET_NWN_BUILD_POSTFIX 7)
set(NWNX_BUILD_SHA ${SHORT_HASH})
set(PLUGIN_PREFIX NWNX_)

Expand Down Expand Up @@ -53,7 +53,7 @@ else()
set(WARNING_FLAGS_CXX "-Wall -Wextra -Wno-pmf-conversions")
endif()

set(NWNX_STANDARD_FLAGS "-m64 -march=x86-64 -fdiagnostics-show-option -fno-omit-frame-pointer -fPIC -fno-strict-aliasing")
set(NWNX_STANDARD_FLAGS "-fdiagnostics-show-option -fno-omit-frame-pointer -fPIC -fno-strict-aliasing")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${NWNX_STANDARD_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${NWNX_STANDARD_FLAGS} ${WARNING_FLAGS_CXX} -std=c++17")
Expand Down
10 changes: 5 additions & 5 deletions Core/NWNXCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ void NWNXCore::ConfigureLogLevel(const std::string& plugin)

void NWNXCore::InitialSetupHooks()
{
m_vmSetVarHook = Hooks::HookFunction(&CNWVirtualMachineCommands::ExecuteCommandSetVar, &SetVarHandler, Hooks::Order::Final);
m_vmGetVarHook = Hooks::HookFunction(&CNWVirtualMachineCommands::ExecuteCommandGetVar, &GetVarHandler, Hooks::Order::Final);
m_vmTagEffectHook = Hooks::HookFunction(&CNWVirtualMachineCommands::ExecuteCommandTagEffect, &TagEffectHandler, Hooks::Order::Final);
m_vmTagItemProperyHook = Hooks::HookFunction(&CNWVirtualMachineCommands::ExecuteCommandTagItemProperty, &TagItemPropertyHandler, Hooks::Order::Final);
m_vmPlaySoundHook = Hooks::HookFunction(&CNWVirtualMachineCommands::ExecuteCommandPlaySound, &PlaySoundHandler, Hooks::Order::Final);
m_vmSetVarHook = Hooks::HookFunction(&CNWSVirtualMachineCommands::ExecuteCommandSetVar, &SetVarHandler, Hooks::Order::Final);
m_vmGetVarHook = Hooks::HookFunction(&CNWSVirtualMachineCommands::ExecuteCommandGetVar, &GetVarHandler, Hooks::Order::Final);
m_vmTagEffectHook = Hooks::HookFunction(&CNWSVirtualMachineCommands::ExecuteCommandTagEffect, &TagEffectHandler, Hooks::Order::Final);
m_vmTagItemProperyHook = Hooks::HookFunction(&CNWSVirtualMachineCommands::ExecuteCommandTagItemProperty, &TagItemPropertyHandler, Hooks::Order::Final);
m_vmPlaySoundHook = Hooks::HookFunction(&CNWSVirtualMachineCommands::ExecuteCommandPlaySound, &PlaySoundHandler, Hooks::Order::Final);


m_destroyServerHook = Hooks::HookFunction(&CAppManager::DestroyServer, &DestroyServerHandler, Hooks::Order::Final);
Expand Down
12 changes: 6 additions & 6 deletions Core/NWNXCore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "nwnx.hpp"
#include "API/CServerExoAppInternal.hpp"
#include "API/CNWVirtualMachineCommands.hpp"
#include "API/CNWSVirtualMachineCommands.hpp"

#include <functional>
#include <map>
Expand All @@ -16,11 +16,11 @@ class NWNXCore
NWNXCore();
~NWNXCore();

static int32_t GetVarHandler(CNWVirtualMachineCommands*, int32_t, int32_t);
static int32_t SetVarHandler(CNWVirtualMachineCommands*, int32_t, int32_t);
static int32_t TagEffectHandler(CNWVirtualMachineCommands*, int32_t, int32_t);
static int32_t TagItemPropertyHandler(CNWVirtualMachineCommands*, int32_t, int32_t);
static int32_t PlaySoundHandler(CNWVirtualMachineCommands*, int32_t, int32_t);
static int32_t GetVarHandler(CNWSVirtualMachineCommands*, int32_t, int32_t);
static int32_t SetVarHandler(CNWSVirtualMachineCommands*, int32_t, int32_t);
static int32_t TagEffectHandler(CNWSVirtualMachineCommands*, int32_t, int32_t);
static int32_t TagItemPropertyHandler(CNWSVirtualMachineCommands*, int32_t, int32_t);
static int32_t PlaySoundHandler(CNWSVirtualMachineCommands*, int32_t, int32_t);

std::unique_ptr<NWNXLib::Services::ServiceList> m_services;

Expand Down
12 changes: 6 additions & 6 deletions Core/NWNXCoreVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "API/CScriptLocation.hpp"
#include "API/CVirtualMachine.hpp"
#include "API/CGameEffect.hpp"
#include "API/CNWVirtualMachineCommands.hpp"
#include "API/CNWSVirtualMachineCommands.hpp"
#include "API/CNWSObject.hpp"

#include <cstring>
Expand Down Expand Up @@ -91,7 +91,7 @@ namespace Core {

extern NWNXCore* g_core;

int32_t NWNXCore::GetVarHandler(CNWVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
int32_t NWNXCore::GetVarHandler(CNWSVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
{
switch (nCommandId)
{
Expand Down Expand Up @@ -200,7 +200,7 @@ int32_t NWNXCore::GetVarHandler(CNWVirtualMachineCommands* thisPtr, int32_t nCom

return success ? VMError::Success : VMError::StackOverflow;
}
int32_t NWNXCore::SetVarHandler(CNWVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
int32_t NWNXCore::SetVarHandler(CNWSVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
{
switch (nCommandId)
{
Expand Down Expand Up @@ -323,7 +323,7 @@ int32_t NWNXCore::SetVarHandler(CNWVirtualMachineCommands* thisPtr, int32_t nCom
return VMError::Success;
}

int32_t NWNXCore::TagEffectHandler(CNWVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
int32_t NWNXCore::TagEffectHandler(CNWSVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
{
ASSERT(thisPtr); ASSERT(nCommandId == VMCommand::TagEffect); ASSERT(nParameters == 2);
auto *vm = Globals::VirtualMachine();
Expand Down Expand Up @@ -374,7 +374,7 @@ int32_t NWNXCore::TagEffectHandler(CNWVirtualMachineCommands* thisPtr, int32_t n
}


int32_t NWNXCore::TagItemPropertyHandler(CNWVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
int32_t NWNXCore::TagItemPropertyHandler(CNWSVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
{
ASSERT(thisPtr); ASSERT(nCommandId == VMCommand::TagItemProperty); ASSERT(nParameters == 2);
auto *vm = Globals::VirtualMachine();
Expand Down Expand Up @@ -424,7 +424,7 @@ int32_t NWNXCore::TagItemPropertyHandler(CNWVirtualMachineCommands* thisPtr, int
}


int32_t NWNXCore::PlaySoundHandler(CNWVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
int32_t NWNXCore::PlaySoundHandler(CNWSVirtualMachineCommands* thisPtr, int32_t nCommandId, int32_t nParameters)
{
ASSERT(thisPtr); ASSERT(nCommandId == VMCommand::PlaySound); ASSERT(nParameters == 1);
auto *vm = Globals::VirtualMachine();
Expand Down
7 changes: 1 addition & 6 deletions NWNXLib/API/API/ALL_CLASSES.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ struct EXOLTRHEADER;
struct CResLTR;
struct CResMDL;
struct CResTLK;
struct CScriptSourceFile;
struct CScriptCompilerIncludeFileStackEntry;
struct CScriptCompiler;
struct CVirtualMachineCmdImplementer;
Expand Down Expand Up @@ -178,7 +177,6 @@ struct CExoKeyTable;
struct CExoPackedFile;
struct CExoResFile;
struct CExoEncapsulatedFile;
struct CExoResourceImageFile;
struct CNetLayerWindow;
struct CNetLayerInternal;
struct KXPacket;
Expand All @@ -194,10 +192,7 @@ struct CScriptCompilerStructureEntry;
struct CScriptCompilerStructureFieldEntry;
struct CScriptCompilerSymbolTableEntry;
struct CVirtualMachineDebuggingContext;
struct CVirtualMachineDebugLoader;
struct CVirtualMachineDebuggerInstance;
struct CResNCS;
struct CResNDB;
struct CResNSS;
struct CFactionManager;
struct CMessagePlayer;
Expand Down Expand Up @@ -302,7 +297,7 @@ struct CNWSScriptVar;
struct CNWSScriptVarTable;
struct CNWSWaypoint;
struct SqlQueryEngineStructure;
struct CNWVirtualMachineCommands;
struct CNWSVirtualMachineCommands;
struct CResARE;
struct CResIFO;
struct CGameEffectApplierRemover;
Expand Down
6 changes: 0 additions & 6 deletions NWNXLib/API/API/CAppManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ struct CAppManager
uint32_t m_nApplicationId;
BOOL m_bMultiplayerEnabled;
BOOL m_bWasPaused;
BOOL m_bDigitalDistributionModule;
uint8_t * m_pDDCipher;
uint32_t m_nDDOffset;
uint32_t m_nPlayerTimeout;
BOOL m_bLogModelErrors;

Expand All @@ -48,10 +45,7 @@ struct CAppManager
BOOL GetDungeonMasterEXERunning();
void DisplayScriptDebuggerPopup();
void DestroyScriptDebuggerPopup();
BOOL SetDDCipherForModule(CExoString moduleName);
uint8_t ReadProgressFromINI(uint8_t m_nCampaign);
// CExoLocString GetHostedModuleDescription();
// CExoString GetHostedPublicInternetAddressAndPort();
void ConnectToServer(CExoString sAddress, BOOL bPasswordRequired);
class CWorldTimer * GetWorldTimer();
CExoString GetCryptoKxPublicKeyBase64();
Expand Down
2 changes: 1 addition & 1 deletion NWNXLib/API/API/CBaseExoApp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct CBaseExoApp
virtual BOOL CheckStickyPlayerNameReserved(CExoString sClientCDKey, CExoString sClientLegacyCDKey, CExoString sPlayerName, int32_t nConnectionType);
virtual void PushMessageOverWall(uint8_t * pData, uint32_t nMsgLength);
virtual BOOL GetIsMultiPlayer();
virtual BOOL GetCDKeys(CExoArrayList<CExoString> * * lstKeys);
virtual CExoString GetCDKey();
virtual void SetWeGotDisconnected();


Expand Down
2 changes: 1 addition & 1 deletion NWNXLib/API/API/CERFFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct CERFFile
BOOL WriteStringTable();
BOOL SetNumEntries(uint32_t nEntries);
BOOL WriteResource(char * szResName, RESTYPE rtResType, CRes * pRes, BOOL bIsGFF = true);
//BOOL WriteResource(const char * szResName, RESTYPE rtResType, DataViewRef pData);
BOOL WriteResource(const char * szResName, RESTYPE rtResType, DataViewRef pData);
BOOL Finish();


Expand Down
4 changes: 0 additions & 4 deletions NWNXLib/API/API/CExoDebug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ struct CExoDebug
void CloseLogFiles();
void FlushErrorFile();
void FlushLogFile();
uint32_t GetCurrentAllocatedMemory();
uint32_t GetMaxAllocatedMemory();
uint32_t GetTotalMemoryAllocations();
uint32_t GetCurrentMemoryAllocations();
void OpenLogFiles(CExoString sExecutableName, int32_t nMaxLogSize = 10000000);
void Warning(int32_t nLineNumber, const char * sFileName, const char * sComment = nullptr);
void WriteToErrorFile(const CExoString & sLogString);
Expand Down
1 change: 0 additions & 1 deletion NWNXLib/API/API/CExoEncapsulatedFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ struct CExoEncapsulatedFile : CExoPackedFile
virtual uint32_t GetResourceSize(RESID nID);
virtual BOOL Initialize();
virtual BOOL OpenFile();
virtual BOOL OpenFile(uint8_t * pCipher);
virtual uint32_t ReadResource(RESID nID, void * pData, uint32_t nSize, uint32_t nDataOffset);
virtual BOOL LoadHeader(const char * expectOid, uint8_t nType = 0);
virtual BOOL UnloadHeader();
Expand Down
5 changes: 2 additions & 3 deletions NWNXLib/API/API/CExoKeyTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ struct CExoKeyTable
~CExoKeyTable();
BOOL AddDirectoryContents(BOOL bPopulateTable = true);
BOOL AddEncapsulatedContents(BOOL bPopulateTable = true);
BOOL AddResourceImageContents(BOOL bPopulateTable = true, uint8_t * pCipher = nullptr);
BOOL AddManifestContents(BOOL bPopulateTable = true);
CKeyTableEntry * AddKey(const CResRef & cNewResRef, RESTYPE nType, RESID nNewResID, BOOL bPopulateEntry);
BOOL AddKeyTableContents(BOOL bPopulateTable = true);
CKeyTableEntry * AllocateTable(uint32_t nTableEntries, BOOL bKeepInMemory = false);
BOOL BuildNewTable(uint32_t nTableType, const CExoString & sName, uint32_t nTableID, BOOL bPopulateTable = true, uint8_t * pCipher = nullptr);
BOOL BuildNewTable(uint32_t nTableType, const CExoString & sName, uint32_t nTableID, BOOL bPopulateTable = true);
void DeleteTableList(CExoLinkedList<CKeyTableInfo> * lKeyTables);
void DestroyTable();
CKeyTableEntry * FindKey(const CResRef & cResRef, RESTYPE nType);
Expand All @@ -62,7 +61,7 @@ struct CExoKeyTable
BOOL GetTableIndex(uint32_t & nIndex, const CResRef & cResRef, RESTYPE nType);
uint32_t Hash(const CResRef & cResRef, RESTYPE nType);
BOOL LocateBifFile(const CExoString & sFileName);
void RebuildTable(uint8_t * pCipher = nullptr);
void RebuildTable();
int32_t GetEntryCount(BOOL bCountStatic);
void SetAllowDynamicReload(BOOL v);
void DropContentsFromCache();
Expand Down
3 changes: 0 additions & 3 deletions NWNXLib/API/API/CExoPackedFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,11 @@ struct CExoPackedFile
virtual void AddRefCount();
virtual BOOL CloseFile();
virtual void DeleteRefCount();
virtual void DeleteAsyncRefCount();
virtual CExoFile * GetFile();
virtual uint32_t GetResourceSize(RESID nID);
virtual BOOL Initialize();
virtual BOOL OpenFile();
virtual BOOL OpenFile(uint8_t * pCipher);
virtual uint32_t ReadResource(RESID nID, void * pData, uint32_t nSize, uint32_t nDataOffset);
virtual void ReadResourceAsync(RESID nID, void * pData, uint32_t nSize, uint32_t nDataOffset);
virtual BOOL LoadHeader(const char * expectOid, uint8_t nType = 0);
virtual BOOL UnloadHeader();
uint32_t ReadNWCompressedBuffer(void * outBuffer, uint32_t outBufSize, uint32_t readLength);
Expand Down
1 change: 0 additions & 1 deletion NWNXLib/API/API/CExoResFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ struct CExoResFile : CExoPackedFile
virtual uint32_t GetResourceSize(RESID nID);
virtual BOOL Initialize();
virtual BOOL OpenFile();
virtual BOOL OpenFile(uint8_t * pCipher);
virtual uint32_t ReadResource(RESID nID, void * pData, uint32_t nSize, uint32_t nDataOffset);
virtual BOOL LoadHeader(const char * expectOid, uint8_t nType = 0);
virtual BOOL UnloadHeader();
Expand Down
6 changes: 1 addition & 5 deletions NWNXLib/API/API/CExoResMan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ struct CExoResMan
~CExoResMan();
void SetupDefaultSearchPath();
BOOL AddEncapsulatedResourceFile(const CExoString & sName, uint32_t nPriority);
BOOL AddResourceImageFile(const CExoString & sName, uint8_t * pCipher = nullptr, uint32_t nPriority = (60*1000000));
BOOL AddFixedKeyTableFile(const CExoString & sName, uint32_t nPriority = (1*1000000));
BOOL AddResourceDirectory(const CExoString & sName, uint32_t nPriority, BOOL bDetectChanges = false);
BOOL AddManifest(const Hash::SHA1 & manifestHash, uint32_t nPriority);
Expand All @@ -66,7 +65,6 @@ struct CExoResMan
int64_t GetTotalPhysicalMemory();
int32_t ReleaseResObject(CRes * pRes, bool bDontCache = false);
BOOL RemoveEncapsulatedResourceFile(const CExoString & sName, BOOL bEmitWarningOnFailure = true);
BOOL RemoveResourceImageFile(const CExoString & sName);
BOOL RemoveFixedKeyTableFile(const CExoString & sName);
BOOL RemoveResourceDirectory(const CExoString & sName);
BOOL RemoveManifest(const Hash::SHA1 & sManifestHash);
Expand All @@ -93,7 +91,7 @@ struct CExoResMan
int32_t GetTableCount(CRes * pRes, BOOL bCountStatic);
BOOL GetIsStaticType(RESTYPE nType);
void RemoveFromToBeFreedList(CRes * pRes);
BOOL AddKeyTable(uint32_t nPriority, const CExoString & sName, uint32_t nTableType, uint8_t * pCipher = nullptr, BOOL bDetectChanges = false);
BOOL AddKeyTable(uint32_t nPriority, const CExoString & sName, uint32_t nTableType, BOOL bDetectChanges = false);
BOOL RemoveKeyTable(const CExoString & sName, uint32_t nTableType, BOOL bEmitWarningOnFailure = true);
size_t CountKeyTablesOf(int32_t type, const CExoString & sName = "");
void AddOverride(const CResRef & oldname, const CResRef & newname, RESTYPE restype);
Expand All @@ -107,13 +105,11 @@ struct CExoResMan
BOOL ServiceFromDirectory(CRes * pRes);
BOOL ServiceFromEncapsulated(CRes * pRes);
BOOL ServiceFromResFile(CRes * pRes);
BOOL ServiceFromImage(CRes * pRes);
BOOL ServiceFromManifest(CRes * pRes);
BOOL UpdateKeyTable(const CExoString & sName, uint32_t nTableType);
BOOL ServiceFromDirectoryRaw(CRes * pRes, int32_t nSize, char * pBuffer);
BOOL ServiceFromEncapsulatedRaw(CRes * pRes, int32_t nSize, char * pBuffer);
BOOL ServiceFromResFileRaw(CRes * pRes, int32_t nSize, char * pBuffer);
BOOL ServiceFromImageRaw(CRes * pRes, int32_t nSize, char * pBuffer);
CResRef GetOverride(const CResRef & name, RESTYPE restype);


Expand Down
Loading

0 comments on commit 7155a00

Please sign in to comment.