From 0551c6a9a9d98302b3ef6157532ff1ca553637a0 Mon Sep 17 00:00:00 2001 From: Spotlight Date: Thu, 30 Dec 2021 21:49:28 -0600 Subject: [PATCH] Narrow function clearing patch We wish to preserve the first blr, but it's ridiculous to clear it and replace it with itself. Now, we only clear the contents of the three textinput::EventObserver we overwrite. --- patches.go | 13 +++---------- powerpc_encoding.go | 6 ------ 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/patches.go b/patches.go index 585f498..4206de5 100644 --- a/patches.go +++ b/patches.go @@ -4,15 +4,10 @@ package main // See docs/patch_overwrite_ios.md for more information. var OverwriteIOSPatch = PatchSet{ Patch{ - Name: "Clear textinput::EventObserver functions", - AtOffset: 20320, + Name: "Clear extraneous textinput::EventObserver functions", + AtOffset: 20336, Before: Instructions{ - // Function: textinput::EventObserver::onSE - BLR(), - padding, - padding, - padding, // Function: textinput::EventObserver::onEvent BLR(), padding, @@ -32,9 +27,7 @@ var OverwriteIOSPatch = PatchSet{ // We wish to clear extraneous blrs so that our custom overwriteIOSMemory // function does not somehow conflict. We only preserve onSE. - After: append(Instructions{ - BLR(), - }.toBytes(), emptyBytes(60)...), + After: emptyBytes(48), }, Patch{ Name: "Repair textinput::EventObserver vtable", diff --git a/powerpc_encoding.go b/powerpc_encoding.go index f924f3e..6c7d8a1 100644 --- a/powerpc_encoding.go +++ b/powerpc_encoding.go @@ -2,8 +2,6 @@ package main import ( "encoding/binary" - "encoding/hex" - "log" ) // Register represents a value for a PowerPC register. @@ -115,10 +113,6 @@ func EncodeInstrDForm(opcode byte, rT Register, rA Register, value uint16) Instr secondInstr := instr[1].getByte() valByte := twoByte(value) - log.Println(hex.EncodeToString([]byte{ - firstInstr, secondInstr, valByte[0], valByte[1], - })) - return Instruction{firstInstr, secondInstr, valByte[0], valByte[1]} }