diff --git a/.gitmodules b/.gitmodules index 30036f3bf..10a75a942 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ [submodule "libultraship"] path = libultraship - url = https://github.com/kenix3/libultraship.git + url = https://github.com/Waterdish/libultraship.git [submodule "OTRExporter"] path = OTRExporter - url = https://github.com/louist103/OTRExporter.git + url = https://github.com/Waterdish/OTRExporter.git [submodule "ZAPDTR"] path = ZAPDTR - url = https://github.com/louist103/ZAPDTR.git + url = https://github.com/Waterdish/ZAPDTR.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a3005dd2..d4260cff9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,7 @@ endif() ################################################################################ # Global configuration types ################################################################################ -if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") +if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch|Android") set(CMAKE_C_FLAGS_DEBUG "-g -ffast-math -DDEBUG") set(CMAKE_CXX_FLAGS_DEBUG "-g -ffast-math -DDEBUG") set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG") @@ -227,5 +227,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") set(CPACK_GENERATOR "Bundle") endif() -set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/CMake/Packaging-2.cmake) -include(CMake/Packaging.cmake) +if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android") + set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/CMake/Packaging-2.cmake) + include(CMake/Packaging.cmake) +endif() diff --git a/OTRExporter b/OTRExporter index c2a891be8..5495b80e3 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit c2a891be8ba1d33e09ee39eb4bf1c95e3b753e0e +Subproject commit 5495b80e3595afcd0d6984ac5580a4e62d2f894f diff --git a/ZAPDTR b/ZAPDTR index ce2d63d8d..7d257b0d7 160000 --- a/ZAPDTR +++ b/ZAPDTR @@ -1 +1 @@ -Subproject commit ce2d63d8dd594a8ebc35073868d071aa36258317 +Subproject commit 7d257b0d7dbd651476bca491bba318f368052065 diff --git a/libultraship b/libultraship index 0c4b49112..bb5133163 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 0c4b491125e86709400d7bae866159eecd079d38 +Subproject commit bb5133163dc60bc26d8931d2f04bdf021f3cdb73 diff --git a/mm/2s2h/BenPort.cpp b/mm/2s2h/BenPort.cpp index 10572be77..3386a6755 100644 --- a/mm/2s2h/BenPort.cpp +++ b/mm/2s2h/BenPort.cpp @@ -150,10 +150,11 @@ OTRGlobals::OTRGlobals() { Ship::Context::CreateInstance("2 Ship 2 Harkinian", appShortName, "2ship2harkinian.json", archiveFiles, {}, 3); // Override LUS defaults +#ifndef __ANDROID__ Ship::Context::GetInstance()->GetLogger()->set_level( (spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1)); Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v"); - +#endif // context = Ship::Context::CreateUninitializedInstance("Ship of Harkinian", appShortName, "shipofharkinian.json"); auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay(); diff --git a/mm/CMakeLists.txt b/mm/CMakeLists.txt index 86e067161..91e18855d 100644 --- a/mm/CMakeLists.txt +++ b/mm/CMakeLists.txt @@ -292,7 +292,11 @@ set(ALL_FILES ################################################################################ # Target ################################################################################ -add_executable(${PROJECT_NAME} ${ALL_FILES}) +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Android") + add_executable(${PROJECT_NAME} ${ALL_FILES}) +else() + add_library(${PROJECT_NAME} SHARED ${ALL_FILES}) +endif() if (CMAKE_SYSTEM_NAME STREQUAL "Windows") use_props(${PROJECT_NAME} "${CMAKE_CONFIGURATION_TYPES}" "${DEFAULT_CXX_PROPS}") @@ -578,6 +582,29 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-stringop-overflow > ) + elseif (CMAKE_SYSTEM_NAME STREQUAL "Android") + target_compile_options(${PROJECT_NAME} PRIVATE + -O2 + + -Wno-error + -Wno-format-security + # disable some warnings to not clutter output + -Wno-multichar + -Wno-return-type + -Wno-narrowing + -Wno-switch-outside-range + $<$: + -Werror-implicit-function-declaration + -Wno-incompatible-pointer-types + -Wno-discarded-array-qualifiers + -Wno-discarded-qualifiers + -Wno-int-conversion + -Wno-builtin-declaration-mismatch + -Wno-switch-unreachable + -Wno-stringop-overflow + -Wno-implicit-int + > + ) else() if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") set(CPU_OPTION -msse2 -mfpmath=sse) @@ -612,7 +639,7 @@ endif() ################################################################################ # Pre build events ################################################################################ -if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS") +if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS|Android") add_custom_command( TARGET ${PROJECT_NAME} POST_BUILD @@ -663,6 +690,15 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") -lglad Threads::Threads ) +elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + set(ADDITIONAL_LIBRARY_DEPENDENCIES + "libultraship;" + "ZAPDLib;" + SDL2::SDL2 + Threads::Threads + ) elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS") find_package(SDL2 REQUIRED) set(ADDITIONAL_LIBRARY_DEPENDENCIES diff --git a/mm/src/audio/lib/load.c b/mm/src/audio/lib/load.c index e38e232a6..ba39b65d1 100644 --- a/mm/src/audio/lib/load.c +++ b/mm/src/audio/lib/load.c @@ -830,7 +830,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) { size -= 0x10; } - memcpy(ramAddr, romAddr, size); + memcpy((void*)ramAddr, (void*)romAddr, size); } else if (medium2 == mediumUnk) { AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, (s16)table->unkMediumParam); } else { @@ -956,7 +956,7 @@ s32 AudioLoad_Dma(OSIoMesg* mesg, u32 priority, s32 direction, uintptr_t devAddr if (gAudioCtx.resetTimer > 0x10) { return -1; } - memcpy(ramAddr, devAddr, size); + memcpy((void*)ramAddr, (void*)devAddr, size); return 0; } @@ -1672,7 +1672,7 @@ void AudioLoad_AsyncDmaRamUnloaded(AudioAsyncLoad* asyncLoad, size_t size) { size = ALIGN16(size); Audio_InvalDCache(asyncLoad->curRamAddr, size); osCreateMesgQueue(&asyncLoad->msgQueue, &asyncLoad->msg, 1); - memcpy(asyncLoad->curRamAddr, asyncLoad->curDevAddr, size); + memcpy((void*)asyncLoad->curRamAddr, (void*)asyncLoad->curDevAddr, size); osSendMesg(&asyncLoad->msgQueue, OS_MESG_PTR(NULL), OS_MESG_NOBLOCK); } diff --git a/mm/src/code/main.c b/mm/src/code/main.c index 046fd99e4..cacbb161a 100644 --- a/mm/src/code/main.c +++ b/mm/src/code/main.c @@ -50,8 +50,12 @@ void InitOTR(); #ifdef __GNUC__ #define SDL_main main #endif - +#ifdef __ANDROID__ +#include +int SDL_main(int argc, char** argv /* void* arg*/) { +#else void SDL_main(int argc, char** argv /* void* arg*/) { +#endif intptr_t fb; intptr_t sysHeap; s32 exit; diff --git a/mm/src/code/z_skelanime.c b/mm/src/code/z_skelanime.c index 2af58e492..86e574e30 100644 --- a/mm/src/code/z_skelanime.c +++ b/mm/src/code/z_skelanime.c @@ -1031,7 +1031,7 @@ void AnimationContext_SetLoadFrame(PlayState* play, PlayerAnimationHeader* anima s16* animData = /* ResourceMgr_LoadPlayerAnimByName*/ (animation->segmentVoid); - memcpy(ram, (uintptr_t)animData + (((sizeof(Vec3s) * limbCount + 2) * frame)), sizeof(Vec3s) * limbCount + 2); + memcpy((void*)ram, (void*)(uintptr_t)animData + (((sizeof(Vec3s) * limbCount + 2) * frame)), sizeof(Vec3s) * limbCount + 2); } }