Skip to content
This repository was archived by the owner on Jul 31, 2024. It is now read-only.

fix slow-pitched audio by patching file directly#4

Merged
neobenedict merged 1 commit into
rayshift:masterfrom
segfault-bilibili:master
Jun 24, 2023
Merged

fix slow-pitched audio by patching file directly#4
neobenedict merged 1 commit into
rayshift:masterfrom
segfault-bilibili:master

Conversation

@segfault-bilibili

@segfault-bilibili segfault-bilibili commented Jun 15, 2023

Copy link
Copy Markdown
Contributor

It's reported in discord channel that after 31c73fe, (English or global version of) Memu and Nox emulators then have problem with 3.0.4, that the game probabilistically got silenced on app launch.

It's still unclear what caused this problem and how. Especially, the hook should do essentially nothing in a 48000Hz environment like Nox.

logcat from Nox Android 7 32-bit:

06-15 19:59:13.070  2181  2349 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=io.kamihama.magiatranslate/jp.f4samurai.AppActivity bnds=[1264,207][1496,366] (has extras)} from uid 1000 on display 0
06-15 19:59:13.120  1877  2406 D gralloc_nox: gralloc_alloc: Creating ashmem region of size 5763072
06-15 19:59:13.137  2181  2581 I ActivityManager: Start proc 3549:io.kamihama.magiatranslate/u0a44 for activity io.kamihama.magiatranslate/jp.f4samurai.AppActivity
06-15 19:59:13.149  3549  3549 D         : houdini no need remount
06-15 19:59:13.154  3549  3549 D houdini : [3549] Initialize library(version: 7.1.1b_x.49852 RELEASE)... successfully.
06-15 19:59:13.154  3549  3549 W art     : Unexpected CPU variant for X86 using defaults: x86
06-15 19:59:13.314  3549  3549 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
06-15 19:59:13.315  3549  3549 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
06-15 19:59:13.326  3549  3549 I FirebaseInitProvider: FirebaseApp initialization successful
06-15 19:59:13.341  3549  3549 D WM-WrkMgrInitializer: Initializing WorkManager with default configuration.
06-15 19:59:13.365  3549  3577 I FA      : App measurement is starting up, version: 12451
06-15 19:59:13.365  3549  3577 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-15 19:59:13.365  3549  3577 I FA      : To enable faster debug mode event logging run:
06-15 19:59:13.365  3549  3577 I FA      :   adb shell setprop debug.firebase.analytics.app io.kamihama.magiatranslate
06-15 19:59:13.745  3584  3584 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
06-15 19:59:14.073  3584  3584 D AndroidRuntime: CheckJNI is OFF
06-15 19:59:14.124  3549  3549 D houdini : [3549] Added shared library /data/app/io.kamihama.magiatranslate-1/lib/arm/libmadomagi_native.so for ClassLoader by Native Bridge.
06-15 19:59:14.124  3549  3549 D main    : cocos_android_app_init
06-15 19:59:14.126  3549  3549 D Cocos2dxHelper: isSupportLowLatency:true
06-15 19:59:14.127  3549  3549 D Cocos2dxHelper: sampleRate: 48000, framesPerBuffer: 2048
06-15 19:59:14.127  3549  3549 D Java_org_cocos2dx_lib_Cocos2dxHelper.cpp: nativeSetAudioDeviceInfo: sampleRate: 48000, bufferSizeInFrames: 2048
06-15 19:59:14.128  2181  2322 W ActivityManager: Unable to start service Intent { act=com.enhance.gameservice.IGameTuningService pkg=com.enhance.gameservice } U=0: not found
06-15 19:59:14.134  3584  3584 D ICU     : No timezone override file found: /data/misc/zoneinfo/current/icu/icu_tzdata.dat
06-15 19:59:14.152  3584  3584 W art     : Unexpected CPU variant for X86 using defaults: x86
06-15 19:59:14.159  3549  3549 D houdini : [3549] Added shared library /data/app/io.kamihama.magiatranslate-1/lib/arm/libbacktrace-native.so for ClassLoader by Native Bridge.
06-15 19:59:14.161  3584  3584 D         : houdini no need remount
06-15 19:59:14.176  3584  3584 E memtrack: Couldn't load memtrack module (No such file or directory)
06-15 19:59:14.176  3584  3584 E android.os.Debug: failed to load memtrack module: -2
06-15 19:59:14.177  3584  3584 I Radio-JNI: register_android_hardware_Radio DONE
06-15 19:59:14.188  3584  3584 D AndroidRuntime: Calling main entry com.android.commands.svc.Svc
06-15 19:59:14.188  2181  2556 D WifiService: setWifiEnabled: true pid=3584, uid=0
06-15 19:59:14.189  3584  3584 D AndroidRuntime: Shutting down VM
06-15 19:59:14.212  3549  3549 D AppActivity: onResume()
06-15 19:59:14.212  3549  3549 D Cocos2dxActivity: onResume()
06-15 19:59:14.219  3549  3577 I FA      : Tag Manager is not found and thus will not be used
06-15 19:59:14.230  3549  3549 D         : static std::unique_ptr<HostConnection> HostConnection::createUnique(uint32_t): call
06-15 19:59:14.230  3549  3549 D         : HostComposition ext GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 GL_OES_texture_half_float GL_EXT_robustness GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_EXT_color_buffer_float GL_EXT_texture_sRGB_decode ANDROID_gles_max_version_3_1 GL_OES_vertex_array_object GL_EXT_texture_buffer GL_EXT_copy_image GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_OES_texture_compression_astc GL_OES_EGL_image_external
06-15 19:59:14.244  3549  3549 D houdini : [3549] Added shared library /data/app/io.kamihama.magiatranslate-1/lib/arm/libuwasa.so for ClassLoader by Native Bridge.
06-15 19:59:14.244  3549  3549 I MagiaHook: Starting MagiaHook.
06-15 19:59:14.244  3549  3603 I MagiaHook: Library location: /data/app/io.kamihama.magiatranslate-1/lib/arm/libmadomagi_native.so
06-15 19:59:14.247  2517  3148 E GCM     : Missing checkin config file
06-15 19:59:14.247  2517  3148 W GCM     : GCM FAILED TO INITIALIZE - missing checkin
06-15 19:59:14.250  3549  3603 I MagiaHook: Base address: 0x4000000
06-15 19:59:14.270  3549  3606 D NetworkSecurityConfig: No Network Security Config specified, using platform default
06-15 19:59:14.289  3549  3602 D         : static std::unique_ptr<HostConnection> HostConnection::createUnique(uint32_t): call
06-15 19:59:14.291  3549  3602 D         : HostComposition ext GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 GL_OES_texture_half_float GL_EXT_robustness GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_EXT_color_buffer_float GL_EXT_texture_sRGB_decode ANDROID_gles_max_version_3_1 GL_OES_vertex_array_object GL_EXT_texture_buffer GL_EXT_copy_image GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_OES_texture_compression_astc GL_OES_EGL_image_external
06-15 19:59:14.293  3549  3602 I OpenGLRenderer: Initialized EGL, version 1.4
06-15 19:59:14.293  3549  3602 D OpenGLRenderer: Swap behavior 1
06-15 19:59:14.293  3549  3602 D EGL_emulation: rcCreateContext wated version 2.0  rc:4
06-15 19:59:14.294  3549  3603 I MagiaHook: Successfully hooked UrlConfig::resource.
06-15 19:59:14.294  3549  3603 I MagiaHook: Successfully hooked SceneLayerManager::createSceneLayer.
06-15 19:59:14.295  3549  3603 I MagiaHook: Successfully hooked http2::Http2Session::setMaxConnectionNum.
06-15 19:59:14.295  3549  3603 I MagiaHook: Successfully hooked criNcv_GetHardwareSamplingRate_ANDROID.
06-15 19:59:14.296  3549  3603 I MagiaHook: Successfully hooked cocos2d::Node::setPosition.
06-15 19:59:14.296  3549  3603 I MagiaHook: Successfully hooked cocos2d::Label::setMaxLineWidth.
06-15 19:59:14.297  3549  3603 I MagiaHook: Successfully hooked cocos2d::Label::setDimensions.
06-15 19:59:14.298  3549  3603 I MagiaHook: Successfully hooked LbUtility::getViewPosition.
06-15 19:59:14.299  3549  3603 I MagiaHook: Successfully hooked cocos2d::Label::createWithTTF.
06-15 19:59:14.299  3549  3603 I MagiaHook: Exiting hook thread.
06-15 19:59:14.320  3549  3588 D         : static std::unique_ptr<HostConnection> HostConnection::createUnique(uint32_t): call
06-15 19:59:14.326  3549  3575 E FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED
06-15 19:59:14.338  3549  3588 D         : HostComposition ext GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_EXT_texture_format_BGRA8888 GL_APPLE_texture_format_BGRA8888 GL_OES_texture_half_float GL_EXT_robustness GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float GL_OES_texture_npot GL_OES_rgb8_rgba8 GL_EXT_color_buffer_float GL_EXT_texture_sRGB_decode ANDROID_gles_max_version_3_1 GL_OES_vertex_array_object GL_EXT_texture_buffer GL_EXT_copy_image GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_OES_texture_compression_astc GL_OES_EGL_image_external
06-15 19:59:14.339  3549  3602 D EGL_emulation: eglMakeCurrent: 0xd6f95c40: ver 3 2 (tinfo 0xd6f83a30) (first time)
06-15 19:59:14.339  3549  3588 D EGL_emulation: rcCreateContext wated version 2.0  rc:4
06-15 19:59:14.361  1877  2065 D gralloc_nox: gralloc_alloc: Creating ashmem region of size 4096
06-15 19:59:14.368  1877  1902 D gralloc_nox: gralloc_alloc: Creating ashmem region of size 4096
06-15 19:59:14.382  3549  3588 D EGL_emulation: eglMakeCurrent: 0xc69bd350: ver 3 2 (tinfo 0xb52cd4a0) (first time)
06-15 19:59:14.423  3549  3588 W Adjust  : PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
06-15 19:59:14.423  3549  3588 W Adjust  : PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
06-15 19:59:14.428  3549  3588 D cocos2d-x debug info: [CSM][I]Live2D Cubism Core version: 04.01.0000 (67174400)
06-15 19:59:14.428  3549  3588 D cocos2d-x debug info:
06-15 19:59:14.428  3549  3588 D cocos2d-x debug info: [CSM][I]CubismFramework::StartUp() is complete.
06-15 19:59:14.428  3549  3588 D cocos2d-x debug info:
06-15 19:59:14.703  3612  3612 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 0 <<<<<<
06-15 19:59:14.832  3549  3588 E libOpenSLES: pAudioSrc: samplesPerSec=897794056
06-15 19:59:14.832  3549  3588 W libOpenSLES: Leaving Engine::CreateAudioPlayer (SL_RESULT_CONTENT_UNSUPPORTED)
06-15 19:59:14.832  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2021051200:failed to create OpenSLES player.
06-15 19:59:14.832  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2013101600:Failed to setup output voice of ASR.
06-15 19:59:14.832  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E16061401NC:Failed to create ASR.
06-15 19:59:14.832  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2012062215:Invalid Rack ID has been set.
06-15 19:59:14.832  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2011061727:Initialize the library before calling this function.
06-15 19:59:14.833  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2012062215:Invalid Rack ID has been set.
06-15 19:59:14.833  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2011061727:Initialize the library before calling this function.
06-15 19:59:14.833  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2012062215:Invalid Rack ID has been set.
06-15 19:59:14.833  3549  3588 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2011061727:Initialize the library before calling this function.

@neobenedict neobenedict self-assigned this Jun 15, 2023
@segfault-bilibili segfault-bilibili force-pushed the master branch 18 times, most recently from ae726e0 to 0dfc9b6 Compare June 24, 2023 02:08
@segfault-bilibili segfault-bilibili marked this pull request as ready for review June 24, 2023 02:15
@segfault-bilibili

Copy link
Copy Markdown
Contributor Author

IMHO it should be better to build two APKs.

Initially I thought the main APK should not include this audio fix at all, as it does not address the root cause. I then thought only an alternative APK should include it.

Now I think the main APK may just include this audio fix, and then an APK without it can be provided as a fallback.

@segfault-bilibili

segfault-bilibili commented Jun 24, 2023

Copy link
Copy Markdown
Contributor Author

The player may not notice that the audio sounds somewhat abnormal - until he hears the audio of correct pitch.

The direct file patching method doesn't seem to cause problem according to my tests.

Therefore, I think it would be fine to include it in the main APK, while a fallback APK without this fix should be provided as well.

@segfault-bilibili

segfault-bilibili commented Jun 24, 2023

Copy link
Copy Markdown
Contributor Author

I will continue to work on #5

@segfault-bilibili

Copy link
Copy Markdown
Contributor Author

I'll do some more tests

@segfault-bilibili segfault-bilibili marked this pull request as draft June 24, 2023 02:31
@segfault-bilibili segfault-bilibili marked this pull request as ready for review June 24, 2023 04:09
@neobenedict neobenedict merged commit c121dc3 into rayshift:master Jun 24, 2023
@segfault-bilibili

Copy link
Copy Markdown
Contributor Author

I use this snippet to let the app restart in loop:

t() {
    while true; do
        am force-stop $1;
        am start -n $1/jp.f4samurai.AppActivity $1;
        for i in `seq 1 10`; do
            sleep 1; input tap 500 500;
        done;
    done;
}

t io.kamihama.magiatranslate
t io.kamihama.magiatranslate.patched
t com.aniplex.magireco

@segfault-bilibili

Copy link
Copy Markdown
Contributor Author

I'm doing some more experiment on this: 2f05c6a

Now the hook does nothing but printing return value to logcat.

@segfault-bilibili

segfault-bilibili commented Jun 25, 2023

Copy link
Copy Markdown
Contributor Author

MuMu emluator (Android 6)

MuMu Android 6 emulator (CN, version 2.7.26.0, x64),

Here it just played audio in slow pitch "as normal".

logcat:

06-25 17:04:09.575   736   814 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity bnds=[467,344][796,533]} from uid 1000 on display 0
06-25 17:04:09.584  1031  1031 W ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:805 android.content.ContextWrapper.sendBroadcast:401 com.mumu.launcher.t2.d:9 com.mumu.launcher.Launcher.onClick:50 android.view.View.performClick:5204
06-25 17:04:09.587   736  1050 D ActivityManager: start process: io.kamihama.magiatranslate.experiment, abi override: null, primary cpu abi: arm64-v8a, forceToUseNativeBridge: true, fileAccessControlLastUpdatedTime: -1, appDevicePropLastUpdatedTime: -1
06-25 17:04:09.587   736  1050 D ActivityManager: start process: io.kamihama.magiatranslate.experiment, cpu abi: arm64-v8a, instructionSet: arm64
06-25 17:04:09.590  4633  4633 W native_bridge: We are going to bind-mount /data/system/cpuinfoarm64 as /proc/cpuinfo
06-25 17:04:09.591  4633  4633 I art     : Late-enabling JIT
06-25 17:04:09.591  4633  4633 D libnb   : enter native_bridge2_initialize /data/user/0/io.kamihama.magiatranslate.experiment/code_cache arm64
06-25 17:04:09.593  4633  4633 I HP      : patch linker relocate target address outof bounds
06-25 17:04:09.593  4633  4633 D HP      : no libmumuhooker.so
06-25 17:04:09.593  4633  4633 D houdini : [4633] Initialize library(version: 6.1.2d_z.48748 RELEASE)... successfully.
06-25 17:04:09.596  4633  4633 W art     : Unexpected CPU variant for X86 using defaults: x86_64
06-25 17:04:09.597  4633  4633 I art     : JIT created with code_cache_capacity=2MB compile_threshold=1000
06-25 17:04:09.598   736  1050 I ActivityManager: Start proc 4633:io.kamihama.magiatranslate.experiment/u0a65 for activity io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity
06-25 17:04:09.602  4633  4633 I Zygote  : fake Product info io.kamihama.magiatranslate.experiment not matched any pattern
06-25 17:04:09.611   736  2609 W InputMethodManagerService: Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@f388843 (uid=1000 pid=1031)
06-25 17:04:09.623  4633  4633 D NemuJavaHotPatchHelper: onHandleBindApplication reportedPackageName:io.kamihama.magiatranslate.experiment isMatchJavaPatch:false
06-25 17:04:09.624   290   850 D gralloc_x86: gralloc_alloc: Creating ashmem region of size 8294400
06-25 17:04:09.630   736  1050 I com.android.server.tabs.TabManagerService: notifyOpening:468: notify tab opened in android as it's new task io.kamihama.magiatranslate.experiment, appName: Magia Record JP, taskId: 1095, firstActiveTime: 1687683849612
06-25 17:04:09.630   736   751 D Interception: result: allow, reason: calleePkg is system app, rule: runType===broadcast|||callerPkg===android|||calleePkg===com.mumu.acc|||calleeClass===com.mumu.acc.AccMsgReceiver|||action===nemu.intent.action.NEW_TASK
06-25 17:04:09.631  1258  1258 D AccService: AccMsgReceiver: nemu.intent.action.NEW_TASK
06-25 17:04:09.635  1031  1149 D updatePackage: version io.kamihama.magiatranslate.experiment 1713000452
06-25 17:04:09.635  1031  1031 I Launcher: Deferring update until onResume
06-25 17:04:09.636  1014  1251 D com.netease.nemu_android_watchdog_lib.core.Watchdog: upload event: {"architecture":"x86_64","channel":"nochannel","country":"zh-CN","engine":"NEMU","fchannel":"nochannel","language":"zh_CN","package":"mumu","usage":"0","uuid":"4258ffcd-db32-4db7-9a8e-afdea0394f61","version":"2.7.26.0","x":{"app_name":"Magia Record JP","app_package":"io.kamihama.magiatranslate.experiment","app_version_code":1713000452,"app_version_name":"3.0.4","error":{"code":0,"msg":"ok"},"token":"c46e061e-4f71-4c05-8aed-caad9e8be8a1"}}  type: LaunchAPP sign: i97j+6UCoNgka83n/dhP77zEsCs=     uid: 1000        json:{"app_name":"Magia Record JP","app_package":"io.kamihama.magiatranslate.experiment","app_version_code":1713000452,"app_version_name":"3.0.4","error":{"code":0,"msg":"ok"},"token":"c46e061e-4f71-4c05-8aed-caad9e8be8a1"}
06-25 17:04:09.659  1014  1251 D com.netease.nemu_android_watchdog_lib.core.Watchdog: upload server response: {"errcode": 100, "errmsg": "ok"}
06-25 17:04:09.659  1014  1251 D com.netease.nemu_android_watchdog_lib.core.Watchdog: upload result: true
06-25 17:04:09.734  4633  4633 D WM-WrkMgrInitializer: Initializing WorkManager with default configuration.
06-25 17:04:09.738  4633  4654 E ActivityThread: Failed to find provider info for com.google.android.gms.phenotype
06-25 17:04:09.773  4633  4654 I FA      : App measurement is starting up, version: 12451
06-25 17:04:09.773  4633  4654 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-25 17:04:09.773  4633  4654 I FA      : To enable faster debug mode event logging run:
06-25 17:04:09.773  4633  4654 I FA      :   adb shell setprop debug.firebase.analytics.app io.kamihama.magiatranslate.experiment
06-25 17:04:09.794  4633  4633 D Activity: on create, cpu abi: arm64-v8a, brand: Android
06-25 17:04:09.812  4633  4633 V libnb   : enter native_bridge2_isSupported /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libmadomagi_native.so
06-25 17:04:09.812  4633  4633 D libnb   : enter native_bridge2_loadLibrary /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libmadomagi_native.so
06-25 17:04:09.838  4633  4654 W GooglePlayServicesUtil: io.kamihama.magiatranslate.experiment requires the Google Play Store, but it is missing.
06-25 17:04:09.838  4633  4654 W FA      : Service invalid
06-25 17:04:09.839   736  1139 D Interception: result: allow, reason: callerPkg == calleePkg, rule: runType===retrieveService|||callerPkg===io.kamihama.magiatranslate.experiment|||calleePkg===io.kamihama.magiatranslate.experiment|||calleeClass===com.google.android.gms.measurement.AppMeasurementService|||action===com.google.android.gms.measurement.START
06-25 17:04:09.956  4633  4633 D houdini : [4633] Added shared library /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libmadomagi_native.so for ClassLoader by Native Bridge.
06-25 17:04:09.956  4633  4633 V libnb   : enter native_bridge2_getTrampoline JNI_OnLoad
06-25 17:04:09.956  4633  4633 D main    : cocos_android_app_init
06-25 17:04:09.959  4633  4633 D Cocos2dxHelper: isSupportLowLatency:true
06-25 17:04:09.961  4633  4633 D Cocos2dxHelper: sampleRate: 44100, framesPerBuffer: 512
06-25 17:04:09.961  4633  4633 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetAudioDeviceInfo
06-25 17:04:09.962  4633  4633 D Java_org_cocos2dx_lib_Cocos2dxHelper.cpp: nativeSetAudioDeviceInfo: sampleRate: 44100, bufferSizeInFrames: 512
06-25 17:04:09.962  4633  4633 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxHelper_nativeSetContext
06-25 17:04:09.964   736  1261 W ActivityManager: Unable to start service Intent { act=com.enhance.gameservice.IGameTuningService pkg=com.enhance.gameservice } U=0: not found
06-25 17:04:09.964  4633  4633 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxActivity_getGLContextAttrs
06-25 17:04:09.978  4633  4633 V libnb   : enter native_bridge2_isSupported /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libbacktrace-native.so
06-25 17:04:09.978  4633  4633 D libnb   : enter native_bridge2_loadLibrary /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libbacktrace-native.so
06-25 17:04:09.981  4633  4633 D houdini : [4633] Added shared library /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libbacktrace-native.so for ClassLoader by Native Bridge.
06-25 17:04:09.981  4633  4633 V libnb   : enter native_bridge2_getTrampoline JNI_OnLoad
06-25 17:04:09.988  4633  4633 V libnb   : enter native_bridge2_getTrampoline Java_backtraceio_library_BacktraceDatabase_initialize
06-25 17:04:10.022  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callStartSession
06-25 17:04:10.022  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callStartSession__
06-25 17:04:10.022  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callStartSession
06-25 17:04:10.034  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callAddInstallEvent
06-25 17:04:10.034  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callAddInstallEvent__
06-25 17:04:10.034  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callAddInstallEvent
06-25 17:04:10.034  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callAddLoginEvent
06-25 17:04:10.035  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callAddLoginEvent__
06-25 17:04:10.035  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_treasuredata_TreasureDataHelper_callAddLoginEvent
06-25 17:04:10.036  4633  4633 D AppActivity: onResume()
06-25 17:04:10.036  4633  4633 D Cocos2dxActivity: onResume()
06-25 17:04:10.037  4633  4654 I FA      : Tag Manager is not found and thus will not be used
06-25 17:04:10.049  4633  4666 D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
06-25 17:04:10.084  4633  4633 V libnb   : enter native_bridge2_isSupported /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libuwasa.so
06-25 17:04:10.084  4633  4633 D libnb   : enter native_bridge2_loadLibrary /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libuwasa.so
06-25 17:04:10.088  4633  4633 D houdini : [4633] Added shared library /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libuwasa.so for ClassLoader by Native Bridge.
06-25 17:04:10.088  4633  4633 V libnb   : enter native_bridge2_getTrampoline JNI_OnLoad
06-25 17:04:10.088  4633  4633 I MagiaHook: Starting MagiaHook.
06-25 17:04:10.092  4633  4667 I MagiaHook: Library location: /data/app/io.kamihama.magiatranslate.experiment-1/lib/arm64/libmadomagi_native.so
06-25 17:04:10.092  4633  4667 I MagiaHook: Base address: 0x4000000
06-25 17:04:10.100  4633  4667 I MagiaHook: Successfully hooked UrlConfig::resource.
06-25 17:04:10.107  4633  4667 I MagiaHook: Successfully hooked SceneLayerManager::createSceneLayer.
06-25 17:04:10.110  4633  4667 I MagiaHook: Successfully hooked http2::Http2Session::setMaxConnectionNum.
06-25 17:04:10.118  4633  4667 I MagiaHook: Successfully hooked criNcv_GetHardwareSamplingRate_ANDROID.
06-25 17:04:10.121  4633  4667 I MagiaHook: Successfully hooked cocos2d::Node::setPosition.
06-25 17:04:10.124  4633  4667 I MagiaHook: Successfully hooked cocos2d::Label::setMaxLineWidth.
06-25 17:04:10.135  4633  4667 I MagiaHook: Successfully hooked cocos2d::Label::setDimensions.
06-25 17:04:10.137  4633  4667 I MagiaHook: Successfully hooked LbUtility::getViewPosition.
06-25 17:04:10.143  4633  4667 I MagiaHook: Successfully hooked cocos2d::Label::createWithTTF.
06-25 17:04:10.169  4633  4667 I MagiaHook: Exiting hook thread.
06-25 17:04:10.171  4633  4633 W art     : Method processed more than once: java.lang.String com.fasterxml.jackson.core.util.TextBuffer.contentsAsString()
06-25 17:04:10.183  4633  4668 W art     : Method processed more than once: java.lang.String com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer._addSymbol(char[], int, int, int, int)
06-25 17:04:10.197  4633  4666 D libEGL  : loaded /system/lib64/egl/libEGL_emulation.so
06-25 17:04:10.213  4633  4666 D libEGL  : loaded /system/lib64/egl/libGLESv1_CM_emulation.so
06-25 17:04:10.221  4633  4654 I FA      : This instance being marked as an uploader
06-25 17:04:10.224  4633  4666 D libEGL  : loaded /system/lib64/egl/libGLESv2_emulation.so
06-25 17:04:10.291  4633  4666 I OpenGLRenderer: Initialized EGL, version 1.4
06-25 17:04:10.291  4633  4666 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
06-25 17:04:10.338  4633  4654 W art     : Method processed more than once: java.lang.String com.google.android.gms.internal.measurement.zzabx.readString()
06-25 17:04:10.352  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit
06-25 17:04:10.353  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit__II
06-25 17:04:10.353  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit
06-25 17:04:10.415  4633  4633 D AppActivity: onWindowFocusChanged() hasFocus=true
06-25 17:04:10.415  4633  4633 D Cocos2dxActivity: onWindowFocusChanged() hasFocus=true
06-25 17:04:10.420   736   756 I ActivityManager: Displayed io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity: +833ms
06-25 17:04:10.424   736  1972 W InputMethodManagerService: Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@1855e6c (uid=10038 pid=2664)
06-25 17:04:10.479  4633  4660 W Adjust  : PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
06-25 17:04:10.484  4633  4660 W Adjust  : PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
06-25 17:04:10.494  4633  4660 D cocos2d-x debug info: [CSM][I]Live2D Cubism Core version: 04.01.0000 (67174400)
06-25 17:04:10.494  4633  4660 D cocos2d-x debug info:
06-25 17:04:10.494  4633  4660 D cocos2d-x debug info: [CSM][I]CubismFramework::StartUp() is complete.
06-25 17:04:10.494  4633  4660 D cocos2d-x debug info:
06-25 17:04:10.517  4633  4660 E emuglGLESv2_enc: GraphicsError: A program can not be linked correctly..
06-25 17:04:10.811  4633  4660 I MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned 44100
06-25 17:04:10.812  4633  4660 I MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned 44100
06-25 17:04:10.813  4633  4660 I MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned 44100
06-25 17:04:10.813  4633  4660 I MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned 44100
06-25 17:04:10.814  4633  4660 I MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned 44100
06-25 17:04:10.814  4633  4660 I MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned 44100
06-25 17:04:10.816  4633  4660 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2022062722:Cannot set sampling rate exceeds max value.
06-25 17:04:10.853   308   439 D audio_hw_primary: tunnel_pcm_open called!
06-25 17:04:10.921  4633  4660 D cocos2d-x debug info: [CSM][I]CubismFramework::Initialize() is complete.
06-25 17:04:10.921  4633  4660 D cocos2d-x debug info:
06-25 17:04:10.921  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnSurfaceChanged
06-25 17:04:10.921  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnSurfaceChanged__II
06-25 17:04:10.921  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnSurfaceChanged
06-25 17:04:10.955  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender
06-25 17:04:10.955  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender__
06-25 17:04:10.955  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeRender
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume__
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeOnResume
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin__IFF
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd__IFF
06-25 17:04:10.966  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd
06-25 17:04:11.531  4633  4660 I MagiaHook: Scene layer changed to: StartupSceneLayer
06-25 17:04:11.532  4633  4660 I MagiaHook: Scene layer changed to: TapSceneLayer
06-25 17:04:12.083  4633  4660 D cocos2d-x debug info: "/cc_2x2_white_image" rc=3 id=0x7f79047be140 2 x 2 @ 32 bpp => 0 KB
06-25 17:04:12.083  4633  4660 D cocos2d-x debug info: "assets/package/window/popup_bg00.png" rc=3 id=0x7f79047be920 1024 x 1024 @ 32 bpp => 4096 KB
06-25 17:04:12.083  4633  4660 D cocos2d-x debug info: "assets/package/window/common_btn0.png" rc=13 id=0x7f79047be260 512 x 512 @ 32 bpp => 1024 KB
06-25 17:04:12.083  4633  4660 D cocos2d-x debug info: TextureCache dumpDebugInfo: 3 textures, for 5120 KB (5.00 MB)
06-25 17:04:12.083  4633  4660 D cocos2d-x debug info:
06-25 17:04:12.083  4633  4660 D cocos2d-x debug info:
06-25 17:04:12.083  4633  4660 I MagiaHook: Scene layer changed to: WebSceneLayer
06-25 17:04:12.241  4633  4660 W art     : Method processed more than once: java.lang.String okhttp3.internal.platform.AndroidPlatform.getSelectedProtocol(javax.net.ssl.SSLSocket)
06-25 17:04:13.109  4633  4701 W art     : Method processed more than once: java.lang.String okio.ByteString.utf8()
06-25 17:04:13.111  4633  4660 W art     : Method processed more than once: java.lang.String okio.Buffer.readString(long, java.nio.charset.Charset)
06-25 17:04:13.116  4633  4633 I WebViewFactory: Loading com.android.webview version 91.0.4472.114 (code 447211456)
06-25 17:04:13.136  4633  4660 I MagiaHook: Scene layer changed to: TapSceneLayer
06-25 17:04:13.196  4633  4660 I MagiaHook: Scene layer changed to: LoadingSceneLayer
06-25 17:04:13.355  4633  4633 I cr_LibraryLoader: Loaded native library version number "91.0.4472.114"
06-25 17:04:13.361  4633  4633 I cr_CachingUmaRecorder: Flushed 6 samples from 6 histograms.
06-25 17:04:13.425   736  1972 D ConnectivityService: listenForNetwork for Listen from uid/pid:10065/4633 for NetworkRequest [ id=31, legacyType=-1, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED] ]
06-25 17:04:13.750  4633  4722 W cr_media: Requires BLUETOOTH permission
06-25 17:04:13.909  4633  4719 W art     : Method processed more than once: boolean Au0.f(java.security.cert.X509Certificate)
06-25 17:04:13.987  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove
06-25 17:04:13.987  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove___3I_3F_3F
06-25 17:04:13.987  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove
06-25 17:04:14.327  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_web_WebViewHelper_didFinishLoading
06-25 17:04:14.327  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_web_WebViewHelper_didFinishLoading__Ljava_lang_String_2
06-25 17:04:14.327  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_web_WebViewHelper_didFinishLoading
06-25 17:04:14.394  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_web_WebViewHelper_onJsCallback
06-25 17:04:14.394  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_web_WebViewHelper_onJsCallback__Ljava_lang_String_2
06-25 17:04:14.394  4633  4660 V libnb   : enter native_bridge2_getTrampoline Java_jp_f4samurai_web_WebViewHelper_onJsCallback
06-25 17:04:14.592  4633  4660 I MagiaHook: Scene layer changed to: TapSceneLayer

@segfault-bilibili

segfault-bilibili commented Jun 25, 2023

Copy link
Copy Markdown
Contributor Author

MEmu emulator

MEmu emulator (EN, version 9.0.1, according to the native library used, it seems to be armeabi-v7a: lib/arm/libuwasa.so)

It appeared to (randomly) either "fix" or "break/silent" the audio here, even if the hook does nothing but to observe.

logcat (silent):

06-25 16:48:00.223   412  8994 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity bnds=[110,310][386,482]} from uid 10016
06-25 16:48:00.235   952   952 W Settings: Setting android_id has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
06-25 16:48:00.257 18572 18572 D houdini : [18572] Initialize library(version: 9.0.7a_y.36020 RELEASE)... successfully.
06-25 16:48:00.258 18572 18572 W late.experimen: Unexpected CPU variant for X86 using defaults: x86
06-25 16:48:00.259   412   428 I ActivityManager: Start proc 18572:io.kamihama.magiatranslate.experiment/u0a76 for activity io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity
06-25 16:48:00.260  1015  1015 D BoundBrokerSvc: onBind: Intent { act=com.google.android.gms.measurement.START pkg=com.google.android.gms }
06-25 16:48:00.260  1015  1015 D BoundBrokerSvc: Loading bound service for intent: Intent { act=com.google.android.gms.measurement.START pkg=com.google.android.gms }
06-25 16:48:00.265 18572 18572 E late.experimen: Not starting debugger since process cannot load the jdwp agent.
06-25 16:48:00.267   153   354 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:48:00.277   129   214 E TrafficController: Failed to set the counterSet: Function not implemented, fd: -1
06-25 16:48:00.295 18572 18572 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
06-25 16:48:00.296 18572 18572 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
06-25 16:48:00.303 18572 18572 I FirebaseInitProvider: FirebaseApp initialization successful
06-25 16:48:00.311 18572 18572 D WM-WrkMgrInitializer: Initializing WorkManager with default configuration.
06-25 16:48:00.325   153   235 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:48:00.341 18572 18598 I FA      : App measurement is starting up, version: 12451
06-25 16:48:00.342 18572 18598 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-25 16:48:00.342 18572 18598 I FA      : To enable faster debug mode event logging run:
06-25 16:48:00.342 18572 18598 I FA      :   adb shell setprop debug.firebase.analytics.app io.kamihama.magiatranslate.experiment
06-25 16:48:00.499   153   235 W SurfaceFlinger: Attempting to set client state on removed layer: Surface(name=AppWindowToken{6450880 token=Token{9018103 ActivityRecord{a84db2 u0 com.microvirt.launcher2/com.microvirt.launcher.Launcher t2}}})/@0x71ec86c - animation-leash#0
06-25 16:48:00.499   153   235 W SurfaceFlinger: Attempting to set client state on removed layer: Surface(name=AppWindowToken{22a4a8a token=Token{34dbcf5 ActivityRecord{9a51a2c u0 io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity t174}}})/@0x51a24f4 - animation-leash#0
06-25 16:48:00.499   153   235 W SurfaceFlinger: Attempting to destroy on removed layer: Surface(name=AppWindowToken{6450880 token=Token{9018103 ActivityRecord{a84db2 u0 com.microvirt.launcher2/com.microvirt.launcher.Launcher t2}}})/@0x71ec86c - animation-leash#0
06-25 16:48:00.499   153   235 W SurfaceFlinger: Attempting to destroy on removed layer: Surface(name=AppWindowToken{22a4a8a token=Token{34dbcf5 ActivityRecord{9a51a2c u0 io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity t174}}})/@0x51a24f4 - animation-leash#0
06-25 16:48:00.649 18572 18572 D main    : cocos_android_app_init
06-25 16:48:00.650 18572 18572 D Cocos2dxHelper: isSupportLowLatency:false
06-25 16:48:00.650 18572 18572 D Cocos2dxHelper: sampleRate: 44100, framesPerBuffer: 512
06-25 16:48:00.651 18572 18572 D Java_org_cocos2dx_lib_Cocos2dxHelper.cpp: nativeSetAudioDeviceInfo: sampleRate: 44100, bufferSizeInFrames: 512
06-25 16:48:00.651   412  7467 W ActivityManager: Unable to start service Intent { act=com.enhance.gameservice.IGameTuningService pkg=com.enhance.gameservice } U=0: not found
06-25 16:48:00.655 18572 18572 D OpenGLRenderer: Skia GL Pipeline
06-25 16:48:00.687 18572 18572 D AppActivity: onResume()
06-25 16:48:00.687 18572 18572 D Cocos2dxActivity: onResume()
06-25 16:48:00.688 18572 18598 I FA      : Tag Manager is not found and thus will not be used
06-25 16:48:00.702 18572 18572 I MagiaHook: Starting MagiaHook.
06-25 16:48:00.703 18572 18617 I MagiaHook: Library location: /data/app/io.kamihama.magiatranslate.experiment-rUyTKu0GZNzn9Ex9wMDdyQ==/lib/arm/libmadomagi_native.so
06-25 16:48:00.704 18572 18617 I MagiaHook: Base address: 0x31cc000
06-25 16:48:00.709  1045  1342 E GCM     : Missing checkin config file
06-25 16:48:00.709  1045  1342 W GCM     : GCM FAILED TO INITIALIZE - missing checkin
06-25 16:48:00.717 18572 18619 D NetworkSecurityConfig: No Network Security Config specified, using platform default
06-25 16:48:00.730 18572 18615 D         : HostConnection::get() New Host Connection established 0xd39d3ac0, tid 18615
06-25 16:48:00.731 18572 18615 W         : Process pipe failed
06-25 16:48:00.733 18572 18615 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
06-25 16:48:00.733 18572 18615 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
06-25 16:48:00.733 18572 18615 I OpenGLRenderer: Initialized EGL, version 1.4
06-25 16:48:00.733 18572 18615 D OpenGLRenderer: Swap behavior 1
06-25 16:48:00.735 18572 18615 E EGL_adreno: CreateContext rcMajorVersion:3, minorVersion:1
06-25 16:48:00.736 18572 18609 D         : HostConnection::get() New Host Connection established 0xed126900, tid 18609
06-25 16:48:00.737 18572 18609 E EGL_adreno: CreateContext rcMajorVersion:3, minorVersion:1
06-25 16:48:00.740 18572 18595 E FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED
06-25 16:48:00.750 18572 18617 I MagiaHook: Successfully hooked UrlConfig::resource.
06-25 16:48:00.753 18572 18617 I MagiaHook: Successfully hooked SceneLayerManager::createSceneLayer.
06-25 16:48:00.754 18572 18615 D EGL_adreno: eglCreateContext: 0xed105f60: maj 3 min 1 rcv 3
06-25 16:48:00.754 18572 18615 E EGL_adreno: [getAttribValue] Bad attribute idx
06-25 16:48:00.754 18572 18615 D EGL_adreno: eglGetConfigAttrib: bad attrib 0x3339
06-25 16:48:00.754 18572 18617 I MagiaHook: Successfully hooked http2::Http2Session::setMaxConnectionNum.
06-25 16:48:00.756 18572 18617 I MagiaHook: Successfully hooked criNcv_GetHardwareSamplingRate_ANDROID.
06-25 16:48:00.756 18572 18617 I MagiaHook: Successfully hooked cocos2d::Node::setPosition.
06-25 16:48:00.757 18572 18617 I MagiaHook: Successfully hooked cocos2d::Label::setMaxLineWidth.
06-25 16:48:00.758 18572 18617 I MagiaHook: Successfully hooked cocos2d::Label::setDimensions.
06-25 16:48:00.759 18572 18617 I MagiaHook: Successfully hooked LbUtility::getViewPosition.
06-25 16:48:00.760 18572 18617 I MagiaHook: Successfully hooked cocos2d::Label::createWithTTF.
06-25 16:48:00.763 18572 18617 I MagiaHook: Exiting hook thread.
06-25 16:48:00.773 18572 18609 D EGL_adreno: eglCreateContext: 0xed105900: maj 3 min 1 rcv 3
06-25 16:48:00.773 18572 18609 E EGL_adreno: [getAttribValue] Bad attribute idx
06-25 16:48:00.773 18572 18609 D EGL_adreno: eglGetConfigAttrib: bad attrib 0x3339
06-25 16:48:00.774   153   354 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:48:00.798 18572 18609 D vndksupport: Loading /vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace.
06-25 16:48:00.798 18572 18609 D vndksupport: Loading /vendor/lib/hw/gralloc.gmin.so from current namespace instead of sphal namespace.
06-25 16:48:00.821 18572 18615 E EGL_adreno: [getAttribValue] Bad attribute idx
06-25 16:48:00.821 18572 18615 D EGL_adreno: eglGetConfigAttrib: bad attrib 0x3339
06-25 16:48:00.821   153   235 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:48:00.836 18572 18615 E EGL_adreno: tid 18615: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH)
06-25 16:48:00.836 18572 18615 W OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xed105e40, error=EGL_BAD_MATCH
06-25 16:48:00.845 18572 18609 W Adjust  : PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
06-25 16:48:00.846 18572 18609 W Adjust  : PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
06-25 16:48:00.850 18572 18609 D cocos2d-x debug info: [CSM][I]Live2D Cubism Core version: 04.01.0000 (67174400)
06-25 16:48:00.850 18572 18609 D cocos2d-x debug info:
06-25 16:48:00.850 18572 18609 D cocos2d-x debug info: [CSM][I]CubismFramework::StartUp() is complete.
06-25 16:48:00.850 18572 18609 D cocos2d-x debug info:
06-25 16:48:00.861   153   235 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:48:00.886 18572 18572 D AppActivity: onWindowFocusChanged() hasFocus=true
06-25 16:48:00.886 18572 18572 D Cocos2dxActivity: onWindowFocusChanged() hasFocus=true
06-25 16:48:00.901   153   235 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:48:00.946  1045  1342 W NetworkScheduler: Error inserting period=3354000 preferred_charging_state=1 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService required_network_type=0 runtime=1687682880944 required_idleness_state=0 source=16 service_kind=0 target_package=com.google.android.gms persistence_level=1 source_version=220920000 last_runtime=0 user_id=0 job_id=-1 requires_charging=0 tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG flex_time=1676000 task_type=0 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}}, error message: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE) [CONTEXT service_id=218 ]
06-25 16:48:01.167 18639 18639 E cutils-trace: Error opening trace file: Permission denied (13)
06-25 16:48:01.168 18639 18639 E android.hardware.bluetooth@1.0-service: Could not get passthrough implementation for android.hardware.bluetooth@1.0::IBluetoothHci/default.
06-25 16:48:01.317 18572 18609 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 192 (0xc0)
06-25 16:48:01.320 18572 18609 I chatty  : uid=10076(io.kamihama.magiatranslate.experiment) GLThread 131 identical 4 lines
06-25 16:48:01.320 18572 18609 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 192 (0xc0)
06-25 16:48:01.321 18572 18609 E libOpenSLES: pAudioSrc: samplesPerSec=192000
06-25 16:48:01.321 18572 18609 W libOpenSLES: Leaving Engine::CreateAudioPlayer (SL_RESULT_CONTENT_UNSUPPORTED)
06-25 16:48:01.321 18572 18609 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2021051200:failed to create OpenSLES player.
06-25 16:48:01.321 18572 18609 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2013101600:Failed to setup output voice of ASR.
06-25 16:48:01.321 18572 18609 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E16061401NC:Failed to create ASR.
06-25 16:48:01.321 18572 18609 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2012062215:Invalid Rack ID has been set.
06-25 16:48:01.321 18572 18609 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2011061727:Initialize the library before calling this function.

logcat ("fixed")

06-25 16:53:12.987   412  2918 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity bnds=[110,310][386,482]} from uid 10016
06-25 16:53:12.616   543   543 W StaticLayout: maxLineHeight should not be -1.  maxLines:1 lineCount:1
06-25 16:53:12.997   952   952 W Settings: Setting android_id has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
06-25 16:53:13.015   153  1458 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:53:13.017 21003 21003 D houdini : [21003] Initialize library(version: 9.0.7a_y.36020 RELEASE)... successfully.
06-25 16:53:13.017 21003 21003 W late.experimen: Unexpected CPU variant for X86 using defaults: x86
06-25 16:53:13.019   412   428 I ActivityManager: Start proc 21003:io.kamihama.magiatranslate.experiment/u0a76 for activity io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity
06-25 16:53:13.020 21003 21003 E late.experimen: Not starting debugger since process cannot load the jdwp agent.
06-25 16:53:13.042   129   214 E TrafficController: Failed to set the counterSet: Function not implemented, fd: -1
06-25 16:53:13.059 21003 21003 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
06-25 16:53:13.060 21003 21003 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
06-25 16:53:13.064 21003 21003 I FirebaseInitProvider: FirebaseApp initialization successful
06-25 16:53:13.068 21003 21003 D WM-WrkMgrInitializer: Initializing WorkManager with default configuration.
06-25 16:53:13.081   153  1458 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:53:13.085 21003 21022 I FA      : App measurement is starting up, version: 12451
06-25 16:53:13.085 21003 21022 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-25 16:53:13.086 21003 21022 I FA      : To enable faster debug mode event logging run:
06-25 16:53:13.086 21003 21022 I FA      :   adb shell setprop debug.firebase.analytics.app io.kamihama.magiatranslate.experiment
06-25 16:53:13.427 21003 21003 D main    : cocos_android_app_init
06-25 16:53:13.427 21003 21003 D Cocos2dxHelper: isSupportLowLatency:false
06-25 16:53:13.428 21003 21003 D Cocos2dxHelper: sampleRate: 44100, framesPerBuffer: 512
06-25 16:53:13.428 21003 21003 D Java_org_cocos2dx_lib_Cocos2dxHelper.cpp: nativeSetAudioDeviceInfo: sampleRate: 44100, bufferSizeInFrames: 512
06-25 16:53:13.429   412  2566 W ActivityManager: Unable to start service Intent { act=com.enhance.gameservice.IGameTuningService pkg=com.enhance.gameservice } U=0: not found
06-25 16:53:13.433 21003 21003 D OpenGLRenderer: Skia GL Pipeline
06-25 16:53:13.467 21003 21003 D AppActivity: onResume()
06-25 16:53:13.467 21003 21003 D Cocos2dxActivity: onResume()
06-25 16:53:13.468 21003 21022 I FA      : Tag Manager is not found and thus will not be used
06-25 16:53:13.487 21003 21003 I MagiaHook: Starting MagiaHook.
06-25 16:53:13.492  1045 19803 E GCM     : Missing checkin config file
06-25 16:53:13.492  1045 19803 W GCM     : GCM FAILED TO INITIALIZE - missing checkin
06-25 16:53:13.494 21003 21043 I MagiaHook: Library location: /data/app/io.kamihama.magiatranslate.experiment-rUyTKu0GZNzn9Ex9wMDdyQ==/lib/arm/libmadomagi_native.so
06-25 16:53:13.495 21003 21043 I MagiaHook: Base address: 0x31cc000
06-25 16:53:13.507 21003 21045 D NetworkSecurityConfig: No Network Security Config specified, using platform default
06-25 16:53:13.518 21003 21042 D         : HostConnection::get() New Host Connection established 0xd0b9a100, tid 21042
06-25 16:53:13.523 21003 21045 I late.experimen: IncrementDisableThreadFlip blocked for 6.700ms
06-25 16:53:13.523 21003 21042 W         : Process pipe failed
06-25 16:53:13.523 21003 21003 I late.experimen: IncrementDisableThreadFlip blocked for 5.996ms
06-25 16:53:13.527 21003 21042 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
06-25 16:53:13.527 21003 21042 I ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
06-25 16:53:13.527 21003 21042 I OpenGLRenderer: Initialized EGL, version 1.4
06-25 16:53:13.527 21003 21042 D OpenGLRenderer: Swap behavior 1
06-25 16:53:13.529 21003 21042 E EGL_adreno: CreateContext rcMajorVersion:3, minorVersion:1
06-25 16:53:13.531 21003 21034 D         : HostConnection::get() New Host Connection established 0xece7fe40, tid 21034
06-25 16:53:13.532 21003 21034 E EGL_adreno: CreateContext rcMajorVersion:3, minorVersion:1
06-25 16:53:13.533 21003 21020 E FirebaseInstanceId: Token retrieval failed: AUTHENTICATION_FAILED
06-25 16:53:13.545 21003 21043 I MagiaHook: Successfully hooked UrlConfig::resource.
06-25 16:53:13.547 21003 21043 I MagiaHook: Successfully hooked SceneLayerManager::createSceneLayer.
06-25 16:53:13.550 21003 21043 I MagiaHook: Successfully hooked http2::Http2Session::setMaxConnectionNum.
06-25 16:53:13.552 21003 21043 I MagiaHook: Successfully hooked criNcv_GetHardwareSamplingRate_ANDROID.
06-25 16:53:13.553 21003 21043 I MagiaHook: Successfully hooked cocos2d::Node::setPosition.
06-25 16:53:13.555 21003 21043 I MagiaHook: Successfully hooked cocos2d::Label::setMaxLineWidth.
06-25 16:53:13.556 21003 21043 I MagiaHook: Successfully hooked cocos2d::Label::setDimensions.
06-25 16:53:13.557 21003 21043 I MagiaHook: Successfully hooked LbUtility::getViewPosition.
06-25 16:53:13.557 21003 21043 I MagiaHook: Successfully hooked cocos2d::Label::createWithTTF.
06-25 16:53:13.561 21003 21043 I MagiaHook: Exiting hook thread.
06-25 16:53:13.563 21003 21013 I late.experimen: Background concurrent copying GC freed 13088(2MB) AllocSpace objects, 9(176KB) LOS objects, 49% free, 1721KB/3MB, paused 5.127ms total 52.214ms
06-25 16:53:13.564 21003 21042 D EGL_adreno: eglCreateContext: 0xeced30a0: maj 3 min 1 rcv 3
06-25 16:53:13.564 21003 21042 E EGL_adreno: [getAttribValue] Bad attribute idx
06-25 16:53:13.564 21003 21042 D EGL_adreno: eglGetConfigAttrib: bad attrib 0x3339
06-25 16:53:13.566   153   353 W SurfaceFlinger: Attempting to destroy on removed layer: 2d2934d Sys2038:com.microvirt.launcher2/com.microvirt.launcher.Launcher#0
06-25 16:53:13.590 21003 21034 D EGL_adreno: eglCreateContext: 0xeced28c0: maj 3 min 1 rcv 3
06-25 16:53:13.591 21003 21034 E EGL_adreno: [getAttribValue] Bad attribute idx
06-25 16:53:13.591 21003 21034 D EGL_adreno: eglGetConfigAttrib: bad attrib 0x3339
06-25 16:53:13.591   153   353 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:53:13.628 21003 21034 D vndksupport: Loading /vendor/lib/hw/android.hardware.graphics.mapper@2.0-impl.so from current namespace instead of sphal namespace.
06-25 16:53:13.628 21003 21034 D vndksupport: Loading /vendor/lib/hw/gralloc.gmin.so from current namespace instead of sphal namespace.
06-25 16:53:13.654 21003 21042 E EGL_adreno: [getAttribValue] Bad attribute idx
06-25 16:53:13.654 21003 21042 D EGL_adreno: eglGetConfigAttrib: bad attrib 0x3339
06-25 16:53:13.655   153   353 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:53:13.681 21003 21042 E EGL_adreno: tid 21042: eglSurfaceAttrib(1615): error 0x3009 (EGL_BAD_MATCH)
06-25 16:53:13.681 21003 21042 W OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xeced2f80, error=EGL_BAD_MATCH
06-25 16:53:13.735 21003 21034 W Adjust  : PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
06-25 16:53:13.736 21003 21034 W Adjust  : PRODUCTION: Adjust is running in Production mode. Use this setting only for the build that you want to publish. Set the environment to `sandbox` if you want to test your app!
06-25 16:53:13.743 21003 21034 D cocos2d-x debug info: [CSM][I]Live2D Cubism Core version: 04.01.0000 (67174400)
06-25 16:53:13.743 21003 21034 D cocos2d-x debug info:
06-25 16:53:13.743 21003 21034 D cocos2d-x debug info: [CSM][I]CubismFramework::StartUp() is complete.
06-25 16:53:13.743 21003 21034 D cocos2d-x debug info:
06-25 16:53:13.795   153   353 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:53:13.861 21003 21003 D AppActivity: onWindowFocusChanged() hasFocus=true
06-25 16:53:13.861 21003 21003 D Cocos2dxActivity: onWindowFocusChanged() hasFocus=true
06-25 16:53:13.870   153   353 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:53:13.918  1045 19803 W NetworkScheduler: Error inserting period=6838000 preferred_charging_state=1 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService required_network_type=0 runtime=1687683193911 required_idleness_state=0 source=16 service_kind=0 target_package=com.google.android.gms persistence_level=1 source_version=220920000 last_runtime=0 user_id=0 job_id=-1 requires_charging=0 tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG flex_time=3418000 task_type=0 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}}, error message: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE) [CONTEXT service_id=218 ]
06-25 16:53:13.947  1045 19803 W NetworkScheduler: Error inserting period=6838000 preferred_charging_state=1 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService required_network_type=0 runtime=1687683193945 required_idleness_state=0 source=16 service_kind=0 target_package=com.google.android.gms persistence_level=1 source_version=220920000 last_runtime=0 user_id=0 job_id=-1 requires_charging=0 tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG flex_time=3418000 task_type=0 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}}, error message: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE) [CONTEXT service_id=218 ]
06-25 16:53:14.317 21003 21034 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 0 (0x0)
06-25 16:53:14.331 21003 21034 I chatty  : uid=10076(io.kamihama.magiatranslate.experiment) GLThread 158 identical 4 lines
06-25 16:53:14.331 21003 21034 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 0 (0x0)
06-25 16:53:14.337 21003 21034 D         : PlayerBase::PlayerBase()
06-25 16:53:14.338 21003 21034 D         : TrackPlayerBase::TrackPlayerBase()
06-25 16:53:14.338 21003 21034 I libOpenSLES: Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
06-25 16:53:14.339   151   918 W AudioFlinger: createTrack_l(): mismatch between requested flags (00000104) and output flags (00000006)
06-25 16:53:14.339   151   918 D AudioFlinger: Client defaulted notificationFrames to 960 for frameCount 3354
06-25 16:53:14.341 21003 21034 W AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 3354
06-25 16:53:14.471 21003 21034 D cocos2d-x debug info: [CSM][I]CubismFramework::Initialize() is complete.
06-25 16:53:14.471 21003 21034 D cocos2d-x debug info:
06-25 16:53:14.508   153   353 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:53:14.539   412   434 I ActivityManager: Displayed io.kamihama.magiatranslate.experiment/jp.f4samurai.AppActivity: +1s501ms
06-25 16:53:14.539   412   425 W system_server: Failed to determine oat file name for dex location /data/app/io.kamihama.magiatranslate.experiment-rUyTKu0GZNzn9Ex9wMDdyQ==/base.apk: Dalvik cache directory does not exist
06-25 16:53:14.544   129   214 E TrafficController: Failed to delete the counterSet: Function not implemented
06-25 16:53:14.545   129   214 E TrafficController: Failed to delete the counterSet: Function not implemented
06-25 16:53:14.560   952  1515 W Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
06-25 16:53:14.570   952  1515 E ironSourceSDK: INTERNAL: b 2.run - Failed to send events. Saving them back to storage.
06-25 16:53:14.608   153   353 D gralloc_gmin: gralloc_alloc: Creating ashmem region of size 5763072
06-25 16:53:14.623   151   399 D AudioFlinger: mixer(0xf4003c00) throttle end: throttle time(1)
06-25 16:53:14.641   153   234 W SurfaceFlinger: Attempting to set client state on removed layer: Splash Screen io.kamihama.magiatranslate.experiment#0
06-25 16:53:14.641   153   234 W SurfaceFlinger: Attempting to destroy on removed layer: Splash Screen io.kamihama.magiatranslate.experiment#0
06-25 16:53:15.172 21003 21034 I MagiaHook: Scene layer changed to: StartupSceneLayer
06-25 16:53:15.172 21003 21034 I MagiaHook: Scene layer changed to: TapSceneLayer
06-25 16:53:15.304 21003 21011 W System  : A resource failed to call end.
06-25 16:53:16.517 21098 21098 E cutils-trace: Error opening trace file: Permission denied (13)
06-25 16:53:16.517 21098 21098 E android.hardware.bluetooth@1.0-service: Could not get passthrough implementation for android.hardware.bluetooth@1.0::IBluetoothHci/default.
06-25 16:53:17.876 21003 21034 D cocos2d-x debug info: "/cc_2x2_white_image" rc=3 id=0xd0bb4f90 2 x 2 @ 32 bpp => 0 KB
06-25 16:53:17.876 21003 21034 D cocos2d-x debug info: "assets/package/window/popup_bg00.png" rc=3 id=0xd0bb4e50 1024 x 1024 @ 32 bpp => 4096 KB
06-25 16:53:17.876 21003 21034 D cocos2d-x debug info: "assets/package/window/common_btn0.png" rc=13 id=0xd0bb4e00 512 x 512 @ 32 bpp => 1024 KB
06-25 16:53:17.876 21003 21034 D cocos2d-x debug info: TextureCache dumpDebugInfo: 3 textures, for 5120 KB (5.00 MB)
06-25 16:53:17.876 21003 21034 D cocos2d-x debug info:
06-25 16:53:17.876 21003 21034 D cocos2d-x debug info:
06-25 16:53:17.876 21003 21034 I MagiaHook: Scene layer changed to: WebSceneLayer
06-25 16:53:18.344 21003 21003 I WebViewFactory: Loading com.android.chrome version 68.0.3440.70 (code 344007062)
06-25 16:53:18.347 21003 21003 I late.experimen: The ClassLoaderContext is a special shared library.
06-25 16:53:18.348 21003 21034 I MagiaHook: Scene layer changed to: TapSceneLayer
06-25 16:53:18.378 21003 21034 I MagiaHook: Scene layer changed to: LoadingSceneLayer
06-25 16:53:18.407 21003 21003 I cr_LibraryLoader: Time to load native libraries: 8 ms (timestamps 3468-3476)
06-25 16:53:18.417 21003 21116 E cr_VariationsUtils: Failed reading seed file "/data/user/0/io.kamihama.magiatranslate.experiment/app_webview/variations_seed_new": /data/user/0/io.kamihama.magiatranslate.experiment/app_webview/variations_seed_new (No such file or directory)
06-25 16:53:18.423 21003 21003 I chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
06-25 16:53:18.423 21003 21003 I cr_LibraryLoader: Expected native library version number "68.0.3440.70", actual native library version number "68.0.3440.70"
06-25 16:53:18.428 21003 21117 W cr_ChildProcLH: Create a new ChildConnectionAllocator with package name = com.android.chrome, sandboxed = true
06-25 16:53:18.432 21003 21003 I cr_BrowserStartup: Initializing chromium process, singleProcess=false
06-25 16:53:18.433 21003 21003 I cr_base : Android Locale: en_US requires .pak files: [en-GB, en-US]
06-25 16:53:18.436 21119 21119 W dboxed_process: Unexpected CPU variant for X86 using defaults: x86
06-25 16:53:18.437 21119 21119 E dboxed_process: Not starting debugger since process cannot load the jdwp agent.
06-25 16:53:18.441   412   428 I ActivityManager: Start proc 21119:com.android.chrome:sandboxed_process0/u0i22 for webview_service io.kamihama.magiatranslate.experiment/org.chromium.content.app.SandboxedProcessService0
06-25 16:53:18.451   129   214 E TrafficController: Failed to set the counterSet: Function not implemented, fd: -1
06-25 16:53:18.453 21003 21003 I chromium: [INFO:aw_field_trial_creator.cc(54)] First-WebView-Experiment not found
06-25 16:53:18.474 21119 21119 I cr_ChildProcessService: Creating new ChildProcessService pid=21119
06-25 16:53:18.549 21003 21046 W cr_CrashFileManager: /data/user/0/io.kamihama.magiatranslate.experiment/cache/WebView/Crash Reports does not exist or is not a directory
06-25 16:53:18.911   151   399 D AudioFlinger: mixer(0xf4003c00) throttle end: throttle time(3)
06-25 16:53:18.947 21003 21142 W cr_media: Requires BLUETOOTH permission
06-25 16:53:18.948 21003 21156 D         : HostConnection::get() New Host Connection established 0xca05e700, tid 21156
06-25 16:53:18.949 21119 21147 I cr_LibraryLoader: Time to load native libraries: 1 ms (timestamps 4017-4018)
06-25 16:53:18.949 21119 21147 I chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
06-25 16:53:18.949 21119 21147 I cr_LibraryLoader: Expected native library version number "68.0.3440.70", actual native library version number "68.0.3440.70"
06-25 16:53:18.951 21003 21156 E EGL_adreno: [getAttribValue] Bad attribute idx
06-25 16:53:18.951 21003 21156 D EGL_adreno: eglGetConfigAttrib: bad attrib 0x3339
06-25 16:53:18.997 21003 21156 E EGL_adreno: CreateContext rcMajorVersion:3, minorVersion:1
06-25 16:53:18.999 21003 21156 D EGL_adreno: eglCreateContext: 0xc80acd80: maj 3 min 1 rcv 3
06-25 16:53:19.025 21003 21156 W VideoCapabilities: Unrecognized profile 4 for video/hevc
06-25 16:53:19.031 21003 21156 I VideoCapabilities: Unsupported profile 4 for video/mp4v-es
06-25 16:53:19.032 21003 21156 W cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
06-25 16:53:19.035 21003 21156 E EGL_adreno: [getAttribValue] Bad attribute idx
06-25 16:53:19.035 21003 21156 D EGL_adreno: eglGetConfigAttrib: bad attrib 0x3339
06-25 16:53:19.047 21003 21156 E EGL_adreno: CreateContext rcMajorVersion:3, minorVersion:0
06-25 16:53:19.050 21003 21156 D EGL_adreno: eglCreateContext: 0xc80ac3c0: maj 3 min 0 rcv 3
06-25 16:53:19.818 21003 21034 I MagiaHook: Scene layer changed to: TapSceneLayer
06-25 16:53:19.831 21003 21013 I late.experimen: Background concurrent copying GC freed 10445(654KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 8MB/17MB, paused 6.232ms total 33.316ms
06-25 16:53:20.670 21003 21034 I MagiaHook: Scene layer changed to: TopSceneLayer
06-25 16:53:21.228 21003 21034 D CCFileUtils-android.cpp: asset is nullptr
06-25 16:53:21.417 21003 21034 I chatty  : uid=10076(io.kamihama.magiatranslate.experiment) GLThread 158 identical 34 lines
06-25 16:53:21.420 21003 21034 D CCFileUtils-android.cpp: asset is nullptr
06-25 16:53:21.520 21185 21185 E cutils-trace: Error opening trace file: Permission denied (13)
06-25 16:53:21.521 21185 21185 E android.hardware.bluetooth@1.0-service: Could not get passthrough implementation for android.hardware.bluetooth@1.0::IBluetoothHci/default.
06-25 16:53:23.143   151   399 D AudioFlinger: mixer(0xf4003c00) throttle end: throttle time(2)
06-25 16:53:23.628   151   399 D AudioFlinger: mixer(0xf4003c00) throttle end: throttle time(1)

@segfault-bilibili

segfault-bilibili commented Jun 25, 2023

Copy link
Copy Markdown
Contributor Author

This "silent or having pitch fixed" issue seems to be tied to armeabi-v7a.

I deleted arm64-v8a library files, repacked the APK, and then MuMu behaved the same as MEmu.

I doubt that Dobby possibly implemented hook under armeabi-v7a in some wrong way, or it's also possible that we are just not using this hook framework in the right way.


criNcv_GetHardwareSamplingRate_ANDROID does nothing more than reading a value from hard-coded memory address.

However, after being compiled to assembly, there's a subtle difference between armeabi-v7a and arm64-v8a:

  1. armeabi-v7a seems to be (took from magireco 3.0.2, below is the same):
ldr r0, [pc, #4]
ldr r0, [pc, r0]
bx lr
; the 4-byte data which is not an instruction
  1. arm64-v8a seems to be
adrp x8, #0x732cf2c000
ldr w0, [x8, #0xf50]
ret 

We can observe that:

  1. Disassmbler output shows that: armeabi-v7a has to read the memory address from [pc+4] (it's actually [pc+8] - probably it's related to some instruction pipelining thing pc is defined to point to the current instruction + 8 bytes, according to official ARM docs about pc-relative expressions) - in other words, the memory address is stored in the extra 4-byte data placed after the BX (function return) instruction;
  2. Meanwhile, arm64-v8a doesn't have this quirk, it does not need that extra 4-byte data, the memory address is directly encoded into the ADRP and LDR instructions (as a relative offset).

Then the explanation comes out:

When criNcv_GetHardwareSamplingRate_ANDROID is called from the hook handler function (instead of being called from what it's originally supposed to), Dobby probably get the [pc+4] quirky thing wrong, so that it actually reads from some random memory address.

@segfault-bilibili

segfault-bilibili commented Jun 25, 2023

Copy link
Copy Markdown
Contributor Author

@jmpews

tldr:

We hooked a function which does only one trivial thing: read a value from hard-coded memory address.

The value to be read out is supposed to be not changing, as it's "cached" value of system audio output sample rate (48000 or 44100 typically).

On arm64-v8a it seems to work fine;

On armeabi-v7a the original function seems to spit out random garbage values.

@segfault-bilibili

Copy link
Copy Markdown
Contributor Author

Installed armeabi-v7a-only APK to a physical device (Redmi K40, with LineageOS 20)

Then the silenced audio bug is reproduced, which should be a proof that this bug is not emulator-only.

logcat:

06-25 19:18:18.207 22760 22797 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 894959694 (0x3558004e)
06-25 19:18:18.207 22760 22797 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 894959694 (0x3558004e)
06-25 19:18:18.208 22760 22797 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 894959694 (0x3558004e)
06-25 19:18:18.208 22760 22797 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 894959694 (0x3558004e)
06-25 19:18:18.208 22760 22797 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 894959694 (0x3558004e)
06-25 19:18:18.208 22760 22797 W MagiaHook: [do nothing] criNcv_GetHardwareSamplingRate_ANDROID returned UNUSUAL VALUE 894959694 (0x3558004e)
06-25 19:18:18.208 22760 22797 E libOpenSLES: pAudioSrc: samplesPerSec=1606496432
06-25 19:18:18.208 22760 22797 W libOpenSLES: Leaving Engine::CreateAudioPlayer (SL_RESULT_CONTENT_UNSUPPORTED)
06-25 19:18:18.208 22760 22797 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2021051200:failed to create OpenSLES player.
06-25 19:18:18.208 22760 22797 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2013101600:Failed to setup output voice of ASR.
06-25 19:18:18.208 22760 22797 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E16061401NC:Failed to create ASR.
06-25 19:18:18.208 22760 22797 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2012062215:Invalid Rack ID has been set.
06-25 19:18:18.208 22760 22797 E CRIWARE for Cocos2d: [CRIWARE][ERROR] E2011061727:Initialize the library before calling this function.

@segfault-bilibili

segfault-bilibili commented Jun 26, 2023

Copy link
Copy Markdown
Contributor Author

I've just done another experiment: 97df8a1

I learned that:

  1. Dobby did a inline hook on the original function. The original function is modifed (to become a trampoline?). Then the original function seems to be copied and relocated - that's where the bug lies, that:
  2. Dobby doesn't seem to properly relocate consecutive LDR instructions (sorry I don't know the proper name of this thing yet): the first pseudo LDR instruction loading offset as a immediate number, and the following second LDR instruction does the real memory-reading job.

full logcat:

06-26 22:53:05.876  8315  8315 I MagiaHook: Starting MagiaHook.
06-26 22:53:05.876  8315  8353 I MagiaHook: Library location: /data/app/io.kamihama.magiatranslate.experiment-p7-NMIaTr97oRvzW5epEog==/lib/arm/libmadomagi_native.so
06-26 22:53:05.877  8315  8353 I MagiaHook: Base address: 0x32cc000
06-26 22:53:05.913  8315  8353 I MagiaHook: Successfully hooked UrlConfig::resource.
06-26 22:53:05.921  8315  8353 I MagiaHook: Successfully hooked SceneLayerManager::createSceneLayer.
06-26 22:53:05.933  8315  8353 I MagiaHook: Successfully hooked http2::Http2Session::setMaxConnectionNum.
06-26 22:53:05.933  8315  8353 I MagiaHook: mprotect rwx
06-26 22:53:05.933  8315  8353 I MagiaHook: PageSize = 4096
06-26 22:53:05.933  8315  8353 I MagiaHook: found in audioSampleRateFix, i = 1, ptr = 0x3ce0244
06-26 22:53:05.934  8315  8353 I MagiaHook: immediate = 0xbc4084
06-26 22:53:05.934  8315  8353 I MagiaHook: page_start = 0x3ce0000
06-26 22:53:05.934  8315  8353 I MagiaHook: mprotect ret = 0
06-26 22:53:05.934  8315  8353 I MagiaHook: modified instruction
06-26 22:53:05.934  8315  8353 I MagiaHook: orig value: -1, read from ptr = 0x48a42d0
06-26 22:53:05.934  8315  8353 I MagiaHook: memcmp returned 0, recovered instruction
06-26 22:53:05.936  8315  8353 I MagiaHook: Successfully hooked criNcv_GetHardwareSamplingRate_ANDROID.
06-26 22:53:05.937  8315  8353 I MagiaHook: found in criNcv_GetHardwareSamplingRate_ANDROID_Hooked, i = 2, ptr = 0xf348006c
06-26 22:53:05.937  8315  8353 I MagiaHook: immediate = 0x3ce0248
06-26 22:53:05.937  8315  8353 I MagiaHook: page_start = 0xf3480000
06-26 22:53:05.937  8315  8353 I MagiaHook: mprotect ret = 0
06-26 22:53:05.938  8315  8353 I MagiaHook: modified instruction again
06-26 22:53:05.938  8315  8353 I MagiaHook: after hook: 0, read from ptr = 0xf40440f8
06-26 22:53:05.943  8315  8353 I MagiaHook: Successfully hooked cocos2d::Node::setPosition.
06-26 22:53:05.945  8315  8353 I MagiaHook: Successfully hooked cocos2d::Label::setMaxLineWidth.
06-26 22:53:05.946  8315  8353 I MagiaHook: Successfully hooked cocos2d::Label::setDimensions.
06-26 22:53:05.950  8315  8353 I MagiaHook: Successfully hooked LbUtility::getViewPosition.
06-26 22:53:05.950  8315  8353 I MagiaHook: Successfully hooked cocos2d::Label::createWithTTF.
06-26 22:53:05.952  8315  8353 I MagiaHook: Exiting hook thread.
06-26 22:53:06.640  8315  8343 I MagiaHook: instruction MODIFIED: criNcv_GetHardwareSamplingRate_ANDROID got 0 at 0xf40440f8
06-26 22:53:06.645  8315  8343 I MagiaHook: instruction MODIFIED: criNcv_GetHardwareSamplingRate_ANDROID got 0 at 0xf40440f8
06-26 22:53:07.565  8315  8343 I MagiaHook: Scene layer changed to: StartupSceneLayer
06-26 22:53:07.565  8315  8343 I MagiaHook: Scene layer changed to: TapSceneLayer

@segfault-bilibili

Copy link
Copy Markdown
Contributor Author

Note: this has been fixed with jmpews/Dobby#238

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants