Browse Source

+ write the WebAssembly header in the WASM resource writer

Nikolay Nikolov 1 year ago
parent
commit
025282ccb9
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/fcl-res/src/wasmwriter.pp

+ 6 - 1
packages/fcl-res/src/wasmwriter.pp

@@ -48,6 +48,10 @@ type
 
 
 implementation
 implementation
 
 
+const
+  WasmModuleMagic: array [0..3] of byte = ($00,$61,$73,$6D);
+  WasmVersion: array [0..3] of byte = ($01,$00,$00,$00);
+
 { TWasmResourceWriter }
 { TWasmResourceWriter }
 
 
 function TWasmResourceWriter.GetExtensions: string;
 function TWasmResourceWriter.GetExtensions: string;
@@ -62,7 +66,8 @@ end;
 
 
 procedure TWasmResourceWriter.Write(aResources: TResources; aStream: TStream);
 procedure TWasmResourceWriter.Write(aResources: TResources; aStream: TStream);
 begin
 begin
-
+  aStream.WriteBuffer(WasmModuleMagic,SizeOf(WasmModuleMagic));
+  aStream.WriteBuffer(WasmVersion,SizeOf(WasmVersion));
 end;
 end;
 
 
 constructor TWasmResourceWriter.Create;
 constructor TWasmResourceWriter.Create;