diff --git a/gradle/build.gradle b/gradle/build.gradle index 45900fdf55..6774bbe4c5 100644 --- a/gradle/build.gradle +++ b/gradle/build.gradle @@ -28,7 +28,7 @@ buildscript { } if (Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN") == true) { - classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:4.13.3' + classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:5.0.2' } } } 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 dd55909a54..006c2f0089 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 @@ -1,5 +1,6 @@ package org.Mengine.Base; +import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; @@ -856,7 +857,17 @@ public boolean linkingOpenURL(String url) { intent.setData(uri); Intent chooser = Intent.createChooser(intent, ""); - this.startActivity(chooser); + + try { + this.startActivity(chooser); + } catch (ActivityNotFoundException e) { + MengineLog.logWarning(TAG, "linkingOpenURL url: %s catch ActivityNotFoundException: %s" + , url + , e.getLocalizedMessage() + ); + + return false; + } return true; } diff --git a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MenginePlugin.java b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MenginePlugin.java index c3381f9c6f..a51b5e2b8e 100644 --- a/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MenginePlugin.java +++ b/gradle/libraries/Mengine/src/main/java/org/Mengine/Base/MenginePlugin.java @@ -101,19 +101,27 @@ public void setState(String name, Object value) { } public String logInfo(String format, Object ... args) { - return MengineLog.logInfo(m_pluginName, format, args); + String m = MengineLog.logInfo(m_pluginName, format, args); + + return m; } public String logMessage(String format, Object ... args) { - return MengineLog.logMessage(m_pluginName, format, args); + String m = MengineLog.logMessage(m_pluginName, format, args); + + return m; } public String logWarning(String format, Object ... args) { - return MengineLog.logWarning(m_pluginName, format, args); + String m = MengineLog.logWarning(m_pluginName, format, args); + + return m; } public String logError(String format, Object ... args) { - return MengineLog.logError(m_pluginName, format, args); + String m = MengineLog.logError(m_pluginName, format, args); + + return m; } public void assertionError(String format, Object ... args) { diff --git a/gradle/plugins/AppLovin/build.gradle b/gradle/plugins/AppLovin/build.gradle index 5a4d5cf98d..10e0820806 100644 --- a/gradle/plugins/AppLovin/build.gradle +++ b/gradle/plugins/AppLovin/build.gradle @@ -25,7 +25,6 @@ def MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_NEND = Utils.existAppPlugin(project, " def MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_OGURY = Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_OGURY") def MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_PANGLE = Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_PANGLE") def MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_SMAATO = Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_SMAATO") -def MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_TAPJOY = Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_TAPJOY") def MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_UNITYADS = Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_UNITYADS") def MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_VERVE = Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_VERVE") def MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_YANDEX = Utils.existAppPlugin(project, "MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_YANDEX") @@ -52,7 +51,6 @@ Utils.logAvailable("MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_NEND", MENGINE_APP_PLU Utils.logAvailable("MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_OGURY", MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_OGURY) Utils.logAvailable("MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_PANGLE", MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_PANGLE) Utils.logAvailable("MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_SMAATO", MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_SMAATO) -Utils.logAvailable("MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_TAPJOY", MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_TAPJOY) Utils.logAvailable("MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_UNITYADS", MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_UNITYADS) Utils.logAvailable("MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_VERVE", MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_VERVE) Utils.logAvailable("MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_YANDEX", MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_YANDEX) @@ -99,7 +97,7 @@ dependencies { } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_AMAZON == true) { - implementation 'com.applovin.mediation:amazon-tam-adapter:9.8.5.0' + implementation 'com.applovin.mediation:amazon-tam-adapter:9.8.6.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_BIDMACHINE == true) { @@ -119,11 +117,11 @@ dependencies { } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_GOOGLEADMANAGER == true) { - implementation 'com.applovin.mediation:google-ad-manager-adapter:22.4.0.0' + implementation 'com.applovin.mediation:google-ad-manager-adapter:22.4.0.1' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_ADMOB == true) { - implementation 'com.applovin.mediation:google-adapter:22.4.0.0' + implementation 'com.applovin.mediation:google-adapter:22.4.0.1' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_HYPRMX == true) { @@ -131,12 +129,12 @@ dependencies { } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_INMOBI == true) { - implementation 'com.applovin.mediation:inmobi-adapter:10.5.8.0' + implementation 'com.applovin.mediation:inmobi-adapter:10.5.9.0' implementation 'com.squareup.picasso:picasso:2.71828' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_IRONSOURCE == true) { - implementation 'com.applovin.mediation:ironsource-adapter:7.5.1.0.0' + implementation 'com.applovin.mediation:ironsource-adapter:7.5.2.0.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_LIFTOFF == true) { @@ -156,47 +154,43 @@ dependencies { } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_MINTEGRAL == true) { - implementation 'com.applovin.mediation:mintegral-adapter:16.5.11.0' + implementation 'com.applovin.mediation:mintegral-adapter:16.5.31.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_MOBILEFUSE == true) { - implementation 'com.applovin.mediation:mobilefuse-adapter:1.6.2.0' + implementation 'com.applovin.mediation:mobilefuse-adapter:1.6.4.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_MYTARGET == true) { - implementation 'com.applovin.mediation:mytarget-adapter:5.18.0.0' + implementation 'com.applovin.mediation:mytarget-adapter:5.19.0.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_NEND == true) { - implementation 'com.applovin.mediation:nend-adapter:9.0.1.0' + implementation 'com.applovin.mediation:nend-adapter:10.0.0.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_OGURY == true) { - implementation 'com.applovin.mediation:ogury-presage-adapter:5.6.0.0' + implementation 'com.applovin.mediation:ogury-presage-adapter:5.6.1.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_PANGLE == true) { - implementation 'com.applovin.mediation:bytedance-adapter:5.4.1.1.0' + implementation 'com.applovin.mediation:bytedance-adapter:5.5.0.6.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_SMAATO == true) { - implementation 'com.applovin.mediation:smaato-adapter:22.3.2.0' - } - - if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_TAPJOY == true) { - implementation 'com.applovin.mediation:tapjoy-adapter:13.1.2.0' + implementation 'com.applovin.mediation:smaato-adapter:22.4.0.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_UNITYADS == true) { - implementation 'com.applovin.mediation:unityads-adapter:4.8.0.0' + implementation 'com.applovin.mediation:unityads-adapter:4.9.1.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_VERVE == true) { - implementation 'com.applovin.mediation:verve-adapter:2.19.0.0' + implementation 'com.applovin.mediation:verve-adapter:2.20.0.0' } if (MENGINE_APP_PLUGIN_APPLOVIN_MEDIATION_YANDEX == true) { - implementation 'com.applovin.mediation:yandex-adapter:5.10.0.0' + implementation 'com.applovin.mediation:yandex-adapter:6.1.0.0' } } diff --git a/src/Environment/Android/AndroidEventation.h b/src/Environment/Android/AndroidEventation.h index 35eddee260..7d002c6655 100644 --- a/src/Environment/Android/AndroidEventation.h +++ b/src/Environment/Android/AndroidEventation.h @@ -33,6 +33,7 @@ namespace Mengine m_handler = nullptr; m_commands.clear(); + m_commandsAux.clear(); } void setEventHandler( const EventHandlerPtr & _handler ) @@ -50,10 +51,9 @@ namespace Mengine protected: void invoke() override { - VectorEventHandlerCommand commands; - m_mutex->lock(); - std::swap( m_commands, commands ); + std::swap( m_commands, m_commandsAux ); + m_commands.clear(); m_mutex->unlock(); if( m_handler == nullptr ) @@ -61,10 +61,12 @@ namespace Mengine return; } - for( const LambdaEventHandler & command : commands ) + for( const LambdaEventHandler & command : m_commandsAux ) { command( m_handler ); } + + m_commandsAux.clear(); } protected: @@ -72,5 +74,6 @@ namespace Mengine EventHandlerPtr m_handler; VectorEventHandlerCommand m_commands; + VectorEventHandlerCommand m_commandsAux; }; } \ No newline at end of file diff --git a/src/Plugins/AstralaxPlugin/AstralaxService.cpp b/src/Plugins/AstralaxPlugin/AstralaxService.cpp index 10c2811263..8271a1be43 100644 --- a/src/Plugins/AstralaxPlugin/AstralaxService.cpp +++ b/src/Plugins/AstralaxPlugin/AstralaxService.cpp @@ -103,7 +103,7 @@ namespace Mengine m_atlases.clear(); - for( uint32_t index = 0; index != 256; ++index ) + for( int32_t index = 0; index != m_stageCount; ++index ) { const RenderMaterialStage * stage = m_stages[index]; diff --git a/src/Tools/ProjectBuilder/ProjectBuilder.cpp b/src/Tools/ProjectBuilder/ProjectBuilder.cpp index 7accf261f8..9dc08e1f29 100644 --- a/src/Tools/ProjectBuilder/ProjectBuilder.cpp +++ b/src/Tools/ProjectBuilder/ProjectBuilder.cpp @@ -21,8 +21,10 @@ #include "Interface/PluginServiceInterface.h" #include "Interface/LoggerServiceInterface.h" #include "Interface/ConverterServiceInterface.h" +#include "Interface/RenderMaterialServiceInterface.h" #include "Environment/Windows/WindowsIncluder.h" +#include "Environment/Windows/Win32Helper.h" #include "XmlToBinDecoder.h" #include "XmlToAekConverter.h" @@ -247,6 +249,41 @@ namespace Mengine return true; } ////////////////////////////////////////////////////////////////////////// + static void finalize() + { + SERVICE_PROVIDER_STOP(); + + PLUGIN_SERVICE() + ->unloadPlugins(); + + SERVICE_FINALIZE( ConfigService ); + SERVICE_FINALIZE( FileService ); + SERVICE_FINALIZE( PlatformService ); + SERVICE_FINALIZE( PluginService ); + SERVICE_FINALIZE( ModuleService ); + SERVICE_FINALIZE( TimepipeService ); + SERVICE_FINALIZE( TimelineService ); + SERVICE_FINALIZE( EnumeratorService ); + SERVICE_FINALIZE( MemoryService ); + SERVICE_FINALIZE( ThreadService ); + SERVICE_FINALIZE( DataService ); + SERVICE_FINALIZE( CodecService ); + SERVICE_FINALIZE( ConverterService ); + SERVICE_FINALIZE( LoggerService ); + SERVICE_FINALIZE( ArchiveService ); + SERVICE_FINALIZE( FactoryService ); + SERVICE_FINALIZE( OptionsService ); + SERVICE_FINALIZE( PrototypeService ); + SERVICE_FINALIZE( VocabularyService ); + SERVICE_FINALIZE( NotificationService ); + SERVICE_FINALIZE( EnumeratorService ); + SERVICE_FINALIZE( DateTimeSystem ); + SERVICE_FINALIZE( UnicodeSystem ); + SERVICE_FINALIZE( ThreadSystem ); + SERVICE_FINALIZE( TimeSystem ); + SERVICE_FINALIZE( PlatformSystem ); + } + ////////////////////////////////////////////////////////////////////////// static bool s_convert( const WString & _fromPath, const WString & _toPath, const WString & _convertType, const MapWParams & _params ) { MENGINE_UNUSED( _params ); @@ -677,85 +714,6 @@ static void s_error( const wchar_t * _msg ) ); } ////////////////////////////////////////////////////////////////////////// -static bool getCurrentUserRegValue( const WCHAR * _path, const WCHAR * _key, WCHAR * _value, DWORD _size ) -{ - HKEY hKey; - LONG lRes = RegOpenKeyEx( HKEY_CURRENT_USER, _path, 0, KEY_READ, &hKey ); // Check Python x32 - if( lRes == ERROR_FILE_NOT_FOUND ) - { -#ifdef _MSC_VER - lRes = RegOpenKeyEx( HKEY_CURRENT_USER, _path, 0, KEY_READ | KEY_WOW64_64KEY, &hKey ); // Check Python x64 -#endif - } - - if( lRes != ERROR_SUCCESS ) - { - LOGGER_ERROR( "%ls RegOpenKeyEx get Error %d" - , _path - , lRes - ); - - return false; - } - - DWORD dwBufferSize = _size; - LONG nError = ::RegQueryValueEx( hKey, _key, 0, NULL, (LPBYTE)_value, &dwBufferSize ); - - RegCloseKey( hKey ); - - if( nError != ERROR_SUCCESS ) - { - LOGGER_ERROR( "%ls RegQueryValueEx get Error %d" - , _path - , nError - ); - - return false; - } - - return true; -} -////////////////////////////////////////////////////////////////////////// -static bool filterCurrentUserRegValue( const WCHAR * _path, const std::function & _filter ) -{ - HKEY hKey; - LONG lOpenRes = RegOpenKeyEx( HKEY_CURRENT_USER, _path, 0, KEY_READ, &hKey ); // Check Python x32 - if( lOpenRes == ERROR_FILE_NOT_FOUND ) - { -#ifdef _MSC_VER - lOpenRes = RegOpenKeyEx( HKEY_CURRENT_USER, _path, 0, KEY_READ | KEY_WOW64_64KEY, &hKey ); // Check Python x64 -#endif - } - - if( lOpenRes != ERROR_SUCCESS ) - { - LOGGER_ERROR( "%ls RegOpenKeyEx get Error %d" - , _path - , lOpenRes - ); - - return false; - } - - for( DWORD index = 0;; ++index ) - { - WCHAR wcKeyValue[256]; - DWORD wcKeyValueSize = 256; - LONG lEnumRes = ::RegEnumKeyEx( hKey, index, wcKeyValue, &wcKeyValueSize, 0, NULL, NULL, NULL ); - - if( lEnumRes != ERROR_SUCCESS ) - { - break; - } - - _filter( wcKeyValue, wcKeyValueSize ); - } - - RegCloseKey( hKey ); - - return true; -} -////////////////////////////////////////////////////////////////////////// struct extract_String_type : public pybind::type_cast_result { @@ -989,6 +947,7 @@ bool run() LOGGER_ERROR( "initialize complete" ); + /* const WCHAR * szPythonVersionRegPath = L"SOFTWARE\\Python\\PythonCore"; std::vector vPythonVersions; @@ -1068,7 +1027,7 @@ bool run() LOGGER_ERROR( "invalid found python 3.8" ); return false; - } + } PythonDesc & desc = *it_found; @@ -1080,20 +1039,55 @@ bool run() return false; } + */ + + WCHAR currentPath[MENGINE_MAX_PATH] = {L'\0'}; + DWORD len = ::GetCurrentDirectory( MENGINE_MAX_PATH, currentPath ); + + if( len == 0 ) + { + return false; + } + + currentPath[len + 0] = MENGINE_PATH_WDELIM; + currentPath[len + 1] = L'\0'; + + WCHAR exportPath[MENGINE_MAX_PATH] = {L'\0'}; + ::wcscpy( exportPath, currentPath ); + ::wcscat( exportPath, L"Python3Lib/" ); + + WCHAR shortpath_stdPath[MENGINE_MAX_PATH] = {L'\0'}; + DWORD ShortPathNameLen = ::GetShortPathName( exportPath, shortpath_stdPath, MENGINE_MAX_PATH ); + + if( ShortPathNameLen == 0 ) + { + LOGGER_ERROR( "invalid GetShortPathName '%ls' get error %ls" + , exportPath + , Mengine::Helper::Win32GetLastErrorMessage() + ); + + return false; + } LOGGER_ERROR( "python path: %ls" - , szPythonPath + , shortpath_stdPath ); pybind::allocator_interface * allocator = Mengine::Helper::newT(); - pybind::kernel_interface * kernel = pybind::initialize( allocator, szPythonPath, MENGINE_DEBUG_VALUE( true, false ), true, false ); + pybind::kernel_interface * kernel = pybind::initialize( allocator, shortpath_stdPath, MENGINE_DEBUG_VALUE( true, false ), true, false ); if( kernel == nullptr ) { return false; } + pybind::list py_syspath( kernel ); + py_syspath.append( currentPath ); + py_syspath.append( shortpath_stdPath ); + + kernel->set_syspath( py_syspath.ptr() ); + LOGGER_ERROR( "pybind::initialize complete" ); PyObject * py_tools_module = kernel->module_init( "ToolsBuilderPlugin" ); @@ -1150,51 +1144,8 @@ bool run() kernel->incref( py_tools_module ); kernel->module_addobject( module_builtins, "ToolsBuilderPlugin", py_tools_module ); - Mengine::WChar currentDirectory[MAX_PATH] = {L'\0'}; - if( ::GetCurrentDirectory( MAX_PATH, currentDirectory ) == 0 ) - { - return false; - } - - PyObject * py_syspath = kernel->list_new( 0 ); - - { -#ifdef _MSC_VER - WCHAR * ch_buffer; - WCHAR * ch = wcstok( szPythonPath, L";", &ch_buffer ); -#elif __MINGW32__ - WCHAR * ch = wcstok( szPythonPath, L";" ); -#else -# error unssuport -#endif - - while( ch != NULL ) - { - PyObject * py_stdpath = pybind::ptr( kernel, ch ); - kernel->list_appenditem( py_syspath, py_stdpath ); - kernel->decref( py_stdpath ); - -#ifdef _MSC_VER - ch = wcstok( NULL, L";", &ch_buffer ); -#elif __MINGW32__ - ch = wcstok( NULL, L";" ); -#else -# error unssuport -#endif - } - } - - PyObject * py_currentpath = pybind::ptr( kernel, currentDirectory ); - kernel->list_appenditem( py_syspath, py_currentpath ); - kernel->decref( py_currentpath ); - - kernel->set_syspath( py_syspath ); - - kernel->decref( py_syspath ); - LPWSTR lpwCmdLine = ::GetCommandLineW(); - int nArgs = 0; LPWSTR * szArglist = ::CommandLineToArgvW( lpwCmdLine, &nArgs ); @@ -1252,6 +1203,8 @@ bool run() Mengine::Helper::deleteT( static_cast(allocator) ); + Mengine::finalize(); + return result; } ///////////////////////////////////////////////////////////////////////////////////