Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions platforms/android/AppPlatform_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions platforms/android/AppPlatform_android.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions platforms/android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 2 additions & 2 deletions platforms/android/android_native_app_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include "android_native_app_glue.h"
#include <android/log.h>

#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
Expand Down
1 change: 0 additions & 1 deletion platforms/android/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions platforms/android/project/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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'
}
}
Expand Down
2 changes: 1 addition & 1 deletion platforms/android/project/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!-- Tell the NativeActivity about our shared object -->
<meta-data
android:name="android.app.lib_name"
android:value="reminecraftpe" />
android:value="nbcraft" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">ReMinecraftPE</string>
<string name="app_name">NBCraft</string>
</resources>
2 changes: 1 addition & 1 deletion platforms/android/project/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ dependencyResolutionManagement {
mavenCentral()
}
}
rootProject.name = "ReMinecraftPE"
rootProject.name = "NBCraft"
include ':app'
1 change: 1 addition & 0 deletions platforms/audio/opensl/CustomSoundSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions platforms/audio/opensl/SoundSystemOSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,8 @@ void SoundSystemOSL::destroy()
{

}

bool SoundSystemOSL::isAvailable() override
{
return true;
}
4 changes: 3 additions & 1 deletion source/client/app/AppPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down