From 13010f10fa74c2e20d55117f20f86dc56ab2ccc4 Mon Sep 17 00:00:00 2001 From: Kolyah35 Date: Tue, 3 Mar 2026 01:22:26 +0300 Subject: [PATCH] revert all code back except platform --- CMakeLists.txt | 2 +- src/client/Minecraft.cpp | 27 +++++---- src/client/MouseHandler.cpp | 12 ---- src/client/Options.cpp | 2 +- src/client/gui/Gui.cpp | 42 +++++++------- src/client/gui/screens/SelectWorldScreen.cpp | 2 +- .../screens/touch/TouchSelectWorldScreen.cpp | 2 +- src/client/player/input/KeyboardInput.cpp | 2 +- src/client/renderer/Textures.cpp | 2 +- src/client/renderer/culling/tmp/FrustumData.h | 12 ++-- src/client/renderer/gles.h | 11 ++-- src/raknet/PacketLogger.cpp | 8 +-- src/raknet/RakNetStatistics.cpp | 58 +++++++++---------- src/raknet/RakPeer.cpp | 2 +- src/raknet/ReliabilityLayer.cpp | 2 +- src/raknet/SocketLayer.cpp | 2 +- 16 files changed, 90 insertions(+), 98 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8a48c5..93a325d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ include(cmake/CPM.cmake) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED TRUE) -set(CMAKE_CXX_FLAGS "-Wno-c++11-narrowing -Wno-invalid-source-encoding") +set(CMAKE_CXX_FLAGS "-Wno-c++11-narrowing -Wno-invalid-source-encoding -Wno-reserved-user-defined-literal") CPMAddPackage("gh:madler/zlib@1.3.2") CPMAddPackage( diff --git a/src/client/Minecraft.cpp b/src/client/Minecraft.cpp index 613d5b2..04598b1 100755 --- a/src/client/Minecraft.cpp +++ b/src/client/Minecraft.cpp @@ -4,7 +4,7 @@ #define NO_NETWORK #endif -#ifdef PLATFORM_DESKTOP +#if defined(RPI) #define CREATORMODE #endif @@ -574,7 +574,7 @@ void Minecraft::tick(int nTick, int maxTick) { #ifndef STANDALONE_SERVER textures->loadAndBindTexture("terrain.png"); if (!pause && !(screen && !screen->renderGameBehind())) { - #ifndef PLATFORM_DESKTOP + #if !defined(RPI) #ifdef __APPLE__ if (isSuperFast()) #endif @@ -691,7 +691,7 @@ void Minecraft::tickInput() { if (isPressed) { gui.handleKeyPressed(key); - #ifdef PLATFORM_DESKTOP //|| defined(_DEBUG) || defined(DEBUG) + #if defined(WIN32) || defined(RPI)//|| defined(_DEBUG) || defined(DEBUG) if (key >= '0' && key <= '9') { int digit = key - '0'; int slot = digit - 1; @@ -714,14 +714,16 @@ void Minecraft::tickInput() { } #endif } - + #endif + #if defined(RPI) if (key == Keyboard::KEY_E) { screenChooser.setScreen(SCREEN_BLOCKSELECTION); } if (!screen && key == Keyboard::KEY_O || key == 250) { releaseMouse(); } - + #endif + #if defined(WIN32) if (key == Keyboard::KEY_F) { options.isFlying = !options.isFlying; player->noPhysics = options.isFlying; @@ -829,7 +831,7 @@ void Minecraft::tickInput() { } #endif - #ifndef PLATFORM_DESKTOP + #ifndef RPI if (key == 82) pauseGame(false); #else @@ -846,7 +848,7 @@ void Minecraft::tickInput() { } #endif } - #ifdef PLATFORM_DESKTOP + #ifdef WIN32 if (key == Keyboard::KEY_M) { for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i) level->tick(); @@ -890,7 +892,7 @@ void Minecraft::tickInput() { || (buildHandled && bai.isRemove()); TIMER_POP_PUSH("handlemouse"); -#ifdef PLATFORM_DESKTOP +#ifdef RPI handleMouseDown(MouseAction::ACTION_LEFT, isTryingToDestroyBlock); handleMouseClick(buildHandled && bai.isInteract() || options.useMouseForDigging && Mouse::isButtonDown(MouseAction::ACTION_RIGHT)); @@ -1121,7 +1123,7 @@ void Minecraft::releaseMouse() } bool Minecraft::useTouchscreen() { -#ifdef PLATFORM_DESKTOP +#ifdef RPI return false; #endif return options.useTouchScreen || !_supportsNonTouchscreen; @@ -1311,7 +1313,10 @@ void Minecraft::hostMultiplayer(int port) { // // Level generation // -/*static*/ void* Minecraft::prepareLevel_tspawn(void *p_param) { +/*static*/ + + void* Minecraft::prepareLevel_tspawn(void *p_param) +{ Minecraft* mc = (Minecraft*) p_param; mc->generateLevel("Currently not used", mc->level); return 0; @@ -1364,7 +1369,7 @@ void Minecraft::_levelGenerated() netCallback->levelGenerated(level); } -#ifdef PLATFORM_DESKTOP +#if defined(WIN32) || defined(RPI) if (_commandServer) { delete _commandServer; } diff --git a/src/client/MouseHandler.cpp b/src/client/MouseHandler.cpp index 7855e41..4044941 100755 --- a/src/client/MouseHandler.cpp +++ b/src/client/MouseHandler.cpp @@ -5,10 +5,6 @@ #include #endif -#ifdef PLATFORM_GLFW -#include -#endif - MouseHandler::MouseHandler( ITurnInput* turnInput ) : _turnInput(turnInput) {} @@ -33,10 +29,6 @@ void MouseHandler::grab() { SDL_WM_GrabInput(SDL_GRAB_ON); SDL_ShowCursor(0); #endif - -#ifdef PLATFORM_GLFW - glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_DISABLED); -#endif } void MouseHandler::release() { @@ -45,10 +37,6 @@ void MouseHandler::release() { SDL_WM_GrabInput(SDL_GRAB_OFF); SDL_ShowCursor(1); #endif - -#ifdef PLATFORM_GLFW - glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_NORMAL); -#endif } void MouseHandler::poll() { diff --git a/src/client/Options.cpp b/src/client/Options.cpp index dde5f1f..67a00a8 100755 --- a/src/client/Options.cpp +++ b/src/client/Options.cpp @@ -54,7 +54,7 @@ void Options::initDefaultValues() { keyJump = KeyMapping("key.jump", Keyboard::KEY_SPACE); keyBuild = KeyMapping("key.inventory", Keyboard::KEY_E); keySneak = KeyMapping("key.sneak", Keyboard::KEY_LSHIFT); -#ifdef PLATFORM_DESKTOP +#ifndef RPI keyCraft = KeyMapping("key.crafting", Keyboard::KEY_Q); keyDrop = KeyMapping("key.drop", Keyboard::KEY_Q); keyChat = KeyMapping("key.chat", Keyboard::KEY_T); diff --git a/src/client/gui/Gui.cpp b/src/client/gui/Gui.cpp index c87da8c..ef8bf95 100755 --- a/src/client/gui/Gui.cpp +++ b/src/client/gui/Gui.cpp @@ -112,10 +112,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) { unsigned int max = 10; bool isChatting = false; renderChatMessages(screenHeight, max, isChatting, font); -#ifndef PLATFORM_DESKTOP +#if !defined(RPI) renderOnSelectItemNameText(screenWidth, font, ySlot); #endif -#ifdef PLATFORM_DESKTOP +#if defined(RPI) renderDebugInfo(); #endif @@ -614,27 +614,27 @@ void Gui::renderBubbles() { } } -static OffsetPosTranslator posTranslator; -void Gui::onLevelGenerated() { - if (Level* level = minecraft->level) { - Pos p = level->getSharedSpawnPos(); - posTranslator = OffsetPosTranslator((float)-p.x, (float)-p.y, (float)-p.z); - } -} +static OffsetPosTranslator posTranslator; +void Gui::onLevelGenerated() { + if (Level* level = minecraft->level) { + Pos p = level->getSharedSpawnPos(); + posTranslator = OffsetPosTranslator((float)-p.x, (float)-p.y, (float)-p.z); + } +} void Gui::renderDebugInfo() { - static char buf[256]; - float xx = minecraft->player->x; - float yy = minecraft->player->y - minecraft->player->heightOffset; - float zz = minecraft->player->z; - posTranslator.to(xx, yy, zz); - sprintf(buf, "pos: %3.1f, %3.1f, %3.1f\n", xx, yy, zz); - Tesselator& t = Tesselator::instance; - t.beginOverride(); - t.scale2d(InvGuiScale, InvGuiScale); - minecraft->font->draw(buf, 2, 2, 0xffffff); - t.resetScale(); - t.endOverrideAndDraw(); + static char buf[256]; + float xx = minecraft->player->x; + float yy = minecraft->player->y - minecraft->player->heightOffset; + float zz = minecraft->player->z; + posTranslator.to(xx, yy, zz); + sprintf(buf, "pos: %3.1f, %3.1f, %3.1f\n", xx, yy, zz); + Tesselator& t = Tesselator::instance; + t.beginOverride(); + t.scale2d(InvGuiScale, InvGuiScale); + minecraft->font->draw(buf, 2, 2, 0xffffff); + t.resetScale(); + t.endOverrideAndDraw(); } void Gui::renderSleepAnimation( const int screenWidth, const int screenHeight ) { diff --git a/src/client/gui/screens/SelectWorldScreen.cpp b/src/client/gui/screens/SelectWorldScreen.cpp index 2f7d09f..dd3ebbb 100755 --- a/src/client/gui/screens/SelectWorldScreen.cpp +++ b/src/client/gui/screens/SelectWorldScreen.cpp @@ -295,7 +295,7 @@ static char ILLEGAL_FILE_CHARACTERS[] = { void SelectWorldScreen::tick() { if (_state == _STATE_CREATEWORLD) { - #if defined(PLATFORM_DESKTOP) + #if defined(RPI) std::string levelId = getUniqueLevelName("world"); LevelSettings settings(getEpochTimeS(), GameType::Creative); minecraft->selectLevel(levelId, levelId, settings); diff --git a/src/client/gui/screens/touch/TouchSelectWorldScreen.cpp b/src/client/gui/screens/touch/TouchSelectWorldScreen.cpp index 83b79d0..bc0d977 100755 --- a/src/client/gui/screens/touch/TouchSelectWorldScreen.cpp +++ b/src/client/gui/screens/touch/TouchSelectWorldScreen.cpp @@ -393,7 +393,7 @@ static char ILLEGAL_FILE_CHARACTERS[] = { void SelectWorldScreen::tick() { if (_state == _STATE_CREATEWORLD) { - #ifdef PLATFORM_DESKTOP + #if defined(RPI) std::string levelId = getUniqueLevelName("perf"); //int seed = Util::hashCode("/r/Minecraft"); LevelSettings settings(getEpochTimeS(), GameType::Creative); diff --git a/src/client/player/input/KeyboardInput.cpp b/src/client/player/input/KeyboardInput.cpp index 916bab2..597884a 100755 --- a/src/client/player/input/KeyboardInput.cpp +++ b/src/client/player/input/KeyboardInput.cpp @@ -52,7 +52,7 @@ void KeyboardInput::tick( Player* player ) ya *= 0.3f; } - #ifdef PLATFORM_DESKTOP + #ifdef RPI wantUp = jumping; wantDown = sneaking; #endif diff --git a/src/client/renderer/Textures.cpp b/src/client/renderer/Textures.cpp index 50c6502..6be65b9 100755 --- a/src/client/renderer/Textures.cpp +++ b/src/client/renderer/Textures.cpp @@ -8,7 +8,7 @@ /*static*/ int Textures::textureChanges = 0; /*static*/ bool Textures::MIPMAP = false; -const TextureId Textures::InvalidId = -1; +/*static*/ const TextureId Textures::InvalidId = -1; Textures::Textures( Options* options_, AppPlatform* platform_ ) : clamp(false), diff --git a/src/client/renderer/culling/tmp/FrustumData.h b/src/client/renderer/culling/tmp/FrustumData.h index aa9befd..942b74c 100755 --- a/src/client/renderer/culling/tmp/FrustumData.h +++ b/src/client/renderer/culling/tmp/FrustumData.h @@ -23,18 +23,18 @@ /*public*/ static const int C = 2; // The Z value of the plane's normal /*public*/ static const int D = 3; // The distance the plane is from the origin - /*public*/ float** m_Frustum; // = /*new*/ float[16][16]; - /*public*/ float* proj; // = /*new*/ float[16]; - /*public*/ float* modl; // = /*new*/ float[16]; - /*public*/ float* clip; // = /*new*/ float[16]; + /*public*/ float[][] m_Frustum = /*new*/ float[16][16]; + /*public*/ float[] proj = /*new*/ float[16]; + /*public*/ float[] modl = /*new*/ float[16]; + /*public*/ float[] clip = /*new*/ float[16]; /* - /*public*/ FrustumData(float** mFrustum, float* proj, float* modl, float* clip) + /*public*/ FrustumData(float[][] mFrustum, float[] proj, float[] modl, float[] clip) { m_Frustum = mFrustum; this->proj = proj; this->modl = modl; this->clip = clip; - } + }*/ /*public*/ bool pointInFrustum(float x, float y, float z) { for (int i = 0; i < 6; i++) diff --git a/src/client/renderer/gles.h b/src/client/renderer/gles.h index 2c0c850..993b2c6 100755 --- a/src/client/renderer/gles.h +++ b/src/client/renderer/gles.h @@ -5,7 +5,7 @@ #include "../Options.h" // Android should always run OPENGL_ES -#if defined(ANDROID) || defined(__APPLE__) || defined(PLATFORM_DESKTOP) +#if defined(ANDROID) || defined(__APPLE__) || defined(RPI) #define OPENGL_ES #endif @@ -17,9 +17,7 @@ #import #import #else - // #include - #include - + #include #if defined(ANDROID) #include #endif @@ -30,13 +28,14 @@ #include #include #endif - // #include - // #include + #include + #include #define glFogx(a,b) glFogi(a,b) #define glOrthof(a,b,c,d,e,f) glOrtho(a,b,c,d,e,f) #endif + #define GLERRDEBUG 1 #if GLERRDEBUG //#define GLERR(x) if((x) != 0) { LOGI("GLError: " #x "(%d)\n", __LINE__) } diff --git a/src/raknet/PacketLogger.cpp b/src/raknet/PacketLogger.cpp index 35e8c68..d7e2ac5 100755 --- a/src/raknet/PacketLogger.cpp +++ b/src/raknet/PacketLogger.cpp @@ -85,7 +85,7 @@ unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPac sprintf(str3,"%5u",reliableMessageNumber); } - sprintf(into, "%s,%s%s,%s,%s,%5u,%s,%u,%llu,%s,%s,%i,%i,%i,%i,%s," + sprintf(into, "%s,%s%s,%s,%s,%5u,%s,%u,%"PRINTF_64_BIT_MODIFIER"u,%s,%s,%i,%i,%i,%i,%s," , localtime , prefix , dir @@ -144,7 +144,7 @@ void PacketLogger::OnAck(unsigned int messageNumber, SystemAddress remoteSystemA char localtime[128]; GetLocalTime(localtime); - sprintf(str, "%s,Rcv,Ack,%i,,,,%llu,%s,%s,,,,,," + sprintf(str, "%s,Rcv,Ack,%i,,,,%"PRINTF_64_BIT_MODIFIER"u,%s,%s,,,,,," , localtime , messageNumber , (unsigned long long) time @@ -164,7 +164,7 @@ void PacketLogger::OnPushBackPacket(const char *data, const BitSize_t bitsUsed, char localtime[128]; GetLocalTime(localtime); - sprintf(str, "%s,Lcl,PBP,,,%s,%i,%llu,%s,%s,,,,,," + sprintf(str, "%s,Lcl,PBP,,,%s,%i,%"PRINTF_64_BIT_MODIFIER"u,%s,%s,,,,,," , localtime , BaseIDTOString(data[0]) , bitsUsed @@ -226,7 +226,7 @@ void PacketLogger::WriteMiscellaneous(const char *type, const char *msg) char localtime[128]; GetLocalTime(localtime); - sprintf(str, "%s,Lcl,%s,,,,,%llu,%s,,,,,,,%s" + sprintf(str, "%s,Lcl,%s,,,,,%"PRINTF_64_BIT_MODIFIER"u,%s,,,,,,,%s" , localtime , type , (unsigned long long) time diff --git a/src/raknet/RakNetStatistics.cpp b/src/raknet/RakNetStatistics.cpp index eba7885..5016641 100755 --- a/src/raknet/RakNetStatistics.cpp +++ b/src/raknet/RakNetStatistics.cpp @@ -25,8 +25,8 @@ void RAK_DLL_EXPORT RakNet::StatisticsToString( RakNetStatistics *s, char *buffe if (verbosityLevel==0) { sprintf(buffer, - "Bytes per second sent %llu\n" - "Bytes per second received %llu\n" + "Bytes per second sent %"PRINTF_64_BIT_MODIFIER"u\n" + "Bytes per second received %"PRINTF_64_BIT_MODIFIER"u\n" "Current packetloss %.1f%%\n", (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT], (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED], @@ -36,15 +36,15 @@ void RAK_DLL_EXPORT RakNet::StatisticsToString( RakNetStatistics *s, char *buffe else if (verbosityLevel==1) { sprintf(buffer, - "Actual bytes per second sent %llu\n" - "Actual bytes per second received %llu\n" - "Message bytes per second pushed %llu\n" - "Total actual bytes sent %llu\n" - "Total actual bytes received %llu\n" - "Total message bytes pushed %llu\n" + "Actual bytes per second sent %"PRINTF_64_BIT_MODIFIER"u\n" + "Actual bytes per second received %"PRINTF_64_BIT_MODIFIER"u\n" + "Message bytes per second pushed %"PRINTF_64_BIT_MODIFIER"u\n" + "Total actual bytes sent %"PRINTF_64_BIT_MODIFIER"u\n" + "Total actual bytes received %"PRINTF_64_BIT_MODIFIER"u\n" + "Total message bytes pushed %"PRINTF_64_BIT_MODIFIER"u\n" "Current packetloss %.1f%%\n" "Average packetloss %.1f%%\n" - "Elapsed connection time in seconds %llu\n", + "Elapsed connection time in seconds %"PRINTF_64_BIT_MODIFIER"u\n", (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT], (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED], (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_PUSHED], @@ -60,7 +60,7 @@ void RAK_DLL_EXPORT RakNet::StatisticsToString( RakNetStatistics *s, char *buffe { char buff2[128]; sprintf(buff2, - "Send capacity %llu bytes per second (%.0f%%)\n", + "Send capacity %"PRINTF_64_BIT_MODIFIER"u bytes per second (%.0f%%)\n", (long long unsigned int) s->BPSLimitByCongestionControl, 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByCongestionControl ); @@ -70,7 +70,7 @@ void RAK_DLL_EXPORT RakNet::StatisticsToString( RakNetStatistics *s, char *buffe { char buff2[128]; sprintf(buff2, - "Send limit %llu (%.0f%%)\n", + "Send limit %"PRINTF_64_BIT_MODIFIER"u (%.0f%%)\n", (long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit, 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByOutgoingBandwidthLimit ); @@ -80,27 +80,27 @@ void RAK_DLL_EXPORT RakNet::StatisticsToString( RakNetStatistics *s, char *buffe else { sprintf(buffer, - "Actual bytes per second sent %llu\n" - "Actual bytes per second received %llu\n" - "Message bytes per second sent %llu\n" - "Message bytes per second resent %llu\n" - "Message bytes per second pushed %llu\n" - "Message bytes per second processed %llu\n" - "Message bytes per second ignored %llu\n" - "Total bytes sent %llu\n" - "Total bytes received %llu\n" - "Total message bytes sent %llu\n" - "Total message bytes resent %llu\n" - "Total message bytes pushed %llu\n" - "Total message bytes received %llu\n" - "Total message bytes ignored %llu\n" + "Actual bytes per second sent %"PRINTF_64_BIT_MODIFIER"u\n" + "Actual bytes per second received %"PRINTF_64_BIT_MODIFIER"u\n" + "Message bytes per second sent %"PRINTF_64_BIT_MODIFIER"u\n" + "Message bytes per second resent %"PRINTF_64_BIT_MODIFIER"u\n" + "Message bytes per second pushed %"PRINTF_64_BIT_MODIFIER"u\n" + "Message bytes per second processed %"PRINTF_64_BIT_MODIFIER"u\n" + "Message bytes per second ignored %"PRINTF_64_BIT_MODIFIER"u\n" + "Total bytes sent %"PRINTF_64_BIT_MODIFIER"u\n" + "Total bytes received %"PRINTF_64_BIT_MODIFIER"u\n" + "Total message bytes sent %"PRINTF_64_BIT_MODIFIER"u\n" + "Total message bytes resent %"PRINTF_64_BIT_MODIFIER"u\n" + "Total message bytes pushed %"PRINTF_64_BIT_MODIFIER"u\n" + "Total message bytes received %"PRINTF_64_BIT_MODIFIER"u\n" + "Total message bytes ignored %"PRINTF_64_BIT_MODIFIER"u\n" "Messages in send buffer, by priority %i,%i,%i,%i\n" "Bytes in send buffer, by priority %i,%i,%i,%i\n" "Messages in resend buffer %i\n" - "Bytes in resend buffer %llu\n" + "Bytes in resend buffer %"PRINTF_64_BIT_MODIFIER"u\n" "Current packetloss %.1f%%\n" "Average packetloss %.1f%%\n" - "Elapsed connection time in seconds %llu\n", + "Elapsed connection time in seconds %"PRINTF_64_BIT_MODIFIER"u\n", (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT], (long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED], (long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_SENT], @@ -128,7 +128,7 @@ void RAK_DLL_EXPORT RakNet::StatisticsToString( RakNetStatistics *s, char *buffe { char buff2[128]; sprintf(buff2, - "Send capacity %llu bytes per second (%.0f%%)\n", + "Send capacity %"PRINTF_64_BIT_MODIFIER"u bytes per second (%.0f%%)\n", (long long unsigned int) s->BPSLimitByCongestionControl, 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByCongestionControl ); @@ -138,7 +138,7 @@ void RAK_DLL_EXPORT RakNet::StatisticsToString( RakNetStatistics *s, char *buffe { char buff2[128]; sprintf(buff2, - "Send limit %llu (%.0f%%)\n", + "Send limit %"PRINTF_64_BIT_MODIFIER"u (%.0f%%)\n", (long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit, 100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByOutgoingBandwidthLimit ); diff --git a/src/raknet/RakPeer.cpp b/src/raknet/RakPeer.cpp index e00660a..698374e 100755 --- a/src/raknet/RakPeer.cpp +++ b/src/raknet/RakPeer.cpp @@ -124,7 +124,7 @@ static const unsigned int MAX_OFFLINE_DATA_LENGTH=400; // I set this because I l #pragma warning(disable:4309) // 'initializing' : truncation of constant value #endif // Make sure highest bit is 0, so isValid in DatagramHeaderFormat is false -static const char OFFLINE_MESSAGE_DATA_ID[16]={0x00,(char)0xFF,(char)0xFF,0x00,(char)0xFE,(char)0xFE,(char)0xFE,(char)0xFE,(char)0xFD,(char)0xFD,(char)0xFD, (char)0xFD,0x12,0x34,0x56,0x78}; +static const char OFFLINE_MESSAGE_DATA_ID[16]={0x00,0xFF,0xFF,0x00,0xFE,0xFE,0xFE,0xFE,0xFD,0xFD,0xFD,0xFD,0x12,0x34,0x56,0x78}; struct PacketFollowedByData { diff --git a/src/raknet/ReliabilityLayer.cpp b/src/raknet/ReliabilityLayer.cpp index 3ac9cfa..fdb7b6f 100755 --- a/src/raknet/ReliabilityLayer.cpp +++ b/src/raknet/ReliabilityLayer.cpp @@ -1361,7 +1361,7 @@ bool ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer( #ifdef PRINT_TO_FILE_ROT if (fp) { - fprintf(fp, "Heap push %i, %s, weight=%llu. OI=%i. waiting on %i. SI=%i.\n", receivedPacketNumber, type, weight, internalPacket->orderingIndex.val, orderedReadIndex[internalPacket->orderingChannel].val, internalPacket->sequencingIndex); + fprintf(fp, "Heap push %i, %s, weight=%"PRINTF_64_BIT_MODIFIER"u. OI=%i. waiting on %i. SI=%i.\n", receivedPacketNumber, type, weight, internalPacket->orderingIndex.val, orderedReadIndex[internalPacket->orderingChannel].val, internalPacket->sequencingIndex); fflush(fp); } #endif diff --git a/src/raknet/SocketLayer.cpp b/src/raknet/SocketLayer.cpp index ae11076..92188f4 100755 --- a/src/raknet/SocketLayer.cpp +++ b/src/raknet/SocketLayer.cpp @@ -1248,7 +1248,7 @@ int SocketLayer::SendTo_PC( SOCKET s, const char *data, int length, const System #ifdef DEBUG_SENDTO_SPIKES RakNetTime end = RakNet::GetTime(); static unsigned int callCount=1; - RAKNET_DEBUG_PRINTF("%i. SendTo_PC, time=%llu, elapsed=%llu, length=%i, returned=%i, binaryAddress=%i, port=%i, file=%s, line=%i\n", callCount++, end, end-start, length, len, binaryAddress, port, file, line); + RAKNET_DEBUG_PRINTF("%i. SendTo_PC, time=%"PRINTF_64_BIT_MODIFIER"u, elapsed=%"PRINTF_64_BIT_MODIFIER"u, length=%i, returned=%i, binaryAddress=%i, port=%i, file=%s, line=%i\n", callCount++, end, end-start, length, len, binaryAddress, port, file, line); #endif if (len<0) {