@@ -462,60 +462,71 @@ const updateGameStatus = async () => {
462462 const aiResult = await executeCommand (
463463 "getprop persist.sys.azenithconf.AIenabled"
464464 ) ;
465- const aiEnabled = aiResult . stdout ?. trim ( ) !== "0" ;
465+ const aiEnabled = aiResult . stdout ?. trim ( ) === "1" ;
466466
467- let statusText = "" ;
467+ const gameRaw = await executeCommand (
468+ "cat /data/adb/.config/AZenith/API/gameinfo"
469+ ) ;
468470
469- if ( aiEnabled ) {
470- statusText = getTranslation ( "serviceStatus.noApps" ) ;
471- } else {
472- const gameRaw = await executeCommand (
473- "cat /data/adb/.config/AZenith/API/gameinfo"
474- ) ;
475- let gameLine = ( gameRaw . stdout || "" ) . trim ( ) ;
476-
477- if (
478- ! gameLine ||
479- [ "null" , "(null)" , "NULL" ] . includes ( gameLine . toUpperCase ( ) ) ||
480- gameLine . toUpperCase ( ) . startsWith ( "NULL 0 0" )
481- ) {
482- gameLine = null ;
471+ const rawLine = gameRaw . stdout ?. trim ( ) ;
472+ let gamePkg = null ;
473+
474+ if ( rawLine ) {
475+ const parts = rawLine . split ( / \s + / ) ;
476+ const name = parts [ 0 ] ;
477+
478+ if ( ! / ^ \( ? n u l l \) ? $ / i. test ( name ) ) {
479+ gamePkg = name ;
483480 }
481+ }
484482
485- if ( ! gameLine ) {
486- statusText = getTranslation ( "serviceStatus.idleMode" ) ;
487- } else {
488- const pkg = gameLine . split ( " " ) [ 0 ] ?. trim ( ) || "" ;
489- let label = pkg ;
483+ let statusText = "" ;
490484
491- try {
492- const infoList = JSON . parse ( ksu . getPackagesInfo ( JSON . stringify ( [ pkg ] ) ) ) ;
493- if ( Array . isArray ( infoList ) && infoList . length > 0 ) {
494- label = infoList [ 0 ] . appLabel || infoList [ 0 ] . label || infoList [ 0 ] . appName || pkg ;
495- }
496- } catch {
497- if ( typeof window . $packageManager !== "undefined" ) {
498- try {
499- const appInfo = await window . $packageManager . getApplicationInfo ( pkg , 0 , 0 ) ;
500- if ( appInfo ) {
501- label = ( typeof appInfo . getLabel === "function" ? appInfo . getLabel ( ) : appInfo . label )
502- || appInfo . appName
503- || pkg ;
504- }
505- } catch { }
506- }
507- }
485+ if ( ! gamePkg ) {
486+ statusText = aiEnabled
487+ ? getTranslation ( "serviceStatus.noApps" )
488+ : getTranslation ( "serviceStatus.idleMode" ) ;
489+ } else {
490+ const pkg = gamePkg ;
491+ let label = pkg ;
508492
509- statusText = getTranslation ( "serviceStatus.activeIdle" , label ) ;
493+ try {
494+ const infoList = JSON . parse (
495+ ksu . getPackagesInfo ( JSON . stringify ( [ pkg ] ) )
496+ ) ;
497+ const info = infoList ?. [ 0 ] ;
498+ if ( info ) {
499+ label =
500+ info . appLabel ||
501+ info . label ||
502+ info . appName ||
503+ pkg ;
504+ }
505+ } catch {
506+ if ( window . $packageManager ) {
507+ try {
508+ const appInfo =
509+ await window . $packageManager . getApplicationInfo ( pkg , 0 , 0 ) ;
510+ if ( appInfo ) {
511+ label =
512+ ( typeof appInfo . getLabel === "function"
513+ ? appInfo . getLabel ( )
514+ : appInfo . label ) ||
515+ appInfo . appName ||
516+ pkg ;
517+ }
518+ } catch { }
519+ }
510520 }
521+
522+ statusText = getTranslation ( "serviceStatus.active" , label ) ;
511523 }
512524
513525 if ( lastGameCheck . status !== statusText ) {
514526 banner . textContent = statusText ;
515527 lastGameCheck . status = statusText ;
516528 }
517- } catch ( e ) {
518- console . warn ( "updateGameStatus error:" , e ) ;
529+ } catch {
519530 banner . textContent = getTranslation ( "serviceStatus.error" ) ;
520531 }
521532} ;
@@ -669,9 +680,36 @@ const getSupportedRefreshRates = async () => {
669680
670681const openPerAppSettings = async ( pkg , gamelist ) => {
671682 const modal = document . getElementById ( "appSettingsModal" ) ;
683+ const content = modal . querySelector ( ".app-modal-content" ) ;
672684 const list = document . getElementById ( "appModalSettings" ) ;
685+ if ( ! modal || ! content || ! list ) return ;
673686
674687 document . body . classList . add ( "modal-open" ) ;
688+ modal . classList . remove ( "hidden" , "closing" ) ;
689+
690+ // reset (no animation)
691+ content . style . transition = "none" ;
692+ content . style . opacity = "0" ;
693+ content . style . transform = "translateY(20px) scale(.98)" ;
694+ void content . offsetHeight ;
695+
696+ // animate in
697+ content . style . transition =
698+ "opacity .25s ease, transform .25s cubic-bezier(0.16,1,0.3,1)" ;
699+ content . style . opacity = "1" ;
700+ content . style . transform = "translateY(0) scale(1)" ;
701+
702+ const baseH = window . innerHeight ;
703+ const resize = ( ) => {
704+ content . style . transform =
705+ window . innerHeight < baseH - 150
706+ ? "translateY(-8px) scale(1)"
707+ : "translateY(0) scale(1)" ;
708+ } ;
709+
710+ window . addEventListener ( "resize" , resize , { passive : true } ) ;
711+ modal . _resizeHandler = resize ;
712+
675713 const cfg = gamelist [ pkg ] ;
676714 if ( ! cfg ) return ;
677715
@@ -691,7 +729,7 @@ const openPerAppSettings = async (pkg, gamelist) => {
691729 <div class="optionGroup" data-key="${ s . key } ">
692730 ${ [ "false" , "default" , "true" ] . map ( v => `
693731 <button class="optionBtn ${ value === v ? "active" : "" } " data-value="${ v } ">
694- ${ v . charAt ( 0 ) . toUpperCase ( ) + v . slice ( 1 ) }
732+ ${ v [ 0 ] . toUpperCase ( ) + v . slice ( 1 ) }
695733 </button>
696734 ` ) . join ( "" ) }
697735 </div>
@@ -744,8 +782,6 @@ const openPerAppSettings = async (pkg, gamelist) => {
744782 } ;
745783 } ) ;
746784 } ) ;
747-
748- modal . classList . remove ( "hidden" ) ;
749785} ;
750786
751787let cachedPkgList = [ ] ;
@@ -2140,7 +2176,6 @@ const hidecolorscheme = () => {
21402176 if ( ! c ) return ; // exit if modal not found
21412177
21422178 c . classList . remove ( "show" ) ;
2143- document . body . classList . remove ( "modal-open" ) ;
21442179 const colorSchemeSavedToast = getTranslation ( "toast.colorSchemeSaved" ) ;
21452180 toast ( colorSchemeSavedToast ) ;
21462181
@@ -2547,6 +2582,7 @@ const showAdditionalSettings = async () => {
25472582 // jalan berurutan = stabil + no spike
25482583 for ( const fn of [
25492584 hideBypassIfUnsupported ,
2585+ checkGPreload ,
25502586 checkDND ,
25512587 checkfstrim ,
25522588 checkBypassChargeStatus ,
@@ -2603,7 +2639,7 @@ const showPreferenceSettings = async () => {
26032639
26042640 for ( const fn of [
26052641 checkfpsged , checkDThermal , checkiosched ,
2606- checkGPreload , checkmalisched , checkjit ,
2642+ checkmalisched , checkjit ,
26072643 checkdtrace , checkKillLog , checkschedtunes ,
26082644 checkwalt , checkSFL
26092645 ] ) {
@@ -2624,7 +2660,6 @@ const hidePreferenceSettings = () => {
26242660const hideSchemeSettings = ( ) => {
26252661 const c = document . getElementById ( "schemeModal" ) ;
26262662 c . classList . remove ( "show" ) ;
2627- document . body . classList . remove ( "modal-open" ) ;
26282663 if ( c . _resizeHandler ) {
26292664 window . removeEventListener ( "resize" , c . _resizeHandler ) ;
26302665 delete c . _resizeHandler ;
@@ -2894,7 +2929,6 @@ const showCustomResolution = async () => {
28942929const hideResoSettings = ( ) => {
28952930 const c = document . getElementById ( "resomodal" ) ;
28962931 c . classList . remove ( "show" ) ;
2897- document . body . classList . remove ( "modal-open" ) ;
28982932 if ( c . _resizeHandler ) {
28992933 window . removeEventListener ( "resize" , c . _resizeHandler ) ;
29002934 delete c . _resizeHandler ;
@@ -3344,6 +3378,10 @@ const heavyInit = async () => {
33443378 const loader = document . getElementById ( "loading-screen" ) ;
33453379 if ( loader ) loader . classList . remove ( "hidden" ) ;
33463380 document . body . classList . add ( "no-scroll" ) ;
3381+
3382+ await checkWebUISupport ( ) ;
3383+ await checkServiceRunning ( ) ;
3384+ await checkModuleVersion ( ) ;
33473385
33483386 await Promise . all ( [
33493387 checkProfile ( ) ,
@@ -3352,8 +3390,8 @@ const heavyInit = async () => {
33523390 ] ) ;
33533391
33543392 [
3355- checkWebUISupport , checkServiceStatus , checkServiceRunning ,
3356- checkModuleVersion , checkCPUInfo , checkDeviceInfo , checkKernelVersion , getAndroidVersion
3393+ checkServiceStatus ,
3394+ checkCPUInfo , checkDeviceInfo , checkKernelVersion , getAndroidVersion
33573395 ] . forEach ( fn => fn ( ) . catch ( ( ) => { } ) ) ;
33583396
33593397 await Promise . all ( [
0 commit comments