Skip to content

Commit

Permalink
Add compile-time check for missing .read() in pattern declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkrupinski committed Oct 18, 2024
1 parent 4343c2d commit b912cbf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/MemoryPatterns/Linux/GameSceneNodePatternsLinux.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct GameSceneNodePatterns {
[[nodiscard]] static consteval auto addClientPatterns(auto clientPatterns) noexcept
{
return clientPatterns
.template addPattern<OffsetToAbsOrigin, CodePattern{"43 ? F3 0F 10 83 ? ? ? ? 66"}.add(6)>()
.template addPattern<OffsetToAbsOrigin, CodePattern{"43 ? F3 0F 10 83 ? ? ? ? 66"}.add(6).read()>()
.template addPattern<OffsetToGameSceneNodeOwner, CodePattern{"4C 8B 6F ? ? F6 ? ? 0F"}.add(3).read()>()
.template addPattern<OffsetToChildGameSceneNode, CodePattern{"? 48 85 DB 75 ? EB ? 0F B6"}.read()>()
.template addPattern<OffsetToNextSiblingGameSceneNode, CodePattern{"50 ? 48 8B 5B ? 48 85 DB 0F"}.add(5).read()>();
Expand Down
1 change: 1 addition & 0 deletions Source/MemorySearch/PatternPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class PatternPool {
[[nodiscard]] consteval auto addPattern() const noexcept
{
static_assert(Pattern.storage.size <= (std::numeric_limits<std::uint8_t>::max)());
static_assert(sizeof(typename PatternType::Type) == 8 || Pattern.operation == CodePatternOperation::Read, "Incorrect result size, missing .read() in pattern declaration?");

PatternPool<BufferSize + Pattern.storage.size, NumberOfPatterns + 1, typename PatternTypesList::template add<PatternType>> newPool;
copyCurrentPool(newPool);
Expand Down

0 comments on commit b912cbf

Please sign in to comment.