Thread: JBPatch
View Single Post
Old 11-06-2012, 06:20 AM   #903
dung.saga
Junior Member
dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.dung.saga can tame squirrels without the assistance of a chair or a whip.
 
Posts: 7
Karma: 11342
Join Date: Oct 2012
Device: Kindle Touch
Red face tried & failed

In order to control zooming ratio while reading PDF, I tried to patch here and there. So far all of them failed . At least I learned something about JVM bytecode and Java class file .

Using ht under Linux, I was trying to change op-codes directly in Java class file (ht can (dis)assemble bytecode of a Java class).


test #1:
I patched function mousePressed(MouseEvent a)
in zb.class in ReaderSDK-impl.jar

change "40" into "20" (2 occurrences)

Code:
public class ContentPanel extends ReaderUIContext
{
  public void mousePressed(MouseEvent a)
  {
    //...
    int x = a.getX(); 
    int y = a.getY();
    switch (a.getButton())
    {
      case 1: //first finger
      case 2: //second finger
      case 8: //this.E += 40; this.doZoom(...);
      case 7: //this.E -= 40; this.doZoom(...);
      case 9:
      //case 3,4,5,6: //do nothing
    }
    //...
  }
}
result: no visible change!

test #2:
I patched function D(int a, int a, boolean a, boolean a, boolean a, boolean a)
in zb.class in ReaderSDK-impl.jar

change 99 (ifeq) into 9a (ifne)
"if(arg4)" become "if(!arg4)"

Code:
if(arg4) {
//*  84  155:iload           4
//*  85  157:ifeq            188
  if(arg5) {
  //*  86  160:iload           5
  //*  87  162:ifeq            178
    j++;
  } else {
    j--;
  }
}
result: cannot zoom in/out with pinch/stretch gesture anymore.

test #3:
in the same function as the last test

change "j++" into "j += 0.5"
change "j--" into "j -= 0.5"

result: no book listed in home screen!


test #4:
in the same function as the last test

change "j++" into "j += 2"
change "j--" into "j -= 2"

result: no book listed in home screen!
dung.saga is offline   Reply With Quote