revert all code back except platform
This commit is contained in:
@@ -5,7 +5,7 @@ include(cmake/CPM.cmake)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
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("gh:madler/zlib@1.3.2")
|
||||||
CPMAddPackage(
|
CPMAddPackage(
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#define NO_NETWORK
|
#define NO_NETWORK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_DESKTOP
|
#if defined(RPI)
|
||||||
#define CREATORMODE
|
#define CREATORMODE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ void Minecraft::tick(int nTick, int maxTick) {
|
|||||||
#ifndef STANDALONE_SERVER
|
#ifndef STANDALONE_SERVER
|
||||||
textures->loadAndBindTexture("terrain.png");
|
textures->loadAndBindTexture("terrain.png");
|
||||||
if (!pause && !(screen && !screen->renderGameBehind())) {
|
if (!pause && !(screen && !screen->renderGameBehind())) {
|
||||||
#ifndef PLATFORM_DESKTOP
|
#if !defined(RPI)
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if (isSuperFast())
|
if (isSuperFast())
|
||||||
#endif
|
#endif
|
||||||
@@ -691,7 +691,7 @@ void Minecraft::tickInput() {
|
|||||||
if (isPressed) {
|
if (isPressed) {
|
||||||
gui.handleKeyPressed(key);
|
gui.handleKeyPressed(key);
|
||||||
|
|
||||||
#ifdef PLATFORM_DESKTOP //|| defined(_DEBUG) || defined(DEBUG)
|
#if defined(WIN32) || defined(RPI)//|| defined(_DEBUG) || defined(DEBUG)
|
||||||
if (key >= '0' && key <= '9') {
|
if (key >= '0' && key <= '9') {
|
||||||
int digit = key - '0';
|
int digit = key - '0';
|
||||||
int slot = digit - 1;
|
int slot = digit - 1;
|
||||||
@@ -714,14 +714,16 @@ void Minecraft::tickInput() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(RPI)
|
||||||
if (key == Keyboard::KEY_E) {
|
if (key == Keyboard::KEY_E) {
|
||||||
screenChooser.setScreen(SCREEN_BLOCKSELECTION);
|
screenChooser.setScreen(SCREEN_BLOCKSELECTION);
|
||||||
}
|
}
|
||||||
if (!screen && key == Keyboard::KEY_O || key == 250) {
|
if (!screen && key == Keyboard::KEY_O || key == 250) {
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(WIN32)
|
||||||
if (key == Keyboard::KEY_F) {
|
if (key == Keyboard::KEY_F) {
|
||||||
options.isFlying = !options.isFlying;
|
options.isFlying = !options.isFlying;
|
||||||
player->noPhysics = options.isFlying;
|
player->noPhysics = options.isFlying;
|
||||||
@@ -829,7 +831,7 @@ void Minecraft::tickInput() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PLATFORM_DESKTOP
|
#ifndef RPI
|
||||||
if (key == 82)
|
if (key == 82)
|
||||||
pauseGame(false);
|
pauseGame(false);
|
||||||
#else
|
#else
|
||||||
@@ -846,7 +848,7 @@ void Minecraft::tickInput() {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef PLATFORM_DESKTOP
|
#ifdef WIN32
|
||||||
if (key == Keyboard::KEY_M) {
|
if (key == Keyboard::KEY_M) {
|
||||||
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
for (int i = 0; i < 5 * SharedConstants::TicksPerSecond; ++i)
|
||||||
level->tick();
|
level->tick();
|
||||||
@@ -890,7 +892,7 @@ void Minecraft::tickInput() {
|
|||||||
|| (buildHandled && bai.isRemove());
|
|| (buildHandled && bai.isRemove());
|
||||||
|
|
||||||
TIMER_POP_PUSH("handlemouse");
|
TIMER_POP_PUSH("handlemouse");
|
||||||
#ifdef PLATFORM_DESKTOP
|
#ifdef RPI
|
||||||
handleMouseDown(MouseAction::ACTION_LEFT, isTryingToDestroyBlock);
|
handleMouseDown(MouseAction::ACTION_LEFT, isTryingToDestroyBlock);
|
||||||
handleMouseClick(buildHandled && bai.isInteract()
|
handleMouseClick(buildHandled && bai.isInteract()
|
||||||
|| options.useMouseForDigging && Mouse::isButtonDown(MouseAction::ACTION_RIGHT));
|
|| options.useMouseForDigging && Mouse::isButtonDown(MouseAction::ACTION_RIGHT));
|
||||||
@@ -1121,7 +1123,7 @@ void Minecraft::releaseMouse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Minecraft::useTouchscreen() {
|
bool Minecraft::useTouchscreen() {
|
||||||
#ifdef PLATFORM_DESKTOP
|
#ifdef RPI
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
return options.useTouchScreen || !_supportsNonTouchscreen;
|
return options.useTouchScreen || !_supportsNonTouchscreen;
|
||||||
@@ -1311,7 +1313,10 @@ void Minecraft::hostMultiplayer(int port) {
|
|||||||
//
|
//
|
||||||
// Level generation
|
// Level generation
|
||||||
//
|
//
|
||||||
/*static*/ void* Minecraft::prepareLevel_tspawn(void *p_param) {
|
/*static*/
|
||||||
|
|
||||||
|
void* Minecraft::prepareLevel_tspawn(void *p_param)
|
||||||
|
{
|
||||||
Minecraft* mc = (Minecraft*) p_param;
|
Minecraft* mc = (Minecraft*) p_param;
|
||||||
mc->generateLevel("Currently not used", mc->level);
|
mc->generateLevel("Currently not used", mc->level);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1364,7 +1369,7 @@ void Minecraft::_levelGenerated()
|
|||||||
netCallback->levelGenerated(level);
|
netCallback->levelGenerated(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_DESKTOP
|
#if defined(WIN32) || defined(RPI)
|
||||||
if (_commandServer) {
|
if (_commandServer) {
|
||||||
delete _commandServer;
|
delete _commandServer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,6 @@
|
|||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_GLFW
|
|
||||||
#include <GLFW/glfw3.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MouseHandler::MouseHandler( ITurnInput* turnInput )
|
MouseHandler::MouseHandler( ITurnInput* turnInput )
|
||||||
: _turnInput(turnInput)
|
: _turnInput(turnInput)
|
||||||
{}
|
{}
|
||||||
@@ -33,10 +29,6 @@ void MouseHandler::grab() {
|
|||||||
SDL_WM_GrabInput(SDL_GRAB_ON);
|
SDL_WM_GrabInput(SDL_GRAB_ON);
|
||||||
SDL_ShowCursor(0);
|
SDL_ShowCursor(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_GLFW
|
|
||||||
glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseHandler::release() {
|
void MouseHandler::release() {
|
||||||
@@ -45,10 +37,6 @@ void MouseHandler::release() {
|
|||||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||||
SDL_ShowCursor(1);
|
SDL_ShowCursor(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLATFORM_GLFW
|
|
||||||
glfwSetInputMode(glfwGetCurrentContext(), GLFW_CURSOR, GLFW_CURSOR_NORMAL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseHandler::poll() {
|
void MouseHandler::poll() {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ void Options::initDefaultValues() {
|
|||||||
keyJump = KeyMapping("key.jump", Keyboard::KEY_SPACE);
|
keyJump = KeyMapping("key.jump", Keyboard::KEY_SPACE);
|
||||||
keyBuild = KeyMapping("key.inventory", Keyboard::KEY_E);
|
keyBuild = KeyMapping("key.inventory", Keyboard::KEY_E);
|
||||||
keySneak = KeyMapping("key.sneak", Keyboard::KEY_LSHIFT);
|
keySneak = KeyMapping("key.sneak", Keyboard::KEY_LSHIFT);
|
||||||
#ifdef PLATFORM_DESKTOP
|
#ifndef RPI
|
||||||
keyCraft = KeyMapping("key.crafting", Keyboard::KEY_Q);
|
keyCraft = KeyMapping("key.crafting", Keyboard::KEY_Q);
|
||||||
keyDrop = KeyMapping("key.drop", Keyboard::KEY_Q);
|
keyDrop = KeyMapping("key.drop", Keyboard::KEY_Q);
|
||||||
keyChat = KeyMapping("key.chat", Keyboard::KEY_T);
|
keyChat = KeyMapping("key.chat", Keyboard::KEY_T);
|
||||||
|
|||||||
@@ -112,10 +112,10 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse) {
|
|||||||
unsigned int max = 10;
|
unsigned int max = 10;
|
||||||
bool isChatting = false;
|
bool isChatting = false;
|
||||||
renderChatMessages(screenHeight, max, isChatting, font);
|
renderChatMessages(screenHeight, max, isChatting, font);
|
||||||
#ifndef PLATFORM_DESKTOP
|
#if !defined(RPI)
|
||||||
renderOnSelectItemNameText(screenWidth, font, ySlot);
|
renderOnSelectItemNameText(screenWidth, font, ySlot);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PLATFORM_DESKTOP
|
#if defined(RPI)
|
||||||
renderDebugInfo();
|
renderDebugInfo();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -614,27 +614,27 @@ void Gui::renderBubbles() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static OffsetPosTranslator posTranslator;
|
static OffsetPosTranslator posTranslator;
|
||||||
void Gui::onLevelGenerated() {
|
void Gui::onLevelGenerated() {
|
||||||
if (Level* level = minecraft->level) {
|
if (Level* level = minecraft->level) {
|
||||||
Pos p = level->getSharedSpawnPos();
|
Pos p = level->getSharedSpawnPos();
|
||||||
posTranslator = OffsetPosTranslator((float)-p.x, (float)-p.y, (float)-p.z);
|
posTranslator = OffsetPosTranslator((float)-p.x, (float)-p.y, (float)-p.z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::renderDebugInfo() {
|
void Gui::renderDebugInfo() {
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
float xx = minecraft->player->x;
|
float xx = minecraft->player->x;
|
||||||
float yy = minecraft->player->y - minecraft->player->heightOffset;
|
float yy = minecraft->player->y - minecraft->player->heightOffset;
|
||||||
float zz = minecraft->player->z;
|
float zz = minecraft->player->z;
|
||||||
posTranslator.to(xx, yy, zz);
|
posTranslator.to(xx, yy, zz);
|
||||||
sprintf(buf, "pos: %3.1f, %3.1f, %3.1f\n", xx, yy, zz);
|
sprintf(buf, "pos: %3.1f, %3.1f, %3.1f\n", xx, yy, zz);
|
||||||
Tesselator& t = Tesselator::instance;
|
Tesselator& t = Tesselator::instance;
|
||||||
t.beginOverride();
|
t.beginOverride();
|
||||||
t.scale2d(InvGuiScale, InvGuiScale);
|
t.scale2d(InvGuiScale, InvGuiScale);
|
||||||
minecraft->font->draw(buf, 2, 2, 0xffffff);
|
minecraft->font->draw(buf, 2, 2, 0xffffff);
|
||||||
t.resetScale();
|
t.resetScale();
|
||||||
t.endOverrideAndDraw();
|
t.endOverrideAndDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gui::renderSleepAnimation( const int screenWidth, const int screenHeight ) {
|
void Gui::renderSleepAnimation( const int screenWidth, const int screenHeight ) {
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ static char ILLEGAL_FILE_CHARACTERS[] = {
|
|||||||
void SelectWorldScreen::tick()
|
void SelectWorldScreen::tick()
|
||||||
{
|
{
|
||||||
if (_state == _STATE_CREATEWORLD) {
|
if (_state == _STATE_CREATEWORLD) {
|
||||||
#if defined(PLATFORM_DESKTOP)
|
#if defined(RPI)
|
||||||
std::string levelId = getUniqueLevelName("world");
|
std::string levelId = getUniqueLevelName("world");
|
||||||
LevelSettings settings(getEpochTimeS(), GameType::Creative);
|
LevelSettings settings(getEpochTimeS(), GameType::Creative);
|
||||||
minecraft->selectLevel(levelId, levelId, settings);
|
minecraft->selectLevel(levelId, levelId, settings);
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ static char ILLEGAL_FILE_CHARACTERS[] = {
|
|||||||
void SelectWorldScreen::tick()
|
void SelectWorldScreen::tick()
|
||||||
{
|
{
|
||||||
if (_state == _STATE_CREATEWORLD) {
|
if (_state == _STATE_CREATEWORLD) {
|
||||||
#ifdef PLATFORM_DESKTOP
|
#if defined(RPI)
|
||||||
std::string levelId = getUniqueLevelName("perf");
|
std::string levelId = getUniqueLevelName("perf");
|
||||||
//int seed = Util::hashCode("/r/Minecraft");
|
//int seed = Util::hashCode("/r/Minecraft");
|
||||||
LevelSettings settings(getEpochTimeS(), GameType::Creative);
|
LevelSettings settings(getEpochTimeS(), GameType::Creative);
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void KeyboardInput::tick( Player* player )
|
|||||||
ya *= 0.3f;
|
ya *= 0.3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLATFORM_DESKTOP
|
#ifdef RPI
|
||||||
wantUp = jumping;
|
wantUp = jumping;
|
||||||
wantDown = sneaking;
|
wantDown = sneaking;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
/*static*/ int Textures::textureChanges = 0;
|
/*static*/ int Textures::textureChanges = 0;
|
||||||
/*static*/ bool Textures::MIPMAP = false;
|
/*static*/ bool Textures::MIPMAP = false;
|
||||||
const TextureId Textures::InvalidId = -1;
|
/*static*/ const TextureId Textures::InvalidId = -1;
|
||||||
|
|
||||||
Textures::Textures( Options* options_, AppPlatform* platform_ )
|
Textures::Textures( Options* options_, AppPlatform* platform_ )
|
||||||
: clamp(false),
|
: clamp(false),
|
||||||
|
|||||||
@@ -23,18 +23,18 @@
|
|||||||
/*public*/ static const int C = 2; // The Z value of the plane's normal
|
/*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*/ static const int D = 3; // The distance the plane is from the origin
|
||||||
|
|
||||||
/*public*/ float** m_Frustum; // = /*new*/ float[16][16];
|
/*public*/ float[][] m_Frustum = /*new*/ float[16][16];
|
||||||
/*public*/ float* proj; // = /*new*/ float[16];
|
/*public*/ float[] proj = /*new*/ float[16];
|
||||||
/*public*/ float* modl; // = /*new*/ float[16];
|
/*public*/ float[] modl = /*new*/ float[16];
|
||||||
/*public*/ float* clip; // = /*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;
|
m_Frustum = mFrustum;
|
||||||
this->proj = proj;
|
this->proj = proj;
|
||||||
this->modl = modl;
|
this->modl = modl;
|
||||||
this->clip = clip;
|
this->clip = clip;
|
||||||
}
|
}*/
|
||||||
/*public*/ bool pointInFrustum(float x, float y, float z)
|
/*public*/ bool pointInFrustum(float x, float y, float z)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include "../Options.h"
|
#include "../Options.h"
|
||||||
|
|
||||||
// Android should always run OPENGL_ES
|
// Android should always run OPENGL_ES
|
||||||
#if defined(ANDROID) || defined(__APPLE__) || defined(PLATFORM_DESKTOP)
|
#if defined(ANDROID) || defined(__APPLE__) || defined(RPI)
|
||||||
#define OPENGL_ES
|
#define OPENGL_ES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -17,9 +17,7 @@
|
|||||||
#import <OpenGLES/ES1/gl.height>
|
#import <OpenGLES/ES1/gl.height>
|
||||||
#import <OpenGLES/ES1/glext.height>
|
#import <OpenGLES/ES1/glext.height>
|
||||||
#else
|
#else
|
||||||
// #include <GLES/gl.h>
|
#include <glad/glad.h>
|
||||||
#include <glad/glad.h>
|
|
||||||
|
|
||||||
#if defined(ANDROID)
|
#if defined(ANDROID)
|
||||||
#include<GLES/glext.h>
|
#include<GLES/glext.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -30,13 +28,14 @@
|
|||||||
#include <WinSock2.h>
|
#include <WinSock2.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#endif
|
||||||
// #include <gl/glew.h>
|
#include <gl/glew.h>
|
||||||
// #include <gl/GL.h>
|
#include <gl/GL.h>
|
||||||
|
|
||||||
#define glFogx(a,b) glFogi(a,b)
|
#define glFogx(a,b) glFogi(a,b)
|
||||||
#define glOrthof(a,b,c,d,e,f) glOrtho(a,b,c,d,e,f)
|
#define glOrthof(a,b,c,d,e,f) glOrtho(a,b,c,d,e,f)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define GLERRDEBUG 1
|
#define GLERRDEBUG 1
|
||||||
#if GLERRDEBUG
|
#if GLERRDEBUG
|
||||||
//#define GLERR(x) if((x) != 0) { LOGI("GLError: " #x "(%d)\n", __LINE__) }
|
//#define GLERR(x) if((x) != 0) { LOGI("GLError: " #x "(%d)\n", __LINE__) }
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ unsigned int splitPacketId, unsigned int splitPacketIndex, unsigned int splitPac
|
|||||||
sprintf(str3,"%5u",reliableMessageNumber);
|
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
|
, localtime
|
||||||
, prefix
|
, prefix
|
||||||
, dir
|
, dir
|
||||||
@@ -144,7 +144,7 @@ void PacketLogger::OnAck(unsigned int messageNumber, SystemAddress remoteSystemA
|
|||||||
char localtime[128];
|
char localtime[128];
|
||||||
GetLocalTime(localtime);
|
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
|
, localtime
|
||||||
, messageNumber
|
, messageNumber
|
||||||
, (unsigned long long) time
|
, (unsigned long long) time
|
||||||
@@ -164,7 +164,7 @@ void PacketLogger::OnPushBackPacket(const char *data, const BitSize_t bitsUsed,
|
|||||||
char localtime[128];
|
char localtime[128];
|
||||||
GetLocalTime(localtime);
|
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
|
, localtime
|
||||||
, BaseIDTOString(data[0])
|
, BaseIDTOString(data[0])
|
||||||
, bitsUsed
|
, bitsUsed
|
||||||
@@ -226,7 +226,7 @@ void PacketLogger::WriteMiscellaneous(const char *type, const char *msg)
|
|||||||
char localtime[128];
|
char localtime[128];
|
||||||
GetLocalTime(localtime);
|
GetLocalTime(localtime);
|
||||||
|
|
||||||
sprintf(str, "%s,Lcl,%s,,,,,%llu,%s,,,,,,,%s"
|
sprintf(str, "%s,Lcl,%s,,,,,%"PRINTF_64_BIT_MODIFIER"u,%s,,,,,,,%s"
|
||||||
, localtime
|
, localtime
|
||||||
, type
|
, type
|
||||||
, (unsigned long long) time
|
, (unsigned long long) time
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ void RAK_DLL_EXPORT RakNet::StatisticsToString( RakNetStatistics *s, char *buffe
|
|||||||
if (verbosityLevel==0)
|
if (verbosityLevel==0)
|
||||||
{
|
{
|
||||||
sprintf(buffer,
|
sprintf(buffer,
|
||||||
"Bytes per second sent %llu\n"
|
"Bytes per second sent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Bytes per second received %llu\n"
|
"Bytes per second received %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Current packetloss %.1f%%\n",
|
"Current packetloss %.1f%%\n",
|
||||||
(long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT],
|
(long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_SENT],
|
||||||
(long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
|
(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)
|
else if (verbosityLevel==1)
|
||||||
{
|
{
|
||||||
sprintf(buffer,
|
sprintf(buffer,
|
||||||
"Actual bytes per second sent %llu\n"
|
"Actual bytes per second sent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Actual bytes per second received %llu\n"
|
"Actual bytes per second received %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Message bytes per second pushed %llu\n"
|
"Message bytes per second pushed %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total actual bytes sent %llu\n"
|
"Total actual bytes sent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total actual bytes received %llu\n"
|
"Total actual bytes received %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total message bytes pushed %llu\n"
|
"Total message bytes pushed %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Current packetloss %.1f%%\n"
|
"Current packetloss %.1f%%\n"
|
||||||
"Average 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_SENT],
|
||||||
(long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
|
(long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
|
||||||
(long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_PUSHED],
|
(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];
|
char buff2[128];
|
||||||
sprintf(buff2,
|
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,
|
(long long unsigned int) s->BPSLimitByCongestionControl,
|
||||||
100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / 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];
|
char buff2[128];
|
||||||
sprintf(buff2,
|
sprintf(buff2,
|
||||||
"Send limit %llu (%.0f%%)\n",
|
"Send limit %"PRINTF_64_BIT_MODIFIER"u (%.0f%%)\n",
|
||||||
(long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit,
|
(long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit,
|
||||||
100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / 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
|
else
|
||||||
{
|
{
|
||||||
sprintf(buffer,
|
sprintf(buffer,
|
||||||
"Actual bytes per second sent %llu\n"
|
"Actual bytes per second sent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Actual bytes per second received %llu\n"
|
"Actual bytes per second received %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Message bytes per second sent %llu\n"
|
"Message bytes per second sent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Message bytes per second resent %llu\n"
|
"Message bytes per second resent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Message bytes per second pushed %llu\n"
|
"Message bytes per second pushed %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Message bytes per second processed %llu\n"
|
"Message bytes per second processed %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Message bytes per second ignored %llu\n"
|
"Message bytes per second ignored %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total bytes sent %llu\n"
|
"Total bytes sent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total bytes received %llu\n"
|
"Total bytes received %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total message bytes sent %llu\n"
|
"Total message bytes sent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total message bytes resent %llu\n"
|
"Total message bytes resent %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total message bytes pushed %llu\n"
|
"Total message bytes pushed %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total message bytes received %llu\n"
|
"Total message bytes received %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Total message bytes ignored %llu\n"
|
"Total message bytes ignored %"PRINTF_64_BIT_MODIFIER"u\n"
|
||||||
"Messages in send buffer, by priority %i,%i,%i,%i\n"
|
"Messages in send buffer, by priority %i,%i,%i,%i\n"
|
||||||
"Bytes 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"
|
"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"
|
"Current packetloss %.1f%%\n"
|
||||||
"Average 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_SENT],
|
||||||
(long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
|
(long long unsigned int) s->valueOverLastSecond[ACTUAL_BYTES_RECEIVED],
|
||||||
(long long unsigned int) s->valueOverLastSecond[USER_MESSAGE_BYTES_SENT],
|
(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];
|
char buff2[128];
|
||||||
sprintf(buff2,
|
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,
|
(long long unsigned int) s->BPSLimitByCongestionControl,
|
||||||
100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / 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];
|
char buff2[128];
|
||||||
sprintf(buff2,
|
sprintf(buff2,
|
||||||
"Send limit %llu (%.0f%%)\n",
|
"Send limit %"PRINTF_64_BIT_MODIFIER"u (%.0f%%)\n",
|
||||||
(long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit,
|
(long long unsigned int) s->BPSLimitByOutgoingBandwidthLimit,
|
||||||
100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByOutgoingBandwidthLimit
|
100.0f * s->valueOverLastSecond[ACTUAL_BYTES_SENT] / s->BPSLimitByOutgoingBandwidthLimit
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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
|
#pragma warning(disable:4309) // 'initializing' : truncation of constant value
|
||||||
#endif
|
#endif
|
||||||
// Make sure highest bit is 0, so isValid in DatagramHeaderFormat is false
|
// 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
|
struct PacketFollowedByData
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1361,7 +1361,7 @@ bool ReliabilityLayer::HandleSocketReceiveFromConnectedPlayer(
|
|||||||
#ifdef PRINT_TO_FILE_ROT
|
#ifdef PRINT_TO_FILE_ROT
|
||||||
if (fp)
|
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);
|
fflush(fp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1248,7 +1248,7 @@ int SocketLayer::SendTo_PC( SOCKET s, const char *data, int length, const System
|
|||||||
#ifdef DEBUG_SENDTO_SPIKES
|
#ifdef DEBUG_SENDTO_SPIKES
|
||||||
RakNetTime end = RakNet::GetTime();
|
RakNetTime end = RakNet::GetTime();
|
||||||
static unsigned int callCount=1;
|
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
|
#endif
|
||||||
if (len<0)
|
if (len<0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user