Codes
WiiRd forum
March 29, 2024, 12:02:45 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Welcome on the new server

Update 4.3 - do NOT update!
Gecko 1.9.3.1
Should I get a USB Gecko, I wanna hack?
How do I use my USB Gecko
Where can I get WiiRd?
 
   Home   CODE DATABASE GAMEHACKING Help Search Login Register  
Pages: [1] 2 3 ... 5
  Print  
Author Topic: PyiiASMH  (Read 22716 times)
hawkeye2777
Hacker
Sr. Member
*****

Karma: 25
Posts: 355


« on: December 28, 2009, 07:17:12 AM »

EDIT (Update - v2.0.0 released):

PyiiASMH is a cross-platform WiiRd ASM helper tool coded in Python. Go to GitHub to check it out and download it. Please submit feedback, bug reports, etc. if you have any.

Changelog:
Spoiler for Hiden:
PyiiASMH 2.0.0 (March 10, 2012):
    - Complete rewrite of the old code
    - New CLI interface (WIP)
    - New redesigned GUI (more internal changes)
    - PySide now supported
    - Multiple session support (opening/saving to files anywhere)
    - New preferences dialog with GUI Style selector, default codetype
      selector, confirmation prompts, and loading the last session on startup
    - Fields used for bapo, xor, and chksum now only allow hexadecimal input
    - Better error handling (most errors/exceptions logged to error.log)
    - Relicensed under the "new" BSD license
    - Cleaner code (WIP)
    - Bug fixes

What you need (summary):
 - Python 2.6.x or 2.7.x (download)
 - PySide 1.0.6+ (download) OR PyQt 4.7.x+ (download)

Other notes:
 - PyiiASMH is now released under the "new"/"modified"/3-clause BSD license.
 - For those of you who like to redistribute/repackage stuff, you cannot pack PyQt with PyiiASMH; the GPL doesn't allow it (unless PyiiASMH were GPL'd, which it is not anymore). However, I'll be working on "native" packages soon for Windows (and hopefully OS X too) using PySide instead, so just be patient... or just install stuff manually; it won't kill you.
 
Think that's all; ask away if you need to.
« Last Edit: June 21, 2012, 03:19:22 AM by hawkeye2777 » Logged

Currently "retired" from hacking codes.
hawkeye2777
Hacker
Sr. Member
*****

Karma: 25
Posts: 355


« Reply #1 on: April 10, 2010, 12:27:07 AM »

Updated to v0.9.1. It contains a few bug fixes, assembling opcodes shouldn't* produce errors from time to time now. Find the packages on Google Code; the source can be checked out via svn too.
Logged

Currently "retired" from hacking codes.
wiiztec
Lazy hacking machine
Hacker
Hero Member
*****

Karma: 34
Posts: 813

TimmyKitty7124
WWW
« Reply #2 on: April 10, 2010, 01:06:34 AM »

What are the differences between this and Link's ASMWiiRd?
Logged

If there's any code at all that you want to be button activated, or even able to toggle on & off, and I have the game, just PM me and I'll make it happen
hawkeye2777
Hacker
Sr. Member
*****

Karma: 25
Posts: 355


« Reply #3 on: April 10, 2010, 01:35:25 AM »

What are the differences between this and Link's ASMWiiRd?

From the README:

Quote
=== Features ===

    * Cross-platform, open-source
    * Session Loading/Saving support (currently only one session)
    * Assemble powerpc opcodes into WiiRd codes using any of the ASM codetypes (C0, C2/D2, F2/F4) or into raw hex
    * Disassemble Gecko codes into powerpc assembly opcodes

So just a few differences when compared to Link's tool.

One downside is that you'll have to download and install Python and PyQt4 if they are not already installed. I think both downloads run at about 36mb total (for Windows), so it'll take a while on slower connections to download.

If you have other questions, feel free to ask.
Logged

Currently "retired" from hacking codes.
dcx2
Computer Engineer
Moderator
Legendary Member
*****

Karma: 165
Posts: 3468


WWW
« Reply #4 on: April 10, 2010, 02:01:48 AM »

Looks yummy...perhaps you could add support for branch labels and comments at the end of the line?  The two major itches I have with asmwiird is that I have to manually calculate branch targets and I have to remove all my comments before I can copy/paste it into the assembler.

EDIT: Moving this up to the front page...

I'm making a post here with links to the appropriate stuff for Windows folks so that I have something easy to point to.


The google code page for PyiiASMH

http://code.google.com/p/pyiiasmh/


Python 2.7.2 (click "Windows x86 MSI Installer")

http://www.python.org/download/releases/2.7.2/


PyQt4 (click "PyQt-Py2.7-x86-gpl-4.8.4-1.exe") (or x64)

http://www.riverbankcomputing.co.uk/software/pyqt/download
« Last Edit: July 25, 2011, 04:20:54 AM by dcx2 » Logged

conanac
Hacker
Full Member
*****

Karma: 9
Posts: 114


« Reply #5 on: April 10, 2010, 03:22:27 AM »


Looks great and will try it out (I want to learn Python as well). Thanks for creating and improving it.

I agree with dcx2 on labeling the branch, especially when branching to prior lines with those 0xFFFFFFFF (negative) numbers.

Cheers.
Logged
hawkeye2777
Hacker
Sr. Member
*****

Karma: 25
Posts: 355


« Reply #6 on: April 10, 2010, 04:00:25 AM »

Looks yummy...perhaps you could add support for branch labels and comments at the end of the line?  The two major itches I have with asmwiird is that I have to manually calculate branch targets and I have to remove all my comments before I can copy/paste it into the assembler.

Could you give me an example or two? I'll give it a shot.
Logged

Currently "retired" from hacking codes.
dcx2
Computer Engineer
Moderator
Legendary Member
*****

Karma: 165
Posts: 3468


WWW
« Reply #7 on: April 10, 2010, 05:05:04 AM »

Real-world example is my synch code for Tales of Symphonia.

Quote
lbz r3,475(r29)      # get synch
cmpwi r3,0      # if no synch, not monster
beq- end

lis r4,-32691      # get controller pointer
ori r4,r4,30042
lha r0,4(r4)      # get button deltas hword
andi. r0,r0,12      # make sure it's not c or z changing
beq- end

lha r4,0(r4)      # get buttons
cmpwi r4,24584      # is czup?
bne- czdown

addi r3,r3,1      # inc monster synch
andi. r3,r3,15      # mask off any extra bits
bne- czdown      # did we lose synch?
li r3,1         # Replace with first synch

czdown:
cmpwi r4,24580      # is cz down?
bne- storesynch
subi r3,r3,1
andi. r3,r3,15
bne- storesynch
li r3,15         # replace with last synch

storesynch:
stb r3,475(r29)      # store synch

end:
nop

As it stands currently, I need to go through and remove all of my comments, then I need to carefully calculate the distances to each label.  If I modify the code at all, many (but not all!) of the branch distances could change.

You can make the comment character whatever you want.  You can also make any conditions on branch labels, like if you want branch labels to start with an & or something like that which will parsing easier.
Logged

hawkeye2777
Hacker
Sr. Member
*****

Karma: 25
Posts: 355


« Reply #8 on: April 10, 2010, 04:07:24 PM »

Real-world example is my synch code for Tales of Symphonia.

Spoiler for Hiden:
Quote
lbz r3,475(r29)      # get synch
cmpwi r3,0      # if no synch, not monster
beq- end

lis r4,-32691      # get controller pointer
ori r4,r4,30042
lha r0,4(r4)      # get button deltas hword
andi. r0,r0,12      # make sure it's not c or z changing
beq- end

lha r4,0(r4)      # get buttons
cmpwi r4,24584      # is czup?
bne- czdown

addi r3,r3,1      # inc monster synch
andi. r3,r3,15      # mask off any extra bits
bne- czdown      # did we lose synch?
li r3,1         # Replace with first synch

czdown:
cmpwi r4,24580      # is cz down?
bne- storesynch
subi r3,r3,1
andi. r3,r3,15
bne- storesynch
li r3,15         # replace with last synch

storesynch:
stb r3,475(r29)      # store synch

end:
nop

As it stands currently, I need to go through and remove all of my comments, then I need to carefully calculate the distances to each label.  If I modify the code at all, many (but not all!) of the branch distances could change.

You can make the comment character whatever you want.  You can also make any conditions on branch labels, like if you want branch labels to start with an & or something like that which will parsing easier.

Your original code:

Code:
C205CADC 0000000C
887D01DB 2C030000
4182004C 3C80804D #Diff 1
6084755A A8040004
7000000C 41820038 #Diff 2
A8840000 2C046008
40820014 38630001
7063000F 40820008
38600001 2C046004
40820014 3863FFFF
7063000F 40820008
3860000F 987D01DB
60000000 00000000

Assembled code using PyiiASMH:

Code:
C205CADC 0000000C
887D01DB 2C030000
41820050 3C80804D #Diff 1
6084755A A8040004
7000000C 4182003C #Diff 2
A8840000 2C046008
40820014 38630001
7063000F 40820008
38600001 2C046004
40820014 3863FFFF
7063000F 40820008
3860000F 987D01DB
60000000 00000000

Except for those two differences, everything else in the code is identical. Comments seem to work fine, I guess some of the branch labels are miscalculated.

One problem I did find though was the fixed size text fields. When comments are placed in, it's not very easy to read the assembly. I should try and fix that if I can.
Logged

Currently "retired" from hacking codes.
dcx2
Computer Engineer
Moderator
Legendary Member
*****

Karma: 165
Posts: 3468


WWW
« Reply #9 on: April 10, 2010, 04:33:45 PM »

Yeah, the branch label miscalculation was my bad (or was it a test to see if your app was working correctly..?   Evil)

In my notes I saved it with the calculated branches and I was trying to remake the one with branch labels...the original code is the correct one for sure, I messed up labels.

Anyway, that is just absolutely awesome that it supports comments and branch labels, I will definitely download and test this out.   Grin
Logged

dcx2
Computer Engineer
Moderator
Legendary Member
*****

Karma: 165
Posts: 3468


WWW
« Reply #10 on: May 23, 2010, 05:33:47 AM »

Did you ever release the PyiiASMH that supports branch labels and comments?
Logged

Cory321
Newbie
*

Karma: 0
Posts: 29


« Reply #11 on: May 23, 2010, 03:07:45 PM »

Did you ever release the PyiiASMH that supports branch labels and comments?

I'm interested too!  Tongue
Logged

dcx2
Computer Engineer
Moderator
Legendary Member
*****

Karma: 165
Posts: 3468


WWW
« Reply #12 on: May 23, 2010, 03:58:55 PM »

I downloaded PyiiASMH, and it does branch labels/comments.  You have to follow the readme to install prerequisites.
Logged

hawkeye2777
Hacker
Sr. Member
*****

Karma: 25
Posts: 355


« Reply #13 on: May 24, 2010, 04:00:21 AM »

Updated to v0.9.2; just a few minor changes. Archives are on Google Code, a deb package for Ubuntu should be coming soon (just have to rewrite some of the IO parts for it to work right).
Logged

Currently "retired" from hacking codes.
dcx2
Computer Engineer
Moderator
Legendary Member
*****

Karma: 165
Posts: 3468


WWW
« Reply #14 on: June 02, 2010, 03:21:24 AM »

Try to make a C0 code out of the following

ori r30,r30,2562

And you will get

C0000000 00000001
63DE0A 4E800020

It should be

C0000000 00000001
63DE0A02 4E800020

Amusingly, if you try to run the correct code backwards into opcodes, it works correctly.
Logged

Pages: [1] 2 3 ... 5
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!