@@ -427,7 +427,8 @@ class EmulatorJS {
427427 // Resolution (host stream source): 1080p | 720p | 480p | 360p (default 480p, optimized for latency)
428428 const normalizeResolution = ( v ) => {
429429 const s = ( typeof v === "string" ? v . trim ( ) : "" ) . toLowerCase ( ) ;
430- if ( s === "1080p" || s === "720p" || s === "480p" || s === "360p" ) return s ;
430+ if ( s === "1080p" || s === "720p" || s === "480p" || s === "360p" )
431+ return s ;
431432 return "480p" ;
432433 } ;
433434 const storedResolution = this . preGetSetting ( "netplayStreamResolution" ) ;
@@ -440,7 +441,9 @@ class EmulatorJS {
440441 ? this . config . netplayStreamResolution
441442 : envResolution ;
442443 this . netplayStreamResolution = normalizeResolution (
443- typeof storedResolution === "string" ? storedResolution : configResolution ,
444+ typeof storedResolution === "string"
445+ ? storedResolution
446+ : configResolution ,
444447 ) ;
445448 window . EJS_NETPLAY_STREAM_RESOLUTION = this . netplayStreamResolution ;
446449
@@ -484,7 +487,9 @@ class EmulatorJS {
484487 ? this . config . netplayHostScalabilityMode
485488 : envHostScalability ;
486489 this . netplayHostScalabilityMode = normalizeHostScalability (
487- typeof storedHostScalability === "string" ? storedHostScalability : configHostScalability ,
490+ typeof storedHostScalability === "string"
491+ ? storedHostScalability
492+ : configHostScalability ,
488493 ) ;
489494 window . EJS_NETPLAY_HOST_SCALABILITY_MODE = this . netplayHostScalabilityMode ;
490495
@@ -1773,7 +1778,10 @@ class EmulatorJS {
17731778 const originalAlcCreateContext = this . Module . AL . alcCreateContext ;
17741779 if ( originalAlcCreateContext ) {
17751780 this . Module . AL . alcCreateContext = ( ...args ) => {
1776- const ctx = originalAlcCreateContext . apply ( this . Module . AL , args ) ;
1781+ const ctx = originalAlcCreateContext . apply (
1782+ this . Module . AL ,
1783+ args ,
1784+ ) ;
17771785 if ( ctx && ctx . audioCtx ) {
17781786 // Expose the master gain node for EmulatorJS audio capture
17791787 if ( ! ctx . masterGain ) {
@@ -1783,7 +1791,9 @@ class EmulatorJS {
17831791 if ( ctx . masterGain && ctx . audioCtx . destination ) {
17841792 ctx . masterGain . connect ( ctx . audioCtx . destination ) ;
17851793 }
1786- console . log ( "[EmulatorJS] Exposed masterGain node for audio capture" ) ;
1794+ console . log (
1795+ "[EmulatorJS] Exposed masterGain node for audio capture" ,
1796+ ) ;
17871797 }
17881798 }
17891799 return ctx ;
@@ -1829,7 +1839,7 @@ class EmulatorJS {
18291839 } )
18301840 . then ( ( module ) => {
18311841 this . Module = module ;
1832-
1842+
18331843 // Set up audio node exposure for EmulatorJS after module loads
18341844 const setupAudioExposure = ( ) => {
18351845 if ( this . Module && this . Module . AL && this . Module . AL . currentCtx ) {
@@ -1844,18 +1854,20 @@ class EmulatorJS {
18441854 } else if ( ctx . audioCtx . destination ) {
18451855 ctx . masterGain . connect ( ctx . audioCtx . destination ) ;
18461856 }
1847- console . log ( "[EmulatorJS] Exposed masterGain node for audio capture" ) ;
1857+ console . log (
1858+ "[EmulatorJS] Exposed masterGain node for audio capture" ,
1859+ ) ;
18481860 }
18491861 }
18501862 } ;
1851-
1863+
18521864 // Check immediately and then periodically
18531865 setupAudioExposure ( ) ;
18541866 const audioCheckInterval = setInterval ( setupAudioExposure , 1000 ) ;
1855-
1867+
18561868 // Clear interval after 10 seconds
18571869 setTimeout ( ( ) => clearInterval ( audioCheckInterval ) , 10000 ) ;
1858-
1870+
18591871 this . downloadFiles ( ) ;
18601872 } )
18611873 . catch ( ( e ) => {
@@ -7154,7 +7166,8 @@ class EmulatorJS {
71547166 } else if ( option === "netplayStreamResolution" ) {
71557167 const normalizeResolution = ( v ) => {
71567168 const s = ( typeof v === "string" ? v . trim ( ) : "" ) . toLowerCase ( ) ;
7157- if ( s === "1080p" || s === "720p" || s === "480p" || s === "360p" ) return s ;
7169+ if ( s === "1080p" || s === "720p" || s === "480p" || s === "360p" )
7170+ return s ;
71587171 return "480p" ;
71597172 } ;
71607173 this . netplayStreamResolution = normalizeResolution ( value ) ;
@@ -7191,7 +7204,8 @@ class EmulatorJS {
71917204 return "L1T1" ;
71927205 } ;
71937206 this . netplayHostScalabilityMode = normalizeHostScalability ( value ) ;
7194- window . EJS_NETPLAY_HOST_SCALABILITY_MODE = this . netplayHostScalabilityMode ;
7207+ window . EJS_NETPLAY_HOST_SCALABILITY_MODE =
7208+ this . netplayHostScalabilityMode ;
71957209 try {
71967210 if (
71977211 this . isNetplay &&
@@ -8550,17 +8564,21 @@ class EmulatorJS {
85508564 // Create a master gain node and connect all source gains to it
85518565 console . log ( "[EmulatorJS] Checking OpenAL sources fallback:" , {
85528566 hasSources : ! ! openALCtx . sources ,
8553- sourcesLength : openALCtx . sources ? openALCtx . sources . length : 'undefined' ,
8567+ sourcesLength : openALCtx . sources
8568+ ? openALCtx . sources . length
8569+ : "undefined" ,
85548570 } ) ;
85558571 if ( openALCtx . sources && openALCtx . sources . length > 0 ) {
8556- console . log ( "[EmulatorJS] Attempting to create master gain from OpenAL sources" ) ;
8572+ console . log (
8573+ "[EmulatorJS] Attempting to create master gain from OpenAL sources" ,
8574+ ) ;
85578575 try {
85588576 // Find the audio context from the first source
85598577 const firstSource = openALCtx . sources [ 0 ] ;
85608578 console . log ( "[EmulatorJS] First source info:" , {
85618579 hasSource : ! ! firstSource ,
85628580 hasGain : ! ! firstSource . gain ,
8563- gainType : firstSource . gain ? typeof firstSource . gain : ' undefined' ,
8581+ gainType : firstSource . gain ? typeof firstSource . gain : " undefined" ,
85648582 hasContext : ! ! ( firstSource . gain && firstSource . gain . context ) ,
85658583 } ) ;
85668584 if ( firstSource && firstSource . gain && firstSource . gain . context ) {
@@ -8570,24 +8588,33 @@ class EmulatorJS {
85708588
85718589 // Connect all source gains to the master gain
85728590 let connectedCount = 0 ;
8573- openALCtx . sources . forEach ( source => {
8591+ openALCtx . sources . forEach ( ( source ) => {
85748592 if ( source . gain && typeof source . gain . connect === "function" ) {
85758593 source . gain . connect ( masterGain ) ;
85768594 connectedCount ++ ;
85778595 }
85788596 } ) ;
85798597
85808598 if ( connectedCount > 0 ) {
8581- console . log ( `[EmulatorJS] Created master gain node from ${ connectedCount } OpenAL sources` ) ;
8599+ console . log (
8600+ `[EmulatorJS] Created master gain node from ${ connectedCount } OpenAL sources` ,
8601+ ) ;
85828602 return masterGain ;
85838603 } else {
8584- console . log ( "[EmulatorJS] No OpenAL sources could be connected to master gain" ) ;
8604+ console . log (
8605+ "[EmulatorJS] No OpenAL sources could be connected to master gain" ,
8606+ ) ;
85858607 }
85868608 } else {
8587- console . log ( "[EmulatorJS] OpenAL sources found but no valid gain context" ) ;
8609+ console . log (
8610+ "[EmulatorJS] OpenAL sources found but no valid gain context" ,
8611+ ) ;
85888612 }
85898613 } catch ( e ) {
8590- console . warn ( "[EmulatorJS] Failed to create master gain from OpenAL sources:" , e ) ;
8614+ console . warn (
8615+ "[EmulatorJS] Failed to create master gain from OpenAL sources:" ,
8616+ e ,
8617+ ) ;
85918618 }
85928619 }
85938620 }
0 commit comments