Closed Flan-I closed 1 year ago
Code from the irreparable error window:
Platform: Android
Version: 4.5.14 (Build 839)
Rulesets: [ReSound, Unciv Vanilla Music Pack, Civ V - Vanilla, Additional Music Ambient, Community Maps, Civ6 mod, Civ V Leader portraits, Leader Mission, Alpha Frontier, Higher Quality City Ambience Sounds, Latin American_Civs, Civ V - Gods & Kings, Additional Music Various]
Last Screen: com.unciv.ui.crashhandling.CrashScreen
Device Model: RMX3393 API Level: 33
Message:
java.lang.ArrayIndexOutOfBoundsException: src.length=14 srcPos=0 dst.length=14 dstPos=1 length=15
at java.lang.System.arraycopy(Native Method)
at com.badlogic.gdx.utils.IntArray.insert(IntArray.java:167)
at com.badlogic.gdx.backends.android.AndroidSound.play(AndroidSound.java:53)
at com.unciv.ui.audio.SoundPlayer.play(SoundPlayer.kt:173)
at com.unciv.ui.components.extensions.OnClickListener$clicked$2.invokeSuspend(Scene2dExtensions.kt:300)
at com.unciv.ui.components.extensions.OnClickListener$clicked$2.invoke(Unknown Source:8)
at com.unciv.ui.components.extensions.OnClickListener$clicked$2.invoke(Unknown Source:4)
at com.unciv.utils.concurrency.ConcurrencyKt$launchCrashHandling$1.invokeSuspend(Concurrency.kt:83)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at com.unciv.utils.concurrency.CrashHandlingDispatcher$dispatch$1.invoke(Concurrency.kt:164)
at com.unciv.utils.concurrency.CrashHandlingDispatcher$dispatch$1.invoke(Concurrency.kt:164)
at com.unciv.ui.crashhandling.CrashHandlingExtensionsKt$wrapCrashHandling$1.invoke(CrashHandlingExtensions.kt:17)
at com.unciv.ui.crashhandling.CrashHandlingExtensionsKt$wrapCrashHandlingUnit$1.invoke(CrashHandlingExtensions.kt:33)
at com.unciv.ui.crashhandling.CrashHandlingExtensionsKt$wrapCrashHandlingUnit$1.invoke(CrashHandlingExtensions.kt:33)
at com.unciv.utils.concurrency.CrashHandlingDispatcher.dispatch$lambda$0(Concurrency.kt:164)
at com.unciv.utils.concurrency.CrashHandlingDispatcher.$r8$lambda$nwZVoCWi6P2779l7sK5tCF-sQTA(Unknown Source:0)
at com.unciv.utils.concurrency.CrashHandlingDispatcher$$ExternalSyntheticLambda0.run(Unknown Source:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
Save Mods:
[ReSound, Higher Quality City Ambience Sounds, Additional Music Ambient, Civ V - Gods & Kings, Community Maps, Civ V Leader portraits, Additional Music Various]
Save Data:
@SomeTroglodyte
com.badlogic.gdx.backends
- backends - the offending line reads streamIds.insert(0, streamId);
- that is a fixed size IntArray(8), and it just popped one off if full. Doesn't really fit the exception text saying there wasn't a 15th element...
Anyway, Gdx and Audio - that was a hard battle. HardenGdxAudio
exists for that very reason, but it only covers Music not Sounds. There is a little defense against idiocy in the Sounds code - that Concurrency.run("DelayedSound")
thanks to Android needing some kind of time for buffering - I deep-debugged that seemingly years ago, memory fuzzy - right after newSound(file)
or else play()
crashes. That crash had a different exception type, though, and was un-catcheable, direct to LogCat and App simply gone. If I remember correctly. Could be re-learned quickly enough by connecting 'droid hardware to the debugger and disabling that delay coroutine - happened reliably AFAIK.
What to do about it? No "Eureka". OP's description seems contradictory - endless wait for next turn ending? That wouldn't pop a crash handler... API 33 is slowly moving past what the Sound code was tested with, but... And RMX3393 isn't exactly a methusalem weakling either. Sounds faster than my brick here...
@Flan-I - could you try to see if your problem also happens when... Ah no you used the Sound mods the wrong way round, they're linked in the save game. If you had used "permanent audiovisual" instead, disabling Sound mods would have been easier. This way, you could only try running a new game without them, and see if you can reproduce. To clarify: Music mods aren't the problem, the Sound ones may be. "ReSound, Higher Quality City Ambience Sounds" - though the name could mislead.
@SomeTroglodyte thanks at least for that. I will be more careful about sound mods from now on
No, you misunderstood - it's of course a possibility that a mod causes problems, but here not certain at all. It may be combinations - mods using higher bitrates and thus more resources per sound, or Android Tiramisu, or bugs in Gdx or Lwjgl3 or whatever surfacing with newer OS, or your specific hardware... And getting better ideas where that may come from is important.
Okay. In that case, is there anything you would advise me to do?
Experiment and tell us any patterns that turn up?
Okay, I'll try
Well, I can load and next-turn your saved game successfully on a physical Phone - but it's running Los 19, which is Android 12. So no hints that way. No wait - there's some suspicious logcat stuff - but that fingers the normal click.mp3, and it checks out. Except it's VBR, and for something <1s I'd always encode CBR... Irrelevant.
But - you could try to override more sounds with mods instead of the other way 'round, namely, try my - what did I call it - this one: Higher-quality-builtin-sounds. Even if you don't like them, just to see if it changes anything. 2MB unpacked.
Yesterday I tried to start the game just without sound mods, but the bug was repeated. Now I'm playing only with the sound quality improvement mod, 141 turn, so far everything is fine
With this higher sound quality mod and without other sound mods, the game finally stopped crashing. Thank you very much!
@yairm210 this could mean that, at least on their particular version of Android Tiramisu, the ogg decoder is more reliable? Should we redo the standard sounds with ogg encoding?
When trying to start the next turn of the game, it just processes the request endlessly and does not start the turn. If you load the autosave of the last move, you can do it again — and then the next move will start, but the bug will repeat again, in a circle.