@thenick775/mgba-wasm 2.1.1-beta.0 → 2.1.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mgba.d.ts +2 -0
- package/dist/mgba.js +137 -1160
- package/dist/mgba.wasm +0 -0
- package/dist/mgba.wasm.map +1 -1
- package/package.json +1 -1
package/dist/mgba.js
CHANGED
|
@@ -48,11 +48,6 @@ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIR
|
|
|
48
48
|
// it with a specific name.
|
|
49
49
|
var ENVIRONMENT_IS_PTHREAD = ENVIRONMENT_IS_WORKER && self.name?.startsWith('em-pthread');
|
|
50
50
|
|
|
51
|
-
if (ENVIRONMENT_IS_PTHREAD) {
|
|
52
|
-
assert(!globalThis.moduleLoaded, 'module should only be loaded once on each pthread worker');
|
|
53
|
-
globalThis.moduleLoaded = true;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
51
|
// --pre-jses are emitted after the Module integration code, so that they can
|
|
57
52
|
// refer to Module (if they choose; they can also define Module)
|
|
58
53
|
// include: /home/mgba/src/src/platform/wasm/pre.js
|
|
@@ -496,6 +491,12 @@ Module.setCoreSettings = (coreSettings) => {
|
|
|
496
491
|
|
|
497
492
|
if (coreSettings.audioSync !== undefined)
|
|
498
493
|
setIntegerCoreSetting('audioSync', coreSettings.audioSync);
|
|
494
|
+
|
|
495
|
+
if (coreSettings.threadedVideo !== undefined)
|
|
496
|
+
setIntegerCoreSetting('threadedVideo', coreSettings.threadedVideo);
|
|
497
|
+
|
|
498
|
+
if (coreSettings.rewindEnable !== undefined)
|
|
499
|
+
setIntegerCoreSetting('rewindEnable', coreSettings.rewindEnable);
|
|
499
500
|
};
|
|
500
501
|
// end include: /home/mgba/src/src/platform/wasm/pre.js
|
|
501
502
|
|
|
@@ -525,12 +526,6 @@ function locateFile(path) {
|
|
|
525
526
|
// Hooks that are implemented differently in different runtime environments.
|
|
526
527
|
var readAsync, readBinary;
|
|
527
528
|
|
|
528
|
-
if (ENVIRONMENT_IS_SHELL) {
|
|
529
|
-
|
|
530
|
-
if ((typeof process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof WorkerGlobalScope != 'undefined') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
|
|
531
|
-
|
|
532
|
-
} else
|
|
533
|
-
|
|
534
529
|
// Note that this includes Node.js workers when relevant (pthreads is enabled).
|
|
535
530
|
// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
|
|
536
531
|
// ENVIRONMENT_IS_NODE.
|
|
@@ -557,8 +552,6 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
|
557
552
|
scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1);
|
|
558
553
|
}
|
|
559
554
|
|
|
560
|
-
if (!(typeof window == 'object' || typeof WorkerGlobalScope != 'undefined')) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');
|
|
561
|
-
|
|
562
555
|
{
|
|
563
556
|
// include: web_or_worker_shell_read.js
|
|
564
557
|
if (ENVIRONMENT_IS_WORKER) {
|
|
@@ -572,7 +565,6 @@ if (ENVIRONMENT_IS_WORKER) {
|
|
|
572
565
|
}
|
|
573
566
|
|
|
574
567
|
readAsync = async (url) => {
|
|
575
|
-
assert(!isFileURI(url), "readAsync does not work with file:// URLs");
|
|
576
568
|
var response = await fetch(url, { credentials: 'same-origin' });
|
|
577
569
|
if (response.ok) {
|
|
578
570
|
return response.arrayBuffer();
|
|
@@ -583,7 +575,6 @@ if (ENVIRONMENT_IS_WORKER) {
|
|
|
583
575
|
}
|
|
584
576
|
} else
|
|
585
577
|
{
|
|
586
|
-
throw new Error('environment detection error');
|
|
587
578
|
}
|
|
588
579
|
|
|
589
580
|
var out = Module['print'] || console.log.bind(console);
|
|
@@ -594,49 +585,17 @@ Object.assign(Module, moduleOverrides);
|
|
|
594
585
|
// Free the object hierarchy contained in the overrides, this lets the GC
|
|
595
586
|
// reclaim data used.
|
|
596
587
|
moduleOverrides = null;
|
|
597
|
-
checkIncomingModuleAPI();
|
|
598
588
|
|
|
599
589
|
// Emit code to handle expected values on the Module object. This applies Module.x
|
|
600
590
|
// to the proper local x. This has two benefits: first, we only emit it if it is
|
|
601
591
|
// expected to arrive, and second, by using a local everywhere else that can be
|
|
602
592
|
// minified.
|
|
603
593
|
|
|
604
|
-
if (Module['arguments']) arguments_ = Module['arguments'];
|
|
594
|
+
if (Module['arguments']) arguments_ = Module['arguments'];
|
|
605
595
|
|
|
606
|
-
if (Module['thisProgram']) thisProgram = Module['thisProgram'];
|
|
596
|
+
if (Module['thisProgram']) thisProgram = Module['thisProgram'];
|
|
607
597
|
|
|
608
598
|
// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
|
|
609
|
-
// Assertions on removed incoming Module JS APIs.
|
|
610
|
-
assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
611
|
-
assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
|
|
612
|
-
assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
613
|
-
assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
|
|
614
|
-
assert(typeof Module['read'] == 'undefined', 'Module.read option was removed');
|
|
615
|
-
assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
|
|
616
|
-
assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
|
|
617
|
-
assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');
|
|
618
|
-
assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
|
|
619
|
-
legacyModuleProp('asm', 'wasmExports');
|
|
620
|
-
legacyModuleProp('readAsync', 'readAsync');
|
|
621
|
-
legacyModuleProp('readBinary', 'readBinary');
|
|
622
|
-
legacyModuleProp('setWindowTitle', 'setWindowTitle');
|
|
623
|
-
var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js';
|
|
624
|
-
var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js';
|
|
625
|
-
var WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js';
|
|
626
|
-
var FETCHFS = 'FETCHFS is no longer included by default; build with -lfetchfs.js';
|
|
627
|
-
var ICASEFS = 'ICASEFS is no longer included by default; build with -licasefs.js';
|
|
628
|
-
var JSFILEFS = 'JSFILEFS is no longer included by default; build with -ljsfilefs.js';
|
|
629
|
-
var OPFS = 'OPFS is no longer included by default; build with -lopfs.js';
|
|
630
|
-
|
|
631
|
-
var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js';
|
|
632
|
-
|
|
633
|
-
assert(
|
|
634
|
-
ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER || ENVIRONMENT_IS_NODE, 'Pthreads do not work in this environment yet (need Web Workers, or an alternative to them)');
|
|
635
|
-
|
|
636
|
-
assert(!ENVIRONMENT_IS_NODE, 'node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.');
|
|
637
|
-
|
|
638
|
-
assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.');
|
|
639
|
-
|
|
640
599
|
// end include: shell.js
|
|
641
600
|
|
|
642
601
|
// include: preamble.js
|
|
@@ -650,11 +609,7 @@ assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at bui
|
|
|
650
609
|
// An online HTML version (which may be of a different version of Emscripten)
|
|
651
610
|
// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
|
|
652
611
|
|
|
653
|
-
var wasmBinary = Module['wasmBinary'];
|
|
654
|
-
|
|
655
|
-
if (typeof WebAssembly != 'object') {
|
|
656
|
-
err('no native wasm support detected');
|
|
657
|
-
}
|
|
612
|
+
var wasmBinary = Module['wasmBinary'];
|
|
658
613
|
|
|
659
614
|
// Wasm globals
|
|
660
615
|
|
|
@@ -683,13 +638,13 @@ var EXITSTATUS;
|
|
|
683
638
|
/** @type {function(*, string=)} */
|
|
684
639
|
function assert(condition, text) {
|
|
685
640
|
if (!condition) {
|
|
686
|
-
|
|
641
|
+
// This build was created without ASSERTIONS defined. `assert()` should not
|
|
642
|
+
// ever be called in this configuration but in case there are callers in
|
|
643
|
+
// the wild leave this simple abort() implementation here for now.
|
|
644
|
+
abort(text);
|
|
687
645
|
}
|
|
688
646
|
}
|
|
689
647
|
|
|
690
|
-
// We used to include malloc/free by default in the past. Show a helpful error in
|
|
691
|
-
// builds with assertions.
|
|
692
|
-
|
|
693
648
|
// Memory management
|
|
694
649
|
|
|
695
650
|
var HEAP,
|
|
@@ -726,176 +681,10 @@ var isFileURI = (filename) => filename.startsWith('file://');
|
|
|
726
681
|
|
|
727
682
|
// include: runtime_shared.js
|
|
728
683
|
// include: runtime_stack_check.js
|
|
729
|
-
// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
|
|
730
|
-
function writeStackCookie() {
|
|
731
|
-
var max = _emscripten_stack_get_end();
|
|
732
|
-
assert((max & 3) == 0);
|
|
733
|
-
// If the stack ends at address zero we write our cookies 4 bytes into the
|
|
734
|
-
// stack. This prevents interference with SAFE_HEAP and ASAN which also
|
|
735
|
-
// monitor writes to address zero.
|
|
736
|
-
if (max == 0) {
|
|
737
|
-
max += 4;
|
|
738
|
-
}
|
|
739
|
-
// The stack grow downwards towards _emscripten_stack_get_end.
|
|
740
|
-
// We write cookies to the final two words in the stack and detect if they are
|
|
741
|
-
// ever overwritten.
|
|
742
|
-
HEAPU32[((max)>>2)] = 0x02135467;
|
|
743
|
-
HEAPU32[(((max)+(4))>>2)] = 0x89BACDFE;
|
|
744
|
-
// Also test the global address 0 for integrity.
|
|
745
|
-
HEAPU32[((0)>>2)] = 1668509029;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
function checkStackCookie() {
|
|
749
|
-
if (ABORT) return;
|
|
750
|
-
var max = _emscripten_stack_get_end();
|
|
751
|
-
// See writeStackCookie().
|
|
752
|
-
if (max == 0) {
|
|
753
|
-
max += 4;
|
|
754
|
-
}
|
|
755
|
-
var cookie1 = HEAPU32[((max)>>2)];
|
|
756
|
-
var cookie2 = HEAPU32[(((max)+(4))>>2)];
|
|
757
|
-
if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
|
|
758
|
-
abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
|
|
759
|
-
}
|
|
760
|
-
// Also test the global address 0 for integrity.
|
|
761
|
-
if (HEAPU32[((0)>>2)] != 0x63736d65 /* 'emsc' */) {
|
|
762
|
-
abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
684
|
// end include: runtime_stack_check.js
|
|
766
685
|
// include: runtime_exceptions.js
|
|
767
686
|
// end include: runtime_exceptions.js
|
|
768
687
|
// include: runtime_debug.js
|
|
769
|
-
// Endianness check
|
|
770
|
-
(() => {
|
|
771
|
-
var h16 = new Int16Array(1);
|
|
772
|
-
var h8 = new Int8Array(h16.buffer);
|
|
773
|
-
h16[0] = 0x6373;
|
|
774
|
-
if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';
|
|
775
|
-
})();
|
|
776
|
-
|
|
777
|
-
if (Module['ENVIRONMENT']) {
|
|
778
|
-
throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
function legacyModuleProp(prop, newName, incoming=true) {
|
|
782
|
-
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
783
|
-
Object.defineProperty(Module, prop, {
|
|
784
|
-
configurable: true,
|
|
785
|
-
get() {
|
|
786
|
-
let extra = incoming ? ' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)' : '';
|
|
787
|
-
abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra);
|
|
788
|
-
|
|
789
|
-
}
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
function consumedModuleProp(prop) {
|
|
795
|
-
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
796
|
-
Object.defineProperty(Module, prop, {
|
|
797
|
-
configurable: true,
|
|
798
|
-
set() {
|
|
799
|
-
abort(`Attempt to set \`Module.${prop}\` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js'`);
|
|
800
|
-
|
|
801
|
-
}
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
function ignoredModuleProp(prop) {
|
|
807
|
-
if (Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
808
|
-
abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
// forcing the filesystem exports a few things by default
|
|
813
|
-
function isExportedByForceFilesystem(name) {
|
|
814
|
-
return name === 'FS_createPath' ||
|
|
815
|
-
name === 'FS_createDataFile' ||
|
|
816
|
-
name === 'FS_createPreloadedFile' ||
|
|
817
|
-
name === 'FS_unlink' ||
|
|
818
|
-
name === 'addRunDependency' ||
|
|
819
|
-
// The old FS has some functionality that WasmFS lacks.
|
|
820
|
-
name === 'FS_createLazyFile' ||
|
|
821
|
-
name === 'FS_createDevice' ||
|
|
822
|
-
name === 'removeRunDependency';
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
/**
|
|
826
|
-
* Intercept access to a global symbol. This enables us to give informative
|
|
827
|
-
* warnings/errors when folks attempt to use symbols they did not include in
|
|
828
|
-
* their build, or no symbols that no longer exist.
|
|
829
|
-
*/
|
|
830
|
-
function hookGlobalSymbolAccess(sym, func) {
|
|
831
|
-
if (typeof globalThis != 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) {
|
|
832
|
-
Object.defineProperty(globalThis, sym, {
|
|
833
|
-
configurable: true,
|
|
834
|
-
get() {
|
|
835
|
-
func();
|
|
836
|
-
return undefined;
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
function missingGlobal(sym, msg) {
|
|
843
|
-
hookGlobalSymbolAccess(sym, () => {
|
|
844
|
-
warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`);
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
missingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');
|
|
849
|
-
missingGlobal('asm', 'Please use wasmExports instead');
|
|
850
|
-
|
|
851
|
-
function missingLibrarySymbol(sym) {
|
|
852
|
-
hookGlobalSymbolAccess(sym, () => {
|
|
853
|
-
// Can't `abort()` here because it would break code that does runtime
|
|
854
|
-
// checks. e.g. `if (typeof SDL === 'undefined')`.
|
|
855
|
-
var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;
|
|
856
|
-
// DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
|
|
857
|
-
// library.js, which means $name for a JS name with no prefix, or name
|
|
858
|
-
// for a JS name like _name.
|
|
859
|
-
var librarySymbol = sym;
|
|
860
|
-
if (!librarySymbol.startsWith('_')) {
|
|
861
|
-
librarySymbol = '$' + sym;
|
|
862
|
-
}
|
|
863
|
-
msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;
|
|
864
|
-
if (isExportedByForceFilesystem(sym)) {
|
|
865
|
-
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
|
|
866
|
-
}
|
|
867
|
-
warnOnce(msg);
|
|
868
|
-
});
|
|
869
|
-
|
|
870
|
-
// Any symbol that is not included from the JS library is also (by definition)
|
|
871
|
-
// not exported on the Module object.
|
|
872
|
-
unexportedRuntimeSymbol(sym);
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
function unexportedRuntimeSymbol(sym) {
|
|
876
|
-
if (ENVIRONMENT_IS_PTHREAD) {
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
if (!Object.getOwnPropertyDescriptor(Module, sym)) {
|
|
880
|
-
Object.defineProperty(Module, sym, {
|
|
881
|
-
configurable: true,
|
|
882
|
-
get() {
|
|
883
|
-
var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
|
|
884
|
-
if (isExportedByForceFilesystem(sym)) {
|
|
885
|
-
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
|
|
886
|
-
}
|
|
887
|
-
abort(msg);
|
|
888
|
-
}
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
// Used by XXXXX_DEBUG settings to output debug messages.
|
|
894
|
-
function dbg(...args) {
|
|
895
|
-
// TODO(sbc): Make this configurable somehow. Its not always convenient for
|
|
896
|
-
// logging to show up as warnings.
|
|
897
|
-
console.warn(...args);
|
|
898
|
-
}
|
|
899
688
|
// end include: runtime_debug.js
|
|
900
689
|
// include: memoryprofiler.js
|
|
901
690
|
// end include: memoryprofiler.js
|
|
@@ -904,10 +693,6 @@ function dbg(...args) {
|
|
|
904
693
|
// This code runs only on pthread web workers and handles pthread setup
|
|
905
694
|
// and communication with the main thread via postMessage.
|
|
906
695
|
|
|
907
|
-
// Unique ID of the current pthread worker (zero on non-pthread-workers
|
|
908
|
-
// including the main thread).
|
|
909
|
-
var workerID = 0;
|
|
910
|
-
|
|
911
696
|
if (ENVIRONMENT_IS_PTHREAD) {
|
|
912
697
|
var wasmModuleReceived;
|
|
913
698
|
|
|
@@ -921,7 +706,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
921
706
|
|
|
922
707
|
if (!Module['printErr'])
|
|
923
708
|
err = threadPrintErr;
|
|
924
|
-
dbg = threadPrintErr;
|
|
925
709
|
function threadAlert(...args) {
|
|
926
710
|
var text = args.join(' ');
|
|
927
711
|
postMessage({cmd: 'alert', text, threadId: _pthread_self()});
|
|
@@ -938,7 +722,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
938
722
|
//dbg('msgData: ' + Object.keys(msgData));
|
|
939
723
|
var cmd = msgData.cmd;
|
|
940
724
|
if (cmd === 'load') { // Preload command that is called once per worker to parse and load the Emscripten code.
|
|
941
|
-
workerID = msgData.workerID;
|
|
942
725
|
|
|
943
726
|
// Until we initialize the runtime, queue up any further incoming messages.
|
|
944
727
|
let messageQueue = [];
|
|
@@ -977,7 +760,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
977
760
|
|
|
978
761
|
wasmModuleReceived(msgData.wasmModule);
|
|
979
762
|
} else if (cmd === 'run') {
|
|
980
|
-
assert(msgData.pthread_ptr);
|
|
981
763
|
// Call inside JS module to set up the stack frame for this pthread in JS module scope.
|
|
982
764
|
// This needs to be the first thing that we do, as we cannot call to any C/C++ functions
|
|
983
765
|
// until the thread stack is initialized.
|
|
@@ -1020,8 +802,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
1020
802
|
err(msgData);
|
|
1021
803
|
}
|
|
1022
804
|
} catch(ex) {
|
|
1023
|
-
err(`worker: onmessage() captured an uncaught exception: ${ex}`);
|
|
1024
|
-
if (ex?.stack) err(ex.stack);
|
|
1025
805
|
__emscripten_thread_crashed();
|
|
1026
806
|
throw ex;
|
|
1027
807
|
}
|
|
@@ -1048,11 +828,6 @@ function updateMemoryViews() {
|
|
|
1048
828
|
}
|
|
1049
829
|
|
|
1050
830
|
// end include: runtime_shared.js
|
|
1051
|
-
assert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
|
|
1052
|
-
|
|
1053
|
-
assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined,
|
|
1054
|
-
'JS engine does not provide full typed array support');
|
|
1055
|
-
|
|
1056
831
|
// In non-standalone/normal mode, we create the memory here.
|
|
1057
832
|
// include: runtime_init_memory.js
|
|
1058
833
|
// Create the wasm memory. (Note: this only applies if IMPORTED_MEMORY is defined)
|
|
@@ -1065,9 +840,8 @@ if (!ENVIRONMENT_IS_PTHREAD) {
|
|
|
1065
840
|
wasmMemory = Module['wasmMemory'];
|
|
1066
841
|
} else
|
|
1067
842
|
{
|
|
1068
|
-
var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 268435456;
|
|
843
|
+
var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 268435456;
|
|
1069
844
|
|
|
1070
|
-
assert(INITIAL_MEMORY >= 65536, 'INITIAL_MEMORY should be larger than STACK_SIZE, was ' + INITIAL_MEMORY + '! (STACK_SIZE=' + 65536 + ')');
|
|
1071
845
|
/** @suppress {checkTypes} */
|
|
1072
846
|
wasmMemory = new WebAssembly.Memory({
|
|
1073
847
|
'initial': INITIAL_MEMORY / 65536,
|
|
@@ -1082,25 +856,20 @@ if (!ENVIRONMENT_IS_PTHREAD) {
|
|
|
1082
856
|
// end include: runtime_init_memory.js
|
|
1083
857
|
|
|
1084
858
|
function preRun() {
|
|
1085
|
-
assert(!ENVIRONMENT_IS_PTHREAD); // PThreads reuse the runtime from the main thread.
|
|
1086
859
|
if (Module['preRun']) {
|
|
1087
860
|
if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
|
|
1088
861
|
while (Module['preRun'].length) {
|
|
1089
862
|
addOnPreRun(Module['preRun'].shift());
|
|
1090
863
|
}
|
|
1091
864
|
}
|
|
1092
|
-
consumedModuleProp('preRun');
|
|
1093
865
|
callRuntimeCallbacks(onPreRuns);
|
|
1094
866
|
}
|
|
1095
867
|
|
|
1096
868
|
function initRuntime() {
|
|
1097
|
-
assert(!runtimeInitialized);
|
|
1098
869
|
runtimeInitialized = true;
|
|
1099
870
|
|
|
1100
871
|
if (ENVIRONMENT_IS_PTHREAD) return startWorker(Module);
|
|
1101
872
|
|
|
1102
|
-
checkStackCookie();
|
|
1103
|
-
|
|
1104
873
|
if (!Module['noFSInit'] && !FS.initialized) FS.init();
|
|
1105
874
|
TTY.init();
|
|
1106
875
|
|
|
@@ -1110,12 +879,10 @@ TTY.init();
|
|
|
1110
879
|
}
|
|
1111
880
|
|
|
1112
881
|
function preMain() {
|
|
1113
|
-
checkStackCookie();
|
|
1114
882
|
|
|
1115
883
|
}
|
|
1116
884
|
|
|
1117
885
|
function postRun() {
|
|
1118
|
-
checkStackCookie();
|
|
1119
886
|
if (ENVIRONMENT_IS_PTHREAD) return; // PThreads reuse the runtime from the main thread.
|
|
1120
887
|
|
|
1121
888
|
if (Module['postRun']) {
|
|
@@ -1124,7 +891,6 @@ function postRun() {
|
|
|
1124
891
|
addOnPostRun(Module['postRun'].shift());
|
|
1125
892
|
}
|
|
1126
893
|
}
|
|
1127
|
-
consumedModuleProp('postRun');
|
|
1128
894
|
|
|
1129
895
|
callRuntimeCallbacks(onPostRuns);
|
|
1130
896
|
}
|
|
@@ -1138,15 +904,9 @@ function postRun() {
|
|
|
1138
904
|
// the dependencies are met.
|
|
1139
905
|
var runDependencies = 0;
|
|
1140
906
|
var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
|
|
1141
|
-
var runDependencyTracking = {};
|
|
1142
|
-
var runDependencyWatcher = null;
|
|
1143
907
|
|
|
1144
908
|
function getUniqueRunDependency(id) {
|
|
1145
|
-
|
|
1146
|
-
while (1) {
|
|
1147
|
-
if (!runDependencyTracking[id]) return id;
|
|
1148
|
-
id = orig + Math.random();
|
|
1149
|
-
}
|
|
909
|
+
return id;
|
|
1150
910
|
}
|
|
1151
911
|
|
|
1152
912
|
function addRunDependency(id) {
|
|
@@ -1154,33 +914,6 @@ function addRunDependency(id) {
|
|
|
1154
914
|
|
|
1155
915
|
Module['monitorRunDependencies']?.(runDependencies);
|
|
1156
916
|
|
|
1157
|
-
if (id) {
|
|
1158
|
-
assert(!runDependencyTracking[id]);
|
|
1159
|
-
runDependencyTracking[id] = 1;
|
|
1160
|
-
if (runDependencyWatcher === null && typeof setInterval != 'undefined') {
|
|
1161
|
-
// Check for missing dependencies every few seconds
|
|
1162
|
-
runDependencyWatcher = setInterval(() => {
|
|
1163
|
-
if (ABORT) {
|
|
1164
|
-
clearInterval(runDependencyWatcher);
|
|
1165
|
-
runDependencyWatcher = null;
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
1168
|
-
var shown = false;
|
|
1169
|
-
for (var dep in runDependencyTracking) {
|
|
1170
|
-
if (!shown) {
|
|
1171
|
-
shown = true;
|
|
1172
|
-
err('still waiting on run dependencies:');
|
|
1173
|
-
}
|
|
1174
|
-
err(`dependency: ${dep}`);
|
|
1175
|
-
}
|
|
1176
|
-
if (shown) {
|
|
1177
|
-
err('(end of list)');
|
|
1178
|
-
}
|
|
1179
|
-
}, 10000);
|
|
1180
|
-
}
|
|
1181
|
-
} else {
|
|
1182
|
-
err('warning: run dependency added without ID');
|
|
1183
|
-
}
|
|
1184
917
|
}
|
|
1185
918
|
|
|
1186
919
|
function removeRunDependency(id) {
|
|
@@ -1188,17 +921,7 @@ function removeRunDependency(id) {
|
|
|
1188
921
|
|
|
1189
922
|
Module['monitorRunDependencies']?.(runDependencies);
|
|
1190
923
|
|
|
1191
|
-
if (id) {
|
|
1192
|
-
assert(runDependencyTracking[id]);
|
|
1193
|
-
delete runDependencyTracking[id];
|
|
1194
|
-
} else {
|
|
1195
|
-
err('warning: run dependency removed without ID');
|
|
1196
|
-
}
|
|
1197
924
|
if (runDependencies == 0) {
|
|
1198
|
-
if (runDependencyWatcher !== null) {
|
|
1199
|
-
clearInterval(runDependencyWatcher);
|
|
1200
|
-
runDependencyWatcher = null;
|
|
1201
|
-
}
|
|
1202
925
|
if (dependenciesFulfilled) {
|
|
1203
926
|
var callback = dependenciesFulfilled;
|
|
1204
927
|
dependenciesFulfilled = null;
|
|
@@ -1218,6 +941,8 @@ function abort(what) {
|
|
|
1218
941
|
|
|
1219
942
|
ABORT = true;
|
|
1220
943
|
|
|
944
|
+
what += '. Build with -sASSERTIONS for more info.';
|
|
945
|
+
|
|
1221
946
|
// Use a wasm runtime error, because a JS error might be seen as a foreign
|
|
1222
947
|
// exception, which means we'd run destructors on it. We need the error to
|
|
1223
948
|
// simply make the program stop.
|
|
@@ -1241,17 +966,6 @@ function abort(what) {
|
|
|
1241
966
|
throw e;
|
|
1242
967
|
}
|
|
1243
968
|
|
|
1244
|
-
function createExportWrapper(name, nargs) {
|
|
1245
|
-
return (...args) => {
|
|
1246
|
-
assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`);
|
|
1247
|
-
var f = wasmExports[name];
|
|
1248
|
-
assert(f, `exported native function \`${name}\` not found`);
|
|
1249
|
-
// Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled.
|
|
1250
|
-
assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`);
|
|
1251
|
-
return f(...args);
|
|
1252
|
-
};
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
969
|
var wasmBinaryFile;
|
|
1256
970
|
function findWasmBinary() {
|
|
1257
971
|
if (Module['locateFile']) {
|
|
@@ -1295,10 +1009,6 @@ async function instantiateArrayBuffer(binaryFile, imports) {
|
|
|
1295
1009
|
} catch (reason) {
|
|
1296
1010
|
err(`failed to asynchronously prepare wasm: ${reason}`);
|
|
1297
1011
|
|
|
1298
|
-
// Warn on some common problems.
|
|
1299
|
-
if (isFileURI(wasmBinaryFile)) {
|
|
1300
|
-
err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`);
|
|
1301
|
-
}
|
|
1302
1012
|
abort(reason);
|
|
1303
1013
|
}
|
|
1304
1014
|
}
|
|
@@ -1346,7 +1056,6 @@ async function createWasm() {
|
|
|
1346
1056
|
|
|
1347
1057
|
wasmTable = wasmExports['__indirect_function_table'];
|
|
1348
1058
|
|
|
1349
|
-
assert(wasmTable, 'table not found in wasm exports');
|
|
1350
1059
|
|
|
1351
1060
|
// We now have the Wasm module loaded up, keep a reference to the compiled module so we can post it to the workers.
|
|
1352
1061
|
wasmModule = module;
|
|
@@ -1357,15 +1066,9 @@ async function createWasm() {
|
|
|
1357
1066
|
addRunDependency('wasm-instantiate');
|
|
1358
1067
|
|
|
1359
1068
|
// Prefer streaming instantiation if available.
|
|
1360
|
-
// Async compilation can be confusing when an error on the page overwrites Module
|
|
1361
|
-
// (for example, if the order of elements is wrong, and the one defining Module is
|
|
1362
|
-
// later), so we save Module and check it later.
|
|
1363
|
-
var trueModule = Module;
|
|
1364
1069
|
function receiveInstantiationResult(result) {
|
|
1365
1070
|
// 'result' is a ResultObject object which has both the module and instance.
|
|
1366
1071
|
// receiveInstance() will swap in the exports (to Module.asm) so they can be called
|
|
1367
|
-
assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');
|
|
1368
|
-
trueModule = null;
|
|
1369
1072
|
return receiveInstance(result['instance'], result['module']);
|
|
1370
1073
|
}
|
|
1371
1074
|
|
|
@@ -1379,15 +1082,10 @@ async function createWasm() {
|
|
|
1379
1082
|
// path.
|
|
1380
1083
|
if (Module['instantiateWasm']) {
|
|
1381
1084
|
return new Promise((resolve, reject) => {
|
|
1382
|
-
try {
|
|
1383
1085
|
Module['instantiateWasm'](info, (mod, inst) => {
|
|
1384
1086
|
receiveInstance(mod, inst);
|
|
1385
1087
|
resolve(mod.exports);
|
|
1386
1088
|
});
|
|
1387
|
-
} catch(e) {
|
|
1388
|
-
err(`Module.instantiateWasm callback failed with error: ${e}`);
|
|
1389
|
-
reject(e);
|
|
1390
|
-
}
|
|
1391
1089
|
});
|
|
1392
1090
|
}
|
|
1393
1091
|
|
|
@@ -1418,39 +1116,43 @@ async function createWasm() {
|
|
|
1418
1116
|
// === Body ===
|
|
1419
1117
|
|
|
1420
1118
|
var ASM_CONSTS = {
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1119
|
+
310240: () => { console.error("thread instantiation failed") },
|
|
1120
|
+
310289: ($0, $1) => { console.log("using videoSync/audioSync", $0, $1) },
|
|
1121
|
+
310342: ($0) => { console.log("using threadedVideo", $0) },
|
|
1122
|
+
310385: ($0) => { console.log('setting core audio buffer size:', $0) },
|
|
1123
|
+
310440: ($0, $1) => { Module.canvas.width = $0; Module.canvas.height = $1; },
|
|
1124
|
+
310497: ($0) => { console.log('setting audioSampleRate', $0) },
|
|
1125
|
+
310544: ($0) => { console.log('setting audioBufferSize', $0) },
|
|
1126
|
+
310591: ($0) => { console.log('setting videoSync', $0) },
|
|
1127
|
+
310632: ($0) => { console.log('setting audioSync', $0) },
|
|
1128
|
+
310673: ($0) => { console.log('setting threadedVideo', $0) },
|
|
1129
|
+
310718: ($0) => { console.log('setting rewindEnable', $0) },
|
|
1130
|
+
310762: ($0, $1, $2, $3, $4, $5, $6) => { Module.version = { gitCommit : UTF8ToString($0), gitShort : UTF8ToString($1), gitBranch : UTF8ToString($2), gitRevision : $3, binaryName : UTF8ToString($4), projectName : UTF8ToString($5), projectVersion : UTF8ToString($6) }; },
|
|
1131
|
+
310994: ($0) => { console.log("fps target audio", $0); },
|
|
1132
|
+
311035: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1133
|
+
311133: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1134
|
+
311231: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1135
|
+
311329: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1136
|
+
311427: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1137
|
+
311525: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1138
|
+
311623: ($0, $1, $2, $3) => { console.log("desired spec values: sampleRate/samples", $0, $1); console.log("obtained spec values: sampleRate/samples", $2, $3) },
|
|
1139
|
+
311755: () => { FS.syncfs(function (err) { assert(!err); }) },
|
|
1140
|
+
311799: ($0) => { var str = UTF8ToString($0) + '\n\n' + 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :'; var reply = window.prompt(str, "i"); if (reply === null) { reply = "i"; } return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL); },
|
|
1141
|
+
312024: () => { if (typeof(AudioContext) !== 'undefined') { return true; } else if (typeof(webkitAudioContext) !== 'undefined') { return true; } return false; },
|
|
1142
|
+
312171: () => { if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) { return true; } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') { return true; } return false; },
|
|
1143
|
+
312405: ($0) => { if(typeof(Module['SDL2']) === 'undefined') { Module['SDL2'] = {}; } var SDL2 = Module['SDL2']; if (!$0) { SDL2.audio = {}; } else { SDL2.capture = {}; } if (!SDL2.audioContext) { if (typeof(AudioContext) !== 'undefined') { SDL2.audioContext = new AudioContext(); } else if (typeof(webkitAudioContext) !== 'undefined') { SDL2.audioContext = new webkitAudioContext(); } if (SDL2.audioContext) { if ((typeof navigator.userActivation) === 'undefined') { autoResumeAudioContext(SDL2.audioContext); } } } return SDL2.audioContext === undefined ? -1 : 0; },
|
|
1144
|
+
312957: () => { var SDL2 = Module['SDL2']; return SDL2.audioContext.sampleRate; },
|
|
1145
|
+
313025: ($0, $1, $2, $3) => { var SDL2 = Module['SDL2']; var have_microphone = function(stream) { if (SDL2.capture.silenceTimer !== undefined) { clearInterval(SDL2.capture.silenceTimer); SDL2.capture.silenceTimer = undefined; SDL2.capture.silenceBuffer = undefined } SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream); SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1); SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) { if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; } audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0); SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer; dynCall('vi', $2, [$3]); }; SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode); SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination); SDL2.capture.stream = stream; }; var no_microphone = function(error) { }; SDL2.capture.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate); SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0); var silence_callback = function() { SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer; dynCall('vi', $2, [$3]); }; SDL2.capture.silenceTimer = setInterval(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); if ((navigator.mediaDevices !== undefined) && (navigator.mediaDevices.getUserMedia !== undefined)) { navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(have_microphone).catch(no_microphone); } else if (navigator.webkitGetUserMedia !== undefined) { navigator.webkitGetUserMedia({ audio: true, video: false }, have_microphone, no_microphone); } },
|
|
1146
|
+
314718: ($0, $1, $2, $3) => { var SDL2 = Module['SDL2']; SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; } if (SDL2.audio.silenceTimer !== undefined) { clearInterval(SDL2.audio.silenceTimer); SDL2.audio.silenceTimer = undefined; SDL2.audio.silenceBuffer = undefined; } SDL2.audio.currentOutputBuffer = e['outputBuffer']; dynCall('vi', $2, [$3]); }; SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']); if (SDL2.audioContext.state === 'suspended') { SDL2.audio.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate); SDL2.audio.silenceBuffer.getChannelData(0).fill(0.0); var silence_callback = function() { if ((typeof navigator.userActivation) !== 'undefined') { if (navigator.userActivation.hasBeenActive) { SDL2.audioContext.resume(); } } SDL2.audio.currentOutputBuffer = SDL2.audio.silenceBuffer; dynCall('vi', $2, [$3]); SDL2.audio.currentOutputBuffer = undefined; }; SDL2.audio.silenceTimer = setInterval(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); } },
|
|
1147
|
+
315893: ($0, $1) => { var SDL2 = Module['SDL2']; var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; for (var c = 0; c < numChannels; ++c) { var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); if (channelData.length != $1) { throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } if (numChannels == 1) { for (var j = 0; j < $1; ++j) { setValue($0 + (j * 4), channelData[j], 'float'); } } else { for (var j = 0; j < $1; ++j) { setValue($0 + (((j * numChannels) + c) * 4), channelData[j], 'float'); } } } },
|
|
1148
|
+
316498: ($0, $1) => { var SDL2 = Module['SDL2']; var buf = $0 >>> 2; var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; for (var c = 0; c < numChannels; ++c) { var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); if (channelData.length != $1) { throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } for (var j = 0; j < $1; ++j) { channelData[j] = HEAPF32[buf + (j*numChannels + c)]; } } },
|
|
1149
|
+
316987: ($0) => { var SDL2 = Module['SDL2']; if ($0) { if (SDL2.capture.silenceTimer !== undefined) { clearInterval(SDL2.capture.silenceTimer); } if (SDL2.capture.stream !== undefined) { var tracks = SDL2.capture.stream.getAudioTracks(); for (var i = 0; i < tracks.length; i++) { SDL2.capture.stream.removeTrack(tracks[i]); } } if (SDL2.capture.scriptProcessorNode !== undefined) { SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {}; SDL2.capture.scriptProcessorNode.disconnect(); } if (SDL2.capture.mediaStreamNode !== undefined) { SDL2.capture.mediaStreamNode.disconnect(); } SDL2.capture = undefined; } else { if (SDL2.audio.scriptProcessorNode != undefined) { SDL2.audio.scriptProcessorNode.disconnect(); } if (SDL2.audio.silenceTimer !== undefined) { clearInterval(SDL2.audio.silenceTimer); } SDL2.audio = undefined; } if ((SDL2.audioContext !== undefined) && (SDL2.audio === undefined) && (SDL2.capture === undefined)) { SDL2.audioContext.close(); SDL2.audioContext = undefined; } },
|
|
1150
|
+
317993: ($0, $1, $2) => { var w = $0; var h = $1; var pixels = $2; if (!Module['SDL2']) Module['SDL2'] = {}; var SDL2 = Module['SDL2']; if (SDL2.ctxCanvas !== Module['canvas']) { SDL2.ctx = Module['createContext'](Module['canvas'], false, true); SDL2.ctxCanvas = Module['canvas']; } if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) { SDL2.image = SDL2.ctx.createImageData(w, h); SDL2.w = w; SDL2.h = h; SDL2.imageCtx = SDL2.ctx; } var data = SDL2.image.data; var src = pixels / 4; var dst = 0; var num; if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { num = data.length; while (dst < num) { var val = HEAP32[src]; data[dst ] = val & 0xff; data[dst+1] = (val >> 8) & 0xff; data[dst+2] = (val >> 16) & 0xff; data[dst+3] = 0xff; src++; dst += 4; } } else { if (SDL2.data32Data !== data) { SDL2.data32 = new Int32Array(data.buffer); SDL2.data8 = new Uint8Array(data.buffer); SDL2.data32Data = data; } var data32 = SDL2.data32; num = data32.length; data32.set(HEAP32.subarray(src, src + num)); var data8 = SDL2.data8; var i = 3; var j = i + 4*num; if (num % 8 == 0) { while (i < j) { data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; } } else { while (i < j) { data8[i] = 0xff; i = i + 4 | 0; } } } SDL2.ctx.putImageData(SDL2.image, 0, 0); },
|
|
1151
|
+
319461: ($0, $1, $2, $3, $4) => { var w = $0; var h = $1; var hot_x = $2; var hot_y = $3; var pixels = $4; var canvas = document.createElement("canvas"); canvas.width = w; canvas.height = h; var ctx = canvas.getContext("2d"); var image = ctx.createImageData(w, h); var data = image.data; var src = pixels / 4; var dst = 0; var num; if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { num = data.length; while (dst < num) { var val = HEAP32[src]; data[dst ] = val & 0xff; data[dst+1] = (val >> 8) & 0xff; data[dst+2] = (val >> 16) & 0xff; data[dst+3] = (val >> 24) & 0xff; src++; dst += 4; } } else { var data32 = new Int32Array(data.buffer); num = data32.length; data32.set(HEAP32.subarray(src, src + num)); } ctx.putImageData(image, 0, 0); var url = hot_x === 0 && hot_y === 0 ? "url(" + canvas.toDataURL() + "), auto" : "url(" + canvas.toDataURL() + ") " + hot_x + " " + hot_y + ", auto"; var urlBuf = _malloc(url.length + 1); stringToUTF8(url, urlBuf, url.length + 1); return urlBuf; },
|
|
1152
|
+
320449: ($0) => { if (Module['canvas']) { Module['canvas'].style['cursor'] = UTF8ToString($0); } },
|
|
1153
|
+
320532: () => { if (Module['canvas']) { Module['canvas'].style['cursor'] = 'none'; } },
|
|
1154
|
+
320601: () => { return window.innerWidth; },
|
|
1155
|
+
320631: () => { return window.innerHeight; }
|
|
1454
1156
|
};
|
|
1455
1157
|
|
|
1456
1158
|
// end include: preamble.js
|
|
@@ -1473,16 +1175,11 @@ var ASM_CONSTS = {
|
|
|
1473
1175
|
// out its message handler here. This avoids having to check in each of
|
|
1474
1176
|
// the onmessage handlers if the message was coming from valid worker.
|
|
1475
1177
|
worker.onmessage = (e) => {
|
|
1476
|
-
var cmd = e['data'].cmd;
|
|
1477
|
-
err(`received "${cmd}" command from terminated worker: ${worker.workerID}`);
|
|
1478
1178
|
};
|
|
1479
1179
|
};
|
|
1480
1180
|
|
|
1481
1181
|
var cleanupThread = (pthread_ptr) => {
|
|
1482
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! cleanupThread() can only ever be called from main application thread!');
|
|
1483
|
-
assert(pthread_ptr, 'Internal Error! Null pthread_ptr in cleanupThread!');
|
|
1484
1182
|
var worker = PThread.pthreads[pthread_ptr];
|
|
1485
|
-
assert(worker);
|
|
1486
1183
|
PThread.returnWorkerToPool(worker);
|
|
1487
1184
|
};
|
|
1488
1185
|
|
|
@@ -1496,15 +1193,12 @@ var ASM_CONSTS = {
|
|
|
1496
1193
|
var addOnPreRun = (cb) => onPreRuns.unshift(cb);
|
|
1497
1194
|
|
|
1498
1195
|
var spawnThread = (threadParams) => {
|
|
1499
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! spawnThread() can only ever be called from main application thread!');
|
|
1500
|
-
assert(threadParams.pthread_ptr, 'Internal error, no pthread ptr!');
|
|
1501
1196
|
|
|
1502
1197
|
var worker = PThread.getNewWorker();
|
|
1503
1198
|
if (!worker) {
|
|
1504
1199
|
// No available workers in the PThread pool.
|
|
1505
1200
|
return 6;
|
|
1506
1201
|
}
|
|
1507
|
-
assert(!worker.pthread_ptr, 'Internal error!');
|
|
1508
1202
|
|
|
1509
1203
|
PThread.runningWorkers.push(worker);
|
|
1510
1204
|
|
|
@@ -1596,7 +1290,6 @@ var ASM_CONSTS = {
|
|
|
1596
1290
|
|
|
1597
1291
|
|
|
1598
1292
|
|
|
1599
|
-
|
|
1600
1293
|
var handleException = (e) => {
|
|
1601
1294
|
// Certain exception types we do not treat as errors since they are used for
|
|
1602
1295
|
// internal control flow.
|
|
@@ -1606,12 +1299,6 @@ var ASM_CONSTS = {
|
|
|
1606
1299
|
if (e instanceof ExitStatus || e == 'unwind') {
|
|
1607
1300
|
return EXITSTATUS;
|
|
1608
1301
|
}
|
|
1609
|
-
checkStackCookie();
|
|
1610
|
-
if (e instanceof WebAssembly.RuntimeError) {
|
|
1611
|
-
if (_emscripten_stack_get_current() <= 0) {
|
|
1612
|
-
err('Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)');
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
1302
|
quit_(1, e);
|
|
1616
1303
|
};
|
|
1617
1304
|
|
|
@@ -1625,17 +1312,13 @@ var ASM_CONSTS = {
|
|
|
1625
1312
|
|
|
1626
1313
|
}
|
|
1627
1314
|
|
|
1628
|
-
|
|
1629
1315
|
/** @suppress {duplicate } */
|
|
1630
1316
|
/** @param {boolean|number=} implicit */
|
|
1631
1317
|
var exitJS = (status, implicit) => {
|
|
1632
1318
|
EXITSTATUS = status;
|
|
1633
1319
|
|
|
1634
|
-
checkUnflushedContent();
|
|
1635
|
-
|
|
1636
1320
|
if (ENVIRONMENT_IS_PTHREAD) {
|
|
1637
1321
|
// implicit exit can never happen on a pthread
|
|
1638
|
-
assert(!implicit);
|
|
1639
1322
|
// When running in a pthread we propagate the exit back to the main thread
|
|
1640
1323
|
// where it can decide if the whole process should be shut down or not.
|
|
1641
1324
|
// The pthread may have decided not to exit its own runtime, for example
|
|
@@ -1644,24 +1327,10 @@ var ASM_CONSTS = {
|
|
|
1644
1327
|
throw 'unwind';
|
|
1645
1328
|
}
|
|
1646
1329
|
|
|
1647
|
-
// if exit() was called explicitly, warn the user if the runtime isn't actually being shut down
|
|
1648
|
-
if (keepRuntimeAlive() && !implicit) {
|
|
1649
|
-
var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;
|
|
1650
|
-
readyPromiseReject(msg);
|
|
1651
|
-
err(msg);
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
1330
|
_proc_exit(status);
|
|
1655
1331
|
};
|
|
1656
1332
|
var _exit = exitJS;
|
|
1657
1333
|
|
|
1658
|
-
var ptrToString = (ptr) => {
|
|
1659
|
-
assert(typeof ptr === 'number');
|
|
1660
|
-
// With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
|
|
1661
|
-
ptr >>>= 0;
|
|
1662
|
-
return '0x' + ptr.toString(16).padStart(8, '0');
|
|
1663
|
-
};
|
|
1664
|
-
|
|
1665
1334
|
|
|
1666
1335
|
var PThread = {
|
|
1667
1336
|
unusedWorkers:[],
|
|
@@ -1669,23 +1338,7 @@ var ASM_CONSTS = {
|
|
|
1669
1338
|
tlsInitFunctions:[],
|
|
1670
1339
|
pthreads:{
|
|
1671
1340
|
},
|
|
1672
|
-
nextWorkerID:1,
|
|
1673
|
-
debugInit() {
|
|
1674
|
-
function pthreadLogPrefix() {
|
|
1675
|
-
var t = 0;
|
|
1676
|
-
if (runtimeInitialized && typeof _pthread_self != 'undefined'
|
|
1677
|
-
) {
|
|
1678
|
-
t = _pthread_self();
|
|
1679
|
-
}
|
|
1680
|
-
return `w:${workerID},t:${ptrToString(t)}: `;
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
// Prefix all err()/dbg() messages with the calling thread ID.
|
|
1684
|
-
var origDbg = dbg;
|
|
1685
|
-
dbg = (...args) => origDbg(pthreadLogPrefix() + args.join(' '));
|
|
1686
|
-
},
|
|
1687
1341
|
init() {
|
|
1688
|
-
PThread.debugInit();
|
|
1689
1342
|
if ((!(ENVIRONMENT_IS_PTHREAD))) {
|
|
1690
1343
|
PThread.initMainThread();
|
|
1691
1344
|
}
|
|
@@ -1704,7 +1357,6 @@ var ASM_CONSTS = {
|
|
|
1704
1357
|
});
|
|
1705
1358
|
},
|
|
1706
1359
|
terminateAllThreads:() => {
|
|
1707
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! terminateAllThreads() can only ever be called from main application thread!');
|
|
1708
1360
|
// Attempt to kill all workers. Sadly (at least on the web) there is no
|
|
1709
1361
|
// way to terminate a worker synchronously, or to be notified when a
|
|
1710
1362
|
// worker in actually terminated. This means there is some risk that
|
|
@@ -1792,16 +1444,10 @@ var ASM_CONSTS = {
|
|
|
1792
1444
|
|
|
1793
1445
|
worker.onerror = (e) => {
|
|
1794
1446
|
var message = 'worker sent an error!';
|
|
1795
|
-
if (worker.pthread_ptr) {
|
|
1796
|
-
message = `Pthread ${ptrToString(worker.pthread_ptr)} sent an error!`;
|
|
1797
|
-
}
|
|
1798
1447
|
err(`${message} ${e.filename}:${e.lineno}: ${e.message}`);
|
|
1799
1448
|
throw e;
|
|
1800
1449
|
};
|
|
1801
1450
|
|
|
1802
|
-
assert(wasmMemory instanceof WebAssembly.Memory, 'WebAssembly memory should have been loaded by now!');
|
|
1803
|
-
assert(wasmModule instanceof WebAssembly.Module, 'WebAssembly Module should have been loaded by now!');
|
|
1804
|
-
|
|
1805
1451
|
// When running on a pthread, none of the incoming parameters on the module
|
|
1806
1452
|
// object are present. Proxy known handlers back to the main thread if specified.
|
|
1807
1453
|
var handlers = [];
|
|
@@ -1817,15 +1463,12 @@ var ASM_CONSTS = {
|
|
|
1817
1463
|
}
|
|
1818
1464
|
}
|
|
1819
1465
|
|
|
1820
|
-
worker.workerID = PThread.nextWorkerID++;
|
|
1821
|
-
|
|
1822
1466
|
// Ask the new worker to load up the Emscripten-compiled page. This is a heavy operation.
|
|
1823
1467
|
worker.postMessage({
|
|
1824
1468
|
cmd: 'load',
|
|
1825
1469
|
handlers: handlers,
|
|
1826
1470
|
wasmMemory,
|
|
1827
1471
|
wasmModule,
|
|
1828
|
-
'workerID': worker.workerID,
|
|
1829
1472
|
});
|
|
1830
1473
|
}),
|
|
1831
1474
|
loadWasmModuleToAllWorkers(onMaybeReady) {
|
|
@@ -1850,20 +1493,13 @@ var ASM_CONSTS = {
|
|
|
1850
1493
|
'type': 'module',
|
|
1851
1494
|
// This is the way that we signal to the Web Worker that it is hosting
|
|
1852
1495
|
// a pthread.
|
|
1853
|
-
'name': 'em-pthread
|
|
1496
|
+
'name': 'em-pthread',
|
|
1854
1497
|
});
|
|
1855
1498
|
PThread.unusedWorkers.push(worker);
|
|
1856
1499
|
},
|
|
1857
1500
|
getNewWorker() {
|
|
1858
1501
|
if (PThread.unusedWorkers.length == 0) {
|
|
1859
1502
|
// PTHREAD_POOL_SIZE_STRICT should show a warning and, if set to level `2`, return from the function.
|
|
1860
|
-
// However, if we're in Node.js, then we can create new workers on the fly and PTHREAD_POOL_SIZE_STRICT
|
|
1861
|
-
// should be ignored altogether.
|
|
1862
|
-
err('Tried to spawn a new thread, but the thread pool is exhausted.\n' +
|
|
1863
|
-
'This might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.\n' +
|
|
1864
|
-
'If you want to increase the pool size, use setting `-sPTHREAD_POOL_SIZE=...`.'
|
|
1865
|
-
+ '\nIf you want to throw an explicit error instead of the risk of deadlocking in those cases, use setting `-sPTHREAD_POOL_SIZE_STRICT=2`.'
|
|
1866
|
-
);
|
|
1867
1503
|
PThread.allocateUnusedWorker();
|
|
1868
1504
|
PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]);
|
|
1869
1505
|
}
|
|
@@ -1882,9 +1518,6 @@ var ASM_CONSTS = {
|
|
|
1882
1518
|
var stackHigh = HEAPU32[(((pthread_ptr)+(52))>>2)];
|
|
1883
1519
|
var stackSize = HEAPU32[(((pthread_ptr)+(56))>>2)];
|
|
1884
1520
|
var stackLow = stackHigh - stackSize;
|
|
1885
|
-
assert(stackHigh != 0);
|
|
1886
|
-
assert(stackLow != 0);
|
|
1887
|
-
assert(stackHigh > stackLow, 'stackHigh must be higher then stackLow');
|
|
1888
1521
|
// Set stack limits used by `emscripten/stack.h` function. These limits are
|
|
1889
1522
|
// cached in wasm-side globals to make checks as fast as possible.
|
|
1890
1523
|
_emscripten_stack_set_limits(stackHigh, stackLow);
|
|
@@ -1892,9 +1525,6 @@ var ASM_CONSTS = {
|
|
|
1892
1525
|
// Call inside wasm module to set up the stack frame for this pthread in wasm module scope
|
|
1893
1526
|
stackRestore(stackHigh);
|
|
1894
1527
|
|
|
1895
|
-
// Write the stack cookie last, after we have set up the proper bounds and
|
|
1896
|
-
// current position of the stack.
|
|
1897
|
-
writeStackCookie();
|
|
1898
1528
|
};
|
|
1899
1529
|
|
|
1900
1530
|
|
|
@@ -1932,8 +1562,6 @@ var ASM_CONSTS = {
|
|
|
1932
1562
|
/** @suppress {checkTypes} */
|
|
1933
1563
|
wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
|
|
1934
1564
|
}
|
|
1935
|
-
/** @suppress {checkTypes} */
|
|
1936
|
-
assert(wasmTable.get(funcPtr) == func, 'JavaScript-side Wasm function table mirror is out of date!');
|
|
1937
1565
|
return func;
|
|
1938
1566
|
};
|
|
1939
1567
|
var invokeEntryPoint = (ptr, arg) => {
|
|
@@ -1962,7 +1590,6 @@ var ASM_CONSTS = {
|
|
|
1962
1590
|
|
|
1963
1591
|
var result = getWasmTableEntry(ptr)(arg);
|
|
1964
1592
|
|
|
1965
|
-
checkStackCookie();
|
|
1966
1593
|
function finish(result) {
|
|
1967
1594
|
if (keepRuntimeAlive()) {
|
|
1968
1595
|
EXITSTATUS = result;
|
|
@@ -1975,7 +1602,6 @@ var ASM_CONSTS = {
|
|
|
1975
1602
|
|
|
1976
1603
|
var noExitRuntime = Module['noExitRuntime'] || true;
|
|
1977
1604
|
|
|
1978
|
-
|
|
1979
1605
|
var registerTLSInit = (tlsInitFunc) => PThread.tlsInitFunctions.push(tlsInitFunc);
|
|
1980
1606
|
|
|
1981
1607
|
|
|
@@ -2001,14 +1627,6 @@ var ASM_CONSTS = {
|
|
|
2001
1627
|
|
|
2002
1628
|
|
|
2003
1629
|
|
|
2004
|
-
var warnOnce = (text) => {
|
|
2005
|
-
warnOnce.shown ||= {};
|
|
2006
|
-
if (!warnOnce.shown[text]) {
|
|
2007
|
-
warnOnce.shown[text] = 1;
|
|
2008
|
-
err(text);
|
|
2009
|
-
}
|
|
2010
|
-
};
|
|
2011
|
-
|
|
2012
1630
|
var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined;
|
|
2013
1631
|
|
|
2014
1632
|
/**
|
|
@@ -2049,7 +1667,6 @@ var ASM_CONSTS = {
|
|
|
2049
1667
|
if ((u0 & 0xF0) == 0xE0) {
|
|
2050
1668
|
u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
|
|
2051
1669
|
} else {
|
|
2052
|
-
if ((u0 & 0xF8) != 0xF0) warnOnce('Invalid UTF-8 leading byte ' + ptrToString(u0) + ' encountered when deserializing a UTF-8 string in wasm memory to a JS string!');
|
|
2053
1670
|
u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
|
|
2054
1671
|
}
|
|
2055
1672
|
|
|
@@ -2079,7 +1696,6 @@ var ASM_CONSTS = {
|
|
|
2079
1696
|
* @return {string}
|
|
2080
1697
|
*/
|
|
2081
1698
|
var UTF8ToString = (ptr, maxBytesToRead) => {
|
|
2082
|
-
assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
|
|
2083
1699
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
|
|
2084
1700
|
};
|
|
2085
1701
|
var ___assert_fail = (condition, filename, line, func) =>
|
|
@@ -2103,7 +1719,6 @@ var ASM_CONSTS = {
|
|
|
2103
1719
|
|
|
2104
1720
|
var ___pthread_create_js = (pthread_ptr, attr, startRoutine, arg) => {
|
|
2105
1721
|
if (!_emscripten_has_threading_support()) {
|
|
2106
|
-
dbg('pthread_create: environment does not support SharedArrayBuffer, pthreads are not available');
|
|
2107
1722
|
return 6;
|
|
2108
1723
|
}
|
|
2109
1724
|
|
|
@@ -2147,7 +1762,6 @@ var ASM_CONSTS = {
|
|
|
2147
1762
|
|
|
2148
1763
|
/** @suppress {duplicate } */
|
|
2149
1764
|
var syscallGetVarargI = () => {
|
|
2150
|
-
assert(SYSCALLS.varargs != undefined);
|
|
2151
1765
|
// the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number.
|
|
2152
1766
|
var ret = HEAP32[((+SYSCALLS.varargs)>>2)];
|
|
2153
1767
|
SYSCALLS.varargs += 4;
|
|
@@ -2310,7 +1924,6 @@ var ASM_CONSTS = {
|
|
|
2310
1924
|
};
|
|
2311
1925
|
|
|
2312
1926
|
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
2313
|
-
assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
|
|
2314
1927
|
// Parameter maxBytesToWrite is not optional. Negative values, 0, null,
|
|
2315
1928
|
// undefined and false each don't write out any bytes.
|
|
2316
1929
|
if (!(maxBytesToWrite > 0))
|
|
@@ -2345,7 +1958,6 @@ var ASM_CONSTS = {
|
|
|
2345
1958
|
heap[outIdx++] = 0x80 | (u & 63);
|
|
2346
1959
|
} else {
|
|
2347
1960
|
if (outIdx + 3 >= endIdx) break;
|
|
2348
|
-
if (u > 0x10FFFF) warnOnce('Invalid Unicode code point ' + ptrToString(u) + ' encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).');
|
|
2349
1961
|
heap[outIdx++] = 0xF0 | (u >> 18);
|
|
2350
1962
|
heap[outIdx++] = 0x80 | ((u >> 12) & 63);
|
|
2351
1963
|
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
@@ -2531,7 +2143,6 @@ var ASM_CONSTS = {
|
|
|
2531
2143
|
};
|
|
2532
2144
|
|
|
2533
2145
|
var alignMemory = (size, alignment) => {
|
|
2534
|
-
assert(alignment, "alignment argument is required");
|
|
2535
2146
|
return Math.ceil(size / alignment) * alignment;
|
|
2536
2147
|
};
|
|
2537
2148
|
var mmapAlloc = (size) => {
|
|
@@ -2697,7 +2308,7 @@ var ASM_CONSTS = {
|
|
|
2697
2308
|
}
|
|
2698
2309
|
},
|
|
2699
2310
|
lookup(parent, name) {
|
|
2700
|
-
throw
|
|
2311
|
+
throw MEMFS.doesNotExistError;
|
|
2701
2312
|
},
|
|
2702
2313
|
mknod(parent, name, mode, dev) {
|
|
2703
2314
|
return MEMFS.createNode(parent, name, mode, dev);
|
|
@@ -2754,7 +2365,6 @@ var ASM_CONSTS = {
|
|
|
2754
2365
|
var contents = stream.node.contents;
|
|
2755
2366
|
if (position >= stream.node.usedBytes) return 0;
|
|
2756
2367
|
var size = Math.min(stream.node.usedBytes - position, length);
|
|
2757
|
-
assert(size >= 0);
|
|
2758
2368
|
if (size > 8 && contents.subarray) { // non-trivial, and typed array
|
|
2759
2369
|
buffer.set(contents.subarray(position, position + size), offset);
|
|
2760
2370
|
} else {
|
|
@@ -2763,8 +2373,6 @@ var ASM_CONSTS = {
|
|
|
2763
2373
|
return size;
|
|
2764
2374
|
},
|
|
2765
2375
|
write(stream, buffer, offset, length, position, canOwn) {
|
|
2766
|
-
// The data buffer should be a typed array view
|
|
2767
|
-
assert(!(buffer instanceof ArrayBuffer));
|
|
2768
2376
|
|
|
2769
2377
|
if (!length) return 0;
|
|
2770
2378
|
var node = stream.node;
|
|
@@ -2772,7 +2380,6 @@ var ASM_CONSTS = {
|
|
|
2772
2380
|
|
|
2773
2381
|
if (buffer.subarray && (!node.contents || node.contents.subarray)) { // This write is from a typed array to a typed array?
|
|
2774
2382
|
if (canOwn) {
|
|
2775
|
-
assert(position === 0, 'canOwn must imply no weird position inside the file');
|
|
2776
2383
|
node.contents = buffer.subarray(offset, offset + length);
|
|
2777
2384
|
node.usedBytes = length;
|
|
2778
2385
|
return length;
|
|
@@ -2860,7 +2467,6 @@ var ASM_CONSTS = {
|
|
|
2860
2467
|
|
|
2861
2468
|
var asyncLoad = async (url) => {
|
|
2862
2469
|
var arrayBuffer = await readAsync(url);
|
|
2863
|
-
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
|
|
2864
2470
|
return new Uint8Array(arrayBuffer);
|
|
2865
2471
|
};
|
|
2866
2472
|
|
|
@@ -2949,7 +2555,6 @@ var ASM_CONSTS = {
|
|
|
2949
2555
|
if (typeof indexedDB != 'undefined') return indexedDB;
|
|
2950
2556
|
var ret = null;
|
|
2951
2557
|
if (typeof window == 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
2952
|
-
assert(ret, 'IDBFS used, but indexedDB not supported');
|
|
2953
2558
|
return ret;
|
|
2954
2559
|
},
|
|
2955
2560
|
DB_VERSION:21,
|
|
@@ -3312,134 +2917,6 @@ var ASM_CONSTS = {
|
|
|
3312
2917
|
});
|
|
3313
2918
|
},
|
|
3314
2919
|
};
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
var strError = (errno) => UTF8ToString(_strerror(errno));
|
|
3319
|
-
|
|
3320
|
-
var ERRNO_CODES = {
|
|
3321
|
-
'EPERM': 63,
|
|
3322
|
-
'ENOENT': 44,
|
|
3323
|
-
'ESRCH': 71,
|
|
3324
|
-
'EINTR': 27,
|
|
3325
|
-
'EIO': 29,
|
|
3326
|
-
'ENXIO': 60,
|
|
3327
|
-
'E2BIG': 1,
|
|
3328
|
-
'ENOEXEC': 45,
|
|
3329
|
-
'EBADF': 8,
|
|
3330
|
-
'ECHILD': 12,
|
|
3331
|
-
'EAGAIN': 6,
|
|
3332
|
-
'EWOULDBLOCK': 6,
|
|
3333
|
-
'ENOMEM': 48,
|
|
3334
|
-
'EACCES': 2,
|
|
3335
|
-
'EFAULT': 21,
|
|
3336
|
-
'ENOTBLK': 105,
|
|
3337
|
-
'EBUSY': 10,
|
|
3338
|
-
'EEXIST': 20,
|
|
3339
|
-
'EXDEV': 75,
|
|
3340
|
-
'ENODEV': 43,
|
|
3341
|
-
'ENOTDIR': 54,
|
|
3342
|
-
'EISDIR': 31,
|
|
3343
|
-
'EINVAL': 28,
|
|
3344
|
-
'ENFILE': 41,
|
|
3345
|
-
'EMFILE': 33,
|
|
3346
|
-
'ENOTTY': 59,
|
|
3347
|
-
'ETXTBSY': 74,
|
|
3348
|
-
'EFBIG': 22,
|
|
3349
|
-
'ENOSPC': 51,
|
|
3350
|
-
'ESPIPE': 70,
|
|
3351
|
-
'EROFS': 69,
|
|
3352
|
-
'EMLINK': 34,
|
|
3353
|
-
'EPIPE': 64,
|
|
3354
|
-
'EDOM': 18,
|
|
3355
|
-
'ERANGE': 68,
|
|
3356
|
-
'ENOMSG': 49,
|
|
3357
|
-
'EIDRM': 24,
|
|
3358
|
-
'ECHRNG': 106,
|
|
3359
|
-
'EL2NSYNC': 156,
|
|
3360
|
-
'EL3HLT': 107,
|
|
3361
|
-
'EL3RST': 108,
|
|
3362
|
-
'ELNRNG': 109,
|
|
3363
|
-
'EUNATCH': 110,
|
|
3364
|
-
'ENOCSI': 111,
|
|
3365
|
-
'EL2HLT': 112,
|
|
3366
|
-
'EDEADLK': 16,
|
|
3367
|
-
'ENOLCK': 46,
|
|
3368
|
-
'EBADE': 113,
|
|
3369
|
-
'EBADR': 114,
|
|
3370
|
-
'EXFULL': 115,
|
|
3371
|
-
'ENOANO': 104,
|
|
3372
|
-
'EBADRQC': 103,
|
|
3373
|
-
'EBADSLT': 102,
|
|
3374
|
-
'EDEADLOCK': 16,
|
|
3375
|
-
'EBFONT': 101,
|
|
3376
|
-
'ENOSTR': 100,
|
|
3377
|
-
'ENODATA': 116,
|
|
3378
|
-
'ETIME': 117,
|
|
3379
|
-
'ENOSR': 118,
|
|
3380
|
-
'ENONET': 119,
|
|
3381
|
-
'ENOPKG': 120,
|
|
3382
|
-
'EREMOTE': 121,
|
|
3383
|
-
'ENOLINK': 47,
|
|
3384
|
-
'EADV': 122,
|
|
3385
|
-
'ESRMNT': 123,
|
|
3386
|
-
'ECOMM': 124,
|
|
3387
|
-
'EPROTO': 65,
|
|
3388
|
-
'EMULTIHOP': 36,
|
|
3389
|
-
'EDOTDOT': 125,
|
|
3390
|
-
'EBADMSG': 9,
|
|
3391
|
-
'ENOTUNIQ': 126,
|
|
3392
|
-
'EBADFD': 127,
|
|
3393
|
-
'EREMCHG': 128,
|
|
3394
|
-
'ELIBACC': 129,
|
|
3395
|
-
'ELIBBAD': 130,
|
|
3396
|
-
'ELIBSCN': 131,
|
|
3397
|
-
'ELIBMAX': 132,
|
|
3398
|
-
'ELIBEXEC': 133,
|
|
3399
|
-
'ENOSYS': 52,
|
|
3400
|
-
'ENOTEMPTY': 55,
|
|
3401
|
-
'ENAMETOOLONG': 37,
|
|
3402
|
-
'ELOOP': 32,
|
|
3403
|
-
'EOPNOTSUPP': 138,
|
|
3404
|
-
'EPFNOSUPPORT': 139,
|
|
3405
|
-
'ECONNRESET': 15,
|
|
3406
|
-
'ENOBUFS': 42,
|
|
3407
|
-
'EAFNOSUPPORT': 5,
|
|
3408
|
-
'EPROTOTYPE': 67,
|
|
3409
|
-
'ENOTSOCK': 57,
|
|
3410
|
-
'ENOPROTOOPT': 50,
|
|
3411
|
-
'ESHUTDOWN': 140,
|
|
3412
|
-
'ECONNREFUSED': 14,
|
|
3413
|
-
'EADDRINUSE': 3,
|
|
3414
|
-
'ECONNABORTED': 13,
|
|
3415
|
-
'ENETUNREACH': 40,
|
|
3416
|
-
'ENETDOWN': 38,
|
|
3417
|
-
'ETIMEDOUT': 73,
|
|
3418
|
-
'EHOSTDOWN': 142,
|
|
3419
|
-
'EHOSTUNREACH': 23,
|
|
3420
|
-
'EINPROGRESS': 26,
|
|
3421
|
-
'EALREADY': 7,
|
|
3422
|
-
'EDESTADDRREQ': 17,
|
|
3423
|
-
'EMSGSIZE': 35,
|
|
3424
|
-
'EPROTONOSUPPORT': 66,
|
|
3425
|
-
'ESOCKTNOSUPPORT': 137,
|
|
3426
|
-
'EADDRNOTAVAIL': 4,
|
|
3427
|
-
'ENETRESET': 39,
|
|
3428
|
-
'EISCONN': 30,
|
|
3429
|
-
'ENOTCONN': 53,
|
|
3430
|
-
'ETOOMANYREFS': 141,
|
|
3431
|
-
'EUSERS': 136,
|
|
3432
|
-
'EDQUOT': 19,
|
|
3433
|
-
'ESTALE': 72,
|
|
3434
|
-
'ENOTSUP': 138,
|
|
3435
|
-
'ENOMEDIUM': 148,
|
|
3436
|
-
'EILSEQ': 25,
|
|
3437
|
-
'EOVERFLOW': 61,
|
|
3438
|
-
'ECANCELED': 11,
|
|
3439
|
-
'ENOTRECOVERABLE': 56,
|
|
3440
|
-
'EOWNERDEAD': 62,
|
|
3441
|
-
'ESTRPIPE': 135,
|
|
3442
|
-
};
|
|
3443
2920
|
var FS = {
|
|
3444
2921
|
root:null,
|
|
3445
2922
|
mounts:[],
|
|
@@ -3455,7 +2932,7 @@ var ASM_CONSTS = {
|
|
|
3455
2932
|
syncFSRequests:0,
|
|
3456
2933
|
readFiles:{
|
|
3457
2934
|
},
|
|
3458
|
-
ErrnoError:class
|
|
2935
|
+
ErrnoError:class {
|
|
3459
2936
|
name = 'ErrnoError';
|
|
3460
2937
|
// We set the `name` property to be able to identify `FS.ErrnoError`
|
|
3461
2938
|
// - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway.
|
|
@@ -3464,14 +2941,7 @@ var ASM_CONSTS = {
|
|
|
3464
2941
|
// the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs.
|
|
3465
2942
|
// we'll use the reliable test `err.name == "ErrnoError"` instead
|
|
3466
2943
|
constructor(errno) {
|
|
3467
|
-
super(runtimeInitialized ? strError(errno) : '');
|
|
3468
2944
|
this.errno = errno;
|
|
3469
|
-
for (var key in ERRNO_CODES) {
|
|
3470
|
-
if (ERRNO_CODES[key] === errno) {
|
|
3471
|
-
this.code = key;
|
|
3472
|
-
break;
|
|
3473
|
-
}
|
|
3474
|
-
}
|
|
3475
2945
|
}
|
|
3476
2946
|
},
|
|
3477
2947
|
FSStream:class {
|
|
@@ -3669,7 +3139,6 @@ var ASM_CONSTS = {
|
|
|
3669
3139
|
return FS.lookup(parent, name);
|
|
3670
3140
|
},
|
|
3671
3141
|
createNode(parent, name, mode, rdev) {
|
|
3672
|
-
assert(typeof parent == 'object')
|
|
3673
3142
|
var node = new FS.FSNode(parent, name, mode, rdev);
|
|
3674
3143
|
|
|
3675
3144
|
FS.hashAddNode(node);
|
|
@@ -3808,7 +3277,6 @@ var ASM_CONSTS = {
|
|
|
3808
3277
|
},
|
|
3809
3278
|
getStream:(fd) => FS.streams[fd],
|
|
3810
3279
|
createStream(stream, fd = -1) {
|
|
3811
|
-
assert(fd >= -1);
|
|
3812
3280
|
|
|
3813
3281
|
// clone it, so we can return an instance of FSStream
|
|
3814
3282
|
stream = Object.assign(new FS.FSStream(), stream);
|
|
@@ -3883,7 +3351,6 @@ var ASM_CONSTS = {
|
|
|
3883
3351
|
var completed = 0;
|
|
3884
3352
|
|
|
3885
3353
|
function doCallback(errCode) {
|
|
3886
|
-
assert(FS.syncFSRequests > 0);
|
|
3887
3354
|
FS.syncFSRequests--;
|
|
3888
3355
|
return callback(errCode);
|
|
3889
3356
|
}
|
|
@@ -3910,11 +3377,6 @@ var ASM_CONSTS = {
|
|
|
3910
3377
|
});
|
|
3911
3378
|
},
|
|
3912
3379
|
mount(type, opts, mountpoint) {
|
|
3913
|
-
if (typeof type == 'string') {
|
|
3914
|
-
// The filesystem was not included, and instead we have an error
|
|
3915
|
-
// message stored in the variable.
|
|
3916
|
-
throw type;
|
|
3917
|
-
}
|
|
3918
3380
|
var root = mountpoint === '/';
|
|
3919
3381
|
var pseudo = !mountpoint;
|
|
3920
3382
|
var node;
|
|
@@ -3993,7 +3455,6 @@ var ASM_CONSTS = {
|
|
|
3993
3455
|
|
|
3994
3456
|
// remove this mount from the child mounts
|
|
3995
3457
|
var idx = node.mount.mounts.indexOf(mount);
|
|
3996
|
-
assert(idx !== -1);
|
|
3997
3458
|
node.mount.mounts.splice(idx, 1);
|
|
3998
3459
|
},
|
|
3999
3460
|
lookup(parent, name) {
|
|
@@ -4486,7 +3947,6 @@ var ASM_CONSTS = {
|
|
|
4486
3947
|
return stream.position;
|
|
4487
3948
|
},
|
|
4488
3949
|
read(stream, buffer, offset, length, position) {
|
|
4489
|
-
assert(offset >= 0);
|
|
4490
3950
|
if (length < 0 || position < 0) {
|
|
4491
3951
|
throw new FS.ErrnoError(28);
|
|
4492
3952
|
}
|
|
@@ -4513,7 +3973,6 @@ var ASM_CONSTS = {
|
|
|
4513
3973
|
return bytesRead;
|
|
4514
3974
|
},
|
|
4515
3975
|
write(stream, buffer, offset, length, position, canOwn) {
|
|
4516
|
-
assert(offset >= 0);
|
|
4517
3976
|
if (length < 0 || position < 0) {
|
|
4518
3977
|
throw new FS.ErrnoError(28);
|
|
4519
3978
|
}
|
|
@@ -4585,7 +4044,6 @@ var ASM_CONSTS = {
|
|
|
4585
4044
|
return stream.stream_ops.mmap(stream, length, position, prot, flags);
|
|
4586
4045
|
},
|
|
4587
4046
|
msync(stream, buffer, offset, length, mmapFlags) {
|
|
4588
|
-
assert(offset >= 0);
|
|
4589
4047
|
if (!stream.stream_ops.msync) {
|
|
4590
4048
|
return 0;
|
|
4591
4049
|
}
|
|
@@ -4749,9 +4207,6 @@ var ASM_CONSTS = {
|
|
|
4749
4207
|
var stdin = FS.open('/dev/stdin', 0);
|
|
4750
4208
|
var stdout = FS.open('/dev/stdout', 1);
|
|
4751
4209
|
var stderr = FS.open('/dev/stderr', 1);
|
|
4752
|
-
assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`);
|
|
4753
|
-
assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`);
|
|
4754
|
-
assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`);
|
|
4755
4210
|
},
|
|
4756
4211
|
staticInit() {
|
|
4757
4212
|
FS.nameTable = new Array(4096);
|
|
@@ -4768,7 +4223,6 @@ var ASM_CONSTS = {
|
|
|
4768
4223
|
};
|
|
4769
4224
|
},
|
|
4770
4225
|
init(input, output, error) {
|
|
4771
|
-
assert(!FS.initialized, 'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)');
|
|
4772
4226
|
FS.initialized = true;
|
|
4773
4227
|
|
|
4774
4228
|
// Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here
|
|
@@ -4781,7 +4235,6 @@ var ASM_CONSTS = {
|
|
|
4781
4235
|
quit() {
|
|
4782
4236
|
FS.initialized = false;
|
|
4783
4237
|
// force-flush all streams, so we get musl std streams printed out
|
|
4784
|
-
_fflush(0);
|
|
4785
4238
|
// close all of our streams
|
|
4786
4239
|
for (var i = 0; i < FS.streams.length; i++) {
|
|
4787
4240
|
var stream = FS.streams[i];
|
|
@@ -5068,7 +4521,6 @@ var ASM_CONSTS = {
|
|
|
5068
4521
|
if (position >= contents.length)
|
|
5069
4522
|
return 0;
|
|
5070
4523
|
var size = Math.min(contents.length - position, length);
|
|
5071
|
-
assert(size >= 0);
|
|
5072
4524
|
if (contents.slice) { // normal array
|
|
5073
4525
|
for (var i = 0; i < size; i++) {
|
|
5074
4526
|
buffer[offset + i] = contents[position + i];
|
|
@@ -5098,24 +4550,6 @@ var ASM_CONSTS = {
|
|
|
5098
4550
|
node.stream_ops = stream_ops;
|
|
5099
4551
|
return node;
|
|
5100
4552
|
},
|
|
5101
|
-
absolutePath() {
|
|
5102
|
-
abort('FS.absolutePath has been removed; use PATH_FS.resolve instead');
|
|
5103
|
-
},
|
|
5104
|
-
createFolder() {
|
|
5105
|
-
abort('FS.createFolder has been removed; use FS.mkdir instead');
|
|
5106
|
-
},
|
|
5107
|
-
createLink() {
|
|
5108
|
-
abort('FS.createLink has been removed; use FS.symlink instead');
|
|
5109
|
-
},
|
|
5110
|
-
joinPath() {
|
|
5111
|
-
abort('FS.joinPath has been removed; use PATH.join instead');
|
|
5112
|
-
},
|
|
5113
|
-
mmapAlloc() {
|
|
5114
|
-
abort('FS.mmapAlloc has been replaced by the top level function mmapAlloc');
|
|
5115
|
-
},
|
|
5116
|
-
standardizePath() {
|
|
5117
|
-
abort('FS.standardizePath has been removed; use PATH.normalize instead');
|
|
5118
|
-
},
|
|
5119
4553
|
};
|
|
5120
4554
|
|
|
5121
4555
|
var SYSCALLS = {
|
|
@@ -5294,7 +4728,6 @@ var ASM_CONSTS = {
|
|
|
5294
4728
|
|
|
5295
4729
|
|
|
5296
4730
|
var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
|
|
5297
|
-
assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
|
|
5298
4731
|
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
5299
4732
|
};
|
|
5300
4733
|
|
|
@@ -5368,7 +4801,6 @@ var ASM_CONSTS = {
|
|
|
5368
4801
|
FS.isLink(child.mode) ? 10 : // DT_LNK, symbolic link.
|
|
5369
4802
|
8; // DT_REG, regular file.
|
|
5370
4803
|
}
|
|
5371
|
-
assert(id);
|
|
5372
4804
|
HEAP64[((dirp + pos)>>3)] = BigInt(id);
|
|
5373
4805
|
HEAP64[(((dirp + pos)+(8))>>3)] = BigInt((idx + 1) * struct_size);
|
|
5374
4806
|
HEAP16[(((dirp + pos)+(16))>>1)] = 280;
|
|
@@ -5539,7 +4971,6 @@ var ASM_CONSTS = {
|
|
|
5539
4971
|
var nofollow = flags & 256;
|
|
5540
4972
|
var allowEmpty = flags & 4096;
|
|
5541
4973
|
flags = flags & (~6400);
|
|
5542
|
-
assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`);
|
|
5543
4974
|
path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
|
|
5544
4975
|
return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path));
|
|
5545
4976
|
} catch (e) {
|
|
@@ -5678,7 +5109,6 @@ var ASM_CONSTS = {
|
|
|
5678
5109
|
try {
|
|
5679
5110
|
|
|
5680
5111
|
path = SYSCALLS.getStr(path);
|
|
5681
|
-
assert(flags === 0);
|
|
5682
5112
|
path = SYSCALLS.calculateAt(dirfd, path, true);
|
|
5683
5113
|
var now = Date.now(), atime, mtime;
|
|
5684
5114
|
if (!times) {
|
|
@@ -5720,7 +5150,7 @@ var ASM_CONSTS = {
|
|
|
5720
5150
|
|
|
5721
5151
|
|
|
5722
5152
|
var __abort_js = () =>
|
|
5723
|
-
abort('
|
|
5153
|
+
abort('');
|
|
5724
5154
|
|
|
5725
5155
|
var __emscripten_init_main_thread_js = (tb) => {
|
|
5726
5156
|
// Pass the thread address to the native code where they stored in wasm
|
|
@@ -5754,7 +5184,6 @@ var ASM_CONSTS = {
|
|
|
5754
5184
|
};
|
|
5755
5185
|
var callUserCallback = (func) => {
|
|
5756
5186
|
if (ABORT) {
|
|
5757
|
-
err('user callback triggered after runtime exited or application aborted. Ignoring.');
|
|
5758
5187
|
return;
|
|
5759
5188
|
}
|
|
5760
5189
|
try {
|
|
@@ -5774,7 +5203,6 @@ var ASM_CONSTS = {
|
|
|
5774
5203
|
// thread.
|
|
5775
5204
|
// TODO: How to make this work with wasm64?
|
|
5776
5205
|
var wait = Atomics.waitAsync(HEAP32, ((pthread_ptr)>>2), pthread_ptr);
|
|
5777
|
-
assert(wait.async);
|
|
5778
5206
|
wait.value.then(checkMailbox);
|
|
5779
5207
|
var waitingAsync = pthread_ptr + 128;
|
|
5780
5208
|
Atomics.store(HEAP32, ((waitingAsync)>>2), 1);
|
|
@@ -5805,7 +5233,6 @@ var ASM_CONSTS = {
|
|
|
5805
5233
|
} else {
|
|
5806
5234
|
var worker = PThread.pthreads[targetThread];
|
|
5807
5235
|
if (!worker) {
|
|
5808
|
-
err(`Cannot send message to thread with ID ${targetThread}, unknown thread ID!`);
|
|
5809
5236
|
return;
|
|
5810
5237
|
}
|
|
5811
5238
|
worker.postMessage({cmd: 'checkMailbox'});
|
|
@@ -5834,15 +5261,9 @@ var ASM_CONSTS = {
|
|
|
5834
5261
|
}
|
|
5835
5262
|
// Proxied JS library funcs use funcIndex and EM_ASM functions use emAsmAddr
|
|
5836
5263
|
var func = emAsmAddr ? ASM_CONSTS[emAsmAddr] : proxiedFunctionTable[funcIndex];
|
|
5837
|
-
assert(!(funcIndex && emAsmAddr));
|
|
5838
|
-
assert(func.length == numCallArgs, 'Call args mismatch in _emscripten_receive_on_main_thread_js');
|
|
5839
5264
|
PThread.currentProxiedOperationCallerThread = callingThread;
|
|
5840
5265
|
var rtn = func(...proxiedJSCallArgs);
|
|
5841
5266
|
PThread.currentProxiedOperationCallerThread = 0;
|
|
5842
|
-
// Proxied functions can return any type except bigint. All other types
|
|
5843
|
-
// cooerce to f64/double (the return type of this function in C) but not
|
|
5844
|
-
// bigint.
|
|
5845
|
-
assert(typeof rtn != "bigint");
|
|
5846
5267
|
return rtn;
|
|
5847
5268
|
};
|
|
5848
5269
|
|
|
@@ -6046,7 +5467,6 @@ var ASM_CONSTS = {
|
|
|
6046
5467
|
}
|
|
6047
5468
|
|
|
6048
5469
|
|
|
6049
|
-
|
|
6050
5470
|
var __tzset_js = (timezone, daylight, std_name, dst_name) => {
|
|
6051
5471
|
// TODO: Use (malleable) environment variables instead of system settings.
|
|
6052
5472
|
var currentYear = new Date().getFullYear();
|
|
@@ -6086,10 +5506,6 @@ var ASM_CONSTS = {
|
|
|
6086
5506
|
|
|
6087
5507
|
var winterName = extractZone(winterOffset);
|
|
6088
5508
|
var summerName = extractZone(summerOffset);
|
|
6089
|
-
assert(winterName);
|
|
6090
|
-
assert(summerName);
|
|
6091
|
-
assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`);
|
|
6092
|
-
assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`);
|
|
6093
5509
|
if (summerOffset < winterOffset) {
|
|
6094
5510
|
// Northern hemisphere
|
|
6095
5511
|
stringToUTF8(winterName, std_name, 17);
|
|
@@ -6138,7 +5554,6 @@ var ASM_CONSTS = {
|
|
|
6138
5554
|
};
|
|
6139
5555
|
|
|
6140
5556
|
var runtimeKeepalivePop = () => {
|
|
6141
|
-
assert(runtimeKeepaliveCounter > 0);
|
|
6142
5557
|
runtimeKeepaliveCounter -= 1;
|
|
6143
5558
|
};
|
|
6144
5559
|
/** @param {number=} timeout */
|
|
@@ -6150,6 +5565,13 @@ var ASM_CONSTS = {
|
|
|
6150
5565
|
}, timeout);
|
|
6151
5566
|
};
|
|
6152
5567
|
|
|
5568
|
+
var warnOnce = (text) => {
|
|
5569
|
+
warnOnce.shown ||= {};
|
|
5570
|
+
if (!warnOnce.shown[text]) {
|
|
5571
|
+
warnOnce.shown[text] = 1;
|
|
5572
|
+
err(text);
|
|
5573
|
+
}
|
|
5574
|
+
};
|
|
6153
5575
|
|
|
6154
5576
|
|
|
6155
5577
|
var Browser = {
|
|
@@ -6186,10 +5608,8 @@ var ASM_CONSTS = {
|
|
|
6186
5608
|
b = new Blob([(new Uint8Array(byteArray)).buffer], { type: Browser.getMimetype(name) });
|
|
6187
5609
|
}
|
|
6188
5610
|
var url = URL.createObjectURL(b);
|
|
6189
|
-
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
|
|
6190
5611
|
var img = new Image();
|
|
6191
5612
|
img.onload = () => {
|
|
6192
|
-
assert(img.complete, `Image ${name} could not be decoded`);
|
|
6193
5613
|
var canvas = /** @type {!HTMLCanvasElement} */ (document.createElement('canvas'));
|
|
6194
5614
|
canvas.width = img.width;
|
|
6195
5615
|
canvas.height = img.height;
|
|
@@ -6227,7 +5647,6 @@ var ASM_CONSTS = {
|
|
|
6227
5647
|
}
|
|
6228
5648
|
var b = new Blob([byteArray], { type: Browser.getMimetype(name) });
|
|
6229
5649
|
var url = URL.createObjectURL(b); // XXX we never revoke this!
|
|
6230
|
-
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
|
|
6231
5650
|
var audio = new Audio();
|
|
6232
5651
|
audio.addEventListener('canplaythrough', () => finish(audio), false); // use addEventListener due to chromium bug 124926
|
|
6233
5652
|
audio.onerror = function audio_onerror(event) {
|
|
@@ -6344,7 +5763,6 @@ var ASM_CONSTS = {
|
|
|
6344
5763
|
if (!ctx) return null;
|
|
6345
5764
|
|
|
6346
5765
|
if (setInModule) {
|
|
6347
|
-
if (!useWebGL) assert(typeof GLctx == 'undefined', 'cannot set in module if GLctx is used, but we are a non-GL context that would replace it');
|
|
6348
5766
|
Module['ctx'] = ctx;
|
|
6349
5767
|
if (useWebGL) GL.makeContextCurrent(contextHandle);
|
|
6350
5768
|
Browser.useWebGL = useWebGL;
|
|
@@ -6414,9 +5832,6 @@ var ASM_CONSTS = {
|
|
|
6414
5832
|
|
|
6415
5833
|
canvasContainer.requestFullscreen();
|
|
6416
5834
|
},
|
|
6417
|
-
requestFullScreen() {
|
|
6418
|
-
abort('Module.requestFullScreen has been replaced by Module.requestFullscreen (without a capital S)');
|
|
6419
|
-
},
|
|
6420
5835
|
exitFullscreen() {
|
|
6421
5836
|
// This is workaround for chrome. Trying to exit from fullscreen
|
|
6422
5837
|
// not in fullscreen state will cause "TypeError: Document not active"
|
|
@@ -6522,9 +5937,6 @@ var ASM_CONSTS = {
|
|
|
6522
5937
|
// (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/)
|
|
6523
5938
|
var scrollX = ((typeof window.scrollX != 'undefined') ? window.scrollX : window.pageXOffset);
|
|
6524
5939
|
var scrollY = ((typeof window.scrollY != 'undefined') ? window.scrollY : window.pageYOffset);
|
|
6525
|
-
// If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset
|
|
6526
|
-
// and we have no viable fallback.
|
|
6527
|
-
assert((typeof scrollX != 'undefined') && (typeof scrollY != 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.');
|
|
6528
5940
|
var adjustedX = pageX - (scrollX + rect.left);
|
|
6529
5941
|
var adjustedY = pageY - (scrollY + rect.top);
|
|
6530
5942
|
|
|
@@ -7416,7 +6828,6 @@ var ASM_CONSTS = {
|
|
|
7416
6828
|
* @param {boolean=} noSetTiming
|
|
7417
6829
|
*/
|
|
7418
6830
|
var setMainLoop = (iterFunc, fps, simulateInfiniteLoop, arg, noSetTiming) => {
|
|
7419
|
-
assert(!MainLoop.func, 'emscripten_set_main_loop: there can only be one main loop function at once: call emscripten_cancel_main_loop to cancel the previous one before setting a new one with different parameters.');
|
|
7420
6831
|
MainLoop.func = iterFunc;
|
|
7421
6832
|
MainLoop.arg = arg;
|
|
7422
6833
|
|
|
@@ -7475,11 +6886,6 @@ var ASM_CONSTS = {
|
|
|
7475
6886
|
MainLoop.tickStartTime = _emscripten_get_now();
|
|
7476
6887
|
}
|
|
7477
6888
|
|
|
7478
|
-
if (MainLoop.method === 'timeout' && Module['ctx']) {
|
|
7479
|
-
warnOnce('Looks like you are rendering without using requestAnimationFrame for the main loop. You should use 0 for the frame rate in emscripten_set_main_loop in order to use requestAnimationFrame, as that can greatly improve your frame rates!');
|
|
7480
|
-
MainLoop.method = ''; // just warn once per call to set main loop
|
|
7481
|
-
}
|
|
7482
|
-
|
|
7483
6889
|
MainLoop.runIter(iterFunc);
|
|
7484
6890
|
|
|
7485
6891
|
// catch pauses from the main loop itself
|
|
@@ -7565,7 +6971,6 @@ var ASM_CONSTS = {
|
|
|
7565
6971
|
for (var post of MainLoop.postMainLoop) {
|
|
7566
6972
|
post();
|
|
7567
6973
|
}
|
|
7568
|
-
checkStackCookie();
|
|
7569
6974
|
},
|
|
7570
6975
|
nextRAF:0,
|
|
7571
6976
|
fakeRequestAnimationFrame(func) {
|
|
@@ -7596,7 +7001,6 @@ var ASM_CONSTS = {
|
|
|
7596
7001
|
MainLoop.timingValue = value;
|
|
7597
7002
|
|
|
7598
7003
|
if (!MainLoop.func) {
|
|
7599
|
-
err('emscripten_set_main_loop_timing: Cannot set timing mode for main loop since a main loop does not exist! Call emscripten_set_main_loop first to set one up.');
|
|
7600
7004
|
return 1; // Return non-zero on failure, can't set timing mode when there is no main loop.
|
|
7601
7005
|
}
|
|
7602
7006
|
|
|
@@ -7719,20 +7123,11 @@ var ASM_CONSTS = {
|
|
|
7719
7123
|
|
|
7720
7124
|
var readEmAsmArgsArray = [];
|
|
7721
7125
|
var readEmAsmArgs = (sigPtr, buf) => {
|
|
7722
|
-
// Nobody should have mutated _readEmAsmArgsArray underneath us to be something else than an array.
|
|
7723
|
-
assert(Array.isArray(readEmAsmArgsArray));
|
|
7724
|
-
// The input buffer is allocated on the stack, so it must be stack-aligned.
|
|
7725
|
-
assert(buf % 16 == 0);
|
|
7726
7126
|
readEmAsmArgsArray.length = 0;
|
|
7727
7127
|
var ch;
|
|
7728
7128
|
// Most arguments are i32s, so shift the buffer pointer so it is a plain
|
|
7729
7129
|
// index into HEAP32.
|
|
7730
7130
|
while (ch = HEAPU8[sigPtr++]) {
|
|
7731
|
-
var chr = String.fromCharCode(ch);
|
|
7732
|
-
var validChars = ['d', 'f', 'i', 'p'];
|
|
7733
|
-
// In WASM_BIGINT mode we support passing i64 values as bigint.
|
|
7734
|
-
validChars.push('j');
|
|
7735
|
-
assert(validChars.includes(chr), `Invalid character ${ch}("${chr}") in readEmAsmArgs! Use only [${validChars}], and do not specify "v" for void return argument.`);
|
|
7736
7131
|
// Floats are always passed as doubles, so all types except for 'i'
|
|
7737
7132
|
// are 8 bytes and require alignment.
|
|
7738
7133
|
var wide = (ch != 105);
|
|
@@ -7752,7 +7147,6 @@ var ASM_CONSTS = {
|
|
|
7752
7147
|
};
|
|
7753
7148
|
var runEmAsmFunction = (code, sigPtr, argbuf) => {
|
|
7754
7149
|
var args = readEmAsmArgs(sigPtr, argbuf);
|
|
7755
|
-
assert(ASM_CONSTS.hasOwnProperty(code), `No EM_ASM constant found at address ${code}. The loaded WebAssembly file is likely out of sync with the generated JavaScript.`);
|
|
7756
7150
|
return ASM_CONSTS[code](...args);
|
|
7757
7151
|
};
|
|
7758
7152
|
var _emscripten_asm_const_int = (code, sigPtr, argbuf) => {
|
|
@@ -7774,7 +7168,6 @@ var ASM_CONSTS = {
|
|
|
7774
7168
|
// code paths as similar as possible on both sides.)
|
|
7775
7169
|
return proxyToMainThread(0, emAsmAddr, sync, ...args);
|
|
7776
7170
|
}
|
|
7777
|
-
assert(ASM_CONSTS.hasOwnProperty(emAsmAddr), `No EM_ASM constant found at address ${emAsmAddr}. The loaded WebAssembly file is likely out of sync with the generated JavaScript.`);
|
|
7778
7171
|
return ASM_CONSTS[emAsmAddr](...args);
|
|
7779
7172
|
};
|
|
7780
7173
|
var _emscripten_asm_const_int_sync_on_main_thread = (emAsmAddr, sigPtr, argbuf) => runMainThreadEmAsm(emAsmAddr, sigPtr, argbuf, 1);
|
|
@@ -7788,11 +7181,6 @@ var ASM_CONSTS = {
|
|
|
7788
7181
|
|
|
7789
7182
|
|
|
7790
7183
|
var _emscripten_check_blocking_allowed = () => {
|
|
7791
|
-
|
|
7792
|
-
if (ENVIRONMENT_IS_WORKER) return; // Blocking in a worker/pthread is fine.
|
|
7793
|
-
|
|
7794
|
-
warnOnce('Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread');
|
|
7795
|
-
|
|
7796
7184
|
};
|
|
7797
7185
|
|
|
7798
7186
|
|
|
@@ -7875,8 +7263,6 @@ var ASM_CONSTS = {
|
|
|
7875
7263
|
},
|
|
7876
7264
|
registerOrRemoveHandler(eventHandler) {
|
|
7877
7265
|
if (!eventHandler.target) {
|
|
7878
|
-
err('registerOrRemoveHandler: the target element for event handler registration does not exist, when processing the following event handler registration:');
|
|
7879
|
-
console.dir(eventHandler);
|
|
7880
7266
|
return -4;
|
|
7881
7267
|
}
|
|
7882
7268
|
if (eventHandler.callbackfunc) {
|
|
@@ -8305,12 +7691,10 @@ var ASM_CONSTS = {
|
|
|
8305
7691
|
|
|
8306
7692
|
|
|
8307
7693
|
|
|
8308
|
-
|
|
8309
7694
|
function _emscripten_force_exit(status) {
|
|
8310
7695
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8311
7696
|
return proxyToMainThread(42, 0, 1, status);
|
|
8312
7697
|
|
|
8313
|
-
warnOnce('emscripten_force_exit cannot actually shut down the runtime, as the build does not have EXIT_RUNTIME set');
|
|
8314
7698
|
__emscripten_runtime_keepalive_clear();
|
|
8315
7699
|
_exit(status);
|
|
8316
7700
|
|
|
@@ -8382,7 +7766,6 @@ var ASM_CONSTS = {
|
|
|
8382
7766
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8383
7767
|
return proxyToMainThread(45, 0, 1, index, gamepadState);
|
|
8384
7768
|
|
|
8385
|
-
if (!JSEvents.lastGamepadState) throw 'emscripten_get_gamepad_status() can only be called after having first called emscripten_sample_gamepad_data() and that function has returned EMSCRIPTEN_RESULT_SUCCESS!';
|
|
8386
7769
|
// INVALID_PARAM is returned on a Gamepad index that never was there.
|
|
8387
7770
|
if (index < 0 || index >= JSEvents.lastGamepadState.length) return -5;
|
|
8388
7771
|
|
|
@@ -8410,7 +7793,6 @@ var ASM_CONSTS = {
|
|
|
8410
7793
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8411
7794
|
return proxyToMainThread(46, 0, 1);
|
|
8412
7795
|
|
|
8413
|
-
if (!JSEvents.lastGamepadState) throw 'emscripten_get_num_gamepads() can only be called after having first called emscripten_sample_gamepad_data() and that function has returned EMSCRIPTEN_RESULT_SUCCESS!';
|
|
8414
7796
|
// N.B. Do not call emscripten_get_num_gamepads() unless having first called emscripten_sample_gamepad_data(), and that has returned EMSCRIPTEN_RESULT_SUCCESS.
|
|
8415
7797
|
// Otherwise the following line will throw an exception.
|
|
8416
7798
|
return JSEvents.lastGamepadState.length;
|
|
@@ -9330,17 +8712,10 @@ var ASM_CONSTS = {
|
|
|
9330
8712
|
GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name));
|
|
9331
8713
|
var _emscripten_glGetAttribLocation = _glGetAttribLocation;
|
|
9332
8714
|
|
|
9333
|
-
|
|
9334
|
-
var readI53FromU64 = (ptr) => {
|
|
9335
|
-
return HEAPU32[((ptr)>>2)] + HEAPU32[(((ptr)+(4))>>2)] * 4294967296;
|
|
9336
|
-
};
|
|
9337
8715
|
var writeI53ToI64 = (ptr, num) => {
|
|
9338
8716
|
HEAPU32[((ptr)>>2)] = num;
|
|
9339
8717
|
var lower = HEAPU32[((ptr)>>2)];
|
|
9340
8718
|
HEAPU32[(((ptr)+(4))>>2)] = (num - lower)/4294967296;
|
|
9341
|
-
var deserialized = (num >= 0) ? readI53FromU64(ptr) : readI53FromI64(ptr);
|
|
9342
|
-
var offset = ((ptr)>>2);
|
|
9343
|
-
if (deserialized != num) warnOnce(`writeI53ToI64() out of range: serialized JS Number ${num} to Wasm heap as bytes lo=${ptrToString(HEAPU32[offset])}, hi=${ptrToString(HEAPU32[offset+1])}, which deserializes back to ${deserialized} instead!`);
|
|
9344
8719
|
};
|
|
9345
8720
|
|
|
9346
8721
|
|
|
@@ -11254,7 +10629,7 @@ var ASM_CONSTS = {
|
|
|
11254
10629
|
|
|
11255
10630
|
|
|
11256
10631
|
var abortOnCannotGrowMemory = (requestedSize) => {
|
|
11257
|
-
abort(
|
|
10632
|
+
abort('OOM');
|
|
11258
10633
|
};
|
|
11259
10634
|
var _emscripten_resize_heap = (requestedSize) => {
|
|
11260
10635
|
var oldSize = HEAPU8.length;
|
|
@@ -11276,7 +10651,6 @@ var ASM_CONSTS = {
|
|
|
11276
10651
|
if (navigator.getGamepads) return (JSEvents.lastGamepadState = navigator.getGamepads())
|
|
11277
10652
|
? 0 : -1;
|
|
11278
10653
|
} catch(e) {
|
|
11279
|
-
err(`navigator.getGamepads() exists, but failed to execute with exception ${e}. Disabling Gamepad access.`);
|
|
11280
10654
|
navigator.getGamepads = null; // Disable getGamepads() so that it won't be attempted to be used again.
|
|
11281
10655
|
}
|
|
11282
10656
|
return -1;
|
|
@@ -11527,7 +10901,6 @@ var ASM_CONSTS = {
|
|
|
11527
10901
|
JSEvents.keyEvent ||= _malloc(160);
|
|
11528
10902
|
|
|
11529
10903
|
var keyEventHandlerFunc = (e) => {
|
|
11530
|
-
assert(e);
|
|
11531
10904
|
|
|
11532
10905
|
var keyEventData = targetThread ? _malloc(160) : JSEvents.keyEvent; // This allocated block is passed as satellite data to the proxied function call, so the call frees up the data block when done.
|
|
11533
10906
|
HEAPF64[((keyEventData)>>3)] = e.timeStamp;
|
|
@@ -11600,7 +10973,6 @@ var ASM_CONSTS = {
|
|
|
11600
10973
|
|
|
11601
10974
|
|
|
11602
10975
|
var fillMouseEventData = (eventStruct, e, target) => {
|
|
11603
|
-
assert(eventStruct % 4 == 0);
|
|
11604
10976
|
HEAPF64[((eventStruct)>>3)] = e.timeStamp;
|
|
11605
10977
|
var idx = ((eventStruct)>>2);
|
|
11606
10978
|
HEAP32[idx + 2] = e.screenX;
|
|
@@ -11829,7 +11201,6 @@ var ASM_CONSTS = {
|
|
|
11829
11201
|
target = findEventTarget(target);
|
|
11830
11202
|
|
|
11831
11203
|
var touchEventHandlerFunc = (e) => {
|
|
11832
|
-
assert(e);
|
|
11833
11204
|
var t, touches = {}, et = e.touches;
|
|
11834
11205
|
// To ease marshalling different kinds of touches that browser reports (all touches are listed in e.touches,
|
|
11835
11206
|
// only changed touches in e.changedTouches, and touches on target at a.targetTouches), mark a boolean in
|
|
@@ -12085,7 +11456,6 @@ var ASM_CONSTS = {
|
|
|
12085
11456
|
|
|
12086
11457
|
var stringToAscii = (str, buffer) => {
|
|
12087
11458
|
for (var i = 0; i < str.length; ++i) {
|
|
12088
|
-
assert(str.charCodeAt(i) === (str.charCodeAt(i) & 0xff));
|
|
12089
11459
|
HEAP8[buffer++] = str.charCodeAt(i);
|
|
12090
11460
|
}
|
|
12091
11461
|
// Null-terminate the string
|
|
@@ -12294,7 +11664,6 @@ var ASM_CONSTS = {
|
|
|
12294
11664
|
};
|
|
12295
11665
|
|
|
12296
11666
|
var dynCall = (sig, ptr, args = []) => {
|
|
12297
|
-
assert(getWasmTableEntry(ptr), `missing table entry in dynCall: ${ptr}`);
|
|
12298
11667
|
var rtn = getWasmTableEntry(ptr)(...args);
|
|
12299
11668
|
return rtn;
|
|
12300
11669
|
};
|
|
@@ -12305,13 +11674,11 @@ var ASM_CONSTS = {
|
|
|
12305
11674
|
|
|
12306
11675
|
var getCFunc = (ident) => {
|
|
12307
11676
|
var func = Module['_' + ident]; // closure exported function
|
|
12308
|
-
assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported');
|
|
12309
11677
|
return func;
|
|
12310
11678
|
};
|
|
12311
11679
|
|
|
12312
11680
|
|
|
12313
11681
|
var writeArrayToMemory = (array, buffer) => {
|
|
12314
|
-
assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
|
|
12315
11682
|
HEAP8.set(array, buffer);
|
|
12316
11683
|
};
|
|
12317
11684
|
|
|
@@ -12354,7 +11721,6 @@ var ASM_CONSTS = {
|
|
|
12354
11721
|
var func = getCFunc(ident);
|
|
12355
11722
|
var cArgs = [];
|
|
12356
11723
|
var stack = 0;
|
|
12357
|
-
assert(returnType !== 'array', 'Return type should not be "array".');
|
|
12358
11724
|
if (args) {
|
|
12359
11725
|
for (var i = 0; i < args.length; i++) {
|
|
12360
11726
|
var converter = toC[argTypes[i]];
|
|
@@ -12382,11 +11748,17 @@ var ASM_CONSTS = {
|
|
|
12382
11748
|
* @param {Object=} opts
|
|
12383
11749
|
*/
|
|
12384
11750
|
var cwrap = (ident, returnType, argTypes, opts) => {
|
|
11751
|
+
// When the function takes numbers and returns a number, we can just return
|
|
11752
|
+
// the original function
|
|
11753
|
+
var numericArgs = !argTypes || argTypes.every((type) => type === 'number' || type === 'boolean');
|
|
11754
|
+
var numericRet = returnType !== 'string';
|
|
11755
|
+
if (numericRet && numericArgs && !opts) {
|
|
11756
|
+
return getCFunc(ident);
|
|
11757
|
+
}
|
|
12385
11758
|
return (...args) => ccall(ident, returnType, argTypes, args, opts);
|
|
12386
11759
|
};
|
|
12387
11760
|
|
|
12388
11761
|
var uleb128Encode = (n, target) => {
|
|
12389
|
-
assert(n < 16384);
|
|
12390
11762
|
if (n < 128) {
|
|
12391
11763
|
target.push(n);
|
|
12392
11764
|
} else {
|
|
@@ -12408,7 +11780,6 @@ var ASM_CONSTS = {
|
|
|
12408
11780
|
results: sig[0] == 'v' ? [] : [typeNames[sig[0]]]
|
|
12409
11781
|
};
|
|
12410
11782
|
for (var i = 1; i < sig.length; ++i) {
|
|
12411
|
-
assert(sig[i] in typeNames, 'invalid signature char: ' + sig[i]);
|
|
12412
11783
|
type.parameters.push(typeNames[sig[i]]);
|
|
12413
11784
|
}
|
|
12414
11785
|
return type;
|
|
@@ -12430,7 +11801,6 @@ var ASM_CONSTS = {
|
|
|
12430
11801
|
target.push(0x60 /* form: func */);
|
|
12431
11802
|
uleb128Encode(sigParam.length, target);
|
|
12432
11803
|
for (var i = 0; i < sigParam.length; ++i) {
|
|
12433
|
-
assert(sigParam[i] in typeCodes, 'invalid signature char: ' + sigParam[i]);
|
|
12434
11804
|
target.push(typeCodes[sigParam[i]]);
|
|
12435
11805
|
}
|
|
12436
11806
|
|
|
@@ -12546,7 +11916,6 @@ var ASM_CONSTS = {
|
|
|
12546
11916
|
|
|
12547
11917
|
/** @param {string=} sig */
|
|
12548
11918
|
var addFunction = (func, sig) => {
|
|
12549
|
-
assert(typeof func != 'undefined');
|
|
12550
11919
|
// Check if the function is already in the table, to ensure each function
|
|
12551
11920
|
// gets a unique index.
|
|
12552
11921
|
var rtn = getFunctionAddress(func);
|
|
@@ -12566,7 +11935,6 @@ var ASM_CONSTS = {
|
|
|
12566
11935
|
if (!(err instanceof TypeError)) {
|
|
12567
11936
|
throw err;
|
|
12568
11937
|
}
|
|
12569
|
-
assert(typeof sig != 'undefined', 'Missing signature argument to addFunction: ' + func);
|
|
12570
11938
|
var wrapped = convertJsFunctionToWasm(func, sig);
|
|
12571
11939
|
setWasmTableEntry(ret, wrapped);
|
|
12572
11940
|
}
|
|
@@ -12592,9 +11960,15 @@ PThread.init();;
|
|
|
12592
11960
|
// Set module methods based on EXPORTED_RUNTIME_METHODS
|
|
12593
11961
|
;
|
|
12594
11962
|
|
|
11963
|
+
// This error may happen quite a bit. To avoid overhead we reuse it (and
|
|
11964
|
+
// suffer a lack of stack info).
|
|
11965
|
+
MEMFS.doesNotExistError = new FS.ErrnoError(44);
|
|
11966
|
+
/** @suppress {checkTypes} */
|
|
11967
|
+
MEMFS.doesNotExistError.stack = '<generic error, no stack>';
|
|
11968
|
+
;
|
|
11969
|
+
|
|
12595
11970
|
// exports
|
|
12596
11971
|
Module['requestFullscreen'] = Browser.requestFullscreen;
|
|
12597
|
-
Module['requestFullScreen'] = Browser.requestFullScreen;
|
|
12598
11972
|
Module['setCanvasSize'] = Browser.setCanvasSize;
|
|
12599
11973
|
Module['getUserMedia'] = Browser.getUserMedia;
|
|
12600
11974
|
Module['createContext'] = Browser.createContext;
|
|
@@ -12695,9 +12069,6 @@ var proxiedFunctionTable = [
|
|
|
12695
12069
|
_fd_write
|
|
12696
12070
|
];
|
|
12697
12071
|
|
|
12698
|
-
function checkIncomingModuleAPI() {
|
|
12699
|
-
ignoredModuleProp('fetchSettings');
|
|
12700
|
-
}
|
|
12701
12072
|
var wasmImports;
|
|
12702
12073
|
function assignWasmImports() {
|
|
12703
12074
|
wasmImports = {
|
|
@@ -13498,73 +12869,67 @@ function assignWasmImports() {
|
|
|
13498
12869
|
};
|
|
13499
12870
|
}
|
|
13500
12871
|
var wasmExports = await createWasm();
|
|
13501
|
-
var ___wasm_call_ctors =
|
|
13502
|
-
var _screenshot = Module['_screenshot'] =
|
|
13503
|
-
var _buttonPress = Module['_buttonPress'] =
|
|
13504
|
-
var _buttonUnpress = Module['_buttonUnpress'] =
|
|
13505
|
-
var _toggleRewind = Module['_toggleRewind'] =
|
|
13506
|
-
var _setVolume = Module['_setVolume'] =
|
|
13507
|
-
var _getVolume = Module['_getVolume'] =
|
|
13508
|
-
var _getMainLoopTimingMode = Module['_getMainLoopTimingMode'] =
|
|
13509
|
-
var _getMainLoopTimingValue = Module['_getMainLoopTimingValue'] =
|
|
13510
|
-
var _setMainLoopTiming = Module['_setMainLoopTiming'] =
|
|
13511
|
-
var _setFastForwardMultiplier = Module['_setFastForwardMultiplier'] =
|
|
13512
|
-
var _getFastForwardMultiplier = Module['_getFastForwardMultiplier'] =
|
|
13513
|
-
var _quitGame = Module['_quitGame'] =
|
|
13514
|
-
var _free =
|
|
13515
|
-
var _quitMgba = Module['_quitMgba'] =
|
|
13516
|
-
var _quickReload = Module['_quickReload'] =
|
|
13517
|
-
var _pauseGame = Module['_pauseGame'] =
|
|
13518
|
-
var _resumeGame = Module['_resumeGame'] =
|
|
13519
|
-
var _setEventEnable = Module['_setEventEnable'] =
|
|
13520
|
-
var _bindKey = Module['_bindKey'] =
|
|
13521
|
-
var _saveState = Module['_saveState'] =
|
|
13522
|
-
var _loadState = Module['_loadState'] =
|
|
13523
|
-
var _autoLoadCheats = Module['_autoLoadCheats'] =
|
|
13524
|
-
var _loadGame = Module['_loadGame'] =
|
|
13525
|
-
var _saveStateSlot = Module['_saveStateSlot'] =
|
|
13526
|
-
var _loadStateSlot = Module['_loadStateSlot'] =
|
|
13527
|
-
var _addCoreCallbacks = Module['_addCoreCallbacks'] =
|
|
13528
|
-
var _setIntegerCoreSetting = Module['_setIntegerCoreSetting'] =
|
|
13529
|
-
var _setupConstants = Module['_setupConstants'] =
|
|
13530
|
-
var _main = Module['_main'] =
|
|
13531
|
-
var _malloc =
|
|
13532
|
-
var _strerror = createExportWrapper('strerror', 1);
|
|
13533
|
-
var _fflush = createExportWrapper('fflush', 1);
|
|
12872
|
+
var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])();
|
|
12873
|
+
var _screenshot = Module['_screenshot'] = (a0) => (_screenshot = Module['_screenshot'] = wasmExports['screenshot'])(a0);
|
|
12874
|
+
var _buttonPress = Module['_buttonPress'] = (a0) => (_buttonPress = Module['_buttonPress'] = wasmExports['buttonPress'])(a0);
|
|
12875
|
+
var _buttonUnpress = Module['_buttonUnpress'] = (a0) => (_buttonUnpress = Module['_buttonUnpress'] = wasmExports['buttonUnpress'])(a0);
|
|
12876
|
+
var _toggleRewind = Module['_toggleRewind'] = (a0) => (_toggleRewind = Module['_toggleRewind'] = wasmExports['toggleRewind'])(a0);
|
|
12877
|
+
var _setVolume = Module['_setVolume'] = (a0) => (_setVolume = Module['_setVolume'] = wasmExports['setVolume'])(a0);
|
|
12878
|
+
var _getVolume = Module['_getVolume'] = () => (_getVolume = Module['_getVolume'] = wasmExports['getVolume'])();
|
|
12879
|
+
var _getMainLoopTimingMode = Module['_getMainLoopTimingMode'] = () => (_getMainLoopTimingMode = Module['_getMainLoopTimingMode'] = wasmExports['getMainLoopTimingMode'])();
|
|
12880
|
+
var _getMainLoopTimingValue = Module['_getMainLoopTimingValue'] = () => (_getMainLoopTimingValue = Module['_getMainLoopTimingValue'] = wasmExports['getMainLoopTimingValue'])();
|
|
12881
|
+
var _setMainLoopTiming = Module['_setMainLoopTiming'] = (a0, a1) => (_setMainLoopTiming = Module['_setMainLoopTiming'] = wasmExports['setMainLoopTiming'])(a0, a1);
|
|
12882
|
+
var _setFastForwardMultiplier = Module['_setFastForwardMultiplier'] = (a0) => (_setFastForwardMultiplier = Module['_setFastForwardMultiplier'] = wasmExports['setFastForwardMultiplier'])(a0);
|
|
12883
|
+
var _getFastForwardMultiplier = Module['_getFastForwardMultiplier'] = () => (_getFastForwardMultiplier = Module['_getFastForwardMultiplier'] = wasmExports['getFastForwardMultiplier'])();
|
|
12884
|
+
var _quitGame = Module['_quitGame'] = () => (_quitGame = Module['_quitGame'] = wasmExports['quitGame'])();
|
|
12885
|
+
var _free = (a0) => (_free = wasmExports['free'])(a0);
|
|
12886
|
+
var _quitMgba = Module['_quitMgba'] = () => (_quitMgba = Module['_quitMgba'] = wasmExports['quitMgba'])();
|
|
12887
|
+
var _quickReload = Module['_quickReload'] = () => (_quickReload = Module['_quickReload'] = wasmExports['quickReload'])();
|
|
12888
|
+
var _pauseGame = Module['_pauseGame'] = () => (_pauseGame = Module['_pauseGame'] = wasmExports['pauseGame'])();
|
|
12889
|
+
var _resumeGame = Module['_resumeGame'] = () => (_resumeGame = Module['_resumeGame'] = wasmExports['resumeGame'])();
|
|
12890
|
+
var _setEventEnable = Module['_setEventEnable'] = (a0) => (_setEventEnable = Module['_setEventEnable'] = wasmExports['setEventEnable'])(a0);
|
|
12891
|
+
var _bindKey = Module['_bindKey'] = (a0, a1) => (_bindKey = Module['_bindKey'] = wasmExports['bindKey'])(a0, a1);
|
|
12892
|
+
var _saveState = Module['_saveState'] = (a0) => (_saveState = Module['_saveState'] = wasmExports['saveState'])(a0);
|
|
12893
|
+
var _loadState = Module['_loadState'] = (a0) => (_loadState = Module['_loadState'] = wasmExports['loadState'])(a0);
|
|
12894
|
+
var _autoLoadCheats = Module['_autoLoadCheats'] = () => (_autoLoadCheats = Module['_autoLoadCheats'] = wasmExports['autoLoadCheats'])();
|
|
12895
|
+
var _loadGame = Module['_loadGame'] = (a0, a1) => (_loadGame = Module['_loadGame'] = wasmExports['loadGame'])(a0, a1);
|
|
12896
|
+
var _saveStateSlot = Module['_saveStateSlot'] = (a0, a1) => (_saveStateSlot = Module['_saveStateSlot'] = wasmExports['saveStateSlot'])(a0, a1);
|
|
12897
|
+
var _loadStateSlot = Module['_loadStateSlot'] = (a0, a1) => (_loadStateSlot = Module['_loadStateSlot'] = wasmExports['loadStateSlot'])(a0, a1);
|
|
12898
|
+
var _addCoreCallbacks = Module['_addCoreCallbacks'] = (a0, a1, a2, a3, a4, a5) => (_addCoreCallbacks = Module['_addCoreCallbacks'] = wasmExports['addCoreCallbacks'])(a0, a1, a2, a3, a4, a5);
|
|
12899
|
+
var _setIntegerCoreSetting = Module['_setIntegerCoreSetting'] = (a0, a1) => (_setIntegerCoreSetting = Module['_setIntegerCoreSetting'] = wasmExports['setIntegerCoreSetting'])(a0, a1);
|
|
12900
|
+
var _setupConstants = Module['_setupConstants'] = () => (_setupConstants = Module['_setupConstants'] = wasmExports['setupConstants'])();
|
|
12901
|
+
var _main = Module['_main'] = (a0, a1) => (_main = Module['_main'] = wasmExports['main'])(a0, a1);
|
|
12902
|
+
var _malloc = (a0) => (_malloc = wasmExports['malloc'])(a0);
|
|
13534
12903
|
var _pthread_self = () => (_pthread_self = wasmExports['pthread_self'])();
|
|
13535
|
-
var __emscripten_tls_init =
|
|
13536
|
-
var _emscripten_builtin_memalign =
|
|
13537
|
-
var __emscripten_run_callback_on_thread =
|
|
13538
|
-
var __emscripten_thread_init =
|
|
13539
|
-
var __emscripten_thread_crashed =
|
|
13540
|
-
var
|
|
13541
|
-
var
|
|
13542
|
-
var
|
|
13543
|
-
var
|
|
13544
|
-
var
|
|
13545
|
-
var __emscripten_check_mailbox = createExportWrapper('_emscripten_check_mailbox', 0);
|
|
13546
|
-
var _setThrew = createExportWrapper('setThrew', 2);
|
|
13547
|
-
var _emscripten_stack_init = () => (_emscripten_stack_init = wasmExports['emscripten_stack_init'])();
|
|
12904
|
+
var __emscripten_tls_init = () => (__emscripten_tls_init = wasmExports['_emscripten_tls_init'])();
|
|
12905
|
+
var _emscripten_builtin_memalign = (a0, a1) => (_emscripten_builtin_memalign = wasmExports['emscripten_builtin_memalign'])(a0, a1);
|
|
12906
|
+
var __emscripten_run_callback_on_thread = (a0, a1, a2, a3, a4) => (__emscripten_run_callback_on_thread = wasmExports['_emscripten_run_callback_on_thread'])(a0, a1, a2, a3, a4);
|
|
12907
|
+
var __emscripten_thread_init = (a0, a1, a2, a3, a4, a5) => (__emscripten_thread_init = wasmExports['_emscripten_thread_init'])(a0, a1, a2, a3, a4, a5);
|
|
12908
|
+
var __emscripten_thread_crashed = () => (__emscripten_thread_crashed = wasmExports['_emscripten_thread_crashed'])();
|
|
12909
|
+
var __emscripten_run_on_main_thread_js = (a0, a1, a2, a3, a4) => (__emscripten_run_on_main_thread_js = wasmExports['_emscripten_run_on_main_thread_js'])(a0, a1, a2, a3, a4);
|
|
12910
|
+
var __emscripten_thread_free_data = (a0) => (__emscripten_thread_free_data = wasmExports['_emscripten_thread_free_data'])(a0);
|
|
12911
|
+
var __emscripten_thread_exit = (a0) => (__emscripten_thread_exit = wasmExports['_emscripten_thread_exit'])(a0);
|
|
12912
|
+
var __emscripten_check_mailbox = () => (__emscripten_check_mailbox = wasmExports['_emscripten_check_mailbox'])();
|
|
12913
|
+
var _setThrew = (a0, a1) => (_setThrew = wasmExports['setThrew'])(a0, a1);
|
|
13548
12914
|
var _emscripten_stack_set_limits = (a0, a1) => (_emscripten_stack_set_limits = wasmExports['emscripten_stack_set_limits'])(a0, a1);
|
|
13549
|
-
var _emscripten_stack_get_free = () => (_emscripten_stack_get_free = wasmExports['emscripten_stack_get_free'])();
|
|
13550
12915
|
var __emscripten_stack_restore = (a0) => (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])(a0);
|
|
13551
12916
|
var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0);
|
|
13552
12917
|
var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
|
|
13553
|
-
var _GBAInputInfo = Module['_GBAInputInfo'] =
|
|
13554
|
-
var _binaryName = Module['_binaryName'] =
|
|
13555
|
-
var _projectName = Module['_projectName'] =
|
|
13556
|
-
var _projectVersion = Module['_projectVersion'] =
|
|
13557
|
-
var _gitCommit = Module['_gitCommit'] =
|
|
13558
|
-
var _gitCommitShort = Module['_gitCommitShort'] =
|
|
13559
|
-
var _gitBranch = Module['_gitBranch'] =
|
|
13560
|
-
var _gitRevision = Module['_gitRevision'] =
|
|
13561
|
-
var _GBIORegisterNames = Module['_GBIORegisterNames'] =
|
|
13562
|
-
var _GBSavestateMagic = Module['_GBSavestateMagic'] =
|
|
13563
|
-
var _GBSavestateVersion = Module['_GBSavestateVersion'] =
|
|
13564
|
-
var _GBA_LUX_LEVELS = Module['_GBA_LUX_LEVELS'] =
|
|
13565
|
-
var _GBAVideoObjSizes = Module['_GBAVideoObjSizes'] =
|
|
13566
|
-
var _GBASavestateMagic = Module['_GBASavestateMagic'] =
|
|
13567
|
-
var _GBASavestateVersion = Module['_GBASavestateVersion'] =
|
|
12918
|
+
var _GBAInputInfo = Module['_GBAInputInfo'] = 122320;
|
|
12919
|
+
var _binaryName = Module['_binaryName'] = 198352;
|
|
12920
|
+
var _projectName = Module['_projectName'] = 198356;
|
|
12921
|
+
var _projectVersion = Module['_projectVersion'] = 198360;
|
|
12922
|
+
var _gitCommit = Module['_gitCommit'] = 198336;
|
|
12923
|
+
var _gitCommitShort = Module['_gitCommitShort'] = 198340;
|
|
12924
|
+
var _gitBranch = Module['_gitBranch'] = 198344;
|
|
12925
|
+
var _gitRevision = Module['_gitRevision'] = 198348;
|
|
12926
|
+
var _GBIORegisterNames = Module['_GBIORegisterNames'] = 60688;
|
|
12927
|
+
var _GBSavestateMagic = Module['_GBSavestateMagic'] = 75952;
|
|
12928
|
+
var _GBSavestateVersion = Module['_GBSavestateVersion'] = 75956;
|
|
12929
|
+
var _GBA_LUX_LEVELS = Module['_GBA_LUX_LEVELS'] = 105424;
|
|
12930
|
+
var _GBAVideoObjSizes = Module['_GBAVideoObjSizes'] = 149760;
|
|
12931
|
+
var _GBASavestateMagic = Module['_GBASavestateMagic'] = 149536;
|
|
12932
|
+
var _GBASavestateVersion = Module['_GBASavestateVersion'] = 149540;
|
|
13568
12933
|
function invoke_iiiii(index,a1,a2,a3,a4) {
|
|
13569
12934
|
var sp = stackSave();
|
|
13570
12935
|
try {
|
|
@@ -13683,316 +13048,9 @@ Module['cwrap'] = cwrap;
|
|
|
13683
13048
|
Module['addFunction'] = addFunction;
|
|
13684
13049
|
Module['removeFunction'] = removeFunction;
|
|
13685
13050
|
Module['FS'] = FS;
|
|
13686
|
-
var missingLibrarySymbols = [
|
|
13687
|
-
'writeI53ToI64Clamped',
|
|
13688
|
-
'writeI53ToI64Signaling',
|
|
13689
|
-
'writeI53ToU64Clamped',
|
|
13690
|
-
'writeI53ToU64Signaling',
|
|
13691
|
-
'convertI32PairToI53',
|
|
13692
|
-
'convertI32PairToI53Checked',
|
|
13693
|
-
'convertU32PairToI53',
|
|
13694
|
-
'getTempRet0',
|
|
13695
|
-
'setTempRet0',
|
|
13696
|
-
'growMemory',
|
|
13697
|
-
'inetPton4',
|
|
13698
|
-
'inetNtop4',
|
|
13699
|
-
'inetPton6',
|
|
13700
|
-
'inetNtop6',
|
|
13701
|
-
'readSockaddr',
|
|
13702
|
-
'writeSockaddr',
|
|
13703
|
-
'emscriptenLog',
|
|
13704
|
-
'getDynCaller',
|
|
13705
|
-
'asmjsMangle',
|
|
13706
|
-
'HandleAllocator',
|
|
13707
|
-
'getNativeTypeSize',
|
|
13708
|
-
'addOnInit',
|
|
13709
|
-
'addOnPostCtor',
|
|
13710
|
-
'addOnPreMain',
|
|
13711
|
-
'STACK_SIZE',
|
|
13712
|
-
'STACK_ALIGN',
|
|
13713
|
-
'POINTER_SIZE',
|
|
13714
|
-
'ASSERTIONS',
|
|
13715
|
-
'reallyNegative',
|
|
13716
|
-
'unSign',
|
|
13717
|
-
'strLen',
|
|
13718
|
-
'reSign',
|
|
13719
|
-
'formatString',
|
|
13720
|
-
'intArrayToString',
|
|
13721
|
-
'AsciiToString',
|
|
13722
|
-
'UTF16ToString',
|
|
13723
|
-
'stringToUTF16',
|
|
13724
|
-
'lengthBytesUTF16',
|
|
13725
|
-
'UTF32ToString',
|
|
13726
|
-
'stringToUTF32',
|
|
13727
|
-
'lengthBytesUTF32',
|
|
13728
|
-
'fillDeviceOrientationEventData',
|
|
13729
|
-
'registerDeviceOrientationEventCallback',
|
|
13730
|
-
'fillDeviceMotionEventData',
|
|
13731
|
-
'registerDeviceMotionEventCallback',
|
|
13732
|
-
'screenOrientation',
|
|
13733
|
-
'fillOrientationChangeEventData',
|
|
13734
|
-
'registerOrientationChangeEventCallback',
|
|
13735
|
-
'hideEverythingExceptGivenElement',
|
|
13736
|
-
'restoreHiddenElements',
|
|
13737
|
-
'softFullscreenResizeWebGLRenderTarget',
|
|
13738
|
-
'registerPointerlockErrorEventCallback',
|
|
13739
|
-
'fillBatteryEventData',
|
|
13740
|
-
'battery',
|
|
13741
|
-
'registerBatteryEventCallback',
|
|
13742
|
-
'jsStackTrace',
|
|
13743
|
-
'getCallstack',
|
|
13744
|
-
'convertPCtoSourceLocation',
|
|
13745
|
-
'wasiRightsToMuslOFlags',
|
|
13746
|
-
'wasiOFlagsToMuslOFlags',
|
|
13747
|
-
'setImmediateWrapped',
|
|
13748
|
-
'safeRequestAnimationFrame',
|
|
13749
|
-
'clearImmediateWrapped',
|
|
13750
|
-
'registerPostMainLoop',
|
|
13751
|
-
'registerPreMainLoop',
|
|
13752
|
-
'getPromise',
|
|
13753
|
-
'makePromise',
|
|
13754
|
-
'idsToPromises',
|
|
13755
|
-
'makePromiseCallback',
|
|
13756
|
-
'ExceptionInfo',
|
|
13757
|
-
'findMatchingCatch',
|
|
13758
|
-
'Browser_asyncPrepareDataCounter',
|
|
13759
|
-
'arraySum',
|
|
13760
|
-
'addDays',
|
|
13761
|
-
'getSocketFromFD',
|
|
13762
|
-
'getSocketAddress',
|
|
13763
|
-
'FS_unlink',
|
|
13764
|
-
'FS_mkdirTree',
|
|
13765
|
-
'_setNetworkCallback',
|
|
13766
|
-
'writeGLArray',
|
|
13767
|
-
'emscripten_webgl_destroy_context_before_on_calling_thread',
|
|
13768
|
-
'registerWebGlEventCallback',
|
|
13769
|
-
'runAndAbortIfError',
|
|
13770
|
-
'ALLOC_NORMAL',
|
|
13771
|
-
'ALLOC_STACK',
|
|
13772
|
-
'allocate',
|
|
13773
|
-
'writeStringToMemory',
|
|
13774
|
-
'writeAsciiToMemory',
|
|
13775
|
-
'setErrNo',
|
|
13776
|
-
'demangle',
|
|
13777
|
-
'stackTrace',
|
|
13778
|
-
];
|
|
13779
|
-
missingLibrarySymbols.forEach(missingLibrarySymbol)
|
|
13780
|
-
|
|
13781
|
-
var unexportedSymbols = [
|
|
13782
|
-
'run',
|
|
13783
|
-
'addRunDependency',
|
|
13784
|
-
'removeRunDependency',
|
|
13785
|
-
'out',
|
|
13786
|
-
'err',
|
|
13787
|
-
'callMain',
|
|
13788
|
-
'abort',
|
|
13789
|
-
'wasmMemory',
|
|
13790
|
-
'wasmExports',
|
|
13791
|
-
'writeStackCookie',
|
|
13792
|
-
'checkStackCookie',
|
|
13793
|
-
'writeI53ToI64',
|
|
13794
|
-
'readI53FromI64',
|
|
13795
|
-
'readI53FromU64',
|
|
13796
|
-
'INT53_MAX',
|
|
13797
|
-
'INT53_MIN',
|
|
13798
|
-
'bigintToI53Checked',
|
|
13799
|
-
'stackSave',
|
|
13800
|
-
'stackRestore',
|
|
13801
|
-
'stackAlloc',
|
|
13802
|
-
'ptrToString',
|
|
13803
|
-
'zeroMemory',
|
|
13804
|
-
'exitJS',
|
|
13805
|
-
'getHeapMax',
|
|
13806
|
-
'abortOnCannotGrowMemory',
|
|
13807
|
-
'ENV',
|
|
13808
|
-
'ERRNO_CODES',
|
|
13809
|
-
'strError',
|
|
13810
|
-
'DNS',
|
|
13811
|
-
'Protocols',
|
|
13812
|
-
'Sockets',
|
|
13813
|
-
'timers',
|
|
13814
|
-
'warnOnce',
|
|
13815
|
-
'readEmAsmArgsArray',
|
|
13816
|
-
'readEmAsmArgs',
|
|
13817
|
-
'runEmAsmFunction',
|
|
13818
|
-
'runMainThreadEmAsm',
|
|
13819
|
-
'jstoi_q',
|
|
13820
|
-
'jstoi_s',
|
|
13821
|
-
'getExecutableName',
|
|
13822
|
-
'listenOnce',
|
|
13823
|
-
'autoResumeAudioContext',
|
|
13824
|
-
'dynCall',
|
|
13825
|
-
'handleException',
|
|
13826
|
-
'keepRuntimeAlive',
|
|
13827
|
-
'runtimeKeepalivePush',
|
|
13828
|
-
'runtimeKeepalivePop',
|
|
13829
|
-
'callUserCallback',
|
|
13830
|
-
'maybeExit',
|
|
13831
|
-
'asyncLoad',
|
|
13832
|
-
'alignMemory',
|
|
13833
|
-
'mmapAlloc',
|
|
13834
|
-
'wasmTable',
|
|
13835
|
-
'noExitRuntime',
|
|
13836
|
-
'addOnPreRun',
|
|
13837
|
-
'addOnExit',
|
|
13838
|
-
'addOnPostRun',
|
|
13839
|
-
'getCFunc',
|
|
13840
|
-
'ccall',
|
|
13841
|
-
'uleb128Encode',
|
|
13842
|
-
'sigToWasmTypes',
|
|
13843
|
-
'generateFuncType',
|
|
13844
|
-
'convertJsFunctionToWasm',
|
|
13845
|
-
'freeTableIndexes',
|
|
13846
|
-
'functionsInTableMap',
|
|
13847
|
-
'getEmptyTableSlot',
|
|
13848
|
-
'updateTableMap',
|
|
13849
|
-
'getFunctionAddress',
|
|
13850
|
-
'setValue',
|
|
13851
|
-
'getValue',
|
|
13852
|
-
'PATH',
|
|
13853
|
-
'PATH_FS',
|
|
13854
|
-
'UTF8Decoder',
|
|
13855
|
-
'UTF8ArrayToString',
|
|
13856
|
-
'UTF8ToString',
|
|
13857
|
-
'stringToUTF8Array',
|
|
13858
|
-
'stringToUTF8',
|
|
13859
|
-
'lengthBytesUTF8',
|
|
13860
|
-
'intArrayFromString',
|
|
13861
|
-
'stringToAscii',
|
|
13862
|
-
'UTF16Decoder',
|
|
13863
|
-
'stringToNewUTF8',
|
|
13864
|
-
'stringToUTF8OnStack',
|
|
13865
|
-
'writeArrayToMemory',
|
|
13866
|
-
'JSEvents',
|
|
13867
|
-
'registerKeyEventCallback',
|
|
13868
|
-
'specialHTMLTargets',
|
|
13869
|
-
'maybeCStringToJsString',
|
|
13870
|
-
'findEventTarget',
|
|
13871
|
-
'findCanvasEventTarget',
|
|
13872
|
-
'getBoundingClientRect',
|
|
13873
|
-
'fillMouseEventData',
|
|
13874
|
-
'registerMouseEventCallback',
|
|
13875
|
-
'registerWheelEventCallback',
|
|
13876
|
-
'registerUiEventCallback',
|
|
13877
|
-
'registerFocusEventCallback',
|
|
13878
|
-
'fillFullscreenChangeEventData',
|
|
13879
|
-
'registerFullscreenChangeEventCallback',
|
|
13880
|
-
'JSEvents_requestFullscreen',
|
|
13881
|
-
'JSEvents_resizeCanvasForFullscreen',
|
|
13882
|
-
'registerRestoreOldStyle',
|
|
13883
|
-
'setLetterbox',
|
|
13884
|
-
'currentFullscreenStrategy',
|
|
13885
|
-
'restoreOldWindowedStyle',
|
|
13886
|
-
'doRequestFullscreen',
|
|
13887
|
-
'fillPointerlockChangeEventData',
|
|
13888
|
-
'registerPointerlockChangeEventCallback',
|
|
13889
|
-
'requestPointerLock',
|
|
13890
|
-
'fillVisibilityChangeEventData',
|
|
13891
|
-
'registerVisibilityChangeEventCallback',
|
|
13892
|
-
'registerTouchEventCallback',
|
|
13893
|
-
'fillGamepadEventData',
|
|
13894
|
-
'registerGamepadEventCallback',
|
|
13895
|
-
'registerBeforeUnloadEventCallback',
|
|
13896
|
-
'setCanvasElementSizeCallingThread',
|
|
13897
|
-
'setCanvasElementSizeMainThread',
|
|
13898
|
-
'setCanvasElementSize',
|
|
13899
|
-
'getCanvasSizeCallingThread',
|
|
13900
|
-
'getCanvasSizeMainThread',
|
|
13901
|
-
'getCanvasElementSize',
|
|
13902
|
-
'UNWIND_CACHE',
|
|
13903
|
-
'ExitStatus',
|
|
13904
|
-
'getEnvStrings',
|
|
13905
|
-
'checkWasiClock',
|
|
13906
|
-
'doReadv',
|
|
13907
|
-
'doWritev',
|
|
13908
|
-
'initRandomFill',
|
|
13909
|
-
'randomFill',
|
|
13910
|
-
'safeSetTimeout',
|
|
13911
|
-
'emSetImmediate',
|
|
13912
|
-
'emClearImmediate_deps',
|
|
13913
|
-
'emClearImmediate',
|
|
13914
|
-
'promiseMap',
|
|
13915
|
-
'uncaughtExceptionCount',
|
|
13916
|
-
'exceptionLast',
|
|
13917
|
-
'exceptionCaught',
|
|
13918
|
-
'Browser',
|
|
13919
|
-
'getPreloadedImageData__data',
|
|
13920
|
-
'wget',
|
|
13921
|
-
'MONTH_DAYS_REGULAR',
|
|
13922
|
-
'MONTH_DAYS_LEAP',
|
|
13923
|
-
'MONTH_DAYS_REGULAR_CUMULATIVE',
|
|
13924
|
-
'MONTH_DAYS_LEAP_CUMULATIVE',
|
|
13925
|
-
'isLeapYear',
|
|
13926
|
-
'ydayFromDate',
|
|
13927
|
-
'SYSCALLS',
|
|
13928
|
-
'preloadPlugins',
|
|
13929
|
-
'FS_createPreloadedFile',
|
|
13930
|
-
'FS_modeStringToFlags',
|
|
13931
|
-
'FS_getMode',
|
|
13932
|
-
'FS_stdin_getChar_buffer',
|
|
13933
|
-
'FS_stdin_getChar',
|
|
13934
|
-
'FS_createPath',
|
|
13935
|
-
'FS_createDevice',
|
|
13936
|
-
'FS_readFile',
|
|
13937
|
-
'FS_createDataFile',
|
|
13938
|
-
'FS_createLazyFile',
|
|
13939
|
-
'MEMFS',
|
|
13940
|
-
'TTY',
|
|
13941
|
-
'PIPEFS',
|
|
13942
|
-
'SOCKFS',
|
|
13943
|
-
'tempFixedLengthArray',
|
|
13944
|
-
'miniTempWebGLFloatBuffers',
|
|
13945
|
-
'miniTempWebGLIntBuffers',
|
|
13946
|
-
'heapObjectForWebGLType',
|
|
13947
|
-
'toTypedArrayIndex',
|
|
13948
|
-
'webgl_enable_WEBGL_multi_draw',
|
|
13949
|
-
'webgl_enable_EXT_polygon_offset_clamp',
|
|
13950
|
-
'webgl_enable_EXT_clip_control',
|
|
13951
|
-
'webgl_enable_WEBGL_polygon_mode',
|
|
13952
|
-
'GL',
|
|
13953
|
-
'emscriptenWebGLGet',
|
|
13954
|
-
'computeUnpackAlignedImageSize',
|
|
13955
|
-
'colorChannelsInGlTextureFormat',
|
|
13956
|
-
'emscriptenWebGLGetTexPixelData',
|
|
13957
|
-
'emscriptenWebGLGetUniform',
|
|
13958
|
-
'webglGetUniformLocation',
|
|
13959
|
-
'webglPrepareUniformLocationsBeforeFirstUse',
|
|
13960
|
-
'webglGetLeftBracePos',
|
|
13961
|
-
'emscriptenWebGLGetVertexAttrib',
|
|
13962
|
-
'__glGetActiveAttribOrUniform',
|
|
13963
|
-
'AL',
|
|
13964
|
-
'GLUT',
|
|
13965
|
-
'EGL',
|
|
13966
|
-
'GLEW',
|
|
13967
|
-
'IDBStore',
|
|
13968
|
-
'emscriptenWebGLGetIndexed',
|
|
13969
|
-
'webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance',
|
|
13970
|
-
'webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance',
|
|
13971
|
-
'allocateUTF8',
|
|
13972
|
-
'allocateUTF8OnStack',
|
|
13973
|
-
'print',
|
|
13974
|
-
'printErr',
|
|
13975
|
-
'PThread',
|
|
13976
|
-
'terminateWorker',
|
|
13977
|
-
'cleanupThread',
|
|
13978
|
-
'registerTLSInit',
|
|
13979
|
-
'spawnThread',
|
|
13980
|
-
'exitOnMainThread',
|
|
13981
|
-
'proxyToMainThread',
|
|
13982
|
-
'proxiedJSCallArgs',
|
|
13983
|
-
'invokeEntryPoint',
|
|
13984
|
-
'checkMailbox',
|
|
13985
|
-
'IDBFS',
|
|
13986
|
-
];
|
|
13987
|
-
unexportedSymbols.forEach(unexportedRuntimeSymbol);
|
|
13988
|
-
|
|
13989
13051
|
|
|
13990
13052
|
|
|
13991
|
-
var calledRun;
|
|
13992
|
-
|
|
13993
13053
|
function callMain() {
|
|
13994
|
-
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
|
|
13995
|
-
assert(typeof onPreRuns === 'undefined' || onPreRuns.length == 0, 'cannot call main when preRun functions remain to be called');
|
|
13996
13054
|
|
|
13997
13055
|
var entryFunction = _main;
|
|
13998
13056
|
|
|
@@ -14011,17 +13069,6 @@ function callMain() {
|
|
|
14011
13069
|
}
|
|
14012
13070
|
}
|
|
14013
13071
|
|
|
14014
|
-
function stackCheckInit() {
|
|
14015
|
-
// This is normally called automatically during __wasm_call_ctors but need to
|
|
14016
|
-
// get these values before even running any of the ctors so we call it redundantly
|
|
14017
|
-
// here.
|
|
14018
|
-
// See $establishStackSpace for the equivalent code that runs on a thread
|
|
14019
|
-
assert(!ENVIRONMENT_IS_PTHREAD);
|
|
14020
|
-
_emscripten_stack_init();
|
|
14021
|
-
// TODO(sbc): Move writeStackCookie to native to to avoid this.
|
|
14022
|
-
writeStackCookie();
|
|
14023
|
-
}
|
|
14024
|
-
|
|
14025
13072
|
function run() {
|
|
14026
13073
|
|
|
14027
13074
|
if (runDependencies > 0) {
|
|
@@ -14035,8 +13082,6 @@ function run() {
|
|
|
14035
13082
|
return;
|
|
14036
13083
|
}
|
|
14037
13084
|
|
|
14038
|
-
stackCheckInit();
|
|
14039
|
-
|
|
14040
13085
|
preRun();
|
|
14041
13086
|
|
|
14042
13087
|
// a preRun added a dependency, run will be called later
|
|
@@ -14048,8 +13093,6 @@ function run() {
|
|
|
14048
13093
|
function doRun() {
|
|
14049
13094
|
// run may have just been called through dependencies being fulfilled just in this very frame,
|
|
14050
13095
|
// or while the async setStatus time below was happening
|
|
14051
|
-
assert(!calledRun);
|
|
14052
|
-
calledRun = true;
|
|
14053
13096
|
Module['calledRun'] = true;
|
|
14054
13097
|
|
|
14055
13098
|
if (ABORT) return;
|
|
@@ -14060,9 +13103,8 @@ function run() {
|
|
|
14060
13103
|
|
|
14061
13104
|
readyPromiseResolve(Module);
|
|
14062
13105
|
Module['onRuntimeInitialized']?.();
|
|
14063
|
-
consumedModuleProp('onRuntimeInitialized');
|
|
14064
13106
|
|
|
14065
|
-
var noInitialRun = Module['noInitialRun'];
|
|
13107
|
+
var noInitialRun = Module['noInitialRun'];
|
|
14066
13108
|
if (!noInitialRun) callMain();
|
|
14067
13109
|
|
|
14068
13110
|
postRun();
|
|
@@ -14078,46 +13120,6 @@ function run() {
|
|
|
14078
13120
|
{
|
|
14079
13121
|
doRun();
|
|
14080
13122
|
}
|
|
14081
|
-
checkStackCookie();
|
|
14082
|
-
}
|
|
14083
|
-
|
|
14084
|
-
function checkUnflushedContent() {
|
|
14085
|
-
// Compiler settings do not allow exiting the runtime, so flushing
|
|
14086
|
-
// the streams is not possible. but in ASSERTIONS mode we check
|
|
14087
|
-
// if there was something to flush, and if so tell the user they
|
|
14088
|
-
// should request that the runtime be exitable.
|
|
14089
|
-
// Normally we would not even include flush() at all, but in ASSERTIONS
|
|
14090
|
-
// builds we do so just for this check, and here we see if there is any
|
|
14091
|
-
// content to flush, that is, we check if there would have been
|
|
14092
|
-
// something a non-ASSERTIONS build would have not seen.
|
|
14093
|
-
// How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0
|
|
14094
|
-
// mode (which has its own special function for this; otherwise, all
|
|
14095
|
-
// the code is inside libc)
|
|
14096
|
-
var oldOut = out;
|
|
14097
|
-
var oldErr = err;
|
|
14098
|
-
var has = false;
|
|
14099
|
-
out = err = (x) => {
|
|
14100
|
-
has = true;
|
|
14101
|
-
}
|
|
14102
|
-
try { // it doesn't matter if it fails
|
|
14103
|
-
_fflush(0);
|
|
14104
|
-
// also flush in the JS FS layer
|
|
14105
|
-
['stdout', 'stderr'].forEach((name) => {
|
|
14106
|
-
var info = FS.analyzePath('/dev/' + name);
|
|
14107
|
-
if (!info) return;
|
|
14108
|
-
var stream = info.object;
|
|
14109
|
-
var rdev = stream.rdev;
|
|
14110
|
-
var tty = TTY.ttys[rdev];
|
|
14111
|
-
if (tty?.output?.length) {
|
|
14112
|
-
has = true;
|
|
14113
|
-
}
|
|
14114
|
-
});
|
|
14115
|
-
} catch(e) {}
|
|
14116
|
-
out = oldOut;
|
|
14117
|
-
err = oldErr;
|
|
14118
|
-
if (has) {
|
|
14119
|
-
warnOnce('stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.');
|
|
14120
|
-
}
|
|
14121
13123
|
}
|
|
14122
13124
|
|
|
14123
13125
|
if (Module['preInit']) {
|
|
@@ -14126,7 +13128,6 @@ if (Module['preInit']) {
|
|
|
14126
13128
|
Module['preInit'].pop()();
|
|
14127
13129
|
}
|
|
14128
13130
|
}
|
|
14129
|
-
consumedModuleProp('preInit');
|
|
14130
13131
|
|
|
14131
13132
|
run();
|
|
14132
13133
|
|
|
@@ -14141,21 +13142,6 @@ run();
|
|
|
14141
13142
|
|
|
14142
13143
|
moduleRtn = readyPromise;
|
|
14143
13144
|
|
|
14144
|
-
// Assertion for attempting to access module properties on the incoming
|
|
14145
|
-
// moduleArg. In the past we used this object as the prototype of the module
|
|
14146
|
-
// and assigned properties to it, but now we return a distinct object. This
|
|
14147
|
-
// keeps the instance private until it is ready (i.e the promise has been
|
|
14148
|
-
// resolved).
|
|
14149
|
-
for (const prop of Object.keys(Module)) {
|
|
14150
|
-
if (!(prop in moduleArg)) {
|
|
14151
|
-
Object.defineProperty(moduleArg, prop, {
|
|
14152
|
-
configurable: true,
|
|
14153
|
-
get() {
|
|
14154
|
-
abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)
|
|
14155
|
-
}
|
|
14156
|
-
});
|
|
14157
|
-
}
|
|
14158
|
-
}
|
|
14159
13145
|
// end include: postamble_modularize.js
|
|
14160
13146
|
|
|
14161
13147
|
|
|
@@ -14164,15 +13150,6 @@ for (const prop of Object.keys(Module)) {
|
|
|
14164
13150
|
}
|
|
14165
13151
|
);
|
|
14166
13152
|
})();
|
|
14167
|
-
(() => {
|
|
14168
|
-
// Create a small, never-async wrapper around mGBA which
|
|
14169
|
-
// checks for callers incorrectly using it with `new`.
|
|
14170
|
-
var real_mGBA = mGBA;
|
|
14171
|
-
mGBA = function(arg) {
|
|
14172
|
-
if (new.target) throw new Error("mGBA() should not be called with `new mGBA()`");
|
|
14173
|
-
return real_mGBA(arg);
|
|
14174
|
-
}
|
|
14175
|
-
})();
|
|
14176
13153
|
export default mGBA;
|
|
14177
13154
|
var isPthread = globalThis.self?.name?.startsWith('em-pthread');
|
|
14178
13155
|
// When running as a pthread, construct a new instance on startup
|