N64 assembly editor
Users browsing this thread: 1 Guest(s)

Hi guys. I've been working on this assembly editor for n64. My aim with this one was to have an easy interface. As in easy, I mean as to eliminate the small repetitive tasks (such as navigating the assembly, calculating addresses or moving/NOPing a section of assembly).

I don't think it's finished yet as I am constantly finding small updates to add, but it is currently usable. Any feedback for bugs or features it should have is welcome!

It's current features are:
  • Game offset mode: Jumps/branches/addresses and navigation will be treated with the game entry point
  • Highlighting for jumps/branches and selected register
  • Text boxes containing original assembly, hacked assembly and comments/notes which are constantly aligned
  • Easy address translation from memory editor to emulator
  • Checksum calculation (should work for most games)
  • CRC bypass (works for some games)
  • Jump/branch mapping which allows highlighting of "branch/jump targets" and "jumps to function" lookup
  • Changeable colour scheme
  • Hacking notes are always output to a negotiable text document in order of address they are aligned with
  • Generate a script from a script template to apply to a batch of addresses for use in other programs

It's currently functional spaghetti source code. If you would like to give it a whirl and you're on linux or mac, you will need a Python 3.5 or 3.6 interpreter, also need to install Python's tkinter module. If you're on Windows, there is a download link to a snapshot of my Python environment and also the disassembler and a batch file to run it.

If you haven't dabbled in python before, you likely won't have the interpreter on your machine. I'd suggest Anaconda (a Python virtual environment manager) as when you make an environment, you can specify "Anaconda" at the end of the command when creating a virtual environment in the command prompt, and it will create the python installation with a whole heap of commonly used modules, including tkinter. Anaconda might chew up to 1gb of data to install, as a forewarning.

Anaconda for OSX: https://conda.io/docs/user-guide/install/macos.html
Anaconda for Linux: https://conda.io/docs/user-guide/install/linux.html
**Don't choose miniconda, from what I understand, you can get stuck in "dependency hell" while trying to obtaining tkinter, which is not a place you want to be in

Source on Git: N64 Rom Disassembler
Download for Windows (includes python and tkinter): https://nofile.io/f/1qEEPRQ14bK/N64-Rom-Disassembler.rar


Usage

In the main window, there are 4 tall text boxes. Respectively, they represent: Addresses, base file, hack file, hacking notes/comments.

When you open a rom initially, you can choose "start new" in the file menu to select the base file and then the name and location for the hack file. If you already have a hack file you wish to open, you can "open existing" and then associate it with the base file in the 2nd file navigation window.

They might feel like normal text boxes, but they have heavily modified behaviour so as to keep the code and comments aligned. You can copy/paste or backspace multiple lines of code or comments and it will be safe.

The text boxes are bound with a few hotkeys which make life a bit easier. I'll list them all here:
  • Return: Move to end of next line
  • Shift+Return: Move to end of previous line
  • Shift+Backspace or Shift+Delete: Remove line of code
  • Ctrl+B: Insert branch template (BEQ R0, R0, $)
  • Ctrl+R: Restore line of code, or selection of lines of code
  • Ctrl+F: Follow jump or branch
  • Ctrl+G: Find all J or JAL which target any address inside the current function
  • Ctrl+Comma (< key): Undo
  • Ctrl+Fullstop (> key): Redo

The rest of the hotkeys which don't affect the text boxes can be found scattered in the Menu.

Extra text box behaviours:
  • NOP will be automatically removed when typing on that line
  • Blank lines will be replaced with and treated as NOP
  • Multi-line selections will be extended to the bounds of the start and end lines you select when you attempt to action the selection
  • Hack text box will always input as upper case letters

For address translation from memory editor RAM to emulator RAM, you may use an option to set the memory editor offset for the current game, and from there you can either type in addresses manually, or, if you leave the input text box blank and just click the translate button, it will try to convert your clipboard contents instead.

The comments navigator has a "filter" option to search for comments with particular phrases. It will filter out any comment that doesn't contain each word you type in, separated by spaces. You can see an example of that in the comments navigator image below.

If you group your addresses by adding hashtags (#group name) to the end of their comments, you can then add those groups to the batch with the click of a button in the script generator window.


Screenshots

Main window
[Image: Main_win.png]

Comments navigator
[Image: updated_comments_win.png]

Jumps navigator
[Image: jumps_win.png]

Script generator
[Image: script_generation.png]
[Image: test_script_generation.png]


All newer versions will be compatible with old config files

Latest update: 16/12/2017
(This post was last modified: Yesterday, 10:10 AM by mitchasdf.)

Hey mitchasdf,

Excellent tool! I'm usually not a big fan of python, but your code is actually quite elegant and the interface is very clean.

I had a chance to run it and the interface is a little confusing at first, but makes sense once you get going with it. Probably the initial confusion is the open dialog immediately followed by the save dialog. This is a good idea in general, as it will save people from accidentally overwriting good ROMs.

I have a couple issues/suggestions for improvement.
1. the "translate address" input box uses a font that is too large to fit an entire address in the box on my machine, so it spans multiple lines.
[Image: Gw5NE2A.png]
2. allowing for multiple memory regions to be specified. ROMs always have multiple regions which get loaded into different RAM addresses (e.g., SM64 has 4: boot, main, engine, and menu).

If you prefer I add them to the issue tracker on Github, just let me know.

This looks like a very useful tool, but I have just one request: Could you make it usable on Linux please?  See, I run Linux, but when I try to run your program I get :

Code:
Traceback (most recent call last):
 File "/home/user/misc/Other/Other/N64-Rom-Disassembler/main.py", line 7, in <module>
   from disassembler import Disassembler, REGISTERS_ENCODE, BRANCH_INTS, JUMP_INTS, CIC
 File "/home/user/misc/Other/Other/N64-Rom-Disassembler/disassembler.py", line 7, in <module>
   from decoder import PyDecoder
ImportError: No module named 'decoder'

The problem is the with the .pyd file.  I'm not sure, but I think that the pyd format is Windows specific, and Linux Python, for whatever reason, can't import a Python DLL (Which is what pyd file is, I think).  So if there's any way to use a plain Python module rather than a compiled Python DLL, would you do that please? Smile  

Thank you in advance!  From your screenshots, this looks like a great tool, and I'd be really glad if I could run it under Linux!   Smile   Excellent job, and keep up the good work!  Big Grin

Spoiler :
By the way, if you ever want some help redesigning the interface or something, let me know!  I have some experience in using Tkinter, and I'd be glad to help!  Wink
Quote:A word fitly spoken is like apples of gold in pictures of silver.
  --Proverbs 25:11

Cheers for the feedback queueRAM.

I'll look into adding the custom memory regions tomorrow morning.

For now, I've set the font sizes for those text boxes so the text no longer wraps. I'd forgotten about that and it was running off system default. There's also a fail-safe in place for overwriting a file that exists.

Hi J_128. Sorry, I made a more optimised algorithm in C++ literally hours ago and compiled that with Cython. I was unaware it was not going to work for linux. But I fixed it so it will revert to the python version of the algorithm if you cannot load PyDecoder Tongue
(This post was last modified: 06-12-2017, 05:36 PM by mitchasdf.)

Sorry to everybody who has downloaded the recent update. I left a stupid bug in there where the punctuation is spelled out as you type it... A handy feature included with the auto-capitalisation update. My bad Tongue

P.S. it's fixed now

N64 assembly editor
Users browsing this thread: 1 Guest(s)


  EN ・日本語