Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pkmncoraldev committed Jul 6, 2019
0 parents commit 7dd9c1e
Show file tree
Hide file tree
Showing 6,884 changed files with 365,311 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
23 changes: 23 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Auto detect text files and perform LF normalization
* text eol=lf

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.asm text
*.pal text
*.py text
*.txt text
*.sh text
*.link text
Makefile text

# hexdump binary files
*.png binary diff=hex
*.lz binary diff=hex
*.2bpp binary diff=hex
*.1bpp binary diff=hex
*.bin binary diff=hex
*.blk binary diff=hex
*.ablk binary diff=hex
*.tilemap binary diff=hex
*.ips binary diff=hex
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# generated
*.tx
*.o

# precompiled python
*.pyc
*$py.class

# no binaries
*.exe

# roms
*.gbc
*.gb

# for any of the poor souls with save game files in their working directory
*.sgm
*.sav
*.rtc
*.sn1
*.sn2
*.sn3
*.sn4
*.sn5
*.sn6
*.sn7
*.sn8
*.sn9
*.sn0

# rgbds extras
*.map
*.sym

# for vim configuration
# url: http://www.vim.org/scripts/script.php?script_id=441
.lvimrc

# swap files for vim
.*.swp

# swap files for gedit
*~
149 changes: 149 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
NAME := coral
VERSION := in-progress

TITLE := PKCORALVERSION
MCODE := PKCV
ROMVERSION := 0x30

FILLER = 0x00

ifneq ($(wildcard rgbds/.*),)
RGBDS_DIR = rgbds/
else
RGBDS_DIR =
endif

RGBASM_FLAGS =
RGBLINK_FLAGS = -n $(ROM_NAME).sym -m $(ROM_NAME).map -l contents/contents.link -p $(FILLER)
RGBFIX_FLAGS = -csjv -t $(TITLE) -i $(MCODE) -n $(ROMVERSION) -p $(FILLER) -k 01 -l 0x33 -m 0x10 -r 3

CFLAGS = -O3 -std=c11 -Wall -Wextra -pedantic

ifeq ($(filter faithful,$(MAKECMDGOALS)),faithful)
RGBASM_FLAGS += -DFAITHFUL
endif
ifeq ($(filter nortc,$(MAKECMDGOALS)),nortc)
RGBASM_FLAGS += -DNO_RTC
endif
ifeq ($(filter monochrome,$(MAKECMDGOALS)),monochrome)
RGBASM_FLAGS += -DMONOCHROME
endif
ifeq ($(filter noir,$(MAKECMDGOALS)),noir)
RGBASM_FLAGS += -DNOIR
endif
ifeq ($(filter hgss,$(MAKECMDGOALS)),hgss)
RGBASM_FLAGS += -DHGSS
endif
ifeq ($(filter debug,$(MAKECMDGOALS)),debug)
RGBASM_FLAGS += -DDEBUG
endif


.SUFFIXES:
.PHONY: all clean crystal faithful nortc debug monochrome bankfree freespace compare tools
.SECONDEXPANSION:
.PRECIOUS: %.2bpp %.1bpp %.lz %.o


roms_md5 = roms.md5
bank_ends_txt = contents/bank_ends.txt
sorted_sym = contents/$(NAME).sym

PYTHON = python
CC = gcc
RM = rm -f
GFX = $(PYTHON) gfx.py
MD5 = md5sum

LZ = tools/lzcomp
SCAN_INCLUDES = tools/scan_includes

bank_ends := $(PYTHON) contents/bank_ends.py $(NAME)-$(VERSION)


crystal_obj := \
main.o \
home.o \
ram.o \
audio.o \
audio/musicplayer.o \
data/pokemon/dex_entries.o \
data/pokemon/egg_moves.o \
data/pokemon/evos_attacks.o \
data/maps/map_data.o \
data/text/common.o \
data/tilesets.o \
engine/credits.o \
engine/events.o \
gfx/pics.o \
gfx/sprites.o


all: crystal

crystal: FILLER = 0x00
crystal: ROM_NAME = $(NAME)-$(VERSION)
crystal: $(NAME)-$(VERSION).gbc

faithful: crystal
nortc: crystal
monochrome: crystal
noir: crystal
hgss: crystal
debug: crystal

bankfree: FILLER = 0xff
bankfree: ROM_NAME = $(NAME)-$(VERSION)-0xff
bankfree: $(NAME)-$(VERSION)-0xff.gbc

freespace: $(bank_ends_txt) $(roms_md5) $(sorted_sym)


# Build tools when building the rom
ifeq ($(filter clean tools,$(MAKECMDGOALS)),)
Makefile: tools
endif

tools: $(LZ) $(SCAN_INCLUDES)

$(LZ): $(LZ).c
$(CC) $(CFLAGS) -o $@ $<

$(SCAN_INCLUDES): $(SCAN_INCLUDES).c
$(CC) $(CFLAGS) -o $@ $<


clean:
$(RM) $(crystal_obj) $(wildcard $(NAME)-*.gbc) $(wildcard $(NAME)-*.map) $(wildcard $(NAME)-*.sym)

compare: crystal
$(MD5) -c $(roms_md5)


$(bank_ends_txt): crystal bankfree ; $(bank_ends) > $@
$(roms_md5): crystal ; $(MD5) $(NAME)-$(VERSION).gbc > $@
$(sorted_sym): crystal ; tail -n +3 $(NAME)-$(VERSION).sym | sort -o $@


%.o: dep = $(shell $(SCAN_INCLUDES) $(@D)/$*.asm)
%.o: %.asm $$(dep)
$(RGBDS_DIR)rgbasm $(RGBASM_FLAGS) -o $@ $<

.gbc:
%.gbc: $(crystal_obj)
$(RGBDS_DIR)rgblink $(RGBLINK_FLAGS) -o $@ $^
$(RGBDS_DIR)rgbfix $(RGBFIX_FLAGS) $@

%.2bpp: %.png ; $(GFX) 2bpp $<
%.1bpp: %.png ; $(GFX) 1bpp $<

gfx/pokemon/%/bitmask.asm gfx/pokemon/%/frames.asm: gfx/pokemon/%/front.2bpp

%.lz: % ; $(LZ) $< $@

%.pal: ; $(error ERROR: Cannot find '$@')
%.png: ; $(error ERROR: Cannot find '$@')
%.asm: ; $(error ERROR: Cannot find '$@')
%.bin: ; $(error ERROR: Cannot find '$@')
%.ablk: ; $(error ERROR: Cannot find '$@')
%.tilemap: ; $(error ERROR: Cannot find '$@')
Loading

0 comments on commit 7dd9c1e

Please sign in to comment.