ㅁㄴㅇㅁㄴㅇ
All checks were successful
Deploy Static Site to Cloudflare Pages / deploy (push) Successful in 46s
All checks were successful
Deploy Static Site to Cloudflare Pages / deploy (push) Successful in 46s
This commit is contained in:
46
index.js
46
index.js
@@ -1,4 +1,4 @@
|
|||||||
// Support for growable heap + pthreads, where the buffer may change, so JS views
|
// Support for growable heap + pthreads, where the buffer may change, so JS views
|
||||||
// must be updated.
|
// must be updated.
|
||||||
function GROWABLE_HEAP_I8() {
|
function GROWABLE_HEAP_I8() {
|
||||||
if (wasmMemory.buffer != HEAP8.buffer) {
|
if (wasmMemory.buffer != HEAP8.buffer) {
|
||||||
@@ -65,6 +65,46 @@ function GROWABLE_HEAP_F64() {
|
|||||||
// can continue to use Module afterwards as well.
|
// can continue to use Module afterwards as well.
|
||||||
var Module = typeof Module != "undefined" ? Module : {};
|
var Module = typeof Module != "undefined" ? Module : {};
|
||||||
|
|
||||||
|
// --- 여기서부터 추가: 쪼개진 WASM 파일을 합치는 커스텀 로더 ---
|
||||||
|
if (typeof Module === 'undefined') {
|
||||||
|
var Module = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
Module["instantiateWasm"] = function(imports, receiveInstance) {
|
||||||
|
console.log("쪼개진 WASM 파일(aa, ab, ac) 다운로드 및 병합 시작...");
|
||||||
|
|
||||||
|
Promise.all([
|
||||||
|
fetch('index.wasm.part-aa').then(res => res.arrayBuffer()),
|
||||||
|
fetch('index.wasm.part-ab').then(res => res.arrayBuffer()),
|
||||||
|
fetch('index.wasm.part-ac').then(res => res.arrayBuffer())
|
||||||
|
]).then(buffers => {
|
||||||
|
// 1. 총 용량 계산해서 빈 도화지 만들기
|
||||||
|
const totalLength = buffers.reduce((sum, buf) => sum + buf.byteLength, 0);
|
||||||
|
const combined = new Uint8Array(totalLength);
|
||||||
|
|
||||||
|
// 2. 조각들을 순서대로 이어 붙이기
|
||||||
|
let offset = 0;
|
||||||
|
for (const buf of buffers) {
|
||||||
|
combined.set(new Uint8Array(buf), offset);
|
||||||
|
offset += buf.byteLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("WASM 병합 완료! WebAssembly 컴파일 시작...");
|
||||||
|
|
||||||
|
// 3. 합쳐진 데이터를 WebAssembly로 컴파일
|
||||||
|
return WebAssembly.instantiate(combined, imports);
|
||||||
|
}).then(instance => {
|
||||||
|
// 4. Emscripten 엔진에 실행 인스턴스 넘겨주기
|
||||||
|
receiveInstance(instance.instance, instance.module);
|
||||||
|
}).catch(err => {
|
||||||
|
console.error("WASM 다운로드 또는 병합 중 치명적 오류 발생:", err);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Emscripten에게 우리가 비동기로 직접 로딩할 것이라고 알려줌
|
||||||
|
return {};
|
||||||
|
};
|
||||||
|
// --- 여기까지 추가 ---
|
||||||
|
|
||||||
// Determine the runtime environment we are in. You can customize this by
|
// Determine the runtime environment we are in. You can customize this by
|
||||||
// setting the ENVIRONMENT setting at compile time (see settings.js).
|
// setting the ENVIRONMENT setting at compile time (see settings.js).
|
||||||
// Attempt to auto-detect the environment
|
// Attempt to auto-detect the environment
|
||||||
@@ -101,7 +141,7 @@ if (ENVIRONMENT_IS_NODE) {
|
|||||||
|
|
||||||
// --pre-jses are emitted after the Module integration code, so that they can
|
// --pre-jses are emitted after the Module integration code, so that they can
|
||||||
// refer to Module (if they choose; they can also define Module)
|
// refer to Module (if they choose; they can also define Module)
|
||||||
// include: C:\Users\tymmkang\AppData\Local\Temp\tmpyjlnr784.js
|
// include: C:\Users\tymmkang\AppData\Local\Temp\tmps8zlhwdi.js
|
||||||
Module["expectedDataFileDownloads"] ??= 0;
|
Module["expectedDataFileDownloads"] ??= 0;
|
||||||
|
|
||||||
Module["expectedDataFileDownloads"]++;
|
Module["expectedDataFileDownloads"]++;
|
||||||
@@ -653,7 +693,7 @@ Module["expectedDataFileDownloads"]++;
|
|||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// end include: C:\Users\tymmkang\AppData\Local\Temp\tmpyjlnr784.js
|
// end include: C:\Users\tymmkang\AppData\Local\Temp\tmps8zlhwdi.js
|
||||||
// Sometimes an existing Module object exists with properties
|
// Sometimes an existing Module object exists with properties
|
||||||
// meant to overwrite the default module functionality. Here
|
// meant to overwrite the default module functionality. Here
|
||||||
// we collect those properties and reapply _after_ we configure
|
// we collect those properties and reapply _after_ we configure
|
||||||
|
|||||||
BIN
index.wasm
BIN
index.wasm
Binary file not shown.
BIN
index.wasm.part-aa
Normal file
BIN
index.wasm.part-aa
Normal file
Binary file not shown.
BIN
index.wasm.part-ab
Normal file
BIN
index.wasm.part-ab
Normal file
Binary file not shown.
BIN
index.wasm.part-ac
Normal file
BIN
index.wasm.part-ac
Normal file
Binary file not shown.
Reference in New Issue
Block a user