-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (82 loc) · 3.79 KB
/
Makefile
File metadata and controls
82 lines (82 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Makefile for creating the 'Fixed PSI Animations' patch for the Base ROM
SHELL := /bin/bash
#----------------------------------------------------------------
# Variables
START := $(shell date +%s)
CLEAN_ROM = EarthBound.sfc
BASE = PSIAnimsBase.sfc
CHECKSUM = d67a8ef36ef616bc39306aa1b486e1bd3047815a
PATCH_NAME = MaternalBound-Redux
PATCHED_ROM_NAME = Mother 2.sfc
PATCH_DIR = Patches
FLIPS = ./flips
TIME = `date +'%T, %a %d/%b/%Y'`
SHA1SUM = `sha1sum $(CLEAN_ROM) | awk '{ print $$1 }'`
#----------------------------------------------------------------
# Targets
all: check_rom check_checksum create_base_rom compile_project create_patch create_debug_symbols create_both_patches finish
#----------------------------------------------------------------
# Check if the base ROM exists and has the correct name
check_rom:
@if [ ! -e $(CLEAN_ROM) ]; then \
echo "ERROR: Base ROM not found."; \
echo "Please, rename the ROM to '$(CLEAN_ROM)' to begin the patching process."; \
exit 1; \
fi
@echo "ROM detected. Verifying name..."
#----------------------------------------------------------------
# Verify SHA-1 checksum
check_checksum:
@echo "Base ROM detected with proper name."; echo
@echo "Verifying SHA-1 checksum hash..."
@if [ "$(SHA1SUM)" != "$(CHECKSUM)" ]; then \
echo "ERROR: Base ROM checksum is incorrect."; \
echo "Use an EarthBound ROM with the proper SHA-1 checksum for patching."; \
exit 1; \
fi
@echo "Base ROM SHA-1 checksum verified."; echo
#----------------------------------------------------------------
# Create the base ROM if it doesn't exist
create_base_rom:
@if [ ! -f $(BASE) ]; then \
echo "Base ROM ($(BASE)) not found, creating it..."; \
coilsnake-cli patchrom $(CLEAN_ROM) $(BASE) "Patches/FixedPSIAnims.ebp" false; echo; \
coilsnake-cli expand $(BASE) false; echo; \
else \
echo "$(BASE) already exists, proceeding..."; echo; \
fi
#----------------------------------------------------------------
# Compile the full CoilSnake Project
compile_project:
@echo "Starting compilation process..."; echo
@coilsnake-cli compile Project/ $(BASE) "$(PATCHED_ROM_NAME)"
@echo
#----------------------------------------------------------------
# Generate the Debug symbols for the project (Requires Python 3)
create_debug_symbols:
@echo "Generating Debug symbols..."
@python "Scripts/generate_debug_symbols.py" "Project/ccscript/summary.txt" $(PATCH_NAME).mlb
#----------------------------------------------------------------
# Create the EBP patch based on the Project
create_patch:
# No more EBP patch. Only BPS will be used.
# @echo
# @coilsnake-cli createpatch $(CLEAN_ROM) "$(PATCHED_ROM_NAME)" "$(PATCH_DIR)/$(PATCH_NAME).ebp" "ShadowOne333" "A new MaternalBound with New Controls, MSU-1 integration and much more!" "MaternalBound Redux"
#----------------------------------------------------------------
# Create both additional BPS and IPS patches files
create_both_patches:
@echo
# @echo "Creating both BPS and IPS patches..."
@echo "Creating BPS patch..."
@$(FLIPS) -c "$(CLEAN_ROM)" "$(PATCHED_ROM_NAME)" "$(PATCH_DIR)/$(PATCH_NAME).bps"
# IPS patches will no longer be made due to them not checking the base ROM for patching, causing glitches in wrong base ROMs
# @$(FLIPS) -c "$(CLEAN_ROM)" "$(PATCHED_ROM_NAME)" "$(PATCH_DIR)/$(PATCH_NAME).ips"
# @echo; echo "BPS & IPS patches created successfully!"; echo
@echo
#----------------------------------------------------------------
# Finish the process
finish:
@echo "Final compilation time: $$(( `date +%s` - $(START) )) seconds"
@echo "Redux compilation finished at $(TIME)!"
#----------------------------------------------------------------
.PHONY: all check_rom check_checksum create_base_rom compile_project create_patch create_debug_symbols create_both_patches finish