diff --git a/platforms/android/AppPlatform_android.cpp b/platforms/android/AppPlatform_android.cpp index ceb1f9872..7e23bd8a8 100644 --- a/platforms/android/AppPlatform_android.cpp +++ b/platforms/android/AppPlatform_android.cpp @@ -280,3 +280,8 @@ AssetFile AppPlatform_android::readAssetFile(const std::string& str, bool quiet) AAsset_close(asset); return AssetFile(ssize_t(cnt), buffer); } + +std::string AppPlatform_android::getAssetPath(const std::string& path) const +{ + return path; +} diff --git a/platforms/android/AppPlatform_android.hpp b/platforms/android/AppPlatform_android.hpp index ce7f219a4..832490e67 100644 --- a/platforms/android/AppPlatform_android.hpp +++ b/platforms/android/AppPlatform_android.hpp @@ -55,6 +55,7 @@ class AppPlatform_android : public AppPlatform void setExternalStoragePath(const std::string& path); AssetFile readAssetFile(const std::string&, bool) const override; + std::string getAssetPath(const std::string&) const override; private: void changeKeyboardVisibility(bool bShown); diff --git a/platforms/android/CMakeLists.txt b/platforms/android/CMakeLists.txt index 7eab1d983..731215bce 100644 --- a/platforms/android/CMakeLists.txt +++ b/platforms/android/CMakeLists.txt @@ -24,15 +24,15 @@ target_link_libraries(nbcraft stb_image) target_link_libraries(nbcraft android) # Check for the presence of some optional asset based features. -if(EXISTS "${MC_ROOT}/game/assets/gui/background/panorama_0.png") +if(EXISTS "${NBC_ROOT}/game/assets/gui/background/panorama_0.png") target_compile_definitions(nbcraft PUBLIC FEATURE_MENU_BACKGROUND) endif() -if(EXISTS "${MC_ROOT}/game/assets/environment/clouds.png") +if(EXISTS "${NBC_ROOT}/game/assets/environment/clouds.png") target_compile_definitions(nbcraft PUBLIC FEATURE_CLOUDS) endif() -if(EXISTS "${MC_ROOT}/game/assets/misc/grasscolor.png") +if(EXISTS "${NBC_ROOT}/game/assets/misc/grasscolor.png") target_compile_definitions(nbcraft PUBLIC FEATURE_GRASS_COLOR) endif() -if(EXISTS "${MC_ROOT}/game/assets/misc/foliagecolor.png") +if(EXISTS "${NBC_ROOT}/game/assets/misc/foliagecolor.png") target_compile_definitions(nbcraft PUBLIC FEATURE_FOLIAGE_COLOR) endif() diff --git a/platforms/android/android_native_app_glue.c b/platforms/android/android_native_app_glue.c index a2341c51b..7bc12952c 100644 --- a/platforms/android/android_native_app_glue.c +++ b/platforms/android/android_native_app_glue.c @@ -26,8 +26,8 @@ #include "android_native_app_glue.h" #include -#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "ReMinecraftPE", __VA_ARGS__)) -#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "ReMinecraftPE", __VA_ARGS__)) +#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "NBCraft", __VA_ARGS__)) +#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "NBCraft", __VA_ARGS__)) /* For debug builds, always enable the debug traces in this library */ #ifndef NDEBUG diff --git a/platforms/android/main.cpp b/platforms/android/main.cpp index 0108c7c04..e99776c09 100644 --- a/platforms/android/main.cpp +++ b/platforms/android/main.cpp @@ -399,7 +399,6 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { void android_main(struct android_app* state) { struct engine engine; - memset(&engine, 0, sizeof(engine)); state->userData = &engine; state->onAppCmd = engine_handle_cmd; diff --git a/platforms/android/project/app/build.gradle b/platforms/android/project/app/build.gradle index d5f75a6f6..3f294b856 100644 --- a/platforms/android/project/app/build.gradle +++ b/platforms/android/project/app/build.gradle @@ -3,7 +3,7 @@ plugins { } android { - namespace 'com.reminecraftpe' + namespace 'org.nbcraft' compileSdk 21 // Employ a hack which copies the assets folder in to the local assets folder. @@ -43,7 +43,7 @@ android { } defaultConfig { - applicationId "com.reminecraftpe" + applicationId "org.nbcraft" minSdk 16 // Don't inspect the target SDK. You'd better not intend to upload this to the Google Play Store. //noinspection ExpiredTargetSdkVersion @@ -54,7 +54,7 @@ android { // testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { - arguments '-DANDROID_PLATFORM=android-21', '-DANDROID_STL=c++_static', '-DREMCPE_PLATFORM=android', '-DREMCPE_AUDIO_LIBRARY=opensl' + arguments '-DANDROID_PLATFORM=android-21', '-DANDROID_STL=c++_static', '-DNBC_PLATFORM=android', '-DNBC_AUDIO_LIBRARY=opensl', '-DNBC_GFX_API=OGL' abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } diff --git a/platforms/android/project/app/src/main/AndroidManifest.xml b/platforms/android/project/app/src/main/AndroidManifest.xml index b14d45171..e60b6394c 100644 --- a/platforms/android/project/app/src/main/AndroidManifest.xml +++ b/platforms/android/project/app/src/main/AndroidManifest.xml @@ -24,7 +24,7 @@ + android:value="nbcraft" /> diff --git a/platforms/android/project/app/src/main/res/values/strings.xml b/platforms/android/project/app/src/main/res/values/strings.xml index 27d02ca31..76e6c28c4 100644 --- a/platforms/android/project/app/src/main/res/values/strings.xml +++ b/platforms/android/project/app/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - ReMinecraftPE + NBCraft \ No newline at end of file diff --git a/platforms/android/project/settings.gradle b/platforms/android/project/settings.gradle index a2cd4b353..1ab966bd5 100644 --- a/platforms/android/project/settings.gradle +++ b/platforms/android/project/settings.gradle @@ -12,5 +12,5 @@ dependencyResolutionManagement { mavenCentral() } } -rootProject.name = "ReMinecraftPE" +rootProject.name = "NBCraft" include ':app' diff --git a/platforms/audio/opensl/CustomSoundSystem.hpp b/platforms/audio/opensl/CustomSoundSystem.hpp index eb3916f13..1388d0dd6 100644 --- a/platforms/audio/opensl/CustomSoundSystem.hpp +++ b/platforms/audio/opensl/CustomSoundSystem.hpp @@ -41,6 +41,7 @@ class SoundSystemOSL : public SoundSystem void destroy(); bool checkErr(SLresult res); void removeStoppedSounds(); + bool isAvailable() override; void setListenerPos(const Vec3& pos) override; void setListenerAngle(const Vec2& rot) override; void playAt(const SoundDesc& sound, const Vec3& pos, float volume, float pitch) override; diff --git a/platforms/audio/opensl/SoundSystemOSL.cpp b/platforms/audio/opensl/SoundSystemOSL.cpp index d1529b05f..c71f4661b 100644 --- a/platforms/audio/opensl/SoundSystemOSL.cpp +++ b/platforms/audio/opensl/SoundSystemOSL.cpp @@ -214,3 +214,8 @@ void SoundSystemOSL::destroy() { } + +bool SoundSystemOSL::isAvailable() override +{ + return true; +} diff --git a/source/client/app/AppPlatform.cpp b/source/client/app/AppPlatform.cpp index ef28f0f4b..31626e691 100644 --- a/source/client/app/AppPlatform.cpp +++ b/source/client/app/AppPlatform.cpp @@ -18,7 +18,9 @@ #include "compat/LegacyCPP.hpp" #include "AppPlatformListener.hpp" -AppPlatform* AppPlatform::m_singleton = nullptr; +// NOTE: don't initialize this with `nullptr`, because some compilers think ` = nullptr;` is a +// static initialization rather than just setting to null/0. +AppPlatform* AppPlatform::m_singleton = NULL; AppPlatform* AppPlatform::singleton() {