mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-12 22:17:41 +00:00
Compare commits
5 Commits
v4.3.0-dev
...
v4.3.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97c4682ccc | ||
|
|
6742cd9232 | ||
|
|
5b2cc10adb | ||
|
|
dbad6252fb | ||
|
|
0f7ed841d1 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
||||
# [4.3.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v4.3.0-dev.6...v4.3.0-dev.7) (2024-02-26)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **OpeningHours:** Add `Fix crash` patch ([#2697](https://github.com/ReVanced/revanced-patches/issues/2697)) ([0d011b8](https://github.com/ReVanced/revanced-patches/commit/0d011b876ecf05031a7daa54ab7e6d3506728a47))
|
||||
|
||||
# [4.3.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v4.3.0-dev.5...v4.3.0-dev.6) (2024-02-25)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **VSCO - Unlock pro:** Constrain to last working version ([6dd4a7c](https://github.com/ReVanced/revanced-patches/commit/6dd4a7c29e48c3bc517bbdd7ed160624c36c2333))
|
||||
|
||||
# [4.3.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v4.3.0-dev.4...v4.3.0-dev.5) (2024-02-25)
|
||||
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ of ReVanced Patcher and how to use ReVanced Patcher to create patches
|
||||
## 🙏 Submitting a feature request
|
||||
|
||||
Features can be requested by opening an issue using the
|
||||
[Feature request issue template](https://github.com/ReVanced/revanced-patches/issues/new?assignees=&labels=Feature+request&projects=&template=feature-request.yml&title=feat%3A+).
|
||||
[Feature request issue template](https://github.com/ReVanced/revanced-patches/issues/new?assignees=&labels=Feature+request&projects=&template=feature_request.yml&title=feat%3A+).
|
||||
|
||||
> **Note**
|
||||
> Requests can be accepted or rejected at the discretion of maintainers of ReVanced Patches.
|
||||
@@ -81,7 +81,7 @@ Features can be requested by opening an issue using the
|
||||
## 🐞 Submitting a bug report
|
||||
|
||||
If you encounter a bug while using ReVanced Patches, open an issue using the
|
||||
[Bug report issue template](https://github.com/ReVanced/revanced-patches/issues/new?assignees=&labels=Bug+report&projects=&template=bug-report.yml&title=bug%3A+).
|
||||
[Bug report issue template](https://github.com/ReVanced/revanced-patches/issues/new?assignees=&labels=Bug+report&projects=&template=bug_report.yml&title=bug%3A+).
|
||||
|
||||
## 🧑⚖️ Guidelines for requesting or contributing patches
|
||||
|
||||
|
||||
@@ -410,6 +410,12 @@ public final class app/revanced/patches/nyx/misc/pro/UnlockProPatch : app/revanc
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/openinghours/misc/fix/crash/FixCrashPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/openinghours/misc/fix/crash/FixCrashPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/photomath/detection/deviceid/SpoofDeviceIdPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 4.3.0-dev.5
|
||||
version = 4.3.0-dev.7
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package app.revanced.patches.openinghours.misc.fix.crash
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.extensions.newLabel
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.openinghours.misc.fix.crash.fingerprints.SetPlaceFingerprint
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getReference
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21t
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch(
|
||||
name = "Fix crash",
|
||||
compatiblePackages = [CompatiblePackage("de.simon.openinghours", ["1.0"])],
|
||||
)
|
||||
@Suppress("unused")
|
||||
object FixCrashPatch : BytecodePatch(
|
||||
setOf(SetPlaceFingerprint),
|
||||
) {
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SetPlaceFingerprint.result?.let {
|
||||
val indexedInstructions = it.mutableMethod.getInstructions().withIndex().toList()
|
||||
|
||||
/**
|
||||
* This function replaces all `checkNotNull` instructions in the integer interval
|
||||
* from [startIndex] to [endIndex], both inclusive. In place of the `checkNotNull`
|
||||
* instruction an if-null check is inserted. If the if-null check yields that
|
||||
* the value is indeed null, we jump to a newly created label at `endIndex + 1`.
|
||||
*/
|
||||
fun avoidNullPointerException(startIndex: Int, endIndex: Int) {
|
||||
val continueLabel = it.mutableMethod.newLabel(endIndex + 1)
|
||||
|
||||
for (index in startIndex..endIndex) {
|
||||
val instruction = indexedInstructions[index].value
|
||||
|
||||
if (!instruction.isCheckNotNullInstruction) {
|
||||
continue
|
||||
}
|
||||
|
||||
val checkNotNullInstruction = instruction as FiveRegisterInstruction
|
||||
val originalRegister = checkNotNullInstruction.registerC
|
||||
|
||||
it.mutableMethod.replaceInstruction(
|
||||
index,
|
||||
BuilderInstruction21t(
|
||||
Opcode.IF_EQZ,
|
||||
originalRegister,
|
||||
continueLabel,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val getOpeningHoursIndex = getIndicesOfInvoke(
|
||||
indexedInstructions,
|
||||
"Lde/simon/openinghours/models/Place;",
|
||||
"getOpeningHours",
|
||||
)
|
||||
|
||||
val setWeekDayTextIndex = getIndexOfInvoke(
|
||||
indexedInstructions,
|
||||
"Lde/simon/openinghours/views/custom/PlaceCard;",
|
||||
"setWeekDayText",
|
||||
)
|
||||
|
||||
val startCalculateStatusIndex = getIndexOfInvoke(
|
||||
indexedInstructions,
|
||||
"Lde/simon/openinghours/views/custom/PlaceCard;",
|
||||
"startCalculateStatus",
|
||||
)
|
||||
|
||||
// Replace the Intrinsics;->checkNotNull instructions with a null check
|
||||
// and jump to our newly created label if it returns true.
|
||||
// This avoids the NullPointerExceptions.
|
||||
avoidNullPointerException(getOpeningHoursIndex[1], startCalculateStatusIndex)
|
||||
avoidNullPointerException(getOpeningHoursIndex[0], setWeekDayTextIndex)
|
||||
} ?: throw SetPlaceFingerprint.exception
|
||||
}
|
||||
|
||||
private fun isInvokeInstruction(instruction: Instruction, className: String, methodName: String): Boolean {
|
||||
val methodRef = instruction.getReference<MethodReference>() ?: return false
|
||||
return methodRef.definingClass == className && methodRef.name == methodName
|
||||
}
|
||||
|
||||
private fun getIndicesOfInvoke(
|
||||
instructions: List<IndexedValue<Instruction>>,
|
||||
className: String,
|
||||
methodName: String,
|
||||
): List<Int> = instructions.mapNotNull { (index, instruction) ->
|
||||
if (isInvokeInstruction(instruction, className, methodName)) {
|
||||
index
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun getIndexOfInvoke(
|
||||
instructions: List<IndexedValue<Instruction>>,
|
||||
className: String,
|
||||
methodName: String,
|
||||
): Int = instructions.first { (_, instruction) ->
|
||||
isInvokeInstruction(instruction, className, methodName)
|
||||
}.index
|
||||
|
||||
private val Instruction.isCheckNotNullInstruction
|
||||
get() = isInvokeInstruction(this, "Lkotlin/jvm/internal/Intrinsics;", "checkNotNull")
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.revanced.patches.openinghours.misc.fix.crash.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object SetPlaceFingerprint : MethodFingerprint(
|
||||
"V",
|
||||
parameters = listOf("Lde/simon/openinghours/models/Place;"),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass == "Lde/simon/openinghours/views/custom/PlaceCard;" &&
|
||||
methodDef.name == "setPlace"
|
||||
},
|
||||
)
|
||||
@@ -1,20 +1,20 @@
|
||||
package app.revanced.patches.vsco.misc.pro
|
||||
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.vsco.misc.pro.fingerprints.RevCatSubscriptionFingerprint
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Unlock pro",
|
||||
description = "Unlocks pro features.",
|
||||
compatiblePackages = [CompatiblePackage("com.vsco.cam")]
|
||||
compatiblePackages = [CompatiblePackage("com.vsco.cam", ["345"])],
|
||||
)
|
||||
object UnlockProPatch : BytecodePatch(
|
||||
setOf(RevCatSubscriptionFingerprint)
|
||||
setOf(RevCatSubscriptionFingerprint),
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
RevCatSubscriptionFingerprint.result?.mutableMethod?.apply {
|
||||
@@ -23,7 +23,7 @@ object UnlockProPatch : BytecodePatch(
|
||||
0,
|
||||
"""
|
||||
const p1, 0x1
|
||||
"""
|
||||
""",
|
||||
)
|
||||
} ?: throw RevCatSubscriptionFingerprint.exception
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user