Skip to content

Commit

Permalink
fix: fix libhat compile
Browse files Browse the repository at this point in the history
  • Loading branch information
OEOTYAN committed Oct 2, 2024
1 parent 01d0d22 commit ef78906
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/ll/api/memory/win/Signature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,15 @@
#include "ll/api/utils/SystemUtils.h"
#include "ll/core/LeviLamina.h"

#include "libhat.hpp"

namespace ll::memory {
void* SignatureView::resolve(std::span<std::byte> range, bool disableErrorOutput) const {

// TODO: fix libhat compile

const auto firstByte = *elements.front();
const auto scanEnd = range.end() - elements.size() + 1;

for (auto i = range.begin(); i != scanEnd; i++) {
i = std::find(std::execution::unseq, i, scanEnd, firstByte);
if (i == scanEnd) [[unlikely]] {
break;
}
if (std::equal(elements.begin() + 1, elements.end(), i + 1, std::equal_to<>{})) [[unlikely]] {
return &*i;
}
}
if (!disableErrorOutput) {
auto result = hat::find_pattern(range.begin(), range.end(), *(hat::signature_view*)&elements);
if (result.has_result() && !disableErrorOutput) {
getLogger().fatal("Couldn't find: {}", toString());
getLogger().fatal("In module: {}", sys_utils::getCallerModuleFileName());
}
return nullptr;
return (void*)result.get();
}
} // namespace ll::memory
5 changes: 5 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ add_requires("levibuildscript 0.2.0")
add_requires("preloader v1.9.0")
add_requires("symbolprovider v1.2.0")

if is_windows then
add_requires("libhat 2024.9.22")
end

if is_linux then
set_toolchains("clang")
end
Expand Down Expand Up @@ -148,6 +152,7 @@ target("LeviLamina")
end

if is_windows then
add_packages("libhat")
add_syslinks("Version", "DbgHelp", "dwrite")
add_defines(
"_AMD64_",
Expand Down

0 comments on commit ef78906

Please sign in to comment.