Stefan Oltmann
12/15/2023, 9:30 AMStefan Oltmann
12/15/2023, 4:38 PMbashor
12/15/2023, 4:44 PMStefan Oltmann
12/15/2023, 4:45 PMephemient
12/15/2023, 4:45 PMRobert Jaros
12/15/2023, 4:58 PMStefan Oltmann
12/15/2023, 5:03 PMephemient
12/15/2023, 5:06 PMSvyatoslav Kuzmich [JB]
12/15/2023, 6:08 PMSvyatoslav Kuzmich [JB]
12/15/2023, 6:20 PMStefan Oltmann
12/15/2023, 6:41 PMephemient
12/15/2023, 6:47 PMStefan Oltmann
12/15/2023, 7:12 PM@file:JsModule("pako")
import org.khronos.webgl.Uint8Array
external object Pako {
fun deflate(data: String): Uint8Array
fun inflate(data: Uint8Array): String
}
Zlib.wasm.kt:
import Pako
import org.khronos.webgl.Uint8Array
import org.khronos.webgl.get
actual fun compress(input: String): ByteArray {
val inputData = Pako.deflate(input)
return ByteArray(inputData.length) { inputData.get(it) }
}
actual fun decompress(byteArray: ByteArray): String {
val intArray = Uint8Array(byteArray.toTypedArray()) // does not compile
return Pako.inflate(intArray)
}
ephemient
12/15/2023, 7:30 PMSvyatoslav Kuzmich [JB]
12/15/2023, 7:35 PMCould not resolve com.goncalossilva:resources:0.4.0
)Svyatoslav Kuzmich [JB]
12/15/2023, 8:28 PM{ to: 'string' }
inflate option. Now this file works in my local project!Stefan Oltmann
12/15/2023, 8:29 PMcom.goncalossilva:resources
, because it lacks WASM support.Stefan Oltmann
12/15/2023, 9:47 PMfile:///Users/sol/IdeaProjects/kim/build/js/packages/kim-wasm-js-test/kotlin/kim-wasm-js-test.uninstantiated.mjs:1286
const wasmModule = new WebAssembly.Module(wasmBuffer);
^
CompileError: WebAssembly.Module(): invalid value type 0x71 @+383
at instantiate (file:///Users/sol/IdeaProjects/kim/build/js/packages/kim-wasm-js-test/kotlin/kim-wasm-js-test.uninstantiated.mjs:1286:28)
at async file:///Users/sol/IdeaProjects/kim/build/js/packages/kim-wasm-js-test/kotlin/kim-wasm-js-test.mjs:3:17
Node.js v18.12.1
Branch:
https://github.com/Ashampoo/kim/tree/wasm_zlibSvyatoslav Kuzmich [JB]
12/15/2023, 10:01 PMStefan Oltmann
12/15/2023, 10:13 PMStefan Oltmann
12/15/2023, 10:35 PMI got 72/162 passed tests with it. It seems that kotlinx.io haven’t supported paths for Wasm node target.Regarding that I hope I can make use of the knowledge of other people here. 😅 https://kotlinlang.slack.com/archives/C0B8MA7FA/p1702679611819619
goncalossilva
12/19/2023, 3:34 PMCompileError: WebAssembly.Module(): invalid value type 0x71 @+365
. @Svyatoslav Kuzmich [JB] should we still use a canary node, considering 21 is stable? Latest is 21.4.0.goncalossilva
12/19/2023, 3:39 PMStefan Oltmann
12/28/2023, 9:47 AMYou could try using https://github.com/korlibs-archive/kzlib/tree/master/kzlib/common/src/main/kotlin/com/soywiz/kzlibJust a quick update: I attempted to utilize the suggested method, but it appears to be outdated and no longer functional. Unfortunately, despite investing some time today, extracting the new zlib logic from KorGE proved to be quite challenging. While KorGE boasts several intriguing features such as 7zip compression, it seems designed exclusively for integration within the game engine rather than for general projects. It's disappointing that the developer deprecated the korlibs repositories, presumably opting for a more consolidated approach within a single project. It would have been preferable if he had at least separated all "korlibs" into a distinct artifact from the main engine. It's regrettable that the extensive work put into KorGE is not readily usable for a broader audience. 🤷♂️
Stefan Oltmann
12/28/2023, 9:49 AM