Skip to content

Commit

Permalink
Added ROM setup base scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
nstbayless committed Aug 27, 2017
1 parent 3a73ba8 commit 30997eb
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
54 changes: 54 additions & 0 deletions apply.sh
Original file line number Diff line number Diff line change
@@ -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
Binary file added flips/flips-linux
Binary file not shown.
Binary file added flips/flips.exe
Binary file not shown.
11 changes: 11 additions & 0 deletions flips/license.txt
Original file line number Diff line number Diff line change
@@ -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.
11 changes: 11 additions & 0 deletions hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 30997eb

Please sign in to comment.