@@ -121,6 +121,7 @@ const IL2CPP_RUNTIME_OFFSETS: Record<`il2cpp_${string}`, number> = {
121121 "il2cpp_type_get_name" : 0x3C0 ,
122122
123123 "il2cpp_field_static_get_value" : 0x5DA3C , // Internal function
124+ "il2cpp_field_static_set_value" : 0x5DAEC , // Internal function
124125
125126 "il2cpp_array_class_get" : 0x6C ,
126127 "il2cpp_array_length" : 0x70 ,
@@ -136,6 +137,8 @@ const IL2CPP_RUNTIME_OFFSETS: Record<`il2cpp_${string}`, number> = {
136137 "il2cpp_field_get_type" : 0x27C ,
137138 "il2cpp_field_get_value" : 0x280 ,
138139 "il2cpp_field_has_attribute" : 0x284 ,
140+
141+ "il2cpp_value_box" : 0x7A4 ,
139142} ;
140143
141144function createIl2CppExports (
@@ -258,7 +261,7 @@ function getMaxRefreshRate490(): number {
258261 . method < Il2Cpp . Object > ( "get_refreshRateRatio" ) . invoke ( )
259262 . method < number > ( "get_value" ) . invoke ( )
260263 }
261- return refreshRate ;
264+ return Math . ceil ( refreshRate ) ;
262265}
263266
264267rpc . exports = {
@@ -436,6 +439,9 @@ function main() {
436439 }
437440 }
438441
442+ var alphaModified : boolean = false
443+ var alphaResolutionLongSide : number = 0
444+
439445 /**
440446 * 按照设置的质量档位,获取对应的渲染分辨率
441447 * - 低 1080p
@@ -444,20 +450,24 @@ function main() {
444450 * @param isLongSide 是否是长边
445451 */
446452 function getSize ( quality : number = - 1 , isLongSide : number = 1 ) {
447- if ( quality == - 1 ) {
448- quality = get_SaveData ( ) . method < Il2Cpp . ValueType > ( "get_RenderTextureQuality" ) . invoke ( ) . field < number > ( "value__" ) . value
449- }
450-
451453 var size = 0
452- switch ( quality ) {
453- case 1 :
454- size = globalConfig [ "MediumQualityLongSide" ]
455- break
456- case 2 :
457- size = globalConfig [ "HighQualityLongSide" ]
458- break
459- default :
460- size = globalConfig [ "LowQualityLongSide" ]
454+
455+ if ( alphaModified ) {
456+ size = alphaResolutionLongSide
457+ } else {
458+ if ( quality == - 1 ) {
459+ quality = get_SaveData ( ) . method < Il2Cpp . ValueType > ( "get_RenderTextureQuality" ) . invoke ( ) . field < number > ( "value__" ) . value
460+ }
461+ switch ( quality ) {
462+ case 1 :
463+ size = globalConfig [ "MediumQualityLongSide" ]
464+ break
465+ case 2 :
466+ size = globalConfig [ "HighQualityLongSide" ]
467+ break
468+ default :
469+ size = globalConfig [ "LowQualityLongSide" ]
470+ }
461471 }
462472
463473 if ( ! isLongSide ) {
@@ -469,43 +479,36 @@ function main() {
469479
470480 if ( AssemblyCSharp . image . tryClass ( "School.LiveMain.SchoolResolution" ) ) {
471481 const SchoolResolution = AssemblyCSharp . image . class ( "School.LiveMain.SchoolResolution" )
472- SchoolResolution . initialize ( )
473-
474- /**
475- * 替换内置的质量档位到分辨率词典
476- * @param _liveAreaResolutions School.LiveMain.SchoolResolution._liveAreaResolutions
477- */
478- function setResolutions ( _liveAreaResolutions : Il2Cpp . Object ) {
479- for ( let i = 0 ; i < 3 ; i ++ ) {
480- const LiveResolution = _liveAreaResolutions . method ( "get_Item" ) . invoke ( i ) as Il2Cpp . Object
481- LiveResolution . field ( "_longSide" ) . value = getSize ( i , 1 )
482- LiveResolution . field ( "_shortSide" ) . value = getSize ( i , 0 )
483- }
484- }
485482
486483 /**
487484 * 检查是否已经套用自定义的分辨率,没有套用则套用
488485 * @param quality School.LiveMain.SchoolResolution.LiveAreaQuality
489486 * @param orientation School.LiveMain.SchoolResolution.LiveResolution
490487 */
491488 SchoolResolution . method ( "GetResolution" ) . implementation = function ( quality , orientation ) {
492- const _liveAreaResolutions = SchoolResolution . field ( "_liveAreaResolutions" ) . value as Il2Cpp . Object
493- const numQuality = ( quality as Il2Cpp . ValueType ) . field < number > ( "value__" ) . value
494- const longSide = _liveAreaResolutions . method < Il2Cpp . Object > ( "get_Item" ) . invoke ( numQuality ) . field < number > ( "_longSide" ) . value
495-
496- if ( getSize ( numQuality , 1 ) != longSide ) {
497- setResolutions ( _liveAreaResolutions )
498- }
499-
500- const result = this . method ( "GetResolution" ) . invoke ( quality , orientation )
489+ const result = this . method < Il2Cpp . Object > ( "GetResolution" ) . invoke ( quality , orientation )
501490 // console.log("GetResolution", result)
491+ const numQuality = ( quality as Il2Cpp . ValueType ) . field < number > ( "value__" ) . value ;
492+ const numOrientation = ( orientation as Il2Cpp . ValueType ) . field < number > ( "value__" ) . value ;
493+ result . field < number > ( "m_Width" ) . value = getSize ( numQuality , numOrientation ^ 1 )
494+ result . field < number > ( "m_Height" ) . value = getSize ( numQuality , numOrientation )
495+
502496 return result
503497 }
504498 }
505499
506500 const AlphaBlendCamera = Core . image . class ( "Inspix.AlphaBlendCamera" )
507501
508- var alphaModified : boolean = false
502+ function forceRefreshRenderTexture ( quality : number ) {
503+ if ( quality > 0 ) {
504+ get_SaveData ( ) . method ( "set_RenderTextureQuality" ) . invoke ( quality - 1 )
505+ get_SaveData ( ) . method ( "set_RenderTextureQuality" ) . invoke ( quality )
506+ } else if ( quality < 2 ) {
507+ get_SaveData ( ) . method ( "set_RenderTextureQuality" ) . invoke ( quality + 1 )
508+ get_SaveData ( ) . method ( "set_RenderTextureQuality" ) . invoke ( quality )
509+ }
510+ }
511+
509512 /** Fes×LIVE进行AlphaBlend时降低分辨率至更低画质档位以保证帧率
510513 *
511514 * 基于Apple M4平台进行测试,AlphaBlend应当在1080p才能保证稳定的60FPS
@@ -518,15 +521,17 @@ function main() {
518521 const quality = RenderTextureQuality . field < number > ( "value__" ) . value
519522
520523 if ( alpha > 0 && alpha < 1 ) {
521- if ( ! alphaModified && quality > 0 ) {
524+ if ( ! alphaModified ) {
525+ alphaResolutionLongSide = Math . round ( getSize ( quality ) * 2.0 / 3.0 )
522526 alphaModified = true
523- get_SaveData ( ) . method ( "set_RenderTextureQuality" ) . invoke ( quality - 1 )
527+ forceRefreshRenderTexture ( quality )
524528 }
525529 }
526530 else if ( alphaModified ) {
527531 alphaModified = false
528- if ( quality < 2 ) get_SaveData ( ) . method ( "set_RenderTextureQuality" ) . invoke ( quality + 1 )
532+ forceRefreshRenderTexture ( quality )
529533 }
534+
530535 this . method ( "UpdateAlpha" ) . invoke ( newAlpha )
531536 }
532537
@@ -978,10 +983,12 @@ function main() {
978983
979984 for ( let i = 0 ; i < objChapters . method < number > ( "get_Count" ) . invoke ( ) ; i ++ ) {
980985 const chapter = objChapters . method < Il2Cpp . Object > ( "get_Item" ) . invoke ( i )
981- if ( i < archiveData . chapters . length ) {
982- chapter . method ( "set_PlayTimeSecond" ) . invoke ( archiveData . chapters [ i ] . play_time_second )
983- } else {
984- break
986+ if ( archiveData . chapters ) {
987+ if ( i < archiveData . chapters . length ) {
988+ chapter . method ( "set_PlayTimeSecond" ) . invoke ( archiveData . chapters [ i ] . play_time_second )
989+ } else {
990+ break
991+ }
985992 }
986993 }
987994
0 commit comments