• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Game Modifications › Cheats, Hacks, & Game Patches v
« Previous 1 ... 13 14 15 16 17 Next »

Decompilation, automate preliminary work?
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Decompilation, automate preliminary work?
12-28-2016, 10:24 AM
#1
Yoshimaster96 Offline
Junior Member
**
Posts: 22
Threads: 9
Joined: Aug 2016
I know that it'll take a long time, and that it can't be done completely automatically, however...

I'd like to at the VERY LEAST have a tool that'll split it into functions and convert assembly instructions into small statements that can later be optimized by the user.

For example (code from http://www.csd.uwo.ca/~mburrel/stuff/ppc-asm.html):

ASSEMBLY:

bar:
mflr r0 // set up the stack frame
stw r0, 8(r1)
stwu r1, -16(r1)
addi r3, r3, 3 // add 3 to the argument and return it
addi r1, r1, 16 // destroy the stack frame
lwz r0, 8(r1)
mtlr r0
blr // return

.globl _main
_main:
mflr r0 // set up the stack frame
stw r0, 8(r1)
stwu r1, -16(r1)
lis r3, hi16(847318093) // load big number into r3
ori r3, r3, lo16(847318092)
bl bar // call stuff
addi r1, r1, 16 // destroy the stack frame
lwz r0, 8(r1)
mtlr r0
blr // return


C CODE:

#include <stdint.h>
uint32_t regs[32];

uint32_t bar(uint32_t a)
{
//ctors automatically removed
regs[3] = a+3; //addi r3,r3,3
return regs[3]; //modification to r3 detected
//dtors automatically removed
}

main()
{
//ctors automatically removed
regs[3] = (847318093)&0xFFFF0000; //lis r3, hi16(847318093)
regs[3] |= (847318093)>>16; //ori r3, r3, lo16(847318093)
bar(regs[3]); //bl bar
//dtors automatically removed
}

As you can see, I don't have high expectations, but ideally functions should be detected and separated, stack construction and destruction in functions omitted, and everything else has a 1 to 1 correspondence from assembly opcode to C statement. Is there such a tool? Or would I have to make it myself?
Find
Reply
01-03-2017, 05:58 PM
#2
DrHouse64 Offline
A woman yet a man, a man yet a woman
****
Posts: 343
Threads: 18
Joined: Jun 2013
That's interesting, the only thing I can find about this are softs like boomerang, IDA or PPC2C.
From France with love.
Laptop ROG : W10 / Ryzen 7 4800HS @2.9 GHz (4.2 GHz Turbo disabled unless necessary for better thermals) / 16 Go DDR4 / RTX 2060 MaxQ (6 Go GDDR6)
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode