@thenick775/mgba-wasm 2.1.1-beta.5 → 2.1.1-beta.7
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.js +132 -1164
- 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
|
|
@@ -531,12 +526,6 @@ function locateFile(path) {
|
|
|
531
526
|
// Hooks that are implemented differently in different runtime environments.
|
|
532
527
|
var readAsync, readBinary;
|
|
533
528
|
|
|
534
|
-
if (ENVIRONMENT_IS_SHELL) {
|
|
535
|
-
|
|
536
|
-
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?)');
|
|
537
|
-
|
|
538
|
-
} else
|
|
539
|
-
|
|
540
529
|
// Note that this includes Node.js workers when relevant (pthreads is enabled).
|
|
541
530
|
// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
|
|
542
531
|
// ENVIRONMENT_IS_NODE.
|
|
@@ -563,8 +552,6 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
|
563
552
|
scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1);
|
|
564
553
|
}
|
|
565
554
|
|
|
566
|
-
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?)');
|
|
567
|
-
|
|
568
555
|
{
|
|
569
556
|
// include: web_or_worker_shell_read.js
|
|
570
557
|
if (ENVIRONMENT_IS_WORKER) {
|
|
@@ -578,7 +565,6 @@ if (ENVIRONMENT_IS_WORKER) {
|
|
|
578
565
|
}
|
|
579
566
|
|
|
580
567
|
readAsync = async (url) => {
|
|
581
|
-
assert(!isFileURI(url), "readAsync does not work with file:// URLs");
|
|
582
568
|
var response = await fetch(url, { credentials: 'same-origin' });
|
|
583
569
|
if (response.ok) {
|
|
584
570
|
return response.arrayBuffer();
|
|
@@ -589,7 +575,6 @@ if (ENVIRONMENT_IS_WORKER) {
|
|
|
589
575
|
}
|
|
590
576
|
} else
|
|
591
577
|
{
|
|
592
|
-
throw new Error('environment detection error');
|
|
593
578
|
}
|
|
594
579
|
|
|
595
580
|
var out = Module['print'] || console.log.bind(console);
|
|
@@ -600,49 +585,17 @@ Object.assign(Module, moduleOverrides);
|
|
|
600
585
|
// Free the object hierarchy contained in the overrides, this lets the GC
|
|
601
586
|
// reclaim data used.
|
|
602
587
|
moduleOverrides = null;
|
|
603
|
-
checkIncomingModuleAPI();
|
|
604
588
|
|
|
605
589
|
// Emit code to handle expected values on the Module object. This applies Module.x
|
|
606
590
|
// to the proper local x. This has two benefits: first, we only emit it if it is
|
|
607
591
|
// expected to arrive, and second, by using a local everywhere else that can be
|
|
608
592
|
// minified.
|
|
609
593
|
|
|
610
|
-
if (Module['arguments']) arguments_ = Module['arguments'];
|
|
594
|
+
if (Module['arguments']) arguments_ = Module['arguments'];
|
|
611
595
|
|
|
612
|
-
if (Module['thisProgram']) thisProgram = Module['thisProgram'];
|
|
596
|
+
if (Module['thisProgram']) thisProgram = Module['thisProgram'];
|
|
613
597
|
|
|
614
598
|
// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
|
|
615
|
-
// Assertions on removed incoming Module JS APIs.
|
|
616
|
-
assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
617
|
-
assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
|
|
618
|
-
assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
619
|
-
assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
|
|
620
|
-
assert(typeof Module['read'] == 'undefined', 'Module.read option was removed');
|
|
621
|
-
assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
|
|
622
|
-
assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
|
|
623
|
-
assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');
|
|
624
|
-
assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
|
|
625
|
-
legacyModuleProp('asm', 'wasmExports');
|
|
626
|
-
legacyModuleProp('readAsync', 'readAsync');
|
|
627
|
-
legacyModuleProp('readBinary', 'readBinary');
|
|
628
|
-
legacyModuleProp('setWindowTitle', 'setWindowTitle');
|
|
629
|
-
var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js';
|
|
630
|
-
var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js';
|
|
631
|
-
var WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js';
|
|
632
|
-
var FETCHFS = 'FETCHFS is no longer included by default; build with -lfetchfs.js';
|
|
633
|
-
var ICASEFS = 'ICASEFS is no longer included by default; build with -licasefs.js';
|
|
634
|
-
var JSFILEFS = 'JSFILEFS is no longer included by default; build with -ljsfilefs.js';
|
|
635
|
-
var OPFS = 'OPFS is no longer included by default; build with -lopfs.js';
|
|
636
|
-
|
|
637
|
-
var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js';
|
|
638
|
-
|
|
639
|
-
assert(
|
|
640
|
-
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)');
|
|
641
|
-
|
|
642
|
-
assert(!ENVIRONMENT_IS_NODE, 'node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.');
|
|
643
|
-
|
|
644
|
-
assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.');
|
|
645
|
-
|
|
646
599
|
// end include: shell.js
|
|
647
600
|
|
|
648
601
|
// include: preamble.js
|
|
@@ -656,11 +609,7 @@ assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at bui
|
|
|
656
609
|
// An online HTML version (which may be of a different version of Emscripten)
|
|
657
610
|
// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
|
|
658
611
|
|
|
659
|
-
var wasmBinary = Module['wasmBinary'];
|
|
660
|
-
|
|
661
|
-
if (typeof WebAssembly != 'object') {
|
|
662
|
-
err('no native wasm support detected');
|
|
663
|
-
}
|
|
612
|
+
var wasmBinary = Module['wasmBinary'];
|
|
664
613
|
|
|
665
614
|
// Wasm globals
|
|
666
615
|
|
|
@@ -689,13 +638,13 @@ var EXITSTATUS;
|
|
|
689
638
|
/** @type {function(*, string=)} */
|
|
690
639
|
function assert(condition, text) {
|
|
691
640
|
if (!condition) {
|
|
692
|
-
|
|
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);
|
|
693
645
|
}
|
|
694
646
|
}
|
|
695
647
|
|
|
696
|
-
// We used to include malloc/free by default in the past. Show a helpful error in
|
|
697
|
-
// builds with assertions.
|
|
698
|
-
|
|
699
648
|
// Memory management
|
|
700
649
|
|
|
701
650
|
var HEAP,
|
|
@@ -732,176 +681,10 @@ var isFileURI = (filename) => filename.startsWith('file://');
|
|
|
732
681
|
|
|
733
682
|
// include: runtime_shared.js
|
|
734
683
|
// include: runtime_stack_check.js
|
|
735
|
-
// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
|
|
736
|
-
function writeStackCookie() {
|
|
737
|
-
var max = _emscripten_stack_get_end();
|
|
738
|
-
assert((max & 3) == 0);
|
|
739
|
-
// If the stack ends at address zero we write our cookies 4 bytes into the
|
|
740
|
-
// stack. This prevents interference with SAFE_HEAP and ASAN which also
|
|
741
|
-
// monitor writes to address zero.
|
|
742
|
-
if (max == 0) {
|
|
743
|
-
max += 4;
|
|
744
|
-
}
|
|
745
|
-
// The stack grow downwards towards _emscripten_stack_get_end.
|
|
746
|
-
// We write cookies to the final two words in the stack and detect if they are
|
|
747
|
-
// ever overwritten.
|
|
748
|
-
HEAPU32[((max)>>2)] = 0x02135467;
|
|
749
|
-
HEAPU32[(((max)+(4))>>2)] = 0x89BACDFE;
|
|
750
|
-
// Also test the global address 0 for integrity.
|
|
751
|
-
HEAPU32[((0)>>2)] = 1668509029;
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
function checkStackCookie() {
|
|
755
|
-
if (ABORT) return;
|
|
756
|
-
var max = _emscripten_stack_get_end();
|
|
757
|
-
// See writeStackCookie().
|
|
758
|
-
if (max == 0) {
|
|
759
|
-
max += 4;
|
|
760
|
-
}
|
|
761
|
-
var cookie1 = HEAPU32[((max)>>2)];
|
|
762
|
-
var cookie2 = HEAPU32[(((max)+(4))>>2)];
|
|
763
|
-
if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
|
|
764
|
-
abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
|
|
765
|
-
}
|
|
766
|
-
// Also test the global address 0 for integrity.
|
|
767
|
-
if (HEAPU32[((0)>>2)] != 0x63736d65 /* 'emsc' */) {
|
|
768
|
-
abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
684
|
// end include: runtime_stack_check.js
|
|
772
685
|
// include: runtime_exceptions.js
|
|
773
686
|
// end include: runtime_exceptions.js
|
|
774
687
|
// include: runtime_debug.js
|
|
775
|
-
// Endianness check
|
|
776
|
-
(() => {
|
|
777
|
-
var h16 = new Int16Array(1);
|
|
778
|
-
var h8 = new Int8Array(h16.buffer);
|
|
779
|
-
h16[0] = 0x6373;
|
|
780
|
-
if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';
|
|
781
|
-
})();
|
|
782
|
-
|
|
783
|
-
if (Module['ENVIRONMENT']) {
|
|
784
|
-
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)');
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
function legacyModuleProp(prop, newName, incoming=true) {
|
|
788
|
-
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
789
|
-
Object.defineProperty(Module, prop, {
|
|
790
|
-
configurable: true,
|
|
791
|
-
get() {
|
|
792
|
-
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)' : '';
|
|
793
|
-
abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra);
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
function consumedModuleProp(prop) {
|
|
801
|
-
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
802
|
-
Object.defineProperty(Module, prop, {
|
|
803
|
-
configurable: true,
|
|
804
|
-
set() {
|
|
805
|
-
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'`);
|
|
806
|
-
|
|
807
|
-
}
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
function ignoredModuleProp(prop) {
|
|
813
|
-
if (Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
814
|
-
abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
// forcing the filesystem exports a few things by default
|
|
819
|
-
function isExportedByForceFilesystem(name) {
|
|
820
|
-
return name === 'FS_createPath' ||
|
|
821
|
-
name === 'FS_createDataFile' ||
|
|
822
|
-
name === 'FS_createPreloadedFile' ||
|
|
823
|
-
name === 'FS_unlink' ||
|
|
824
|
-
name === 'addRunDependency' ||
|
|
825
|
-
// The old FS has some functionality that WasmFS lacks.
|
|
826
|
-
name === 'FS_createLazyFile' ||
|
|
827
|
-
name === 'FS_createDevice' ||
|
|
828
|
-
name === 'removeRunDependency';
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
/**
|
|
832
|
-
* Intercept access to a global symbol. This enables us to give informative
|
|
833
|
-
* warnings/errors when folks attempt to use symbols they did not include in
|
|
834
|
-
* their build, or no symbols that no longer exist.
|
|
835
|
-
*/
|
|
836
|
-
function hookGlobalSymbolAccess(sym, func) {
|
|
837
|
-
if (typeof globalThis != 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) {
|
|
838
|
-
Object.defineProperty(globalThis, sym, {
|
|
839
|
-
configurable: true,
|
|
840
|
-
get() {
|
|
841
|
-
func();
|
|
842
|
-
return undefined;
|
|
843
|
-
}
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
function missingGlobal(sym, msg) {
|
|
849
|
-
hookGlobalSymbolAccess(sym, () => {
|
|
850
|
-
warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`);
|
|
851
|
-
});
|
|
852
|
-
}
|
|
853
|
-
|
|
854
|
-
missingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');
|
|
855
|
-
missingGlobal('asm', 'Please use wasmExports instead');
|
|
856
|
-
|
|
857
|
-
function missingLibrarySymbol(sym) {
|
|
858
|
-
hookGlobalSymbolAccess(sym, () => {
|
|
859
|
-
// Can't `abort()` here because it would break code that does runtime
|
|
860
|
-
// checks. e.g. `if (typeof SDL === 'undefined')`.
|
|
861
|
-
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`;
|
|
862
|
-
// DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
|
|
863
|
-
// library.js, which means $name for a JS name with no prefix, or name
|
|
864
|
-
// for a JS name like _name.
|
|
865
|
-
var librarySymbol = sym;
|
|
866
|
-
if (!librarySymbol.startsWith('_')) {
|
|
867
|
-
librarySymbol = '$' + sym;
|
|
868
|
-
}
|
|
869
|
-
msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;
|
|
870
|
-
if (isExportedByForceFilesystem(sym)) {
|
|
871
|
-
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
|
|
872
|
-
}
|
|
873
|
-
warnOnce(msg);
|
|
874
|
-
});
|
|
875
|
-
|
|
876
|
-
// Any symbol that is not included from the JS library is also (by definition)
|
|
877
|
-
// not exported on the Module object.
|
|
878
|
-
unexportedRuntimeSymbol(sym);
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
function unexportedRuntimeSymbol(sym) {
|
|
882
|
-
if (ENVIRONMENT_IS_PTHREAD) {
|
|
883
|
-
return;
|
|
884
|
-
}
|
|
885
|
-
if (!Object.getOwnPropertyDescriptor(Module, sym)) {
|
|
886
|
-
Object.defineProperty(Module, sym, {
|
|
887
|
-
configurable: true,
|
|
888
|
-
get() {
|
|
889
|
-
var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
|
|
890
|
-
if (isExportedByForceFilesystem(sym)) {
|
|
891
|
-
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
|
|
892
|
-
}
|
|
893
|
-
abort(msg);
|
|
894
|
-
}
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
// Used by XXXXX_DEBUG settings to output debug messages.
|
|
900
|
-
function dbg(...args) {
|
|
901
|
-
// TODO(sbc): Make this configurable somehow. Its not always convenient for
|
|
902
|
-
// logging to show up as warnings.
|
|
903
|
-
console.warn(...args);
|
|
904
|
-
}
|
|
905
688
|
// end include: runtime_debug.js
|
|
906
689
|
// include: memoryprofiler.js
|
|
907
690
|
// end include: memoryprofiler.js
|
|
@@ -910,10 +693,6 @@ function dbg(...args) {
|
|
|
910
693
|
// This code runs only on pthread web workers and handles pthread setup
|
|
911
694
|
// and communication with the main thread via postMessage.
|
|
912
695
|
|
|
913
|
-
// Unique ID of the current pthread worker (zero on non-pthread-workers
|
|
914
|
-
// including the main thread).
|
|
915
|
-
var workerID = 0;
|
|
916
|
-
|
|
917
696
|
if (ENVIRONMENT_IS_PTHREAD) {
|
|
918
697
|
var wasmModuleReceived;
|
|
919
698
|
|
|
@@ -927,7 +706,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
927
706
|
|
|
928
707
|
if (!Module['printErr'])
|
|
929
708
|
err = threadPrintErr;
|
|
930
|
-
dbg = threadPrintErr;
|
|
931
709
|
function threadAlert(...args) {
|
|
932
710
|
var text = args.join(' ');
|
|
933
711
|
postMessage({cmd: 'alert', text, threadId: _pthread_self()});
|
|
@@ -944,7 +722,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
944
722
|
//dbg('msgData: ' + Object.keys(msgData));
|
|
945
723
|
var cmd = msgData.cmd;
|
|
946
724
|
if (cmd === 'load') { // Preload command that is called once per worker to parse and load the Emscripten code.
|
|
947
|
-
workerID = msgData.workerID;
|
|
948
725
|
|
|
949
726
|
// Until we initialize the runtime, queue up any further incoming messages.
|
|
950
727
|
let messageQueue = [];
|
|
@@ -983,7 +760,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
983
760
|
|
|
984
761
|
wasmModuleReceived(msgData.wasmModule);
|
|
985
762
|
} else if (cmd === 'run') {
|
|
986
|
-
assert(msgData.pthread_ptr);
|
|
987
763
|
// Call inside JS module to set up the stack frame for this pthread in JS module scope.
|
|
988
764
|
// This needs to be the first thing that we do, as we cannot call to any C/C++ functions
|
|
989
765
|
// until the thread stack is initialized.
|
|
@@ -1026,8 +802,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
1026
802
|
err(msgData);
|
|
1027
803
|
}
|
|
1028
804
|
} catch(ex) {
|
|
1029
|
-
err(`worker: onmessage() captured an uncaught exception: ${ex}`);
|
|
1030
|
-
if (ex?.stack) err(ex.stack);
|
|
1031
805
|
__emscripten_thread_crashed();
|
|
1032
806
|
throw ex;
|
|
1033
807
|
}
|
|
@@ -1054,11 +828,6 @@ function updateMemoryViews() {
|
|
|
1054
828
|
}
|
|
1055
829
|
|
|
1056
830
|
// end include: runtime_shared.js
|
|
1057
|
-
assert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
|
|
1058
|
-
|
|
1059
|
-
assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined,
|
|
1060
|
-
'JS engine does not provide full typed array support');
|
|
1061
|
-
|
|
1062
831
|
// In non-standalone/normal mode, we create the memory here.
|
|
1063
832
|
// include: runtime_init_memory.js
|
|
1064
833
|
// Create the wasm memory. (Note: this only applies if IMPORTED_MEMORY is defined)
|
|
@@ -1071,9 +840,8 @@ if (!ENVIRONMENT_IS_PTHREAD) {
|
|
|
1071
840
|
wasmMemory = Module['wasmMemory'];
|
|
1072
841
|
} else
|
|
1073
842
|
{
|
|
1074
|
-
var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 268435456;
|
|
843
|
+
var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 268435456;
|
|
1075
844
|
|
|
1076
|
-
assert(INITIAL_MEMORY >= 65536, 'INITIAL_MEMORY should be larger than STACK_SIZE, was ' + INITIAL_MEMORY + '! (STACK_SIZE=' + 65536 + ')');
|
|
1077
845
|
/** @suppress {checkTypes} */
|
|
1078
846
|
wasmMemory = new WebAssembly.Memory({
|
|
1079
847
|
'initial': INITIAL_MEMORY / 65536,
|
|
@@ -1088,25 +856,20 @@ if (!ENVIRONMENT_IS_PTHREAD) {
|
|
|
1088
856
|
// end include: runtime_init_memory.js
|
|
1089
857
|
|
|
1090
858
|
function preRun() {
|
|
1091
|
-
assert(!ENVIRONMENT_IS_PTHREAD); // PThreads reuse the runtime from the main thread.
|
|
1092
859
|
if (Module['preRun']) {
|
|
1093
860
|
if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
|
|
1094
861
|
while (Module['preRun'].length) {
|
|
1095
862
|
addOnPreRun(Module['preRun'].shift());
|
|
1096
863
|
}
|
|
1097
864
|
}
|
|
1098
|
-
consumedModuleProp('preRun');
|
|
1099
865
|
callRuntimeCallbacks(onPreRuns);
|
|
1100
866
|
}
|
|
1101
867
|
|
|
1102
868
|
function initRuntime() {
|
|
1103
|
-
assert(!runtimeInitialized);
|
|
1104
869
|
runtimeInitialized = true;
|
|
1105
870
|
|
|
1106
871
|
if (ENVIRONMENT_IS_PTHREAD) return startWorker(Module);
|
|
1107
872
|
|
|
1108
|
-
checkStackCookie();
|
|
1109
|
-
|
|
1110
873
|
if (!Module['noFSInit'] && !FS.initialized) FS.init();
|
|
1111
874
|
TTY.init();
|
|
1112
875
|
|
|
@@ -1116,12 +879,10 @@ TTY.init();
|
|
|
1116
879
|
}
|
|
1117
880
|
|
|
1118
881
|
function preMain() {
|
|
1119
|
-
checkStackCookie();
|
|
1120
882
|
|
|
1121
883
|
}
|
|
1122
884
|
|
|
1123
885
|
function postRun() {
|
|
1124
|
-
checkStackCookie();
|
|
1125
886
|
if (ENVIRONMENT_IS_PTHREAD) return; // PThreads reuse the runtime from the main thread.
|
|
1126
887
|
|
|
1127
888
|
if (Module['postRun']) {
|
|
@@ -1130,7 +891,6 @@ function postRun() {
|
|
|
1130
891
|
addOnPostRun(Module['postRun'].shift());
|
|
1131
892
|
}
|
|
1132
893
|
}
|
|
1133
|
-
consumedModuleProp('postRun');
|
|
1134
894
|
|
|
1135
895
|
callRuntimeCallbacks(onPostRuns);
|
|
1136
896
|
}
|
|
@@ -1144,15 +904,9 @@ function postRun() {
|
|
|
1144
904
|
// the dependencies are met.
|
|
1145
905
|
var runDependencies = 0;
|
|
1146
906
|
var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
|
|
1147
|
-
var runDependencyTracking = {};
|
|
1148
|
-
var runDependencyWatcher = null;
|
|
1149
907
|
|
|
1150
908
|
function getUniqueRunDependency(id) {
|
|
1151
|
-
|
|
1152
|
-
while (1) {
|
|
1153
|
-
if (!runDependencyTracking[id]) return id;
|
|
1154
|
-
id = orig + Math.random();
|
|
1155
|
-
}
|
|
909
|
+
return id;
|
|
1156
910
|
}
|
|
1157
911
|
|
|
1158
912
|
function addRunDependency(id) {
|
|
@@ -1160,33 +914,6 @@ function addRunDependency(id) {
|
|
|
1160
914
|
|
|
1161
915
|
Module['monitorRunDependencies']?.(runDependencies);
|
|
1162
916
|
|
|
1163
|
-
if (id) {
|
|
1164
|
-
assert(!runDependencyTracking[id]);
|
|
1165
|
-
runDependencyTracking[id] = 1;
|
|
1166
|
-
if (runDependencyWatcher === null && typeof setInterval != 'undefined') {
|
|
1167
|
-
// Check for missing dependencies every few seconds
|
|
1168
|
-
runDependencyWatcher = setInterval(() => {
|
|
1169
|
-
if (ABORT) {
|
|
1170
|
-
clearInterval(runDependencyWatcher);
|
|
1171
|
-
runDependencyWatcher = null;
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
var shown = false;
|
|
1175
|
-
for (var dep in runDependencyTracking) {
|
|
1176
|
-
if (!shown) {
|
|
1177
|
-
shown = true;
|
|
1178
|
-
err('still waiting on run dependencies:');
|
|
1179
|
-
}
|
|
1180
|
-
err(`dependency: ${dep}`);
|
|
1181
|
-
}
|
|
1182
|
-
if (shown) {
|
|
1183
|
-
err('(end of list)');
|
|
1184
|
-
}
|
|
1185
|
-
}, 10000);
|
|
1186
|
-
}
|
|
1187
|
-
} else {
|
|
1188
|
-
err('warning: run dependency added without ID');
|
|
1189
|
-
}
|
|
1190
917
|
}
|
|
1191
918
|
|
|
1192
919
|
function removeRunDependency(id) {
|
|
@@ -1194,17 +921,7 @@ function removeRunDependency(id) {
|
|
|
1194
921
|
|
|
1195
922
|
Module['monitorRunDependencies']?.(runDependencies);
|
|
1196
923
|
|
|
1197
|
-
if (id) {
|
|
1198
|
-
assert(runDependencyTracking[id]);
|
|
1199
|
-
delete runDependencyTracking[id];
|
|
1200
|
-
} else {
|
|
1201
|
-
err('warning: run dependency removed without ID');
|
|
1202
|
-
}
|
|
1203
924
|
if (runDependencies == 0) {
|
|
1204
|
-
if (runDependencyWatcher !== null) {
|
|
1205
|
-
clearInterval(runDependencyWatcher);
|
|
1206
|
-
runDependencyWatcher = null;
|
|
1207
|
-
}
|
|
1208
925
|
if (dependenciesFulfilled) {
|
|
1209
926
|
var callback = dependenciesFulfilled;
|
|
1210
927
|
dependenciesFulfilled = null;
|
|
@@ -1224,6 +941,8 @@ function abort(what) {
|
|
|
1224
941
|
|
|
1225
942
|
ABORT = true;
|
|
1226
943
|
|
|
944
|
+
what += '. Build with -sASSERTIONS for more info.';
|
|
945
|
+
|
|
1227
946
|
// Use a wasm runtime error, because a JS error might be seen as a foreign
|
|
1228
947
|
// exception, which means we'd run destructors on it. We need the error to
|
|
1229
948
|
// simply make the program stop.
|
|
@@ -1247,17 +966,6 @@ function abort(what) {
|
|
|
1247
966
|
throw e;
|
|
1248
967
|
}
|
|
1249
968
|
|
|
1250
|
-
function createExportWrapper(name, nargs) {
|
|
1251
|
-
return (...args) => {
|
|
1252
|
-
assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`);
|
|
1253
|
-
var f = wasmExports[name];
|
|
1254
|
-
assert(f, `exported native function \`${name}\` not found`);
|
|
1255
|
-
// Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled.
|
|
1256
|
-
assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`);
|
|
1257
|
-
return f(...args);
|
|
1258
|
-
};
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
969
|
var wasmBinaryFile;
|
|
1262
970
|
function findWasmBinary() {
|
|
1263
971
|
if (Module['locateFile']) {
|
|
@@ -1301,10 +1009,6 @@ async function instantiateArrayBuffer(binaryFile, imports) {
|
|
|
1301
1009
|
} catch (reason) {
|
|
1302
1010
|
err(`failed to asynchronously prepare wasm: ${reason}`);
|
|
1303
1011
|
|
|
1304
|
-
// Warn on some common problems.
|
|
1305
|
-
if (isFileURI(wasmBinaryFile)) {
|
|
1306
|
-
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`);
|
|
1307
|
-
}
|
|
1308
1012
|
abort(reason);
|
|
1309
1013
|
}
|
|
1310
1014
|
}
|
|
@@ -1352,7 +1056,6 @@ async function createWasm() {
|
|
|
1352
1056
|
|
|
1353
1057
|
wasmTable = wasmExports['__indirect_function_table'];
|
|
1354
1058
|
|
|
1355
|
-
assert(wasmTable, 'table not found in wasm exports');
|
|
1356
1059
|
|
|
1357
1060
|
// We now have the Wasm module loaded up, keep a reference to the compiled module so we can post it to the workers.
|
|
1358
1061
|
wasmModule = module;
|
|
@@ -1363,15 +1066,9 @@ async function createWasm() {
|
|
|
1363
1066
|
addRunDependency('wasm-instantiate');
|
|
1364
1067
|
|
|
1365
1068
|
// Prefer streaming instantiation if available.
|
|
1366
|
-
// Async compilation can be confusing when an error on the page overwrites Module
|
|
1367
|
-
// (for example, if the order of elements is wrong, and the one defining Module is
|
|
1368
|
-
// later), so we save Module and check it later.
|
|
1369
|
-
var trueModule = Module;
|
|
1370
1069
|
function receiveInstantiationResult(result) {
|
|
1371
1070
|
// 'result' is a ResultObject object which has both the module and instance.
|
|
1372
1071
|
// receiveInstance() will swap in the exports (to Module.asm) so they can be called
|
|
1373
|
-
assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');
|
|
1374
|
-
trueModule = null;
|
|
1375
1072
|
return receiveInstance(result['instance'], result['module']);
|
|
1376
1073
|
}
|
|
1377
1074
|
|
|
@@ -1385,15 +1082,10 @@ async function createWasm() {
|
|
|
1385
1082
|
// path.
|
|
1386
1083
|
if (Module['instantiateWasm']) {
|
|
1387
1084
|
return new Promise((resolve, reject) => {
|
|
1388
|
-
try {
|
|
1389
1085
|
Module['instantiateWasm'](info, (mod, inst) => {
|
|
1390
1086
|
receiveInstance(mod, inst);
|
|
1391
1087
|
resolve(mod.exports);
|
|
1392
1088
|
});
|
|
1393
|
-
} catch(e) {
|
|
1394
|
-
err(`Module.instantiateWasm callback failed with error: ${e}`);
|
|
1395
|
-
reject(e);
|
|
1396
|
-
}
|
|
1397
1089
|
});
|
|
1398
1090
|
}
|
|
1399
1091
|
|
|
@@ -1424,43 +1116,44 @@ async function createWasm() {
|
|
|
1424
1116
|
// === Body ===
|
|
1425
1117
|
|
|
1426
1118
|
var ASM_CONSTS = {
|
|
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
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1119
|
+
310240: () => { console.error("thread instantiation failed") },
|
|
1120
|
+
310289: ($0, $1, $2, $3, $4) => { console.log('skipping frame, rendering too fast', $0, $1, $2, $3, $4) },
|
|
1121
|
+
310363: ($0, $1) => { console.log("using videoSync/audioSync", $0, $1) },
|
|
1122
|
+
310416: ($0) => { console.log("using threadedVideo", $0) },
|
|
1123
|
+
310459: ($0) => { console.log('setting core audio buffer size:', $0) },
|
|
1124
|
+
310514: ($0, $1) => { Module.canvas.width = $0; Module.canvas.height = $1; },
|
|
1125
|
+
310571: ($0) => { console.log('setting audioSampleRate', $0) },
|
|
1126
|
+
310618: ($0) => { console.log('setting audioBufferSize', $0) },
|
|
1127
|
+
310665: ($0) => { console.log('setting videoSync', $0) },
|
|
1128
|
+
310706: ($0) => { console.log('setting audioSync', $0) },
|
|
1129
|
+
310747: ($0) => { console.log('setting threadedVideo', $0) },
|
|
1130
|
+
310792: ($0) => { console.log('setting rewindEnable', $0) },
|
|
1131
|
+
310836: ($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) }; },
|
|
1132
|
+
311068: ($0) => { console.log("fps target audio", $0); },
|
|
1133
|
+
311109: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1134
|
+
311207: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1135
|
+
311305: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1136
|
+
311403: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1137
|
+
311501: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1138
|
+
311599: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1139
|
+
311697: ($0, $1, $2, $3) => { console.log("desired spec values: sampleRate/samples", $0, $1); console.log("obtained spec values: sampleRate/samples", $2, $3) },
|
|
1140
|
+
311829: () => { FS.syncfs(function (err) { assert(!err); }) },
|
|
1141
|
+
311873: ($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); },
|
|
1142
|
+
312098: () => { if (typeof(AudioContext) !== 'undefined') { return true; } else if (typeof(webkitAudioContext) !== 'undefined') { return true; } return false; },
|
|
1143
|
+
312245: () => { if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) { return true; } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') { return true; } return false; },
|
|
1144
|
+
312479: ($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; },
|
|
1145
|
+
313031: () => { var SDL2 = Module['SDL2']; return SDL2.audioContext.sampleRate; },
|
|
1146
|
+
313099: ($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); } },
|
|
1147
|
+
314792: ($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); } },
|
|
1148
|
+
315967: ($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'); } } } },
|
|
1149
|
+
316572: ($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)]; } } },
|
|
1150
|
+
317061: ($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; } },
|
|
1151
|
+
318067: ($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); },
|
|
1152
|
+
319535: ($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; },
|
|
1153
|
+
320523: ($0) => { if (Module['canvas']) { Module['canvas'].style['cursor'] = UTF8ToString($0); } },
|
|
1154
|
+
320606: () => { if (Module['canvas']) { Module['canvas'].style['cursor'] = 'none'; } },
|
|
1155
|
+
320675: () => { return window.innerWidth; },
|
|
1156
|
+
320705: () => { return window.innerHeight; }
|
|
1464
1157
|
};
|
|
1465
1158
|
|
|
1466
1159
|
// end include: preamble.js
|
|
@@ -1483,16 +1176,11 @@ var ASM_CONSTS = {
|
|
|
1483
1176
|
// out its message handler here. This avoids having to check in each of
|
|
1484
1177
|
// the onmessage handlers if the message was coming from valid worker.
|
|
1485
1178
|
worker.onmessage = (e) => {
|
|
1486
|
-
var cmd = e['data'].cmd;
|
|
1487
|
-
err(`received "${cmd}" command from terminated worker: ${worker.workerID}`);
|
|
1488
1179
|
};
|
|
1489
1180
|
};
|
|
1490
1181
|
|
|
1491
1182
|
var cleanupThread = (pthread_ptr) => {
|
|
1492
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! cleanupThread() can only ever be called from main application thread!');
|
|
1493
|
-
assert(pthread_ptr, 'Internal Error! Null pthread_ptr in cleanupThread!');
|
|
1494
1183
|
var worker = PThread.pthreads[pthread_ptr];
|
|
1495
|
-
assert(worker);
|
|
1496
1184
|
PThread.returnWorkerToPool(worker);
|
|
1497
1185
|
};
|
|
1498
1186
|
|
|
@@ -1506,15 +1194,12 @@ var ASM_CONSTS = {
|
|
|
1506
1194
|
var addOnPreRun = (cb) => onPreRuns.unshift(cb);
|
|
1507
1195
|
|
|
1508
1196
|
var spawnThread = (threadParams) => {
|
|
1509
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! spawnThread() can only ever be called from main application thread!');
|
|
1510
|
-
assert(threadParams.pthread_ptr, 'Internal error, no pthread ptr!');
|
|
1511
1197
|
|
|
1512
1198
|
var worker = PThread.getNewWorker();
|
|
1513
1199
|
if (!worker) {
|
|
1514
1200
|
// No available workers in the PThread pool.
|
|
1515
1201
|
return 6;
|
|
1516
1202
|
}
|
|
1517
|
-
assert(!worker.pthread_ptr, 'Internal error!');
|
|
1518
1203
|
|
|
1519
1204
|
PThread.runningWorkers.push(worker);
|
|
1520
1205
|
|
|
@@ -1606,7 +1291,6 @@ var ASM_CONSTS = {
|
|
|
1606
1291
|
|
|
1607
1292
|
|
|
1608
1293
|
|
|
1609
|
-
|
|
1610
1294
|
var handleException = (e) => {
|
|
1611
1295
|
// Certain exception types we do not treat as errors since they are used for
|
|
1612
1296
|
// internal control flow.
|
|
@@ -1616,12 +1300,6 @@ var ASM_CONSTS = {
|
|
|
1616
1300
|
if (e instanceof ExitStatus || e == 'unwind') {
|
|
1617
1301
|
return EXITSTATUS;
|
|
1618
1302
|
}
|
|
1619
|
-
checkStackCookie();
|
|
1620
|
-
if (e instanceof WebAssembly.RuntimeError) {
|
|
1621
|
-
if (_emscripten_stack_get_current() <= 0) {
|
|
1622
|
-
err('Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)');
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
1303
|
quit_(1, e);
|
|
1626
1304
|
};
|
|
1627
1305
|
|
|
@@ -1635,17 +1313,13 @@ var ASM_CONSTS = {
|
|
|
1635
1313
|
|
|
1636
1314
|
}
|
|
1637
1315
|
|
|
1638
|
-
|
|
1639
1316
|
/** @suppress {duplicate } */
|
|
1640
1317
|
/** @param {boolean|number=} implicit */
|
|
1641
1318
|
var exitJS = (status, implicit) => {
|
|
1642
1319
|
EXITSTATUS = status;
|
|
1643
1320
|
|
|
1644
|
-
checkUnflushedContent();
|
|
1645
|
-
|
|
1646
1321
|
if (ENVIRONMENT_IS_PTHREAD) {
|
|
1647
1322
|
// implicit exit can never happen on a pthread
|
|
1648
|
-
assert(!implicit);
|
|
1649
1323
|
// When running in a pthread we propagate the exit back to the main thread
|
|
1650
1324
|
// where it can decide if the whole process should be shut down or not.
|
|
1651
1325
|
// The pthread may have decided not to exit its own runtime, for example
|
|
@@ -1654,24 +1328,10 @@ var ASM_CONSTS = {
|
|
|
1654
1328
|
throw 'unwind';
|
|
1655
1329
|
}
|
|
1656
1330
|
|
|
1657
|
-
// if exit() was called explicitly, warn the user if the runtime isn't actually being shut down
|
|
1658
|
-
if (keepRuntimeAlive() && !implicit) {
|
|
1659
|
-
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)`;
|
|
1660
|
-
readyPromiseReject(msg);
|
|
1661
|
-
err(msg);
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
1331
|
_proc_exit(status);
|
|
1665
1332
|
};
|
|
1666
1333
|
var _exit = exitJS;
|
|
1667
1334
|
|
|
1668
|
-
var ptrToString = (ptr) => {
|
|
1669
|
-
assert(typeof ptr === 'number');
|
|
1670
|
-
// With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
|
|
1671
|
-
ptr >>>= 0;
|
|
1672
|
-
return '0x' + ptr.toString(16).padStart(8, '0');
|
|
1673
|
-
};
|
|
1674
|
-
|
|
1675
1335
|
|
|
1676
1336
|
var PThread = {
|
|
1677
1337
|
unusedWorkers:[],
|
|
@@ -1679,23 +1339,7 @@ var ASM_CONSTS = {
|
|
|
1679
1339
|
tlsInitFunctions:[],
|
|
1680
1340
|
pthreads:{
|
|
1681
1341
|
},
|
|
1682
|
-
nextWorkerID:1,
|
|
1683
|
-
debugInit() {
|
|
1684
|
-
function pthreadLogPrefix() {
|
|
1685
|
-
var t = 0;
|
|
1686
|
-
if (runtimeInitialized && typeof _pthread_self != 'undefined'
|
|
1687
|
-
) {
|
|
1688
|
-
t = _pthread_self();
|
|
1689
|
-
}
|
|
1690
|
-
return `w:${workerID},t:${ptrToString(t)}: `;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
// Prefix all err()/dbg() messages with the calling thread ID.
|
|
1694
|
-
var origDbg = dbg;
|
|
1695
|
-
dbg = (...args) => origDbg(pthreadLogPrefix() + args.join(' '));
|
|
1696
|
-
},
|
|
1697
1342
|
init() {
|
|
1698
|
-
PThread.debugInit();
|
|
1699
1343
|
if ((!(ENVIRONMENT_IS_PTHREAD))) {
|
|
1700
1344
|
PThread.initMainThread();
|
|
1701
1345
|
}
|
|
@@ -1714,7 +1358,6 @@ var ASM_CONSTS = {
|
|
|
1714
1358
|
});
|
|
1715
1359
|
},
|
|
1716
1360
|
terminateAllThreads:() => {
|
|
1717
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! terminateAllThreads() can only ever be called from main application thread!');
|
|
1718
1361
|
// Attempt to kill all workers. Sadly (at least on the web) there is no
|
|
1719
1362
|
// way to terminate a worker synchronously, or to be notified when a
|
|
1720
1363
|
// worker in actually terminated. This means there is some risk that
|
|
@@ -1802,16 +1445,10 @@ var ASM_CONSTS = {
|
|
|
1802
1445
|
|
|
1803
1446
|
worker.onerror = (e) => {
|
|
1804
1447
|
var message = 'worker sent an error!';
|
|
1805
|
-
if (worker.pthread_ptr) {
|
|
1806
|
-
message = `Pthread ${ptrToString(worker.pthread_ptr)} sent an error!`;
|
|
1807
|
-
}
|
|
1808
1448
|
err(`${message} ${e.filename}:${e.lineno}: ${e.message}`);
|
|
1809
1449
|
throw e;
|
|
1810
1450
|
};
|
|
1811
1451
|
|
|
1812
|
-
assert(wasmMemory instanceof WebAssembly.Memory, 'WebAssembly memory should have been loaded by now!');
|
|
1813
|
-
assert(wasmModule instanceof WebAssembly.Module, 'WebAssembly Module should have been loaded by now!');
|
|
1814
|
-
|
|
1815
1452
|
// When running on a pthread, none of the incoming parameters on the module
|
|
1816
1453
|
// object are present. Proxy known handlers back to the main thread if specified.
|
|
1817
1454
|
var handlers = [];
|
|
@@ -1827,15 +1464,12 @@ var ASM_CONSTS = {
|
|
|
1827
1464
|
}
|
|
1828
1465
|
}
|
|
1829
1466
|
|
|
1830
|
-
worker.workerID = PThread.nextWorkerID++;
|
|
1831
|
-
|
|
1832
1467
|
// Ask the new worker to load up the Emscripten-compiled page. This is a heavy operation.
|
|
1833
1468
|
worker.postMessage({
|
|
1834
1469
|
cmd: 'load',
|
|
1835
1470
|
handlers: handlers,
|
|
1836
1471
|
wasmMemory,
|
|
1837
1472
|
wasmModule,
|
|
1838
|
-
'workerID': worker.workerID,
|
|
1839
1473
|
});
|
|
1840
1474
|
}),
|
|
1841
1475
|
loadWasmModuleToAllWorkers(onMaybeReady) {
|
|
@@ -1860,20 +1494,13 @@ var ASM_CONSTS = {
|
|
|
1860
1494
|
'type': 'module',
|
|
1861
1495
|
// This is the way that we signal to the Web Worker that it is hosting
|
|
1862
1496
|
// a pthread.
|
|
1863
|
-
'name': 'em-pthread
|
|
1497
|
+
'name': 'em-pthread',
|
|
1864
1498
|
});
|
|
1865
1499
|
PThread.unusedWorkers.push(worker);
|
|
1866
1500
|
},
|
|
1867
1501
|
getNewWorker() {
|
|
1868
1502
|
if (PThread.unusedWorkers.length == 0) {
|
|
1869
1503
|
// PTHREAD_POOL_SIZE_STRICT should show a warning and, if set to level `2`, return from the function.
|
|
1870
|
-
// However, if we're in Node.js, then we can create new workers on the fly and PTHREAD_POOL_SIZE_STRICT
|
|
1871
|
-
// should be ignored altogether.
|
|
1872
|
-
err('Tried to spawn a new thread, but the thread pool is exhausted.\n' +
|
|
1873
|
-
'This might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.\n' +
|
|
1874
|
-
'If you want to increase the pool size, use setting `-sPTHREAD_POOL_SIZE=...`.'
|
|
1875
|
-
+ '\nIf you want to throw an explicit error instead of the risk of deadlocking in those cases, use setting `-sPTHREAD_POOL_SIZE_STRICT=2`.'
|
|
1876
|
-
);
|
|
1877
1504
|
PThread.allocateUnusedWorker();
|
|
1878
1505
|
PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]);
|
|
1879
1506
|
}
|
|
@@ -1892,9 +1519,6 @@ var ASM_CONSTS = {
|
|
|
1892
1519
|
var stackHigh = HEAPU32[(((pthread_ptr)+(52))>>2)];
|
|
1893
1520
|
var stackSize = HEAPU32[(((pthread_ptr)+(56))>>2)];
|
|
1894
1521
|
var stackLow = stackHigh - stackSize;
|
|
1895
|
-
assert(stackHigh != 0);
|
|
1896
|
-
assert(stackLow != 0);
|
|
1897
|
-
assert(stackHigh > stackLow, 'stackHigh must be higher then stackLow');
|
|
1898
1522
|
// Set stack limits used by `emscripten/stack.h` function. These limits are
|
|
1899
1523
|
// cached in wasm-side globals to make checks as fast as possible.
|
|
1900
1524
|
_emscripten_stack_set_limits(stackHigh, stackLow);
|
|
@@ -1902,9 +1526,6 @@ var ASM_CONSTS = {
|
|
|
1902
1526
|
// Call inside wasm module to set up the stack frame for this pthread in wasm module scope
|
|
1903
1527
|
stackRestore(stackHigh);
|
|
1904
1528
|
|
|
1905
|
-
// Write the stack cookie last, after we have set up the proper bounds and
|
|
1906
|
-
// current position of the stack.
|
|
1907
|
-
writeStackCookie();
|
|
1908
1529
|
};
|
|
1909
1530
|
|
|
1910
1531
|
|
|
@@ -1942,8 +1563,6 @@ var ASM_CONSTS = {
|
|
|
1942
1563
|
/** @suppress {checkTypes} */
|
|
1943
1564
|
wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
|
|
1944
1565
|
}
|
|
1945
|
-
/** @suppress {checkTypes} */
|
|
1946
|
-
assert(wasmTable.get(funcPtr) == func, 'JavaScript-side Wasm function table mirror is out of date!');
|
|
1947
1566
|
return func;
|
|
1948
1567
|
};
|
|
1949
1568
|
var invokeEntryPoint = (ptr, arg) => {
|
|
@@ -1972,7 +1591,6 @@ var ASM_CONSTS = {
|
|
|
1972
1591
|
|
|
1973
1592
|
var result = getWasmTableEntry(ptr)(arg);
|
|
1974
1593
|
|
|
1975
|
-
checkStackCookie();
|
|
1976
1594
|
function finish(result) {
|
|
1977
1595
|
if (keepRuntimeAlive()) {
|
|
1978
1596
|
EXITSTATUS = result;
|
|
@@ -1985,7 +1603,6 @@ var ASM_CONSTS = {
|
|
|
1985
1603
|
|
|
1986
1604
|
var noExitRuntime = Module['noExitRuntime'] || true;
|
|
1987
1605
|
|
|
1988
|
-
|
|
1989
1606
|
var registerTLSInit = (tlsInitFunc) => PThread.tlsInitFunctions.push(tlsInitFunc);
|
|
1990
1607
|
|
|
1991
1608
|
|
|
@@ -2011,14 +1628,6 @@ var ASM_CONSTS = {
|
|
|
2011
1628
|
|
|
2012
1629
|
|
|
2013
1630
|
|
|
2014
|
-
var warnOnce = (text) => {
|
|
2015
|
-
warnOnce.shown ||= {};
|
|
2016
|
-
if (!warnOnce.shown[text]) {
|
|
2017
|
-
warnOnce.shown[text] = 1;
|
|
2018
|
-
err(text);
|
|
2019
|
-
}
|
|
2020
|
-
};
|
|
2021
|
-
|
|
2022
1631
|
var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined;
|
|
2023
1632
|
|
|
2024
1633
|
/**
|
|
@@ -2059,7 +1668,6 @@ var ASM_CONSTS = {
|
|
|
2059
1668
|
if ((u0 & 0xF0) == 0xE0) {
|
|
2060
1669
|
u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
|
|
2061
1670
|
} else {
|
|
2062
|
-
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!');
|
|
2063
1671
|
u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
|
|
2064
1672
|
}
|
|
2065
1673
|
|
|
@@ -2089,7 +1697,6 @@ var ASM_CONSTS = {
|
|
|
2089
1697
|
* @return {string}
|
|
2090
1698
|
*/
|
|
2091
1699
|
var UTF8ToString = (ptr, maxBytesToRead) => {
|
|
2092
|
-
assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
|
|
2093
1700
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
|
|
2094
1701
|
};
|
|
2095
1702
|
var ___assert_fail = (condition, filename, line, func) =>
|
|
@@ -2113,7 +1720,6 @@ var ASM_CONSTS = {
|
|
|
2113
1720
|
|
|
2114
1721
|
var ___pthread_create_js = (pthread_ptr, attr, startRoutine, arg) => {
|
|
2115
1722
|
if (!_emscripten_has_threading_support()) {
|
|
2116
|
-
dbg('pthread_create: environment does not support SharedArrayBuffer, pthreads are not available');
|
|
2117
1723
|
return 6;
|
|
2118
1724
|
}
|
|
2119
1725
|
|
|
@@ -2157,7 +1763,6 @@ var ASM_CONSTS = {
|
|
|
2157
1763
|
|
|
2158
1764
|
/** @suppress {duplicate } */
|
|
2159
1765
|
var syscallGetVarargI = () => {
|
|
2160
|
-
assert(SYSCALLS.varargs != undefined);
|
|
2161
1766
|
// the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number.
|
|
2162
1767
|
var ret = HEAP32[((+SYSCALLS.varargs)>>2)];
|
|
2163
1768
|
SYSCALLS.varargs += 4;
|
|
@@ -2320,7 +1925,6 @@ var ASM_CONSTS = {
|
|
|
2320
1925
|
};
|
|
2321
1926
|
|
|
2322
1927
|
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
2323
|
-
assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
|
|
2324
1928
|
// Parameter maxBytesToWrite is not optional. Negative values, 0, null,
|
|
2325
1929
|
// undefined and false each don't write out any bytes.
|
|
2326
1930
|
if (!(maxBytesToWrite > 0))
|
|
@@ -2355,7 +1959,6 @@ var ASM_CONSTS = {
|
|
|
2355
1959
|
heap[outIdx++] = 0x80 | (u & 63);
|
|
2356
1960
|
} else {
|
|
2357
1961
|
if (outIdx + 3 >= endIdx) break;
|
|
2358
|
-
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).');
|
|
2359
1962
|
heap[outIdx++] = 0xF0 | (u >> 18);
|
|
2360
1963
|
heap[outIdx++] = 0x80 | ((u >> 12) & 63);
|
|
2361
1964
|
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
@@ -2541,7 +2144,6 @@ var ASM_CONSTS = {
|
|
|
2541
2144
|
};
|
|
2542
2145
|
|
|
2543
2146
|
var alignMemory = (size, alignment) => {
|
|
2544
|
-
assert(alignment, "alignment argument is required");
|
|
2545
2147
|
return Math.ceil(size / alignment) * alignment;
|
|
2546
2148
|
};
|
|
2547
2149
|
var mmapAlloc = (size) => {
|
|
@@ -2707,7 +2309,7 @@ var ASM_CONSTS = {
|
|
|
2707
2309
|
}
|
|
2708
2310
|
},
|
|
2709
2311
|
lookup(parent, name) {
|
|
2710
|
-
throw
|
|
2312
|
+
throw MEMFS.doesNotExistError;
|
|
2711
2313
|
},
|
|
2712
2314
|
mknod(parent, name, mode, dev) {
|
|
2713
2315
|
return MEMFS.createNode(parent, name, mode, dev);
|
|
@@ -2764,7 +2366,6 @@ var ASM_CONSTS = {
|
|
|
2764
2366
|
var contents = stream.node.contents;
|
|
2765
2367
|
if (position >= stream.node.usedBytes) return 0;
|
|
2766
2368
|
var size = Math.min(stream.node.usedBytes - position, length);
|
|
2767
|
-
assert(size >= 0);
|
|
2768
2369
|
if (size > 8 && contents.subarray) { // non-trivial, and typed array
|
|
2769
2370
|
buffer.set(contents.subarray(position, position + size), offset);
|
|
2770
2371
|
} else {
|
|
@@ -2773,8 +2374,6 @@ var ASM_CONSTS = {
|
|
|
2773
2374
|
return size;
|
|
2774
2375
|
},
|
|
2775
2376
|
write(stream, buffer, offset, length, position, canOwn) {
|
|
2776
|
-
// The data buffer should be a typed array view
|
|
2777
|
-
assert(!(buffer instanceof ArrayBuffer));
|
|
2778
2377
|
|
|
2779
2378
|
if (!length) return 0;
|
|
2780
2379
|
var node = stream.node;
|
|
@@ -2782,7 +2381,6 @@ var ASM_CONSTS = {
|
|
|
2782
2381
|
|
|
2783
2382
|
if (buffer.subarray && (!node.contents || node.contents.subarray)) { // This write is from a typed array to a typed array?
|
|
2784
2383
|
if (canOwn) {
|
|
2785
|
-
assert(position === 0, 'canOwn must imply no weird position inside the file');
|
|
2786
2384
|
node.contents = buffer.subarray(offset, offset + length);
|
|
2787
2385
|
node.usedBytes = length;
|
|
2788
2386
|
return length;
|
|
@@ -2870,7 +2468,6 @@ var ASM_CONSTS = {
|
|
|
2870
2468
|
|
|
2871
2469
|
var asyncLoad = async (url) => {
|
|
2872
2470
|
var arrayBuffer = await readAsync(url);
|
|
2873
|
-
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
|
|
2874
2471
|
return new Uint8Array(arrayBuffer);
|
|
2875
2472
|
};
|
|
2876
2473
|
|
|
@@ -2959,7 +2556,6 @@ var ASM_CONSTS = {
|
|
|
2959
2556
|
if (typeof indexedDB != 'undefined') return indexedDB;
|
|
2960
2557
|
var ret = null;
|
|
2961
2558
|
if (typeof window == 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
2962
|
-
assert(ret, 'IDBFS used, but indexedDB not supported');
|
|
2963
2559
|
return ret;
|
|
2964
2560
|
},
|
|
2965
2561
|
DB_VERSION:21,
|
|
@@ -3322,134 +2918,6 @@ var ASM_CONSTS = {
|
|
|
3322
2918
|
});
|
|
3323
2919
|
},
|
|
3324
2920
|
};
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
var strError = (errno) => UTF8ToString(_strerror(errno));
|
|
3329
|
-
|
|
3330
|
-
var ERRNO_CODES = {
|
|
3331
|
-
'EPERM': 63,
|
|
3332
|
-
'ENOENT': 44,
|
|
3333
|
-
'ESRCH': 71,
|
|
3334
|
-
'EINTR': 27,
|
|
3335
|
-
'EIO': 29,
|
|
3336
|
-
'ENXIO': 60,
|
|
3337
|
-
'E2BIG': 1,
|
|
3338
|
-
'ENOEXEC': 45,
|
|
3339
|
-
'EBADF': 8,
|
|
3340
|
-
'ECHILD': 12,
|
|
3341
|
-
'EAGAIN': 6,
|
|
3342
|
-
'EWOULDBLOCK': 6,
|
|
3343
|
-
'ENOMEM': 48,
|
|
3344
|
-
'EACCES': 2,
|
|
3345
|
-
'EFAULT': 21,
|
|
3346
|
-
'ENOTBLK': 105,
|
|
3347
|
-
'EBUSY': 10,
|
|
3348
|
-
'EEXIST': 20,
|
|
3349
|
-
'EXDEV': 75,
|
|
3350
|
-
'ENODEV': 43,
|
|
3351
|
-
'ENOTDIR': 54,
|
|
3352
|
-
'EISDIR': 31,
|
|
3353
|
-
'EINVAL': 28,
|
|
3354
|
-
'ENFILE': 41,
|
|
3355
|
-
'EMFILE': 33,
|
|
3356
|
-
'ENOTTY': 59,
|
|
3357
|
-
'ETXTBSY': 74,
|
|
3358
|
-
'EFBIG': 22,
|
|
3359
|
-
'ENOSPC': 51,
|
|
3360
|
-
'ESPIPE': 70,
|
|
3361
|
-
'EROFS': 69,
|
|
3362
|
-
'EMLINK': 34,
|
|
3363
|
-
'EPIPE': 64,
|
|
3364
|
-
'EDOM': 18,
|
|
3365
|
-
'ERANGE': 68,
|
|
3366
|
-
'ENOMSG': 49,
|
|
3367
|
-
'EIDRM': 24,
|
|
3368
|
-
'ECHRNG': 106,
|
|
3369
|
-
'EL2NSYNC': 156,
|
|
3370
|
-
'EL3HLT': 107,
|
|
3371
|
-
'EL3RST': 108,
|
|
3372
|
-
'ELNRNG': 109,
|
|
3373
|
-
'EUNATCH': 110,
|
|
3374
|
-
'ENOCSI': 111,
|
|
3375
|
-
'EL2HLT': 112,
|
|
3376
|
-
'EDEADLK': 16,
|
|
3377
|
-
'ENOLCK': 46,
|
|
3378
|
-
'EBADE': 113,
|
|
3379
|
-
'EBADR': 114,
|
|
3380
|
-
'EXFULL': 115,
|
|
3381
|
-
'ENOANO': 104,
|
|
3382
|
-
'EBADRQC': 103,
|
|
3383
|
-
'EBADSLT': 102,
|
|
3384
|
-
'EDEADLOCK': 16,
|
|
3385
|
-
'EBFONT': 101,
|
|
3386
|
-
'ENOSTR': 100,
|
|
3387
|
-
'ENODATA': 116,
|
|
3388
|
-
'ETIME': 117,
|
|
3389
|
-
'ENOSR': 118,
|
|
3390
|
-
'ENONET': 119,
|
|
3391
|
-
'ENOPKG': 120,
|
|
3392
|
-
'EREMOTE': 121,
|
|
3393
|
-
'ENOLINK': 47,
|
|
3394
|
-
'EADV': 122,
|
|
3395
|
-
'ESRMNT': 123,
|
|
3396
|
-
'ECOMM': 124,
|
|
3397
|
-
'EPROTO': 65,
|
|
3398
|
-
'EMULTIHOP': 36,
|
|
3399
|
-
'EDOTDOT': 125,
|
|
3400
|
-
'EBADMSG': 9,
|
|
3401
|
-
'ENOTUNIQ': 126,
|
|
3402
|
-
'EBADFD': 127,
|
|
3403
|
-
'EREMCHG': 128,
|
|
3404
|
-
'ELIBACC': 129,
|
|
3405
|
-
'ELIBBAD': 130,
|
|
3406
|
-
'ELIBSCN': 131,
|
|
3407
|
-
'ELIBMAX': 132,
|
|
3408
|
-
'ELIBEXEC': 133,
|
|
3409
|
-
'ENOSYS': 52,
|
|
3410
|
-
'ENOTEMPTY': 55,
|
|
3411
|
-
'ENAMETOOLONG': 37,
|
|
3412
|
-
'ELOOP': 32,
|
|
3413
|
-
'EOPNOTSUPP': 138,
|
|
3414
|
-
'EPFNOSUPPORT': 139,
|
|
3415
|
-
'ECONNRESET': 15,
|
|
3416
|
-
'ENOBUFS': 42,
|
|
3417
|
-
'EAFNOSUPPORT': 5,
|
|
3418
|
-
'EPROTOTYPE': 67,
|
|
3419
|
-
'ENOTSOCK': 57,
|
|
3420
|
-
'ENOPROTOOPT': 50,
|
|
3421
|
-
'ESHUTDOWN': 140,
|
|
3422
|
-
'ECONNREFUSED': 14,
|
|
3423
|
-
'EADDRINUSE': 3,
|
|
3424
|
-
'ECONNABORTED': 13,
|
|
3425
|
-
'ENETUNREACH': 40,
|
|
3426
|
-
'ENETDOWN': 38,
|
|
3427
|
-
'ETIMEDOUT': 73,
|
|
3428
|
-
'EHOSTDOWN': 142,
|
|
3429
|
-
'EHOSTUNREACH': 23,
|
|
3430
|
-
'EINPROGRESS': 26,
|
|
3431
|
-
'EALREADY': 7,
|
|
3432
|
-
'EDESTADDRREQ': 17,
|
|
3433
|
-
'EMSGSIZE': 35,
|
|
3434
|
-
'EPROTONOSUPPORT': 66,
|
|
3435
|
-
'ESOCKTNOSUPPORT': 137,
|
|
3436
|
-
'EADDRNOTAVAIL': 4,
|
|
3437
|
-
'ENETRESET': 39,
|
|
3438
|
-
'EISCONN': 30,
|
|
3439
|
-
'ENOTCONN': 53,
|
|
3440
|
-
'ETOOMANYREFS': 141,
|
|
3441
|
-
'EUSERS': 136,
|
|
3442
|
-
'EDQUOT': 19,
|
|
3443
|
-
'ESTALE': 72,
|
|
3444
|
-
'ENOTSUP': 138,
|
|
3445
|
-
'ENOMEDIUM': 148,
|
|
3446
|
-
'EILSEQ': 25,
|
|
3447
|
-
'EOVERFLOW': 61,
|
|
3448
|
-
'ECANCELED': 11,
|
|
3449
|
-
'ENOTRECOVERABLE': 56,
|
|
3450
|
-
'EOWNERDEAD': 62,
|
|
3451
|
-
'ESTRPIPE': 135,
|
|
3452
|
-
};
|
|
3453
2921
|
var FS = {
|
|
3454
2922
|
root:null,
|
|
3455
2923
|
mounts:[],
|
|
@@ -3465,7 +2933,7 @@ var ASM_CONSTS = {
|
|
|
3465
2933
|
syncFSRequests:0,
|
|
3466
2934
|
readFiles:{
|
|
3467
2935
|
},
|
|
3468
|
-
ErrnoError:class
|
|
2936
|
+
ErrnoError:class {
|
|
3469
2937
|
name = 'ErrnoError';
|
|
3470
2938
|
// We set the `name` property to be able to identify `FS.ErrnoError`
|
|
3471
2939
|
// - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway.
|
|
@@ -3474,14 +2942,7 @@ var ASM_CONSTS = {
|
|
|
3474
2942
|
// the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs.
|
|
3475
2943
|
// we'll use the reliable test `err.name == "ErrnoError"` instead
|
|
3476
2944
|
constructor(errno) {
|
|
3477
|
-
super(runtimeInitialized ? strError(errno) : '');
|
|
3478
2945
|
this.errno = errno;
|
|
3479
|
-
for (var key in ERRNO_CODES) {
|
|
3480
|
-
if (ERRNO_CODES[key] === errno) {
|
|
3481
|
-
this.code = key;
|
|
3482
|
-
break;
|
|
3483
|
-
}
|
|
3484
|
-
}
|
|
3485
2946
|
}
|
|
3486
2947
|
},
|
|
3487
2948
|
FSStream:class {
|
|
@@ -3679,7 +3140,6 @@ var ASM_CONSTS = {
|
|
|
3679
3140
|
return FS.lookup(parent, name);
|
|
3680
3141
|
},
|
|
3681
3142
|
createNode(parent, name, mode, rdev) {
|
|
3682
|
-
assert(typeof parent == 'object')
|
|
3683
3143
|
var node = new FS.FSNode(parent, name, mode, rdev);
|
|
3684
3144
|
|
|
3685
3145
|
FS.hashAddNode(node);
|
|
@@ -3818,7 +3278,6 @@ var ASM_CONSTS = {
|
|
|
3818
3278
|
},
|
|
3819
3279
|
getStream:(fd) => FS.streams[fd],
|
|
3820
3280
|
createStream(stream, fd = -1) {
|
|
3821
|
-
assert(fd >= -1);
|
|
3822
3281
|
|
|
3823
3282
|
// clone it, so we can return an instance of FSStream
|
|
3824
3283
|
stream = Object.assign(new FS.FSStream(), stream);
|
|
@@ -3893,7 +3352,6 @@ var ASM_CONSTS = {
|
|
|
3893
3352
|
var completed = 0;
|
|
3894
3353
|
|
|
3895
3354
|
function doCallback(errCode) {
|
|
3896
|
-
assert(FS.syncFSRequests > 0);
|
|
3897
3355
|
FS.syncFSRequests--;
|
|
3898
3356
|
return callback(errCode);
|
|
3899
3357
|
}
|
|
@@ -3920,11 +3378,6 @@ var ASM_CONSTS = {
|
|
|
3920
3378
|
});
|
|
3921
3379
|
},
|
|
3922
3380
|
mount(type, opts, mountpoint) {
|
|
3923
|
-
if (typeof type == 'string') {
|
|
3924
|
-
// The filesystem was not included, and instead we have an error
|
|
3925
|
-
// message stored in the variable.
|
|
3926
|
-
throw type;
|
|
3927
|
-
}
|
|
3928
3381
|
var root = mountpoint === '/';
|
|
3929
3382
|
var pseudo = !mountpoint;
|
|
3930
3383
|
var node;
|
|
@@ -4003,7 +3456,6 @@ var ASM_CONSTS = {
|
|
|
4003
3456
|
|
|
4004
3457
|
// remove this mount from the child mounts
|
|
4005
3458
|
var idx = node.mount.mounts.indexOf(mount);
|
|
4006
|
-
assert(idx !== -1);
|
|
4007
3459
|
node.mount.mounts.splice(idx, 1);
|
|
4008
3460
|
},
|
|
4009
3461
|
lookup(parent, name) {
|
|
@@ -4496,7 +3948,6 @@ var ASM_CONSTS = {
|
|
|
4496
3948
|
return stream.position;
|
|
4497
3949
|
},
|
|
4498
3950
|
read(stream, buffer, offset, length, position) {
|
|
4499
|
-
assert(offset >= 0);
|
|
4500
3951
|
if (length < 0 || position < 0) {
|
|
4501
3952
|
throw new FS.ErrnoError(28);
|
|
4502
3953
|
}
|
|
@@ -4523,7 +3974,6 @@ var ASM_CONSTS = {
|
|
|
4523
3974
|
return bytesRead;
|
|
4524
3975
|
},
|
|
4525
3976
|
write(stream, buffer, offset, length, position, canOwn) {
|
|
4526
|
-
assert(offset >= 0);
|
|
4527
3977
|
if (length < 0 || position < 0) {
|
|
4528
3978
|
throw new FS.ErrnoError(28);
|
|
4529
3979
|
}
|
|
@@ -4595,7 +4045,6 @@ var ASM_CONSTS = {
|
|
|
4595
4045
|
return stream.stream_ops.mmap(stream, length, position, prot, flags);
|
|
4596
4046
|
},
|
|
4597
4047
|
msync(stream, buffer, offset, length, mmapFlags) {
|
|
4598
|
-
assert(offset >= 0);
|
|
4599
4048
|
if (!stream.stream_ops.msync) {
|
|
4600
4049
|
return 0;
|
|
4601
4050
|
}
|
|
@@ -4759,9 +4208,6 @@ var ASM_CONSTS = {
|
|
|
4759
4208
|
var stdin = FS.open('/dev/stdin', 0);
|
|
4760
4209
|
var stdout = FS.open('/dev/stdout', 1);
|
|
4761
4210
|
var stderr = FS.open('/dev/stderr', 1);
|
|
4762
|
-
assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`);
|
|
4763
|
-
assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`);
|
|
4764
|
-
assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`);
|
|
4765
4211
|
},
|
|
4766
4212
|
staticInit() {
|
|
4767
4213
|
FS.nameTable = new Array(4096);
|
|
@@ -4778,7 +4224,6 @@ var ASM_CONSTS = {
|
|
|
4778
4224
|
};
|
|
4779
4225
|
},
|
|
4780
4226
|
init(input, output, error) {
|
|
4781
|
-
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)');
|
|
4782
4227
|
FS.initialized = true;
|
|
4783
4228
|
|
|
4784
4229
|
// Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here
|
|
@@ -4791,7 +4236,6 @@ var ASM_CONSTS = {
|
|
|
4791
4236
|
quit() {
|
|
4792
4237
|
FS.initialized = false;
|
|
4793
4238
|
// force-flush all streams, so we get musl std streams printed out
|
|
4794
|
-
_fflush(0);
|
|
4795
4239
|
// close all of our streams
|
|
4796
4240
|
for (var i = 0; i < FS.streams.length; i++) {
|
|
4797
4241
|
var stream = FS.streams[i];
|
|
@@ -5078,7 +4522,6 @@ var ASM_CONSTS = {
|
|
|
5078
4522
|
if (position >= contents.length)
|
|
5079
4523
|
return 0;
|
|
5080
4524
|
var size = Math.min(contents.length - position, length);
|
|
5081
|
-
assert(size >= 0);
|
|
5082
4525
|
if (contents.slice) { // normal array
|
|
5083
4526
|
for (var i = 0; i < size; i++) {
|
|
5084
4527
|
buffer[offset + i] = contents[position + i];
|
|
@@ -5108,24 +4551,6 @@ var ASM_CONSTS = {
|
|
|
5108
4551
|
node.stream_ops = stream_ops;
|
|
5109
4552
|
return node;
|
|
5110
4553
|
},
|
|
5111
|
-
absolutePath() {
|
|
5112
|
-
abort('FS.absolutePath has been removed; use PATH_FS.resolve instead');
|
|
5113
|
-
},
|
|
5114
|
-
createFolder() {
|
|
5115
|
-
abort('FS.createFolder has been removed; use FS.mkdir instead');
|
|
5116
|
-
},
|
|
5117
|
-
createLink() {
|
|
5118
|
-
abort('FS.createLink has been removed; use FS.symlink instead');
|
|
5119
|
-
},
|
|
5120
|
-
joinPath() {
|
|
5121
|
-
abort('FS.joinPath has been removed; use PATH.join instead');
|
|
5122
|
-
},
|
|
5123
|
-
mmapAlloc() {
|
|
5124
|
-
abort('FS.mmapAlloc has been replaced by the top level function mmapAlloc');
|
|
5125
|
-
},
|
|
5126
|
-
standardizePath() {
|
|
5127
|
-
abort('FS.standardizePath has been removed; use PATH.normalize instead');
|
|
5128
|
-
},
|
|
5129
4554
|
};
|
|
5130
4555
|
|
|
5131
4556
|
var SYSCALLS = {
|
|
@@ -5304,7 +4729,6 @@ var ASM_CONSTS = {
|
|
|
5304
4729
|
|
|
5305
4730
|
|
|
5306
4731
|
var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
|
|
5307
|
-
assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
|
|
5308
4732
|
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
5309
4733
|
};
|
|
5310
4734
|
|
|
@@ -5378,7 +4802,6 @@ var ASM_CONSTS = {
|
|
|
5378
4802
|
FS.isLink(child.mode) ? 10 : // DT_LNK, symbolic link.
|
|
5379
4803
|
8; // DT_REG, regular file.
|
|
5380
4804
|
}
|
|
5381
|
-
assert(id);
|
|
5382
4805
|
HEAP64[((dirp + pos)>>3)] = BigInt(id);
|
|
5383
4806
|
HEAP64[(((dirp + pos)+(8))>>3)] = BigInt((idx + 1) * struct_size);
|
|
5384
4807
|
HEAP16[(((dirp + pos)+(16))>>1)] = 280;
|
|
@@ -5549,7 +4972,6 @@ var ASM_CONSTS = {
|
|
|
5549
4972
|
var nofollow = flags & 256;
|
|
5550
4973
|
var allowEmpty = flags & 4096;
|
|
5551
4974
|
flags = flags & (~6400);
|
|
5552
|
-
assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`);
|
|
5553
4975
|
path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
|
|
5554
4976
|
return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path));
|
|
5555
4977
|
} catch (e) {
|
|
@@ -5688,7 +5110,6 @@ var ASM_CONSTS = {
|
|
|
5688
5110
|
try {
|
|
5689
5111
|
|
|
5690
5112
|
path = SYSCALLS.getStr(path);
|
|
5691
|
-
assert(flags === 0);
|
|
5692
5113
|
path = SYSCALLS.calculateAt(dirfd, path, true);
|
|
5693
5114
|
var now = Date.now(), atime, mtime;
|
|
5694
5115
|
if (!times) {
|
|
@@ -5730,7 +5151,7 @@ var ASM_CONSTS = {
|
|
|
5730
5151
|
|
|
5731
5152
|
|
|
5732
5153
|
var __abort_js = () =>
|
|
5733
|
-
abort('
|
|
5154
|
+
abort('');
|
|
5734
5155
|
|
|
5735
5156
|
var __emscripten_init_main_thread_js = (tb) => {
|
|
5736
5157
|
// Pass the thread address to the native code where they stored in wasm
|
|
@@ -5764,7 +5185,6 @@ var ASM_CONSTS = {
|
|
|
5764
5185
|
};
|
|
5765
5186
|
var callUserCallback = (func) => {
|
|
5766
5187
|
if (ABORT) {
|
|
5767
|
-
err('user callback triggered after runtime exited or application aborted. Ignoring.');
|
|
5768
5188
|
return;
|
|
5769
5189
|
}
|
|
5770
5190
|
try {
|
|
@@ -5784,7 +5204,6 @@ var ASM_CONSTS = {
|
|
|
5784
5204
|
// thread.
|
|
5785
5205
|
// TODO: How to make this work with wasm64?
|
|
5786
5206
|
var wait = Atomics.waitAsync(HEAP32, ((pthread_ptr)>>2), pthread_ptr);
|
|
5787
|
-
assert(wait.async);
|
|
5788
5207
|
wait.value.then(checkMailbox);
|
|
5789
5208
|
var waitingAsync = pthread_ptr + 128;
|
|
5790
5209
|
Atomics.store(HEAP32, ((waitingAsync)>>2), 1);
|
|
@@ -5815,7 +5234,6 @@ var ASM_CONSTS = {
|
|
|
5815
5234
|
} else {
|
|
5816
5235
|
var worker = PThread.pthreads[targetThread];
|
|
5817
5236
|
if (!worker) {
|
|
5818
|
-
err(`Cannot send message to thread with ID ${targetThread}, unknown thread ID!`);
|
|
5819
5237
|
return;
|
|
5820
5238
|
}
|
|
5821
5239
|
worker.postMessage({cmd: 'checkMailbox'});
|
|
@@ -5844,15 +5262,9 @@ var ASM_CONSTS = {
|
|
|
5844
5262
|
}
|
|
5845
5263
|
// Proxied JS library funcs use funcIndex and EM_ASM functions use emAsmAddr
|
|
5846
5264
|
var func = emAsmAddr ? ASM_CONSTS[emAsmAddr] : proxiedFunctionTable[funcIndex];
|
|
5847
|
-
assert(!(funcIndex && emAsmAddr));
|
|
5848
|
-
assert(func.length == numCallArgs, 'Call args mismatch in _emscripten_receive_on_main_thread_js');
|
|
5849
5265
|
PThread.currentProxiedOperationCallerThread = callingThread;
|
|
5850
5266
|
var rtn = func(...proxiedJSCallArgs);
|
|
5851
5267
|
PThread.currentProxiedOperationCallerThread = 0;
|
|
5852
|
-
// Proxied functions can return any type except bigint. All other types
|
|
5853
|
-
// cooerce to f64/double (the return type of this function in C) but not
|
|
5854
|
-
// bigint.
|
|
5855
|
-
assert(typeof rtn != "bigint");
|
|
5856
5268
|
return rtn;
|
|
5857
5269
|
};
|
|
5858
5270
|
|
|
@@ -6056,7 +5468,6 @@ var ASM_CONSTS = {
|
|
|
6056
5468
|
}
|
|
6057
5469
|
|
|
6058
5470
|
|
|
6059
|
-
|
|
6060
5471
|
var __tzset_js = (timezone, daylight, std_name, dst_name) => {
|
|
6061
5472
|
// TODO: Use (malleable) environment variables instead of system settings.
|
|
6062
5473
|
var currentYear = new Date().getFullYear();
|
|
@@ -6096,10 +5507,6 @@ var ASM_CONSTS = {
|
|
|
6096
5507
|
|
|
6097
5508
|
var winterName = extractZone(winterOffset);
|
|
6098
5509
|
var summerName = extractZone(summerOffset);
|
|
6099
|
-
assert(winterName);
|
|
6100
|
-
assert(summerName);
|
|
6101
|
-
assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`);
|
|
6102
|
-
assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`);
|
|
6103
5510
|
if (summerOffset < winterOffset) {
|
|
6104
5511
|
// Northern hemisphere
|
|
6105
5512
|
stringToUTF8(winterName, std_name, 17);
|
|
@@ -6148,7 +5555,6 @@ var ASM_CONSTS = {
|
|
|
6148
5555
|
};
|
|
6149
5556
|
|
|
6150
5557
|
var runtimeKeepalivePop = () => {
|
|
6151
|
-
assert(runtimeKeepaliveCounter > 0);
|
|
6152
5558
|
runtimeKeepaliveCounter -= 1;
|
|
6153
5559
|
};
|
|
6154
5560
|
/** @param {number=} timeout */
|
|
@@ -6160,6 +5566,13 @@ var ASM_CONSTS = {
|
|
|
6160
5566
|
}, timeout);
|
|
6161
5567
|
};
|
|
6162
5568
|
|
|
5569
|
+
var warnOnce = (text) => {
|
|
5570
|
+
warnOnce.shown ||= {};
|
|
5571
|
+
if (!warnOnce.shown[text]) {
|
|
5572
|
+
warnOnce.shown[text] = 1;
|
|
5573
|
+
err(text);
|
|
5574
|
+
}
|
|
5575
|
+
};
|
|
6163
5576
|
|
|
6164
5577
|
|
|
6165
5578
|
var Browser = {
|
|
@@ -6196,10 +5609,8 @@ var ASM_CONSTS = {
|
|
|
6196
5609
|
b = new Blob([(new Uint8Array(byteArray)).buffer], { type: Browser.getMimetype(name) });
|
|
6197
5610
|
}
|
|
6198
5611
|
var url = URL.createObjectURL(b);
|
|
6199
|
-
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
|
|
6200
5612
|
var img = new Image();
|
|
6201
5613
|
img.onload = () => {
|
|
6202
|
-
assert(img.complete, `Image ${name} could not be decoded`);
|
|
6203
5614
|
var canvas = /** @type {!HTMLCanvasElement} */ (document.createElement('canvas'));
|
|
6204
5615
|
canvas.width = img.width;
|
|
6205
5616
|
canvas.height = img.height;
|
|
@@ -6237,7 +5648,6 @@ var ASM_CONSTS = {
|
|
|
6237
5648
|
}
|
|
6238
5649
|
var b = new Blob([byteArray], { type: Browser.getMimetype(name) });
|
|
6239
5650
|
var url = URL.createObjectURL(b); // XXX we never revoke this!
|
|
6240
|
-
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
|
|
6241
5651
|
var audio = new Audio();
|
|
6242
5652
|
audio.addEventListener('canplaythrough', () => finish(audio), false); // use addEventListener due to chromium bug 124926
|
|
6243
5653
|
audio.onerror = function audio_onerror(event) {
|
|
@@ -6354,7 +5764,6 @@ var ASM_CONSTS = {
|
|
|
6354
5764
|
if (!ctx) return null;
|
|
6355
5765
|
|
|
6356
5766
|
if (setInModule) {
|
|
6357
|
-
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');
|
|
6358
5767
|
Module['ctx'] = ctx;
|
|
6359
5768
|
if (useWebGL) GL.makeContextCurrent(contextHandle);
|
|
6360
5769
|
Browser.useWebGL = useWebGL;
|
|
@@ -6424,9 +5833,6 @@ var ASM_CONSTS = {
|
|
|
6424
5833
|
|
|
6425
5834
|
canvasContainer.requestFullscreen();
|
|
6426
5835
|
},
|
|
6427
|
-
requestFullScreen() {
|
|
6428
|
-
abort('Module.requestFullScreen has been replaced by Module.requestFullscreen (without a capital S)');
|
|
6429
|
-
},
|
|
6430
5836
|
exitFullscreen() {
|
|
6431
5837
|
// This is workaround for chrome. Trying to exit from fullscreen
|
|
6432
5838
|
// not in fullscreen state will cause "TypeError: Document not active"
|
|
@@ -6532,9 +5938,6 @@ var ASM_CONSTS = {
|
|
|
6532
5938
|
// (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/)
|
|
6533
5939
|
var scrollX = ((typeof window.scrollX != 'undefined') ? window.scrollX : window.pageXOffset);
|
|
6534
5940
|
var scrollY = ((typeof window.scrollY != 'undefined') ? window.scrollY : window.pageYOffset);
|
|
6535
|
-
// If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset
|
|
6536
|
-
// and we have no viable fallback.
|
|
6537
|
-
assert((typeof scrollX != 'undefined') && (typeof scrollY != 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.');
|
|
6538
5941
|
var adjustedX = pageX - (scrollX + rect.left);
|
|
6539
5942
|
var adjustedY = pageY - (scrollY + rect.top);
|
|
6540
5943
|
|
|
@@ -7426,7 +6829,6 @@ var ASM_CONSTS = {
|
|
|
7426
6829
|
* @param {boolean=} noSetTiming
|
|
7427
6830
|
*/
|
|
7428
6831
|
var setMainLoop = (iterFunc, fps, simulateInfiniteLoop, arg, noSetTiming) => {
|
|
7429
|
-
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.');
|
|
7430
6832
|
MainLoop.func = iterFunc;
|
|
7431
6833
|
MainLoop.arg = arg;
|
|
7432
6834
|
|
|
@@ -7485,11 +6887,6 @@ var ASM_CONSTS = {
|
|
|
7485
6887
|
MainLoop.tickStartTime = _emscripten_get_now();
|
|
7486
6888
|
}
|
|
7487
6889
|
|
|
7488
|
-
if (MainLoop.method === 'timeout' && Module['ctx']) {
|
|
7489
|
-
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!');
|
|
7490
|
-
MainLoop.method = ''; // just warn once per call to set main loop
|
|
7491
|
-
}
|
|
7492
|
-
|
|
7493
6890
|
MainLoop.runIter(iterFunc);
|
|
7494
6891
|
|
|
7495
6892
|
// catch pauses from the main loop itself
|
|
@@ -7575,7 +6972,6 @@ var ASM_CONSTS = {
|
|
|
7575
6972
|
for (var post of MainLoop.postMainLoop) {
|
|
7576
6973
|
post();
|
|
7577
6974
|
}
|
|
7578
|
-
checkStackCookie();
|
|
7579
6975
|
},
|
|
7580
6976
|
nextRAF:0,
|
|
7581
6977
|
fakeRequestAnimationFrame(func) {
|
|
@@ -7606,7 +7002,6 @@ var ASM_CONSTS = {
|
|
|
7606
7002
|
MainLoop.timingValue = value;
|
|
7607
7003
|
|
|
7608
7004
|
if (!MainLoop.func) {
|
|
7609
|
-
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.');
|
|
7610
7005
|
return 1; // Return non-zero on failure, can't set timing mode when there is no main loop.
|
|
7611
7006
|
}
|
|
7612
7007
|
|
|
@@ -7729,20 +7124,11 @@ var ASM_CONSTS = {
|
|
|
7729
7124
|
|
|
7730
7125
|
var readEmAsmArgsArray = [];
|
|
7731
7126
|
var readEmAsmArgs = (sigPtr, buf) => {
|
|
7732
|
-
// Nobody should have mutated _readEmAsmArgsArray underneath us to be something else than an array.
|
|
7733
|
-
assert(Array.isArray(readEmAsmArgsArray));
|
|
7734
|
-
// The input buffer is allocated on the stack, so it must be stack-aligned.
|
|
7735
|
-
assert(buf % 16 == 0);
|
|
7736
7127
|
readEmAsmArgsArray.length = 0;
|
|
7737
7128
|
var ch;
|
|
7738
7129
|
// Most arguments are i32s, so shift the buffer pointer so it is a plain
|
|
7739
7130
|
// index into HEAP32.
|
|
7740
7131
|
while (ch = HEAPU8[sigPtr++]) {
|
|
7741
|
-
var chr = String.fromCharCode(ch);
|
|
7742
|
-
var validChars = ['d', 'f', 'i', 'p'];
|
|
7743
|
-
// In WASM_BIGINT mode we support passing i64 values as bigint.
|
|
7744
|
-
validChars.push('j');
|
|
7745
|
-
assert(validChars.includes(chr), `Invalid character ${ch}("${chr}") in readEmAsmArgs! Use only [${validChars}], and do not specify "v" for void return argument.`);
|
|
7746
7132
|
// Floats are always passed as doubles, so all types except for 'i'
|
|
7747
7133
|
// are 8 bytes and require alignment.
|
|
7748
7134
|
var wide = (ch != 105);
|
|
@@ -7762,7 +7148,6 @@ var ASM_CONSTS = {
|
|
|
7762
7148
|
};
|
|
7763
7149
|
var runEmAsmFunction = (code, sigPtr, argbuf) => {
|
|
7764
7150
|
var args = readEmAsmArgs(sigPtr, argbuf);
|
|
7765
|
-
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.`);
|
|
7766
7151
|
return ASM_CONSTS[code](...args);
|
|
7767
7152
|
};
|
|
7768
7153
|
var _emscripten_asm_const_int = (code, sigPtr, argbuf) => {
|
|
@@ -7784,7 +7169,6 @@ var ASM_CONSTS = {
|
|
|
7784
7169
|
// code paths as similar as possible on both sides.)
|
|
7785
7170
|
return proxyToMainThread(0, emAsmAddr, sync, ...args);
|
|
7786
7171
|
}
|
|
7787
|
-
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.`);
|
|
7788
7172
|
return ASM_CONSTS[emAsmAddr](...args);
|
|
7789
7173
|
};
|
|
7790
7174
|
var _emscripten_asm_const_int_sync_on_main_thread = (emAsmAddr, sigPtr, argbuf) => runMainThreadEmAsm(emAsmAddr, sigPtr, argbuf, 1);
|
|
@@ -7798,11 +7182,6 @@ var ASM_CONSTS = {
|
|
|
7798
7182
|
|
|
7799
7183
|
|
|
7800
7184
|
var _emscripten_check_blocking_allowed = () => {
|
|
7801
|
-
|
|
7802
|
-
if (ENVIRONMENT_IS_WORKER) return; // Blocking in a worker/pthread is fine.
|
|
7803
|
-
|
|
7804
|
-
warnOnce('Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread');
|
|
7805
|
-
|
|
7806
7185
|
};
|
|
7807
7186
|
|
|
7808
7187
|
|
|
@@ -7885,8 +7264,6 @@ var ASM_CONSTS = {
|
|
|
7885
7264
|
},
|
|
7886
7265
|
registerOrRemoveHandler(eventHandler) {
|
|
7887
7266
|
if (!eventHandler.target) {
|
|
7888
|
-
err('registerOrRemoveHandler: the target element for event handler registration does not exist, when processing the following event handler registration:');
|
|
7889
|
-
console.dir(eventHandler);
|
|
7890
7267
|
return -4;
|
|
7891
7268
|
}
|
|
7892
7269
|
if (eventHandler.callbackfunc) {
|
|
@@ -8315,12 +7692,10 @@ var ASM_CONSTS = {
|
|
|
8315
7692
|
|
|
8316
7693
|
|
|
8317
7694
|
|
|
8318
|
-
|
|
8319
7695
|
function _emscripten_force_exit(status) {
|
|
8320
7696
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8321
7697
|
return proxyToMainThread(42, 0, 1, status);
|
|
8322
7698
|
|
|
8323
|
-
warnOnce('emscripten_force_exit cannot actually shut down the runtime, as the build does not have EXIT_RUNTIME set');
|
|
8324
7699
|
__emscripten_runtime_keepalive_clear();
|
|
8325
7700
|
_exit(status);
|
|
8326
7701
|
|
|
@@ -8392,7 +7767,6 @@ var ASM_CONSTS = {
|
|
|
8392
7767
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8393
7768
|
return proxyToMainThread(45, 0, 1, index, gamepadState);
|
|
8394
7769
|
|
|
8395
|
-
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!';
|
|
8396
7770
|
// INVALID_PARAM is returned on a Gamepad index that never was there.
|
|
8397
7771
|
if (index < 0 || index >= JSEvents.lastGamepadState.length) return -5;
|
|
8398
7772
|
|
|
@@ -8420,7 +7794,6 @@ var ASM_CONSTS = {
|
|
|
8420
7794
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8421
7795
|
return proxyToMainThread(46, 0, 1);
|
|
8422
7796
|
|
|
8423
|
-
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!';
|
|
8424
7797
|
// N.B. Do not call emscripten_get_num_gamepads() unless having first called emscripten_sample_gamepad_data(), and that has returned EMSCRIPTEN_RESULT_SUCCESS.
|
|
8425
7798
|
// Otherwise the following line will throw an exception.
|
|
8426
7799
|
return JSEvents.lastGamepadState.length;
|
|
@@ -9340,17 +8713,10 @@ var ASM_CONSTS = {
|
|
|
9340
8713
|
GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name));
|
|
9341
8714
|
var _emscripten_glGetAttribLocation = _glGetAttribLocation;
|
|
9342
8715
|
|
|
9343
|
-
|
|
9344
|
-
var readI53FromU64 = (ptr) => {
|
|
9345
|
-
return HEAPU32[((ptr)>>2)] + HEAPU32[(((ptr)+(4))>>2)] * 4294967296;
|
|
9346
|
-
};
|
|
9347
8716
|
var writeI53ToI64 = (ptr, num) => {
|
|
9348
8717
|
HEAPU32[((ptr)>>2)] = num;
|
|
9349
8718
|
var lower = HEAPU32[((ptr)>>2)];
|
|
9350
8719
|
HEAPU32[(((ptr)+(4))>>2)] = (num - lower)/4294967296;
|
|
9351
|
-
var deserialized = (num >= 0) ? readI53FromU64(ptr) : readI53FromI64(ptr);
|
|
9352
|
-
var offset = ((ptr)>>2);
|
|
9353
|
-
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!`);
|
|
9354
8720
|
};
|
|
9355
8721
|
|
|
9356
8722
|
|
|
@@ -11264,7 +10630,7 @@ var ASM_CONSTS = {
|
|
|
11264
10630
|
|
|
11265
10631
|
|
|
11266
10632
|
var abortOnCannotGrowMemory = (requestedSize) => {
|
|
11267
|
-
abort(
|
|
10633
|
+
abort('OOM');
|
|
11268
10634
|
};
|
|
11269
10635
|
var _emscripten_resize_heap = (requestedSize) => {
|
|
11270
10636
|
var oldSize = HEAPU8.length;
|
|
@@ -11286,7 +10652,6 @@ var ASM_CONSTS = {
|
|
|
11286
10652
|
if (navigator.getGamepads) return (JSEvents.lastGamepadState = navigator.getGamepads())
|
|
11287
10653
|
? 0 : -1;
|
|
11288
10654
|
} catch(e) {
|
|
11289
|
-
err(`navigator.getGamepads() exists, but failed to execute with exception ${e}. Disabling Gamepad access.`);
|
|
11290
10655
|
navigator.getGamepads = null; // Disable getGamepads() so that it won't be attempted to be used again.
|
|
11291
10656
|
}
|
|
11292
10657
|
return -1;
|
|
@@ -11537,7 +10902,6 @@ var ASM_CONSTS = {
|
|
|
11537
10902
|
JSEvents.keyEvent ||= _malloc(160);
|
|
11538
10903
|
|
|
11539
10904
|
var keyEventHandlerFunc = (e) => {
|
|
11540
|
-
assert(e);
|
|
11541
10905
|
|
|
11542
10906
|
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.
|
|
11543
10907
|
HEAPF64[((keyEventData)>>3)] = e.timeStamp;
|
|
@@ -11610,7 +10974,6 @@ var ASM_CONSTS = {
|
|
|
11610
10974
|
|
|
11611
10975
|
|
|
11612
10976
|
var fillMouseEventData = (eventStruct, e, target) => {
|
|
11613
|
-
assert(eventStruct % 4 == 0);
|
|
11614
10977
|
HEAPF64[((eventStruct)>>3)] = e.timeStamp;
|
|
11615
10978
|
var idx = ((eventStruct)>>2);
|
|
11616
10979
|
HEAP32[idx + 2] = e.screenX;
|
|
@@ -11839,7 +11202,6 @@ var ASM_CONSTS = {
|
|
|
11839
11202
|
target = findEventTarget(target);
|
|
11840
11203
|
|
|
11841
11204
|
var touchEventHandlerFunc = (e) => {
|
|
11842
|
-
assert(e);
|
|
11843
11205
|
var t, touches = {}, et = e.touches;
|
|
11844
11206
|
// To ease marshalling different kinds of touches that browser reports (all touches are listed in e.touches,
|
|
11845
11207
|
// only changed touches in e.changedTouches, and touches on target at a.targetTouches), mark a boolean in
|
|
@@ -12095,7 +11457,6 @@ var ASM_CONSTS = {
|
|
|
12095
11457
|
|
|
12096
11458
|
var stringToAscii = (str, buffer) => {
|
|
12097
11459
|
for (var i = 0; i < str.length; ++i) {
|
|
12098
|
-
assert(str.charCodeAt(i) === (str.charCodeAt(i) & 0xff));
|
|
12099
11460
|
HEAP8[buffer++] = str.charCodeAt(i);
|
|
12100
11461
|
}
|
|
12101
11462
|
// Null-terminate the string
|
|
@@ -12304,7 +11665,6 @@ var ASM_CONSTS = {
|
|
|
12304
11665
|
};
|
|
12305
11666
|
|
|
12306
11667
|
var dynCall = (sig, ptr, args = []) => {
|
|
12307
|
-
assert(getWasmTableEntry(ptr), `missing table entry in dynCall: ${ptr}`);
|
|
12308
11668
|
var rtn = getWasmTableEntry(ptr)(...args);
|
|
12309
11669
|
return rtn;
|
|
12310
11670
|
};
|
|
@@ -12315,13 +11675,11 @@ var ASM_CONSTS = {
|
|
|
12315
11675
|
|
|
12316
11676
|
var getCFunc = (ident) => {
|
|
12317
11677
|
var func = Module['_' + ident]; // closure exported function
|
|
12318
|
-
assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported');
|
|
12319
11678
|
return func;
|
|
12320
11679
|
};
|
|
12321
11680
|
|
|
12322
11681
|
|
|
12323
11682
|
var writeArrayToMemory = (array, buffer) => {
|
|
12324
|
-
assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
|
|
12325
11683
|
HEAP8.set(array, buffer);
|
|
12326
11684
|
};
|
|
12327
11685
|
|
|
@@ -12364,7 +11722,6 @@ var ASM_CONSTS = {
|
|
|
12364
11722
|
var func = getCFunc(ident);
|
|
12365
11723
|
var cArgs = [];
|
|
12366
11724
|
var stack = 0;
|
|
12367
|
-
assert(returnType !== 'array', 'Return type should not be "array".');
|
|
12368
11725
|
if (args) {
|
|
12369
11726
|
for (var i = 0; i < args.length; i++) {
|
|
12370
11727
|
var converter = toC[argTypes[i]];
|
|
@@ -12392,11 +11749,17 @@ var ASM_CONSTS = {
|
|
|
12392
11749
|
* @param {Object=} opts
|
|
12393
11750
|
*/
|
|
12394
11751
|
var cwrap = (ident, returnType, argTypes, opts) => {
|
|
11752
|
+
// When the function takes numbers and returns a number, we can just return
|
|
11753
|
+
// the original function
|
|
11754
|
+
var numericArgs = !argTypes || argTypes.every((type) => type === 'number' || type === 'boolean');
|
|
11755
|
+
var numericRet = returnType !== 'string';
|
|
11756
|
+
if (numericRet && numericArgs && !opts) {
|
|
11757
|
+
return getCFunc(ident);
|
|
11758
|
+
}
|
|
12395
11759
|
return (...args) => ccall(ident, returnType, argTypes, args, opts);
|
|
12396
11760
|
};
|
|
12397
11761
|
|
|
12398
11762
|
var uleb128Encode = (n, target) => {
|
|
12399
|
-
assert(n < 16384);
|
|
12400
11763
|
if (n < 128) {
|
|
12401
11764
|
target.push(n);
|
|
12402
11765
|
} else {
|
|
@@ -12418,7 +11781,6 @@ var ASM_CONSTS = {
|
|
|
12418
11781
|
results: sig[0] == 'v' ? [] : [typeNames[sig[0]]]
|
|
12419
11782
|
};
|
|
12420
11783
|
for (var i = 1; i < sig.length; ++i) {
|
|
12421
|
-
assert(sig[i] in typeNames, 'invalid signature char: ' + sig[i]);
|
|
12422
11784
|
type.parameters.push(typeNames[sig[i]]);
|
|
12423
11785
|
}
|
|
12424
11786
|
return type;
|
|
@@ -12440,7 +11802,6 @@ var ASM_CONSTS = {
|
|
|
12440
11802
|
target.push(0x60 /* form: func */);
|
|
12441
11803
|
uleb128Encode(sigParam.length, target);
|
|
12442
11804
|
for (var i = 0; i < sigParam.length; ++i) {
|
|
12443
|
-
assert(sigParam[i] in typeCodes, 'invalid signature char: ' + sigParam[i]);
|
|
12444
11805
|
target.push(typeCodes[sigParam[i]]);
|
|
12445
11806
|
}
|
|
12446
11807
|
|
|
@@ -12556,7 +11917,6 @@ var ASM_CONSTS = {
|
|
|
12556
11917
|
|
|
12557
11918
|
/** @param {string=} sig */
|
|
12558
11919
|
var addFunction = (func, sig) => {
|
|
12559
|
-
assert(typeof func != 'undefined');
|
|
12560
11920
|
// Check if the function is already in the table, to ensure each function
|
|
12561
11921
|
// gets a unique index.
|
|
12562
11922
|
var rtn = getFunctionAddress(func);
|
|
@@ -12576,7 +11936,6 @@ var ASM_CONSTS = {
|
|
|
12576
11936
|
if (!(err instanceof TypeError)) {
|
|
12577
11937
|
throw err;
|
|
12578
11938
|
}
|
|
12579
|
-
assert(typeof sig != 'undefined', 'Missing signature argument to addFunction: ' + func);
|
|
12580
11939
|
var wrapped = convertJsFunctionToWasm(func, sig);
|
|
12581
11940
|
setWasmTableEntry(ret, wrapped);
|
|
12582
11941
|
}
|
|
@@ -12602,9 +11961,15 @@ PThread.init();;
|
|
|
12602
11961
|
// Set module methods based on EXPORTED_RUNTIME_METHODS
|
|
12603
11962
|
;
|
|
12604
11963
|
|
|
11964
|
+
// This error may happen quite a bit. To avoid overhead we reuse it (and
|
|
11965
|
+
// suffer a lack of stack info).
|
|
11966
|
+
MEMFS.doesNotExistError = new FS.ErrnoError(44);
|
|
11967
|
+
/** @suppress {checkTypes} */
|
|
11968
|
+
MEMFS.doesNotExistError.stack = '<generic error, no stack>';
|
|
11969
|
+
;
|
|
11970
|
+
|
|
12605
11971
|
// exports
|
|
12606
11972
|
Module['requestFullscreen'] = Browser.requestFullscreen;
|
|
12607
|
-
Module['requestFullScreen'] = Browser.requestFullScreen;
|
|
12608
11973
|
Module['setCanvasSize'] = Browser.setCanvasSize;
|
|
12609
11974
|
Module['getUserMedia'] = Browser.getUserMedia;
|
|
12610
11975
|
Module['createContext'] = Browser.createContext;
|
|
@@ -12705,9 +12070,6 @@ var proxiedFunctionTable = [
|
|
|
12705
12070
|
_fd_write
|
|
12706
12071
|
];
|
|
12707
12072
|
|
|
12708
|
-
function checkIncomingModuleAPI() {
|
|
12709
|
-
ignoredModuleProp('fetchSettings');
|
|
12710
|
-
}
|
|
12711
12073
|
var wasmImports;
|
|
12712
12074
|
function assignWasmImports() {
|
|
12713
12075
|
wasmImports = {
|
|
@@ -13508,73 +12870,67 @@ function assignWasmImports() {
|
|
|
13508
12870
|
};
|
|
13509
12871
|
}
|
|
13510
12872
|
var wasmExports = await createWasm();
|
|
13511
|
-
var ___wasm_call_ctors =
|
|
13512
|
-
var _screenshot = Module['_screenshot'] =
|
|
13513
|
-
var _buttonPress = Module['_buttonPress'] =
|
|
13514
|
-
var _buttonUnpress = Module['_buttonUnpress'] =
|
|
13515
|
-
var _toggleRewind = Module['_toggleRewind'] =
|
|
13516
|
-
var _setVolume = Module['_setVolume'] =
|
|
13517
|
-
var _getVolume = Module['_getVolume'] =
|
|
13518
|
-
var _getMainLoopTimingMode = Module['_getMainLoopTimingMode'] =
|
|
13519
|
-
var _getMainLoopTimingValue = Module['_getMainLoopTimingValue'] =
|
|
13520
|
-
var _setMainLoopTiming = Module['_setMainLoopTiming'] =
|
|
13521
|
-
var _setFastForwardMultiplier = Module['_setFastForwardMultiplier'] =
|
|
13522
|
-
var _getFastForwardMultiplier = Module['_getFastForwardMultiplier'] =
|
|
13523
|
-
var _quitGame = Module['_quitGame'] =
|
|
13524
|
-
var _free =
|
|
13525
|
-
var _quitMgba = Module['_quitMgba'] =
|
|
13526
|
-
var _quickReload = Module['_quickReload'] =
|
|
13527
|
-
var _pauseGame = Module['_pauseGame'] =
|
|
13528
|
-
var _resumeGame = Module['_resumeGame'] =
|
|
13529
|
-
var _setEventEnable = Module['_setEventEnable'] =
|
|
13530
|
-
var _bindKey = Module['_bindKey'] =
|
|
13531
|
-
var _saveState = Module['_saveState'] =
|
|
13532
|
-
var _loadState = Module['_loadState'] =
|
|
13533
|
-
var _autoLoadCheats = Module['_autoLoadCheats'] =
|
|
13534
|
-
var _loadGame = Module['_loadGame'] =
|
|
13535
|
-
var _saveStateSlot = Module['_saveStateSlot'] =
|
|
13536
|
-
var _loadStateSlot = Module['_loadStateSlot'] =
|
|
13537
|
-
var _addCoreCallbacks = Module['_addCoreCallbacks'] =
|
|
13538
|
-
var _setIntegerCoreSetting = Module['_setIntegerCoreSetting'] =
|
|
13539
|
-
var _setupConstants = Module['_setupConstants'] =
|
|
13540
|
-
var _main = Module['_main'] =
|
|
13541
|
-
var _malloc =
|
|
13542
|
-
var _strerror = createExportWrapper('strerror', 1);
|
|
13543
|
-
var _fflush = createExportWrapper('fflush', 1);
|
|
12873
|
+
var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])();
|
|
12874
|
+
var _screenshot = Module['_screenshot'] = (a0) => (_screenshot = Module['_screenshot'] = wasmExports['screenshot'])(a0);
|
|
12875
|
+
var _buttonPress = Module['_buttonPress'] = (a0) => (_buttonPress = Module['_buttonPress'] = wasmExports['buttonPress'])(a0);
|
|
12876
|
+
var _buttonUnpress = Module['_buttonUnpress'] = (a0) => (_buttonUnpress = Module['_buttonUnpress'] = wasmExports['buttonUnpress'])(a0);
|
|
12877
|
+
var _toggleRewind = Module['_toggleRewind'] = (a0) => (_toggleRewind = Module['_toggleRewind'] = wasmExports['toggleRewind'])(a0);
|
|
12878
|
+
var _setVolume = Module['_setVolume'] = (a0) => (_setVolume = Module['_setVolume'] = wasmExports['setVolume'])(a0);
|
|
12879
|
+
var _getVolume = Module['_getVolume'] = () => (_getVolume = Module['_getVolume'] = wasmExports['getVolume'])();
|
|
12880
|
+
var _getMainLoopTimingMode = Module['_getMainLoopTimingMode'] = () => (_getMainLoopTimingMode = Module['_getMainLoopTimingMode'] = wasmExports['getMainLoopTimingMode'])();
|
|
12881
|
+
var _getMainLoopTimingValue = Module['_getMainLoopTimingValue'] = () => (_getMainLoopTimingValue = Module['_getMainLoopTimingValue'] = wasmExports['getMainLoopTimingValue'])();
|
|
12882
|
+
var _setMainLoopTiming = Module['_setMainLoopTiming'] = (a0, a1) => (_setMainLoopTiming = Module['_setMainLoopTiming'] = wasmExports['setMainLoopTiming'])(a0, a1);
|
|
12883
|
+
var _setFastForwardMultiplier = Module['_setFastForwardMultiplier'] = (a0) => (_setFastForwardMultiplier = Module['_setFastForwardMultiplier'] = wasmExports['setFastForwardMultiplier'])(a0);
|
|
12884
|
+
var _getFastForwardMultiplier = Module['_getFastForwardMultiplier'] = () => (_getFastForwardMultiplier = Module['_getFastForwardMultiplier'] = wasmExports['getFastForwardMultiplier'])();
|
|
12885
|
+
var _quitGame = Module['_quitGame'] = () => (_quitGame = Module['_quitGame'] = wasmExports['quitGame'])();
|
|
12886
|
+
var _free = (a0) => (_free = wasmExports['free'])(a0);
|
|
12887
|
+
var _quitMgba = Module['_quitMgba'] = () => (_quitMgba = Module['_quitMgba'] = wasmExports['quitMgba'])();
|
|
12888
|
+
var _quickReload = Module['_quickReload'] = () => (_quickReload = Module['_quickReload'] = wasmExports['quickReload'])();
|
|
12889
|
+
var _pauseGame = Module['_pauseGame'] = () => (_pauseGame = Module['_pauseGame'] = wasmExports['pauseGame'])();
|
|
12890
|
+
var _resumeGame = Module['_resumeGame'] = () => (_resumeGame = Module['_resumeGame'] = wasmExports['resumeGame'])();
|
|
12891
|
+
var _setEventEnable = Module['_setEventEnable'] = (a0) => (_setEventEnable = Module['_setEventEnable'] = wasmExports['setEventEnable'])(a0);
|
|
12892
|
+
var _bindKey = Module['_bindKey'] = (a0, a1) => (_bindKey = Module['_bindKey'] = wasmExports['bindKey'])(a0, a1);
|
|
12893
|
+
var _saveState = Module['_saveState'] = (a0) => (_saveState = Module['_saveState'] = wasmExports['saveState'])(a0);
|
|
12894
|
+
var _loadState = Module['_loadState'] = (a0) => (_loadState = Module['_loadState'] = wasmExports['loadState'])(a0);
|
|
12895
|
+
var _autoLoadCheats = Module['_autoLoadCheats'] = () => (_autoLoadCheats = Module['_autoLoadCheats'] = wasmExports['autoLoadCheats'])();
|
|
12896
|
+
var _loadGame = Module['_loadGame'] = (a0, a1) => (_loadGame = Module['_loadGame'] = wasmExports['loadGame'])(a0, a1);
|
|
12897
|
+
var _saveStateSlot = Module['_saveStateSlot'] = (a0, a1) => (_saveStateSlot = Module['_saveStateSlot'] = wasmExports['saveStateSlot'])(a0, a1);
|
|
12898
|
+
var _loadStateSlot = Module['_loadStateSlot'] = (a0, a1) => (_loadStateSlot = Module['_loadStateSlot'] = wasmExports['loadStateSlot'])(a0, a1);
|
|
12899
|
+
var _addCoreCallbacks = Module['_addCoreCallbacks'] = (a0, a1, a2, a3, a4, a5) => (_addCoreCallbacks = Module['_addCoreCallbacks'] = wasmExports['addCoreCallbacks'])(a0, a1, a2, a3, a4, a5);
|
|
12900
|
+
var _setIntegerCoreSetting = Module['_setIntegerCoreSetting'] = (a0, a1) => (_setIntegerCoreSetting = Module['_setIntegerCoreSetting'] = wasmExports['setIntegerCoreSetting'])(a0, a1);
|
|
12901
|
+
var _setupConstants = Module['_setupConstants'] = () => (_setupConstants = Module['_setupConstants'] = wasmExports['setupConstants'])();
|
|
12902
|
+
var _main = Module['_main'] = (a0, a1) => (_main = Module['_main'] = wasmExports['main'])(a0, a1);
|
|
12903
|
+
var _malloc = (a0) => (_malloc = wasmExports['malloc'])(a0);
|
|
13544
12904
|
var _pthread_self = () => (_pthread_self = wasmExports['pthread_self'])();
|
|
13545
|
-
var __emscripten_tls_init =
|
|
13546
|
-
var _emscripten_builtin_memalign =
|
|
13547
|
-
var __emscripten_run_callback_on_thread =
|
|
13548
|
-
var __emscripten_thread_init =
|
|
13549
|
-
var __emscripten_thread_crashed =
|
|
13550
|
-
var
|
|
13551
|
-
var
|
|
13552
|
-
var
|
|
13553
|
-
var
|
|
13554
|
-
var
|
|
13555
|
-
var __emscripten_check_mailbox = createExportWrapper('_emscripten_check_mailbox', 0);
|
|
13556
|
-
var _setThrew = createExportWrapper('setThrew', 2);
|
|
13557
|
-
var _emscripten_stack_init = () => (_emscripten_stack_init = wasmExports['emscripten_stack_init'])();
|
|
12905
|
+
var __emscripten_tls_init = () => (__emscripten_tls_init = wasmExports['_emscripten_tls_init'])();
|
|
12906
|
+
var _emscripten_builtin_memalign = (a0, a1) => (_emscripten_builtin_memalign = wasmExports['emscripten_builtin_memalign'])(a0, a1);
|
|
12907
|
+
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);
|
|
12908
|
+
var __emscripten_thread_init = (a0, a1, a2, a3, a4, a5) => (__emscripten_thread_init = wasmExports['_emscripten_thread_init'])(a0, a1, a2, a3, a4, a5);
|
|
12909
|
+
var __emscripten_thread_crashed = () => (__emscripten_thread_crashed = wasmExports['_emscripten_thread_crashed'])();
|
|
12910
|
+
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);
|
|
12911
|
+
var __emscripten_thread_free_data = (a0) => (__emscripten_thread_free_data = wasmExports['_emscripten_thread_free_data'])(a0);
|
|
12912
|
+
var __emscripten_thread_exit = (a0) => (__emscripten_thread_exit = wasmExports['_emscripten_thread_exit'])(a0);
|
|
12913
|
+
var __emscripten_check_mailbox = () => (__emscripten_check_mailbox = wasmExports['_emscripten_check_mailbox'])();
|
|
12914
|
+
var _setThrew = (a0, a1) => (_setThrew = wasmExports['setThrew'])(a0, a1);
|
|
13558
12915
|
var _emscripten_stack_set_limits = (a0, a1) => (_emscripten_stack_set_limits = wasmExports['emscripten_stack_set_limits'])(a0, a1);
|
|
13559
|
-
var _emscripten_stack_get_free = () => (_emscripten_stack_get_free = wasmExports['emscripten_stack_get_free'])();
|
|
13560
12916
|
var __emscripten_stack_restore = (a0) => (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])(a0);
|
|
13561
12917
|
var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0);
|
|
13562
12918
|
var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
|
|
13563
|
-
var _GBAInputInfo = Module['_GBAInputInfo'] =
|
|
13564
|
-
var _binaryName = Module['_binaryName'] =
|
|
13565
|
-
var _projectName = Module['_projectName'] =
|
|
13566
|
-
var _projectVersion = Module['_projectVersion'] =
|
|
13567
|
-
var _gitCommit = Module['_gitCommit'] =
|
|
13568
|
-
var _gitCommitShort = Module['_gitCommitShort'] =
|
|
13569
|
-
var _gitBranch = Module['_gitBranch'] =
|
|
13570
|
-
var _gitRevision = Module['_gitRevision'] =
|
|
13571
|
-
var _GBIORegisterNames = Module['_GBIORegisterNames'] =
|
|
13572
|
-
var _GBSavestateMagic = Module['_GBSavestateMagic'] =
|
|
13573
|
-
var _GBSavestateVersion = Module['_GBSavestateVersion'] =
|
|
13574
|
-
var _GBA_LUX_LEVELS = Module['_GBA_LUX_LEVELS'] =
|
|
13575
|
-
var _GBAVideoObjSizes = Module['_GBAVideoObjSizes'] =
|
|
13576
|
-
var _GBASavestateMagic = Module['_GBASavestateMagic'] =
|
|
13577
|
-
var _GBASavestateVersion = Module['_GBASavestateVersion'] =
|
|
12919
|
+
var _GBAInputInfo = Module['_GBAInputInfo'] = 122320;
|
|
12920
|
+
var _binaryName = Module['_binaryName'] = 198352;
|
|
12921
|
+
var _projectName = Module['_projectName'] = 198356;
|
|
12922
|
+
var _projectVersion = Module['_projectVersion'] = 198360;
|
|
12923
|
+
var _gitCommit = Module['_gitCommit'] = 198336;
|
|
12924
|
+
var _gitCommitShort = Module['_gitCommitShort'] = 198340;
|
|
12925
|
+
var _gitBranch = Module['_gitBranch'] = 198344;
|
|
12926
|
+
var _gitRevision = Module['_gitRevision'] = 198348;
|
|
12927
|
+
var _GBIORegisterNames = Module['_GBIORegisterNames'] = 60688;
|
|
12928
|
+
var _GBSavestateMagic = Module['_GBSavestateMagic'] = 75952;
|
|
12929
|
+
var _GBSavestateVersion = Module['_GBSavestateVersion'] = 75956;
|
|
12930
|
+
var _GBA_LUX_LEVELS = Module['_GBA_LUX_LEVELS'] = 105424;
|
|
12931
|
+
var _GBAVideoObjSizes = Module['_GBAVideoObjSizes'] = 149760;
|
|
12932
|
+
var _GBASavestateMagic = Module['_GBASavestateMagic'] = 149536;
|
|
12933
|
+
var _GBASavestateVersion = Module['_GBASavestateVersion'] = 149540;
|
|
13578
12934
|
function invoke_iiiii(index,a1,a2,a3,a4) {
|
|
13579
12935
|
var sp = stackSave();
|
|
13580
12936
|
try {
|
|
@@ -13693,316 +13049,9 @@ Module['cwrap'] = cwrap;
|
|
|
13693
13049
|
Module['addFunction'] = addFunction;
|
|
13694
13050
|
Module['removeFunction'] = removeFunction;
|
|
13695
13051
|
Module['FS'] = FS;
|
|
13696
|
-
var missingLibrarySymbols = [
|
|
13697
|
-
'writeI53ToI64Clamped',
|
|
13698
|
-
'writeI53ToI64Signaling',
|
|
13699
|
-
'writeI53ToU64Clamped',
|
|
13700
|
-
'writeI53ToU64Signaling',
|
|
13701
|
-
'convertI32PairToI53',
|
|
13702
|
-
'convertI32PairToI53Checked',
|
|
13703
|
-
'convertU32PairToI53',
|
|
13704
|
-
'getTempRet0',
|
|
13705
|
-
'setTempRet0',
|
|
13706
|
-
'growMemory',
|
|
13707
|
-
'inetPton4',
|
|
13708
|
-
'inetNtop4',
|
|
13709
|
-
'inetPton6',
|
|
13710
|
-
'inetNtop6',
|
|
13711
|
-
'readSockaddr',
|
|
13712
|
-
'writeSockaddr',
|
|
13713
|
-
'emscriptenLog',
|
|
13714
|
-
'getDynCaller',
|
|
13715
|
-
'asmjsMangle',
|
|
13716
|
-
'HandleAllocator',
|
|
13717
|
-
'getNativeTypeSize',
|
|
13718
|
-
'addOnInit',
|
|
13719
|
-
'addOnPostCtor',
|
|
13720
|
-
'addOnPreMain',
|
|
13721
|
-
'STACK_SIZE',
|
|
13722
|
-
'STACK_ALIGN',
|
|
13723
|
-
'POINTER_SIZE',
|
|
13724
|
-
'ASSERTIONS',
|
|
13725
|
-
'reallyNegative',
|
|
13726
|
-
'unSign',
|
|
13727
|
-
'strLen',
|
|
13728
|
-
'reSign',
|
|
13729
|
-
'formatString',
|
|
13730
|
-
'intArrayToString',
|
|
13731
|
-
'AsciiToString',
|
|
13732
|
-
'UTF16ToString',
|
|
13733
|
-
'stringToUTF16',
|
|
13734
|
-
'lengthBytesUTF16',
|
|
13735
|
-
'UTF32ToString',
|
|
13736
|
-
'stringToUTF32',
|
|
13737
|
-
'lengthBytesUTF32',
|
|
13738
|
-
'fillDeviceOrientationEventData',
|
|
13739
|
-
'registerDeviceOrientationEventCallback',
|
|
13740
|
-
'fillDeviceMotionEventData',
|
|
13741
|
-
'registerDeviceMotionEventCallback',
|
|
13742
|
-
'screenOrientation',
|
|
13743
|
-
'fillOrientationChangeEventData',
|
|
13744
|
-
'registerOrientationChangeEventCallback',
|
|
13745
|
-
'hideEverythingExceptGivenElement',
|
|
13746
|
-
'restoreHiddenElements',
|
|
13747
|
-
'softFullscreenResizeWebGLRenderTarget',
|
|
13748
|
-
'registerPointerlockErrorEventCallback',
|
|
13749
|
-
'fillBatteryEventData',
|
|
13750
|
-
'battery',
|
|
13751
|
-
'registerBatteryEventCallback',
|
|
13752
|
-
'jsStackTrace',
|
|
13753
|
-
'getCallstack',
|
|
13754
|
-
'convertPCtoSourceLocation',
|
|
13755
|
-
'wasiRightsToMuslOFlags',
|
|
13756
|
-
'wasiOFlagsToMuslOFlags',
|
|
13757
|
-
'setImmediateWrapped',
|
|
13758
|
-
'safeRequestAnimationFrame',
|
|
13759
|
-
'clearImmediateWrapped',
|
|
13760
|
-
'registerPostMainLoop',
|
|
13761
|
-
'registerPreMainLoop',
|
|
13762
|
-
'getPromise',
|
|
13763
|
-
'makePromise',
|
|
13764
|
-
'idsToPromises',
|
|
13765
|
-
'makePromiseCallback',
|
|
13766
|
-
'ExceptionInfo',
|
|
13767
|
-
'findMatchingCatch',
|
|
13768
|
-
'Browser_asyncPrepareDataCounter',
|
|
13769
|
-
'arraySum',
|
|
13770
|
-
'addDays',
|
|
13771
|
-
'getSocketFromFD',
|
|
13772
|
-
'getSocketAddress',
|
|
13773
|
-
'FS_unlink',
|
|
13774
|
-
'FS_mkdirTree',
|
|
13775
|
-
'_setNetworkCallback',
|
|
13776
|
-
'writeGLArray',
|
|
13777
|
-
'emscripten_webgl_destroy_context_before_on_calling_thread',
|
|
13778
|
-
'registerWebGlEventCallback',
|
|
13779
|
-
'runAndAbortIfError',
|
|
13780
|
-
'ALLOC_NORMAL',
|
|
13781
|
-
'ALLOC_STACK',
|
|
13782
|
-
'allocate',
|
|
13783
|
-
'writeStringToMemory',
|
|
13784
|
-
'writeAsciiToMemory',
|
|
13785
|
-
'setErrNo',
|
|
13786
|
-
'demangle',
|
|
13787
|
-
'stackTrace',
|
|
13788
|
-
];
|
|
13789
|
-
missingLibrarySymbols.forEach(missingLibrarySymbol)
|
|
13790
|
-
|
|
13791
|
-
var unexportedSymbols = [
|
|
13792
|
-
'run',
|
|
13793
|
-
'addRunDependency',
|
|
13794
|
-
'removeRunDependency',
|
|
13795
|
-
'out',
|
|
13796
|
-
'err',
|
|
13797
|
-
'callMain',
|
|
13798
|
-
'abort',
|
|
13799
|
-
'wasmMemory',
|
|
13800
|
-
'wasmExports',
|
|
13801
|
-
'writeStackCookie',
|
|
13802
|
-
'checkStackCookie',
|
|
13803
|
-
'writeI53ToI64',
|
|
13804
|
-
'readI53FromI64',
|
|
13805
|
-
'readI53FromU64',
|
|
13806
|
-
'INT53_MAX',
|
|
13807
|
-
'INT53_MIN',
|
|
13808
|
-
'bigintToI53Checked',
|
|
13809
|
-
'stackSave',
|
|
13810
|
-
'stackRestore',
|
|
13811
|
-
'stackAlloc',
|
|
13812
|
-
'ptrToString',
|
|
13813
|
-
'zeroMemory',
|
|
13814
|
-
'exitJS',
|
|
13815
|
-
'getHeapMax',
|
|
13816
|
-
'abortOnCannotGrowMemory',
|
|
13817
|
-
'ENV',
|
|
13818
|
-
'ERRNO_CODES',
|
|
13819
|
-
'strError',
|
|
13820
|
-
'DNS',
|
|
13821
|
-
'Protocols',
|
|
13822
|
-
'Sockets',
|
|
13823
|
-
'timers',
|
|
13824
|
-
'warnOnce',
|
|
13825
|
-
'readEmAsmArgsArray',
|
|
13826
|
-
'readEmAsmArgs',
|
|
13827
|
-
'runEmAsmFunction',
|
|
13828
|
-
'runMainThreadEmAsm',
|
|
13829
|
-
'jstoi_q',
|
|
13830
|
-
'jstoi_s',
|
|
13831
|
-
'getExecutableName',
|
|
13832
|
-
'listenOnce',
|
|
13833
|
-
'autoResumeAudioContext',
|
|
13834
|
-
'dynCall',
|
|
13835
|
-
'handleException',
|
|
13836
|
-
'keepRuntimeAlive',
|
|
13837
|
-
'runtimeKeepalivePush',
|
|
13838
|
-
'runtimeKeepalivePop',
|
|
13839
|
-
'callUserCallback',
|
|
13840
|
-
'maybeExit',
|
|
13841
|
-
'asyncLoad',
|
|
13842
|
-
'alignMemory',
|
|
13843
|
-
'mmapAlloc',
|
|
13844
|
-
'wasmTable',
|
|
13845
|
-
'noExitRuntime',
|
|
13846
|
-
'addOnPreRun',
|
|
13847
|
-
'addOnExit',
|
|
13848
|
-
'addOnPostRun',
|
|
13849
|
-
'getCFunc',
|
|
13850
|
-
'ccall',
|
|
13851
|
-
'uleb128Encode',
|
|
13852
|
-
'sigToWasmTypes',
|
|
13853
|
-
'generateFuncType',
|
|
13854
|
-
'convertJsFunctionToWasm',
|
|
13855
|
-
'freeTableIndexes',
|
|
13856
|
-
'functionsInTableMap',
|
|
13857
|
-
'getEmptyTableSlot',
|
|
13858
|
-
'updateTableMap',
|
|
13859
|
-
'getFunctionAddress',
|
|
13860
|
-
'setValue',
|
|
13861
|
-
'getValue',
|
|
13862
|
-
'PATH',
|
|
13863
|
-
'PATH_FS',
|
|
13864
|
-
'UTF8Decoder',
|
|
13865
|
-
'UTF8ArrayToString',
|
|
13866
|
-
'UTF8ToString',
|
|
13867
|
-
'stringToUTF8Array',
|
|
13868
|
-
'stringToUTF8',
|
|
13869
|
-
'lengthBytesUTF8',
|
|
13870
|
-
'intArrayFromString',
|
|
13871
|
-
'stringToAscii',
|
|
13872
|
-
'UTF16Decoder',
|
|
13873
|
-
'stringToNewUTF8',
|
|
13874
|
-
'stringToUTF8OnStack',
|
|
13875
|
-
'writeArrayToMemory',
|
|
13876
|
-
'JSEvents',
|
|
13877
|
-
'registerKeyEventCallback',
|
|
13878
|
-
'specialHTMLTargets',
|
|
13879
|
-
'maybeCStringToJsString',
|
|
13880
|
-
'findEventTarget',
|
|
13881
|
-
'findCanvasEventTarget',
|
|
13882
|
-
'getBoundingClientRect',
|
|
13883
|
-
'fillMouseEventData',
|
|
13884
|
-
'registerMouseEventCallback',
|
|
13885
|
-
'registerWheelEventCallback',
|
|
13886
|
-
'registerUiEventCallback',
|
|
13887
|
-
'registerFocusEventCallback',
|
|
13888
|
-
'fillFullscreenChangeEventData',
|
|
13889
|
-
'registerFullscreenChangeEventCallback',
|
|
13890
|
-
'JSEvents_requestFullscreen',
|
|
13891
|
-
'JSEvents_resizeCanvasForFullscreen',
|
|
13892
|
-
'registerRestoreOldStyle',
|
|
13893
|
-
'setLetterbox',
|
|
13894
|
-
'currentFullscreenStrategy',
|
|
13895
|
-
'restoreOldWindowedStyle',
|
|
13896
|
-
'doRequestFullscreen',
|
|
13897
|
-
'fillPointerlockChangeEventData',
|
|
13898
|
-
'registerPointerlockChangeEventCallback',
|
|
13899
|
-
'requestPointerLock',
|
|
13900
|
-
'fillVisibilityChangeEventData',
|
|
13901
|
-
'registerVisibilityChangeEventCallback',
|
|
13902
|
-
'registerTouchEventCallback',
|
|
13903
|
-
'fillGamepadEventData',
|
|
13904
|
-
'registerGamepadEventCallback',
|
|
13905
|
-
'registerBeforeUnloadEventCallback',
|
|
13906
|
-
'setCanvasElementSizeCallingThread',
|
|
13907
|
-
'setCanvasElementSizeMainThread',
|
|
13908
|
-
'setCanvasElementSize',
|
|
13909
|
-
'getCanvasSizeCallingThread',
|
|
13910
|
-
'getCanvasSizeMainThread',
|
|
13911
|
-
'getCanvasElementSize',
|
|
13912
|
-
'UNWIND_CACHE',
|
|
13913
|
-
'ExitStatus',
|
|
13914
|
-
'getEnvStrings',
|
|
13915
|
-
'checkWasiClock',
|
|
13916
|
-
'doReadv',
|
|
13917
|
-
'doWritev',
|
|
13918
|
-
'initRandomFill',
|
|
13919
|
-
'randomFill',
|
|
13920
|
-
'safeSetTimeout',
|
|
13921
|
-
'emSetImmediate',
|
|
13922
|
-
'emClearImmediate_deps',
|
|
13923
|
-
'emClearImmediate',
|
|
13924
|
-
'promiseMap',
|
|
13925
|
-
'uncaughtExceptionCount',
|
|
13926
|
-
'exceptionLast',
|
|
13927
|
-
'exceptionCaught',
|
|
13928
|
-
'Browser',
|
|
13929
|
-
'getPreloadedImageData__data',
|
|
13930
|
-
'wget',
|
|
13931
|
-
'MONTH_DAYS_REGULAR',
|
|
13932
|
-
'MONTH_DAYS_LEAP',
|
|
13933
|
-
'MONTH_DAYS_REGULAR_CUMULATIVE',
|
|
13934
|
-
'MONTH_DAYS_LEAP_CUMULATIVE',
|
|
13935
|
-
'isLeapYear',
|
|
13936
|
-
'ydayFromDate',
|
|
13937
|
-
'SYSCALLS',
|
|
13938
|
-
'preloadPlugins',
|
|
13939
|
-
'FS_createPreloadedFile',
|
|
13940
|
-
'FS_modeStringToFlags',
|
|
13941
|
-
'FS_getMode',
|
|
13942
|
-
'FS_stdin_getChar_buffer',
|
|
13943
|
-
'FS_stdin_getChar',
|
|
13944
|
-
'FS_createPath',
|
|
13945
|
-
'FS_createDevice',
|
|
13946
|
-
'FS_readFile',
|
|
13947
|
-
'FS_createDataFile',
|
|
13948
|
-
'FS_createLazyFile',
|
|
13949
|
-
'MEMFS',
|
|
13950
|
-
'TTY',
|
|
13951
|
-
'PIPEFS',
|
|
13952
|
-
'SOCKFS',
|
|
13953
|
-
'tempFixedLengthArray',
|
|
13954
|
-
'miniTempWebGLFloatBuffers',
|
|
13955
|
-
'miniTempWebGLIntBuffers',
|
|
13956
|
-
'heapObjectForWebGLType',
|
|
13957
|
-
'toTypedArrayIndex',
|
|
13958
|
-
'webgl_enable_WEBGL_multi_draw',
|
|
13959
|
-
'webgl_enable_EXT_polygon_offset_clamp',
|
|
13960
|
-
'webgl_enable_EXT_clip_control',
|
|
13961
|
-
'webgl_enable_WEBGL_polygon_mode',
|
|
13962
|
-
'GL',
|
|
13963
|
-
'emscriptenWebGLGet',
|
|
13964
|
-
'computeUnpackAlignedImageSize',
|
|
13965
|
-
'colorChannelsInGlTextureFormat',
|
|
13966
|
-
'emscriptenWebGLGetTexPixelData',
|
|
13967
|
-
'emscriptenWebGLGetUniform',
|
|
13968
|
-
'webglGetUniformLocation',
|
|
13969
|
-
'webglPrepareUniformLocationsBeforeFirstUse',
|
|
13970
|
-
'webglGetLeftBracePos',
|
|
13971
|
-
'emscriptenWebGLGetVertexAttrib',
|
|
13972
|
-
'__glGetActiveAttribOrUniform',
|
|
13973
|
-
'AL',
|
|
13974
|
-
'GLUT',
|
|
13975
|
-
'EGL',
|
|
13976
|
-
'GLEW',
|
|
13977
|
-
'IDBStore',
|
|
13978
|
-
'emscriptenWebGLGetIndexed',
|
|
13979
|
-
'webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance',
|
|
13980
|
-
'webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance',
|
|
13981
|
-
'allocateUTF8',
|
|
13982
|
-
'allocateUTF8OnStack',
|
|
13983
|
-
'print',
|
|
13984
|
-
'printErr',
|
|
13985
|
-
'PThread',
|
|
13986
|
-
'terminateWorker',
|
|
13987
|
-
'cleanupThread',
|
|
13988
|
-
'registerTLSInit',
|
|
13989
|
-
'spawnThread',
|
|
13990
|
-
'exitOnMainThread',
|
|
13991
|
-
'proxyToMainThread',
|
|
13992
|
-
'proxiedJSCallArgs',
|
|
13993
|
-
'invokeEntryPoint',
|
|
13994
|
-
'checkMailbox',
|
|
13995
|
-
'IDBFS',
|
|
13996
|
-
];
|
|
13997
|
-
unexportedSymbols.forEach(unexportedRuntimeSymbol);
|
|
13998
|
-
|
|
13999
13052
|
|
|
14000
13053
|
|
|
14001
|
-
var calledRun;
|
|
14002
|
-
|
|
14003
13054
|
function callMain() {
|
|
14004
|
-
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
|
|
14005
|
-
assert(typeof onPreRuns === 'undefined' || onPreRuns.length == 0, 'cannot call main when preRun functions remain to be called');
|
|
14006
13055
|
|
|
14007
13056
|
var entryFunction = _main;
|
|
14008
13057
|
|
|
@@ -14021,17 +13070,6 @@ function callMain() {
|
|
|
14021
13070
|
}
|
|
14022
13071
|
}
|
|
14023
13072
|
|
|
14024
|
-
function stackCheckInit() {
|
|
14025
|
-
// This is normally called automatically during __wasm_call_ctors but need to
|
|
14026
|
-
// get these values before even running any of the ctors so we call it redundantly
|
|
14027
|
-
// here.
|
|
14028
|
-
// See $establishStackSpace for the equivalent code that runs on a thread
|
|
14029
|
-
assert(!ENVIRONMENT_IS_PTHREAD);
|
|
14030
|
-
_emscripten_stack_init();
|
|
14031
|
-
// TODO(sbc): Move writeStackCookie to native to to avoid this.
|
|
14032
|
-
writeStackCookie();
|
|
14033
|
-
}
|
|
14034
|
-
|
|
14035
13073
|
function run() {
|
|
14036
13074
|
|
|
14037
13075
|
if (runDependencies > 0) {
|
|
@@ -14045,8 +13083,6 @@ function run() {
|
|
|
14045
13083
|
return;
|
|
14046
13084
|
}
|
|
14047
13085
|
|
|
14048
|
-
stackCheckInit();
|
|
14049
|
-
|
|
14050
13086
|
preRun();
|
|
14051
13087
|
|
|
14052
13088
|
// a preRun added a dependency, run will be called later
|
|
@@ -14058,8 +13094,6 @@ function run() {
|
|
|
14058
13094
|
function doRun() {
|
|
14059
13095
|
// run may have just been called through dependencies being fulfilled just in this very frame,
|
|
14060
13096
|
// or while the async setStatus time below was happening
|
|
14061
|
-
assert(!calledRun);
|
|
14062
|
-
calledRun = true;
|
|
14063
13097
|
Module['calledRun'] = true;
|
|
14064
13098
|
|
|
14065
13099
|
if (ABORT) return;
|
|
@@ -14070,9 +13104,8 @@ function run() {
|
|
|
14070
13104
|
|
|
14071
13105
|
readyPromiseResolve(Module);
|
|
14072
13106
|
Module['onRuntimeInitialized']?.();
|
|
14073
|
-
consumedModuleProp('onRuntimeInitialized');
|
|
14074
13107
|
|
|
14075
|
-
var noInitialRun = Module['noInitialRun'];
|
|
13108
|
+
var noInitialRun = Module['noInitialRun'];
|
|
14076
13109
|
if (!noInitialRun) callMain();
|
|
14077
13110
|
|
|
14078
13111
|
postRun();
|
|
@@ -14088,46 +13121,6 @@ function run() {
|
|
|
14088
13121
|
{
|
|
14089
13122
|
doRun();
|
|
14090
13123
|
}
|
|
14091
|
-
checkStackCookie();
|
|
14092
|
-
}
|
|
14093
|
-
|
|
14094
|
-
function checkUnflushedContent() {
|
|
14095
|
-
// Compiler settings do not allow exiting the runtime, so flushing
|
|
14096
|
-
// the streams is not possible. but in ASSERTIONS mode we check
|
|
14097
|
-
// if there was something to flush, and if so tell the user they
|
|
14098
|
-
// should request that the runtime be exitable.
|
|
14099
|
-
// Normally we would not even include flush() at all, but in ASSERTIONS
|
|
14100
|
-
// builds we do so just for this check, and here we see if there is any
|
|
14101
|
-
// content to flush, that is, we check if there would have been
|
|
14102
|
-
// something a non-ASSERTIONS build would have not seen.
|
|
14103
|
-
// How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0
|
|
14104
|
-
// mode (which has its own special function for this; otherwise, all
|
|
14105
|
-
// the code is inside libc)
|
|
14106
|
-
var oldOut = out;
|
|
14107
|
-
var oldErr = err;
|
|
14108
|
-
var has = false;
|
|
14109
|
-
out = err = (x) => {
|
|
14110
|
-
has = true;
|
|
14111
|
-
}
|
|
14112
|
-
try { // it doesn't matter if it fails
|
|
14113
|
-
_fflush(0);
|
|
14114
|
-
// also flush in the JS FS layer
|
|
14115
|
-
['stdout', 'stderr'].forEach((name) => {
|
|
14116
|
-
var info = FS.analyzePath('/dev/' + name);
|
|
14117
|
-
if (!info) return;
|
|
14118
|
-
var stream = info.object;
|
|
14119
|
-
var rdev = stream.rdev;
|
|
14120
|
-
var tty = TTY.ttys[rdev];
|
|
14121
|
-
if (tty?.output?.length) {
|
|
14122
|
-
has = true;
|
|
14123
|
-
}
|
|
14124
|
-
});
|
|
14125
|
-
} catch(e) {}
|
|
14126
|
-
out = oldOut;
|
|
14127
|
-
err = oldErr;
|
|
14128
|
-
if (has) {
|
|
14129
|
-
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.');
|
|
14130
|
-
}
|
|
14131
13124
|
}
|
|
14132
13125
|
|
|
14133
13126
|
if (Module['preInit']) {
|
|
@@ -14136,7 +13129,6 @@ if (Module['preInit']) {
|
|
|
14136
13129
|
Module['preInit'].pop()();
|
|
14137
13130
|
}
|
|
14138
13131
|
}
|
|
14139
|
-
consumedModuleProp('preInit');
|
|
14140
13132
|
|
|
14141
13133
|
run();
|
|
14142
13134
|
|
|
@@ -14151,21 +13143,6 @@ run();
|
|
|
14151
13143
|
|
|
14152
13144
|
moduleRtn = readyPromise;
|
|
14153
13145
|
|
|
14154
|
-
// Assertion for attempting to access module properties on the incoming
|
|
14155
|
-
// moduleArg. In the past we used this object as the prototype of the module
|
|
14156
|
-
// and assigned properties to it, but now we return a distinct object. This
|
|
14157
|
-
// keeps the instance private until it is ready (i.e the promise has been
|
|
14158
|
-
// resolved).
|
|
14159
|
-
for (const prop of Object.keys(Module)) {
|
|
14160
|
-
if (!(prop in moduleArg)) {
|
|
14161
|
-
Object.defineProperty(moduleArg, prop, {
|
|
14162
|
-
configurable: true,
|
|
14163
|
-
get() {
|
|
14164
|
-
abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)
|
|
14165
|
-
}
|
|
14166
|
-
});
|
|
14167
|
-
}
|
|
14168
|
-
}
|
|
14169
13146
|
// end include: postamble_modularize.js
|
|
14170
13147
|
|
|
14171
13148
|
|
|
@@ -14174,15 +13151,6 @@ for (const prop of Object.keys(Module)) {
|
|
|
14174
13151
|
}
|
|
14175
13152
|
);
|
|
14176
13153
|
})();
|
|
14177
|
-
(() => {
|
|
14178
|
-
// Create a small, never-async wrapper around mGBA which
|
|
14179
|
-
// checks for callers incorrectly using it with `new`.
|
|
14180
|
-
var real_mGBA = mGBA;
|
|
14181
|
-
mGBA = function(arg) {
|
|
14182
|
-
if (new.target) throw new Error("mGBA() should not be called with `new mGBA()`");
|
|
14183
|
-
return real_mGBA(arg);
|
|
14184
|
-
}
|
|
14185
|
-
})();
|
|
14186
13154
|
export default mGBA;
|
|
14187
13155
|
var isPthread = globalThis.self?.name?.startsWith('em-pthread');
|
|
14188
13156
|
// When running as a pthread, construct a new instance on startup
|