修复PropertiesSettings

This commit is contained in:
Qiuzhizhe 2022-10-02 01:33:38 -07:00
parent 5710878d29
commit c8ac025ed9
2 changed files with 18 additions and 17 deletions

View File

@ -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<PropertiesSettings> = this;
return out;
}

View File

@ -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<PropertiesSettings> = this;
// return out;
//}
//
//// Fix move view crash (ref PlayerAuthInput[MoveView])
//Player* movingViewPlayer = nullptr;