@@ -21185,7 +21185,8 @@ class EmulatorJS {
2118521185 // Resolution (host stream source): 1080p | 720p | 480p | 360p (default 480p, optimized for latency)
2118621186 const normalizeResolution = (v) => {
2118721187 const s = (typeof v === "string" ? v.trim() : "").toLowerCase();
21188- if (s === "1080p" || s === "720p" || s === "480p" || s === "360p") return s;
21188+ if (s === "1080p" || s === "720p" || s === "480p" || s === "360p")
21189+ return s;
2118921190 return "480p";
2119021191 };
2119121192 const storedResolution = this.preGetSetting("netplayStreamResolution");
@@ -21198,7 +21199,9 @@ class EmulatorJS {
2119821199 ? this.config.netplayStreamResolution
2119921200 : envResolution;
2120021201 this.netplayStreamResolution = normalizeResolution(
21201- typeof storedResolution === "string" ? storedResolution : configResolution,
21202+ typeof storedResolution === "string"
21203+ ? storedResolution
21204+ : configResolution,
2120221205 );
2120321206 window.EJS_NETPLAY_STREAM_RESOLUTION = this.netplayStreamResolution;
2120421207
@@ -21242,7 +21245,9 @@ class EmulatorJS {
2124221245 ? this.config.netplayHostScalabilityMode
2124321246 : envHostScalability;
2124421247 this.netplayHostScalabilityMode = normalizeHostScalability(
21245- typeof storedHostScalability === "string" ? storedHostScalability : configHostScalability,
21248+ typeof storedHostScalability === "string"
21249+ ? storedHostScalability
21250+ : configHostScalability,
2124621251 );
2124721252 window.EJS_NETPLAY_HOST_SCALABILITY_MODE = this.netplayHostScalabilityMode;
2124821253
@@ -22531,7 +22536,10 @@ class EmulatorJS {
2253122536 const originalAlcCreateContext = this.Module.AL.alcCreateContext;
2253222537 if (originalAlcCreateContext) {
2253322538 this.Module.AL.alcCreateContext = (...args) => {
22534- const ctx = originalAlcCreateContext.apply(this.Module.AL, args);
22539+ const ctx = originalAlcCreateContext.apply(
22540+ this.Module.AL,
22541+ args,
22542+ );
2253522543 if (ctx && ctx.audioCtx) {
2253622544 // Expose the master gain node for EmulatorJS audio capture
2253722545 if (!ctx.masterGain) {
@@ -22541,7 +22549,9 @@ class EmulatorJS {
2254122549 if (ctx.masterGain && ctx.audioCtx.destination) {
2254222550 ctx.masterGain.connect(ctx.audioCtx.destination);
2254322551 }
22544- console.log("[EmulatorJS] Exposed masterGain node for audio capture");
22552+ console.log(
22553+ "[EmulatorJS] Exposed masterGain node for audio capture",
22554+ );
2254522555 }
2254622556 }
2254722557 return ctx;
@@ -22587,7 +22597,7 @@ class EmulatorJS {
2258722597 })
2258822598 .then((module) => {
2258922599 this.Module = module;
22590-
22600+
2259122601 // Set up audio node exposure for EmulatorJS after module loads
2259222602 const setupAudioExposure = () => {
2259322603 if (this.Module && this.Module.AL && this.Module.AL.currentCtx) {
@@ -22602,18 +22612,20 @@ class EmulatorJS {
2260222612 } else if (ctx.audioCtx.destination) {
2260322613 ctx.masterGain.connect(ctx.audioCtx.destination);
2260422614 }
22605- console.log("[EmulatorJS] Exposed masterGain node for audio capture");
22615+ console.log(
22616+ "[EmulatorJS] Exposed masterGain node for audio capture",
22617+ );
2260622618 }
2260722619 }
2260822620 };
22609-
22621+
2261022622 // Check immediately and then periodically
2261122623 setupAudioExposure();
2261222624 const audioCheckInterval = setInterval(setupAudioExposure, 1000);
22613-
22625+
2261422626 // Clear interval after 10 seconds
2261522627 setTimeout(() => clearInterval(audioCheckInterval), 10000);
22616-
22628+
2261722629 this.downloadFiles();
2261822630 })
2261922631 .catch((e) => {
@@ -23294,9 +23306,9 @@ class EmulatorJS {
2329423306 save: qSave,
2329523307 load: qLoad,
2329623308 };
23297- addButton("EmulatorJS v" + this.ejs_version, false, () => {
23309+ addButton("EmulatorJS-SFU v" + this.ejs_version, false, () => {
2329823310 hideMenu();
23299- const body = this.createPopup("EmulatorJS", {
23311+ const body = this.createPopup("EmulatorJS-SFU ", {
2330023312 Close: () => {
2330123313 this.closePopup();
2330223314 },
@@ -23339,7 +23351,7 @@ class EmulatorJS {
2333923351 body.appendChild(retroarch);
2334023352 body.appendChild(coreLicense);
2334123353
23342- home.innerText = "EmulatorJS v" + this.ejs_version;
23354+ home.innerText = "EmulatorJS-SFU v" + this.ejs_version;
2334323355 home.appendChild(this.createElement("br"));
2334423356 home.appendChild(this.createElement("br"));
2334523357
@@ -23350,15 +23362,15 @@ class EmulatorJS {
2335023362
2335123363 this.createLink(
2335223364 home,
23353- "https://github.com/EmulatorJS /EmulatorJS",
23365+ "https://github.com/TechnicallyComputers /EmulatorJS-SFU ",
2335423366 "View on GitHub",
2335523367 true,
2335623368 );
2335723369
2335823370 this.createLink(
2335923371 home,
23360- "https://discord.gg/6akryGkETU ",
23361- "Join the discord ",
23372+ "https://discord.gg/wgEajuvEU9 ",
23373+ "Join the Discord ",
2336223374 true,
2336323375 );
2336423376
@@ -23402,7 +23414,7 @@ class EmulatorJS {
2340223414 addButton("Home", false, (li) => {
2340323415 setElem(home, li);
2340423416 }).classList.add("ejs_active_list_element");
23405- addButton("EmulatorJS License", false, (li) => {
23417+ addButton("EmulatorJS-SFU License", false, (li) => {
2340623418 setElem(license, li);
2340723419 });
2340823420 addButton("RetroArch License", false, (li) => {
@@ -27912,7 +27924,8 @@ class EmulatorJS {
2791227924 } else if (option === "netplayStreamResolution") {
2791327925 const normalizeResolution = (v) => {
2791427926 const s = (typeof v === "string" ? v.trim() : "").toLowerCase();
27915- if (s === "1080p" || s === "720p" || s === "480p" || s === "360p") return s;
27927+ if (s === "1080p" || s === "720p" || s === "480p" || s === "360p")
27928+ return s;
2791627929 return "480p";
2791727930 };
2791827931 this.netplayStreamResolution = normalizeResolution(value);
@@ -27949,7 +27962,8 @@ class EmulatorJS {
2794927962 return "L1T1";
2795027963 };
2795127964 this.netplayHostScalabilityMode = normalizeHostScalability(value);
27952- window.EJS_NETPLAY_HOST_SCALABILITY_MODE = this.netplayHostScalabilityMode;
27965+ window.EJS_NETPLAY_HOST_SCALABILITY_MODE =
27966+ this.netplayHostScalabilityMode;
2795327967 try {
2795427968 if (
2795527969 this.isNetplay &&
@@ -29308,17 +29322,21 @@ class EmulatorJS {
2930829322 // Create a master gain node and connect all source gains to it
2930929323 console.log("[EmulatorJS] Checking OpenAL sources fallback:", {
2931029324 hasSources: !!openALCtx.sources,
29311- sourcesLength: openALCtx.sources ? openALCtx.sources.length : 'undefined',
29325+ sourcesLength: openALCtx.sources
29326+ ? openALCtx.sources.length
29327+ : "undefined",
2931229328 });
2931329329 if (openALCtx.sources && openALCtx.sources.length > 0) {
29314- console.log("[EmulatorJS] Attempting to create master gain from OpenAL sources");
29330+ console.log(
29331+ "[EmulatorJS] Attempting to create master gain from OpenAL sources",
29332+ );
2931529333 try {
2931629334 // Find the audio context from the first source
2931729335 const firstSource = openALCtx.sources[0];
2931829336 console.log("[EmulatorJS] First source info:", {
2931929337 hasSource: !!firstSource,
2932029338 hasGain: !!firstSource.gain,
29321- gainType: firstSource.gain ? typeof firstSource.gain : ' undefined' ,
29339+ gainType: firstSource.gain ? typeof firstSource.gain : " undefined" ,
2932229340 hasContext: !!(firstSource.gain && firstSource.gain.context),
2932329341 });
2932429342 if (firstSource && firstSource.gain && firstSource.gain.context) {
@@ -29328,24 +29346,33 @@ class EmulatorJS {
2932829346
2932929347 // Connect all source gains to the master gain
2933029348 let connectedCount = 0;
29331- openALCtx.sources.forEach(source => {
29349+ openALCtx.sources.forEach(( source) => {
2933229350 if (source.gain && typeof source.gain.connect === "function") {
2933329351 source.gain.connect(masterGain);
2933429352 connectedCount++;
2933529353 }
2933629354 });
2933729355
2933829356 if (connectedCount > 0) {
29339- console.log(`[EmulatorJS] Created master gain node from ${connectedCount} OpenAL sources`);
29357+ console.log(
29358+ `[EmulatorJS] Created master gain node from ${connectedCount} OpenAL sources`,
29359+ );
2934029360 return masterGain;
2934129361 } else {
29342- console.log("[EmulatorJS] No OpenAL sources could be connected to master gain");
29362+ console.log(
29363+ "[EmulatorJS] No OpenAL sources could be connected to master gain",
29364+ );
2934329365 }
2934429366 } else {
29345- console.log("[EmulatorJS] OpenAL sources found but no valid gain context");
29367+ console.log(
29368+ "[EmulatorJS] OpenAL sources found but no valid gain context",
29369+ );
2934629370 }
2934729371 } catch (e) {
29348- console.warn("[EmulatorJS] Failed to create master gain from OpenAL sources:", e);
29372+ console.warn(
29373+ "[EmulatorJS] Failed to create master gain from OpenAL sources:",
29374+ e,
29375+ );
2934929376 }
2935029377 }
2935129378 }
0 commit comments