mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-23 03:15:58 -04:00
Update queueInMainThread to be movable
This commit is contained in:
parent
e52b488d0d
commit
0c35a92ece
6 changed files with 9 additions and 12 deletions
CMakeLists.txt
loader
|
@ -266,9 +266,6 @@ target_include_directories(GeodeBindings PUBLIC
|
|||
target_link_directories(GeodeBindings PUBLIC ${GEODE_LOADER_PATH}/include/link)
|
||||
target_link_libraries(GeodeBindings PUBLIC fmt TulipHookInclude mat-json)
|
||||
target_link_libraries(${PROJECT_NAME} INTERFACE GeodeBindings)
|
||||
if (${GEODE_REVERT_TODO_RETURN})
|
||||
target_compile_definitions(GeodeBindings PUBLIC GEODE_REVERT_TODO_RETURN)
|
||||
endif()
|
||||
|
||||
if (NOT EXISTS ${GEODE_BIN_PATH})
|
||||
file(MAKE_DIRECTORY ${GEODE_BIN_PATH})
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace geode {
|
|||
return value.as<T>();
|
||||
}
|
||||
|
||||
void queueInMainThread(ScheduledFunction func);
|
||||
void queueInMainThread(ScheduledFunction&& func);
|
||||
|
||||
/**
|
||||
* Returns the current game version.
|
||||
|
@ -158,8 +158,8 @@ namespace geode {
|
|||
*
|
||||
* @param func the function to queue
|
||||
*/
|
||||
inline GEODE_HIDDEN void queueInMainThread(ScheduledFunction func) {
|
||||
Loader::get()->queueInMainThread(func);
|
||||
inline GEODE_HIDDEN void queueInMainThread(ScheduledFunction&& func) {
|
||||
Loader::get()->queueInMainThread(std::forward<ScheduledFunction>(func));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
using DerivedFuncType = decltype(Resolve<__VA_ARGS__>::func(&Derived::FunctionName_)); \
|
||||
if constexpr (different) { \
|
||||
static auto address = AddressInline_; \
|
||||
static_assert(GEODE_REVERT_TODO_RETURN || \
|
||||
static_assert( \
|
||||
!different || !std::is_same_v<typename ReturnType<BaseFuncType>::type, TodoReturn>, \
|
||||
"Function" #ClassName_ "::" #FunctionName_ " has a TodoReturn type, " \
|
||||
"please fix it by editing the bindings." \
|
||||
|
|
|
@ -93,8 +93,8 @@ std::vector<LoadProblem> Loader::getRecommendations() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
void Loader::queueInMainThread(ScheduledFunction func) {
|
||||
return m_impl->queueInMainThread(std::move(func));
|
||||
void Loader::queueInMainThread(ScheduledFunction&& func) {
|
||||
return m_impl->queueInMainThread(std::forward<ScheduledFunction>(func));
|
||||
}
|
||||
|
||||
std::string Loader::getGameVersion() {
|
||||
|
|
|
@ -802,9 +802,9 @@ bool Loader::Impl::loadHooks() {
|
|||
return !hadErrors;
|
||||
}
|
||||
|
||||
void Loader::Impl::queueInMainThread(const ScheduledFunction& func) {
|
||||
void Loader::Impl::queueInMainThread(ScheduledFunction&& func) {
|
||||
std::lock_guard<std::mutex> lock(m_mainThreadMutex);
|
||||
m_mainThreadQueue.push_back(func);
|
||||
m_mainThreadQueue.push_back(std::forward<ScheduledFunction>(func));
|
||||
}
|
||||
|
||||
void Loader::Impl::executeMainThreadQueue() {
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace geode {
|
|||
|
||||
void updateResources(bool forceReload);
|
||||
|
||||
void queueInMainThread(const ScheduledFunction& func);
|
||||
void queueInMainThread(ScheduledFunction&& func);
|
||||
void executeMainThreadQueue();
|
||||
|
||||
bool isReadyToHook() const;
|
||||
|
|
Loading…
Reference in a new issue