Merge pull request #365 from Ben10do/tools-makefile-integration

Improvements to the tools and their Makefile
This commit is contained in:
yenatch 2017-06-24 21:03:09 -04:00 committed by GitHub
commit 175cc6536a
5 changed files with 25 additions and 8 deletions

View File

@ -17,7 +17,6 @@ cd ..
git clone https://github.com/pret/pokecrystal
cd pokecrystal
make tools
```
To build **pokecrystal.gbc**:
@ -42,7 +41,6 @@ cd ..
git clone https://github.com/pret/pokecrystal
cd pokecrystal
make tools
```
To build **pokecrystal.gbc**:
@ -67,7 +65,6 @@ In the **Cygwin terminal**:
git clone https://github.com/pret/pokecrystal
cd pokecrystal
make tools CC=gcc
```
To build **pokecrystal.gbc**:

View File

@ -36,8 +36,16 @@ all: crystal
crystal: pokecrystal.gbc
crystal11: pokecrystal11.gbc
# Ensure that the tools are built when making the ROM
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),tools)
Makefile: tools
endif
endif
clean:
rm -f $(roms) $(crystal_obj) $(crystal11_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym)
make clean -C tools/
compare: $(roms)
@$(SHA1) -c roms.sha1

8
tools/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
gfx
lzcomp
md5
palette
png_dimensions
pokemon_animation
pokemon_animation_graphics
scan_includes

View File

@ -1,8 +1,8 @@
.PHONY: all
.PHONY: all clean
CFLAGS := -std=c99
all: \
tools := \
lzcomp \
png_dimensions \
scan_includes \
@ -11,7 +11,11 @@ all: \
pokemon_animation_graphics \
gfx \
md5
all: $(tools)
@:
clean:
rm -f $(tools)
%: %.c
$(CC) $(CFLAGS) -o $@ $<

View File

@ -177,11 +177,11 @@ struct command find_best_copy (const unsigned char * data, unsigned short positi
struct command simple = {.command = 7};
struct command flipped = simple, backwards = simple;
short count, offset;
if (count = scan_forwards(data + position, length - position, data, position, &offset))
if ((count = scan_forwards(data + position, length - position, data, position, &offset)))
simple = (struct command) {.command = 4, .count = count, .value = offset};
if (count = scan_forwards(data + position, length - position, bitflipped, position, &offset))
if ((count = scan_forwards(data + position, length - position, bitflipped, position, &offset)))
flipped = (struct command) {.command = 5, .count = count, .value = offset};
if (count = scan_backwards(data, length - position, position, &offset))
if ((count = scan_backwards(data, length - position, position, &offset)))
backwards = (struct command) {.command = 6, .count = count, .value = offset};
struct command command;
switch (flags / 24) {