revert all code back except platform

This commit is contained in:
2026-03-03 01:22:26 +03:00
parent a86d333478
commit 13010f10fa
16 changed files with 90 additions and 98 deletions

View File

@@ -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(

View File

@@ -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;
}

View File

@@ -5,10 +5,6 @@
#include <SDL/SDL.h>
#endif
#ifdef PLATFORM_GLFW
#include <GLFW/glfw3.h>
#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() {

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -52,7 +52,7 @@ void KeyboardInput::tick( Player* player )
ya *= 0.3f;
}
#ifdef PLATFORM_DESKTOP
#ifdef RPI
wantUp = jumping;
wantDown = sneaking;
#endif

View File

@@ -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),

View File

@@ -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++)

View File

@@ -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 <OpenGLES/ES1/gl.height>
#import <OpenGLES/ES1/glext.height>
#else
// #include <GLES/gl.h>
#include <glad/glad.h>
#if defined(ANDROID)
#include<GLES/glext.h>
#endif
@@ -30,13 +28,14 @@
#include <WinSock2.h>
#include <Windows.h>
#endif
// #include <gl/glew.h>
// #include <gl/GL.h>
#include <gl/glew.h>
#include <gl/GL.h>
#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__) }

View File

@@ -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

View File

@@ -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
);

View File

@@ -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
{

View File

@@ -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

View File

@@ -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)
{