TAV: pcm8 audio

This commit is contained in:
minjaesong
2025-10-22 10:05:54 +09:00
parent 758b134abd
commit 4265891093
15 changed files with 298 additions and 47 deletions

View File

@@ -23,7 +23,7 @@ class CompressorDelegate(private val vm: VM) {
val bytes = comp(inbytes)
vm.getDev(output.toLong(), bytes.size.toLong(), true).let {
if (it != null) {
val bytesReversed = bytes.reversedArray() // copy over reversed bytes starting from the end of the destination
val bytesReversed = bytes.reversedArray() // backward addressing: copy over reversed bytes starting from the end of the destination
UnsafeHelper.memcpyRaw(bytesReversed, UnsafeHelper.getArrayOffset(bytesReversed), null, output.toLong() - bytes.size, bytes.size.toLong())
}
else {
@@ -39,7 +39,7 @@ class CompressorDelegate(private val vm: VM) {
val bytes = comp(str)
vm.getDev(output.toLong(), bytes.size.toLong(), true).let {
if (it != null) {
val bytesReversed = bytes.reversedArray() // copy over reversed bytes starting from the end of the destination
val bytesReversed = bytes.reversedArray() // backward addressing: copy over reversed bytes starting from the end of the destination
UnsafeHelper.memcpyRaw(bytesReversed, UnsafeHelper.getArrayOffset(bytesReversed), null, output.toLong() - bytes.size, bytes.size.toLong())
}
else {
@@ -55,7 +55,7 @@ class CompressorDelegate(private val vm: VM) {
val bytes = comp(ba)
vm.getDev(output.toLong(), bytes.size.toLong(), true).let {
if (it != null) {
val bytesReversed = bytes.reversedArray() // copy over reversed bytes starting from the end of the destination
val bytesReversed = bytes.reversedArray() // backward addressing: copy over reversed bytes starting from the end of the destination
UnsafeHelper.memcpyRaw(bytesReversed, UnsafeHelper.getArrayOffset(bytesReversed), null, output.toLong() - bytes.size, bytes.size.toLong())
}
else {
@@ -75,7 +75,7 @@ class CompressorDelegate(private val vm: VM) {
val bytes = decomp(str)
vm.getDev(pointer.toLong(), bytes.size.toLong(), true).let {
if (it != null) {
val bytesReversed = bytes.reversedArray() // copy over reversed bytes starting from the end of the destination
val bytesReversed = bytes.reversedArray() // backward addressing: copy over reversed bytes starting from the end of the destination
UnsafeHelper.memcpyRaw(bytesReversed, UnsafeHelper.getArrayOffset(bytesReversed), null, pointer.toLong() - bytes.size, bytes.size.toLong())
}
else {
@@ -91,7 +91,7 @@ class CompressorDelegate(private val vm: VM) {
val bytes = decomp(ba)
vm.getDev(pointer.toLong(), bytes.size.toLong(), true).let {
if (it != null) {
val bytesReversed = bytes.reversedArray() // copy over reversed bytes starting from the end of the destination
val bytesReversed = bytes.reversedArray() // backward addressing: copy over reversed bytes starting from the end of the destination
UnsafeHelper.memcpyRaw(bytesReversed, UnsafeHelper.getArrayOffset(bytesReversed), null, pointer.toLong() - bytes.size, bytes.size.toLong())
}
else {
@@ -110,15 +110,15 @@ class CompressorDelegate(private val vm: VM) {
val inbytes = ByteArray(len) { vm.peek(input.toLong() + it)!! }
val bytes = decomp(inbytes)
vm.getDev(output.toLong(), bytes.size.toLong(), true).let {
if (it != null) {
val bytesReversed = bytes.reversedArray() // copy over reversed bytes starting from the end of the destination
UnsafeHelper.memcpyRaw(bytesReversed, UnsafeHelper.getArrayOffset(bytesReversed), null, output.toLong() - bytes.size, bytes.size.toLong())
}
else {
// if (it != null) {
// val bytesReversed = bytes.reversedArray() // backward addressing: copy over reversed bytes starting from the end of the destination
// UnsafeHelper.memcpyRaw(bytesReversed, UnsafeHelper.getArrayOffset(bytesReversed), null, output.toLong() - bytes.size, bytes.size.toLong())
// }
// else {
bytes.forEachIndexed { index, byte ->
vm.poke(output.toLong() + index, byte)
}
}
// }
}
return bytes.size
}

View File

@@ -1348,7 +1348,7 @@ class GraphicsJSR223Delegate(private val vm: VM) {
private val END = 0xFF.toByte()
// TEV (TSVM Enhanced Video) format support
// Created by Claude on 2025-08-17
// Created by CuriousTorvald and Claude on 2025-08-17
// Reusable working arrays to reduce allocation overhead
private val tevIdct8TempBuffer = FloatArray(64)

View File

@@ -12,7 +12,7 @@ import java.nio.channels.FileChannel
* A testing version of HSDPA that uses actual files on the host computer as disk sources.
* Each disk corresponds to a single file on the host filesystem.
*
* Created by Claude on 2025-08-16.
* Created by CuriousTorvald and Claude on 2025-08-16.
*/
class HostFileHSDPA : HSDPA {