___  ___    _ _    _  _ _____   _____
 / __|/ _ \  | | |  | || |_ _\ \ / / __|
| (_ | (_) | |_  _| | __ || | \ V /| _|
 \___|\___/    |_|  |_||_|___| \_/ |___|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

[utopian-io] ips-util - Python package for manipulating IPS patches

BY: @nleseul | CREATED: Dec. 26, 2018, 5:59 p.m. | VOTES: 32 | PAYOUT: $32.66 | [ VOTE ]

Background

The International Patching System (IPS) patch format is a historically popular distribution format for ROM hacks. It's a very simple format, and a number of tools exist for creating IPS patches from binary data. I wanted to be able to create IPS patches programatically in Python scripts, however, and no existing library provided that support. So I made one.

I got enough testing and polish done on the library that I chose to upload it to PyPI as a formal Python package. As such, a released version can be acquired by any Python user with pip install ips-util.

Links

Usage notes

(Pretty much straight from the README.)

To create a patch, using existing source and target binary files:

> ips_util create "Super Mario World.smc" "Super Mario World [1337357_h4x_3v4r].smc" -o 1337_p47ch.ips

To apply a patch to a binary file:

> ips_util apply 1337_p47ch.ips "Super Mario World.smc" -o w00t.smc

To dump the contents of a patch:

> ips_util trace 1337_p47ch.ips

The package can also be used within Python scripts to build IPS patches manually, as follows:

from ips_util import Patch

def this_is_my_patch():
  patch = Patch()

  patch.add_record(0x1234, 999.to_bytes(2, byteorder='little')) # Max out some stat
  patch.add_rle_record(0x5678, b'\xea', 0x10)                   # NOP out a bunch of code

  with open('gavroche.ips', 'w+b') as f:
    f.write(patch.encode())

Testing

The package includes unit tests (contained in the ips_util/tests/test_patch.py script) to verify design requirements and some common edge cases in IPS format:

Manually created patches

Patches created from source and target binary data (the Patch.create() API)

TAGS: [ #utopian-io ] [ #development ] [ #python ] [ #rom-hacking ] [ #ips-patch ]

Replies

@steemitboard | Dec. 26, 2018, 6:47 p.m. | Votes: 0 | [ VOTE ]

Congratulations @nleseul! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

https://steemitimages.com/60x70/http://steemitboard.com/@nleseul/votes.png?201812261723You made more than 1250 upvotes. Your next target is to reach 1500 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

Christmas Challenge - The party continuesChristmas Challenge - Send a gift to to your friends

> Support SteemitBoard's project! Vote for its witness and get one more award!

@justyy | Dec. 26, 2018, 6:56 p.m. | Votes: 21 | [ VOTE ]

Thank you for your contribution. I am a fan of the vintage game consoles e.g. 8-bit super mario. So does this utility work on 8-bit ROM files?

From the documentation, I can see it is a complete and useful tool and good job for putting it on pip.

  1. It would be good to see some real ROM files in your test scripts e.g. you can put the ROM under testdata directories.
  2. When dealing with I/O, I feel that the try...catch is kinda missing.
  3. It is better to group your commits into a PR.
  4. If a binary file is empty, your Path.load will probably throw exception?
  5. You might want to add a command-line option to enable the debugger output.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.

Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

@utopian-io | Dec. 28, 2018, 7:01 p.m. | Votes: 0 | [ VOTE ]

Thank you for your review, @justyy! Keep up the good work!

@steem-ua | Dec. 26, 2018, 7:36 p.m. | Votes: 0 | [ VOTE ]

Hi @nleseul!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

@utopian-io | Dec. 26, 2018, 10:43 p.m. | Votes: 1 | [ VOTE ]

Hey, @nleseul!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>