View Single Post
Old 02-06-2019, 08:41 PM   #177
geek1011
Wizard
geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.
 
Posts: 1,139
Karma: 2582511
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Kobo Aura Edition 2, Moto G5
Arrow Patches v41: The 3 missing libadobe patches are back!

I have released patches v41. I have redone the 3 libadobe patches which have been missing for over a year and released them for 4.11.11911+ (which was possible without any extra work due to the new ReplaceBytesAtSymbol instruction in kobopatch v0.13.0).

Keep PDF pan position:
This patch prevents the pan position from being reset after each page turn.

This was the most time consuming to redo (2h), as the reset was actually done in two different locations in the code. I initially overlooked the second reset, and then once I noticed it, I kept messing up the SP (stack pointer) (and causing segfaults) when doing this a more complex way. I eventually tried using a fixed pan value to see if I covered everything (and to make sure I got the pan variable offsets right), then I did this patch again from scratch, and was more careful about my handling of pointers.

Remove PDF page turn arrows:
This patch removes the arrows shown on the left and right sides when zoomed in.

This was the easiest patch to do (~15 min), as I just needed to prevent it from enabling the arrows when zoomed in.

Remove PDF map widget shown during panning:
This patch removes the map widget shown when panning. This can be useful when reading a pdf as you drag it, as the map obstructs a significant portion of the top-left corner.

This patch was also easy to make (~20 min) once I found the code which renders the map.

---

For convenience, here are the patches:
Spoiler:
Code:
Remove PDF map widget shown during panning:
  - Enabled: no
  - Description: |
      Removes the PDF map widget shown during panning and zooming.
  # In the function which shows the widget, NOP the CBZ to end it on all conditions.
  - ReplaceBytesAtSymbol: {Symbol: "N3AdobeReader::showMapWidget()", Offset: 9, FindH: 28 B1, ReplaceH: 00 20}

Remove PDF page turn arrows:
  - Enabled: no
  - Description: |
      Removes the PDF page turn arrows which show on the sides when zoomed in.
  # In the function which shows the arrows, NOP the CBZ to end it on all conditions.
  - ReplaceBytesAtSymbol: {Symbol: "N3AdobeReader::showPageArrowsAsNeeded()", Offset: 13, FindH: 30 B1, ReplaceH: 00 20}

Keep PDF pan position:
  - Enabled: no
  - Description: |
      Prevents the pan position from being reset when going to the next/previous page.
  # Immediately call BX LR to exit function without doing anything:
  - ReplaceBytesAtSymbol: {Symbol: "AdobeReader::resetPan()", Offset: -1, FindH: 00 23, ReplaceH: 70 47}
  # Skip over the additional reset in the function (idk why it's there, as it seems to do the same thing as AdobeReader::resetPan):
  # Making the CMP always NE (CMP r5, #0).
  - ReplaceBytesAtSymbol: {Symbol: "AdobeReader::goToNextPage()", Offset: 155, FindH: 9A 42, ReplaceH: 00 2A}
  - ReplaceBytesAtSymbol: {Symbol: "AdobeReader::goToPrevPage()", Offset: 149, FindH: 9A 42, ReplaceH: 00 2A}
geek1011 is offline   Reply With Quote