mirror of
https://github.com/quizhizhe/LiteLoaderBDS-1.16.40.git
synced 2025-06-03 04:23:39 +00:00
修复部分变更的符合函数
This commit is contained in:
parent
5ecd9e710d
commit
958dfe41b5
@ -73,8 +73,8 @@ public:
|
||||
storage_.policy_ = allocate & 0x3;
|
||||
storage_.length_ = length & 0x3FFFFFFF;
|
||||
}
|
||||
//MCAPI CZString(CZString const& other);
|
||||
//MCAPI ~CZString();
|
||||
MCAPI CZString(CZString const& other);
|
||||
MCAPI ~CZString();
|
||||
CZString& operator=(const CZString& other) {
|
||||
cstr_ = other.cstr_;
|
||||
index_ = other.index_;
|
||||
@ -153,34 +153,34 @@ public:
|
||||
bits_.value_type_ = realValue;
|
||||
value_.real_ = value;
|
||||
}
|
||||
//MCAPI Value(const char* value);
|
||||
MCAPI Value(const char* value);
|
||||
Value(bool value) {
|
||||
bits_.value_type_ = booleanValue;
|
||||
value_.bool_ = value;
|
||||
}
|
||||
//MCAPI Value(const Value& other);
|
||||
//MCAPI ~Value();
|
||||
MCAPI Value(const Value& other);
|
||||
MCAPI ~Value();
|
||||
|
||||
//MCAPI static Value const null;
|
||||
MCAPI static Value const null;
|
||||
|
||||
//MCAPI void swap(Value& other);
|
||||
MCAPI void swap(Value& other);
|
||||
ValueType type() const {
|
||||
return bits_.value_type_;
|
||||
}
|
||||
|
||||
//MCAPI Value& operator=(const Value& other);
|
||||
MCAPI Value& operator=(const Value& other);
|
||||
|
||||
//MCAPI bool operator<(const Value& other) const;
|
||||
//MCAPI bool operator==(const Value& other) const;
|
||||
MCAPI bool operator<(const Value& other) const;
|
||||
MCAPI bool operator==(const Value& other) const;
|
||||
|
||||
//MCAPI std::string asString(std::string const&) const;
|
||||
//MCAPI Int asInt(Int) const;
|
||||
//MCAPI UInt asUInt(UInt) const;
|
||||
//MCAPI float asFloat(float) const;
|
||||
//MCAPI double asDouble(double) const;
|
||||
//MCAPI bool asBool(bool) const;
|
||||
MCAPI std::string asString(std::string const&) const;
|
||||
MCAPI Int asInt(Int) const;
|
||||
MCAPI UInt asUInt(UInt) const;
|
||||
MCAPI float asFloat(float) const;
|
||||
MCAPI double asDouble(double) const;
|
||||
MCAPI bool asBool(bool) const;
|
||||
|
||||
//MCAPI bool isNull() const;
|
||||
MCAPI bool isNull() const;
|
||||
bool isBool() const {
|
||||
return type() == booleanValue;
|
||||
}
|
||||
@ -196,48 +196,48 @@ public:
|
||||
bool isDouble() const {
|
||||
return type() == realValue;
|
||||
}
|
||||
//MCAPI bool isNumeric() const;
|
||||
//MCAPI bool isString() const;
|
||||
MCAPI bool isNumeric() const;
|
||||
MCAPI bool isString() const;
|
||||
bool isArray() const {
|
||||
return type() == arrayValue;
|
||||
}
|
||||
bool isObject() const {
|
||||
return type() == objectValue;
|
||||
}
|
||||
//MCAPI bool isConvertibleTo(ValueType other) const;
|
||||
MCAPI bool isConvertibleTo(ValueType other) const;
|
||||
|
||||
//MCAPI ArrayIndex size() const;
|
||||
//MCAPI bool empty() const;
|
||||
MCAPI ArrayIndex size() const;
|
||||
MCAPI bool empty() const;
|
||||
void clear() {
|
||||
if (type() == arrayValue || type() == objectValue) {
|
||||
value_.map_->clear();
|
||||
}
|
||||
}
|
||||
//MCAPI void resize(ArrayIndex newSize);
|
||||
//MCAPI Value& operator[](ArrayIndex index);
|
||||
//MCAPI Value& operator[](int index);
|
||||
//MCAPI const Value& operator[](ArrayIndex index) const;
|
||||
//MCAPI const Value& operator[](int index) const;
|
||||
//MCAPI Value& append(const Value& value);
|
||||
MCAPI void resize(ArrayIndex newSize);
|
||||
MCAPI Value& operator[](ArrayIndex index);
|
||||
MCAPI Value& operator[](int index);
|
||||
MCAPI const Value& operator[](ArrayIndex index) const;
|
||||
MCAPI const Value& operator[](int index) const;
|
||||
MCAPI Value& append(const Value& value);
|
||||
|
||||
//MCAPI Value& operator[](const char* key);
|
||||
//MCAPI const Value& operator[](const char* key) const;
|
||||
//MCAPI Value& operator[](const std::string& key);
|
||||
//MCAPI const Value& operator[](const std::string& key) const;
|
||||
//MCAPI Value removeMember(const char* key);
|
||||
MCAPI Value& operator[](const char* key);
|
||||
MCAPI const Value& operator[](const char* key) const;
|
||||
MCAPI Value& operator[](const std::string& key);
|
||||
MCAPI const Value& operator[](const std::string& key) const;
|
||||
MCAPI Value removeMember(const char* key);
|
||||
void removeMember(const std::string& key) {
|
||||
removeMember(key.c_str());
|
||||
}
|
||||
//MCAPI bool isMember(const char* key) const;
|
||||
MCAPI bool isMember(const char* key) const;
|
||||
bool isMember(const std::string& key) const {
|
||||
return isMember(key.c_str());
|
||||
}
|
||||
|
||||
//MCAPI const_iterator begin() const;
|
||||
//MCAPI const_iterator end() const;
|
||||
MCAPI const_iterator begin() const;
|
||||
MCAPI const_iterator end() const;
|
||||
|
||||
//MCAPI iterator begin();
|
||||
//MCAPI iterator end();
|
||||
MCAPI iterator begin();
|
||||
MCAPI iterator end();
|
||||
|
||||
MCAPI std::string toStyledString() const;
|
||||
|
||||
@ -256,7 +256,7 @@ public:
|
||||
} bits_;
|
||||
|
||||
private:
|
||||
//MCAPI Value& resolveReference(const char* key, bool create);
|
||||
MCAPI Value& resolveReference(const char* key, bool create);
|
||||
};
|
||||
|
||||
class ValueIteratorBase {
|
||||
@ -273,11 +273,11 @@ public:
|
||||
return !isEqual(other);
|
||||
}
|
||||
|
||||
//MCAPI Value key() const;
|
||||
MCAPI Value key() const;
|
||||
|
||||
protected:
|
||||
//MCAPI void increment(void);
|
||||
//MCAPI class Json::Value& deref(void) const;
|
||||
MCAPI void increment(void);
|
||||
MCAPI class Json::Value& deref(void) const;
|
||||
|
||||
bool isEqual(const SelfType& other) const {
|
||||
if (isNull_)
|
||||
@ -311,8 +311,8 @@ private:
|
||||
explicit ValueConstIterator(const Value::ObjectValues::iterator& current);
|
||||
|
||||
public:
|
||||
//MCAPI SelfType& operator++();
|
||||
//MCAPI reference operator*() const;
|
||||
MCAPI SelfType& operator++();
|
||||
MCAPI reference operator*() const;
|
||||
};
|
||||
|
||||
class ValueIterator : public ValueIteratorBase {
|
||||
@ -334,15 +334,15 @@ private:
|
||||
explicit ValueIterator(const Value::ObjectValues::iterator& current);
|
||||
|
||||
public:
|
||||
// SelfType& operator++() {
|
||||
// increment();
|
||||
// return *this;
|
||||
// }
|
||||
SelfType& operator++() {
|
||||
increment();
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Json::Value& operator*() {
|
||||
// return deref();
|
||||
// }
|
||||
// MCAPI reference operator*() const;
|
||||
Json::Value& operator*() {
|
||||
return deref();
|
||||
}
|
||||
MCAPI reference operator*() const;
|
||||
};
|
||||
|
||||
class Features {
|
||||
@ -363,14 +363,14 @@ public:
|
||||
ptrdiff_t offset_limit;
|
||||
std::string message;
|
||||
};
|
||||
//MCAPI Reader();
|
||||
MCAPI Reader();
|
||||
|
||||
//MCAPI bool parse(const std::string& document, Value& root, bool collectComments = true);
|
||||
//MCAPI bool parse(const char* beginDoc, const char* endDoc, Value& root, bool collectComments = true);
|
||||
//MCAPI bool parse(const char* beginDoc, unsigned long long length, Value& root, bool collectComments = true);
|
||||
//MCAPI bool parse(std::istream& is, Value& root, bool collectComments = true);
|
||||
MCAPI bool parse(const std::string& document, Value& root, bool collectComments = true);
|
||||
MCAPI bool parse(const char* beginDoc, const char* endDoc, Value& root, bool collectComments = true);
|
||||
MCAPI bool parse(const char* beginDoc, unsigned long long length, Value& root, bool collectComments = true);
|
||||
MCAPI bool parse(std::istream& is, Value& root, bool collectComments = true);
|
||||
|
||||
//MCAPI std::string getFormattedErrorMessages() const;
|
||||
MCAPI std::string getFormattedErrorMessages() const;
|
||||
|
||||
private:
|
||||
enum TokenType {
|
||||
@ -434,7 +434,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
//MCAPI std::string write(const Value& root) override;
|
||||
MCAPI std::string write(const Value& root) override;
|
||||
|
||||
private:
|
||||
std::string document_;
|
||||
@ -451,7 +451,7 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
//MCAPI std::string write(const Value& root) override;
|
||||
MCAPI std::string write(const Value& root) override;
|
||||
|
||||
private:
|
||||
typedef std::vector<std::string> ChildValues;
|
||||
|
@ -28,8 +28,7 @@
|
||||
|
||||
Actor* Level::getEntity(ActorUniqueID uniqueId) {
|
||||
try {
|
||||
// 完蛋,没有这个符号
|
||||
return SymCall("?fetchEntity@Level@@UEBAPEAVActor@@UActorUniqueID@@_N@Z", Actor*, Level*, ActorUniqueID)(Global<Level>, uniqueId);
|
||||
return SymCall("?fetchEntity@Level@@QEBAPEAVActor@@UActorUniqueID@@_N@Z", Actor*, Level*, ActorUniqueID)(Global<Level>, uniqueId);
|
||||
} catch (...) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -224,8 +223,7 @@ std::vector<Actor*> Level::getAllEntities(int dimId) {
|
||||
|
||||
// Check Valid
|
||||
std::vector<Actor*> result;
|
||||
// 阿这,这个符号也没有
|
||||
auto currTick = SymCall("?getCurrentTick@Level@@UEBAAEBUTick@@XZ", Tick*, Level*)(lv)->t;
|
||||
auto currTick = SymCall("?getCurrentTick@Level@@QEBAAEBUTick@@XZ", Tick*, Level*)(lv)->t;
|
||||
for (auto& i : list) {
|
||||
// auto entity = SymCall("??$tryUnwrap@VActor@@$$V@WeakEntityRef@@QEBAPEAVActor@@XZ",
|
||||
// Actor*, void*)(&i.second);
|
||||
@ -292,7 +290,12 @@ Player* Level::getPlayer(const string& info) {
|
||||
|
||||
Player* Level::getPlayer(ActorUniqueID id) {
|
||||
// 裂开,这个符号也没有
|
||||
return SymCall("?getPlayer@Level@@UEBAPEAVPlayer@@UActorUniqueID@@@Z", Player*, Level*, ActorUniqueID)(Global<Level>, id);
|
||||
Actor* actor = Level::fetchEntity(id,0);
|
||||
if(actor && actor->hasCategory((ActorCategory)1))
|
||||
return (Player*)actor;
|
||||
else
|
||||
return nullptr;
|
||||
//return SymCall("?getPlayer@Level@@UEBAPEAVPlayer@@UActorUniqueID@@@Z", Player*, Level*, ActorUniqueID)(Global<Level>, id);
|
||||
}
|
||||
|
||||
// Actor* Level::spawnMob(Vec3 pos, int dimId, std::string name) {
|
||||
|
@ -42,20 +42,18 @@ TInstanceHook(void, "?allowIncomingConnections@ServerNetworkHandler@@QEAAXAEBV?$
|
||||
// }
|
||||
|
||||
// MinecraftCommands
|
||||
// 没有这个符号
|
||||
// TInstanceHook(void,
|
||||
// "?initCoreEnums@MinecraftCommands@@QEAAXVItemRegistryRef@@AEBVIWorldRegistriesProvider@@AEBVActorFactory@"
|
||||
// "@AEBVExperiments@@AEBVBaseGameVersion@@@Z",
|
||||
// MinecraftCommands, void* a2, __int64 a3, __int64 a4, void* a5, void* a6) {
|
||||
// original(this, a2, a3, a4, a5, a6);
|
||||
// Global<MinecraftCommands> = this;
|
||||
// }
|
||||
// 符号参数与1.19的不同,1.16是三个,1.19是五个
|
||||
TInstanceHook(void,
|
||||
"?initCoreEnums@MinecraftCommands@@QEAAXAEBVIWorldRegistriesProvider@@_NAEBVBaseGameVersion@@@Z",
|
||||
MinecraftCommands, void* a2, __int8 a3,void* a4) {
|
||||
original(this, a2, a3, a4);
|
||||
Global<MinecraftCommands> = this;
|
||||
}
|
||||
|
||||
// LevelStorage & DBStorage
|
||||
// 没有这个符号,去掉应该会狗带吧?
|
||||
TInstanceHook(DBStorage*, "??0DBStorage@@QEAA@UDBStorageConfig@@V?$not_null@V?$NonOwnerPointer@VLevelDbEnv@@@Bedrock@@@gsl@@@Z",
|
||||
DBStorage, struct DBStorageConfig* config, void* a3) {
|
||||
auto ret = original(this, config, a3);
|
||||
TInstanceHook(DBStorage*, "??0DBStorage@@QEAA@UDBStorageConfig@@@Z",
|
||||
DBStorage, struct DBStorageConfig* config) {
|
||||
auto ret = original(this, config);
|
||||
Global<LevelStorage> = (LevelStorage*)this;
|
||||
Global<DBStorage> = this;
|
||||
return ret;
|
||||
@ -72,8 +70,7 @@ THook(void*, "??0ChunkSource@@QEAA@V?$unique_ptr@VChunkSource@@U?$default_delete
|
||||
|
||||
// RakNetServerLocator
|
||||
// ?activate@RakNetServerLocator@@AEAAXXZ
|
||||
// 没有这个符号,两个都是一样的
|
||||
TInstanceHook(void*, "?_activate@RakNetServerLocator@@AEAAXXZ", RakNetServerLocator) {
|
||||
TInstanceHook(void*, "?activate@RakNetServerLocator@@AEAAXXZ", RakNetServerLocator) {
|
||||
//constexpr auto h = do_hash("?_activate@RakNetServerLocator@@AEAAXXZ");
|
||||
static bool set = false;
|
||||
if (!set) {
|
||||
|
@ -49,9 +49,9 @@ THook(void, "?PlatformBedrockLogOut@@YAXIPEBD@Z", int a1, const char* ts) {
|
||||
}
|
||||
|
||||
// Block BDS from adding LOG metadata
|
||||
// 没有这个符号,去掉这个应该也没有影响
|
||||
// THook(void, "?_appendLogEntryMetadata@LogDetails@BedrockLog@@AEAAXAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V34@W4LogAreaID@@I1HH@Z",
|
||||
// void* a1, void* a2, void** a3, int a4, unsigned int a5, __int64 a6, unsigned int a7, unsigned int a8) {
|
||||
// 虽然这个是可用的,但开了以后BDS自身的后台记录没有了时间
|
||||
// THook(void, "?_appendLogEntryMetadata@LogDetails@BedrockLog@@AEAAXAEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@W4LogAreaID@@IV34@HH@Z",
|
||||
// void* a1, void* a2, int a3, unsigned int a4, size_t *a5, __int64 a6, int a7) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
@ -25,20 +25,20 @@ void RegisterSimpleServerLogger() {
|
||||
}
|
||||
|
||||
#include <MC/Command.hpp>
|
||||
TInstanceHook(void, "?setPermissions@Player@@QEAAXW4CommandPermissionLevel@@@Z",
|
||||
Player, CommandPermissionLevel perm) {
|
||||
if (LL::globalConfig.enableSimpleServerLogger) {
|
||||
static Logger logger("Permissions");
|
||||
logger.info("<{}> {}({}) -> {}({})",
|
||||
getRealName(), magic_enum::enum_name(getCommandPermissionLevel()), (int)getCommandPermissionLevel(), magic_enum::enum_name(perm), (int)perm);
|
||||
}
|
||||
return original(this, perm);
|
||||
}
|
||||
//TInstanceHook(void, "?setPermissions@Player@@QEAAXW4CommandPermissionLevel@@@Z",
|
||||
// Player, CommandPermissionLevel perm) {
|
||||
// if (LL::globalConfig.enableSimpleServerLogger) {
|
||||
// static Logger logger("Permissions");
|
||||
// logger.info("<{}> {}({}) -> {}({})",
|
||||
// getRealName(), magic_enum::enum_name(getCommandPermissionLevel()), (int)getCommandPermissionLevel(), magic_enum::enum_name(perm), (int)perm);
|
||||
// }
|
||||
// return original(this, perm);
|
||||
//}
|
||||
|
||||
// ==> LiteLoader/Main/BuiltinUnlockCmd.cpp
|
||||
#include <MC/I18n.hpp>
|
||||
void LogCommandRegistration(std::string const& name, char const* description, enum CommandPermissionLevel perm, short flag1, short flag2) {
|
||||
static Logger logger("RegsterCommand");
|
||||
logger.consoleLevel = logger.debug.level;
|
||||
logger.debug("{:<18} - {:<12} - {}", name, magic_enum::enum_name(perm), I18n::get(description));
|
||||
}
|
||||
//void LogCommandRegistration(std::string const& name, char const* description, enum CommandPermissionLevel perm, short flag1, short flag2) {
|
||||
// static Logger logger("RegsterCommand");
|
||||
// logger.consoleLevel = logger.debug.level;
|
||||
// logger.debug("{:<18} - {:<12} - {}", name, magic_enum::enum_name(perm), I18n::get(description));
|
||||
//}
|
||||
|
Loading…
Reference in New Issue
Block a user