Open hmaeta opened 8 months ago
plugins {
// alias(libs.plugins.kotlinMultiplatform)
kotlin("multiplatform") version "2.0.20"
// kotlin("jvm")
}
repositories {
mavenCentral()
}
kotlin {
wasmJs {
binaries.executable()
nodejs()
}
}
node
Welcome to Node.js v22.7.0.
Type ".help" for more information.
> const wasmModule = await import('./gbem-wasm-wasm-js/kotlin/gbem-wasm-wasm-js.mjs');
const wasmModule = await import('./gbem-wasm-wasm-js/kotlin/gbem-wasm-wasm-js.mjs');
undefined
> const { openAsBlob } = require('node:fs');
const { openAsBlob } = require('node:fs');
undefined
> const blob = await openAsBlob('<WORKSPACE>/gbem/src/main/resources/rom.gb');
const blob = await openAsBlob('<WORKSPACE>/gbem/src/main/resources/rom.gb');
undefined
> const ab = await blob.arrayBuffer();
const ab = await blob.arrayBuffer();
undefined
> ua = new Uint8Array(ab)
ua = new Uint8Array(ab)
Uint8Array(32768) [
0, 0, 195, 56, 0, 107, 105, 255, 62, 1, 224, 148,
118, 24, 253, 122, 34, 87, 11, 120, 177, 32, 248, 201,
26, 34, 19, 13, 32, 250, 201, 255, 34, 13, 32, 252,
201, 42, 102, 111, 203, 124, 32, 255, 233, 255, 255, 255,
203, 122, 213, 200, 255, 255, 255, 255, 243, 24, 254, 14,
19, 24, 29, 34, 245, 240, 151, 224, 66, 195, 91, 26,
245, 229, 240, 172, 111, 198, 4, 224, 172, 38, 200, 62,
11, 61, 32, 253, 42, 224, 67, 42, 224, 75, 42, 224,
64, 42, 224, 69,
... 32668 more items
]
> wasmModule.emulate(ua)
wasmModule.emulate(ua)
about to run
0, 0, White
1, 0, White
2, 0, White
3, 0, White
4, 0, White
5, 0, White
6, 0, White
9/10 Express経由でhtml/jsを配布して、CORSは回避 ブラウザで実行したが、emultate()がスレッドをブロックしてそうで描画が更新されない (原因不明だが cpu_instrs.gb が03まででwasm内でstacktrace吐いた落ちた) 次回→emulate()がブロックしないような設計に変えて、JS側でループを回すようにしてみる
9/17 メモ clock per second, frame per second あたりを計測可能にして、改善の効果を数値化してみたい
軽く設計サマリ