Skip to content

Commit

Permalink
i ma carhjsefdd
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Jun 2, 2024
1 parent 8b95688 commit fd15556
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ HookHandle Handler::createHook(void* address, HookMetadata m_metadata) {
m_handles.insert({address, hook});

std::cout << "before functions size " << m_content->m_functions.size() << std::endl;
m_content->m_functions.push_back(address);
for (auto it = m_content->m_functions.begin(); it != m_content->m_functions.end(); ++it) {
std::cout << "function " << *it << std::endl;
if (m_hooks.at(m_handles[*it])->m_metadata.m_priority > m_metadata.m_priority) {
m_content->m_functions.insert(it, address);
break;
}
}


this->reorderFunctions();

Expand Down Expand Up @@ -117,10 +124,10 @@ void Handler::updateHookMetadata(HookHandle const& hook, HookMetadata const& met
void Handler::reorderFunctions() {
auto& vec = m_content->m_functions;
std::cout << "functions size " << m_content->m_functions.size() << " this " << (void*)this << std::endl;
std::sort(m_content->m_functions.begin(), m_content->m_functions.end(), [this](auto const a, auto const b) {
// std::cout << "reordering this" << a << " " << b << " "<< (void*)this << std::endl;
return a < b;
});
// std::sort(m_content->m_functions.begin(), m_content->m_functions.end(), [this](auto const a, auto const b) {
// // std::cout << "reordering this" << a << " " << b << " "<< (void*)this << std::endl;
// return a < b;
// });
// std::sort(vec.begin(), vec.end(), [this](auto const a, auto const b) {
// std::cout << "reordering " << m_handles[a] << " " << m_handles[b] << std::endl;
// return (m_hooks.at(m_handles[a])->m_metadata.m_priority < m_hooks.at(m_handles[b])->m_metadata.m_priority);
Expand Down

0 comments on commit fd15556

Please sign in to comment.