-
Notifications
You must be signed in to change notification settings - Fork 968
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement updating settings dropdown selection from C++
- Loading branch information
1 parent
7ae41cc
commit 9281744
Showing
15 changed files
with
290 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include "CPanel2D.h" | ||
|
||
namespace cs2 | ||
{ | ||
|
||
struct CDropDown : CPanel2D { | ||
using SetSelectedIndex = void(CDropDown* thisptr, int index); | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <CS2/Panorama/CDropDown.h> | ||
#include <MemoryPatterns/PatternTypes/PanoramaDropDownPatternTypes.h> | ||
|
||
template <typename HookContext> | ||
class PanoramaDropDown { | ||
public: | ||
PanoramaDropDown(HookContext& hookContext, cs2::CDropDown* dropDown) noexcept | ||
: hookContext{hookContext} | ||
, dropDown{dropDown} | ||
{ | ||
} | ||
|
||
using RawType = cs2::CDropDown; | ||
|
||
void setSelectedIndex(int index) const noexcept | ||
{ | ||
const auto setSelectedIndexFn = hookContext.clientPatternSearchResults().template get<SetSelectedIndexFunctionPointer>(); | ||
if (dropDown && setSelectedIndexFn) | ||
setSelectedIndexFn(dropDown, index); | ||
} | ||
|
||
private: | ||
HookContext& hookContext; | ||
cs2::CDropDown* dropDown; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
Source/MemoryPatterns/Linux/PanoramaDropDownPatternsLinux.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <MemoryPatterns/PatternTypes/PanoramaDropDownPatternTypes.h> | ||
#include <MemorySearch/CodePattern.h> | ||
|
||
struct PanoramaDropDownPatterns { | ||
[[nodiscard]] static consteval auto addClientPatterns(auto clientPatterns) noexcept | ||
{ | ||
return clientPatterns | ||
.template addPattern<SetSelectedIndexFunctionPointer, CodePattern{"55 48 89 E5 41 55 41 89 F5 41 54 48 8D 77 ? 49 89 FC 53 48 83 EC ? 8B"}>(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
Source/MemoryPatterns/PatternTypes/PanoramaDropDownPatternTypes.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
#include <CS2/Panorama/CDropDown.h> | ||
#include <Utils/StrongTypeAlias.h> | ||
|
||
STRONG_TYPE_ALIAS(SetSelectedIndexFunctionPointer, cs2::CDropDown::SetSelectedIndex*); |
12 changes: 12 additions & 0 deletions
12
Source/MemoryPatterns/Windows/PanoramaDropDownPatternsWindows.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
|
||
#include <MemoryPatterns/PatternTypes/PanoramaDropDownPatternTypes.h> | ||
#include <MemorySearch/CodePattern.h> | ||
|
||
struct PanoramaDropDownPatterns { | ||
[[nodiscard]] static consteval auto addClientPatterns(auto clientPatterns) noexcept | ||
{ | ||
return clientPatterns | ||
.template addPattern<SetSelectedIndexFunctionPointer, CodePattern{"48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 8B 05 ? ? ? ? 8B"}>(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.