diff --git a/cmake/Platform.cmake b/cmake/Platform.cmake index 76711247..b4f79b0c 100644 --- a/cmake/Platform.cmake +++ b/cmake/Platform.cmake @@ -8,7 +8,11 @@ if (NOT DEFINED GEODE_TARGET_PLATFORM) elseif(WIN32) set(GEODE_TARGET_PLATFORM "Win32") elseif(ANDROID) - set(GEODE_TARGET_PLATFORM "Android") + if (ANDROID_ABI STREQUAL "arm64-v8a") + set(GEODE_TARGET_PLATFORM "Android64") + elseif(ANDROID_ABI STREQUAL "armeabi-v7a") + set(GEODE_TARGET_PLATFORM "Android32") + endif() else() message(FATAL_ERROR "Unable to detect platform, please set GEODE_TARGET_PLATFORM in the root CMake file.") endif() @@ -25,6 +29,7 @@ if (GEODE_TARGET_PLATFORM STREQUAL "iOS") OSX_ARCHITECTURES arm64 ) + set(GEODE_OUTPUT_NAME "GeodeIOS") set(GEODE_PLATFORM_BINARY "GeodeIOS.dylib") elseif (GEODE_TARGET_PLATFORM STREQUAL "MacOS") set_target_properties(${PROJECT_NAME} PROPERTIES @@ -55,6 +60,7 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "MacOS") -DCommentType=CommentTypeDummy ) + set(GEODE_OUTPUT_NAME "Geode") set(GEODE_PLATFORM_BINARY "Geode.dylib") elseif (GEODE_TARGET_PLATFORM STREQUAL "Win32") @@ -75,19 +81,39 @@ elseif (GEODE_TARGET_PLATFORM STREQUAL "Win32") ) # Windows links against .lib and not .dll + set(GEODE_OUTPUT_NAME "Geode") set(GEODE_PLATFORM_BINARY "Geode.lib") -elseif (GEODE_TARGET_PLATFORM STREQUAL "Android") +elseif (GEODE_TARGET_PLATFORM STREQUAL "Android32") set_target_properties(${PROJECT_NAME} PROPERTIES SYSTEM_NAME Android ) target_link_libraries(${PROJECT_NAME} INTERFACE - ${GEODE_LOADER_PATH}/include/link/android/libcurl.a - ${GEODE_LOADER_PATH}/include/link/android/libssl.a - ${GEODE_LOADER_PATH}/include/link/android/libcrypto.a - ${GEODE_LOADER_PATH}/include/link/android/libcocos2dcpp.so + ${GEODE_LOADER_PATH}/include/link/android32/libcurl.a + ${GEODE_LOADER_PATH}/include/link/android32/libssl.a + ${GEODE_LOADER_PATH}/include/link/android32/libcrypto.a + ${GEODE_LOADER_PATH}/include/link/android32/libcocos2dcpp.so log ) - set(GEODE_PLATFORM_BINARY "Geode.so") + set(GEODE_OUTPUT_NAME "Geode.v7") + set(GEODE_PLATFORM_BINARY "Geode.v7.so") + +elseif (GEODE_TARGET_PLATFORM STREQUAL "Android64") + set_target_properties(${PROJECT_NAME} PROPERTIES + SYSTEM_NAME Android + ) + + target_link_libraries(${PROJECT_NAME} INTERFACE + ${GEODE_LOADER_PATH}/include/link/android64/libcurl.a + ${GEODE_LOADER_PATH}/include/link/android64/libssl.a + ${GEODE_LOADER_PATH}/include/link/android64/libcrypto.a + ${GEODE_LOADER_PATH}/include/link/android64/libcocos2dcpp.so + log + ) + + set(GEODE_OUTPUT_NAME "Geode.v8") + set(GEODE_PLATFORM_BINARY "Geode.v8.so") +else() + message(FATAL_ERROR "Unknown platform ${GEODE_TARGET_PLATFORM}") endif() diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 154dc62d..2b597fa1 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -117,7 +117,7 @@ make_directory("${GEODE_BIN_PATH}/nightly") # Prevent SDK from activating a loader build set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" - OUTPUT_NAME "Geode" + OUTPUT_NAME ${GEODE_OUTPUT_NAME} # i'm going to say a slur that not a single soul has uttered in the last 200 years LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly" RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${GEODE_BIN_PATH}/nightly" diff --git a/loader/include/Geode/platform/cplatform.h b/loader/include/Geode/platform/cplatform.h index 562b11d4..80fe2334 100644 --- a/loader/include/Geode/platform/cplatform.h +++ b/loader/include/Geode/platform/cplatform.h @@ -56,14 +56,32 @@ #define GEODE_ANDROID(...) __VA_ARGS__ #define GEODE_IS_ANDROID #define GEODE_IS_MOBILE - #define GEODE_PLATFORM_NAME "Android" #define GEODE_CALL #define GEODE_CDECL_CALL - #define GEODE_PLATFORM_EXTENSION ".so" - #define GEODE_PLATFORM_SHORT_IDENTIFIER "android" #define CC_TARGET_OS_ANDROID + + #if defined(__arm__) + #define GEODE_ANDROID32(...) __VA_ARGS__ + #define GEODE_ANDROID64(...) + #define GEODE_IS_ANDROID32 + #define GEODE_PLATFORM_NAME "Android32" + #define GEODE_PLATFORM_EXTENSION ".v7.so" + #define GEODE_PLATFORM_SHORT_IDENTIFIER "android32" + #elif defined(__aarch64__) + #define GEODE_ANDROID32(...) + #define GEODE_ANDROID64(...) __VA_ARGS__ + #define GEODE_IS_ANDROID64 + #define GEODE_PLATFORM_NAME "Android64" + #define GEODE_PLATFORM_EXTENSION ".v8.so" + #define GEODE_PLATFORM_SHORT_IDENTIFIER "android64" + #else + #define GEODE_ANDROID32(...) + #define GEODE_ANDROID64(...) + #endif #else #define GEODE_ANDROID(...) + #define GEODE_ANDROID32(...) + #define GEODE_ANDROID64(...) #endif #ifndef GEODE_PLATFORM_NAME diff --git a/loader/include/Geode/platform/platform.hpp b/loader/include/Geode/platform/platform.hpp index 109aa893..aa0f0cbc 100644 --- a/loader/include/Geode/platform/platform.hpp +++ b/loader/include/Geode/platform/platform.hpp @@ -99,7 +99,8 @@ namespace geode { Windows, MacOS, iOS, - Android, + Android32, + Android64, Linux, }; @@ -149,7 +150,8 @@ namespace geode { case Windows: return "Windows"; case MacOS: return "MacOS"; case iOS: return "iOS"; - case Android: return "Android"; + case Android32: return "Android32"; + case Android64: return "Android64"; case Linux: return "Linux"; default: break; } @@ -189,6 +191,8 @@ namespace std { #define GEODE_PLATFORM_TARGET PlatformID::MacOS #elif defined(GEODE_IS_IOS) #define GEODE_PLATFORM_TARGET PlatformID::iOS -#elif defined(GEODE_IS_ANDROID) - #define GEODE_PLATFORM_TARGET PlatformID::Android +#elif defined(GEODE_IS_ANDROID32) + #define GEODE_PLATFORM_TARGET PlatformID::Android32 +#elif defined(GEODE_IS_ANDROID64) + #define GEODE_PLATFORM_TARGET PlatformID::Android64 #endif diff --git a/loader/include/link/android/libcocos2dcpp.so b/loader/include/link/android32/libcocos2dcpp.so similarity index 100% rename from loader/include/link/android/libcocos2dcpp.so rename to loader/include/link/android32/libcocos2dcpp.so diff --git a/loader/include/link/android/libcrypto.a b/loader/include/link/android32/libcrypto.a similarity index 100% rename from loader/include/link/android/libcrypto.a rename to loader/include/link/android32/libcrypto.a diff --git a/loader/include/link/android/libcurl.a b/loader/include/link/android32/libcurl.a similarity index 100% rename from loader/include/link/android/libcurl.a rename to loader/include/link/android32/libcurl.a diff --git a/loader/include/link/android/libssl.a b/loader/include/link/android32/libssl.a similarity index 100% rename from loader/include/link/android/libssl.a rename to loader/include/link/android32/libssl.a diff --git a/loader/src/hooks/DynamicCastFix.cpp b/loader/src/hooks/DynamicCastFix.cpp index c34ab3b9..fe9b4a05 100644 --- a/loader/src/hooks/DynamicCastFix.cpp +++ b/loader/src/hooks/DynamicCastFix.cpp @@ -12,7 +12,7 @@ $execute { (void)Mod::get()->patch( reinterpret_cast(base::get() + 0x603948), toByteArray(&cast::typeinfoCastInternal) ); - #elif defined(GEODE_IS_ANDROID) + #elif defined(GEODE_IS_ANDROID32) (void)Mod::get()->addHook(reinterpret_cast(base::get() + (0x720348 - 0x10000) + 1), &cast::typeinfoCastInternal, "__dynamic_cast"); #endif diff --git a/loader/src/platform/android/crashlog.cpp b/loader/src/platform/android/crashlog.cpp index 41c4e272..f73742bf 100644 --- a/loader/src/platform/android/crashlog.cpp +++ b/loader/src/platform/android/crashlog.cpp @@ -1,6 +1,6 @@ #include -#ifdef GEODE_IS_ANDROID +#ifdef GEODE_IS_ANDROID32 using namespace geode::prelude; diff --git a/loader/src/platform/android/gdstdlib.cpp b/loader/src/platform/android/gdstdlib.cpp index 07f518b2..a2355330 100644 --- a/loader/src/platform/android/gdstdlib.cpp +++ b/loader/src/platform/android/gdstdlib.cpp @@ -1,7 +1,7 @@ #include #include "../../c++stl/string-impl.hpp" -#ifdef GEODE_IS_ANDROID +#ifdef GEODE_IS_ANDROID32 // 2.2 addition // zmx please fix this diff --git a/loader/src/ui/internal/list/SearchFilterPopup.cpp b/loader/src/ui/internal/list/SearchFilterPopup.cpp index 706530d9..806e919c 100644 --- a/loader/src/ui/internal/list/SearchFilterPopup.cpp +++ b/loader/src/ui/internal/list/SearchFilterPopup.cpp @@ -35,10 +35,13 @@ bool SearchFilterPopup::setup(ModListLayer* layer, ModListType type) { platformBG->setScale(.5f); m_mainLayer->addChild(platformBG); + // TODO: add scrolllayer + this->enable(this->addPlatformToggle("Windows", PlatformID::Windows, pos), type); this->enable(this->addPlatformToggle("macOS", PlatformID::MacOS, pos), type); //this->enable(this->addPlatformToggle("IOS", PlatformID::iOS, pos), type); - this->enable(this->addPlatformToggle("Android", PlatformID::Android, pos), type); + this->enable(this->addPlatformToggle("Android32", PlatformID::Android32, pos), type); + this->enable(this->addPlatformToggle("Android64", PlatformID::Android64, pos), type); // show installed diff --git a/loader/src/utils/PlatformID.cpp b/loader/src/utils/PlatformID.cpp index e2303213..034e766d 100644 --- a/loader/src/utils/PlatformID.cpp +++ b/loader/src/utils/PlatformID.cpp @@ -11,7 +11,8 @@ PlatformID PlatformID::from(const char* str) { case hash("windows"): return PlatformID::Windows; case hash("macos"): return PlatformID::MacOS; case hash("ios"): return PlatformID::iOS; - case hash("android"): return PlatformID::Android; + case hash("android32"): return PlatformID::Android32; + case hash("android64"): return PlatformID::Android64; case hash("linux"): return PlatformID::Linux; } } diff --git a/loader/test/members/Android.cpp b/loader/test/members/Android.cpp index 88487c06..6312ec70 100644 --- a/loader/test/members/Android.cpp +++ b/loader/test/members/Android.cpp @@ -1,6 +1,6 @@ #include "Common.hpp" -#ifdef GEODE_IS_ANDROID +#ifdef GEODE_IS_ANDROID32 using namespace geode::prelude;