fix slow-pitched audio by patching file directly#4
Conversation
13fd879 to
e9c236f
Compare
ae726e0 to
0dfc9b6
Compare
|
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. |
|
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. |
|
I will continue to work on #5 |
|
I'll do some more tests |
0dfc9b6 to
9c8749f
Compare
|
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 |
|
I'm doing some more experiment on this: 2f05c6a Now the hook does nothing but printing return value to logcat. |
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: |
MEmu emulatorMEmu emulator (EN, version 9.0.1, according to the native library used, it seems to be armeabi-v7a: It appeared to (randomly) either "fix" or "break/silent" the audio here, even if the hook does nothing but to observe. logcat (silent): logcat ("fixed") |
|
This "silent or having pitch fixed" issue seems to be tied to I deleted I doubt that Dobby possibly implemented hook under
However, after being compiled to assembly, there's a subtle difference between
We can observe that:
Then the explanation comes out: When |
|
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 On |
|
Installed Then the silenced audio bug is reproduced, which should be a proof that this bug is not emulator-only. logcat: |
|
I've just done another experiment: 97df8a1 I learned that:
full logcat: |
|
Note: this has been fixed with jmpews/Dobby#238 |
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: