1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Merge remote-tracking branch 'upstream/master' into Visuals-Vol-2

This commit is contained in:
Gefüllte Taubenbrust 2024-12-22 19:08:52 +01:00
commit e7c7441429
285 changed files with 8894 additions and 4654 deletions

View file

@ -4,6 +4,7 @@
#include "client/client.h"
#include "exceptions.h"
#include "irr_v2d.h"
#include "util/base64.h"
#include "client/camera.h"
@ -27,7 +28,7 @@
#include "script/scripting_client.h"
#include "util/serialize.h"
#include "util/srp.h"
#include "util/sha1.h"
#include "util/hashing.h"
#include "tileanimation.h"
#include "gettext.h"
#include "skyparams.h"
@ -62,7 +63,7 @@ void Client::handleCommand_Hello(NetworkPacket* pkt)
if (pkt->getSize() < 1)
return;
u8 serialization_ver;
u8 serialization_ver; // negotiated value
u16 proto_ver;
u16 unused_compression_mode;
u32 auth_mechs;
@ -79,9 +80,9 @@ void Client::handleCommand_Hello(NetworkPacket* pkt)
<< ", proto_ver=" << proto_ver
<< ". Doing auth with mech " << chosen_auth_mechanism << std::endl;
if (!ser_ver_supported(serialization_ver)) {
if (!ser_ver_supported_read(serialization_ver)) {
infostream << "Client: TOCLIENT_HELLO: Server sent "
<< "unsupported ser_fmt_ver"<< std::endl;
<< "unsupported ser_fmt_ver=" << (int)serialization_ver << std::endl;
return;
}
@ -1007,6 +1008,8 @@ void Client::handleCommand_AddParticleSpawner(NetworkPacket* pkt)
p.amount = readU16(is);
p.time = readF32(is);
if (p.time < 0)
throw SerializationError("particle spawner time < 0");
bool missing_end_values = false;
if (m_proto_ver >= 42) {
@ -1642,12 +1645,7 @@ void Client::handleCommand_MediaPush(NetworkPacket *pkt)
if (!filedata.empty()) {
// LEGACY CODEPATH
// Compute and check checksum of data
std::string computed_hash;
{
SHA1 ctx;
ctx.addBytes(filedata);
computed_hash = ctx.getDigest();
}
std::string computed_hash = hashing::sha1(filedata);
if (raw_hash != computed_hash) {
verbosestream << "Hash of file data mismatches, ignoring." << std::endl;
return;

View file

@ -60,9 +60,12 @@
Support float animation frame numbers in TOCLIENT_LOCAL_PLAYER_ANIMATIONS
Add beta_r0, vignette, specular intensity, foliage translucency and cdl parameters to Lighting packets
[scheduled bump for 5.10.0]
PROTOCOL VERSION 47
Add particle blend mode "clip"
[scheduled bump for 5.11.0]
*/
const u16 LATEST_PROTOCOL_VERSION = 46;
const u16 LATEST_PROTOCOL_VERSION = 47;
// See also formspec [Version History] in doc/lua_api.md
const u16 FORMSPEC_API_VERSION = 8;

View file

@ -12,6 +12,7 @@
#include "remoteplayer.h"
#include "rollback_interface.h"
#include "scripting_server.h"
#include "serialization.h"
#include "settings.h"
#include "tool.h"
#include "version.h"
@ -83,34 +84,27 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
if (denyIfBanned(peer_id))
return;
// First byte after command is maximum supported
// serialization version
u8 client_max;
u8 max_ser_ver; // SER_FMT_VER_HIGHEST_READ (of client)
u16 unused;
u16 min_net_proto_version = 0;
u16 min_net_proto_version;
u16 max_net_proto_version;
std::string playerName;
*pkt >> client_max >> unused >> min_net_proto_version
>> max_net_proto_version >> playerName;
*pkt >> max_ser_ver >> unused
>> min_net_proto_version >> max_net_proto_version
>> playerName;
u8 our_max = SER_FMT_VER_HIGHEST_READ;
// Use the highest version supported by both
u8 depl_serial_v = std::min(client_max, our_max);
// If it's lower than the lowest supported, give up.
#if SER_FMT_VER_LOWEST_READ > 0
if (depl_serial_v < SER_FMT_VER_LOWEST_READ)
depl_serial_v = SER_FMT_VER_INVALID;
#endif
const u8 serialization_ver = std::min(max_ser_ver, SER_FMT_VER_HIGHEST_WRITE);
if (depl_serial_v == SER_FMT_VER_INVALID) {
if (!ser_ver_supported_write(serialization_ver)) {
actionstream << "Server: A mismatched client tried to connect from " <<
addr_s << " ser_fmt_max=" << (int)client_max << std::endl;
addr_s << " ser_fmt_max=" << (int)serialization_ver << std::endl;
DenyAccess(peer_id, SERVER_ACCESSDENIED_WRONG_VERSION);
return;
}
client->setPendingSerializationVersion(depl_serial_v);
client->setPendingSerializationVersion(serialization_ver);
/*
Read and check network protocol version
@ -263,8 +257,9 @@ void Server::handleCommand_Init(NetworkPacket* pkt)
NetworkPacket resp_pkt(TOCLIENT_HELLO, 0, peer_id);
resp_pkt << depl_serial_v << u16(0) << net_proto_version
<< auth_mechs << std::string_view();
resp_pkt << serialization_ver << u16(0) /* unused */
<< net_proto_version
<< auth_mechs << std::string_view() /* unused */;
Send(&resp_pkt);