mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Fix nullptr problems (#878)
This commit is contained in:
parent
74966fc4ef
commit
71f3680388
11 changed files with 161 additions and 84 deletions
|
|
@ -137,12 +137,14 @@ namespace utils {
|
|||
static constexpr uint64_t Placeholder = 0xCC90CC90CC90CC90ULL;
|
||||
|
||||
const std::shared_ptr<void> m_pThunk;
|
||||
std::string m_name;
|
||||
std::function<TFn> m_fnTarget;
|
||||
|
||||
public:
|
||||
thunk(std::function<TFn> target)
|
||||
thunk(std::string name, std::function<TFn> target)
|
||||
: m_pThunk(utils::create_thunk(&detour_static, this, Placeholder))
|
||||
, m_fnTarget(std::move(target)) {
|
||||
, m_fnTarget(std::move(target))
|
||||
, m_name(name) {
|
||||
}
|
||||
|
||||
void set_target(std::function<TFn> detour) {
|
||||
|
|
@ -153,6 +155,10 @@ namespace utils {
|
|||
return reinterpret_cast<TFn*>(m_pThunk.get());
|
||||
}
|
||||
|
||||
const std::string& name() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
private:
|
||||
// mark it as virtual to prevent compiler from inlining
|
||||
virtual TReturn detour(TArgs... args) {
|
||||
|
|
@ -249,4 +255,10 @@ namespace utils {
|
|||
bool is_running_on_linux();
|
||||
|
||||
std::filesystem::path get_module_path(HMODULE hModule);
|
||||
|
||||
/// @brief Find the game main window.
|
||||
/// @return Handle to the game main window, or nullptr if it doesn't exist (yet).
|
||||
HWND try_find_game_window();
|
||||
|
||||
void wait_for_game_window();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue