gopro2027

Easy branch absolute PPC generator (PatchInJump)

Apr 16th, 2021
935
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.main;
  2.  
  3. public class GenerateBlaBa {
  4.  
  5.     public static void main(String[] args) {
  6.         //the only two instructions it supports lmao
  7.         gen("bla 0x1234567");
  8.         gen("ba 0xAB1234");
  9.        
  10.         //same output as above
  11.         gen("bl 0x1234567");
  12.         gen("b 0xAB1234");
  13.     }
  14.    
  15.     public static void gen(String instruction) {
  16.         String spacesplit[] = instruction.split(" ");
  17.         String l = spacesplit[0].contains("l")?"l":"";
  18.         String firstHalf = spacesplit[1].substring(0, spacesplit[1].length() - 4);
  19.         String secondHalf =  "0x"+instruction.substring(instruction.length() - 4);
  20.         System.out.println("__asm(\"lis %r11, "+firstHalf+"\");\r\n" +
  21.                 "__asm(\"addi %r11, %r11, "+secondHalf+"\");\r\n" +
  22.                 "__asm(\"mtctr %r11\");\r\n" +
  23.                 "__asm(\"bctr"+l+"\");");
  24.         System.out.println();
  25.     }
  26.  
  27. }
  28.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×