Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
nstbayless committed Jul 25, 2024
1 parent ddee96e commit 8ffd5e2
Show file tree
Hide file tree
Showing 14 changed files with 232 additions and 263 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
*.nes
.patch-prev.ips
*.ips
*.dbg
inc-base.asm
*.map
*.cdl
*.nl
*.nl
*.zip
cv3-controls
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
## Castlevania 3 Improved Controls Hack

### Contributing to this repository
### Building

Run the `setup.sh` script before starting in order to enable githooks.
**Prerequisite**: you need asm6f [with rom patching directives](https://github.com/freem/asm6f/pull/30).

You must supply your own ROM for Akumajou Densetsu (J). Paste the ROM
Please add `base-us.nes` and/or `base-jp.nes` to the repo, then run `./build.sh`.

CRC32 for ROM: 2E93CE72
SHA-1: A0F3B31D4E3B0D2CA2E8A34F91F14AD99A5AD11F
Produces `out-us.nes`, `out-jp.nes` etc., as well as `out-us.ips` and `out-jp.ips`, and packages the result
22 changes: 12 additions & 10 deletions _custom_jump.asm
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ hcancel:
STA hspint
check_vcancel:
LDA joypad_down
AND #$80 ; holding jump button?
BNE __vcancel_rts
LDA vspint ; already moving downward?
BPL __vcancel_rts
LDA #VSP_CONTROL_ZERO_VSPEED
STA vsp_control
LDA #$00
STA vspint
ifdef VCANCEL
LDA joypad_down
AND #$80 ; holding jump button?
BNE __vcancel_rts
LDA vspint ; already moving downward?
BPL __vcancel_rts
LDA #VSP_CONTROL_ZERO_VSPEED
STA vsp_control
LDA #$00
STA vspint
endif
__vcancel_rts:
RTS
72 changes: 72 additions & 0 deletions _hooks.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
FROM detour_to_custom_knockback
; replacement:
; lda #$08
; ldy $04F2
NOP
NOP
JSR custom_knockback

; in Trevor state jump table ($9376)
FROM trevor_jump_table
SKIP $8
; state 8 (jumping)
; jump replacement
DW custom_jump_then_standard_jump

FROM attack
jsr jumping_attack

FROM jump_attack_step
jsr jumping_attack

FROM set_fall_state
; go to jump state (instead of falling state)
lda #$08

FROM fall_adjust
; x=0 before this
lda #VSP_CONTROL_ZERO_VSPEED
STA vsp_control,X
STX simon_fall_objphase
lda #$16
sta imgsin
zero_hspfra:
lda #$00
sta hspfra
__standard_rts:
rts
rts_if_cutscene:
lda cutscene_timer
beq __standard_rts
lda cutscene_input
beq __standard_rts
; double-rts -- rts caller
pla
pla
rts
LIMIT standard_jump

FROM standard_crouch
jsr crouch_direction

FROM standard_stair_idle
; replaces:
; LDA joypad_down
; AND #$40 ; down ?
JSR stair_jumping
NOP
FROM standard_stair_walk
; replaces:
; JSR stair_walk_resume
JSR stair_jumping

FROM sypha_jumptable

SKIP $8
; jump
DW custom_jump_then_standard_jump

FROM alucard_jumptable
SKIP $8
DW custom_jump_then_standard_jump
66 changes: 52 additions & 14 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,65 @@ SRC=patch
OUT=out

builds=("us" "jp")
vcancel_cfgs=("vcancel" "no-vcancel")

export="cv3-controls"
set -e

which asm6f > /dev/null
if [ $? != 0 ]
then
echo "asm6f is not on the PATH. asm6f with patching directives is required: https://github.com/freem/asm6f/pull/30"
exit 1
fi

if [ -d "$export" ]
then
rm -r $export
fi
mkdir $export
cp pkg_readme.md $export/README.md

for build in "${builds[@]}"; do
if [ ! -f $BASE-$build.nes ]; then
echo "no base: $BASE-$build.nes"
continue
fi
echo "INCNES \"$BASE-$build.nes\"" > inc-base.asm
which asm6f > /dev/null
if [ $? != 0 ]
then
echo "asm6f is not on the PATH."
continue
fi
mkdir $export/$build

for vcancel in "${vcancel_cfgs[@]}"; do

defines=""

suffix="$build"
if [ "$vcancel" == "vcancel" ]; then
suffix="$build-$vcancel"
defines="$defines -dVCANCEL"
fi

echo "building $suffix"

asm6f -c -n -i "-dUSEBASE" "-dBUILD_${build^^}" $defines "$SRC-$build.asm" "$OUT-$suffix.nes"

asm6f -c -n -i "-dUSEBASE" "-dBUILD_${build^^}" "$SRC-$build.asm" "$OUT-$build.nes"
if [ $? != 0 ]
then
echo "error building."
exit
fi

cp "$OUT-$suffix.ips" "$export/$build/$export-$suffix.ips"

if command -v ipsnect >/dev/null 2>&1; then
ipsnect "$OUT-$suffix.ips" > "$OUT-$suffix.map"
fi
done
done

if [ $? != 0 ]
then
echo "error building."
exit
fi
echo "============================================"
echo "Assembling export."

ipsnect "$OUT-$build.ips" > "$OUT-$build.map"
done
if [ -f cv3-controls.zip ]; then
rm cv3-controls.zip
fi
zip -r cv3-controls.zip $export/*
3 changes: 3 additions & 0 deletions offsets-jp.asm
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
detour_to_custom_knockback=$8338
standard_crouch=$9920
crouch_resolve=$840C
trevor_jump_table=$9376
attack=$942F
jump_attack_step=$94C9
attack_resolve=$97A3
set_fall_state=$974F
fall_adjust=$9756
standard_jump=$9777
standard_stair_idle=$99A4
standard_stair_walk=$9AAB
stair_walk_resume=$9A43
sypha_jumptable=$9C19
alucard_jumptable=$A59B
empty_bank_e=$BF39
Expand Down
3 changes: 3 additions & 0 deletions offsets-us.asm
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
detour_to_custom_knockback=$834D
standard_crouch=$9919
crouch_resolve=$8421
trevor_jump_table=$9381
attack=$943A
jump_attack_step=$94D4
attack_resolve=$979C
set_fall_state=$9748
fall_adjust=$974F
standard_jump=$9770
standard_stair_idle=$998E
standard_stair_walk=$9A93
stair_walk_resume=$9A2D
sypha_jumptable=$9C02
alucard_jumptable=$A5B4
empty_bank_e=$BFAB
Expand Down
Binary file modified out-jp.ips
Binary file not shown.
Binary file modified out-us.ips
Binary file not shown.
Loading

0 comments on commit 8ffd5e2

Please sign in to comment.