mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-16 07:56:06 +09:00
fix: mp2 384k would cause stack overflow error
This commit is contained in:
@@ -233,11 +233,15 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) {
|
||||
41 -> mp2Busy.toInt().toByte()
|
||||
in 64..2367 -> mediaDecodedBin[addr - 64]
|
||||
in 2368..4095 -> mediaFrameBin[addr - 2368]
|
||||
in 4096..4097 -> 0
|
||||
in 32768..65535 -> (adi - 32768).let {
|
||||
cueSheet[it / 16].read(it % 15)
|
||||
}
|
||||
in 65536..131071 -> pcmBin[addr - 65536]
|
||||
else -> mmio_read(addr % 131072)
|
||||
else -> {
|
||||
println("[AudioAdapter] Bus mirroring on mmio_reading while trying to read address $addr")
|
||||
mmio_read(addr % 131072)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,13 @@ class MP2Env(val vm: VM) {
|
||||
samplesR[pushSizeR++] = sampleR
|
||||
}
|
||||
|
||||
val ret = _decodeFrame(mp2, framePtr, pcm, pushL, pushR)
|
||||
val ret = try {
|
||||
_decodeFrame(mp2, framePtr, pcm, pushL, pushR)
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
e.printStackTrace()
|
||||
intArrayOf(0, 0)
|
||||
}
|
||||
|
||||
// dither samples and store them to the given "out" pointer
|
||||
var outPos = out
|
||||
|
||||
Reference in New Issue
Block a user