mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-07-01 09:10:01 +00:00
moving to laptop
ignore this commit. I need to move this to my laptop
This commit is contained in:
parent
54f387796b
commit
06a1778c6f
@ -16,5 +16,5 @@ __dynamic=1
|
|||||||
# Set __include_backtrace__ to 1 to includes the backtrace library for better crashlogs.
|
# Set __include_backtrace__ to 1 to includes the backtrace library for better crashlogs.
|
||||||
# __compile_backtrace__=1
|
# __compile_backtrace__=1
|
||||||
# Set __compile_backtrace__ to 1 to compile the backtrace library instead of using system libraries.
|
# Set __compile_backtrace__ to 1 to compile the backtrace library instead of using system libraries.
|
||||||
__maria_db_connector_compile_jobs__=1
|
__maria_db_connector_compile_jobs__=
|
||||||
# Set to the number of jobs (make -j equivalent) to compile the mariadbconn files with.
|
# Set to the number of jobs (make -j equivalent) to compile the mariadbconn files with.
|
||||||
|
@ -6,15 +6,26 @@
|
|||||||
#include "dLogger.h"
|
#include "dLogger.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
|
#include "tinyxml2.h"
|
||||||
|
|
||||||
//! Forward declarations
|
//! Forward declarations
|
||||||
|
|
||||||
std::unique_ptr<sql::ResultSet> GetModelsFromDatabase();
|
std::unique_ptr<sql::ResultSet> GetModelsFromDatabase();
|
||||||
void WriteSd0Magic(char* input);
|
void WriteSd0Magic(char* input, uint32_t chunkSize);
|
||||||
|
|
||||||
uint32_t BrickByBrickFix::TruncateBrokenBrickByBrickXml() {
|
uint32_t BrickByBrickFix::TruncateBrokenBrickByBrickXml() {
|
||||||
auto modelsToTruncate = GetModelsFromDatabase();
|
auto modelsToTruncate = GetModelsFromDatabase();
|
||||||
if (modelsToTruncate->next()) {
|
while (modelsToTruncate->next()) {
|
||||||
// Decompress with zlib and attempt to convert to xml. If that fails this model is broken.
|
auto modelAsSd0 = modelsToTruncate->getBlob(2);
|
||||||
|
// Check that header is sd0 by checking for the sd0 magic.
|
||||||
|
if (
|
||||||
|
modelAsSd0->get() == 's' && modelAsSd0->get() == 'd' && modelAsSd0->get() == '0' &&
|
||||||
|
modelAsSd0->get() == 0x01 && modelAsSd0->get() == 0xFF && modelAsSd0->good()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Game::logger->Log("BrickByBrickFix", "Please update models to use sd0 through UpdateOldModels.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -28,8 +39,9 @@ uint32_t BrickByBrickFix::UpdateBrickByBrickModelsToSd0() {
|
|||||||
while (modelsToUpdate->next()) {
|
while (modelsToUpdate->next()) {
|
||||||
uint32_t modelId = modelsToUpdate->getInt(1);
|
uint32_t modelId = modelsToUpdate->getInt(1);
|
||||||
auto oldLxfml = modelsToUpdate->getBlob(2);
|
auto oldLxfml = modelsToUpdate->getBlob(2);
|
||||||
// Check if the stored blob starts with zlib magic (0x78). If it does, convert it to sd0.
|
// Check if the stored blob starts with zlib magic (0x78 0xDA - best compression of zlib)
|
||||||
if (oldLxfml->get() == 0x78) {
|
// If it does, convert it to sd0.
|
||||||
|
if (oldLxfml->get() == 0x78 && oldLxfml->get() == 0xDA) {
|
||||||
Game::logger->Log("BrickByBrickFix", "Updating model %i", modelId);
|
Game::logger->Log("BrickByBrickFix", "Updating model %i", modelId);
|
||||||
|
|
||||||
// Get and save size of zlib compressed chunk.
|
// Get and save size of zlib compressed chunk.
|
||||||
@ -39,14 +51,9 @@ uint32_t BrickByBrickFix::UpdateBrickByBrickModelsToSd0() {
|
|||||||
|
|
||||||
// Allocate 9 extra bytes. 5 for sd0 magic, 4 for the only zlib compressed size.
|
// Allocate 9 extra bytes. 5 for sd0 magic, 4 for the only zlib compressed size.
|
||||||
uint32_t oldLxfmlSizeWithHeader = oldLxfmlSize + 9;
|
uint32_t oldLxfmlSizeWithHeader = oldLxfmlSize + 9;
|
||||||
char* sd0ConvertedModel = static_cast<char*>(std::malloc(oldLxfmlSizeWithHeader));
|
char* sd0ConvertedModel = static_cast<char*>(malloc(oldLxfmlSizeWithHeader));
|
||||||
|
|
||||||
WriteSd0Magic(sd0ConvertedModel);
|
WriteSd0Magic(sd0ConvertedModel, oldLxfmlSize);
|
||||||
// zlib compressed chunk size
|
|
||||||
sd0ConvertedModel[5] = static_cast<uint8_t>(oldLxfmlSize);
|
|
||||||
sd0ConvertedModel[6] = static_cast<uint8_t>(oldLxfmlSize >> 8U);
|
|
||||||
sd0ConvertedModel[7] = static_cast<uint8_t>(oldLxfmlSize >> 16U);
|
|
||||||
sd0ConvertedModel[8] = static_cast<uint8_t>(oldLxfmlSize >> 24U);
|
|
||||||
for (uint32_t i = 9; i < oldLxfmlSizeWithHeader; i++) {
|
for (uint32_t i = 9; i < oldLxfmlSizeWithHeader; i++) {
|
||||||
sd0ConvertedModel[i] = oldLxfml->get();
|
sd0ConvertedModel[i] = oldLxfml->get();
|
||||||
}
|
}
|
||||||
@ -79,10 +86,12 @@ std::unique_ptr<sql::ResultSet> GetModelsFromDatabase() {
|
|||||||
return std::unique_ptr<sql::ResultSet>(modelsRawDataQuery->executeQuery());
|
return std::unique_ptr<sql::ResultSet>(modelsRawDataQuery->executeQuery());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteSd0Magic(char* input) {
|
void WriteSd0Magic(char* input, uint32_t chunkSize) {
|
||||||
input[0] = 's';
|
input[0] = 's';
|
||||||
input[1] = 'd';
|
input[1] = 'd';
|
||||||
input[2] = '0';
|
input[2] = '0';
|
||||||
input[3] = 0x01;
|
input[3] = 0x01;
|
||||||
input[4] = 0xFF;
|
input[4] = 0xFF;
|
||||||
|
// Write the integer to the character array
|
||||||
|
*reinterpret_cast<uint32_t*>(input + 5) = chunkSize;
|
||||||
}
|
}
|
||||||
|
@ -2401,7 +2401,6 @@ void GameMessages::HandleControlBehaviors(RakNet::BitStream* inStream, Entity* e
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {
|
||||||
//First, we have Wincent's clean methods of reading in the data received from the client.
|
|
||||||
LWOOBJID localId;
|
LWOOBJID localId;
|
||||||
|
|
||||||
inStream->Read(localId);
|
inStream->Read(localId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user