refactor: simplify casting instructions
This commit is contained in:
+1
-1
@@ -69,7 +69,7 @@ class HideAutoplayButtonPatch : BytecodePatch(
|
||||
val jumpInstruction = layoutGenMethodInstructions[insertIndex + branchIndex] as Instruction
|
||||
|
||||
// can be clobbered because this register is overwritten after the injected code
|
||||
val clobberRegister = (instruction(insertIndex) as OneRegisterInstruction).registerA
|
||||
val clobberRegister = instruction<OneRegisterInstruction>(insertIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
insertIndex,
|
||||
|
||||
+1
-1
@@ -149,7 +149,7 @@ class NavigationButtonsPatch : BytecodePatch(listOf(AddCreateButtonViewFingerpri
|
||||
}!!.index
|
||||
|
||||
val conditionalCheckIndex = stringIndex - 1
|
||||
val conditionRegister = (instruction(conditionalCheckIndex) as OneRegisterInstruction).registerA
|
||||
val conditionRegister = instruction<OneRegisterInstruction>(conditionalCheckIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
conditionalCheckIndex,
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ internal object InjectionUtils {
|
||||
|
||||
// Register to pass to the hook
|
||||
val registerIndex = insertIndex - 1 // MOVE_RESULT_OBJECT is always the previous instruction
|
||||
val register = (injectTarget.instruction(registerIndex) as OneRegisterInstruction).registerA
|
||||
val register = injectTarget.instruction<OneRegisterInstruction>(registerIndex).registerA
|
||||
|
||||
injectTarget.addInstruction(
|
||||
insertIndex,
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ class HidePlayerButtonsPatch : BytecodePatch(
|
||||
|
||||
PlayerControlsVisibilityModelFingerprint.result?.apply {
|
||||
val callIndex = scanResult.patternScanResult!!.endIndex
|
||||
val callInstruction = mutableMethod.instruction(callIndex) as Instruction3rc
|
||||
val callInstruction = mutableMethod.instruction<Instruction3rc>(callIndex)
|
||||
|
||||
// overriding this parameter register hides the previous and next buttons
|
||||
val hasNextParameterRegister = callInstruction.startRegister + ParameterOffsets.HAS_NEXT
|
||||
|
||||
Reference in New Issue
Block a user