@thenick775/mgba-wasm 2.1.1-beta.1 → 2.1.1-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mgba.d.ts +1 -0
- package/dist/mgba.js +134 -1162
- 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
|
|
@@ -499,6 +494,9 @@ Module.setCoreSettings = (coreSettings) => {
|
|
|
499
494
|
|
|
500
495
|
if (coreSettings.threadedVideo !== undefined)
|
|
501
496
|
setIntegerCoreSetting('threadedVideo', coreSettings.threadedVideo);
|
|
497
|
+
|
|
498
|
+
if (coreSettings.rewindEnable !== undefined)
|
|
499
|
+
setIntegerCoreSetting('rewindEnable', coreSettings.rewindEnable);
|
|
502
500
|
};
|
|
503
501
|
// end include: /home/mgba/src/src/platform/wasm/pre.js
|
|
504
502
|
|
|
@@ -528,12 +526,6 @@ function locateFile(path) {
|
|
|
528
526
|
// Hooks that are implemented differently in different runtime environments.
|
|
529
527
|
var readAsync, readBinary;
|
|
530
528
|
|
|
531
|
-
if (ENVIRONMENT_IS_SHELL) {
|
|
532
|
-
|
|
533
|
-
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?)');
|
|
534
|
-
|
|
535
|
-
} else
|
|
536
|
-
|
|
537
529
|
// Note that this includes Node.js workers when relevant (pthreads is enabled).
|
|
538
530
|
// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
|
|
539
531
|
// ENVIRONMENT_IS_NODE.
|
|
@@ -560,8 +552,6 @@ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
|
|
|
560
552
|
scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1);
|
|
561
553
|
}
|
|
562
554
|
|
|
563
|
-
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?)');
|
|
564
|
-
|
|
565
555
|
{
|
|
566
556
|
// include: web_or_worker_shell_read.js
|
|
567
557
|
if (ENVIRONMENT_IS_WORKER) {
|
|
@@ -575,7 +565,6 @@ if (ENVIRONMENT_IS_WORKER) {
|
|
|
575
565
|
}
|
|
576
566
|
|
|
577
567
|
readAsync = async (url) => {
|
|
578
|
-
assert(!isFileURI(url), "readAsync does not work with file:// URLs");
|
|
579
568
|
var response = await fetch(url, { credentials: 'same-origin' });
|
|
580
569
|
if (response.ok) {
|
|
581
570
|
return response.arrayBuffer();
|
|
@@ -586,7 +575,6 @@ if (ENVIRONMENT_IS_WORKER) {
|
|
|
586
575
|
}
|
|
587
576
|
} else
|
|
588
577
|
{
|
|
589
|
-
throw new Error('environment detection error');
|
|
590
578
|
}
|
|
591
579
|
|
|
592
580
|
var out = Module['print'] || console.log.bind(console);
|
|
@@ -597,49 +585,17 @@ Object.assign(Module, moduleOverrides);
|
|
|
597
585
|
// Free the object hierarchy contained in the overrides, this lets the GC
|
|
598
586
|
// reclaim data used.
|
|
599
587
|
moduleOverrides = null;
|
|
600
|
-
checkIncomingModuleAPI();
|
|
601
588
|
|
|
602
589
|
// Emit code to handle expected values on the Module object. This applies Module.x
|
|
603
590
|
// to the proper local x. This has two benefits: first, we only emit it if it is
|
|
604
591
|
// expected to arrive, and second, by using a local everywhere else that can be
|
|
605
592
|
// minified.
|
|
606
593
|
|
|
607
|
-
if (Module['arguments']) arguments_ = Module['arguments'];
|
|
594
|
+
if (Module['arguments']) arguments_ = Module['arguments'];
|
|
608
595
|
|
|
609
|
-
if (Module['thisProgram']) thisProgram = Module['thisProgram'];
|
|
596
|
+
if (Module['thisProgram']) thisProgram = Module['thisProgram'];
|
|
610
597
|
|
|
611
598
|
// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
|
|
612
|
-
// Assertions on removed incoming Module JS APIs.
|
|
613
|
-
assert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
614
|
-
assert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');
|
|
615
|
-
assert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');
|
|
616
|
-
assert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');
|
|
617
|
-
assert(typeof Module['read'] == 'undefined', 'Module.read option was removed');
|
|
618
|
-
assert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');
|
|
619
|
-
assert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');
|
|
620
|
-
assert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');
|
|
621
|
-
assert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');
|
|
622
|
-
legacyModuleProp('asm', 'wasmExports');
|
|
623
|
-
legacyModuleProp('readAsync', 'readAsync');
|
|
624
|
-
legacyModuleProp('readBinary', 'readBinary');
|
|
625
|
-
legacyModuleProp('setWindowTitle', 'setWindowTitle');
|
|
626
|
-
var IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js';
|
|
627
|
-
var PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js';
|
|
628
|
-
var WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js';
|
|
629
|
-
var FETCHFS = 'FETCHFS is no longer included by default; build with -lfetchfs.js';
|
|
630
|
-
var ICASEFS = 'ICASEFS is no longer included by default; build with -licasefs.js';
|
|
631
|
-
var JSFILEFS = 'JSFILEFS is no longer included by default; build with -ljsfilefs.js';
|
|
632
|
-
var OPFS = 'OPFS is no longer included by default; build with -lopfs.js';
|
|
633
|
-
|
|
634
|
-
var NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js';
|
|
635
|
-
|
|
636
|
-
assert(
|
|
637
|
-
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)');
|
|
638
|
-
|
|
639
|
-
assert(!ENVIRONMENT_IS_NODE, 'node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable.');
|
|
640
|
-
|
|
641
|
-
assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.');
|
|
642
|
-
|
|
643
599
|
// end include: shell.js
|
|
644
600
|
|
|
645
601
|
// include: preamble.js
|
|
@@ -653,11 +609,7 @@ assert(!ENVIRONMENT_IS_SHELL, 'shell environment detected but not enabled at bui
|
|
|
653
609
|
// An online HTML version (which may be of a different version of Emscripten)
|
|
654
610
|
// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
|
|
655
611
|
|
|
656
|
-
var wasmBinary = Module['wasmBinary'];
|
|
657
|
-
|
|
658
|
-
if (typeof WebAssembly != 'object') {
|
|
659
|
-
err('no native wasm support detected');
|
|
660
|
-
}
|
|
612
|
+
var wasmBinary = Module['wasmBinary'];
|
|
661
613
|
|
|
662
614
|
// Wasm globals
|
|
663
615
|
|
|
@@ -686,13 +638,13 @@ var EXITSTATUS;
|
|
|
686
638
|
/** @type {function(*, string=)} */
|
|
687
639
|
function assert(condition, text) {
|
|
688
640
|
if (!condition) {
|
|
689
|
-
|
|
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);
|
|
690
645
|
}
|
|
691
646
|
}
|
|
692
647
|
|
|
693
|
-
// We used to include malloc/free by default in the past. Show a helpful error in
|
|
694
|
-
// builds with assertions.
|
|
695
|
-
|
|
696
648
|
// Memory management
|
|
697
649
|
|
|
698
650
|
var HEAP,
|
|
@@ -729,176 +681,10 @@ var isFileURI = (filename) => filename.startsWith('file://');
|
|
|
729
681
|
|
|
730
682
|
// include: runtime_shared.js
|
|
731
683
|
// include: runtime_stack_check.js
|
|
732
|
-
// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
|
|
733
|
-
function writeStackCookie() {
|
|
734
|
-
var max = _emscripten_stack_get_end();
|
|
735
|
-
assert((max & 3) == 0);
|
|
736
|
-
// If the stack ends at address zero we write our cookies 4 bytes into the
|
|
737
|
-
// stack. This prevents interference with SAFE_HEAP and ASAN which also
|
|
738
|
-
// monitor writes to address zero.
|
|
739
|
-
if (max == 0) {
|
|
740
|
-
max += 4;
|
|
741
|
-
}
|
|
742
|
-
// The stack grow downwards towards _emscripten_stack_get_end.
|
|
743
|
-
// We write cookies to the final two words in the stack and detect if they are
|
|
744
|
-
// ever overwritten.
|
|
745
|
-
HEAPU32[((max)>>2)] = 0x02135467;
|
|
746
|
-
HEAPU32[(((max)+(4))>>2)] = 0x89BACDFE;
|
|
747
|
-
// Also test the global address 0 for integrity.
|
|
748
|
-
HEAPU32[((0)>>2)] = 1668509029;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
function checkStackCookie() {
|
|
752
|
-
if (ABORT) return;
|
|
753
|
-
var max = _emscripten_stack_get_end();
|
|
754
|
-
// See writeStackCookie().
|
|
755
|
-
if (max == 0) {
|
|
756
|
-
max += 4;
|
|
757
|
-
}
|
|
758
|
-
var cookie1 = HEAPU32[((max)>>2)];
|
|
759
|
-
var cookie2 = HEAPU32[(((max)+(4))>>2)];
|
|
760
|
-
if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {
|
|
761
|
-
abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
|
|
762
|
-
}
|
|
763
|
-
// Also test the global address 0 for integrity.
|
|
764
|
-
if (HEAPU32[((0)>>2)] != 0x63736d65 /* 'emsc' */) {
|
|
765
|
-
abort('Runtime error: The application has corrupted its heap memory area (address zero)!');
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
684
|
// end include: runtime_stack_check.js
|
|
769
685
|
// include: runtime_exceptions.js
|
|
770
686
|
// end include: runtime_exceptions.js
|
|
771
687
|
// include: runtime_debug.js
|
|
772
|
-
// Endianness check
|
|
773
|
-
(() => {
|
|
774
|
-
var h16 = new Int16Array(1);
|
|
775
|
-
var h8 = new Int8Array(h16.buffer);
|
|
776
|
-
h16[0] = 0x6373;
|
|
777
|
-
if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';
|
|
778
|
-
})();
|
|
779
|
-
|
|
780
|
-
if (Module['ENVIRONMENT']) {
|
|
781
|
-
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)');
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
function legacyModuleProp(prop, newName, incoming=true) {
|
|
785
|
-
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
786
|
-
Object.defineProperty(Module, prop, {
|
|
787
|
-
configurable: true,
|
|
788
|
-
get() {
|
|
789
|
-
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)' : '';
|
|
790
|
-
abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra);
|
|
791
|
-
|
|
792
|
-
}
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
function consumedModuleProp(prop) {
|
|
798
|
-
if (!Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
799
|
-
Object.defineProperty(Module, prop, {
|
|
800
|
-
configurable: true,
|
|
801
|
-
set() {
|
|
802
|
-
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'`);
|
|
803
|
-
|
|
804
|
-
}
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
function ignoredModuleProp(prop) {
|
|
810
|
-
if (Object.getOwnPropertyDescriptor(Module, prop)) {
|
|
811
|
-
abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
// forcing the filesystem exports a few things by default
|
|
816
|
-
function isExportedByForceFilesystem(name) {
|
|
817
|
-
return name === 'FS_createPath' ||
|
|
818
|
-
name === 'FS_createDataFile' ||
|
|
819
|
-
name === 'FS_createPreloadedFile' ||
|
|
820
|
-
name === 'FS_unlink' ||
|
|
821
|
-
name === 'addRunDependency' ||
|
|
822
|
-
// The old FS has some functionality that WasmFS lacks.
|
|
823
|
-
name === 'FS_createLazyFile' ||
|
|
824
|
-
name === 'FS_createDevice' ||
|
|
825
|
-
name === 'removeRunDependency';
|
|
826
|
-
}
|
|
827
|
-
|
|
828
|
-
/**
|
|
829
|
-
* Intercept access to a global symbol. This enables us to give informative
|
|
830
|
-
* warnings/errors when folks attempt to use symbols they did not include in
|
|
831
|
-
* their build, or no symbols that no longer exist.
|
|
832
|
-
*/
|
|
833
|
-
function hookGlobalSymbolAccess(sym, func) {
|
|
834
|
-
if (typeof globalThis != 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) {
|
|
835
|
-
Object.defineProperty(globalThis, sym, {
|
|
836
|
-
configurable: true,
|
|
837
|
-
get() {
|
|
838
|
-
func();
|
|
839
|
-
return undefined;
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
function missingGlobal(sym, msg) {
|
|
846
|
-
hookGlobalSymbolAccess(sym, () => {
|
|
847
|
-
warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`);
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
missingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');
|
|
852
|
-
missingGlobal('asm', 'Please use wasmExports instead');
|
|
853
|
-
|
|
854
|
-
function missingLibrarySymbol(sym) {
|
|
855
|
-
hookGlobalSymbolAccess(sym, () => {
|
|
856
|
-
// Can't `abort()` here because it would break code that does runtime
|
|
857
|
-
// checks. e.g. `if (typeof SDL === 'undefined')`.
|
|
858
|
-
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`;
|
|
859
|
-
// DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
|
|
860
|
-
// library.js, which means $name for a JS name with no prefix, or name
|
|
861
|
-
// for a JS name like _name.
|
|
862
|
-
var librarySymbol = sym;
|
|
863
|
-
if (!librarySymbol.startsWith('_')) {
|
|
864
|
-
librarySymbol = '$' + sym;
|
|
865
|
-
}
|
|
866
|
-
msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;
|
|
867
|
-
if (isExportedByForceFilesystem(sym)) {
|
|
868
|
-
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
|
|
869
|
-
}
|
|
870
|
-
warnOnce(msg);
|
|
871
|
-
});
|
|
872
|
-
|
|
873
|
-
// Any symbol that is not included from the JS library is also (by definition)
|
|
874
|
-
// not exported on the Module object.
|
|
875
|
-
unexportedRuntimeSymbol(sym);
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
function unexportedRuntimeSymbol(sym) {
|
|
879
|
-
if (ENVIRONMENT_IS_PTHREAD) {
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
if (!Object.getOwnPropertyDescriptor(Module, sym)) {
|
|
883
|
-
Object.defineProperty(Module, sym, {
|
|
884
|
-
configurable: true,
|
|
885
|
-
get() {
|
|
886
|
-
var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
|
|
887
|
-
if (isExportedByForceFilesystem(sym)) {
|
|
888
|
-
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
|
|
889
|
-
}
|
|
890
|
-
abort(msg);
|
|
891
|
-
}
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
// Used by XXXXX_DEBUG settings to output debug messages.
|
|
897
|
-
function dbg(...args) {
|
|
898
|
-
// TODO(sbc): Make this configurable somehow. Its not always convenient for
|
|
899
|
-
// logging to show up as warnings.
|
|
900
|
-
console.warn(...args);
|
|
901
|
-
}
|
|
902
688
|
// end include: runtime_debug.js
|
|
903
689
|
// include: memoryprofiler.js
|
|
904
690
|
// end include: memoryprofiler.js
|
|
@@ -907,10 +693,6 @@ function dbg(...args) {
|
|
|
907
693
|
// This code runs only on pthread web workers and handles pthread setup
|
|
908
694
|
// and communication with the main thread via postMessage.
|
|
909
695
|
|
|
910
|
-
// Unique ID of the current pthread worker (zero on non-pthread-workers
|
|
911
|
-
// including the main thread).
|
|
912
|
-
var workerID = 0;
|
|
913
|
-
|
|
914
696
|
if (ENVIRONMENT_IS_PTHREAD) {
|
|
915
697
|
var wasmModuleReceived;
|
|
916
698
|
|
|
@@ -924,7 +706,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
924
706
|
|
|
925
707
|
if (!Module['printErr'])
|
|
926
708
|
err = threadPrintErr;
|
|
927
|
-
dbg = threadPrintErr;
|
|
928
709
|
function threadAlert(...args) {
|
|
929
710
|
var text = args.join(' ');
|
|
930
711
|
postMessage({cmd: 'alert', text, threadId: _pthread_self()});
|
|
@@ -941,7 +722,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
941
722
|
//dbg('msgData: ' + Object.keys(msgData));
|
|
942
723
|
var cmd = msgData.cmd;
|
|
943
724
|
if (cmd === 'load') { // Preload command that is called once per worker to parse and load the Emscripten code.
|
|
944
|
-
workerID = msgData.workerID;
|
|
945
725
|
|
|
946
726
|
// Until we initialize the runtime, queue up any further incoming messages.
|
|
947
727
|
let messageQueue = [];
|
|
@@ -980,7 +760,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
980
760
|
|
|
981
761
|
wasmModuleReceived(msgData.wasmModule);
|
|
982
762
|
} else if (cmd === 'run') {
|
|
983
|
-
assert(msgData.pthread_ptr);
|
|
984
763
|
// Call inside JS module to set up the stack frame for this pthread in JS module scope.
|
|
985
764
|
// This needs to be the first thing that we do, as we cannot call to any C/C++ functions
|
|
986
765
|
// until the thread stack is initialized.
|
|
@@ -1023,8 +802,6 @@ if (ENVIRONMENT_IS_PTHREAD) {
|
|
|
1023
802
|
err(msgData);
|
|
1024
803
|
}
|
|
1025
804
|
} catch(ex) {
|
|
1026
|
-
err(`worker: onmessage() captured an uncaught exception: ${ex}`);
|
|
1027
|
-
if (ex?.stack) err(ex.stack);
|
|
1028
805
|
__emscripten_thread_crashed();
|
|
1029
806
|
throw ex;
|
|
1030
807
|
}
|
|
@@ -1051,11 +828,6 @@ function updateMemoryViews() {
|
|
|
1051
828
|
}
|
|
1052
829
|
|
|
1053
830
|
// end include: runtime_shared.js
|
|
1054
|
-
assert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')
|
|
1055
|
-
|
|
1056
|
-
assert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined,
|
|
1057
|
-
'JS engine does not provide full typed array support');
|
|
1058
|
-
|
|
1059
831
|
// In non-standalone/normal mode, we create the memory here.
|
|
1060
832
|
// include: runtime_init_memory.js
|
|
1061
833
|
// Create the wasm memory. (Note: this only applies if IMPORTED_MEMORY is defined)
|
|
@@ -1068,9 +840,8 @@ if (!ENVIRONMENT_IS_PTHREAD) {
|
|
|
1068
840
|
wasmMemory = Module['wasmMemory'];
|
|
1069
841
|
} else
|
|
1070
842
|
{
|
|
1071
|
-
var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 268435456;
|
|
843
|
+
var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 268435456;
|
|
1072
844
|
|
|
1073
|
-
assert(INITIAL_MEMORY >= 65536, 'INITIAL_MEMORY should be larger than STACK_SIZE, was ' + INITIAL_MEMORY + '! (STACK_SIZE=' + 65536 + ')');
|
|
1074
845
|
/** @suppress {checkTypes} */
|
|
1075
846
|
wasmMemory = new WebAssembly.Memory({
|
|
1076
847
|
'initial': INITIAL_MEMORY / 65536,
|
|
@@ -1085,25 +856,20 @@ if (!ENVIRONMENT_IS_PTHREAD) {
|
|
|
1085
856
|
// end include: runtime_init_memory.js
|
|
1086
857
|
|
|
1087
858
|
function preRun() {
|
|
1088
|
-
assert(!ENVIRONMENT_IS_PTHREAD); // PThreads reuse the runtime from the main thread.
|
|
1089
859
|
if (Module['preRun']) {
|
|
1090
860
|
if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
|
|
1091
861
|
while (Module['preRun'].length) {
|
|
1092
862
|
addOnPreRun(Module['preRun'].shift());
|
|
1093
863
|
}
|
|
1094
864
|
}
|
|
1095
|
-
consumedModuleProp('preRun');
|
|
1096
865
|
callRuntimeCallbacks(onPreRuns);
|
|
1097
866
|
}
|
|
1098
867
|
|
|
1099
868
|
function initRuntime() {
|
|
1100
|
-
assert(!runtimeInitialized);
|
|
1101
869
|
runtimeInitialized = true;
|
|
1102
870
|
|
|
1103
871
|
if (ENVIRONMENT_IS_PTHREAD) return startWorker(Module);
|
|
1104
872
|
|
|
1105
|
-
checkStackCookie();
|
|
1106
|
-
|
|
1107
873
|
if (!Module['noFSInit'] && !FS.initialized) FS.init();
|
|
1108
874
|
TTY.init();
|
|
1109
875
|
|
|
@@ -1113,12 +879,10 @@ TTY.init();
|
|
|
1113
879
|
}
|
|
1114
880
|
|
|
1115
881
|
function preMain() {
|
|
1116
|
-
checkStackCookie();
|
|
1117
882
|
|
|
1118
883
|
}
|
|
1119
884
|
|
|
1120
885
|
function postRun() {
|
|
1121
|
-
checkStackCookie();
|
|
1122
886
|
if (ENVIRONMENT_IS_PTHREAD) return; // PThreads reuse the runtime from the main thread.
|
|
1123
887
|
|
|
1124
888
|
if (Module['postRun']) {
|
|
@@ -1127,7 +891,6 @@ function postRun() {
|
|
|
1127
891
|
addOnPostRun(Module['postRun'].shift());
|
|
1128
892
|
}
|
|
1129
893
|
}
|
|
1130
|
-
consumedModuleProp('postRun');
|
|
1131
894
|
|
|
1132
895
|
callRuntimeCallbacks(onPostRuns);
|
|
1133
896
|
}
|
|
@@ -1141,15 +904,9 @@ function postRun() {
|
|
|
1141
904
|
// the dependencies are met.
|
|
1142
905
|
var runDependencies = 0;
|
|
1143
906
|
var dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled
|
|
1144
|
-
var runDependencyTracking = {};
|
|
1145
|
-
var runDependencyWatcher = null;
|
|
1146
907
|
|
|
1147
908
|
function getUniqueRunDependency(id) {
|
|
1148
|
-
|
|
1149
|
-
while (1) {
|
|
1150
|
-
if (!runDependencyTracking[id]) return id;
|
|
1151
|
-
id = orig + Math.random();
|
|
1152
|
-
}
|
|
909
|
+
return id;
|
|
1153
910
|
}
|
|
1154
911
|
|
|
1155
912
|
function addRunDependency(id) {
|
|
@@ -1157,33 +914,6 @@ function addRunDependency(id) {
|
|
|
1157
914
|
|
|
1158
915
|
Module['monitorRunDependencies']?.(runDependencies);
|
|
1159
916
|
|
|
1160
|
-
if (id) {
|
|
1161
|
-
assert(!runDependencyTracking[id]);
|
|
1162
|
-
runDependencyTracking[id] = 1;
|
|
1163
|
-
if (runDependencyWatcher === null && typeof setInterval != 'undefined') {
|
|
1164
|
-
// Check for missing dependencies every few seconds
|
|
1165
|
-
runDependencyWatcher = setInterval(() => {
|
|
1166
|
-
if (ABORT) {
|
|
1167
|
-
clearInterval(runDependencyWatcher);
|
|
1168
|
-
runDependencyWatcher = null;
|
|
1169
|
-
return;
|
|
1170
|
-
}
|
|
1171
|
-
var shown = false;
|
|
1172
|
-
for (var dep in runDependencyTracking) {
|
|
1173
|
-
if (!shown) {
|
|
1174
|
-
shown = true;
|
|
1175
|
-
err('still waiting on run dependencies:');
|
|
1176
|
-
}
|
|
1177
|
-
err(`dependency: ${dep}`);
|
|
1178
|
-
}
|
|
1179
|
-
if (shown) {
|
|
1180
|
-
err('(end of list)');
|
|
1181
|
-
}
|
|
1182
|
-
}, 10000);
|
|
1183
|
-
}
|
|
1184
|
-
} else {
|
|
1185
|
-
err('warning: run dependency added without ID');
|
|
1186
|
-
}
|
|
1187
917
|
}
|
|
1188
918
|
|
|
1189
919
|
function removeRunDependency(id) {
|
|
@@ -1191,17 +921,7 @@ function removeRunDependency(id) {
|
|
|
1191
921
|
|
|
1192
922
|
Module['monitorRunDependencies']?.(runDependencies);
|
|
1193
923
|
|
|
1194
|
-
if (id) {
|
|
1195
|
-
assert(runDependencyTracking[id]);
|
|
1196
|
-
delete runDependencyTracking[id];
|
|
1197
|
-
} else {
|
|
1198
|
-
err('warning: run dependency removed without ID');
|
|
1199
|
-
}
|
|
1200
924
|
if (runDependencies == 0) {
|
|
1201
|
-
if (runDependencyWatcher !== null) {
|
|
1202
|
-
clearInterval(runDependencyWatcher);
|
|
1203
|
-
runDependencyWatcher = null;
|
|
1204
|
-
}
|
|
1205
925
|
if (dependenciesFulfilled) {
|
|
1206
926
|
var callback = dependenciesFulfilled;
|
|
1207
927
|
dependenciesFulfilled = null;
|
|
@@ -1221,6 +941,8 @@ function abort(what) {
|
|
|
1221
941
|
|
|
1222
942
|
ABORT = true;
|
|
1223
943
|
|
|
944
|
+
what += '. Build with -sASSERTIONS for more info.';
|
|
945
|
+
|
|
1224
946
|
// Use a wasm runtime error, because a JS error might be seen as a foreign
|
|
1225
947
|
// exception, which means we'd run destructors on it. We need the error to
|
|
1226
948
|
// simply make the program stop.
|
|
@@ -1244,17 +966,6 @@ function abort(what) {
|
|
|
1244
966
|
throw e;
|
|
1245
967
|
}
|
|
1246
968
|
|
|
1247
|
-
function createExportWrapper(name, nargs) {
|
|
1248
|
-
return (...args) => {
|
|
1249
|
-
assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`);
|
|
1250
|
-
var f = wasmExports[name];
|
|
1251
|
-
assert(f, `exported native function \`${name}\` not found`);
|
|
1252
|
-
// Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled.
|
|
1253
|
-
assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`);
|
|
1254
|
-
return f(...args);
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
969
|
var wasmBinaryFile;
|
|
1259
970
|
function findWasmBinary() {
|
|
1260
971
|
if (Module['locateFile']) {
|
|
@@ -1298,10 +1009,6 @@ async function instantiateArrayBuffer(binaryFile, imports) {
|
|
|
1298
1009
|
} catch (reason) {
|
|
1299
1010
|
err(`failed to asynchronously prepare wasm: ${reason}`);
|
|
1300
1011
|
|
|
1301
|
-
// Warn on some common problems.
|
|
1302
|
-
if (isFileURI(wasmBinaryFile)) {
|
|
1303
|
-
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`);
|
|
1304
|
-
}
|
|
1305
1012
|
abort(reason);
|
|
1306
1013
|
}
|
|
1307
1014
|
}
|
|
@@ -1349,7 +1056,6 @@ async function createWasm() {
|
|
|
1349
1056
|
|
|
1350
1057
|
wasmTable = wasmExports['__indirect_function_table'];
|
|
1351
1058
|
|
|
1352
|
-
assert(wasmTable, 'table not found in wasm exports');
|
|
1353
1059
|
|
|
1354
1060
|
// We now have the Wasm module loaded up, keep a reference to the compiled module so we can post it to the workers.
|
|
1355
1061
|
wasmModule = module;
|
|
@@ -1360,15 +1066,9 @@ async function createWasm() {
|
|
|
1360
1066
|
addRunDependency('wasm-instantiate');
|
|
1361
1067
|
|
|
1362
1068
|
// Prefer streaming instantiation if available.
|
|
1363
|
-
// Async compilation can be confusing when an error on the page overwrites Module
|
|
1364
|
-
// (for example, if the order of elements is wrong, and the one defining Module is
|
|
1365
|
-
// later), so we save Module and check it later.
|
|
1366
|
-
var trueModule = Module;
|
|
1367
1069
|
function receiveInstantiationResult(result) {
|
|
1368
1070
|
// 'result' is a ResultObject object which has both the module and instance.
|
|
1369
1071
|
// receiveInstance() will swap in the exports (to Module.asm) so they can be called
|
|
1370
|
-
assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');
|
|
1371
|
-
trueModule = null;
|
|
1372
1072
|
return receiveInstance(result['instance'], result['module']);
|
|
1373
1073
|
}
|
|
1374
1074
|
|
|
@@ -1382,15 +1082,10 @@ async function createWasm() {
|
|
|
1382
1082
|
// path.
|
|
1383
1083
|
if (Module['instantiateWasm']) {
|
|
1384
1084
|
return new Promise((resolve, reject) => {
|
|
1385
|
-
try {
|
|
1386
1085
|
Module['instantiateWasm'](info, (mod, inst) => {
|
|
1387
1086
|
receiveInstance(mod, inst);
|
|
1388
1087
|
resolve(mod.exports);
|
|
1389
1088
|
});
|
|
1390
|
-
} catch(e) {
|
|
1391
|
-
err(`Module.instantiateWasm callback failed with error: ${e}`);
|
|
1392
|
-
reject(e);
|
|
1393
|
-
}
|
|
1394
1089
|
});
|
|
1395
1090
|
}
|
|
1396
1091
|
|
|
@@ -1421,41 +1116,43 @@ async function createWasm() {
|
|
|
1421
1116
|
// === Body ===
|
|
1422
1117
|
|
|
1423
1118
|
var ASM_CONSTS = {
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
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; }
|
|
1459
1156
|
};
|
|
1460
1157
|
|
|
1461
1158
|
// end include: preamble.js
|
|
@@ -1478,16 +1175,11 @@ var ASM_CONSTS = {
|
|
|
1478
1175
|
// out its message handler here. This avoids having to check in each of
|
|
1479
1176
|
// the onmessage handlers if the message was coming from valid worker.
|
|
1480
1177
|
worker.onmessage = (e) => {
|
|
1481
|
-
var cmd = e['data'].cmd;
|
|
1482
|
-
err(`received "${cmd}" command from terminated worker: ${worker.workerID}`);
|
|
1483
1178
|
};
|
|
1484
1179
|
};
|
|
1485
1180
|
|
|
1486
1181
|
var cleanupThread = (pthread_ptr) => {
|
|
1487
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! cleanupThread() can only ever be called from main application thread!');
|
|
1488
|
-
assert(pthread_ptr, 'Internal Error! Null pthread_ptr in cleanupThread!');
|
|
1489
1182
|
var worker = PThread.pthreads[pthread_ptr];
|
|
1490
|
-
assert(worker);
|
|
1491
1183
|
PThread.returnWorkerToPool(worker);
|
|
1492
1184
|
};
|
|
1493
1185
|
|
|
@@ -1501,15 +1193,12 @@ var ASM_CONSTS = {
|
|
|
1501
1193
|
var addOnPreRun = (cb) => onPreRuns.unshift(cb);
|
|
1502
1194
|
|
|
1503
1195
|
var spawnThread = (threadParams) => {
|
|
1504
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! spawnThread() can only ever be called from main application thread!');
|
|
1505
|
-
assert(threadParams.pthread_ptr, 'Internal error, no pthread ptr!');
|
|
1506
1196
|
|
|
1507
1197
|
var worker = PThread.getNewWorker();
|
|
1508
1198
|
if (!worker) {
|
|
1509
1199
|
// No available workers in the PThread pool.
|
|
1510
1200
|
return 6;
|
|
1511
1201
|
}
|
|
1512
|
-
assert(!worker.pthread_ptr, 'Internal error!');
|
|
1513
1202
|
|
|
1514
1203
|
PThread.runningWorkers.push(worker);
|
|
1515
1204
|
|
|
@@ -1601,7 +1290,6 @@ var ASM_CONSTS = {
|
|
|
1601
1290
|
|
|
1602
1291
|
|
|
1603
1292
|
|
|
1604
|
-
|
|
1605
1293
|
var handleException = (e) => {
|
|
1606
1294
|
// Certain exception types we do not treat as errors since they are used for
|
|
1607
1295
|
// internal control flow.
|
|
@@ -1611,12 +1299,6 @@ var ASM_CONSTS = {
|
|
|
1611
1299
|
if (e instanceof ExitStatus || e == 'unwind') {
|
|
1612
1300
|
return EXITSTATUS;
|
|
1613
1301
|
}
|
|
1614
|
-
checkStackCookie();
|
|
1615
|
-
if (e instanceof WebAssembly.RuntimeError) {
|
|
1616
|
-
if (_emscripten_stack_get_current() <= 0) {
|
|
1617
|
-
err('Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)');
|
|
1618
|
-
}
|
|
1619
|
-
}
|
|
1620
1302
|
quit_(1, e);
|
|
1621
1303
|
};
|
|
1622
1304
|
|
|
@@ -1630,17 +1312,13 @@ var ASM_CONSTS = {
|
|
|
1630
1312
|
|
|
1631
1313
|
}
|
|
1632
1314
|
|
|
1633
|
-
|
|
1634
1315
|
/** @suppress {duplicate } */
|
|
1635
1316
|
/** @param {boolean|number=} implicit */
|
|
1636
1317
|
var exitJS = (status, implicit) => {
|
|
1637
1318
|
EXITSTATUS = status;
|
|
1638
1319
|
|
|
1639
|
-
checkUnflushedContent();
|
|
1640
|
-
|
|
1641
1320
|
if (ENVIRONMENT_IS_PTHREAD) {
|
|
1642
1321
|
// implicit exit can never happen on a pthread
|
|
1643
|
-
assert(!implicit);
|
|
1644
1322
|
// When running in a pthread we propagate the exit back to the main thread
|
|
1645
1323
|
// where it can decide if the whole process should be shut down or not.
|
|
1646
1324
|
// The pthread may have decided not to exit its own runtime, for example
|
|
@@ -1649,24 +1327,10 @@ var ASM_CONSTS = {
|
|
|
1649
1327
|
throw 'unwind';
|
|
1650
1328
|
}
|
|
1651
1329
|
|
|
1652
|
-
// if exit() was called explicitly, warn the user if the runtime isn't actually being shut down
|
|
1653
|
-
if (keepRuntimeAlive() && !implicit) {
|
|
1654
|
-
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)`;
|
|
1655
|
-
readyPromiseReject(msg);
|
|
1656
|
-
err(msg);
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
1330
|
_proc_exit(status);
|
|
1660
1331
|
};
|
|
1661
1332
|
var _exit = exitJS;
|
|
1662
1333
|
|
|
1663
|
-
var ptrToString = (ptr) => {
|
|
1664
|
-
assert(typeof ptr === 'number');
|
|
1665
|
-
// With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
|
|
1666
|
-
ptr >>>= 0;
|
|
1667
|
-
return '0x' + ptr.toString(16).padStart(8, '0');
|
|
1668
|
-
};
|
|
1669
|
-
|
|
1670
1334
|
|
|
1671
1335
|
var PThread = {
|
|
1672
1336
|
unusedWorkers:[],
|
|
@@ -1674,23 +1338,7 @@ var ASM_CONSTS = {
|
|
|
1674
1338
|
tlsInitFunctions:[],
|
|
1675
1339
|
pthreads:{
|
|
1676
1340
|
},
|
|
1677
|
-
nextWorkerID:1,
|
|
1678
|
-
debugInit() {
|
|
1679
|
-
function pthreadLogPrefix() {
|
|
1680
|
-
var t = 0;
|
|
1681
|
-
if (runtimeInitialized && typeof _pthread_self != 'undefined'
|
|
1682
|
-
) {
|
|
1683
|
-
t = _pthread_self();
|
|
1684
|
-
}
|
|
1685
|
-
return `w:${workerID},t:${ptrToString(t)}: `;
|
|
1686
|
-
}
|
|
1687
|
-
|
|
1688
|
-
// Prefix all err()/dbg() messages with the calling thread ID.
|
|
1689
|
-
var origDbg = dbg;
|
|
1690
|
-
dbg = (...args) => origDbg(pthreadLogPrefix() + args.join(' '));
|
|
1691
|
-
},
|
|
1692
1341
|
init() {
|
|
1693
|
-
PThread.debugInit();
|
|
1694
1342
|
if ((!(ENVIRONMENT_IS_PTHREAD))) {
|
|
1695
1343
|
PThread.initMainThread();
|
|
1696
1344
|
}
|
|
@@ -1709,7 +1357,6 @@ var ASM_CONSTS = {
|
|
|
1709
1357
|
});
|
|
1710
1358
|
},
|
|
1711
1359
|
terminateAllThreads:() => {
|
|
1712
|
-
assert(!ENVIRONMENT_IS_PTHREAD, 'Internal Error! terminateAllThreads() can only ever be called from main application thread!');
|
|
1713
1360
|
// Attempt to kill all workers. Sadly (at least on the web) there is no
|
|
1714
1361
|
// way to terminate a worker synchronously, or to be notified when a
|
|
1715
1362
|
// worker in actually terminated. This means there is some risk that
|
|
@@ -1797,16 +1444,10 @@ var ASM_CONSTS = {
|
|
|
1797
1444
|
|
|
1798
1445
|
worker.onerror = (e) => {
|
|
1799
1446
|
var message = 'worker sent an error!';
|
|
1800
|
-
if (worker.pthread_ptr) {
|
|
1801
|
-
message = `Pthread ${ptrToString(worker.pthread_ptr)} sent an error!`;
|
|
1802
|
-
}
|
|
1803
1447
|
err(`${message} ${e.filename}:${e.lineno}: ${e.message}`);
|
|
1804
1448
|
throw e;
|
|
1805
1449
|
};
|
|
1806
1450
|
|
|
1807
|
-
assert(wasmMemory instanceof WebAssembly.Memory, 'WebAssembly memory should have been loaded by now!');
|
|
1808
|
-
assert(wasmModule instanceof WebAssembly.Module, 'WebAssembly Module should have been loaded by now!');
|
|
1809
|
-
|
|
1810
1451
|
// When running on a pthread, none of the incoming parameters on the module
|
|
1811
1452
|
// object are present. Proxy known handlers back to the main thread if specified.
|
|
1812
1453
|
var handlers = [];
|
|
@@ -1822,15 +1463,12 @@ var ASM_CONSTS = {
|
|
|
1822
1463
|
}
|
|
1823
1464
|
}
|
|
1824
1465
|
|
|
1825
|
-
worker.workerID = PThread.nextWorkerID++;
|
|
1826
|
-
|
|
1827
1466
|
// Ask the new worker to load up the Emscripten-compiled page. This is a heavy operation.
|
|
1828
1467
|
worker.postMessage({
|
|
1829
1468
|
cmd: 'load',
|
|
1830
1469
|
handlers: handlers,
|
|
1831
1470
|
wasmMemory,
|
|
1832
1471
|
wasmModule,
|
|
1833
|
-
'workerID': worker.workerID,
|
|
1834
1472
|
});
|
|
1835
1473
|
}),
|
|
1836
1474
|
loadWasmModuleToAllWorkers(onMaybeReady) {
|
|
@@ -1855,20 +1493,13 @@ var ASM_CONSTS = {
|
|
|
1855
1493
|
'type': 'module',
|
|
1856
1494
|
// This is the way that we signal to the Web Worker that it is hosting
|
|
1857
1495
|
// a pthread.
|
|
1858
|
-
'name': 'em-pthread
|
|
1496
|
+
'name': 'em-pthread',
|
|
1859
1497
|
});
|
|
1860
1498
|
PThread.unusedWorkers.push(worker);
|
|
1861
1499
|
},
|
|
1862
1500
|
getNewWorker() {
|
|
1863
1501
|
if (PThread.unusedWorkers.length == 0) {
|
|
1864
1502
|
// PTHREAD_POOL_SIZE_STRICT should show a warning and, if set to level `2`, return from the function.
|
|
1865
|
-
// However, if we're in Node.js, then we can create new workers on the fly and PTHREAD_POOL_SIZE_STRICT
|
|
1866
|
-
// should be ignored altogether.
|
|
1867
|
-
err('Tried to spawn a new thread, but the thread pool is exhausted.\n' +
|
|
1868
|
-
'This might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.\n' +
|
|
1869
|
-
'If you want to increase the pool size, use setting `-sPTHREAD_POOL_SIZE=...`.'
|
|
1870
|
-
+ '\nIf you want to throw an explicit error instead of the risk of deadlocking in those cases, use setting `-sPTHREAD_POOL_SIZE_STRICT=2`.'
|
|
1871
|
-
);
|
|
1872
1503
|
PThread.allocateUnusedWorker();
|
|
1873
1504
|
PThread.loadWasmModuleToWorker(PThread.unusedWorkers[0]);
|
|
1874
1505
|
}
|
|
@@ -1887,9 +1518,6 @@ var ASM_CONSTS = {
|
|
|
1887
1518
|
var stackHigh = HEAPU32[(((pthread_ptr)+(52))>>2)];
|
|
1888
1519
|
var stackSize = HEAPU32[(((pthread_ptr)+(56))>>2)];
|
|
1889
1520
|
var stackLow = stackHigh - stackSize;
|
|
1890
|
-
assert(stackHigh != 0);
|
|
1891
|
-
assert(stackLow != 0);
|
|
1892
|
-
assert(stackHigh > stackLow, 'stackHigh must be higher then stackLow');
|
|
1893
1521
|
// Set stack limits used by `emscripten/stack.h` function. These limits are
|
|
1894
1522
|
// cached in wasm-side globals to make checks as fast as possible.
|
|
1895
1523
|
_emscripten_stack_set_limits(stackHigh, stackLow);
|
|
@@ -1897,9 +1525,6 @@ var ASM_CONSTS = {
|
|
|
1897
1525
|
// Call inside wasm module to set up the stack frame for this pthread in wasm module scope
|
|
1898
1526
|
stackRestore(stackHigh);
|
|
1899
1527
|
|
|
1900
|
-
// Write the stack cookie last, after we have set up the proper bounds and
|
|
1901
|
-
// current position of the stack.
|
|
1902
|
-
writeStackCookie();
|
|
1903
1528
|
};
|
|
1904
1529
|
|
|
1905
1530
|
|
|
@@ -1937,8 +1562,6 @@ var ASM_CONSTS = {
|
|
|
1937
1562
|
/** @suppress {checkTypes} */
|
|
1938
1563
|
wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
|
|
1939
1564
|
}
|
|
1940
|
-
/** @suppress {checkTypes} */
|
|
1941
|
-
assert(wasmTable.get(funcPtr) == func, 'JavaScript-side Wasm function table mirror is out of date!');
|
|
1942
1565
|
return func;
|
|
1943
1566
|
};
|
|
1944
1567
|
var invokeEntryPoint = (ptr, arg) => {
|
|
@@ -1967,7 +1590,6 @@ var ASM_CONSTS = {
|
|
|
1967
1590
|
|
|
1968
1591
|
var result = getWasmTableEntry(ptr)(arg);
|
|
1969
1592
|
|
|
1970
|
-
checkStackCookie();
|
|
1971
1593
|
function finish(result) {
|
|
1972
1594
|
if (keepRuntimeAlive()) {
|
|
1973
1595
|
EXITSTATUS = result;
|
|
@@ -1980,7 +1602,6 @@ var ASM_CONSTS = {
|
|
|
1980
1602
|
|
|
1981
1603
|
var noExitRuntime = Module['noExitRuntime'] || true;
|
|
1982
1604
|
|
|
1983
|
-
|
|
1984
1605
|
var registerTLSInit = (tlsInitFunc) => PThread.tlsInitFunctions.push(tlsInitFunc);
|
|
1985
1606
|
|
|
1986
1607
|
|
|
@@ -2006,14 +1627,6 @@ var ASM_CONSTS = {
|
|
|
2006
1627
|
|
|
2007
1628
|
|
|
2008
1629
|
|
|
2009
|
-
var warnOnce = (text) => {
|
|
2010
|
-
warnOnce.shown ||= {};
|
|
2011
|
-
if (!warnOnce.shown[text]) {
|
|
2012
|
-
warnOnce.shown[text] = 1;
|
|
2013
|
-
err(text);
|
|
2014
|
-
}
|
|
2015
|
-
};
|
|
2016
|
-
|
|
2017
1630
|
var UTF8Decoder = typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined;
|
|
2018
1631
|
|
|
2019
1632
|
/**
|
|
@@ -2054,7 +1667,6 @@ var ASM_CONSTS = {
|
|
|
2054
1667
|
if ((u0 & 0xF0) == 0xE0) {
|
|
2055
1668
|
u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
|
|
2056
1669
|
} else {
|
|
2057
|
-
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!');
|
|
2058
1670
|
u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
|
|
2059
1671
|
}
|
|
2060
1672
|
|
|
@@ -2084,7 +1696,6 @@ var ASM_CONSTS = {
|
|
|
2084
1696
|
* @return {string}
|
|
2085
1697
|
*/
|
|
2086
1698
|
var UTF8ToString = (ptr, maxBytesToRead) => {
|
|
2087
|
-
assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
|
|
2088
1699
|
return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
|
|
2089
1700
|
};
|
|
2090
1701
|
var ___assert_fail = (condition, filename, line, func) =>
|
|
@@ -2108,7 +1719,6 @@ var ASM_CONSTS = {
|
|
|
2108
1719
|
|
|
2109
1720
|
var ___pthread_create_js = (pthread_ptr, attr, startRoutine, arg) => {
|
|
2110
1721
|
if (!_emscripten_has_threading_support()) {
|
|
2111
|
-
dbg('pthread_create: environment does not support SharedArrayBuffer, pthreads are not available');
|
|
2112
1722
|
return 6;
|
|
2113
1723
|
}
|
|
2114
1724
|
|
|
@@ -2152,7 +1762,6 @@ var ASM_CONSTS = {
|
|
|
2152
1762
|
|
|
2153
1763
|
/** @suppress {duplicate } */
|
|
2154
1764
|
var syscallGetVarargI = () => {
|
|
2155
|
-
assert(SYSCALLS.varargs != undefined);
|
|
2156
1765
|
// the `+` prepended here is necessary to convince the JSCompiler that varargs is indeed a number.
|
|
2157
1766
|
var ret = HEAP32[((+SYSCALLS.varargs)>>2)];
|
|
2158
1767
|
SYSCALLS.varargs += 4;
|
|
@@ -2315,7 +1924,6 @@ var ASM_CONSTS = {
|
|
|
2315
1924
|
};
|
|
2316
1925
|
|
|
2317
1926
|
var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
|
|
2318
|
-
assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
|
|
2319
1927
|
// Parameter maxBytesToWrite is not optional. Negative values, 0, null,
|
|
2320
1928
|
// undefined and false each don't write out any bytes.
|
|
2321
1929
|
if (!(maxBytesToWrite > 0))
|
|
@@ -2350,7 +1958,6 @@ var ASM_CONSTS = {
|
|
|
2350
1958
|
heap[outIdx++] = 0x80 | (u & 63);
|
|
2351
1959
|
} else {
|
|
2352
1960
|
if (outIdx + 3 >= endIdx) break;
|
|
2353
|
-
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).');
|
|
2354
1961
|
heap[outIdx++] = 0xF0 | (u >> 18);
|
|
2355
1962
|
heap[outIdx++] = 0x80 | ((u >> 12) & 63);
|
|
2356
1963
|
heap[outIdx++] = 0x80 | ((u >> 6) & 63);
|
|
@@ -2536,7 +2143,6 @@ var ASM_CONSTS = {
|
|
|
2536
2143
|
};
|
|
2537
2144
|
|
|
2538
2145
|
var alignMemory = (size, alignment) => {
|
|
2539
|
-
assert(alignment, "alignment argument is required");
|
|
2540
2146
|
return Math.ceil(size / alignment) * alignment;
|
|
2541
2147
|
};
|
|
2542
2148
|
var mmapAlloc = (size) => {
|
|
@@ -2702,7 +2308,7 @@ var ASM_CONSTS = {
|
|
|
2702
2308
|
}
|
|
2703
2309
|
},
|
|
2704
2310
|
lookup(parent, name) {
|
|
2705
|
-
throw
|
|
2311
|
+
throw MEMFS.doesNotExistError;
|
|
2706
2312
|
},
|
|
2707
2313
|
mknod(parent, name, mode, dev) {
|
|
2708
2314
|
return MEMFS.createNode(parent, name, mode, dev);
|
|
@@ -2759,7 +2365,6 @@ var ASM_CONSTS = {
|
|
|
2759
2365
|
var contents = stream.node.contents;
|
|
2760
2366
|
if (position >= stream.node.usedBytes) return 0;
|
|
2761
2367
|
var size = Math.min(stream.node.usedBytes - position, length);
|
|
2762
|
-
assert(size >= 0);
|
|
2763
2368
|
if (size > 8 && contents.subarray) { // non-trivial, and typed array
|
|
2764
2369
|
buffer.set(contents.subarray(position, position + size), offset);
|
|
2765
2370
|
} else {
|
|
@@ -2768,8 +2373,6 @@ var ASM_CONSTS = {
|
|
|
2768
2373
|
return size;
|
|
2769
2374
|
},
|
|
2770
2375
|
write(stream, buffer, offset, length, position, canOwn) {
|
|
2771
|
-
// The data buffer should be a typed array view
|
|
2772
|
-
assert(!(buffer instanceof ArrayBuffer));
|
|
2773
2376
|
|
|
2774
2377
|
if (!length) return 0;
|
|
2775
2378
|
var node = stream.node;
|
|
@@ -2777,7 +2380,6 @@ var ASM_CONSTS = {
|
|
|
2777
2380
|
|
|
2778
2381
|
if (buffer.subarray && (!node.contents || node.contents.subarray)) { // This write is from a typed array to a typed array?
|
|
2779
2382
|
if (canOwn) {
|
|
2780
|
-
assert(position === 0, 'canOwn must imply no weird position inside the file');
|
|
2781
2383
|
node.contents = buffer.subarray(offset, offset + length);
|
|
2782
2384
|
node.usedBytes = length;
|
|
2783
2385
|
return length;
|
|
@@ -2865,7 +2467,6 @@ var ASM_CONSTS = {
|
|
|
2865
2467
|
|
|
2866
2468
|
var asyncLoad = async (url) => {
|
|
2867
2469
|
var arrayBuffer = await readAsync(url);
|
|
2868
|
-
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
|
|
2869
2470
|
return new Uint8Array(arrayBuffer);
|
|
2870
2471
|
};
|
|
2871
2472
|
|
|
@@ -2954,7 +2555,6 @@ var ASM_CONSTS = {
|
|
|
2954
2555
|
if (typeof indexedDB != 'undefined') return indexedDB;
|
|
2955
2556
|
var ret = null;
|
|
2956
2557
|
if (typeof window == 'object') ret = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
|
|
2957
|
-
assert(ret, 'IDBFS used, but indexedDB not supported');
|
|
2958
2558
|
return ret;
|
|
2959
2559
|
},
|
|
2960
2560
|
DB_VERSION:21,
|
|
@@ -3317,134 +2917,6 @@ var ASM_CONSTS = {
|
|
|
3317
2917
|
});
|
|
3318
2918
|
},
|
|
3319
2919
|
};
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
var strError = (errno) => UTF8ToString(_strerror(errno));
|
|
3324
|
-
|
|
3325
|
-
var ERRNO_CODES = {
|
|
3326
|
-
'EPERM': 63,
|
|
3327
|
-
'ENOENT': 44,
|
|
3328
|
-
'ESRCH': 71,
|
|
3329
|
-
'EINTR': 27,
|
|
3330
|
-
'EIO': 29,
|
|
3331
|
-
'ENXIO': 60,
|
|
3332
|
-
'E2BIG': 1,
|
|
3333
|
-
'ENOEXEC': 45,
|
|
3334
|
-
'EBADF': 8,
|
|
3335
|
-
'ECHILD': 12,
|
|
3336
|
-
'EAGAIN': 6,
|
|
3337
|
-
'EWOULDBLOCK': 6,
|
|
3338
|
-
'ENOMEM': 48,
|
|
3339
|
-
'EACCES': 2,
|
|
3340
|
-
'EFAULT': 21,
|
|
3341
|
-
'ENOTBLK': 105,
|
|
3342
|
-
'EBUSY': 10,
|
|
3343
|
-
'EEXIST': 20,
|
|
3344
|
-
'EXDEV': 75,
|
|
3345
|
-
'ENODEV': 43,
|
|
3346
|
-
'ENOTDIR': 54,
|
|
3347
|
-
'EISDIR': 31,
|
|
3348
|
-
'EINVAL': 28,
|
|
3349
|
-
'ENFILE': 41,
|
|
3350
|
-
'EMFILE': 33,
|
|
3351
|
-
'ENOTTY': 59,
|
|
3352
|
-
'ETXTBSY': 74,
|
|
3353
|
-
'EFBIG': 22,
|
|
3354
|
-
'ENOSPC': 51,
|
|
3355
|
-
'ESPIPE': 70,
|
|
3356
|
-
'EROFS': 69,
|
|
3357
|
-
'EMLINK': 34,
|
|
3358
|
-
'EPIPE': 64,
|
|
3359
|
-
'EDOM': 18,
|
|
3360
|
-
'ERANGE': 68,
|
|
3361
|
-
'ENOMSG': 49,
|
|
3362
|
-
'EIDRM': 24,
|
|
3363
|
-
'ECHRNG': 106,
|
|
3364
|
-
'EL2NSYNC': 156,
|
|
3365
|
-
'EL3HLT': 107,
|
|
3366
|
-
'EL3RST': 108,
|
|
3367
|
-
'ELNRNG': 109,
|
|
3368
|
-
'EUNATCH': 110,
|
|
3369
|
-
'ENOCSI': 111,
|
|
3370
|
-
'EL2HLT': 112,
|
|
3371
|
-
'EDEADLK': 16,
|
|
3372
|
-
'ENOLCK': 46,
|
|
3373
|
-
'EBADE': 113,
|
|
3374
|
-
'EBADR': 114,
|
|
3375
|
-
'EXFULL': 115,
|
|
3376
|
-
'ENOANO': 104,
|
|
3377
|
-
'EBADRQC': 103,
|
|
3378
|
-
'EBADSLT': 102,
|
|
3379
|
-
'EDEADLOCK': 16,
|
|
3380
|
-
'EBFONT': 101,
|
|
3381
|
-
'ENOSTR': 100,
|
|
3382
|
-
'ENODATA': 116,
|
|
3383
|
-
'ETIME': 117,
|
|
3384
|
-
'ENOSR': 118,
|
|
3385
|
-
'ENONET': 119,
|
|
3386
|
-
'ENOPKG': 120,
|
|
3387
|
-
'EREMOTE': 121,
|
|
3388
|
-
'ENOLINK': 47,
|
|
3389
|
-
'EADV': 122,
|
|
3390
|
-
'ESRMNT': 123,
|
|
3391
|
-
'ECOMM': 124,
|
|
3392
|
-
'EPROTO': 65,
|
|
3393
|
-
'EMULTIHOP': 36,
|
|
3394
|
-
'EDOTDOT': 125,
|
|
3395
|
-
'EBADMSG': 9,
|
|
3396
|
-
'ENOTUNIQ': 126,
|
|
3397
|
-
'EBADFD': 127,
|
|
3398
|
-
'EREMCHG': 128,
|
|
3399
|
-
'ELIBACC': 129,
|
|
3400
|
-
'ELIBBAD': 130,
|
|
3401
|
-
'ELIBSCN': 131,
|
|
3402
|
-
'ELIBMAX': 132,
|
|
3403
|
-
'ELIBEXEC': 133,
|
|
3404
|
-
'ENOSYS': 52,
|
|
3405
|
-
'ENOTEMPTY': 55,
|
|
3406
|
-
'ENAMETOOLONG': 37,
|
|
3407
|
-
'ELOOP': 32,
|
|
3408
|
-
'EOPNOTSUPP': 138,
|
|
3409
|
-
'EPFNOSUPPORT': 139,
|
|
3410
|
-
'ECONNRESET': 15,
|
|
3411
|
-
'ENOBUFS': 42,
|
|
3412
|
-
'EAFNOSUPPORT': 5,
|
|
3413
|
-
'EPROTOTYPE': 67,
|
|
3414
|
-
'ENOTSOCK': 57,
|
|
3415
|
-
'ENOPROTOOPT': 50,
|
|
3416
|
-
'ESHUTDOWN': 140,
|
|
3417
|
-
'ECONNREFUSED': 14,
|
|
3418
|
-
'EADDRINUSE': 3,
|
|
3419
|
-
'ECONNABORTED': 13,
|
|
3420
|
-
'ENETUNREACH': 40,
|
|
3421
|
-
'ENETDOWN': 38,
|
|
3422
|
-
'ETIMEDOUT': 73,
|
|
3423
|
-
'EHOSTDOWN': 142,
|
|
3424
|
-
'EHOSTUNREACH': 23,
|
|
3425
|
-
'EINPROGRESS': 26,
|
|
3426
|
-
'EALREADY': 7,
|
|
3427
|
-
'EDESTADDRREQ': 17,
|
|
3428
|
-
'EMSGSIZE': 35,
|
|
3429
|
-
'EPROTONOSUPPORT': 66,
|
|
3430
|
-
'ESOCKTNOSUPPORT': 137,
|
|
3431
|
-
'EADDRNOTAVAIL': 4,
|
|
3432
|
-
'ENETRESET': 39,
|
|
3433
|
-
'EISCONN': 30,
|
|
3434
|
-
'ENOTCONN': 53,
|
|
3435
|
-
'ETOOMANYREFS': 141,
|
|
3436
|
-
'EUSERS': 136,
|
|
3437
|
-
'EDQUOT': 19,
|
|
3438
|
-
'ESTALE': 72,
|
|
3439
|
-
'ENOTSUP': 138,
|
|
3440
|
-
'ENOMEDIUM': 148,
|
|
3441
|
-
'EILSEQ': 25,
|
|
3442
|
-
'EOVERFLOW': 61,
|
|
3443
|
-
'ECANCELED': 11,
|
|
3444
|
-
'ENOTRECOVERABLE': 56,
|
|
3445
|
-
'EOWNERDEAD': 62,
|
|
3446
|
-
'ESTRPIPE': 135,
|
|
3447
|
-
};
|
|
3448
2920
|
var FS = {
|
|
3449
2921
|
root:null,
|
|
3450
2922
|
mounts:[],
|
|
@@ -3460,7 +2932,7 @@ var ASM_CONSTS = {
|
|
|
3460
2932
|
syncFSRequests:0,
|
|
3461
2933
|
readFiles:{
|
|
3462
2934
|
},
|
|
3463
|
-
ErrnoError:class
|
|
2935
|
+
ErrnoError:class {
|
|
3464
2936
|
name = 'ErrnoError';
|
|
3465
2937
|
// We set the `name` property to be able to identify `FS.ErrnoError`
|
|
3466
2938
|
// - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway.
|
|
@@ -3469,14 +2941,7 @@ var ASM_CONSTS = {
|
|
|
3469
2941
|
// the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs.
|
|
3470
2942
|
// we'll use the reliable test `err.name == "ErrnoError"` instead
|
|
3471
2943
|
constructor(errno) {
|
|
3472
|
-
super(runtimeInitialized ? strError(errno) : '');
|
|
3473
2944
|
this.errno = errno;
|
|
3474
|
-
for (var key in ERRNO_CODES) {
|
|
3475
|
-
if (ERRNO_CODES[key] === errno) {
|
|
3476
|
-
this.code = key;
|
|
3477
|
-
break;
|
|
3478
|
-
}
|
|
3479
|
-
}
|
|
3480
2945
|
}
|
|
3481
2946
|
},
|
|
3482
2947
|
FSStream:class {
|
|
@@ -3674,7 +3139,6 @@ var ASM_CONSTS = {
|
|
|
3674
3139
|
return FS.lookup(parent, name);
|
|
3675
3140
|
},
|
|
3676
3141
|
createNode(parent, name, mode, rdev) {
|
|
3677
|
-
assert(typeof parent == 'object')
|
|
3678
3142
|
var node = new FS.FSNode(parent, name, mode, rdev);
|
|
3679
3143
|
|
|
3680
3144
|
FS.hashAddNode(node);
|
|
@@ -3813,7 +3277,6 @@ var ASM_CONSTS = {
|
|
|
3813
3277
|
},
|
|
3814
3278
|
getStream:(fd) => FS.streams[fd],
|
|
3815
3279
|
createStream(stream, fd = -1) {
|
|
3816
|
-
assert(fd >= -1);
|
|
3817
3280
|
|
|
3818
3281
|
// clone it, so we can return an instance of FSStream
|
|
3819
3282
|
stream = Object.assign(new FS.FSStream(), stream);
|
|
@@ -3888,7 +3351,6 @@ var ASM_CONSTS = {
|
|
|
3888
3351
|
var completed = 0;
|
|
3889
3352
|
|
|
3890
3353
|
function doCallback(errCode) {
|
|
3891
|
-
assert(FS.syncFSRequests > 0);
|
|
3892
3354
|
FS.syncFSRequests--;
|
|
3893
3355
|
return callback(errCode);
|
|
3894
3356
|
}
|
|
@@ -3915,11 +3377,6 @@ var ASM_CONSTS = {
|
|
|
3915
3377
|
});
|
|
3916
3378
|
},
|
|
3917
3379
|
mount(type, opts, mountpoint) {
|
|
3918
|
-
if (typeof type == 'string') {
|
|
3919
|
-
// The filesystem was not included, and instead we have an error
|
|
3920
|
-
// message stored in the variable.
|
|
3921
|
-
throw type;
|
|
3922
|
-
}
|
|
3923
3380
|
var root = mountpoint === '/';
|
|
3924
3381
|
var pseudo = !mountpoint;
|
|
3925
3382
|
var node;
|
|
@@ -3998,7 +3455,6 @@ var ASM_CONSTS = {
|
|
|
3998
3455
|
|
|
3999
3456
|
// remove this mount from the child mounts
|
|
4000
3457
|
var idx = node.mount.mounts.indexOf(mount);
|
|
4001
|
-
assert(idx !== -1);
|
|
4002
3458
|
node.mount.mounts.splice(idx, 1);
|
|
4003
3459
|
},
|
|
4004
3460
|
lookup(parent, name) {
|
|
@@ -4491,7 +3947,6 @@ var ASM_CONSTS = {
|
|
|
4491
3947
|
return stream.position;
|
|
4492
3948
|
},
|
|
4493
3949
|
read(stream, buffer, offset, length, position) {
|
|
4494
|
-
assert(offset >= 0);
|
|
4495
3950
|
if (length < 0 || position < 0) {
|
|
4496
3951
|
throw new FS.ErrnoError(28);
|
|
4497
3952
|
}
|
|
@@ -4518,7 +3973,6 @@ var ASM_CONSTS = {
|
|
|
4518
3973
|
return bytesRead;
|
|
4519
3974
|
},
|
|
4520
3975
|
write(stream, buffer, offset, length, position, canOwn) {
|
|
4521
|
-
assert(offset >= 0);
|
|
4522
3976
|
if (length < 0 || position < 0) {
|
|
4523
3977
|
throw new FS.ErrnoError(28);
|
|
4524
3978
|
}
|
|
@@ -4590,7 +4044,6 @@ var ASM_CONSTS = {
|
|
|
4590
4044
|
return stream.stream_ops.mmap(stream, length, position, prot, flags);
|
|
4591
4045
|
},
|
|
4592
4046
|
msync(stream, buffer, offset, length, mmapFlags) {
|
|
4593
|
-
assert(offset >= 0);
|
|
4594
4047
|
if (!stream.stream_ops.msync) {
|
|
4595
4048
|
return 0;
|
|
4596
4049
|
}
|
|
@@ -4754,9 +4207,6 @@ var ASM_CONSTS = {
|
|
|
4754
4207
|
var stdin = FS.open('/dev/stdin', 0);
|
|
4755
4208
|
var stdout = FS.open('/dev/stdout', 1);
|
|
4756
4209
|
var stderr = FS.open('/dev/stderr', 1);
|
|
4757
|
-
assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`);
|
|
4758
|
-
assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`);
|
|
4759
|
-
assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`);
|
|
4760
4210
|
},
|
|
4761
4211
|
staticInit() {
|
|
4762
4212
|
FS.nameTable = new Array(4096);
|
|
@@ -4773,7 +4223,6 @@ var ASM_CONSTS = {
|
|
|
4773
4223
|
};
|
|
4774
4224
|
},
|
|
4775
4225
|
init(input, output, error) {
|
|
4776
|
-
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)');
|
|
4777
4226
|
FS.initialized = true;
|
|
4778
4227
|
|
|
4779
4228
|
// Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here
|
|
@@ -4786,7 +4235,6 @@ var ASM_CONSTS = {
|
|
|
4786
4235
|
quit() {
|
|
4787
4236
|
FS.initialized = false;
|
|
4788
4237
|
// force-flush all streams, so we get musl std streams printed out
|
|
4789
|
-
_fflush(0);
|
|
4790
4238
|
// close all of our streams
|
|
4791
4239
|
for (var i = 0; i < FS.streams.length; i++) {
|
|
4792
4240
|
var stream = FS.streams[i];
|
|
@@ -5073,7 +4521,6 @@ var ASM_CONSTS = {
|
|
|
5073
4521
|
if (position >= contents.length)
|
|
5074
4522
|
return 0;
|
|
5075
4523
|
var size = Math.min(contents.length - position, length);
|
|
5076
|
-
assert(size >= 0);
|
|
5077
4524
|
if (contents.slice) { // normal array
|
|
5078
4525
|
for (var i = 0; i < size; i++) {
|
|
5079
4526
|
buffer[offset + i] = contents[position + i];
|
|
@@ -5103,24 +4550,6 @@ var ASM_CONSTS = {
|
|
|
5103
4550
|
node.stream_ops = stream_ops;
|
|
5104
4551
|
return node;
|
|
5105
4552
|
},
|
|
5106
|
-
absolutePath() {
|
|
5107
|
-
abort('FS.absolutePath has been removed; use PATH_FS.resolve instead');
|
|
5108
|
-
},
|
|
5109
|
-
createFolder() {
|
|
5110
|
-
abort('FS.createFolder has been removed; use FS.mkdir instead');
|
|
5111
|
-
},
|
|
5112
|
-
createLink() {
|
|
5113
|
-
abort('FS.createLink has been removed; use FS.symlink instead');
|
|
5114
|
-
},
|
|
5115
|
-
joinPath() {
|
|
5116
|
-
abort('FS.joinPath has been removed; use PATH.join instead');
|
|
5117
|
-
},
|
|
5118
|
-
mmapAlloc() {
|
|
5119
|
-
abort('FS.mmapAlloc has been replaced by the top level function mmapAlloc');
|
|
5120
|
-
},
|
|
5121
|
-
standardizePath() {
|
|
5122
|
-
abort('FS.standardizePath has been removed; use PATH.normalize instead');
|
|
5123
|
-
},
|
|
5124
4553
|
};
|
|
5125
4554
|
|
|
5126
4555
|
var SYSCALLS = {
|
|
@@ -5299,7 +4728,6 @@ var ASM_CONSTS = {
|
|
|
5299
4728
|
|
|
5300
4729
|
|
|
5301
4730
|
var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
|
|
5302
|
-
assert(typeof maxBytesToWrite == 'number', 'stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!');
|
|
5303
4731
|
return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
|
|
5304
4732
|
};
|
|
5305
4733
|
|
|
@@ -5373,7 +4801,6 @@ var ASM_CONSTS = {
|
|
|
5373
4801
|
FS.isLink(child.mode) ? 10 : // DT_LNK, symbolic link.
|
|
5374
4802
|
8; // DT_REG, regular file.
|
|
5375
4803
|
}
|
|
5376
|
-
assert(id);
|
|
5377
4804
|
HEAP64[((dirp + pos)>>3)] = BigInt(id);
|
|
5378
4805
|
HEAP64[(((dirp + pos)+(8))>>3)] = BigInt((idx + 1) * struct_size);
|
|
5379
4806
|
HEAP16[(((dirp + pos)+(16))>>1)] = 280;
|
|
@@ -5544,7 +4971,6 @@ var ASM_CONSTS = {
|
|
|
5544
4971
|
var nofollow = flags & 256;
|
|
5545
4972
|
var allowEmpty = flags & 4096;
|
|
5546
4973
|
flags = flags & (~6400);
|
|
5547
|
-
assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`);
|
|
5548
4974
|
path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
|
|
5549
4975
|
return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path));
|
|
5550
4976
|
} catch (e) {
|
|
@@ -5683,7 +5109,6 @@ var ASM_CONSTS = {
|
|
|
5683
5109
|
try {
|
|
5684
5110
|
|
|
5685
5111
|
path = SYSCALLS.getStr(path);
|
|
5686
|
-
assert(flags === 0);
|
|
5687
5112
|
path = SYSCALLS.calculateAt(dirfd, path, true);
|
|
5688
5113
|
var now = Date.now(), atime, mtime;
|
|
5689
5114
|
if (!times) {
|
|
@@ -5725,7 +5150,7 @@ var ASM_CONSTS = {
|
|
|
5725
5150
|
|
|
5726
5151
|
|
|
5727
5152
|
var __abort_js = () =>
|
|
5728
|
-
abort('
|
|
5153
|
+
abort('');
|
|
5729
5154
|
|
|
5730
5155
|
var __emscripten_init_main_thread_js = (tb) => {
|
|
5731
5156
|
// Pass the thread address to the native code where they stored in wasm
|
|
@@ -5759,7 +5184,6 @@ var ASM_CONSTS = {
|
|
|
5759
5184
|
};
|
|
5760
5185
|
var callUserCallback = (func) => {
|
|
5761
5186
|
if (ABORT) {
|
|
5762
|
-
err('user callback triggered after runtime exited or application aborted. Ignoring.');
|
|
5763
5187
|
return;
|
|
5764
5188
|
}
|
|
5765
5189
|
try {
|
|
@@ -5779,7 +5203,6 @@ var ASM_CONSTS = {
|
|
|
5779
5203
|
// thread.
|
|
5780
5204
|
// TODO: How to make this work with wasm64?
|
|
5781
5205
|
var wait = Atomics.waitAsync(HEAP32, ((pthread_ptr)>>2), pthread_ptr);
|
|
5782
|
-
assert(wait.async);
|
|
5783
5206
|
wait.value.then(checkMailbox);
|
|
5784
5207
|
var waitingAsync = pthread_ptr + 128;
|
|
5785
5208
|
Atomics.store(HEAP32, ((waitingAsync)>>2), 1);
|
|
@@ -5810,7 +5233,6 @@ var ASM_CONSTS = {
|
|
|
5810
5233
|
} else {
|
|
5811
5234
|
var worker = PThread.pthreads[targetThread];
|
|
5812
5235
|
if (!worker) {
|
|
5813
|
-
err(`Cannot send message to thread with ID ${targetThread}, unknown thread ID!`);
|
|
5814
5236
|
return;
|
|
5815
5237
|
}
|
|
5816
5238
|
worker.postMessage({cmd: 'checkMailbox'});
|
|
@@ -5839,15 +5261,9 @@ var ASM_CONSTS = {
|
|
|
5839
5261
|
}
|
|
5840
5262
|
// Proxied JS library funcs use funcIndex and EM_ASM functions use emAsmAddr
|
|
5841
5263
|
var func = emAsmAddr ? ASM_CONSTS[emAsmAddr] : proxiedFunctionTable[funcIndex];
|
|
5842
|
-
assert(!(funcIndex && emAsmAddr));
|
|
5843
|
-
assert(func.length == numCallArgs, 'Call args mismatch in _emscripten_receive_on_main_thread_js');
|
|
5844
5264
|
PThread.currentProxiedOperationCallerThread = callingThread;
|
|
5845
5265
|
var rtn = func(...proxiedJSCallArgs);
|
|
5846
5266
|
PThread.currentProxiedOperationCallerThread = 0;
|
|
5847
|
-
// Proxied functions can return any type except bigint. All other types
|
|
5848
|
-
// cooerce to f64/double (the return type of this function in C) but not
|
|
5849
|
-
// bigint.
|
|
5850
|
-
assert(typeof rtn != "bigint");
|
|
5851
5267
|
return rtn;
|
|
5852
5268
|
};
|
|
5853
5269
|
|
|
@@ -6051,7 +5467,6 @@ var ASM_CONSTS = {
|
|
|
6051
5467
|
}
|
|
6052
5468
|
|
|
6053
5469
|
|
|
6054
|
-
|
|
6055
5470
|
var __tzset_js = (timezone, daylight, std_name, dst_name) => {
|
|
6056
5471
|
// TODO: Use (malleable) environment variables instead of system settings.
|
|
6057
5472
|
var currentYear = new Date().getFullYear();
|
|
@@ -6091,10 +5506,6 @@ var ASM_CONSTS = {
|
|
|
6091
5506
|
|
|
6092
5507
|
var winterName = extractZone(winterOffset);
|
|
6093
5508
|
var summerName = extractZone(summerOffset);
|
|
6094
|
-
assert(winterName);
|
|
6095
|
-
assert(summerName);
|
|
6096
|
-
assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`);
|
|
6097
|
-
assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`);
|
|
6098
5509
|
if (summerOffset < winterOffset) {
|
|
6099
5510
|
// Northern hemisphere
|
|
6100
5511
|
stringToUTF8(winterName, std_name, 17);
|
|
@@ -6143,7 +5554,6 @@ var ASM_CONSTS = {
|
|
|
6143
5554
|
};
|
|
6144
5555
|
|
|
6145
5556
|
var runtimeKeepalivePop = () => {
|
|
6146
|
-
assert(runtimeKeepaliveCounter > 0);
|
|
6147
5557
|
runtimeKeepaliveCounter -= 1;
|
|
6148
5558
|
};
|
|
6149
5559
|
/** @param {number=} timeout */
|
|
@@ -6155,6 +5565,13 @@ var ASM_CONSTS = {
|
|
|
6155
5565
|
}, timeout);
|
|
6156
5566
|
};
|
|
6157
5567
|
|
|
5568
|
+
var warnOnce = (text) => {
|
|
5569
|
+
warnOnce.shown ||= {};
|
|
5570
|
+
if (!warnOnce.shown[text]) {
|
|
5571
|
+
warnOnce.shown[text] = 1;
|
|
5572
|
+
err(text);
|
|
5573
|
+
}
|
|
5574
|
+
};
|
|
6158
5575
|
|
|
6159
5576
|
|
|
6160
5577
|
var Browser = {
|
|
@@ -6191,10 +5608,8 @@ var ASM_CONSTS = {
|
|
|
6191
5608
|
b = new Blob([(new Uint8Array(byteArray)).buffer], { type: Browser.getMimetype(name) });
|
|
6192
5609
|
}
|
|
6193
5610
|
var url = URL.createObjectURL(b);
|
|
6194
|
-
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
|
|
6195
5611
|
var img = new Image();
|
|
6196
5612
|
img.onload = () => {
|
|
6197
|
-
assert(img.complete, `Image ${name} could not be decoded`);
|
|
6198
5613
|
var canvas = /** @type {!HTMLCanvasElement} */ (document.createElement('canvas'));
|
|
6199
5614
|
canvas.width = img.width;
|
|
6200
5615
|
canvas.height = img.height;
|
|
@@ -6232,7 +5647,6 @@ var ASM_CONSTS = {
|
|
|
6232
5647
|
}
|
|
6233
5648
|
var b = new Blob([byteArray], { type: Browser.getMimetype(name) });
|
|
6234
5649
|
var url = URL.createObjectURL(b); // XXX we never revoke this!
|
|
6235
|
-
assert(typeof url == 'string', 'createObjectURL must return a url as a string');
|
|
6236
5650
|
var audio = new Audio();
|
|
6237
5651
|
audio.addEventListener('canplaythrough', () => finish(audio), false); // use addEventListener due to chromium bug 124926
|
|
6238
5652
|
audio.onerror = function audio_onerror(event) {
|
|
@@ -6349,7 +5763,6 @@ var ASM_CONSTS = {
|
|
|
6349
5763
|
if (!ctx) return null;
|
|
6350
5764
|
|
|
6351
5765
|
if (setInModule) {
|
|
6352
|
-
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');
|
|
6353
5766
|
Module['ctx'] = ctx;
|
|
6354
5767
|
if (useWebGL) GL.makeContextCurrent(contextHandle);
|
|
6355
5768
|
Browser.useWebGL = useWebGL;
|
|
@@ -6419,9 +5832,6 @@ var ASM_CONSTS = {
|
|
|
6419
5832
|
|
|
6420
5833
|
canvasContainer.requestFullscreen();
|
|
6421
5834
|
},
|
|
6422
|
-
requestFullScreen() {
|
|
6423
|
-
abort('Module.requestFullScreen has been replaced by Module.requestFullscreen (without a capital S)');
|
|
6424
|
-
},
|
|
6425
5835
|
exitFullscreen() {
|
|
6426
5836
|
// This is workaround for chrome. Trying to exit from fullscreen
|
|
6427
5837
|
// not in fullscreen state will cause "TypeError: Document not active"
|
|
@@ -6527,9 +5937,6 @@ var ASM_CONSTS = {
|
|
|
6527
5937
|
// (see: http://www.w3.org/TR/2013/WD-cssom-view-20131217/)
|
|
6528
5938
|
var scrollX = ((typeof window.scrollX != 'undefined') ? window.scrollX : window.pageXOffset);
|
|
6529
5939
|
var scrollY = ((typeof window.scrollY != 'undefined') ? window.scrollY : window.pageYOffset);
|
|
6530
|
-
// If this assert lands, it's likely because the browser doesn't support scrollX or pageXOffset
|
|
6531
|
-
// and we have no viable fallback.
|
|
6532
|
-
assert((typeof scrollX != 'undefined') && (typeof scrollY != 'undefined'), 'Unable to retrieve scroll position, mouse positions likely broken.');
|
|
6533
5940
|
var adjustedX = pageX - (scrollX + rect.left);
|
|
6534
5941
|
var adjustedY = pageY - (scrollY + rect.top);
|
|
6535
5942
|
|
|
@@ -7421,7 +6828,6 @@ var ASM_CONSTS = {
|
|
|
7421
6828
|
* @param {boolean=} noSetTiming
|
|
7422
6829
|
*/
|
|
7423
6830
|
var setMainLoop = (iterFunc, fps, simulateInfiniteLoop, arg, noSetTiming) => {
|
|
7424
|
-
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.');
|
|
7425
6831
|
MainLoop.func = iterFunc;
|
|
7426
6832
|
MainLoop.arg = arg;
|
|
7427
6833
|
|
|
@@ -7480,11 +6886,6 @@ var ASM_CONSTS = {
|
|
|
7480
6886
|
MainLoop.tickStartTime = _emscripten_get_now();
|
|
7481
6887
|
}
|
|
7482
6888
|
|
|
7483
|
-
if (MainLoop.method === 'timeout' && Module['ctx']) {
|
|
7484
|
-
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!');
|
|
7485
|
-
MainLoop.method = ''; // just warn once per call to set main loop
|
|
7486
|
-
}
|
|
7487
|
-
|
|
7488
6889
|
MainLoop.runIter(iterFunc);
|
|
7489
6890
|
|
|
7490
6891
|
// catch pauses from the main loop itself
|
|
@@ -7570,7 +6971,6 @@ var ASM_CONSTS = {
|
|
|
7570
6971
|
for (var post of MainLoop.postMainLoop) {
|
|
7571
6972
|
post();
|
|
7572
6973
|
}
|
|
7573
|
-
checkStackCookie();
|
|
7574
6974
|
},
|
|
7575
6975
|
nextRAF:0,
|
|
7576
6976
|
fakeRequestAnimationFrame(func) {
|
|
@@ -7601,7 +7001,6 @@ var ASM_CONSTS = {
|
|
|
7601
7001
|
MainLoop.timingValue = value;
|
|
7602
7002
|
|
|
7603
7003
|
if (!MainLoop.func) {
|
|
7604
|
-
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.');
|
|
7605
7004
|
return 1; // Return non-zero on failure, can't set timing mode when there is no main loop.
|
|
7606
7005
|
}
|
|
7607
7006
|
|
|
@@ -7724,20 +7123,11 @@ var ASM_CONSTS = {
|
|
|
7724
7123
|
|
|
7725
7124
|
var readEmAsmArgsArray = [];
|
|
7726
7125
|
var readEmAsmArgs = (sigPtr, buf) => {
|
|
7727
|
-
// Nobody should have mutated _readEmAsmArgsArray underneath us to be something else than an array.
|
|
7728
|
-
assert(Array.isArray(readEmAsmArgsArray));
|
|
7729
|
-
// The input buffer is allocated on the stack, so it must be stack-aligned.
|
|
7730
|
-
assert(buf % 16 == 0);
|
|
7731
7126
|
readEmAsmArgsArray.length = 0;
|
|
7732
7127
|
var ch;
|
|
7733
7128
|
// Most arguments are i32s, so shift the buffer pointer so it is a plain
|
|
7734
7129
|
// index into HEAP32.
|
|
7735
7130
|
while (ch = HEAPU8[sigPtr++]) {
|
|
7736
|
-
var chr = String.fromCharCode(ch);
|
|
7737
|
-
var validChars = ['d', 'f', 'i', 'p'];
|
|
7738
|
-
// In WASM_BIGINT mode we support passing i64 values as bigint.
|
|
7739
|
-
validChars.push('j');
|
|
7740
|
-
assert(validChars.includes(chr), `Invalid character ${ch}("${chr}") in readEmAsmArgs! Use only [${validChars}], and do not specify "v" for void return argument.`);
|
|
7741
7131
|
// Floats are always passed as doubles, so all types except for 'i'
|
|
7742
7132
|
// are 8 bytes and require alignment.
|
|
7743
7133
|
var wide = (ch != 105);
|
|
@@ -7757,7 +7147,6 @@ var ASM_CONSTS = {
|
|
|
7757
7147
|
};
|
|
7758
7148
|
var runEmAsmFunction = (code, sigPtr, argbuf) => {
|
|
7759
7149
|
var args = readEmAsmArgs(sigPtr, argbuf);
|
|
7760
|
-
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.`);
|
|
7761
7150
|
return ASM_CONSTS[code](...args);
|
|
7762
7151
|
};
|
|
7763
7152
|
var _emscripten_asm_const_int = (code, sigPtr, argbuf) => {
|
|
@@ -7779,7 +7168,6 @@ var ASM_CONSTS = {
|
|
|
7779
7168
|
// code paths as similar as possible on both sides.)
|
|
7780
7169
|
return proxyToMainThread(0, emAsmAddr, sync, ...args);
|
|
7781
7170
|
}
|
|
7782
|
-
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.`);
|
|
7783
7171
|
return ASM_CONSTS[emAsmAddr](...args);
|
|
7784
7172
|
};
|
|
7785
7173
|
var _emscripten_asm_const_int_sync_on_main_thread = (emAsmAddr, sigPtr, argbuf) => runMainThreadEmAsm(emAsmAddr, sigPtr, argbuf, 1);
|
|
@@ -7793,11 +7181,6 @@ var ASM_CONSTS = {
|
|
|
7793
7181
|
|
|
7794
7182
|
|
|
7795
7183
|
var _emscripten_check_blocking_allowed = () => {
|
|
7796
|
-
|
|
7797
|
-
if (ENVIRONMENT_IS_WORKER) return; // Blocking in a worker/pthread is fine.
|
|
7798
|
-
|
|
7799
|
-
warnOnce('Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread');
|
|
7800
|
-
|
|
7801
7184
|
};
|
|
7802
7185
|
|
|
7803
7186
|
|
|
@@ -7880,8 +7263,6 @@ var ASM_CONSTS = {
|
|
|
7880
7263
|
},
|
|
7881
7264
|
registerOrRemoveHandler(eventHandler) {
|
|
7882
7265
|
if (!eventHandler.target) {
|
|
7883
|
-
err('registerOrRemoveHandler: the target element for event handler registration does not exist, when processing the following event handler registration:');
|
|
7884
|
-
console.dir(eventHandler);
|
|
7885
7266
|
return -4;
|
|
7886
7267
|
}
|
|
7887
7268
|
if (eventHandler.callbackfunc) {
|
|
@@ -8310,12 +7691,10 @@ var ASM_CONSTS = {
|
|
|
8310
7691
|
|
|
8311
7692
|
|
|
8312
7693
|
|
|
8313
|
-
|
|
8314
7694
|
function _emscripten_force_exit(status) {
|
|
8315
7695
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8316
7696
|
return proxyToMainThread(42, 0, 1, status);
|
|
8317
7697
|
|
|
8318
|
-
warnOnce('emscripten_force_exit cannot actually shut down the runtime, as the build does not have EXIT_RUNTIME set');
|
|
8319
7698
|
__emscripten_runtime_keepalive_clear();
|
|
8320
7699
|
_exit(status);
|
|
8321
7700
|
|
|
@@ -8387,7 +7766,6 @@ var ASM_CONSTS = {
|
|
|
8387
7766
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8388
7767
|
return proxyToMainThread(45, 0, 1, index, gamepadState);
|
|
8389
7768
|
|
|
8390
|
-
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!';
|
|
8391
7769
|
// INVALID_PARAM is returned on a Gamepad index that never was there.
|
|
8392
7770
|
if (index < 0 || index >= JSEvents.lastGamepadState.length) return -5;
|
|
8393
7771
|
|
|
@@ -8415,7 +7793,6 @@ var ASM_CONSTS = {
|
|
|
8415
7793
|
if (ENVIRONMENT_IS_PTHREAD)
|
|
8416
7794
|
return proxyToMainThread(46, 0, 1);
|
|
8417
7795
|
|
|
8418
|
-
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!';
|
|
8419
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.
|
|
8420
7797
|
// Otherwise the following line will throw an exception.
|
|
8421
7798
|
return JSEvents.lastGamepadState.length;
|
|
@@ -9335,17 +8712,10 @@ var ASM_CONSTS = {
|
|
|
9335
8712
|
GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name));
|
|
9336
8713
|
var _emscripten_glGetAttribLocation = _glGetAttribLocation;
|
|
9337
8714
|
|
|
9338
|
-
|
|
9339
|
-
var readI53FromU64 = (ptr) => {
|
|
9340
|
-
return HEAPU32[((ptr)>>2)] + HEAPU32[(((ptr)+(4))>>2)] * 4294967296;
|
|
9341
|
-
};
|
|
9342
8715
|
var writeI53ToI64 = (ptr, num) => {
|
|
9343
8716
|
HEAPU32[((ptr)>>2)] = num;
|
|
9344
8717
|
var lower = HEAPU32[((ptr)>>2)];
|
|
9345
8718
|
HEAPU32[(((ptr)+(4))>>2)] = (num - lower)/4294967296;
|
|
9346
|
-
var deserialized = (num >= 0) ? readI53FromU64(ptr) : readI53FromI64(ptr);
|
|
9347
|
-
var offset = ((ptr)>>2);
|
|
9348
|
-
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!`);
|
|
9349
8719
|
};
|
|
9350
8720
|
|
|
9351
8721
|
|
|
@@ -11259,7 +10629,7 @@ var ASM_CONSTS = {
|
|
|
11259
10629
|
|
|
11260
10630
|
|
|
11261
10631
|
var abortOnCannotGrowMemory = (requestedSize) => {
|
|
11262
|
-
abort(
|
|
10632
|
+
abort('OOM');
|
|
11263
10633
|
};
|
|
11264
10634
|
var _emscripten_resize_heap = (requestedSize) => {
|
|
11265
10635
|
var oldSize = HEAPU8.length;
|
|
@@ -11281,7 +10651,6 @@ var ASM_CONSTS = {
|
|
|
11281
10651
|
if (navigator.getGamepads) return (JSEvents.lastGamepadState = navigator.getGamepads())
|
|
11282
10652
|
? 0 : -1;
|
|
11283
10653
|
} catch(e) {
|
|
11284
|
-
err(`navigator.getGamepads() exists, but failed to execute with exception ${e}. Disabling Gamepad access.`);
|
|
11285
10654
|
navigator.getGamepads = null; // Disable getGamepads() so that it won't be attempted to be used again.
|
|
11286
10655
|
}
|
|
11287
10656
|
return -1;
|
|
@@ -11532,7 +10901,6 @@ var ASM_CONSTS = {
|
|
|
11532
10901
|
JSEvents.keyEvent ||= _malloc(160);
|
|
11533
10902
|
|
|
11534
10903
|
var keyEventHandlerFunc = (e) => {
|
|
11535
|
-
assert(e);
|
|
11536
10904
|
|
|
11537
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.
|
|
11538
10906
|
HEAPF64[((keyEventData)>>3)] = e.timeStamp;
|
|
@@ -11605,7 +10973,6 @@ var ASM_CONSTS = {
|
|
|
11605
10973
|
|
|
11606
10974
|
|
|
11607
10975
|
var fillMouseEventData = (eventStruct, e, target) => {
|
|
11608
|
-
assert(eventStruct % 4 == 0);
|
|
11609
10976
|
HEAPF64[((eventStruct)>>3)] = e.timeStamp;
|
|
11610
10977
|
var idx = ((eventStruct)>>2);
|
|
11611
10978
|
HEAP32[idx + 2] = e.screenX;
|
|
@@ -11834,7 +11201,6 @@ var ASM_CONSTS = {
|
|
|
11834
11201
|
target = findEventTarget(target);
|
|
11835
11202
|
|
|
11836
11203
|
var touchEventHandlerFunc = (e) => {
|
|
11837
|
-
assert(e);
|
|
11838
11204
|
var t, touches = {}, et = e.touches;
|
|
11839
11205
|
// To ease marshalling different kinds of touches that browser reports (all touches are listed in e.touches,
|
|
11840
11206
|
// only changed touches in e.changedTouches, and touches on target at a.targetTouches), mark a boolean in
|
|
@@ -12090,7 +11456,6 @@ var ASM_CONSTS = {
|
|
|
12090
11456
|
|
|
12091
11457
|
var stringToAscii = (str, buffer) => {
|
|
12092
11458
|
for (var i = 0; i < str.length; ++i) {
|
|
12093
|
-
assert(str.charCodeAt(i) === (str.charCodeAt(i) & 0xff));
|
|
12094
11459
|
HEAP8[buffer++] = str.charCodeAt(i);
|
|
12095
11460
|
}
|
|
12096
11461
|
// Null-terminate the string
|
|
@@ -12299,7 +11664,6 @@ var ASM_CONSTS = {
|
|
|
12299
11664
|
};
|
|
12300
11665
|
|
|
12301
11666
|
var dynCall = (sig, ptr, args = []) => {
|
|
12302
|
-
assert(getWasmTableEntry(ptr), `missing table entry in dynCall: ${ptr}`);
|
|
12303
11667
|
var rtn = getWasmTableEntry(ptr)(...args);
|
|
12304
11668
|
return rtn;
|
|
12305
11669
|
};
|
|
@@ -12310,13 +11674,11 @@ var ASM_CONSTS = {
|
|
|
12310
11674
|
|
|
12311
11675
|
var getCFunc = (ident) => {
|
|
12312
11676
|
var func = Module['_' + ident]; // closure exported function
|
|
12313
|
-
assert(func, 'Cannot call unknown function ' + ident + ', make sure it is exported');
|
|
12314
11677
|
return func;
|
|
12315
11678
|
};
|
|
12316
11679
|
|
|
12317
11680
|
|
|
12318
11681
|
var writeArrayToMemory = (array, buffer) => {
|
|
12319
|
-
assert(array.length >= 0, 'writeArrayToMemory array must have a length (should be an array or typed array)')
|
|
12320
11682
|
HEAP8.set(array, buffer);
|
|
12321
11683
|
};
|
|
12322
11684
|
|
|
@@ -12359,7 +11721,6 @@ var ASM_CONSTS = {
|
|
|
12359
11721
|
var func = getCFunc(ident);
|
|
12360
11722
|
var cArgs = [];
|
|
12361
11723
|
var stack = 0;
|
|
12362
|
-
assert(returnType !== 'array', 'Return type should not be "array".');
|
|
12363
11724
|
if (args) {
|
|
12364
11725
|
for (var i = 0; i < args.length; i++) {
|
|
12365
11726
|
var converter = toC[argTypes[i]];
|
|
@@ -12387,11 +11748,17 @@ var ASM_CONSTS = {
|
|
|
12387
11748
|
* @param {Object=} opts
|
|
12388
11749
|
*/
|
|
12389
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
|
+
}
|
|
12390
11758
|
return (...args) => ccall(ident, returnType, argTypes, args, opts);
|
|
12391
11759
|
};
|
|
12392
11760
|
|
|
12393
11761
|
var uleb128Encode = (n, target) => {
|
|
12394
|
-
assert(n < 16384);
|
|
12395
11762
|
if (n < 128) {
|
|
12396
11763
|
target.push(n);
|
|
12397
11764
|
} else {
|
|
@@ -12413,7 +11780,6 @@ var ASM_CONSTS = {
|
|
|
12413
11780
|
results: sig[0] == 'v' ? [] : [typeNames[sig[0]]]
|
|
12414
11781
|
};
|
|
12415
11782
|
for (var i = 1; i < sig.length; ++i) {
|
|
12416
|
-
assert(sig[i] in typeNames, 'invalid signature char: ' + sig[i]);
|
|
12417
11783
|
type.parameters.push(typeNames[sig[i]]);
|
|
12418
11784
|
}
|
|
12419
11785
|
return type;
|
|
@@ -12435,7 +11801,6 @@ var ASM_CONSTS = {
|
|
|
12435
11801
|
target.push(0x60 /* form: func */);
|
|
12436
11802
|
uleb128Encode(sigParam.length, target);
|
|
12437
11803
|
for (var i = 0; i < sigParam.length; ++i) {
|
|
12438
|
-
assert(sigParam[i] in typeCodes, 'invalid signature char: ' + sigParam[i]);
|
|
12439
11804
|
target.push(typeCodes[sigParam[i]]);
|
|
12440
11805
|
}
|
|
12441
11806
|
|
|
@@ -12551,7 +11916,6 @@ var ASM_CONSTS = {
|
|
|
12551
11916
|
|
|
12552
11917
|
/** @param {string=} sig */
|
|
12553
11918
|
var addFunction = (func, sig) => {
|
|
12554
|
-
assert(typeof func != 'undefined');
|
|
12555
11919
|
// Check if the function is already in the table, to ensure each function
|
|
12556
11920
|
// gets a unique index.
|
|
12557
11921
|
var rtn = getFunctionAddress(func);
|
|
@@ -12571,7 +11935,6 @@ var ASM_CONSTS = {
|
|
|
12571
11935
|
if (!(err instanceof TypeError)) {
|
|
12572
11936
|
throw err;
|
|
12573
11937
|
}
|
|
12574
|
-
assert(typeof sig != 'undefined', 'Missing signature argument to addFunction: ' + func);
|
|
12575
11938
|
var wrapped = convertJsFunctionToWasm(func, sig);
|
|
12576
11939
|
setWasmTableEntry(ret, wrapped);
|
|
12577
11940
|
}
|
|
@@ -12597,9 +11960,15 @@ PThread.init();;
|
|
|
12597
11960
|
// Set module methods based on EXPORTED_RUNTIME_METHODS
|
|
12598
11961
|
;
|
|
12599
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
|
+
|
|
12600
11970
|
// exports
|
|
12601
11971
|
Module['requestFullscreen'] = Browser.requestFullscreen;
|
|
12602
|
-
Module['requestFullScreen'] = Browser.requestFullScreen;
|
|
12603
11972
|
Module['setCanvasSize'] = Browser.setCanvasSize;
|
|
12604
11973
|
Module['getUserMedia'] = Browser.getUserMedia;
|
|
12605
11974
|
Module['createContext'] = Browser.createContext;
|
|
@@ -12700,9 +12069,6 @@ var proxiedFunctionTable = [
|
|
|
12700
12069
|
_fd_write
|
|
12701
12070
|
];
|
|
12702
12071
|
|
|
12703
|
-
function checkIncomingModuleAPI() {
|
|
12704
|
-
ignoredModuleProp('fetchSettings');
|
|
12705
|
-
}
|
|
12706
12072
|
var wasmImports;
|
|
12707
12073
|
function assignWasmImports() {
|
|
12708
12074
|
wasmImports = {
|
|
@@ -13503,73 +12869,67 @@ function assignWasmImports() {
|
|
|
13503
12869
|
};
|
|
13504
12870
|
}
|
|
13505
12871
|
var wasmExports = await createWasm();
|
|
13506
|
-
var ___wasm_call_ctors =
|
|
13507
|
-
var _screenshot = Module['_screenshot'] =
|
|
13508
|
-
var _buttonPress = Module['_buttonPress'] =
|
|
13509
|
-
var _buttonUnpress = Module['_buttonUnpress'] =
|
|
13510
|
-
var _toggleRewind = Module['_toggleRewind'] =
|
|
13511
|
-
var _setVolume = Module['_setVolume'] =
|
|
13512
|
-
var _getVolume = Module['_getVolume'] =
|
|
13513
|
-
var _getMainLoopTimingMode = Module['_getMainLoopTimingMode'] =
|
|
13514
|
-
var _getMainLoopTimingValue = Module['_getMainLoopTimingValue'] =
|
|
13515
|
-
var _setMainLoopTiming = Module['_setMainLoopTiming'] =
|
|
13516
|
-
var _setFastForwardMultiplier = Module['_setFastForwardMultiplier'] =
|
|
13517
|
-
var _getFastForwardMultiplier = Module['_getFastForwardMultiplier'] =
|
|
13518
|
-
var _quitGame = Module['_quitGame'] =
|
|
13519
|
-
var _free =
|
|
13520
|
-
var _quitMgba = Module['_quitMgba'] =
|
|
13521
|
-
var _quickReload = Module['_quickReload'] =
|
|
13522
|
-
var _pauseGame = Module['_pauseGame'] =
|
|
13523
|
-
var _resumeGame = Module['_resumeGame'] =
|
|
13524
|
-
var _setEventEnable = Module['_setEventEnable'] =
|
|
13525
|
-
var _bindKey = Module['_bindKey'] =
|
|
13526
|
-
var _saveState = Module['_saveState'] =
|
|
13527
|
-
var _loadState = Module['_loadState'] =
|
|
13528
|
-
var _autoLoadCheats = Module['_autoLoadCheats'] =
|
|
13529
|
-
var _loadGame = Module['_loadGame'] =
|
|
13530
|
-
var _saveStateSlot = Module['_saveStateSlot'] =
|
|
13531
|
-
var _loadStateSlot = Module['_loadStateSlot'] =
|
|
13532
|
-
var _addCoreCallbacks = Module['_addCoreCallbacks'] =
|
|
13533
|
-
var _setIntegerCoreSetting = Module['_setIntegerCoreSetting'] =
|
|
13534
|
-
var _setupConstants = Module['_setupConstants'] =
|
|
13535
|
-
var _main = Module['_main'] =
|
|
13536
|
-
var _malloc =
|
|
13537
|
-
var _strerror = createExportWrapper('strerror', 1);
|
|
13538
|
-
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);
|
|
13539
12903
|
var _pthread_self = () => (_pthread_self = wasmExports['pthread_self'])();
|
|
13540
|
-
var __emscripten_tls_init =
|
|
13541
|
-
var _emscripten_builtin_memalign =
|
|
13542
|
-
var __emscripten_run_callback_on_thread =
|
|
13543
|
-
var __emscripten_thread_init =
|
|
13544
|
-
var __emscripten_thread_crashed =
|
|
13545
|
-
var
|
|
13546
|
-
var
|
|
13547
|
-
var
|
|
13548
|
-
var
|
|
13549
|
-
var
|
|
13550
|
-
var __emscripten_check_mailbox = createExportWrapper('_emscripten_check_mailbox', 0);
|
|
13551
|
-
var _setThrew = createExportWrapper('setThrew', 2);
|
|
13552
|
-
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);
|
|
13553
12914
|
var _emscripten_stack_set_limits = (a0, a1) => (_emscripten_stack_set_limits = wasmExports['emscripten_stack_set_limits'])(a0, a1);
|
|
13554
|
-
var _emscripten_stack_get_free = () => (_emscripten_stack_get_free = wasmExports['emscripten_stack_get_free'])();
|
|
13555
12915
|
var __emscripten_stack_restore = (a0) => (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])(a0);
|
|
13556
12916
|
var __emscripten_stack_alloc = (a0) => (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0);
|
|
13557
12917
|
var _emscripten_stack_get_current = () => (_emscripten_stack_get_current = wasmExports['emscripten_stack_get_current'])();
|
|
13558
|
-
var _GBAInputInfo = Module['_GBAInputInfo'] =
|
|
13559
|
-
var _binaryName = Module['_binaryName'] =
|
|
13560
|
-
var _projectName = Module['_projectName'] =
|
|
13561
|
-
var _projectVersion = Module['_projectVersion'] =
|
|
13562
|
-
var _gitCommit = Module['_gitCommit'] =
|
|
13563
|
-
var _gitCommitShort = Module['_gitCommitShort'] =
|
|
13564
|
-
var _gitBranch = Module['_gitBranch'] =
|
|
13565
|
-
var _gitRevision = Module['_gitRevision'] =
|
|
13566
|
-
var _GBIORegisterNames = Module['_GBIORegisterNames'] =
|
|
13567
|
-
var _GBSavestateMagic = Module['_GBSavestateMagic'] =
|
|
13568
|
-
var _GBSavestateVersion = Module['_GBSavestateVersion'] =
|
|
13569
|
-
var _GBA_LUX_LEVELS = Module['_GBA_LUX_LEVELS'] =
|
|
13570
|
-
var _GBAVideoObjSizes = Module['_GBAVideoObjSizes'] =
|
|
13571
|
-
var _GBASavestateMagic = Module['_GBASavestateMagic'] =
|
|
13572
|
-
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;
|
|
13573
12933
|
function invoke_iiiii(index,a1,a2,a3,a4) {
|
|
13574
12934
|
var sp = stackSave();
|
|
13575
12935
|
try {
|
|
@@ -13688,316 +13048,9 @@ Module['cwrap'] = cwrap;
|
|
|
13688
13048
|
Module['addFunction'] = addFunction;
|
|
13689
13049
|
Module['removeFunction'] = removeFunction;
|
|
13690
13050
|
Module['FS'] = FS;
|
|
13691
|
-
var missingLibrarySymbols = [
|
|
13692
|
-
'writeI53ToI64Clamped',
|
|
13693
|
-
'writeI53ToI64Signaling',
|
|
13694
|
-
'writeI53ToU64Clamped',
|
|
13695
|
-
'writeI53ToU64Signaling',
|
|
13696
|
-
'convertI32PairToI53',
|
|
13697
|
-
'convertI32PairToI53Checked',
|
|
13698
|
-
'convertU32PairToI53',
|
|
13699
|
-
'getTempRet0',
|
|
13700
|
-
'setTempRet0',
|
|
13701
|
-
'growMemory',
|
|
13702
|
-
'inetPton4',
|
|
13703
|
-
'inetNtop4',
|
|
13704
|
-
'inetPton6',
|
|
13705
|
-
'inetNtop6',
|
|
13706
|
-
'readSockaddr',
|
|
13707
|
-
'writeSockaddr',
|
|
13708
|
-
'emscriptenLog',
|
|
13709
|
-
'getDynCaller',
|
|
13710
|
-
'asmjsMangle',
|
|
13711
|
-
'HandleAllocator',
|
|
13712
|
-
'getNativeTypeSize',
|
|
13713
|
-
'addOnInit',
|
|
13714
|
-
'addOnPostCtor',
|
|
13715
|
-
'addOnPreMain',
|
|
13716
|
-
'STACK_SIZE',
|
|
13717
|
-
'STACK_ALIGN',
|
|
13718
|
-
'POINTER_SIZE',
|
|
13719
|
-
'ASSERTIONS',
|
|
13720
|
-
'reallyNegative',
|
|
13721
|
-
'unSign',
|
|
13722
|
-
'strLen',
|
|
13723
|
-
'reSign',
|
|
13724
|
-
'formatString',
|
|
13725
|
-
'intArrayToString',
|
|
13726
|
-
'AsciiToString',
|
|
13727
|
-
'UTF16ToString',
|
|
13728
|
-
'stringToUTF16',
|
|
13729
|
-
'lengthBytesUTF16',
|
|
13730
|
-
'UTF32ToString',
|
|
13731
|
-
'stringToUTF32',
|
|
13732
|
-
'lengthBytesUTF32',
|
|
13733
|
-
'fillDeviceOrientationEventData',
|
|
13734
|
-
'registerDeviceOrientationEventCallback',
|
|
13735
|
-
'fillDeviceMotionEventData',
|
|
13736
|
-
'registerDeviceMotionEventCallback',
|
|
13737
|
-
'screenOrientation',
|
|
13738
|
-
'fillOrientationChangeEventData',
|
|
13739
|
-
'registerOrientationChangeEventCallback',
|
|
13740
|
-
'hideEverythingExceptGivenElement',
|
|
13741
|
-
'restoreHiddenElements',
|
|
13742
|
-
'softFullscreenResizeWebGLRenderTarget',
|
|
13743
|
-
'registerPointerlockErrorEventCallback',
|
|
13744
|
-
'fillBatteryEventData',
|
|
13745
|
-
'battery',
|
|
13746
|
-
'registerBatteryEventCallback',
|
|
13747
|
-
'jsStackTrace',
|
|
13748
|
-
'getCallstack',
|
|
13749
|
-
'convertPCtoSourceLocation',
|
|
13750
|
-
'wasiRightsToMuslOFlags',
|
|
13751
|
-
'wasiOFlagsToMuslOFlags',
|
|
13752
|
-
'setImmediateWrapped',
|
|
13753
|
-
'safeRequestAnimationFrame',
|
|
13754
|
-
'clearImmediateWrapped',
|
|
13755
|
-
'registerPostMainLoop',
|
|
13756
|
-
'registerPreMainLoop',
|
|
13757
|
-
'getPromise',
|
|
13758
|
-
'makePromise',
|
|
13759
|
-
'idsToPromises',
|
|
13760
|
-
'makePromiseCallback',
|
|
13761
|
-
'ExceptionInfo',
|
|
13762
|
-
'findMatchingCatch',
|
|
13763
|
-
'Browser_asyncPrepareDataCounter',
|
|
13764
|
-
'arraySum',
|
|
13765
|
-
'addDays',
|
|
13766
|
-
'getSocketFromFD',
|
|
13767
|
-
'getSocketAddress',
|
|
13768
|
-
'FS_unlink',
|
|
13769
|
-
'FS_mkdirTree',
|
|
13770
|
-
'_setNetworkCallback',
|
|
13771
|
-
'writeGLArray',
|
|
13772
|
-
'emscripten_webgl_destroy_context_before_on_calling_thread',
|
|
13773
|
-
'registerWebGlEventCallback',
|
|
13774
|
-
'runAndAbortIfError',
|
|
13775
|
-
'ALLOC_NORMAL',
|
|
13776
|
-
'ALLOC_STACK',
|
|
13777
|
-
'allocate',
|
|
13778
|
-
'writeStringToMemory',
|
|
13779
|
-
'writeAsciiToMemory',
|
|
13780
|
-
'setErrNo',
|
|
13781
|
-
'demangle',
|
|
13782
|
-
'stackTrace',
|
|
13783
|
-
];
|
|
13784
|
-
missingLibrarySymbols.forEach(missingLibrarySymbol)
|
|
13785
|
-
|
|
13786
|
-
var unexportedSymbols = [
|
|
13787
|
-
'run',
|
|
13788
|
-
'addRunDependency',
|
|
13789
|
-
'removeRunDependency',
|
|
13790
|
-
'out',
|
|
13791
|
-
'err',
|
|
13792
|
-
'callMain',
|
|
13793
|
-
'abort',
|
|
13794
|
-
'wasmMemory',
|
|
13795
|
-
'wasmExports',
|
|
13796
|
-
'writeStackCookie',
|
|
13797
|
-
'checkStackCookie',
|
|
13798
|
-
'writeI53ToI64',
|
|
13799
|
-
'readI53FromI64',
|
|
13800
|
-
'readI53FromU64',
|
|
13801
|
-
'INT53_MAX',
|
|
13802
|
-
'INT53_MIN',
|
|
13803
|
-
'bigintToI53Checked',
|
|
13804
|
-
'stackSave',
|
|
13805
|
-
'stackRestore',
|
|
13806
|
-
'stackAlloc',
|
|
13807
|
-
'ptrToString',
|
|
13808
|
-
'zeroMemory',
|
|
13809
|
-
'exitJS',
|
|
13810
|
-
'getHeapMax',
|
|
13811
|
-
'abortOnCannotGrowMemory',
|
|
13812
|
-
'ENV',
|
|
13813
|
-
'ERRNO_CODES',
|
|
13814
|
-
'strError',
|
|
13815
|
-
'DNS',
|
|
13816
|
-
'Protocols',
|
|
13817
|
-
'Sockets',
|
|
13818
|
-
'timers',
|
|
13819
|
-
'warnOnce',
|
|
13820
|
-
'readEmAsmArgsArray',
|
|
13821
|
-
'readEmAsmArgs',
|
|
13822
|
-
'runEmAsmFunction',
|
|
13823
|
-
'runMainThreadEmAsm',
|
|
13824
|
-
'jstoi_q',
|
|
13825
|
-
'jstoi_s',
|
|
13826
|
-
'getExecutableName',
|
|
13827
|
-
'listenOnce',
|
|
13828
|
-
'autoResumeAudioContext',
|
|
13829
|
-
'dynCall',
|
|
13830
|
-
'handleException',
|
|
13831
|
-
'keepRuntimeAlive',
|
|
13832
|
-
'runtimeKeepalivePush',
|
|
13833
|
-
'runtimeKeepalivePop',
|
|
13834
|
-
'callUserCallback',
|
|
13835
|
-
'maybeExit',
|
|
13836
|
-
'asyncLoad',
|
|
13837
|
-
'alignMemory',
|
|
13838
|
-
'mmapAlloc',
|
|
13839
|
-
'wasmTable',
|
|
13840
|
-
'noExitRuntime',
|
|
13841
|
-
'addOnPreRun',
|
|
13842
|
-
'addOnExit',
|
|
13843
|
-
'addOnPostRun',
|
|
13844
|
-
'getCFunc',
|
|
13845
|
-
'ccall',
|
|
13846
|
-
'uleb128Encode',
|
|
13847
|
-
'sigToWasmTypes',
|
|
13848
|
-
'generateFuncType',
|
|
13849
|
-
'convertJsFunctionToWasm',
|
|
13850
|
-
'freeTableIndexes',
|
|
13851
|
-
'functionsInTableMap',
|
|
13852
|
-
'getEmptyTableSlot',
|
|
13853
|
-
'updateTableMap',
|
|
13854
|
-
'getFunctionAddress',
|
|
13855
|
-
'setValue',
|
|
13856
|
-
'getValue',
|
|
13857
|
-
'PATH',
|
|
13858
|
-
'PATH_FS',
|
|
13859
|
-
'UTF8Decoder',
|
|
13860
|
-
'UTF8ArrayToString',
|
|
13861
|
-
'UTF8ToString',
|
|
13862
|
-
'stringToUTF8Array',
|
|
13863
|
-
'stringToUTF8',
|
|
13864
|
-
'lengthBytesUTF8',
|
|
13865
|
-
'intArrayFromString',
|
|
13866
|
-
'stringToAscii',
|
|
13867
|
-
'UTF16Decoder',
|
|
13868
|
-
'stringToNewUTF8',
|
|
13869
|
-
'stringToUTF8OnStack',
|
|
13870
|
-
'writeArrayToMemory',
|
|
13871
|
-
'JSEvents',
|
|
13872
|
-
'registerKeyEventCallback',
|
|
13873
|
-
'specialHTMLTargets',
|
|
13874
|
-
'maybeCStringToJsString',
|
|
13875
|
-
'findEventTarget',
|
|
13876
|
-
'findCanvasEventTarget',
|
|
13877
|
-
'getBoundingClientRect',
|
|
13878
|
-
'fillMouseEventData',
|
|
13879
|
-
'registerMouseEventCallback',
|
|
13880
|
-
'registerWheelEventCallback',
|
|
13881
|
-
'registerUiEventCallback',
|
|
13882
|
-
'registerFocusEventCallback',
|
|
13883
|
-
'fillFullscreenChangeEventData',
|
|
13884
|
-
'registerFullscreenChangeEventCallback',
|
|
13885
|
-
'JSEvents_requestFullscreen',
|
|
13886
|
-
'JSEvents_resizeCanvasForFullscreen',
|
|
13887
|
-
'registerRestoreOldStyle',
|
|
13888
|
-
'setLetterbox',
|
|
13889
|
-
'currentFullscreenStrategy',
|
|
13890
|
-
'restoreOldWindowedStyle',
|
|
13891
|
-
'doRequestFullscreen',
|
|
13892
|
-
'fillPointerlockChangeEventData',
|
|
13893
|
-
'registerPointerlockChangeEventCallback',
|
|
13894
|
-
'requestPointerLock',
|
|
13895
|
-
'fillVisibilityChangeEventData',
|
|
13896
|
-
'registerVisibilityChangeEventCallback',
|
|
13897
|
-
'registerTouchEventCallback',
|
|
13898
|
-
'fillGamepadEventData',
|
|
13899
|
-
'registerGamepadEventCallback',
|
|
13900
|
-
'registerBeforeUnloadEventCallback',
|
|
13901
|
-
'setCanvasElementSizeCallingThread',
|
|
13902
|
-
'setCanvasElementSizeMainThread',
|
|
13903
|
-
'setCanvasElementSize',
|
|
13904
|
-
'getCanvasSizeCallingThread',
|
|
13905
|
-
'getCanvasSizeMainThread',
|
|
13906
|
-
'getCanvasElementSize',
|
|
13907
|
-
'UNWIND_CACHE',
|
|
13908
|
-
'ExitStatus',
|
|
13909
|
-
'getEnvStrings',
|
|
13910
|
-
'checkWasiClock',
|
|
13911
|
-
'doReadv',
|
|
13912
|
-
'doWritev',
|
|
13913
|
-
'initRandomFill',
|
|
13914
|
-
'randomFill',
|
|
13915
|
-
'safeSetTimeout',
|
|
13916
|
-
'emSetImmediate',
|
|
13917
|
-
'emClearImmediate_deps',
|
|
13918
|
-
'emClearImmediate',
|
|
13919
|
-
'promiseMap',
|
|
13920
|
-
'uncaughtExceptionCount',
|
|
13921
|
-
'exceptionLast',
|
|
13922
|
-
'exceptionCaught',
|
|
13923
|
-
'Browser',
|
|
13924
|
-
'getPreloadedImageData__data',
|
|
13925
|
-
'wget',
|
|
13926
|
-
'MONTH_DAYS_REGULAR',
|
|
13927
|
-
'MONTH_DAYS_LEAP',
|
|
13928
|
-
'MONTH_DAYS_REGULAR_CUMULATIVE',
|
|
13929
|
-
'MONTH_DAYS_LEAP_CUMULATIVE',
|
|
13930
|
-
'isLeapYear',
|
|
13931
|
-
'ydayFromDate',
|
|
13932
|
-
'SYSCALLS',
|
|
13933
|
-
'preloadPlugins',
|
|
13934
|
-
'FS_createPreloadedFile',
|
|
13935
|
-
'FS_modeStringToFlags',
|
|
13936
|
-
'FS_getMode',
|
|
13937
|
-
'FS_stdin_getChar_buffer',
|
|
13938
|
-
'FS_stdin_getChar',
|
|
13939
|
-
'FS_createPath',
|
|
13940
|
-
'FS_createDevice',
|
|
13941
|
-
'FS_readFile',
|
|
13942
|
-
'FS_createDataFile',
|
|
13943
|
-
'FS_createLazyFile',
|
|
13944
|
-
'MEMFS',
|
|
13945
|
-
'TTY',
|
|
13946
|
-
'PIPEFS',
|
|
13947
|
-
'SOCKFS',
|
|
13948
|
-
'tempFixedLengthArray',
|
|
13949
|
-
'miniTempWebGLFloatBuffers',
|
|
13950
|
-
'miniTempWebGLIntBuffers',
|
|
13951
|
-
'heapObjectForWebGLType',
|
|
13952
|
-
'toTypedArrayIndex',
|
|
13953
|
-
'webgl_enable_WEBGL_multi_draw',
|
|
13954
|
-
'webgl_enable_EXT_polygon_offset_clamp',
|
|
13955
|
-
'webgl_enable_EXT_clip_control',
|
|
13956
|
-
'webgl_enable_WEBGL_polygon_mode',
|
|
13957
|
-
'GL',
|
|
13958
|
-
'emscriptenWebGLGet',
|
|
13959
|
-
'computeUnpackAlignedImageSize',
|
|
13960
|
-
'colorChannelsInGlTextureFormat',
|
|
13961
|
-
'emscriptenWebGLGetTexPixelData',
|
|
13962
|
-
'emscriptenWebGLGetUniform',
|
|
13963
|
-
'webglGetUniformLocation',
|
|
13964
|
-
'webglPrepareUniformLocationsBeforeFirstUse',
|
|
13965
|
-
'webglGetLeftBracePos',
|
|
13966
|
-
'emscriptenWebGLGetVertexAttrib',
|
|
13967
|
-
'__glGetActiveAttribOrUniform',
|
|
13968
|
-
'AL',
|
|
13969
|
-
'GLUT',
|
|
13970
|
-
'EGL',
|
|
13971
|
-
'GLEW',
|
|
13972
|
-
'IDBStore',
|
|
13973
|
-
'emscriptenWebGLGetIndexed',
|
|
13974
|
-
'webgl_enable_WEBGL_draw_instanced_base_vertex_base_instance',
|
|
13975
|
-
'webgl_enable_WEBGL_multi_draw_instanced_base_vertex_base_instance',
|
|
13976
|
-
'allocateUTF8',
|
|
13977
|
-
'allocateUTF8OnStack',
|
|
13978
|
-
'print',
|
|
13979
|
-
'printErr',
|
|
13980
|
-
'PThread',
|
|
13981
|
-
'terminateWorker',
|
|
13982
|
-
'cleanupThread',
|
|
13983
|
-
'registerTLSInit',
|
|
13984
|
-
'spawnThread',
|
|
13985
|
-
'exitOnMainThread',
|
|
13986
|
-
'proxyToMainThread',
|
|
13987
|
-
'proxiedJSCallArgs',
|
|
13988
|
-
'invokeEntryPoint',
|
|
13989
|
-
'checkMailbox',
|
|
13990
|
-
'IDBFS',
|
|
13991
|
-
];
|
|
13992
|
-
unexportedSymbols.forEach(unexportedRuntimeSymbol);
|
|
13993
|
-
|
|
13994
13051
|
|
|
13995
13052
|
|
|
13996
|
-
var calledRun;
|
|
13997
|
-
|
|
13998
13053
|
function callMain() {
|
|
13999
|
-
assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
|
|
14000
|
-
assert(typeof onPreRuns === 'undefined' || onPreRuns.length == 0, 'cannot call main when preRun functions remain to be called');
|
|
14001
13054
|
|
|
14002
13055
|
var entryFunction = _main;
|
|
14003
13056
|
|
|
@@ -14016,17 +13069,6 @@ function callMain() {
|
|
|
14016
13069
|
}
|
|
14017
13070
|
}
|
|
14018
13071
|
|
|
14019
|
-
function stackCheckInit() {
|
|
14020
|
-
// This is normally called automatically during __wasm_call_ctors but need to
|
|
14021
|
-
// get these values before even running any of the ctors so we call it redundantly
|
|
14022
|
-
// here.
|
|
14023
|
-
// See $establishStackSpace for the equivalent code that runs on a thread
|
|
14024
|
-
assert(!ENVIRONMENT_IS_PTHREAD);
|
|
14025
|
-
_emscripten_stack_init();
|
|
14026
|
-
// TODO(sbc): Move writeStackCookie to native to to avoid this.
|
|
14027
|
-
writeStackCookie();
|
|
14028
|
-
}
|
|
14029
|
-
|
|
14030
13072
|
function run() {
|
|
14031
13073
|
|
|
14032
13074
|
if (runDependencies > 0) {
|
|
@@ -14040,8 +13082,6 @@ function run() {
|
|
|
14040
13082
|
return;
|
|
14041
13083
|
}
|
|
14042
13084
|
|
|
14043
|
-
stackCheckInit();
|
|
14044
|
-
|
|
14045
13085
|
preRun();
|
|
14046
13086
|
|
|
14047
13087
|
// a preRun added a dependency, run will be called later
|
|
@@ -14053,8 +13093,6 @@ function run() {
|
|
|
14053
13093
|
function doRun() {
|
|
14054
13094
|
// run may have just been called through dependencies being fulfilled just in this very frame,
|
|
14055
13095
|
// or while the async setStatus time below was happening
|
|
14056
|
-
assert(!calledRun);
|
|
14057
|
-
calledRun = true;
|
|
14058
13096
|
Module['calledRun'] = true;
|
|
14059
13097
|
|
|
14060
13098
|
if (ABORT) return;
|
|
@@ -14065,9 +13103,8 @@ function run() {
|
|
|
14065
13103
|
|
|
14066
13104
|
readyPromiseResolve(Module);
|
|
14067
13105
|
Module['onRuntimeInitialized']?.();
|
|
14068
|
-
consumedModuleProp('onRuntimeInitialized');
|
|
14069
13106
|
|
|
14070
|
-
var noInitialRun = Module['noInitialRun'];
|
|
13107
|
+
var noInitialRun = Module['noInitialRun'];
|
|
14071
13108
|
if (!noInitialRun) callMain();
|
|
14072
13109
|
|
|
14073
13110
|
postRun();
|
|
@@ -14083,46 +13120,6 @@ function run() {
|
|
|
14083
13120
|
{
|
|
14084
13121
|
doRun();
|
|
14085
13122
|
}
|
|
14086
|
-
checkStackCookie();
|
|
14087
|
-
}
|
|
14088
|
-
|
|
14089
|
-
function checkUnflushedContent() {
|
|
14090
|
-
// Compiler settings do not allow exiting the runtime, so flushing
|
|
14091
|
-
// the streams is not possible. but in ASSERTIONS mode we check
|
|
14092
|
-
// if there was something to flush, and if so tell the user they
|
|
14093
|
-
// should request that the runtime be exitable.
|
|
14094
|
-
// Normally we would not even include flush() at all, but in ASSERTIONS
|
|
14095
|
-
// builds we do so just for this check, and here we see if there is any
|
|
14096
|
-
// content to flush, that is, we check if there would have been
|
|
14097
|
-
// something a non-ASSERTIONS build would have not seen.
|
|
14098
|
-
// How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0
|
|
14099
|
-
// mode (which has its own special function for this; otherwise, all
|
|
14100
|
-
// the code is inside libc)
|
|
14101
|
-
var oldOut = out;
|
|
14102
|
-
var oldErr = err;
|
|
14103
|
-
var has = false;
|
|
14104
|
-
out = err = (x) => {
|
|
14105
|
-
has = true;
|
|
14106
|
-
}
|
|
14107
|
-
try { // it doesn't matter if it fails
|
|
14108
|
-
_fflush(0);
|
|
14109
|
-
// also flush in the JS FS layer
|
|
14110
|
-
['stdout', 'stderr'].forEach((name) => {
|
|
14111
|
-
var info = FS.analyzePath('/dev/' + name);
|
|
14112
|
-
if (!info) return;
|
|
14113
|
-
var stream = info.object;
|
|
14114
|
-
var rdev = stream.rdev;
|
|
14115
|
-
var tty = TTY.ttys[rdev];
|
|
14116
|
-
if (tty?.output?.length) {
|
|
14117
|
-
has = true;
|
|
14118
|
-
}
|
|
14119
|
-
});
|
|
14120
|
-
} catch(e) {}
|
|
14121
|
-
out = oldOut;
|
|
14122
|
-
err = oldErr;
|
|
14123
|
-
if (has) {
|
|
14124
|
-
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.');
|
|
14125
|
-
}
|
|
14126
13123
|
}
|
|
14127
13124
|
|
|
14128
13125
|
if (Module['preInit']) {
|
|
@@ -14131,7 +13128,6 @@ if (Module['preInit']) {
|
|
|
14131
13128
|
Module['preInit'].pop()();
|
|
14132
13129
|
}
|
|
14133
13130
|
}
|
|
14134
|
-
consumedModuleProp('preInit');
|
|
14135
13131
|
|
|
14136
13132
|
run();
|
|
14137
13133
|
|
|
@@ -14146,21 +13142,6 @@ run();
|
|
|
14146
13142
|
|
|
14147
13143
|
moduleRtn = readyPromise;
|
|
14148
13144
|
|
|
14149
|
-
// Assertion for attempting to access module properties on the incoming
|
|
14150
|
-
// moduleArg. In the past we used this object as the prototype of the module
|
|
14151
|
-
// and assigned properties to it, but now we return a distinct object. This
|
|
14152
|
-
// keeps the instance private until it is ready (i.e the promise has been
|
|
14153
|
-
// resolved).
|
|
14154
|
-
for (const prop of Object.keys(Module)) {
|
|
14155
|
-
if (!(prop in moduleArg)) {
|
|
14156
|
-
Object.defineProperty(moduleArg, prop, {
|
|
14157
|
-
configurable: true,
|
|
14158
|
-
get() {
|
|
14159
|
-
abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)
|
|
14160
|
-
}
|
|
14161
|
-
});
|
|
14162
|
-
}
|
|
14163
|
-
}
|
|
14164
13145
|
// end include: postamble_modularize.js
|
|
14165
13146
|
|
|
14166
13147
|
|
|
@@ -14169,15 +13150,6 @@ for (const prop of Object.keys(Module)) {
|
|
|
14169
13150
|
}
|
|
14170
13151
|
);
|
|
14171
13152
|
})();
|
|
14172
|
-
(() => {
|
|
14173
|
-
// Create a small, never-async wrapper around mGBA which
|
|
14174
|
-
// checks for callers incorrectly using it with `new`.
|
|
14175
|
-
var real_mGBA = mGBA;
|
|
14176
|
-
mGBA = function(arg) {
|
|
14177
|
-
if (new.target) throw new Error("mGBA() should not be called with `new mGBA()`");
|
|
14178
|
-
return real_mGBA(arg);
|
|
14179
|
-
}
|
|
14180
|
-
})();
|
|
14181
13153
|
export default mGBA;
|
|
14182
13154
|
var isPthread = globalThis.self?.name?.startsWith('em-pthread');
|
|
14183
13155
|
// When running as a pthread, construct a new instance on startup
|