First pass at patching (probably integer files only)

This is pretty crude, but seems to work.

Once this and the int/float selection thing are in then a refactor of read/write function selection will be in order.