From c8ac025ed96e14438bcc658dd01dbd37688bbfd7 Mon Sep 17 00:00:00 2001 From: Qiuzhizhe <42761326+quizhizhe@users.noreply.github.com> Date: Sun, 2 Oct 2022 01:33:38 -0700 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DPropertiesSettings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LiteLoader/Kernel/Utils/GlobalService.cpp | 18 ++++++++++++++++++ LiteLoader/Main/BuiltinBugFix.cpp | 17 ----------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/LiteLoader/Kernel/Utils/GlobalService.cpp b/LiteLoader/Kernel/Utils/GlobalService.cpp index fcdeb61..65308a9 100644 --- a/LiteLoader/Kernel/Utils/GlobalService.cpp +++ b/LiteLoader/Kernel/Utils/GlobalService.cpp @@ -107,3 +107,21 @@ TInstanceHook(Scoreboard*, "??0ServerScoreboard@@QEAA@VCommandSoftEnumRegistry@@ // } // PropertiesSettings // -> BuiltinBugFix.cpp +#include "MC/PropertiesSettings.hpp" +TInstanceHook(size_t, "??0PropertiesSettings@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z", PropertiesSettings, const std::string& file) { + auto out = original(this, file); +// if (LL::globalConfig.enableUnoccupyPort19132) { +// // logger.warn("If you turn on this feature, your server will not be displayed on the LAN"); +// DWORD v4Flag, v6Flag; +// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePort, 4, PAGE_READWRITE, &v4Flag); +// *(unsigned short*)&SharedConstants::NetworkDefaultGamePort = getServerPort(); +// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePort, 4, v4Flag, NULL); +// +// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePortv6, 4, PAGE_READWRITE, &v6Flag); +// *(unsigned short*)&SharedConstants::NetworkDefaultGamePortv6 = getServerPortv6(); +// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePortv6, 4, v6Flag, NULL); +// } + // Global service + Global = this; + return out; +} diff --git a/LiteLoader/Main/BuiltinBugFix.cpp b/LiteLoader/Main/BuiltinBugFix.cpp index 87a90d2..907d700 100644 --- a/LiteLoader/Main/BuiltinBugFix.cpp +++ b/LiteLoader/Main/BuiltinBugFix.cpp @@ -126,23 +126,6 @@ // return original(this, netid, pk); //} // -//TInstanceHook(size_t, "??0PropertiesSettings@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z", PropertiesSettings, const std::string& file) { -// auto out = original(this, file); -// if (LL::globalConfig.enableUnoccupyPort19132) { -// // logger.warn("If you turn on this feature, your server will not be displayed on the LAN"); -// DWORD v4Flag, v6Flag; -// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePort, 4, PAGE_READWRITE, &v4Flag); -// *(unsigned short*)&SharedConstants::NetworkDefaultGamePort = getServerPort(); -// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePort, 4, v4Flag, NULL); -// -// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePortv6, 4, PAGE_READWRITE, &v6Flag); -// *(unsigned short*)&SharedConstants::NetworkDefaultGamePortv6 = getServerPortv6(); -// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePortv6, 4, v6Flag, NULL); -// } -// // Global service -// Global = this; -// return out; -//} // //// Fix move view crash (ref PlayerAuthInput[MoveView]) //Player* movingViewPlayer = nullptr;