From dd6e20b28315e15664a9084e4ef7aa3df05381b8 Mon Sep 17 00:00:00 2001 From: altalk23 <45172705+altalk23@users.noreply.github.com> Date: Wed, 27 Mar 2024 22:36:45 +0300 Subject: [PATCH] add a GEODE_REVERT_TODO_RETURN option for cmake --- CMakeLists.txt | 3 +++ loader/include/Geode/Enums.hpp | 8 +++++++- loader/include/Geode/modify/Modify.hpp | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75794abd..4c3f2b45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,6 +267,9 @@ target_include_directories(GeodeBindings PUBLIC target_link_directories(GeodeBindings PUBLIC ${GEODE_LOADER_PATH}/include/link) target_link_libraries(GeodeBindings PUBLIC ghc_filesystem fmt TulipHookInclude mat-json GeodeFilesystemImpl) 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}) diff --git a/loader/include/Geode/Enums.hpp b/loader/include/Geode/Enums.hpp index 2d27f5be..9f086a65 100644 --- a/loader/include/Geode/Enums.hpp +++ b/loader/include/Geode/Enums.hpp @@ -2,7 +2,13 @@ struct TodoReturnPlaceholder; -using TodoReturn = TodoReturnPlaceholder; +#ifdef GEODE_REVERT_TODO_RETURN + using TodoReturn = void; + #warning "Reverting TodoReturn to void. This behavior is deprecated and will be removed in a later update." +#else + #define GEODE_REVERT_TODO_RETURN 0 + using TodoReturn = TodoReturnPlaceholder; +#endif // thanks pie enum class SearchType { diff --git a/loader/include/Geode/modify/Modify.hpp b/loader/include/Geode/modify/Modify.hpp index fb11aa15..c911e4e8 100644 --- a/loader/include/Geode/modify/Modify.hpp +++ b/loader/include/Geode/modify/Modify.hpp @@ -19,7 +19,8 @@ using DerivedFuncType = decltype(Resolve<__VA_ARGS__>::func(&Derived::FunctionName_)); \ if constexpr (different) { \ static auto address = AddressInline_; \ - static_assert(!different || !std::is_same_v<typename ReturnType<BaseFuncType>::type, TodoReturn>, \ + static_assert(GEODE_REVERT_TODO_RETURN || \ + !different || !std::is_same_v<typename ReturnType<BaseFuncType>::type, TodoReturn>, \ "Function" #ClassName_ "::" #FunctionName_ " has a TodoReturn type, " \ "please fix it by editing the bindings." \ ); \