Skip to content

Commit

Permalink
refactor: optimize some code
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Jan 3, 2025
1 parent f406733 commit b8fd6fd
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/ll/core/tweak/ModifyInfomation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ try {
} catch (...) {}
}

// Block from adding LOG metadata

LL_TYPE_INSTANCE_HOOK(
AppendLogEntryMetadataHook,
HookPriority::Normal,
Expand All @@ -128,22 +126,25 @@ LL_TYPE_INSTANCE_HOOK(
std::string,
int,
int
) {}
) {
// Block from adding LOG metadata
}

LL_TYPE_INSTANCE_HOOK(
SetOfflinePingResponseHook,
HookPriority::Normal,
RakNet::RakPeer,
&RakNet::RakPeer::$SetOfflinePingResponse,
void,
const char* data,
unsigned int dataSize
const char* data,
uint dataSize
) {
auto result = std::string(data, dataSize);
if (result.contains("MCPE;")) {
result = fmt::format("{}LeviLamina;{};", result, ll::getLoaderVersion().to_string());
std::string_view dataView{data, dataSize};
if (dataView.contains("MCPE;")) {
auto modified = fmt::format("{}LeviLamina;{};", dataView, getLoaderVersion().to_string());
return origin(modified.c_str(), (uint)modified.size());
}
return origin(result.c_str(), result.size());
return origin(data, dataSize);
}

using HookReg = memory::
Expand Down

0 comments on commit b8fd6fd

Please sign in to comment.