Skip to content

Instantly share code, notes, and snippets.

@kageru
Last active January 13, 2022 18:12
Show Gist options
  • Save kageru/521edf7441ebe57d0d0a93794dce3d04 to your computer and use it in GitHub Desktop.
Save kageru/521edf7441ebe57d0d0a93794dce3d04 to your computer and use it in GitHub Desktop.
A simple script that will rename .inc files to .pory and wrap their contents in `raw` blocks. Something for gen 3 rom hacking.
#!/bin/sh
# Save this somewhere and call it in a loop of your choice, e.g.
# find -name 'scripts.inc' -exec ./inc_to_pory.sh {} \;
# to wrap all `scripts.inc` files in raw blocks and rename them to pory or
# find -name '*.inc' -exec ./inc_to_pory.sh {} \;
# to do the same with *all* .inc scripts in the current folder or subfolders.
f="$(echo $1 | rev | cut -c 5- | rev)"
echo 'raw `' >> "$f.pory"
cat "$f.inc" >> "$f.pory"
echo '`' >> "$f.pory"
rm "$f.inc"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment