From 7bc549a7af9e8c11d4bbeda0ceb737aeb9cf9251 Mon Sep 17 00:00:00 2001 From: irov Date: Sun, 29 Oct 2023 16:33:09 +0200 Subject: [PATCH] add android monitor connectivity status and connection metering ref-in android logs add StringSlice remove Sentry messaging --- .../org/Mengine/Base/MengineActivity.java | 22 +-- .../org/Mengine/Base/MengineApplication.java | 183 ++++++++++++++++-- .../java/org/Mengine/Base/MengineLog.java | 62 ++++-- .../Mengine/Base/MengineNetworkTransport.java | 26 +++ .../Base/MenginePluginLoggerListener.java | 2 +- .../AppLovin/MengineAppLovinBanner.java | 2 +- .../Plugin/AppLovin/MengineAppLovinBase.java | 43 +++- .../AppLovin/MengineAppLovinInterstitial.java | 4 +- .../AppLovin/MengineAppLovinRewarded.java | 15 +- .../AppMetrica/MengineAppMetricaPlugin.java | 2 +- .../Plugin/DataDog/MengineDataDogPlugin.java | 2 +- .../MengineFirebaseCrashlyticsPlugin.java | 2 +- .../Plugin/Sentry/MengineSentryPlugin.java | 22 +-- .../Android/AndroidEnvironmentService.cpp | 15 +- .../Android/AndroidProxyLogger.cpp | 4 +- src/Kernel/CMakeLists.txt | 3 + src/Kernel/StringSlice.cpp | 34 ++++ src/Kernel/StringSlice.h | 15 ++ ...AndroidNativePythonEventHandlerInterface.h | 3 +- .../AndroidNativePythonService.cpp | 40 +++- .../AndroidNativePythonService.h | 5 +- .../AstralaxPlugin/AstralaxEmitter2.cpp | 2 +- .../ResourceValidateService.cpp | 2 +- .../SDLFileOutputStream.cpp | 10 +- .../TextValidatePlugin/TextValidatePlugin.cpp | 2 +- src/Services/LoggerService/LoggerService.cpp | 4 +- 26 files changed, 407 insertions(+), 119 deletions(-) create mode 100644 gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineNetworkTransport.java create mode 100644 src/Kernel/StringSlice.cpp create mode 100644 src/Kernel/StringSlice.h diff --git a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineActivity.java b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineActivity.java index 006c2f0089..d42d1468df 100644 --- a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineActivity.java +++ b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineActivity.java @@ -249,7 +249,7 @@ protected void onCreate(Bundle savedInstanceState) { this.setState("activity.init", "create"); - MengineLog.logInfo(TAG, "onCreate"); + MengineLog.logMessage(TAG, "onCreate"); if (mBrokenLibraries == true) { MengineLog.logWarning(TAG, "onCreate: broken libraries"); @@ -394,7 +394,7 @@ public void onMengineCurrentSceneChange(String name) { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - MengineLog.logInfo(TAG, "onActivityResult request: %d result: %d" + MengineLog.logMessage(TAG, "onActivityResult request: %d result: %d" , requestCode , resultCode ); @@ -422,7 +422,7 @@ protected void onStart(){ this.setState("activity.lifecycle", "start"); - MengineLog.logInfo(TAG, "onStart"); + MengineLog.logMessage(TAG, "onStart"); if (mBrokenLibraries == true) { MengineLog.logWarning(TAG, "onStart: broken libraries"); @@ -449,7 +449,7 @@ protected void onStop() { this.setState("activity.lifecycle", "stop"); - MengineLog.logInfo(TAG, "onStop"); + MengineLog.logMessage(TAG, "onStop"); if (mBrokenLibraries == true) { MengineLog.logWarning(TAG, "onStop: broken libraries"); @@ -478,7 +478,7 @@ protected void onPause() { this.setState("activity.lifecycle", "pause"); - MengineLog.logInfo(TAG, "onPause"); + MengineLog.logMessage(TAG, "onPause"); if (mBrokenLibraries == true) { MengineLog.logWarning(TAG, "onPause: broken libraries"); @@ -505,7 +505,7 @@ protected void onResume() { this.setState("activity.lifecycle", "resume"); - MengineLog.logInfo(TAG, "onResume"); + MengineLog.logMessage(TAG, "onResume"); if (mBrokenLibraries == true) { MengineLog.logWarning(TAG, "onResume: broken libraries"); @@ -530,7 +530,7 @@ protected void onResume() { protected void onNewIntent(Intent intent) { super.onNewIntent(intent); - MengineLog.logInfo(TAG, "onNewIntent intent: %s", intent); + MengineLog.logMessage(TAG, "onNewIntent intent: %s", intent); if (mBrokenLibraries == true) { MengineLog.logWarning(TAG, "onNewIntent: broken libraries"); @@ -549,7 +549,7 @@ protected void onNewIntent(Intent intent) { protected void onDestroy() { this.setState("activity.lifecycle", "destroy"); - MengineLog.logInfo(TAG, "onDestroy"); + MengineLog.logMessage(TAG, "onDestroy"); if (mBrokenLibraries == true) { MengineLog.logWarning(TAG, "onDestroy: broken libraries"); @@ -591,7 +591,7 @@ protected void onRestart() { this.setState("activity.lifecycle", "restart"); - MengineLog.logInfo(TAG, "onRestart"); + MengineLog.logMessage(TAG, "onRestart"); if (mBrokenLibraries == true) { MengineLog.logWarning(TAG, "onRestart: broken libraries"); @@ -618,7 +618,7 @@ public void onConfigurationChanged(Configuration newConfig) { this.setState("configuration.orientation", newConfig.orientation); - MengineLog.logInfo(TAG, "onConfigurationChanged config: %s" + MengineLog.logMessage(TAG, "onConfigurationChanged config: %s" , newConfig.toString() ); @@ -639,7 +639,7 @@ public void onConfigurationChanged(Configuration newConfig) { public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); - MengineLog.logInfo(TAG, "onRequestPermissionsResult request: %d permissions: %s grantResults: %s" + MengineLog.logMessage(TAG, "onRequestPermissionsResult request: %d permissions: %s grantResults: %s" , requestCode , Arrays.toString(permissions) , Arrays.toString(grantResults) diff --git a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineApplication.java b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineApplication.java index b4e4ef899e..758f0b90f6 100644 --- a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineApplication.java +++ b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineApplication.java @@ -10,6 +10,9 @@ import android.content.pm.PackageManager; import android.content.pm.ApplicationInfo; import android.content.res.Configuration; +import android.net.ConnectivityManager; +import android.net.Network; +import android.net.NetworkCapabilities; import android.os.Build; import android.os.Bundle; import android.provider.Settings; @@ -68,6 +71,11 @@ public String getBuildUsername() { private String m_sessionId; private long m_sessionTimestamp = -1; + private boolean m_networkAvailable = false; + private boolean m_networkUnmetered = false; + private MengineNetworkTransport m_networkTransport = MengineNetworkTransport.NETWORKTRANSPORT_UNKNOWN; + private ConnectivityManager.NetworkCallback m_networkCallback; + private ArrayList m_plugins = new ArrayList<>(); private Map m_dictionaryPlugins = new HashMap<>(); private Map m_states = new HashMap<>(); @@ -510,10 +518,6 @@ public MenginePluginExtension createPluginExtension(MengineActivity activity, Me } public void onMengineCaughtException(Throwable throwable) { - MengineLog.logInfo(TAG, "onMengineCaughtException: %s" - , throwable.getLocalizedMessage() - ); - String message = throwable.getLocalizedMessage(); this.setState("exception.message", message); @@ -548,7 +552,7 @@ public void showToast(String format, Object ... args) { public void showAlertDialog(String format, Object ... args) { String message = MengineLog.buildTotalMsg(format, args); - MengineLog.logInfo(TAG, "show alert dialog: %s" + MengineLog.logMessage(TAG, "show alert dialog: %s" , message ); @@ -602,11 +606,121 @@ private boolean isMainProcess() { return true; } + private void initializeMonitorConnectivityStatusAndConnectionMetering() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + return; + } + + ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() { + @Override + public void onAvailable(@NonNull Network network) { + super.onAvailable(network); + + MengineLog.logMessage(TAG, "NetworkCallback onAvailable"); + + m_networkAvailable = true; + } + + @Override + public void onLost(@NonNull Network network) { + super.onLost(network); + + MengineLog.logMessage(TAG, "NetworkCallback onLost"); + + m_networkAvailable = false; + } + + private MengineNetworkTransport getNetworkTransport(@NonNull NetworkCapabilities networkCapabilities) { + if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) == true) { + return MengineNetworkTransport.NETWORKTRANSPORT_CELLULAR; + } + + if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) == true) { + return MengineNetworkTransport.NETWORKTRANSPORT_WIFI; + } + + if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_BLUETOOTH) == true) { + return MengineNetworkTransport.NETWORKTRANSPORT_BLUETOOTH; + } + + if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) == true) { + return MengineNetworkTransport.NETWORKTRANSPORT_ETHERNET; + } + + if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_VPN) == true) { + return MengineNetworkTransport.NETWORKTRANSPORT_VPN; + } + + if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI_AWARE) == true) { + return MengineNetworkTransport.NETWORKTRANSPORT_WIFI_AWARE; + } + + if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_LOWPAN) == true) { + return MengineNetworkTransport.NETWORKTRANSPORT_LOWPAN; + } + + if (networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_USB) == true) { + return MengineNetworkTransport.NETWORKTRANSPORT_USB; + } + + return MengineNetworkTransport.NETWORKTRANSPORT_UNKNOWN; + } + + @Override + public void onCapabilitiesChanged(@NonNull Network network, @NonNull NetworkCapabilities networkCapabilities) { + super.onCapabilitiesChanged(network, networkCapabilities); + final boolean unmetered = networkCapabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED); + + MengineNetworkTransport transport = this.getNetworkTransport(networkCapabilities); + + MengineLog.logMessage(TAG, "NetworkCallback onCapabilitiesChanged unmetered: %b transport: %s" + , unmetered + , transport + ); + + m_networkUnmetered = unmetered; + m_networkTransport = transport; + } + }; + + Context context = this.getApplicationContext(); + + ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(ConnectivityManager.class); + connectivityManager.registerDefaultNetworkCallback(networkCallback); + + m_networkCallback = networkCallback; + } + + private void finalizeMonitorConnectivityStatusAndConnectionMetering() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + return; + } + + if (m_networkCallback == null) { + return; + } + + Context context = this.getApplicationContext(); + + ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(ConnectivityManager.class); + connectivityManager.registerDefaultNetworkCallback(m_networkCallback); + + m_networkCallback = null; + } + @Override public void onCreate() { super.onCreate(); boolean isMainProcess = this.isMainProcess(); + String versionName = this.getVersionName(); + int versionCode = this.getVersionCode(); + + MengineLog.logMessage(TAG, "onCreate isMainProcess: %b VersionName: %s [%d]" + , isMainProcess + , versionName + , versionCode + ); List applicationListeners = this.getApplicationListeners(); @@ -634,6 +748,8 @@ public void onCreate() { this.setState("application.init", "started"); + this.initializeMonitorConnectivityStatusAndConnectionMetering(); + try { SDL.loadLibrary("SDLApplication"); } catch (UnsatisfiedLinkError e) { @@ -653,8 +769,6 @@ public void onCreate() { MengineLog.setMengineApplication(this); MengineAnalytics.setMengineApplication(this); - MengineLog.logInfo(TAG, "onCreate"); - if (this.getMetaDataBoolean("mengine.secure.allow_android_id", true) == true) { m_androidId = this.getSecureAndroidId(); } else { @@ -746,10 +860,47 @@ public void onCreate() { MengineAnalytics.addContextGetterParameterLong("connection", new MengineAnalyticsGetter() { @Override public Long get() { - Context context = MengineApplication.this.getApplicationContext(); - int status = MengineUtils.getConectivityStatus(context); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + return -3L; + } + + if (m_networkAvailable == false) { + return -2L; + } + + if (m_networkTransport == MengineNetworkTransport.NETWORKTRANSPORT_CELLULAR) { + return 1L; + } + + if (m_networkTransport == MengineNetworkTransport.NETWORKTRANSPORT_WIFI) { + return 2L; + } - return Long.valueOf(status); + if (m_networkTransport == MengineNetworkTransport.NETWORKTRANSPORT_BLUETOOTH) { + return 3L; + } + + if (m_networkTransport == MengineNetworkTransport.NETWORKTRANSPORT_ETHERNET) { + return 4L; + } + + if (m_networkTransport == MengineNetworkTransport.NETWORKTRANSPORT_VPN) { + return 5L; + } + + if (m_networkTransport == MengineNetworkTransport.NETWORKTRANSPORT_WIFI_AWARE) { + return 6L; + } + + if (m_networkTransport == MengineNetworkTransport.NETWORKTRANSPORT_LOWPAN) { + return 7L; + } + + if (m_networkTransport == MengineNetworkTransport.NETWORKTRANSPORT_USB) { + return 8L; + } + + return -1L; } }); @@ -812,7 +963,7 @@ public Long get() { @Override public void onTerminate() { - MengineLog.logInfo(TAG, "onTerminate"); + MengineLog.logMessage(TAG, "onTerminate"); List applicationListeners = this.getApplicationListeners(); @@ -824,6 +975,8 @@ public void onTerminate() { plugin.onFinalize(this); } + this.finalizeMonitorConnectivityStatusAndConnectionMetering(); + MengineLog.setMengineApplication(null); MengineAnalytics.setMengineApplication(null); @@ -852,7 +1005,7 @@ public void attachBaseContext(Context base) { MultiDex.install(this); - MengineLog.logInfo(TAG, "attachBaseContext"); + MengineLog.logMessage(TAG, "attachBaseContext"); List applicationListeners = this.getApplicationListeners(); @@ -865,7 +1018,7 @@ public void attachBaseContext(Context base) { public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); - MengineLog.logInfo(TAG, "onConfigurationChanged config: %s" + MengineLog.logMessage(TAG, "onConfigurationChanged config: %s" , newConfig.toString() ); @@ -876,11 +1029,11 @@ public void onConfigurationChanged(@NonNull Configuration newConfig) { } } - public void onMengineLogger(String category, int level, int filter, int color, String msg) { + public void onMengineLogger(int level, String category, String msg) { List listeners = this.getLoggerListeners(); for(MenginePluginLoggerListener l : listeners) { - l.onMengineLogger(this, category, level, filter, color, msg); + l.onMengineLogger(this, level, category, msg); } } diff --git a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineLog.java b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineLog.java index fc36cc43cb..e0235a9e89 100644 --- a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineLog.java +++ b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineLog.java @@ -29,6 +29,7 @@ static class HistoryRecord public int level; public String tag; public String message; + public MengineApplication application; }; private static ArrayList m_history = new ArrayList<>(); @@ -40,9 +41,13 @@ public static void setMengineApplication(MengineApplication application) { public static void onMengineInitializeBaseServices(MengineActivity activity) { MengineLog.m_initializeBaseServices = true; - for (HistoryRecord record : m_history) { - synchronized (MengineLog.m_lock) { + synchronized (MengineLog.m_lock) { + for (HistoryRecord record : m_history) { AndroidEnvironmentService_log(record.level, record.tag, record.message); + + if (record.application == null) { + MengineLog.m_application.onMengineLogger(record.level, record.tag, record.message); + } } } @@ -89,21 +94,22 @@ private static String log(int level, String tag, String format, Object ... args) MengineLog.logLevel(level, tag, totalMsg); - if( MengineLog.m_initializeBaseServices == true ) { - synchronized (MengineLog.m_lock) { + synchronized (MengineLog.m_lock) { + if (MengineLog.m_initializeBaseServices == true) { AndroidEnvironmentService_log(level, tag, totalMsg); + } else { + HistoryRecord record = new HistoryRecord(); + record.level = level; + record.tag = tag; + record.message = totalMsg; + record.application = MengineLog.m_application; + + MengineLog.m_history.add(record); } - } else { - HistoryRecord record = new HistoryRecord(); - record.level = level; - record.tag = tag; - record.message = totalMsg; - - MengineLog.m_history.add(record); } if (MengineLog.m_application != null) { - MengineLog.m_application.onMengineLogger(tag, level, 0, 0, totalMsg); + MengineLog.m_application.onMengineLogger(level, tag, totalMsg); } return totalMsg; @@ -114,7 +120,9 @@ public static String logVerbose(String tag, String format, Object ... args) { return ""; } - return MengineLog.log(LM_VERBOSE, tag, format, args); + String m = MengineLog.log(LM_VERBOSE, tag, format, args); + + return m; } public static String logDebug(String tag, String format, Object ... args) { @@ -122,7 +130,9 @@ public static String logDebug(String tag, String format, Object ... args) { return ""; } - return MengineLog.log(LM_DEBUG, tag, format, args); + String m = MengineLog.log(LM_DEBUG, tag, format, args); + + return m; } public static String logInfo(String tag, String format, Object ... args) { @@ -130,27 +140,39 @@ public static String logInfo(String tag, String format, Object ... args) { return ""; } - return MengineLog.log(LM_INFO, tag, format, args); + String m = MengineLog.log(LM_INFO, tag, format, args); + + return m; } public static String logMessage(String tag, String format, Object ... args) { - return MengineLog.log(LM_MESSAGE, tag, format, args); + String m = MengineLog.log(LM_MESSAGE, tag, format, args); + + return m; } public static String logWarning(String tag, String format, Object ... args) { - return MengineLog.log(LM_WARNING, tag, format, args); + String m = MengineLog.log(LM_WARNING, tag, format, args); + + return m; } public static String logFatal(String tag, String format, Object ... args) { - return MengineLog.log(LM_FATAL, tag, format, args); + String m = MengineLog.log(LM_FATAL, tag, format, args); + + return m; } public static String logMessageRelease(String tag, String format, Object ... args) { - return MengineLog.log(LM_MESSAGE_RELEASE, tag, format, args); + String m = MengineLog.log(LM_MESSAGE_RELEASE, tag, format, args); + + return m; } public static String logError(String tag, String format, Object ... args) { - return MengineLog.log(LM_ERROR, tag, format, args); + String m = MengineLog.log(LM_ERROR, tag, format, args); + + return m; } public static String buildTotalMsg(String format, Object ... args) { diff --git a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineNetworkTransport.java b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineNetworkTransport.java new file mode 100644 index 0000000000..281ebb35c8 --- /dev/null +++ b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MengineNetworkTransport.java @@ -0,0 +1,26 @@ +package org.Mengine.Base; + +public class MengineNetworkTransport { + public final static MengineNetworkTransport NETWORKTRANSPORT_CELLULAR = new MengineNetworkTransport("NETWORKTRANSPORT_CELLULAR"); + public final static MengineNetworkTransport NETWORKTRANSPORT_WIFI = new MengineNetworkTransport("NETWORKTRANSPORT_WIFI"); + public final static MengineNetworkTransport NETWORKTRANSPORT_BLUETOOTH = new MengineNetworkTransport("NETWORKTRANSPORT_BLUETOOTH"); + public final static MengineNetworkTransport NETWORKTRANSPORT_ETHERNET = new MengineNetworkTransport("NETWORKTRANSPORT_ETHERNET"); + public final static MengineNetworkTransport NETWORKTRANSPORT_VPN = new MengineNetworkTransport("NETWORKTRANSPORT_VPN"); + public final static MengineNetworkTransport NETWORKTRANSPORT_WIFI_AWARE = new MengineNetworkTransport("NETWORKTRANSPORT_WIFI_AWARE"); + public final static MengineNetworkTransport NETWORKTRANSPORT_LOWPAN = new MengineNetworkTransport("NETWORKTRANSPORT_LOWPAN"); + public final static MengineNetworkTransport NETWORKTRANSPORT_USB = new MengineNetworkTransport("NETWORKTRANSPORT_USB"); + public final static MengineNetworkTransport NETWORKTRANSPORT_UNKNOWN = new MengineNetworkTransport("NETWORKTRANSPORT_UNKNOWN"); + + private final String m_name; + + MengineNetworkTransport(String name) { + m_name = name; + } + + public String getName() { + return m_name; + } + public String toString() { + return m_name; + } +} \ No newline at end of file diff --git a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MenginePluginLoggerListener.java b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MenginePluginLoggerListener.java index 08d38374b6..e5b6b7a181 100644 --- a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MenginePluginLoggerListener.java +++ b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MenginePluginLoggerListener.java @@ -1,5 +1,5 @@ package org.Mengine.Base; public interface MenginePluginLoggerListener extends MenginePluginInterface { - void onMengineLogger(MengineApplication application, String category, int level, int filter, int color, String msg); + void onMengineLogger(MengineApplication application, int level, String category, String msg); } diff --git a/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinBanner.java b/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinBanner.java index c50b94adb8..8b94544a34 100644 --- a/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinBanner.java +++ b/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinBanner.java @@ -161,7 +161,7 @@ public void onAdRequestStarted(String adUnitId) { @Override public void onAdLoaded(MaxAd ad) { - this.logMaxAd( "Banner","onAdLoaded", ad); + this.logMaxAd("Banner","onAdLoaded", ad); String adUnitId = ad.getAdUnitId(); diff --git a/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinBase.java b/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinBase.java index be7b783cd9..40a0f3f179 100644 --- a/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinBase.java +++ b/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinBase.java @@ -8,10 +8,9 @@ import com.applovin.mediation.MaxError; import com.applovin.mediation.MaxMediatedNetworkInfo; import com.applovin.mediation.MaxNetworkResponseInfo; +import com.applovin.mediation.MaxReward; import org.Mengine.Base.MengineAnalyticsEventBuilder; -import org.Mengine.Base.MengineApplication; -import org.Mengine.Base.MengineUtils; import java.util.List; import java.util.Locale; @@ -27,14 +26,6 @@ public void destroy() { m_plugin = null; } - protected int getConectivityStatus() { - MengineApplication application = m_plugin.getMengineApplication(); - Context context = application.getApplicationContext(); - int status = MengineUtils.getConectivityStatus(context); - - return status; - } - protected String getMAAdParams(MaxAd ad) { StringBuilder sb = new StringBuilder(512); @@ -128,6 +119,23 @@ protected void logMaxAd(String type, String callback, MaxAd ad) { m_plugin.logMessage(message); } + protected void logMaxAdReward(String type, String callback, MaxAd ad, MaxReward reward) { + StringBuilder sb = new StringBuilder(512); + + sb.append(String.format(Locale.US, "[%s] callback: %s\n", type, callback)); + + MaxAdWaterfallInfo waterfall = ad.getWaterfall(); + + this.writeMaxAdWaterfallInfo(sb, waterfall); + this.writeMaxReward(sb, reward); + + sb.setLength(sb.length() - 1); //remove last '\n' + + String message = sb.toString(); + + m_plugin.logMessage(message); + } + protected void logMaxError(String type, String callback, String adUnitId, MaxError error) { StringBuilder sb = new StringBuilder(512); @@ -171,7 +179,22 @@ protected void writeMaxAdWaterfallInfo(StringBuilder sb, MaxAdWaterfallInfo wate } } + protected void writeMaxReward(StringBuilder sb, MaxReward reward) { + if (reward == null) { + return; + } + + String label = reward.getLabel(); + int amount = reward.getAmount(); + + sb.append(String.format(Locale.US, "Reward Label: %s Amount: %d\n", label, amount)); + } + protected void writeMaxNetworkResponseInfo(StringBuilder sb, MaxNetworkResponseInfo networkResponse) { + if (networkResponse == null) { + return; + } + MaxMediatedNetworkInfo responseMediatedNetwork = networkResponse.getMediatedNetwork(); MaxNetworkResponseInfo.AdLoadState responseAdLoadState = networkResponse.getAdLoadState(); long responseLatencyMillis = networkResponse.getLatencyMillis(); diff --git a/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinInterstitial.java b/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinInterstitial.java index 62fc3f96cc..6b3257b42c 100644 --- a/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinInterstitial.java +++ b/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinInterstitial.java @@ -76,7 +76,7 @@ public void loadAd() { m_requestId = m_enumeratorRequest++; - m_plugin.logInfo("[Interstitial] loadAd adUnitId: %s request: %d attempt: %d" + m_plugin.logMessage("[Interstitial] loadAd adUnitId: %s request: %d attempt: %d" , adUnitId , m_requestId , m_retryAttempt @@ -159,7 +159,7 @@ public boolean showInterstitial(String placement) { @Override public void onAdRequestStarted(String adUnitId) { - m_plugin.logInfo("[Interstitial] onAdRequestStarted adUnitId: %s request: %d attempt: %d" + m_plugin.logMessage("[Interstitial] onAdRequestStarted adUnitId: %s request: %d attempt: %d" , adUnitId , m_requestId , m_retryAttempt diff --git a/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinRewarded.java b/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinRewarded.java index 773d7279ca..53987bb67f 100644 --- a/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinRewarded.java +++ b/gradle/plugins/AppLovin/src/main/java/org/Mengine/Plugin/AppLovin/MengineAppLovinRewarded.java @@ -75,7 +75,7 @@ public void loadAd() { String adUnitId = m_rewardedAd.getAdUnitId(); - m_plugin.logInfo("[Rewarded] loadAd adUnitId: %s request: %d attempt: %d" + m_plugin.logMessage("[Rewarded] loadAd adUnitId: %s request: %d attempt: %d" , adUnitId , m_enumeratorRequest , m_retryAttempt @@ -191,7 +191,7 @@ public boolean showRewarded(String placement) { @Override public void onAdRequestStarted(String adUnitId) { - m_plugin.logInfo("[Rewarded] onAdRequestStarted adUnitId: %s request: %d attempt: %d" + m_plugin.logMessage("[Rewarded] onAdRequestStarted adUnitId: %s request: %d attempt: %d" , adUnitId , m_requestId , m_retryAttempt @@ -222,7 +222,7 @@ public void onRewardedVideoCompleted(MaxAd ad) { @Override public void onUserRewarded(MaxAd ad, MaxReward reward) { - this.logMaxAd("Rewarded", "onUserRewarded", ad); + this.logMaxAdReward("Rewarded", "onUserRewarded", ad, reward); String adUnitId = ad.getAdUnitId(); String placement = ad.getPlacement(); @@ -230,18 +230,13 @@ public void onUserRewarded(MaxAd ad, MaxReward reward) { String label = reward.getLabel(); int amount = reward.getAmount(); - m_plugin.logInfo("MaxReward %s [%d]" - , label - , amount - ); - this.buildEvent("mng_ad_rewarded_user_rewarded") .addParameterString("ad_unit_id", adUnitId) .addParameterString("placement", placement) .addParameterLong("request_id", m_requestId) .addParameterJSON("ad", this.getMAAdParams(ad)) - .addParameterString("label", label) - .addParameterLong("amount", amount) + .addParameterString("reward_label", label) + .addParameterLong("reward_amount", amount) .log(); m_plugin.pythonCall("onApplovinRewardedOnUserRewarded", adUnitId, label, amount); diff --git a/gradle/plugins/AppMetrica/src/main/java/org/Mengine/Plugin/AppMetrica/MengineAppMetricaPlugin.java b/gradle/plugins/AppMetrica/src/main/java/org/Mengine/Plugin/AppMetrica/MengineAppMetricaPlugin.java index 9df0a785c7..f5d02187d3 100644 --- a/gradle/plugins/AppMetrica/src/main/java/org/Mengine/Plugin/AppMetrica/MengineAppMetricaPlugin.java +++ b/gradle/plugins/AppMetrica/src/main/java/org/Mengine/Plugin/AppMetrica/MengineAppMetricaPlugin.java @@ -171,7 +171,7 @@ public void onMengineCaughtException(MengineApplication activity, Throwable thro } @Override - public void onMengineLogger(MengineApplication application, String category, int level, int filter, int color, String msg) { + public void onMengineLogger(MengineApplication application, int level, String category, String msg) { if (BuildConfig.DEBUG == true) { return; } diff --git a/gradle/plugins/DataDog/src/main/java/org/Mengine/Plugin/DataDog/MengineDataDogPlugin.java b/gradle/plugins/DataDog/src/main/java/org/Mengine/Plugin/DataDog/MengineDataDogPlugin.java index 156031e539..8fe77d2bd4 100644 --- a/gradle/plugins/DataDog/src/main/java/org/Mengine/Plugin/DataDog/MengineDataDogPlugin.java +++ b/gradle/plugins/DataDog/src/main/java/org/Mengine/Plugin/DataDog/MengineDataDogPlugin.java @@ -156,7 +156,7 @@ public void onDestroy(MengineActivity activity) { } @Override - public void onMengineLogger(MengineApplication application, String tag, int level, int filter, int color, String msg) { + public void onMengineLogger(MengineApplication application, int level, String tag, String msg) { if (m_loggerDataDog == null) { return; } diff --git a/gradle/plugins/FirebaseCrashlytics/src/main/java/org/Mengine/Plugin/FirebaseCrashlytics/MengineFirebaseCrashlyticsPlugin.java b/gradle/plugins/FirebaseCrashlytics/src/main/java/org/Mengine/Plugin/FirebaseCrashlytics/MengineFirebaseCrashlyticsPlugin.java index 78b843093f..06e2a74098 100644 --- a/gradle/plugins/FirebaseCrashlytics/src/main/java/org/Mengine/Plugin/FirebaseCrashlytics/MengineFirebaseCrashlyticsPlugin.java +++ b/gradle/plugins/FirebaseCrashlytics/src/main/java/org/Mengine/Plugin/FirebaseCrashlytics/MengineFirebaseCrashlyticsPlugin.java @@ -125,7 +125,7 @@ public void testCrash() { } @Override - public void onMengineLogger(MengineApplication application, String category, int level, int filter, int color, String msg) { + public void onMengineLogger(MengineApplication application, int level, String category, String msg) { if (BuildConfig.DEBUG == true) { return; } diff --git a/gradle/plugins/Sentry/src/main/java/org/Mengine/Plugin/Sentry/MengineSentryPlugin.java b/gradle/plugins/Sentry/src/main/java/org/Mengine/Plugin/Sentry/MengineSentryPlugin.java index b84169496d..cf43a7c04f 100644 --- a/gradle/plugins/Sentry/src/main/java/org/Mengine/Plugin/Sentry/MengineSentryPlugin.java +++ b/gradle/plugins/Sentry/src/main/java/org/Mengine/Plugin/Sentry/MengineSentryPlugin.java @@ -2,23 +2,19 @@ import android.content.Context; -import org.Mengine.Base.BuildConfig; import org.Mengine.Base.MengineActivity; import org.Mengine.Base.MengineApplication; import org.Mengine.Base.MengineEvent; -import org.Mengine.Base.MengineLog; import org.Mengine.Base.MenginePlugin; import org.Mengine.Base.MenginePluginApplicationListener; import org.Mengine.Base.MenginePluginEngineListener; import org.Mengine.Base.MenginePluginInvalidInitializeException; -import org.Mengine.Base.MenginePluginLoggerListener; import io.sentry.Sentry; -import io.sentry.SentryLevel; import io.sentry.android.core.SentryAndroid; import io.sentry.protocol.User; -public class MengineSentryPlugin extends MenginePlugin implements MenginePluginLoggerListener, MenginePluginApplicationListener, MenginePluginEngineListener { +public class MengineSentryPlugin extends MenginePlugin implements MenginePluginApplicationListener, MenginePluginEngineListener { public static final String PLUGIN_NAME = "Sentry"; public static final boolean PLUGIN_EMBEDDING = true; @@ -146,22 +142,6 @@ public void onMengineCreateApplication(MengineActivity activity) { }); } - @Override - public void onMengineLogger(MengineApplication application, String category, int level, int filter, int color, String msg) { - if (BuildConfig.DEBUG == true) { - return; - } - - switch (level) { - case MengineLog.LM_ERROR: - Sentry.captureMessage("[" + category + "] " + msg, SentryLevel.ERROR); - break; - case MengineLog.LM_FATAL: - Sentry.captureMessage("[" + category + "] " + msg, SentryLevel.FATAL); - break; - } - } - @Override public void onMengineCaughtException(MengineApplication activity, Throwable throwable) { this.recordException(throwable); diff --git a/src/Environment/Android/AndroidEnvironmentService.cpp b/src/Environment/Android/AndroidEnvironmentService.cpp index f82252efa2..48f13189b8 100644 --- a/src/Environment/Android/AndroidEnvironmentService.cpp +++ b/src/Environment/Android/AndroidEnvironmentService.cpp @@ -23,6 +23,7 @@ #include "Kernel/ProxyLogger.h" #include "Kernel/DocumentHelper.h" #include "Kernel/LoggerHelper.h" +#include "Kernel/StringSlice.h" #include "Config/StdString.h" #include "Config/StdIntTypes.h" @@ -201,14 +202,16 @@ extern "C" jclass jclass_Writer = env->GetObjectClass( _writer ); jmethodID jmethodID_Writer_write_String = env->GetMethodID( jclass_Writer, "write", "(Ljava/lang/String;)V" ); - const void * data_value = memory->getBuffer(); + const Mengine::Char * data_value = memory->getBuffer(); size_t data_size = memory->getSize(); - MENGINE_UNUSED( data_size ); - - jstring jvalue = env->NewStringUTF( (const Mengine::Char *)data_value ); - env->CallVoidMethod( _writer, jmethodID_Writer_write_String, jvalue ); - env->DeleteLocalRef( jvalue ); + Mengine::Char jvalue_str[1024 + 1] = {'\0'}; + Mengine::Helper::stringSlice( data_value, data_size, jvalue_str, 1024, [env, _writer, jmethodID_Writer_write_String]( const Mengine::Char * _str ) + { + jstring jvalue = env->NewStringUTF( _str ); + env->CallVoidMethod( _writer, jmethodID_Writer_write_String, jvalue ); + env->DeleteLocalRef( jvalue ); + }); env->DeleteLocalRef( jclass_Writer ); diff --git a/src/Environment/Android/AndroidProxyLogger.cpp b/src/Environment/Android/AndroidProxyLogger.cpp index acbe982b30..47d44faee2 100644 --- a/src/Environment/Android/AndroidProxyLogger.cpp +++ b/src/Environment/Android/AndroidProxyLogger.cpp @@ -57,8 +57,6 @@ namespace Mengine jstring category_jstring = jenv->NewStringUTF( _message.category ); ELoggerLevel level = _message.level; - uint32_t filter = _message.filter; - uint32_t color = _message.color; const Char * data_value = _message.data; size_t data_size = _message.size; @@ -70,7 +68,7 @@ namespace Mengine jstring data_jstring = jenv->NewStringUTF( msg ); ANDROID_ENVIRONMENT_SERVICE() - ->callVoidApplicationMethod( jenv, "onMengineLogger", "(Ljava/lang/String;IIILjava/lang/String;)V", category_jstring, level, filter, color, data_jstring ); + ->callVoidApplicationMethod( jenv, "onMengineLogger", "(ILjava/lang/String;Ljava/lang/String;)V", level, category_jstring, data_jstring ); jenv->DeleteLocalRef( category_jstring ); jenv->DeleteLocalRef( data_jstring ); diff --git a/src/Kernel/CMakeLists.txt b/src/Kernel/CMakeLists.txt index 56eedf91d1..4e5274d49a 100644 --- a/src/Kernel/CMakeLists.txt +++ b/src/Kernel/CMakeLists.txt @@ -631,6 +631,9 @@ Core StringSplit.h StringSplit.cpp + StringSlice.h + StringSlice.cpp + StaticString.h StaticString.cpp diff --git a/src/Kernel/StringSlice.cpp b/src/Kernel/StringSlice.cpp new file mode 100644 index 0000000000..df68cd3151 --- /dev/null +++ b/src/Kernel/StringSlice.cpp @@ -0,0 +1,34 @@ +#include "StringSlice.h" + +#include "Config/StdString.h" + +namespace Mengine +{ + namespace Helper + { + void stringSlice( const Char * _in, size_t _size, Char * _buffer, size_t _capacity, const LambdaStringSlice & _lambda ) + { + if( _size == MENGINE_UNKNOWN_SIZE ) + { + _size = MENGINE_STRLEN( _in ); + } + + size_t data_index = 0; + + for( ; data_index + 1024 < _capacity; data_index += _capacity ) + { + MENGINE_MEMCPY( _buffer, _in + data_index, _capacity ); + _buffer[_capacity] = '\0'; + + _lambda( _buffer ); + } + + if( data_index != _size ) + { + const Char * tail = _in + data_index; + + _lambda( tail ); + } + } + } +} \ No newline at end of file diff --git a/src/Kernel/StringSlice.h b/src/Kernel/StringSlice.h new file mode 100644 index 0000000000..7ec548f69d --- /dev/null +++ b/src/Kernel/StringSlice.h @@ -0,0 +1,15 @@ +#pragma once + +#include "Config/Char.h" +#include "Config/StdDef.h" + +#include "Config/Lambda.h" + +namespace Mengine +{ + namespace Helper + { + typedef Lambda LambdaStringSlice; + void stringSlice( const Char * _in, size_t _size, Char * _buffer, size_t _capacity, const LambdaStringSlice & _lambda ); + } +} diff --git a/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonEventHandlerInterface.h b/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonEventHandlerInterface.h index cdbdc09a5b..6f2f3d787c 100644 --- a/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonEventHandlerInterface.h +++ b/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonEventHandlerInterface.h @@ -12,7 +12,8 @@ namespace Mengine : public Mixin { public: - virtual void pythonMethod( const ConstString & _plugin, const ConstString & _method, jobjectArray _args ) = 0; + virtual bool hasPythonMethod( const ConstString & _plugin, const ConstString & _method ) const = 0; + virtual void callPythonMethod( const ConstString & _plugin, const ConstString & _method, jobjectArray _args ) const = 0; virtual void addPlugin( const ConstString & _name, jobject _plugin ) = 0; virtual void activateSemaphore( const ConstString & _name ) = 0; }; diff --git a/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonService.cpp b/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonService.cpp index dd82984b5a..a86df97147 100644 --- a/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonService.cpp +++ b/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonService.cpp @@ -13,6 +13,7 @@ #include "Kernel/Error.h" #include "Kernel/AssertionFactory.h" #include "Kernel/FactoryPool.h" +#include "Kernel/ThreadMutexScope.h" #include "Environment/Android/AndroidEnv.h" #include "Environment/Android/AndroidHelper.h" @@ -46,11 +47,16 @@ extern "C" return; } + if( s_androidNativePythonService->hasPythonMethod(plugin, method) == false ) + { + return; + } + jobjectArray new_args = (jobjectArray)env->NewGlobalRef( _args ); s_androidNativePythonService->addCommand([plugin, method, new_args]( const Mengine::AndroidNativePythonEventHandlerInterfacePtr & _handler ) { - _handler->pythonMethod( plugin, method, new_args ); + _handler->callPythonMethod( plugin, method, new_args ); } ); } ////////////////////////////////////////////////////////////////////////// @@ -137,14 +143,19 @@ namespace Mengine m_eventation = Helper::makeFactorableUnique( MENGINE_DOCUMENT_FACTORABLE ); - ThreadMutexInterfacePtr mutex = THREAD_SYSTEM() + ThreadMutexInterfacePtr eventationMutex = THREAD_SYSTEM() ->createMutex( MENGINE_DOCUMENT_FACTORABLE ); - if( m_eventation->initialize( mutex ) == false ) + if( m_eventation->initialize( eventationMutex ) == false ) { return false; } + ThreadMutexInterfacePtr callbacksMutex = THREAD_SYSTEM() + ->createMutex( MENGINE_DOCUMENT_FACTORABLE ); + + m_callbacksMutex = callbacksMutex; + s_androidNativePythonService = this; m_eventation->setEventHandler( AndroidNativePythonEventHandlerInterfacePtr::from( this ) ); @@ -190,6 +201,8 @@ namespace Mengine s_androidNativePythonService = nullptr; + m_callbacksMutex = nullptr; + m_semaphoreListeners.clear(); m_callbacks.clear(); @@ -218,18 +231,33 @@ namespace Mengine m_eventation->addCommand( _command ); } ////////////////////////////////////////////////////////////////////////// - void AndroidNativePythonService::pythonMethod( const ConstString & _plugin, const ConstString & _method, jobjectArray _args ) + bool AndroidNativePythonService::hasPythonMethod( const ConstString & _plugin, const ConstString & _method ) const + { + MENGINE_THREAD_MUTEX_SCOPE( m_callbacksMutex ); + + MapAndroidCallbacks::const_iterator it_found = m_callbacks.find( Utility::make_pair( _plugin, _method ) ); + + if( it_found == m_callbacks.end() ) + { + return false; + } + + return true; + } + ////////////////////////////////////////////////////////////////////////// + void AndroidNativePythonService::callPythonMethod( const ConstString & _plugin, const ConstString & _method, jobjectArray _args ) const { JNIEnv * jenv = Mengine_JNI_GetEnv(); MENGINE_ASSERTION_MEMORY_PANIC( jenv, "invalid get jenv" ); - LOGGER_INFO( "android", "call python plugin '%s' method '%s' [%s]" + LOGGER_INFO( "android", "call python plugin '%s' method '%s'" , _plugin.c_str() , _method.c_str() - , (m_callbacks.find( Utility::make_pair( _plugin, _method ) ) != m_callbacks.end() ? "Found" : "NOT-FOUND") ); + MENGINE_THREAD_MUTEX_SCOPE( m_callbacksMutex ); + MapAndroidCallbacks::const_iterator it_found = m_callbacks.find( Utility::make_pair( _plugin, _method ) ); if( it_found == m_callbacks.end() ) diff --git a/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonService.h b/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonService.h index b77375d19d..018c403fcb 100644 --- a/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonService.h +++ b/src/Plugins/AndroidNativePythonPlugin/AndroidNativePythonService.h @@ -37,7 +37,8 @@ namespace Mengine void addCommand( const LambdaPythonEventHandler & _command ); public: - void pythonMethod( const ConstString & _plugin, const ConstString & _method, jobjectArray _args ) override; + bool hasPythonMethod( const ConstString & _plugin, const ConstString & _method ) const override; + void callPythonMethod( const ConstString & _plugin, const ConstString & _method, jobjectArray _args ) const override; void addPlugin( const ConstString & _name, jobject _plugin ) override; void activateSemaphore( const ConstString & _name ) override; @@ -82,6 +83,8 @@ namespace Mengine typedef Map, VectorAndroidPythonCallbacks> MapAndroidCallbacks; MapAndroidCallbacks m_callbacks; + ThreadMutexInterfacePtr m_callbacksMutex; + struct AndroidSemaphoreListenerDesc { ConstString name; diff --git a/src/Plugins/AstralaxPlugin/AstralaxEmitter2.cpp b/src/Plugins/AstralaxPlugin/AstralaxEmitter2.cpp index faec026c77..03bec16e0a 100644 --- a/src/Plugins/AstralaxPlugin/AstralaxEmitter2.cpp +++ b/src/Plugins/AstralaxPlugin/AstralaxEmitter2.cpp @@ -35,7 +35,7 @@ namespace Mengine if( emitterId == 0 ) { - LOGGER_ERROR( "astralax emitter2 invalid create " ); + LOGGER_ERROR( "astralax emitter2 invalid create" ); return false; } diff --git a/src/Plugins/ResourceValidatePlugin/ResourceValidateService.cpp b/src/Plugins/ResourceValidatePlugin/ResourceValidateService.cpp index e73a2f33a4..0156ccc59c 100644 --- a/src/Plugins/ResourceValidatePlugin/ResourceValidateService.cpp +++ b/src/Plugins/ResourceValidatePlugin/ResourceValidateService.cpp @@ -89,7 +89,7 @@ namespace Mengine return; } - LOGGER_MESSAGE_RELEASE( "validate resources... " ); + LOGGER_MESSAGE_RELEASE( "validate resources..." ); bool successful = true; diff --git a/src/Plugins/SDLFileGroupPlugin/SDLFileOutputStream.cpp b/src/Plugins/SDLFileGroupPlugin/SDLFileOutputStream.cpp index 8dd92a92ed..3dbc0a5908 100644 --- a/src/Plugins/SDLFileGroupPlugin/SDLFileOutputStream.cpp +++ b/src/Plugins/SDLFileGroupPlugin/SDLFileOutputStream.cpp @@ -82,6 +82,8 @@ namespace Mengine m_rwops = rwops; + m_size = 0; + return true; } ////////////////////////////////////////////////////////////////////////// @@ -92,11 +94,11 @@ namespace Mengine return true; } - bool successful = this->flush(); - SDL_RWclose( m_rwops ); m_rwops = nullptr; + m_size = 0; + #if defined(MENGINE_PLATFORM_WINDOWS) && !defined(MENGINE_PLATFORM_UWP) if( m_withTemp == true ) { @@ -130,7 +132,7 @@ namespace Mengine } #endif - return successful; + return true; } ////////////////////////////////////////////////////////////////////////// size_t SDLFileOutputStream::write( const void * _data, size_t _size ) @@ -161,6 +163,8 @@ namespace Mengine ////////////////////////////////////////////////////////////////////////// bool SDLFileOutputStream::flush() { + //Empty + return true; } ////////////////////////////////////////////////////////////////////////// diff --git a/src/Plugins/TextValidatePlugin/TextValidatePlugin.cpp b/src/Plugins/TextValidatePlugin/TextValidatePlugin.cpp index 1625b6cfb2..13189a6aeb 100644 --- a/src/Plugins/TextValidatePlugin/TextValidatePlugin.cpp +++ b/src/Plugins/TextValidatePlugin/TextValidatePlugin.cpp @@ -56,7 +56,7 @@ namespace Mengine return; } - LOGGER_MESSAGE_RELEASE( "Validate Texts... " ); + LOGGER_MESSAGE_RELEASE( "Validate Texts..." ); bool successful = true; diff --git a/src/Services/LoggerService/LoggerService.cpp b/src/Services/LoggerService/LoggerService.cpp index 74b31cadac..b33b0cf125 100644 --- a/src/Services/LoggerService/LoggerService.cpp +++ b/src/Services/LoggerService/LoggerService.cpp @@ -396,8 +396,8 @@ namespace Mengine ////////////////////////////////////////////////////////////////////////// void LoggerService::logMessage( const LoggerMessage & _message ) { - MENGINE_ASSERTION_MEMORY_PANIC( _message.category, "please setup category for log message "); - MENGINE_ASSERTION_MEMORY_PANIC( _message.data, "please setup data for log message " ); + MENGINE_ASSERTION_MEMORY_PANIC( _message.category, "please setup category for log message" ); + MENGINE_ASSERTION_MEMORY_PANIC( _message.data, "please setup data for log message" ); NOTIFICATION_NOTIFY( NOTIFICATOR_LOGGER_BEGIN, _message );