@thenick775/mgba-wasm 2.1.1-beta.5 → 2.1.1-beta.6
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 +131 -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,43 @@ 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) => { console.log("using videoSync/audioSync", $0, $1) },
|
|
1121
|
+
310342: ($0) => { console.log("using threadedVideo", $0) },
|
|
1122
|
+
310385: ($0) => { console.log('setting core audio buffer size:', $0) },
|
|
1123
|
+
310440: ($0, $1) => { Module.canvas.width = $0; Module.canvas.height = $1; },
|
|
1124
|
+
310497: ($0) => { console.log('setting audioSampleRate', $0) },
|
|
1125
|
+
310544: ($0) => { console.log('setting audioBufferSize', $0) },
|
|
1126
|
+
310591: ($0) => { console.log('setting videoSync', $0) },
|
|
1127
|
+
310632: ($0) => { console.log('setting audioSync', $0) },
|
|
1128
|
+
310673: ($0) => { console.log('setting threadedVideo', $0) },
|
|
1129
|
+
310718: ($0) => { console.log('setting rewindEnable', $0) },
|
|
1130
|
+
310762: ($0, $1, $2, $3, $4, $5, $6) => { Module.version = { gitCommit : UTF8ToString($0), gitShort : UTF8ToString($1), gitBranch : UTF8ToString($2), gitRevision : $3, binaryName : UTF8ToString($4), projectName : UTF8ToString($5), projectVersion : UTF8ToString($6) }; },
|
|
1131
|
+
310994: ($0) => { console.log("fps target audio", $0); },
|
|
1132
|
+
311035: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1133
|
+
311133: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1134
|
+
311231: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1135
|
+
311329: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1136
|
+
311427: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1137
|
+
311525: ($0, $1) => { const funcPtr = $0; const ctx = $1; const func = wasmTable.get(funcPtr); if (func) func(ctx); },
|
|
1138
|
+
311623: ($0, $1, $2, $3) => { console.log("desired spec values: sampleRate/samples", $0, $1); console.log("obtained spec values: sampleRate/samples", $2, $3) },
|
|
1139
|
+
311755: () => { FS.syncfs(function (err) { assert(!err); }) },
|
|
1140
|
+
311799: ($0) => { var str = UTF8ToString($0) + '\n\n' + 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :'; var reply = window.prompt(str, "i"); if (reply === null) { reply = "i"; } return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL); },
|
|
1141
|
+
312024: () => { if (typeof(AudioContext) !== 'undefined') { return true; } else if (typeof(webkitAudioContext) !== 'undefined') { return true; } return false; },
|
|
1142
|
+
312171: () => { if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) { return true; } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') { return true; } return false; },
|
|
1143
|
+
312405: ($0) => { if(typeof(Module['SDL2']) === 'undefined') { Module['SDL2'] = {}; } var SDL2 = Module['SDL2']; if (!$0) { SDL2.audio = {}; } else { SDL2.capture = {}; } if (!SDL2.audioContext) { if (typeof(AudioContext) !== 'undefined') { SDL2.audioContext = new AudioContext(); } else if (typeof(webkitAudioContext) !== 'undefined') { SDL2.audioContext = new webkitAudioContext(); } if (SDL2.audioContext) { if ((typeof navigator.userActivation) === 'undefined') { autoResumeAudioContext(SDL2.audioContext); } } } return SDL2.audioContext === undefined ? -1 : 0; },
|
|
1144
|
+
312957: () => { var SDL2 = Module['SDL2']; return SDL2.audioContext.sampleRate; },
|
|
1145
|
+
313025: ($0, $1, $2, $3) => { var SDL2 = Module['SDL2']; var have_microphone = function(stream) { if (SDL2.capture.silenceTimer !== undefined) { clearInterval(SDL2.capture.silenceTimer); SDL2.capture.silenceTimer = undefined; SDL2.capture.silenceBuffer = undefined } SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream); SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1); SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) { if ((SDL2 === undefined) || (SDL2.capture === undefined)) { return; } audioProcessingEvent.outputBuffer.getChannelData(0).fill(0.0); SDL2.capture.currentCaptureBuffer = audioProcessingEvent.inputBuffer; dynCall('vi', $2, [$3]); }; SDL2.capture.mediaStreamNode.connect(SDL2.capture.scriptProcessorNode); SDL2.capture.scriptProcessorNode.connect(SDL2.audioContext.destination); SDL2.capture.stream = stream; }; var no_microphone = function(error) { }; SDL2.capture.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate); SDL2.capture.silenceBuffer.getChannelData(0).fill(0.0); var silence_callback = function() { SDL2.capture.currentCaptureBuffer = SDL2.capture.silenceBuffer; dynCall('vi', $2, [$3]); }; SDL2.capture.silenceTimer = setInterval(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); if ((navigator.mediaDevices !== undefined) && (navigator.mediaDevices.getUserMedia !== undefined)) { navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(have_microphone).catch(no_microphone); } else if (navigator.webkitGetUserMedia !== undefined) { navigator.webkitGetUserMedia({ audio: true, video: false }, have_microphone, no_microphone); } },
|
|
1146
|
+
314718: ($0, $1, $2, $3) => { var SDL2 = Module['SDL2']; SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; } if (SDL2.audio.silenceTimer !== undefined) { clearInterval(SDL2.audio.silenceTimer); SDL2.audio.silenceTimer = undefined; SDL2.audio.silenceBuffer = undefined; } SDL2.audio.currentOutputBuffer = e['outputBuffer']; dynCall('vi', $2, [$3]); }; SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']); if (SDL2.audioContext.state === 'suspended') { SDL2.audio.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate); SDL2.audio.silenceBuffer.getChannelData(0).fill(0.0); var silence_callback = function() { if ((typeof navigator.userActivation) !== 'undefined') { if (navigator.userActivation.hasBeenActive) { SDL2.audioContext.resume(); } } SDL2.audio.currentOutputBuffer = SDL2.audio.silenceBuffer; dynCall('vi', $2, [$3]); SDL2.audio.currentOutputBuffer = undefined; }; SDL2.audio.silenceTimer = setInterval(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); } },
|
|
1147
|
+
315893: ($0, $1) => { var SDL2 = Module['SDL2']; var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; for (var c = 0; c < numChannels; ++c) { var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); if (channelData.length != $1) { throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } if (numChannels == 1) { for (var j = 0; j < $1; ++j) { setValue($0 + (j * 4), channelData[j], 'float'); } } else { for (var j = 0; j < $1; ++j) { setValue($0 + (((j * numChannels) + c) * 4), channelData[j], 'float'); } } } },
|
|
1148
|
+
316498: ($0, $1) => { var SDL2 = Module['SDL2']; var buf = $0 >>> 2; var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; for (var c = 0; c < numChannels; ++c) { var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); if (channelData.length != $1) { throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } for (var j = 0; j < $1; ++j) { channelData[j] = HEAPF32[buf + (j*numChannels + c)]; } } },
|
|
1149
|
+
316987: ($0) => { var SDL2 = Module['SDL2']; if ($0) { if (SDL2.capture.silenceTimer !== undefined) { clearInterval(SDL2.capture.silenceTimer); } if (SDL2.capture.stream !== undefined) { var tracks = SDL2.capture.stream.getAudioTracks(); for (var i = 0; i < tracks.length; i++) { SDL2.capture.stream.removeTrack(tracks[i]); } } if (SDL2.capture.scriptProcessorNode !== undefined) { SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {}; SDL2.capture.scriptProcessorNode.disconnect(); } if (SDL2.capture.mediaStreamNode !== undefined) { SDL2.capture.mediaStreamNode.disconnect(); } SDL2.capture = undefined; } else { if (SDL2.audio.scriptProcessorNode != undefined) { SDL2.audio.scriptProcessorNode.disconnect(); } if (SDL2.audio.silenceTimer !== undefined) { clearInterval(SDL2.audio.silenceTimer); } SDL2.audio = undefined; } if ((SDL2.audioContext !== undefined) && (SDL2.audio === undefined) && (SDL2.capture === undefined)) { SDL2.audioContext.close(); SDL2.audioContext = undefined; } },
|
|
1150
|
+
317993: ($0, $1, $2) => { var w = $0; var h = $1; var pixels = $2; if (!Module['SDL2']) Module['SDL2'] = {}; var SDL2 = Module['SDL2']; if (SDL2.ctxCanvas !== Module['canvas']) { SDL2.ctx = Module['createContext'](Module['canvas'], false, true); SDL2.ctxCanvas = Module['canvas']; } if (SDL2.w !== w || SDL2.h !== h || SDL2.imageCtx !== SDL2.ctx) { SDL2.image = SDL2.ctx.createImageData(w, h); SDL2.w = w; SDL2.h = h; SDL2.imageCtx = SDL2.ctx; } var data = SDL2.image.data; var src = pixels / 4; var dst = 0; var num; if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { num = data.length; while (dst < num) { var val = HEAP32[src]; data[dst ] = val & 0xff; data[dst+1] = (val >> 8) & 0xff; data[dst+2] = (val >> 16) & 0xff; data[dst+3] = 0xff; src++; dst += 4; } } else { if (SDL2.data32Data !== data) { SDL2.data32 = new Int32Array(data.buffer); SDL2.data8 = new Uint8Array(data.buffer); SDL2.data32Data = data; } var data32 = SDL2.data32; num = data32.length; data32.set(HEAP32.subarray(src, src + num)); var data8 = SDL2.data8; var i = 3; var j = i + 4*num; if (num % 8 == 0) { while (i < j) { data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; data8[i] = 0xff; i = i + 4 | 0; } } else { while (i < j) { data8[i] = 0xff; i = i + 4 | 0; } } } SDL2.ctx.putImageData(SDL2.image, 0, 0); },
|
|
1151
|
+
319461: ($0, $1, $2, $3, $4) => { var w = $0; var h = $1; var hot_x = $2; var hot_y = $3; var pixels = $4; var canvas = document.createElement("canvas"); canvas.width = w; canvas.height = h; var ctx = canvas.getContext("2d"); var image = ctx.createImageData(w, h); var data = image.data; var src = pixels / 4; var dst = 0; var num; if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { num = data.length; while (dst < num) { var val = HEAP32[src]; data[dst ] = val & 0xff; data[dst+1] = (val >> 8) & 0xff; data[dst+2] = (val >> 16) & 0xff; data[dst+3] = (val >> 24) & 0xff; src++; dst += 4; } } else { var data32 = new Int32Array(data.buffer); num = data32.length; data32.set(HEAP32.subarray(src, src + num)); } ctx.putImageData(image, 0, 0); var url = hot_x === 0 && hot_y === 0 ? "url(" + canvas.toDataURL() + "), auto" : "url(" + canvas.toDataURL() + ") " + hot_x + " " + hot_y + ", auto"; var urlBuf = _malloc(url.length + 1); stringToUTF8(url, urlBuf, url.length + 1); return urlBuf; },
|
|
1152
|
+
320449: ($0) => { if (Module['canvas']) { Module['canvas'].style['cursor'] = UTF8ToString($0); } },
|
|
1153
|
+
320532: () => { if (Module['canvas']) { Module['canvas'].style['cursor'] = 'none'; } },
|
|
1154
|
+
320601: () => { return window.innerWidth; },
|
|
1155
|
+
320631: () => { return window.innerHeight; }
|
|
1464
1156
|
};
|
|
1465
1157
|
|
|
1466
1158
|
// end include: preamble.js
|
|
@@ -1483,16 +1175,11 @@ var ASM_CONSTS = {
|
|
|
1483
1175
|
// out its message handler here. This avoids having to check in each of
|
|
1484
1176
|
// the onmessage handlers if the message was coming from valid worker.
|
|
1485
1177
|
worker.onmessage = (e) => {
|
|
1486
|
-
var cmd = e['data'].cmd;
|
|
1487
|
-
err(`received "${cmd}" command from terminated worker: ${worker.workerID}`);
|
|
1488
1178
|
};
|
|
1489
1179
|
};
|
|
1490
1180
|
|
|
1491
1181
|
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
1182
|
var worker = PThread.pthreads[pthread_ptr];
|
|
1495
|
-
assert(worker);
|
|
1496
1183
|
PThread.returnWorkerToPool(worker);
|
|
1497
1184
|
};
|
|
1498
1185
|
|
|
@@ -1506,15 +1193,12 @@ var ASM_CONSTS = {
|
|
|
1506
1193
|
var addOnPreRun = (cb) => onPreRuns.unshift(cb);
|
|
1507
1194
|
|
|
1508
1195
|
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
1196
|
|
|
1512
1197
|
var worker = PThread.getNewWorker();
|
|
1513
1198
|
if (!worker) {
|
|
1514
1199
|
// No available workers in the PThread pool.
|
|
1515
1200
|
return 6;
|
|
1516
1201
|
}
|
|
1517
|
-
assert(!worker.pthread_ptr, 'Internal error!');
|
|
1518
1202
|
|
|
1519
1203
|
PThread.runningWorkers.push(worker);
|
|
1520
1204
|
|
|
@@ -1606,7 +1290,6 @@ var ASM_CONSTS = {
|
|
|
1606
1290
|
|
|
1607
1291
|
|
|
1608
1292
|
|
|
1609
|
-
|
|
1610
1293
|
var handleException = (e) => {
|
|
1611
1294
|
// Certain exception types we do not treat as errors since they are used for
|
|
1612
1295
|
// internal control flow.
|
|
@@ -1616,12 +1299,6 @@ var ASM_CONSTS = {
|
|
|
1616
1299
|
if (e instanceof ExitStatus || e == 'unwind') {
|
|
1617
1300
|
return EXITSTATUS;
|
|
1618
1301
|
}
|
|
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
1302
|
quit_(1, e);
|
|
1626
1303
|
};
|
|
1627
1304
|
|
|
@@ -1635,17 +1312,13 @@ var ASM_CONSTS = {
|
|
|
1635
1312
|
|
|
1636
1313
|
}
|
|
1637
1314
|
|
|
1638
|
-
|
|
1639
1315
|
/** @suppress {duplicate } */
|
|
1640
1316
|
/** @param {boolean|number=} implicit */
|
|
1641
1317
|
var exitJS = (status, implicit) => {
|
|
1642
1318
|
EXITSTATUS = status;
|
|
1643
1319
|
|
|
1644
|
-
checkUnflushedContent();
|
|
1645
|
-
|
|
1646
1320
|
if (ENVIRONMENT_IS_PTHREAD) {
|
|
1647
1321
|
// implicit exit can never happen on a pthread
|
|
1648
|
-
assert(!implicit);
|
|
1649
1322
|
// When running in a pthread we propagate the exit back to the main thread
|
|
1650
1323
|
// where it can decide if the whole process should be shut down or not.
|
|
1651
1324
|
// The pthread may have decided not to exit its own runtime, for example
|
|
@@ -1654,24 +1327,10 @@ var ASM_CONSTS = {
|
|
|
1654
1327
|
throw 'unwind';
|
|
1655
1328
|
}
|
|
1656
1329
|
|
|
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
1330
|
_proc_exit(status);
|
|
1665
1331
|
};
|
|
1666
1332
|
var _exit = exitJS;
|
|
1667
1333
|
|
|
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
1334
|
|
|
1676
1335
|
var PThread = {
|
|
1677
1336
|
unusedWorkers:[],
|
|
@@ -1679,23 +1338,7 @@ var ASM_CONSTS = {
|
|
|
1679
1338
|
tlsInitFunctions:[],
|
|
1680
1339
|
pthreads:{
|
|
1681
1340
|
},
|
|
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
1341
|
init() {
|
|
1698
|
-
PThread.debugInit();
|
|
1699
1342
|
if ((!(ENVIRONMENT_IS_PTHREAD))) {
|
|
1700
1343
|
PThread.initMainThread();
|
|
1701
1344
|
}
|
|
@@ -1714,7 +1357,6 @@ var ASM_CONSTS = {
|
|
|
1714
1357
|
});
|
|
1715
1358
|
},
|
|
1716
1359
|
terminateAllThreads:() => {
|
|
1717
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! terminateAllThreads() can only ever be called from main application thread!');
|
|
1718
1360
|
// Attempt to kill all workers. Sadly (at least on the web) there is no
|
|
1719
1361
|
// way to terminate a worker synchronously, or to be notified when a
|
|
1720
1362
|
// worker in actually terminated. This means there is some risk that
|
|
@@ -1802,16 +1444,10 @@ var ASM_CONSTS = {
|
|
|
1802
1444
|
|
|
1803
1445
|
worker.onerror = (e) => {
|
|
1804
1446
|
var message = 'worker sent an error!';
|
|
1805
|
-
if (worker.pthread_ptr) {
|
|
1806
|
-
message = `Pthread ${ptrToString(worker.pthread_ptr)} sent an error!`;
|
|
1807
|
-
}
|
|
1808
1447
|
err(`${message} ${e.filename}:${e.lineno}: ${e.message}`);
|
|
1809
1448
|
throw e;
|
|
1810
1449
|
};
|
|
1811
1450
|
|
|
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
1451
|
// When running on a pthread, none of the incoming parameters on the module
|
|
1816
1452
|
// object are present. Proxy known handlers back to the main thread if specified.
|
|
1817
1453
|
var handlers = [];
|
|
@@ -1827,15 +1463,12 @@ var ASM_CONSTS = {
|
|
|
1827
1463
|
}
|
|
1828
1464
|
}
|
|
1829
1465
|
|
|
1830
|
-
worker.workerID = PThread.nextWorkerID++;
|
|
1831
|
-
|
|
1832
1466
|
// Ask the new worker to load up the Emscripten-compiled page. This is a heavy operation.
|
|
1833
1467
|
worker.postMessage({
|
|
1834
1468
|
cmd: 'load',
|
|
1835
1469
|
handlers: handlers,
|
|
1836
1470
|
wasmMemory,
|
|
1837
1471
|
wasmModule,
|
|
1838
|
-
'workerID': worker.workerID,
|
|
1839
1472
|
});
|
|
1840
1473
|
}),
|
|
1841
1474
|
loadWasmModuleToAllWorkers(onMaybeReady) {
|
|
@@ -1860,20 +1493,13 @@ var ASM_CONSTS = {
|
|
|
1860
1493
|
'type': 'module',
|
|
1861
1494
|
// This is the way that we signal to the Web Worker that it is hosting
|
|
1862
1495
|
// a pthread.
|
|
1863
|
-
'name': 'em-pthread
|
|
1496
|
+
'name': 'em-pthread',
|
|
1864
1497
|
});
|
|
1865
1498
|
PThread.unusedWorkers.push(worker);
|
|
1866
1499
|
},
|
|
1867
1500
|
getNewWorker() {
|
|
1868
1501
|
if (PThread.unusedWorkers.length == 0) {
|
|
1869
1502
|
// 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
1503
|
PThread.allocateUnusedWorker();
|
|
1878
1504
|
PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]);
|
|
1879
1505
|
}
|
|
@@ -1892,9 +1518,6 @@ var ASM_CONSTS = {
|
|
|
1892
1518
|
var stackHigh = HEAPU32[(((pthread_ptr)+(52))>>2)];
|
|
1893
1519
|
var stackSize = HEAPU32[(((pthread_ptr)+(56))>>2)];
|
|
1894
1520
|
var stackLow = stackHigh - stackSize;
|
|
1895
|
-
assert(stackHigh != 0);
|
|
1896
|
-
assert(stackLow != 0);
|
|
1897
|
-
assert(stackHigh > stackLow, 'stackHigh must be higher then stackLow');
|
|
1898
1521
|
// Set stack limits used by `emscripten/stack.h` function. These limits are
|
|
1899
1522
|
// cached in wasm-side globals to make checks as fast as possible.
|
|
1900
1523
|
_emscripten_stack_set_limits(stackHigh, stackLow);
|
|
@@ -1902,9 +1525,6 @@ var ASM_CONSTS = {
|
|
|
1902
1525
|
// Call inside wasm module to set up the stack frame for this pthread in wasm module scope
|
|
1903
1526
|
stackRestore(stackHigh);
|
|
1904
1527
|
|
|
1905
|
-
// Write the stack cookie last, after we have set up the proper bounds and
|
|
1906
|
-
// current position of the stack.
|
|
1907
|
-
writeStackCookie();
|
|
1908
1528
|
};
|
|
1909
1529
|
|
|
1910
1530
|
|
|
@@ -1942,8 +1562,6 @@ var ASM_CONSTS = {
|
|
|
1942
1562
|
/** @suppress {checkTypes} */
|
|
1943
1563
|
wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
|
|
1944
1564
|
}
|
|
1945
|
-
/** @suppress {checkTypes} */
|
|
1946
|
-
assert(wasmTable.get(funcPtr) == func, 'JavaScript-side Wasm function table mirror is out of date!');
|
|
1947
1565
|
return func;
|
|
1948
1566
|
};
|
|
1949
1567
|
var invokeEntryPoint = (ptr, arg) => {
|
|
@@ -1972,7 +1590,6 @@ var ASM_CONSTS = {
|
|
|
1972
1590
|
|
|
1973
1591
|
var result = getWasmTableEntry(ptr)(arg);
|
|
1974
1592
|
|
|
1975
|
-
checkStackCookie();
|
|
1976
1593
|
function finish(result) {
|
|
1977
1594
|
if (keepRuntimeAlive()) {
|
|
1978
1595
|
EXITSTATUS = result;
|
|
@@ -1985,7 +1602,6 @@ var ASM_CONSTS = {
|
|
|
1985
1602
|
|
|
1986
1603
|
var noExitRuntime = Module['noExitRuntime'] || true;
|
|
1987
1604
|
|
|
1988
|
-
|
|
1989
1605
|
var registerTLSInit = (tlsInitFunc) => PThread.tlsInitFunctions.push(tlsInitFunc);
|
|
1990
1606
|
|
|
1991
1607
|
|
|
@@ -2011,14 +1627,6 @@ var ASM_CONSTS = {
|
|
|
2011
1627
|
|
|
2012
1628
|
|
|
2013
1629
|
|
|
2014
|
-
var warnOnce = (text) => {
|
|
2015
|
-
warnOnce.shown ||= {};
|
|
2016
|
-
if (!warnOnce.shown[text]) {
|
|
2017
|
-
warnOnce.shown[text] = 1;
|
|
2018
|
-
err(text);
|
|
2019
|
-
}
|
|
2020
|
-
};
|
|
2021
|
-
|
|
2022
1630
|
var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined;
|
|
2023
1631
|
|
|
2024
1632
|
/**
|
|
@@ -2059,7 +1667,6 @@ var ASM_CONSTS = {
|
|
|
2059
1667
|
if ((u0 & 0xF0) == 0xE0) {
|
|
2060
1668
|
u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
|
|
2061
1669
|
} 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
1670
|
u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
|
|
2064
1671
|
}
|
|
2065
1672
|
|
|
@@ -2089,7 +1696,6 @@ var ASM_CONSTS = {
|
|
|
2089
1696
|
* @return {string}
|
|
2090
1697
|
*/
|
|
2091
1698
|
var UTF8ToString = (ptr, maxBytesToRead) => {
|
|
2092
|
-
assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
|
|
2093
1699
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
|
|
2094
1700
|
};
|
|
2095
1701
|
var ___assert_fail = (condition, filename, line, func) =>
|
|
@@ -2113,7 +1719,6 @@ var ASM_CONSTS = {
|
|
|
2113
1719
|
|
|
2114
1720
|
var ___pthread_create_js = (pthread_ptr, attr, startRoutine, arg) => {
|
|
2115
1721
|
if (!_emscripten_has_threading_support()) {
|
|
2116
|
-
dbg('pthread_create: environment does not support SharedArrayBuffer, pthreads are not available');
|
|
2117
1722
|
return 6;
|
|
2118
1723
|
}
|
|
2119
1724
|
|
|
@@ -2157,7 +1762,6 @@ var ASM_CONSTS = {
|
|
|
2157
1762
|
|
|
2158
1763
|
/** @suppress {duplicate } */
|
|
2159
1764
|
var syscallGetVarargI = () => {
|
|
2160
|
-
assert(SYSCALLS.varargs != undefined);
|
|
2161
1765
|
// the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number.
|
|
2162
1766
|
var ret = HEAP32[((+SYSCALLS.varargs)>>2)];
|
|
2163
1767
|
SYSCALLS.varargs += 4;
|
|
@@ -2320,7 +1924,6 @@ var ASM_CONSTS = {
|
|
|
2320
1924
|
};
|
|
2321
1925
|
|
|
2322
1926
|
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
2323
|
-
assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
|
|
2324
1927
|
// Parameter maxBytesToWrite is not optional. Negative values, 0, null,
|
|
2325
1928
|
// undefined and false each don't write out any bytes.
|
|
2326
1929
|
if (!(maxBytesToWrite > 0))
|
|
@@ -2355,7 +1958,6 @@ var ASM_CONSTS = {
|
|
|
2355
1958
|
heap[outIdx++] = 0x80 | (u & 63);
|
|
2356
1959
|
} else {
|
|
2357
1960
|
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
1961
|
heap[outIdx++] = 0xF0 | (u >> 18);
|
|
2360
1962
|
heap[outIdx++] = 0x80 | ((u >> 12) & 63);
|
|
2361
1963
|
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
@@ -2541,7 +2143,6 @@ var ASM_CONSTS = {
|
|
|
2541
2143
|
};
|
|
2542
2144
|
|
|
2543
2145
|
var alignMemory = (size, alignment) => {
|
|
2544
|
-
assert(alignment, "alignment argument is required");
|
|
2545
2146
|
return Math.ceil(size / alignment) * alignment;
|
|
2546
2147
|
};
|
|
2547
2148
|
var mmapAlloc = (size) => {
|
|
@@ -2707,7 +2308,7 @@ var ASM_CONSTS = {
|
|
|
2707
2308
|
}
|
|
2708
2309
|
},
|
|
2709
2310
|
lookup(parent, name) {
|
|
2710
|
-
throw
|
|
2311
|
+
throw MEMFS.doesNotExistError;
|
|
2711
2312
|
},
|
|
2712
2313
|
mknod(parent, name, mode, dev) {
|
|
2713
2314
|
return MEMFS.createNode(parent, name, mode, dev);
|
|
@@ -2764,7 +2365,6 @@ var ASM_CONSTS = {
|
|
|
2764
2365
|
var contents = stream.node.contents;
|
|
2765
2366
|
if (position >= stream.node.usedBytes) return 0;
|
|
2766
2367
|
var size = Math.min(stream.node.usedBytes - position, length);
|
|
2767
|
-
assert(size >= 0);
|
|
2768
2368
|
if (size > 8 && contents.subarray) { // non-trivial, and typed array
|
|
2769
2369
|
buffer.set(contents.subarray(position, position + size), offset);
|
|
2770
2370
|
} else {
|
|
@@ -2773,8 +2373,6 @@ var ASM_CONSTS = {
|
|
|
2773
2373
|
return size;
|
|
2774
2374
|
},
|
|
2775
2375
|
write(stream, buffer, offset, length, position, canOwn) {
|
|
2776
|
-
// The data buffer should be a typed array view
|
|
2777
|
-
assert(!(buffer instanceof ArrayBuffer));
|
|
2778
2376
|
|
|
2779
2377
|
if (!length) return 0;
|
|
2780
2378
|
var node = stream.node;
|
|
@@ -2782,7 +2380,6 @@ var ASM_CONSTS = {
|
|
|
2782
2380
|
|
|
2783
2381
|
if (buffer.subarray && (!node.contents || node.contents.subarray)) { // This write is from a typed array to a typed array?
|
|
2784
2382
|
if (canOwn) {
|
|
2785
|
-
assert(position === 0, 'canOwn must imply no weird position inside the file');
|
|
2786
2383
|
node.contents = buffer.subarray(offset, offset + length);
|
|
2787
2384
|
node.usedBytes = length;
|
|
2788
2385
|
return length;
|
|
@@ -2870,7 +2467,6 @@ var ASM_CONSTS = {
|
|
|
2870
2467
|
|
|
2871
2468
|
var asyncLoad = async (url) => {
|
|
2872
2469
|
var arrayBuffer = await readAsync(url);
|
|
2873
|
-
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
|
|
2874
2470
|
return new Uint8Array(arrayBuffer);
|
|
2875
2471
|
};
|
|
2876
2472
|
|
|
@@ -2959,7 +2555,6 @@ var ASM_CONSTS = {
|
|
|
2959
2555
|
if (typeof indexedDB != 'undefined') return indexedDB;
|
|
2960
2556
|
var ret = null;
|
|
2961
2557
|
if (typeof window == 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
2962
|
-
assert(ret, 'IDBFS used, but indexedDB not supported');
|
|
2963
2558
|
return ret;
|
|
2964
2559
|
},
|
|
2965
2560
|
DB_VERSION:21,
|
|
@@ -3322,134 +2917,6 @@ var ASM_CONSTS = {
|
|
|
3322
2917
|
});
|
|
3323
2918
|
},
|
|
3324
2919
|
};
|
|
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
2920
|
var FS = {
|
|
3454
2921
|
root:null,
|
|
3455
2922
|
mounts:[],
|
|
@@ -3465,7 +2932,7 @@ var ASM_CONSTS = {
|
|
|
3465
2932
|
syncFSRequests:0,
|
|
3466
2933
|
readFiles:{
|
|
3467
2934
|
},
|
|
3468
|
-
ErrnoError:class
|
|
2935
|
+
ErrnoError:class {
|
|
3469
2936
|
name = 'ErrnoError';
|
|
3470
2937
|
// We set the `name` property to be able to identify `FS.ErrnoError`
|
|
3471
2938
|
// - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway.
|
|
@@ -3474,14 +2941,7 @@ var ASM_CONSTS = {
|
|
|
3474
2941
|
// the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs.
|
|
3475
2942
|
// we'll use the reliable test `err.name == "ErrnoError"` instead
|
|
3476
2943
|
constructor(errno) {
|
|
3477
|
-
super(runtimeInitialized ? strError(errno) : '');
|
|
3478
2944
|
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
2945
|
}
|
|
3486
2946
|
},
|
|
3487
2947
|
FSStream:class {
|
|
@@ -3679,7 +3139,6 @@ var ASM_CONSTS = {
|
|
|
3679
3139
|
return FS.lookup(parent, name);
|
|
3680
3140
|
},
|
|
3681
3141
|
createNode(parent, name, mode, rdev) {
|
|
3682
|
-
assert(typeof parent == 'object')
|
|
3683
3142
|
var node = new FS.FSNode(parent, name, mode, rdev);
|
|
3684
3143
|
|
|
3685
3144
|
FS.hashAddNode(node);
|
|
@@ -3818,7 +3277,6 @@ var ASM_CONSTS = {
|
|
|
3818
3277
|
},
|
|
3819
3278
|
getStream:(fd) => FS.streams[fd],
|
|
3820
3279
|
createStream(stream, fd = -1) {
|
|
3821
|
-
assert(fd >= -1);
|
|
3822
3280
|
|
|
3823
3281
|
// clone it, so we can return an instance of FSStream
|
|
3824
3282
|
stream = Object.assign(new FS.FSStream(), stream);
|
|
@@ -3893,7 +3351,6 @@ var ASM_CONSTS = {
|
|
|
3893
3351
|
var completed = 0;
|
|
3894
3352
|
|
|
3895
3353
|
function doCallback(errCode) {
|
|
3896
|
-
assert(FS.syncFSRequests > 0);
|
|
3897
3354
|
FS.syncFSRequests--;
|
|
3898
3355
|
return callback(errCode);
|
|
3899
3356
|
}
|
|
@@ -3920,11 +3377,6 @@ var ASM_CONSTS = {
|
|
|
3920
3377
|
});
|
|
3921
3378
|
},
|
|
3922
3379
|
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
3380
|
var root = mountpoint === '/';
|
|
3929
3381
|
var pseudo = !mountpoint;
|
|
3930
3382
|
var node;
|
|
@@ -4003,7 +3455,6 @@ var ASM_CONSTS = {
|
|
|
4003
3455
|
|
|
4004
3456
|
// remove this mount from the child mounts
|
|
4005
3457
|
var idx = node.mount.mounts.indexOf(mount);
|
|
4006
|
-
assert(idx !== -1);
|
|
4007
3458
|
node.mount.mounts.splice(idx, 1);
|
|
4008
3459
|
},
|
|
4009
3460
|
lookup(parent, name) {
|
|
@@ -4496,7 +3947,6 @@ var ASM_CONSTS = {
|
|
|
4496
3947
|
return stream.position;
|
|
4497
3948
|
},
|
|
4498
3949
|
read(stream, buffer, offset, length, position) {
|
|
4499
|
-
assert(offset >= 0);
|
|
4500
3950
|
if (length < 0 || position < 0) {
|
|
4501
3951
|
throw new FS.ErrnoError(28);
|
|
4502
3952
|
}
|
|
@@ -4523,7 +3973,6 @@ var ASM_CONSTS = {
|
|
|
4523
3973
|
return bytesRead;
|
|
4524
3974
|
},
|
|
4525
3975
|
write(stream, buffer, offset, length, position, canOwn) {
|
|
4526
|
-
assert(offset >= 0);
|
|
4527
3976
|
if (length < 0 || position < 0) {
|
|
4528
3977
|
throw new FS.ErrnoError(28);
|
|
4529
3978
|
}
|
|
@@ -4595,7 +4044,6 @@ var ASM_CONSTS = {
|
|
|
4595
4044
|
return stream.stream_ops.mmap(stream, length, position, prot, flags);
|
|
4596
4045
|
},
|
|
4597
4046
|
msync(stream, buffer, offset, length, mmapFlags) {
|
|
4598
|
-
assert(offset >= 0);
|
|
4599
4047
|
if (!stream.stream_ops.msync) {
|
|
4600
4048
|
return 0;
|
|
4601
4049
|
}
|
|
@@ -4759,9 +4207,6 @@ var ASM_CONSTS = {
|
|
|
4759
4207
|
var stdin = FS.open('/dev/stdin', 0);
|
|
4760
4208
|
var stdout = FS.open('/dev/stdout', 1);
|
|
4761
4209
|
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
4210
|
},
|
|
4766
4211
|
staticInit() {
|
|
4767
4212
|
FS.nameTable = new Array(4096);
|
|
@@ -4778,7 +4223,6 @@ var ASM_CONSTS = {
|
|
|
4778
4223
|
};
|
|
4779
4224
|
},
|
|
4780
4225
|
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
4226
|
FS.initialized = true;
|
|
4783
4227
|
|
|
4784
4228
|
// Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here
|
|
@@ -4791,7 +4235,6 @@ var ASM_CONSTS = {
|
|
|
4791
4235
|
quit() {
|
|
4792
4236
|
FS.initialized = false;
|
|
4793
4237
|
// force-flush all streams, so we get musl std streams printed out
|
|
4794
|
-
_fflush(0);
|
|
4795
4238
|
// close all of our streams
|
|
4796
4239
|
for (var i = 0; i < FS.streams.length; i++) {
|
|
4797
4240
|
var stream = FS.streams[i];
|
|
@@ -5078,7 +4521,6 @@ var ASM_CONSTS = {
|
|
|
5078
4521
|
if (position >= contents.length)
|
|
5079
4522
|
return 0;
|
|
5080
4523
|
var size = Math.min(contents.length - position, length);
|
|
5081
|
-
assert(size >= 0);
|
|
5082
4524
|
if (contents.slice) { // normal array
|
|
5083
4525
|
for (var i = 0; i < size; i++) {
|
|
5084
4526
|
buffer[offset + i] = contents[position + i];
|
|
@@ -5108,24 +4550,6 @@ var ASM_CONSTS = {
|
|
|
5108
4550
|
node.stream_ops = stream_ops;
|
|
5109
4551
|
return node;
|
|
5110
4552
|
},
|
|
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
4553
|
};
|
|
5130
4554
|
|
|
5131
4555
|
var SYSCALLS = {
|
|
@@ -5304,7 +4728,6 @@ var ASM_CONSTS = {
|
|
|
5304
4728
|
|
|
5305
4729
|
|
|
5306
4730
|
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
4731
|
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
5309
4732
|
};
|
|
5310
4733
|
|
|
@@ -5378,7 +4801,6 @@ var ASM_CONSTS = {
|
|
|
5378
4801
|
FS.isLink(child.mode) ? 10 : // DT_LNK, symbolic link.
|
|
5379
4802
|
8; // DT_REG, regular file.
|
|
5380
4803
|
}
|
|
5381
|
-
assert(id);
|
|
5382
4804
|
HEAP64[((dirp + pos)>>3)] = BigInt(id);
|
|
5383
4805
|
HEAP64[(((dirp + pos)+(8))>>3)] = BigInt((idx + 1) * struct_size);
|
|
5384
4806
|
HEAP16[(((dirp + pos)+(16))>>1)] = 280;
|
|
@@ -5549,7 +4971,6 @@ var ASM_CONSTS = {
|
|
|
5549
4971
|
var nofollow = flags & 256;
|
|
5550
4972
|
var allowEmpty = flags & 4096;
|
|
5551
4973
|
flags = flags & (~6400);
|
|
5552
|
-
assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`);
|
|
5553
4974
|
path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
|
|
5554
4975
|
return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path));
|
|
5555
4976
|
} catch (e) {
|
|
@@ -5688,7 +5109,6 @@ var ASM_CONSTS = {
|
|
|
5688
5109
|
try {
|
|
5689
5110
|
|
|
5690
5111
|
path = SYSCALLS.getStr(path);
|
|
5691
|
-
assert(flags === 0);
|
|
5692
5112
|
path = SYSCALLS.calculateAt(dirfd, path, true);
|
|
5693
5113
|
var now = Date.now(), atime, mtime;
|
|
5694
5114
|
if (!times) {
|
|
@@ -5730,7 +5150,7 @@ var ASM_CONSTS = {
|
|
|
5730
5150
|
|
|
5731
5151
|
|
|
5732
5152
|
var __abort_js = () =>
|
|
5733
|
-
abort('
|
|
5153
|
+
abort('');
|
|
5734
5154
|
|
|
5735
5155
|
var __emscripten_init_main_thread_js = (tb) => {
|
|
5736
5156
|
// Pass the thread address to the native code where they stored in wasm
|
|
@@ -5764,7 +5184,6 @@ var ASM_CONSTS = {
|
|
|
5764
5184
|
};
|
|
5765
5185
|
var callUserCallback = (func) => {
|
|
5766
5186
|
if (ABORT) {
|
|
5767
|
-
err('user callback triggered after runtime exited or application aborted. Ignoring.');
|
|
5768
5187
|
return;
|
|
5769
5188
|
}
|
|
5770
5189
|
try {
|
|
@@ -5784,7 +5203,6 @@ var ASM_CONSTS = {
|
|
|
5784
5203
|
// thread.
|
|
5785
5204
|
// TODO: How to make this work with wasm64?
|
|
5786
5205
|
var wait = Atomics.waitAsync(HEAP32, ((pthread_ptr)>>2), pthread_ptr);
|
|
5787
|
-
assert(wait.async);
|
|
5788
5206
|
wait.value.then(checkMailbox);
|
|
5789
5207
|
var waitingAsync = pthread_ptr + 128;
|
|
5790
5208
|
Atomics.store(HEAP32, ((waitingAsync)>>2), 1);
|
|
@@ -5815,7 +5233,6 @@ var ASM_CONSTS = {
|
|
|
5815
5233
|
} else {
|
|
5816
5234
|
var worker = PThread.pthreads[targetThread];
|
|
5817
5235
|
if (!worker) {
|
|
5818
|
-
err(`Cannot send message to thread with ID ${targetThread}, unknown thread ID!`);
|
|
5819
5236
|
return;
|
|
5820
5237
|
}
|
|
5821
5238
|
worker.postMessage({cmd: 'checkMailbox'});
|
|
@@ -5844,15 +5261,9 @@ var ASM_CONSTS = {
|
|
|
5844
5261
|
}
|
|
5845
5262
|
// Proxied JS library funcs use funcIndex and EM_ASM functions use emAsmAddr
|
|
5846
5263
|
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
5264
|
PThread.currentProxiedOperationCallerThread = callingThread;
|
|
5850
5265
|
var rtn = func(...proxiedJSCallArgs);
|
|
5851
5266
|
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
5267
|
return rtn;
|
|
5857
5268
|
};
|
|
5858
5269
|
|
|
@@ -6056,7 +5467,6 @@ var ASM_CONSTS = {
|
|
|
6056
5467
|
}
|
|
6057
5468
|
|
|
6058
5469
|
|
|
6059
|
-
|
|
6060
5470
|
var __tzset_js = (timezone, daylight, std_name, dst_name) => {
|
|
6061
5471
|
// TODO: Use (malleable) environment variables instead of system settings.
|
|
6062
5472
|
var currentYear = new Date().getFullYear();
|
|
@@ -6096,10 +5506,6 @@ var ASM_CONSTS = {
|
|
|
6096
5506
|
|
|
6097
5507
|
var winterName = extractZone(winterOffset);
|
|
6098
5508
|
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
5509
|
if (summerOffset < winterOffset) {
|
|
6104
5510
|
// Northern hemisphere
|
|
6105
5511
|
stringToUTF8(winterName, std_name, 17);
|
|
@@ -6148,7 +5554,6 @@ var ASM_CONSTS = {
|
|
|
6148
5554
|
};
|
|
6149
5555
|
|
|
6150
5556
|
var runtimeKeepalivePop = () => {
|
|
6151
|
-
assert(runtimeKeepaliveCounter > 0);
|
|
6152
5557
|
runtimeKeepaliveCounter -= 1;
|
|
6153
5558
|
};
|
|
6154
5559
|
/** @param {number=} timeout */
|
|
@@ -6160,6 +5565,13 @@ var ASM_CONSTS = {
|
|
|
6160
5565
|
}, timeout);
|
|
6161
5566
|
};
|
|
6162
5567
|
|
|
5568
|
+
var warnOnce = (text) => {
|
|
5569
|
+
warnOnce.shown ||= {};
|
|
5570
|
+
if (!warnOnce.shown[text]) {
|
|
5571
|
+
warnOnce.shown[text] = 1;
|
|
5572
|
+
err(text);
|
|
5573
|
+
}
|
|
5574
|
+
};
|
|
6163
5575
|
|
|
6164
5576
|
|
|
6165
5577
|
var Browser = {
|
|
@@ -6196,10 +5608,8 @@ var ASM_CONSTS = {
|
|
|
6196
5608
|
b = new Blob([(new Uint8Array(byteArray)).buffer], { type: Browser.getMimetype(name) });
|
|
6197
5609
|
}
|
|
6198
5610
|
var url = URL.createObjectURL(b);
|
|
6199
|
-
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
|
|
6200
5611
|
var img = new Image();
|
|
6201
5612
|
img.onload = () => {
|
|
6202
|
-
assert(img.complete, `Image ${name} could not be decoded`);
|
|
6203
5613
|
var canvas = /** @type {!HTMLCanvasElement} */ (document.createElement('canvas'));
|
|
6204
5614
|
canvas.width = img.width;
|
|
6205
5615
|
canvas.height = img.height;
|
|
@@ -6237,7 +5647,6 @@ var ASM_CONSTS = {
|
|
|
6237
5647
|
}
|
|
6238
5648
|
var b = new Blob([byteArray], { type: Browser.getMimetype(name) });
|
|
6239
5649
|
var url = URL.createObjectURL(b); // XXX we never revoke this!
|
|
6240
|
-
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
|
|
6241
5650
|
var audio = new Audio();
|
|
6242
5651
|
audio.addEventListener('canplaythrough', () => finish(audio), false); // use addEventListener due to chromium bug 124926
|
|
6243
5652
|
audio.onerror = function audio_onerror(event) {
|
|
@@ -6354,7 +5763,6 @@ var ASM_CONSTS = {
|
|
|
6354
5763
|
if (!ctx) return null;
|
|
6355
5764
|
|
|
6356
5765
|
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
5766
|
Module['ctx'] = ctx;
|
|
6359
5767
|
if (useWebGL) GL.makeContextCurrent(contextHandle);
|
|
6360
5768
|
Browser.useWebGL = useWebGL;
|
|
@@ -6424,9 +5832,6 @@ var ASM_CONSTS = {
|
|
|
6424
5832
|
|
|
6425
5833
|
canvasContainer.requestFullscreen();
|
|
6426
5834
|
},
|
|
6427
|
-
requestFullScreen() {
|
|
6428
|
-
abort('Module.requestFullScreen has been replaced by Module.requestFullscreen (without a capital S)');
|
|
6429
|
-
},
|
|
6430
5835
|
exitFullscreen() {
|
|
6431
5836
|
// This is workaround for chrome. Trying to exit from fullscreen
|
|
6432
5837
|
// not in fullscreen state will cause "TypeError: Document not active"
|
|
@@ -6532,9 +5937,6 @@ var ASM_CONSTS = {
|
|
|
6532
5937
|
// (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/)
|
|
6533
5938
|
var scrollX = ((typeof window.scrollX != 'undefined') ? window.scrollX : window.pageXOffset);
|
|
6534
5939
|
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
5940
|
var adjustedX = pageX - (scrollX + rect.left);
|
|
6539
5941
|
var adjustedY = pageY - (scrollY + rect.top);
|
|
6540
5942
|
|
|
@@ -7426,7 +6828,6 @@ var ASM_CONSTS = {
|
|
|
7426
6828
|
* @param {boolean=} noSetTiming
|
|
7427
6829
|
*/
|
|
7428
6830
|
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
6831
|
MainLoop.func = iterFunc;
|
|
7431
6832
|
MainLoop.arg = arg;
|
|
7432
6833
|
|
|
@@ -7485,11 +6886,6 @@ var ASM_CONSTS = {
|
|
|
7485
6886
|
MainLoop.tickStartTime = _emscripten_get_now();
|
|
7486
6887
|
}
|
|
7487
6888
|
|
|
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
6889
|
MainLoop.runIter(iterFunc);
|
|
7494
6890
|
|
|
7495
6891
|
// catch pauses from the main loop itself
|
|
@@ -7575,7 +6971,6 @@ var ASM_CONSTS = {
|
|
|
7575
6971
|
for (var post of MainLoop.postMainLoop) {
|
|
7576
6972
|
post();
|
|
7577
6973
|
}
|
|
7578
|
-
checkStackCookie();
|
|
7579
6974
|
},
|
|
7580
6975
|
nextRAF:0,
|
|
7581
6976
|
fakeRequestAnimationFrame(func) {
|
|
@@ -7606,7 +7001,6 @@ var ASM_CONSTS = {
|
|
|
7606
7001
|
MainLoop.timingValue = value;
|
|
7607
7002
|
|
|
7608
7003
|
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
7004
|
return 1; // Return non-zero on failure, can't set timing mode when there is no main loop.
|
|
7611
7005
|
}
|
|
7612
7006
|
|
|
@@ -7729,20 +7123,11 @@ var ASM_CONSTS = {
|
|
|
7729
7123
|
|
|
7730
7124
|
var readEmAsmArgsArray = [];
|
|
7731
7125
|
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
7126
|
readEmAsmArgsArray.length = 0;
|
|
7737
7127
|
var ch;
|
|
7738
7128
|
// Most arguments are i32s, so shift the buffer pointer so it is a plain
|
|
7739
7129
|
// index into HEAP32.
|
|
7740
7130
|
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
7131
|
// Floats are always passed as doubles, so all types except for 'i'
|
|
7747
7132
|
// are 8 bytes and require alignment.
|
|
7748
7133
|
var wide = (ch != 105);
|
|
@@ -7762,7 +7147,6 @@ var ASM_CONSTS = {
|
|
|
7762
7147
|
};
|
|
7763
7148
|
var runEmAsmFunction = (code, sigPtr, argbuf) => {
|
|
7764
7149
|
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
7150
|
return ASM_CONSTS[code](...args);
|
|
7767
7151
|
};
|
|
7768
7152
|
var _emscripten_asm_const_int = (code, sigPtr, argbuf) => {
|
|
@@ -7784,7 +7168,6 @@ var ASM_CONSTS = {
|
|
|
7784
7168
|
// code paths as similar as possible on both sides.)
|
|
7785
7169
|
return proxyToMainThread(0, emAsmAddr, sync, ...args);
|
|
7786
7170
|
}
|
|
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
7171
|
return ASM_CONSTS[emAsmAddr](...args);
|
|
7789
7172
|
};
|
|
7790
7173
|
var _emscripten_asm_const_int_sync_on_main_thread = (emAsmAddr, sigPtr, argbuf) => runMainThreadEmAsm(emAsmAddr, sigPtr, argbuf, 1);
|
|
@@ -7798,11 +7181,6 @@ var ASM_CONSTS = {
|
|
|
7798
7181
|
|
|
7799
7182
|
|
|
7800
7183
|
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
7184
|
};
|
|
7807
7185
|
|
|
7808
7186
|
|
|
@@ -7885,8 +7263,6 @@ var ASM_CONSTS = {
|
|
|
7885
7263
|
},
|
|
7886
7264
|
registerOrRemoveHandler(eventHandler) {
|
|
7887
7265
|
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
7266
|
return -4;
|
|
7891
7267
|
}
|
|
7892
7268
|
if (eventHandler.callbackfunc) {
|
|
@@ -8315,12 +7691,10 @@ var ASM_CONSTS = {
|
|
|
8315
7691
|
|
|
8316
7692
|
|
|
8317
7693
|
|
|
8318
|
-
|
|
8319
7694
|
function _emscripten_force_exit(status) {
|
|
8320
7695
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8321
7696
|
return proxyToMainThread(42, 0, 1, status);
|
|
8322
7697
|
|
|
8323
|
-
warnOnce('emscripten_force_exit cannot actually shut down the runtime, as the build does not have EXIT_RUNTIME set');
|
|
8324
7698
|
__emscripten_runtime_keepalive_clear();
|
|
8325
7699
|
_exit(status);
|
|
8326
7700
|
|
|
@@ -8392,7 +7766,6 @@ var ASM_CONSTS = {
|
|
|
8392
7766
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8393
7767
|
return proxyToMainThread(45, 0, 1, index, gamepadState);
|
|
8394
7768
|
|
|
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
7769
|
// INVALID_PARAM is returned on a Gamepad index that never was there.
|
|
8397
7770
|
if (index < 0 || index >= JSEvents.lastGamepadState.length) return -5;
|
|
8398
7771
|
|
|
@@ -8420,7 +7793,6 @@ var ASM_CONSTS = {
|
|
|
8420
7793
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8421
7794
|
return proxyToMainThread(46, 0, 1);
|
|
8422
7795
|
|
|
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
7796
|
// N.B. Do not call emscripten_get_num_gamepads() unless having first called emscripten_sample_gamepad_data(), and that has returned EMSCRIPTEN_RESULT_SUCCESS.
|
|
8425
7797
|
// Otherwise the following line will throw an exception.
|
|
8426
7798
|
return JSEvents.lastGamepadState.length;
|
|
@@ -9340,17 +8712,10 @@ var ASM_CONSTS = {
|
|
|
9340
8712
|
GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name));
|
|
9341
8713
|
var _emscripten_glGetAttribLocation = _glGetAttribLocation;
|
|
9342
8714
|
|
|
9343
|
-
|
|
9344
|
-
var readI53FromU64 = (ptr) => {
|
|
9345
|
-
return HEAPU32[((ptr)>>2)] + HEAPU32[(((ptr)+(4))>>2)] * 4294967296;
|
|
9346
|
-
};
|
|
9347
8715
|
var writeI53ToI64 = (ptr, num) => {
|
|
9348
8716
|
HEAPU32[((ptr)>>2)] = num;
|
|
9349
8717
|
var lower = HEAPU32[((ptr)>>2)];
|
|
9350
8718
|
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
8719
|
};
|
|
9355
8720
|
|
|
9356
8721
|
|
|
@@ -11264,7 +10629,7 @@ var ASM_CONSTS = {
|
|
|
11264
10629
|
|
|
11265
10630
|
|
|
11266
10631
|
var abortOnCannotGrowMemory = (requestedSize) => {
|
|
11267
|
-
abort(
|
|
10632
|
+
abort('OOM');
|
|
11268
10633
|
};
|
|
11269
10634
|
var _emscripten_resize_heap = (requestedSize) => {
|
|
11270
10635
|
var oldSize = HEAPU8.length;
|
|
@@ -11286,7 +10651,6 @@ var ASM_CONSTS = {
|
|
|
11286
10651
|
if (navigator.getGamepads) return (JSEvents.lastGamepadState = navigator.getGamepads())
|
|
11287
10652
|
? 0 : -1;
|
|
11288
10653
|
} catch(e) {
|
|
11289
|
-
err(`navigator.getGamepads() exists, but failed to execute with exception ${e}. Disabling Gamepad access.`);
|
|
11290
10654
|
navigator.getGamepads = null; // Disable getGamepads() so that it won't be attempted to be used again.
|
|
11291
10655
|
}
|
|
11292
10656
|
return -1;
|
|
@@ -11537,7 +10901,6 @@ var ASM_CONSTS = {
|
|
|
11537
10901
|
JSEvents.keyEvent ||= _malloc(160);
|
|
11538
10902
|
|
|
11539
10903
|
var keyEventHandlerFunc = (e) => {
|
|
11540
|
-
assert(e);
|
|
11541
10904
|
|
|
11542
10905
|
var keyEventData = targetThread ? _malloc(160) : JSEvents.keyEvent; // This allocated block is passed as satellite data to the proxied function call, so the call frees up the data block when done.
|
|
11543
10906
|
HEAPF64[((keyEventData)>>3)] = e.timeStamp;
|
|
@@ -11610,7 +10973,6 @@ var ASM_CONSTS = {
|
|
|
11610
10973
|
|
|
11611
10974
|
|
|
11612
10975
|
var fillMouseEventData = (eventStruct, e, target) => {
|
|
11613
|
-
assert(eventStruct % 4 == 0);
|
|
11614
10976
|
HEAPF64[((eventStruct)>>3)] = e.timeStamp;
|
|
11615
10977
|
var idx = ((eventStruct)>>2);
|
|
11616
10978
|
HEAP32[idx + 2] = e.screenX;
|
|
@@ -11839,7 +11201,6 @@ var ASM_CONSTS = {
|
|
|
11839
11201
|
target = findEventTarget(target);
|
|
11840
11202
|
|
|
11841
11203
|
var touchEventHandlerFunc = (e) => {
|
|
11842
|
-
assert(e);
|
|
11843
11204
|
var t, touches = {}, et = e.touches;
|
|
11844
11205
|
// To ease marshalling different kinds of touches that browser reports (all touches are listed in e.touches,
|
|
11845
11206
|
// only changed touches in e.changedTouches, and touches on target at a.targetTouches), mark a boolean in
|
|
@@ -12095,7 +11456,6 @@ var ASM_CONSTS = {
|
|
|
12095
11456
|
|
|
12096
11457
|
var stringToAscii = (str, buffer) => {
|
|
12097
11458
|
for (var i = 0; i < str.length; ++i) {
|
|
12098
|
-
assert(str.charCodeAt(i) === (str.charCodeAt(i) & 0xff));
|
|
12099
11459
|
HEAP8[buffer++] = str.charCodeAt(i);
|
|
12100
11460
|
}
|
|
12101
11461
|
// Null-terminate the string
|
|
@@ -12304,7 +11664,6 @@ var ASM_CONSTS = {
|
|
|
12304
11664
|
};
|
|
12305
11665
|
|
|
12306
11666
|
var dynCall = (sig, ptr, args = []) => {
|
|
12307
|
-
assert(getWasmTableEntry(ptr), `missing table entry in dynCall: ${ptr}`);
|
|
12308
11667
|
var rtn = getWasmTableEntry(ptr)(...args);
|
|
12309
11668
|
return rtn;
|
|
12310
11669
|
};
|
|
@@ -12315,13 +11674,11 @@ var ASM_CONSTS = {
|
|
|
12315
11674
|
|
|
12316
11675
|
var getCFunc = (ident) => {
|
|
12317
11676
|
var func = Module['_' + ident]; // closure exported function
|
|
12318
|
-
assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported');
|
|
12319
11677
|
return func;
|
|
12320
11678
|
};
|
|
12321
11679
|
|
|
12322
11680
|
|
|
12323
11681
|
var writeArrayToMemory = (array, buffer) => {
|
|
12324
|
-
assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
|
|
12325
11682
|
HEAP8.set(array, buffer);
|
|
12326
11683
|
};
|
|
12327
11684
|
|
|
@@ -12364,7 +11721,6 @@ var ASM_CONSTS = {
|
|
|
12364
11721
|
var func = getCFunc(ident);
|
|
12365
11722
|
var cArgs = [];
|
|
12366
11723
|
var stack = 0;
|
|
12367
|
-
assert(returnType !== 'array', 'Return type should not be "array".');
|
|
12368
11724
|
if (args) {
|
|
12369
11725
|
for (var i = 0; i < args.length; i++) {
|
|
12370
11726
|
var converter = toC[argTypes[i]];
|
|
@@ -12392,11 +11748,17 @@ var ASM_CONSTS = {
|
|
|
12392
11748
|
* @param {Object=} opts
|
|
12393
11749
|
*/
|
|
12394
11750
|
var cwrap = (ident, returnType, argTypes, opts) => {
|
|
11751
|
+
// When the function takes numbers and returns a number, we can just return
|
|
11752
|
+
// the original function
|
|
11753
|
+
var numericArgs = !argTypes || argTypes.every((type) => type === 'number' || type === 'boolean');
|
|
11754
|
+
var numericRet = returnType !== 'string';
|
|
11755
|
+
if (numericRet && numericArgs && !opts) {
|
|
11756
|
+
return getCFunc(ident);
|
|
11757
|
+
}
|
|
12395
11758
|
return (...args) => ccall(ident, returnType, argTypes, args, opts);
|
|
12396
11759
|
};
|
|
12397
11760
|
|
|
12398
11761
|
var uleb128Encode = (n, target) => {
|
|
12399
|
-
assert(n < 16384);
|
|
12400
11762
|
if (n < 128) {
|
|
12401
11763
|
target.push(n);
|
|
12402
11764
|
} else {
|
|
@@ -12418,7 +11780,6 @@ var ASM_CONSTS = {
|
|
|
12418
11780
|
results: sig[0] == 'v' ? [] : [typeNames[sig[0]]]
|
|
12419
11781
|
};
|
|
12420
11782
|
for (var i = 1; i < sig.length; ++i) {
|
|
12421
|
-
assert(sig[i] in typeNames, 'invalid signature char: ' + sig[i]);
|
|
12422
11783
|
type.parameters.push(typeNames[sig[i]]);
|
|
12423
11784
|
}
|
|
12424
11785
|
return type;
|
|
@@ -12440,7 +11801,6 @@ var ASM_CONSTS = {
|
|
|
12440
11801
|
target.push(0x60 /* form: func */);
|
|
12441
11802
|
uleb128Encode(sigParam.length, target);
|
|
12442
11803
|
for (var i = 0; i < sigParam.length; ++i) {
|
|
12443
|
-
assert(sigParam[i] in typeCodes, 'invalid signature char: ' + sigParam[i]);
|
|
12444
11804
|
target.push(typeCodes[sigParam[i]]);
|
|
12445
11805
|
}
|
|
12446
11806
|
|
|
@@ -12556,7 +11916,6 @@ var ASM_CONSTS = {
|
|
|
12556
11916
|
|
|
12557
11917
|
/** @param {string=} sig */
|
|
12558
11918
|
var addFunction = (func, sig) => {
|
|
12559
|
-
assert(typeof func != 'undefined');
|
|
12560
11919
|
// Check if the function is already in the table, to ensure each function
|
|
12561
11920
|
// gets a unique index.
|
|
12562
11921
|
var rtn = getFunctionAddress(func);
|
|
@@ -12576,7 +11935,6 @@ var ASM_CONSTS = {
|
|
|
12576
11935
|
if (!(err instanceof TypeError)) {
|
|
12577
11936
|
throw err;
|
|
12578
11937
|
}
|
|
12579
|
-
assert(typeof sig != 'undefined', 'Missing signature argument to addFunction: ' + func);
|
|
12580
11938
|
var wrapped = convertJsFunctionToWasm(func, sig);
|
|
12581
11939
|
setWasmTableEntry(ret, wrapped);
|
|
12582
11940
|
}
|
|
@@ -12602,9 +11960,15 @@ PThread.init();;
|
|
|
12602
11960
|
// Set module methods based on EXPORTED_RUNTIME_METHODS
|
|
12603
11961
|
;
|
|
12604
11962
|
|
|
11963
|
+
// This error may happen quite a bit. To avoid overhead we reuse it (and
|
|
11964
|
+
// suffer a lack of stack info).
|
|
11965
|
+
MEMFS.doesNotExistError = new FS.ErrnoError(44);
|
|
11966
|
+
/** @suppress {checkTypes} */
|
|
11967
|
+
MEMFS.doesNotExistError.stack = '<generic error, no stack>';
|
|
11968
|
+
;
|
|
11969
|
+
|
|
12605
11970
|
// exports
|
|
12606
11971
|
Module['requestFullscreen'] = Browser.requestFullscreen;
|
|
12607
|
-
Module['requestFullScreen'] = Browser.requestFullScreen;
|
|
12608
11972
|
Module['setCanvasSize'] = Browser.setCanvasSize;
|
|
12609
11973
|
Module['getUserMedia'] = Browser.getUserMedia;
|
|
12610
11974
|
Module['createContext'] = Browser.createContext;
|
|
@@ -12705,9 +12069,6 @@ var proxiedFunctionTable = [
|
|
|
12705
12069
|
_fd_write
|
|
12706
12070
|
];
|
|
12707
12071
|
|
|
12708
|
-
function checkIncomingModuleAPI() {
|
|
12709
|
-
ignoredModuleProp('fetchSettings');
|
|
12710
|
-
}
|
|
12711
12072
|
var wasmImports;
|
|
12712
12073
|
function assignWasmImports() {
|
|
12713
12074
|
wasmImports = {
|
|
@@ -13508,73 +12869,67 @@ function assignWasmImports() {
|
|
|
13508
12869
|
};
|
|
13509
12870
|
}
|
|
13510
12871
|
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);
|
|
12872
|
+
var ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])();
|
|
12873
|
+
var _screenshot = Module['_screenshot'] = (a0) => (_screenshot = Module['_screenshot'] = wasmExports['screenshot'])(a0);
|
|
12874
|
+
var _buttonPress = Module['_buttonPress'] = (a0) => (_buttonPress = Module['_buttonPress'] = wasmExports['buttonPress'])(a0);
|
|
12875
|
+
var _buttonUnpress = Module['_buttonUnpress'] = (a0) => (_buttonUnpress = Module['_buttonUnpress'] = wasmExports['buttonUnpress'])(a0);
|
|
12876
|
+
var _toggleRewind = Module['_toggleRewind'] = (a0) => (_toggleRewind = Module['_toggleRewind'] = wasmExports['toggleRewind'])(a0);
|
|
12877
|
+
var _setVolume = Module['_setVolume'] = (a0) => (_setVolume = Module['_setVolume'] = wasmExports['setVolume'])(a0);
|
|
12878
|
+
var _getVolume = Module['_getVolume'] = () => (_getVolume = Module['_getVolume'] = wasmExports['getVolume'])();
|
|
12879
|
+
var _getMainLoopTimingMode = Module['_getMainLoopTimingMode'] = () => (_getMainLoopTimingMode = Module['_getMainLoopTimingMode'] = wasmExports['getMainLoopTimingMode'])();
|
|
12880
|
+
var _getMainLoopTimingValue = Module['_getMainLoopTimingValue'] = () => (_getMainLoopTimingValue = Module['_getMainLoopTimingValue'] = wasmExports['getMainLoopTimingValue'])();
|
|
12881
|
+
var _setMainLoopTiming = Module['_setMainLoopTiming'] = (a0, a1) => (_setMainLoopTiming = Module['_setMainLoopTiming'] = wasmExports['setMainLoopTiming'])(a0, a1);
|
|
12882
|
+
var _setFastForwardMultiplier = Module['_setFastForwardMultiplier'] = (a0) => (_setFastForwardMultiplier = Module['_setFastForwardMultiplier'] = wasmExports['setFastForwardMultiplier'])(a0);
|
|
12883
|
+
var _getFastForwardMultiplier = Module['_getFastForwardMultiplier'] = () => (_getFastForwardMultiplier = Module['_getFastForwardMultiplier'] = wasmExports['getFastForwardMultiplier'])();
|
|
12884
|
+
var _quitGame = Module['_quitGame'] = () => (_quitGame = Module['_quitGame'] = wasmExports['quitGame'])();
|
|
12885
|
+
var _free = (a0) => (_free = wasmExports['free'])(a0);
|
|
12886
|
+
var _quitMgba = Module['_quitMgba'] = () => (_quitMgba = Module['_quitMgba'] = wasmExports['quitMgba'])();
|
|
12887
|
+
var _quickReload = Module['_quickReload'] = () => (_quickReload = Module['_quickReload'] = wasmExports['quickReload'])();
|
|
12888
|
+
var _pauseGame = Module['_pauseGame'] = () => (_pauseGame = Module['_pauseGame'] = wasmExports['pauseGame'])();
|
|
12889
|
+
var _resumeGame = Module['_resumeGame'] = () => (_resumeGame = Module['_resumeGame'] = wasmExports['resumeGame'])();
|
|
12890
|
+
var _setEventEnable = Module['_setEventEnable'] = (a0) => (_setEventEnable = Module['_setEventEnable'] = wasmExports['setEventEnable'])(a0);
|
|
12891
|
+
var _bindKey = Module['_bindKey'] = (a0, a1) => (_bindKey = Module['_bindKey'] = wasmExports['bindKey'])(a0, a1);
|
|
12892
|
+
var _saveState = Module['_saveState'] = (a0) => (_saveState = Module['_saveState'] = wasmExports['saveState'])(a0);
|
|
12893
|
+
var _loadState = Module['_loadState'] = (a0) => (_loadState = Module['_loadState'] = wasmExports['loadState'])(a0);
|
|
12894
|
+
var _autoLoadCheats = Module['_autoLoadCheats'] = () => (_autoLoadCheats = Module['_autoLoadCheats'] = wasmExports['autoLoadCheats'])();
|
|
12895
|
+
var _loadGame = Module['_loadGame'] = (a0, a1) => (_loadGame = Module['_loadGame'] = wasmExports['loadGame'])(a0, a1);
|
|
12896
|
+
var _saveStateSlot = Module['_saveStateSlot'] = (a0, a1) => (_saveStateSlot = Module['_saveStateSlot'] = wasmExports['saveStateSlot'])(a0, a1);
|
|
12897
|
+
var _loadStateSlot = Module['_loadStateSlot'] = (a0, a1) => (_loadStateSlot = Module['_loadStateSlot'] = wasmExports['loadStateSlot'])(a0, a1);
|
|
12898
|
+
var _addCoreCallbacks = Module['_addCoreCallbacks'] = (a0, a1, a2, a3, a4, a5) => (_addCoreCallbacks = Module['_addCoreCallbacks'] = wasmExports['addCoreCallbacks'])(a0, a1, a2, a3, a4, a5);
|
|
12899
|
+
var _setIntegerCoreSetting = Module['_setIntegerCoreSetting'] = (a0, a1) => (_setIntegerCoreSetting = Module['_setIntegerCoreSetting'] = wasmExports['setIntegerCoreSetting'])(a0, a1);
|
|
12900
|
+
var _setupConstants = Module['_setupConstants'] = () => (_setupConstants = Module['_setupConstants'] = wasmExports['setupConstants'])();
|
|
12901
|
+
var _main = Module['_main'] = (a0, a1) => (_main = Module['_main'] = wasmExports['main'])(a0, a1);
|
|
12902
|
+
var _malloc = (a0) => (_malloc = wasmExports['malloc'])(a0);
|
|
13544
12903
|
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'])();
|
|
12904
|
+
var __emscripten_tls_init = () => (__emscripten_tls_init = wasmExports['_emscripten_tls_init'])();
|
|
12905
|
+
var _emscripten_builtin_memalign = (a0, a1) => (_emscripten_builtin_memalign = wasmExports['emscripten_builtin_memalign'])(a0, a1);
|
|
12906
|
+
var __emscripten_run_callback_on_thread = (a0, a1, a2, a3, a4) => (__emscripten_run_callback_on_thread = wasmExports['_emscripten_run_callback_on_thread'])(a0, a1, a2, a3, a4);
|
|
12907
|
+
var __emscripten_thread_init = (a0, a1, a2, a3, a4, a5) => (__emscripten_thread_init = wasmExports['_emscripten_thread_init'])(a0, a1, a2, a3, a4, a5);
|
|
12908
|
+
var __emscripten_thread_crashed = () => (__emscripten_thread_crashed = wasmExports['_emscripten_thread_crashed'])();
|
|
12909
|
+
var __emscripten_run_on_main_thread_js = (a0, a1, a2, a3, a4) => (__emscripten_run_on_main_thread_js = wasmExports['_emscripten_run_on_main_thread_js'])(a0, a1, a2, a3, a4);
|
|
12910
|
+
var __emscripten_thread_free_data = (a0) => (__emscripten_thread_free_data = wasmExports['_emscripten_thread_free_data'])(a0);
|
|
12911
|
+
var __emscripten_thread_exit = (a0) => (__emscripten_thread_exit = wasmExports['_emscripten_thread_exit'])(a0);
|
|
12912
|
+
var __emscripten_check_mailbox = () => (__emscripten_check_mailbox = wasmExports['_emscripten_check_mailbox'])();
|
|
12913
|
+
var _setThrew = (a0, a1) => (_setThrew = wasmExports['setThrew'])(a0, a1);
|
|
13558
12914
|
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
12915
|
var __emscripten_stack_restore = (a0) => (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])(a0);
|
|
13561
12916
|
var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0);
|
|
13562
12917
|
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'] =
|
|
12918
|
+
var _GBAInputInfo = Module['_GBAInputInfo'] = 122320;
|
|
12919
|
+
var _binaryName = Module['_binaryName'] = 198352;
|
|
12920
|
+
var _projectName = Module['_projectName'] = 198356;
|
|
12921
|
+
var _projectVersion = Module['_projectVersion'] = 198360;
|
|
12922
|
+
var _gitCommit = Module['_gitCommit'] = 198336;
|
|
12923
|
+
var _gitCommitShort = Module['_gitCommitShort'] = 198340;
|
|
12924
|
+
var _gitBranch = Module['_gitBranch'] = 198344;
|
|
12925
|
+
var _gitRevision = Module['_gitRevision'] = 198348;
|
|
12926
|
+
var _GBIORegisterNames = Module['_GBIORegisterNames'] = 60688;
|
|
12927
|
+
var _GBSavestateMagic = Module['_GBSavestateMagic'] = 75952;
|
|
12928
|
+
var _GBSavestateVersion = Module['_GBSavestateVersion'] = 75956;
|
|
12929
|
+
var _GBA_LUX_LEVELS = Module['_GBA_LUX_LEVELS'] = 105424;
|
|
12930
|
+
var _GBAVideoObjSizes = Module['_GBAVideoObjSizes'] = 149760;
|
|
12931
|
+
var _GBASavestateMagic = Module['_GBASavestateMagic'] = 149536;
|
|
12932
|
+
var _GBASavestateVersion = Module['_GBASavestateVersion'] = 149540;
|
|
13578
12933
|
function invoke_iiiii(index,a1,a2,a3,a4) {
|
|
13579
12934
|
var sp = stackSave();
|
|
13580
12935
|
try {
|
|
@@ -13693,316 +13048,9 @@ Module['cwrap'] = cwrap;
|
|
|
13693
13048
|
Module['addFunction'] = addFunction;
|
|
13694
13049
|
Module['removeFunction'] = removeFunction;
|
|
13695
13050
|
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
13051
|
|
|
14000
13052
|
|
|
14001
|
-
var calledRun;
|
|
14002
|
-
|
|
14003
13053
|
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
13054
|
|
|
14007
13055
|
var entryFunction = _main;
|
|
14008
13056
|
|
|
@@ -14021,17 +13069,6 @@ function callMain() {
|
|
|
14021
13069
|
}
|
|
14022
13070
|
}
|
|
14023
13071
|
|
|
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
13072
|
function run() {
|
|
14036
13073
|
|
|
14037
13074
|
if (runDependencies > 0) {
|
|
@@ -14045,8 +13082,6 @@ function run() {
|
|
|
14045
13082
|
return;
|
|
14046
13083
|
}
|
|
14047
13084
|
|
|
14048
|
-
stackCheckInit();
|
|
14049
|
-
|
|
14050
13085
|
preRun();
|
|
14051
13086
|
|
|
14052
13087
|
// a preRun added a dependency, run will be called later
|
|
@@ -14058,8 +13093,6 @@ function run() {
|
|
|
14058
13093
|
function doRun() {
|
|
14059
13094
|
// run may have just been called through dependencies being fulfilled just in this very frame,
|
|
14060
13095
|
// or while the async setStatus time below was happening
|
|
14061
|
-
assert(!calledRun);
|
|
14062
|
-
calledRun = true;
|
|
14063
13096
|
Module['calledRun'] = true;
|
|
14064
13097
|
|
|
14065
13098
|
if (ABORT) return;
|
|
@@ -14070,9 +13103,8 @@ function run() {
|
|
|
14070
13103
|
|
|
14071
13104
|
readyPromiseResolve(Module);
|
|
14072
13105
|
Module['onRuntimeInitialized']?.();
|
|
14073
|
-
consumedModuleProp('onRuntimeInitialized');
|
|
14074
13106
|
|
|
14075
|
-
var noInitialRun = Module['noInitialRun'];
|
|
13107
|
+
var noInitialRun = Module['noInitialRun'];
|
|
14076
13108
|
if (!noInitialRun) callMain();
|
|
14077
13109
|
|
|
14078
13110
|
postRun();
|
|
@@ -14088,46 +13120,6 @@ function run() {
|
|
|
14088
13120
|
{
|
|
14089
13121
|
doRun();
|
|
14090
13122
|
}
|
|
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
13123
|
}
|
|
14132
13124
|
|
|
14133
13125
|
if (Module['preInit']) {
|
|
@@ -14136,7 +13128,6 @@ if (Module['preInit']) {
|
|
|
14136
13128
|
Module['preInit'].pop()();
|
|
14137
13129
|
}
|
|
14138
13130
|
}
|
|
14139
|
-
consumedModuleProp('preInit');
|
|
14140
13131
|
|
|
14141
13132
|
run();
|
|
14142
13133
|
|
|
@@ -14151,21 +13142,6 @@ run();
|
|
|
14151
13142
|
|
|
14152
13143
|
moduleRtn = readyPromise;
|
|
14153
13144
|
|
|
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
13145
|
// end include: postamble_modularize.js
|
|
14170
13146
|
|
|
14171
13147
|
|
|
@@ -14174,15 +13150,6 @@ for (const prop of Object.keys(Module)) {
|
|
|
14174
13150
|
}
|
|
14175
13151
|
);
|
|
14176
13152
|
})();
|
|
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
13153
|
export default mGBA;
|
|
14187
13154
|
var isPthread = globalThis.self?.name?.startsWith('em-pthread');
|
|
14188
13155
|
// When running as a pthread, construct a new instance on startup
|