diff --git a/README.md b/README.md new file mode 100644 index 0000000..1bb9813 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +## Castlevania 3 Improved Controls Hack + +### Contributing to this repository + +Run the `setup.sh` script before starting in order to enable githooks. + +You must supply your own ROM for Akumajou Densetsu (J). Paste the ROM + +CRC32 for ROM: 2E93CE72 +SHA-1: A0F3B31D4E3B0D2CA2E8A34F91F14AD99A5AD11F diff --git a/apply.sh b/apply.sh new file mode 100755 index 0000000..56dce35 --- /dev/null +++ b/apply.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +_force=false +flips="./flips/flips.exe" + +while getopts ":f" opt; do + case ${opt} in + f ) #force + _force=true + esac +done + +if [ ! -f base.nes ] +then + >&2 echo "No base.nes ROM detected; cannot generate working.nes" + exit 4; +else + if [ -f working.nes ] + then + if [ "$_force" = false ] + then + >&2 echo "working.nes already exists. Rerun with -f flag to force overwriting working.nes" + exit 1; + else + echo "Replacing existing working.nes" + rm working.nes + fi + fi + echo "Generating working.nes..." + op=`uname` + + if [ "$op" = "Linux" ] + then + flips="./flips/flips-linux" + fi + + if [ ! -f $flips ] + then + >&2 echo "flips not found; do you have the flips/ folder?" + exit 2; + fi + + cp base.nes working.nes + if [ ! $? -eq 0 ] + then + >&2 echo "Error creating working.nes" + exit 3; + fi + + chmod u+x $flips + + $flips --apply patch.ips working.nes + exit $? +fi diff --git a/flips/flips-linux b/flips/flips-linux new file mode 100755 index 0000000..961933f Binary files /dev/null and b/flips/flips-linux differ diff --git a/flips/flips.exe b/flips/flips.exe new file mode 100755 index 0000000..b94f581 Binary files /dev/null and b/flips/flips.exe differ diff --git a/flips/license.txt b/flips/license.txt new file mode 100644 index 0000000..c3bf78f --- /dev/null +++ b/flips/license.txt @@ -0,0 +1,11 @@ +Flips is licensed under GNU General Public License, version 3.0 or higher. The full legal text can + be found in boring.zip; a rough interpretation (for non-lawyers only) follows: + +- You must credit the author. Don't claim it as your own. You may modify it and take credit for your + modifications, but the author (Alcaro) must be credited for the original software. +- If you modify this software, it must clearly be labeled as a modification. +- Any applications containing any part of this software must provide the full source code needed to + modify and rebuild this application, under the same license. Including this interpretation is + optional. +- The author claims no copyright over input, output, or error messages generated by this tool. Use + it however you want. diff --git a/hooks/pre-commit b/hooks/pre-commit new file mode 100755 index 0000000..cb49b3b --- /dev/null +++ b/hooks/pre-commit @@ -0,0 +1,11 @@ +#!/bin/bash + +# go to root directory of git repo: +_rdir=`git rev-parse --show-toplevel` +cd $_rdir + +# make sure base.nes and working.nes exist: +if [ ! -f ./base.nes ] +then + echo "Base ROM (base.nes) is not found!" +fi diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..7723636 --- /dev/null +++ b/setup.sh @@ -0,0 +1,34 @@ +#!/bin/bash +echo "Seting git hoooks directory to hooks/" +git config core.hooksPath hooks + +if [ -f base.nes ] +then + echo "Marking base.nes as read-only" + chmod a-wx base.nes +fi + +if [ ! -f ./working.nes ] +then + if [ -f ./base.nes ] + then + echo "Applying patch.ips to generate working.nes" + ./apply.sh + else + echo "Warning: no base ROM or working ROM detected." + echo "Copy base.nes into the repository and then run apply.sh" + fi +else + if [ ! -f ./base.nes ] + then + echo "Warning: working.nes but no base.nes file; you will not be able to generate patches." + echo "(Perhaps you should delete working.nes and copy in a new base.nes?)" + fi +fi + +if [ $? -eq 0 ] +then + echo "Setup complete." +else + echo "Setup exited with errors. Please review." +fi