From 6ae301d624cddfdfe338776a6c4b881392a71837 Mon Sep 17 00:00:00 2001 From: Qiuzhizhe <42761326+quizhizhe@users.noreply.github.com> Date: Fri, 30 Sep 2022 14:36:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E5=89=A9mce::Color=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BA=86=EF=BC=8CBDS=E5=86=85=E9=83=A8=E6=B2=A1?= =?UTF-8?q?=E6=9C=89mce?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LiteLoader/Header/MC/RakNet.hpp | 2 +- LiteLoader/Header/MC/VarIntDataInput.hpp | 12 ++++++++---- LiteLoader/Kernel/MC/ColorFormatAPI.cpp | 2 +- LiteLoader/Kernel/MC/NetworkIdentifierAPI.cpp | 2 +- .../Kernel/Network/ReadOnlyBinaryStreamAPI.cpp | 12 ++++-------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/LiteLoader/Header/MC/RakNet.hpp b/LiteLoader/Header/MC/RakNet.hpp index d4fafc1..7348d58 100644 --- a/LiteLoader/Header/MC/RakNet.hpp +++ b/LiteLoader/Header/MC/RakNet.hpp @@ -25,7 +25,7 @@ namespace RakNet { struct SystemAddress { char filler[17 * 8]; // uncertain? - MCAPI void ToString_New(bool, char, char*) const; + MCAPI void ToString_New(bool,char *,char) const; }; struct RakNetGUID { uint64_t unk; diff --git a/LiteLoader/Header/MC/VarIntDataInput.hpp b/LiteLoader/Header/MC/VarIntDataInput.hpp index cda4f99..b37bdcd 100644 --- a/LiteLoader/Header/MC/VarIntDataInput.hpp +++ b/LiteLoader/Header/MC/VarIntDataInput.hpp @@ -4,13 +4,17 @@ #include "../Global.h" #define BEFORE_EXTRA - +#include "MC/ReadOnlyBinaryStream.hpp" #undef BEFORE_EXTRA class VarIntDataInput { #define AFTER_EXTRA - + ReadOnlyBinaryStream *mStream; +public: + VarIntDataInput(ReadOnlyBinaryStream *stream){ + mStream = stream; + }; #undef AFTER_EXTRA #ifndef DISABLE_CONSTRUCTOR_PREVENTION_VARINTDATAINPUT public: @@ -21,8 +25,8 @@ public: public: /*0*/ virtual ~VarIntDataInput(); - /*1*/ virtual void __unk_vfn_1(); - /*2*/ virtual void __unk_vfn_2(); +// /*1*/ virtual void __unk_vfn_1(); + /*2*/ virtual class std::basic_string,class std::allocator> readLongString(void); /*3*/ virtual float readFloat(); /*4*/ virtual double readDouble(); /*5*/ virtual char readByte(); diff --git a/LiteLoader/Kernel/MC/ColorFormatAPI.cpp b/LiteLoader/Kernel/MC/ColorFormatAPI.cpp index ddc236f..9fe1698 100644 --- a/LiteLoader/Kernel/MC/ColorFormatAPI.cpp +++ b/LiteLoader/Kernel/MC/ColorFormatAPI.cpp @@ -118,7 +118,7 @@ Color ColorFromConsoleCode(std::string const& console) { auto codeIter = decorationToColorCodeMap.find(decoration); if (codeIter != decorationToColorCodeMap.end()) return *ColorFromColorCode(codeIter->second); - return mce::Color::NIL; + return Color::NIL; } if (decoration == 38 && c == ';') { unsigned char unk; diff --git a/LiteLoader/Kernel/MC/NetworkIdentifierAPI.cpp b/LiteLoader/Kernel/MC/NetworkIdentifierAPI.cpp index e706898..ca60f1c 100644 --- a/LiteLoader/Kernel/MC/NetworkIdentifierAPI.cpp +++ b/LiteLoader/Kernel/MC/NetworkIdentifierAPI.cpp @@ -3,6 +3,6 @@ string NetworkIdentifier::getIP() { string rv; - Global->getAdr(*this).ToString_New(true, ':', rv.data()); + Global->getAdr(*this).ToString_New(true, rv.data(), ':'); return rv.substr(0, rv.find('|')); } \ No newline at end of file diff --git a/LiteLoader/Kernel/Network/ReadOnlyBinaryStreamAPI.cpp b/LiteLoader/Kernel/Network/ReadOnlyBinaryStreamAPI.cpp index a9ed66d..6df5652 100644 --- a/LiteLoader/Kernel/Network/ReadOnlyBinaryStreamAPI.cpp +++ b/LiteLoader/Kernel/Network/ReadOnlyBinaryStreamAPI.cpp @@ -1,6 +1,8 @@ #include #include #include +#include +#include std::string const& ReadOnlyBinaryStream::getData() const { return *pBuf; @@ -26,20 +28,14 @@ void ReadOnlyBinaryStream::setReadPointer(std::size_t size) { readPointer = len; } -struct IDataInput{ - void* pVT; - ReadOnlyBinaryStream* pReadOnlyBinaryStream; -}; std::unique_ptr ReadOnlyBinaryStream::getCompoundTag() { // auto tag = CompoundTag::create(); // class CompoundTag& (*rv)(class CompoundTag&, class ReadOnlyBinaryStream&); // *((void**)&rv) = dlsym("?read@?$serialize@VCompoundTag@@@@SA?AVCompoundTag@@AEAVReadOnlyBinaryStream@@@Z"); // (*rv)(*tag, *this); - IDataInput pVTVarIntDataInput; - pVTVarIntDataInput.pVT = dlsym("??_7VarIntDataInput@@6B@"); - pVTVarIntDataInput.pReadOnlyBinaryStream = this; - return std::move(NbtIo::read(pVTVarIntDataInput)); + VarIntDataInput pVTVarIntDataInput= VarIntDataInput(this); + return std::move(NbtIo::read((IDataInput&)pVTVarIntDataInput)); }