Skip to content

Commit 260a531

Browse files
committed
2025 update
1 parent 56df015 commit 260a531

File tree

178 files changed

+425
-662
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+425
-662
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
.DS_Store
66
*~
77
filesystem/
8+
build/

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"konami.h": "c",
44
"controls.h": "c",
55
"bgm.h": "c",
6-
"dfs.h": "c",
6+
"sprite.h": "c",
77
"limits": "c",
88
"type_traits": "c"
99
},

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
FROM anacierdem/libdragon
1+
FROM ghcr.io/dragonminded/libdragon
2+
ARG LIBDRAGON_COMMIT 9926cc32e384d58c74b609733c7b50457d811732 #11/22/25
23

3-
RUN apt-get update && apt-get install -yq libsox-fmt-all sox
4+
RUN apt-get update -yq && apt-get install -yq libsox-fmt-all sox
5+
6+
RUN cd /tmp && git clone https://github.com/DragonMinded/libdragon.git && cd libdragon && git reset --hard $LIBDRAGON_COMMIT && make install && make tools-install
47

58
WORKDIR /game

Makefile

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
ROOTDIR = $(N64_INST)
2-
GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf-
3-
CHKSUM64PATH = $(ROOTDIR)/bin/chksum64
4-
MKDFSPATH = $(ROOTDIR)/bin/mkdfs
5-
MKSPRITE = $(ROOTDIR)/bin/mksprite
6-
N64TOOL = $(ROOTDIR)/bin/n64tool
7-
LINK_FLAGS = -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lc -lm -ldragonsys -Tn64.ld
8-
PROG_NAME = 2048-64
9-
CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O2 -Wall -Werror -I$(ROOTDIR)/mips64-elf/include -Iinclude -I/usr/local/include/
10-
ASFLAGS = -mtune=vr4300 -march=vr4300
11-
CC = $(GCCN64PREFIX)gcc
12-
AS = $(GCCN64PREFIX)as
13-
LD = $(GCCN64PREFIX)ld
14-
OBJCOPY = $(GCCN64PREFIX)objcopy
1+
ARES_BIN := /Applications/ares.app/Contents/MacOS/ares
2+
3+
BUILD_DIR := build
4+
SOURCE_DIR := src
5+
ROM_NAME := 2048-64
6+
N64_ROM_TITLE := "2048-64"
7+
8+
N64_MK_PATH := $(N64_INST)/include/n64.mk
9+
ifneq (,$(wildcard $(N64_MK_PATH)))
10+
include $(N64_MK_PATH)
11+
endif
12+
13+
N64_CFLAGS += -Iinclude
14+
N64_ASFLAGS += -Iinclude
1515

1616
all: build
1717

1818
build: ## Create rom.
19-
@docker --version &> /dev/null
20-
@if [ $$? -ne 0 ]; then echo "Building rom..." && make $(PROG_NAME).z64; fi
21-
@if [ $$? -eq 0 ]; then echo "Building rom inside docker environment..." && make docker; fi
19+
@if command -v docker >/dev/null 2>&1; then \
20+
echo "Building rom inside docker environment..."; \
21+
$(MAKE) docker; \
22+
else \
23+
echo "Building rom..."; \
24+
$(MAKE) $(ROM_NAME).z64; \
25+
fi
2226

2327
docker: setup
24-
@docker run --user $(shell id -u):$(shell id -g) -v ${CURDIR}:/game build make $(PROG_NAME).z64
28+
@docker run --user $(shell id -u):$(shell id -g) -v ${CURDIR}:/game build make $(ROM_NAME).z64
2529

2630
rebuild: clean build ## Erase temp files and create the rom.
2731

@@ -30,11 +34,7 @@ PNGS := $(wildcard resources/gfx/*/*.png) $(wildcard resources/gfx/*/*/*.png)
3034
SPRITES := $(subst .png,.sprite,$(subst resources/,filesystem/,$(PNGS)))
3135
filesystem/gfx/sprites/%.sprite: resources/gfx/sprites/%.png
3236
@mkdir -p `echo $@ | xargs dirname`
33-
$(MKSPRITE) 16 1 1 $< $@
34-
35-
filesystem/gfx/maps/%.sprite: resources/gfx/maps/%.png
36-
@mkdir -p `echo $@ | xargs dirname`
37-
$(MKSPRITE) 16 1 1 $< $@
37+
$(N64_MKSPRITE) 16 1 1 $< $@
3838

3939
# sfx #
4040
MP3S := $(wildcard resources/sfx/bgms/*.mp3)
@@ -44,43 +44,42 @@ filesystem/sfx/bgms/%.raw: resources/sfx/bgms/%.mp3
4444
sox $< -b 16 -e signed-integer -B -r 11025 $@ remix -
4545

4646
# code #
47-
SRCS := $(wildcard src/*.c)
48-
OBJS := $(SRCS:.c=.o)
49-
$(PROG_NAME).elf : $(OBJS)
50-
$(LD) -o $@ $^ $(LINK_FLAGS)
47+
SRCS := $(wildcard $(SOURCE_DIR)/*.c)
48+
OBJS := $(SRCS:$(SOURCE_DIR)/%.c=$(BUILD_DIR)/%.o)
49+
50+
$(BUILD_DIR)/$(ROM_NAME).elf: $(OBJS) $(N64_LIBDIR)/libdragon.a $(N64_LIBDIR)/libdragonsys.a $(N64_LIBDIR)/n64.ld
51+
@mkdir -p $(dir $@)
52+
@echo " [LD] $@"
53+
$(N64_CXX) -o $@ $(filter %.o, $^) $(filter-out $(N64_LIBDIR)/libdragon.a $(N64_LIBDIR)/libdragonsys.a, $(filter %.a, $^)) \
54+
-lc -mabi=o64 $(patsubst %,-Wl$(COMMA)%,$(LDFLAGS)) -Wl,-Map=$(BUILD_DIR)/$(ROM_NAME).map
55+
$(N64_SIZE) -G $@
5156

52-
$(PROG_NAME).bin : $(PROG_NAME).elf
53-
$(OBJCOPY) -O binary $< $@
57+
$(ROM_NAME).z64: $(BUILD_DIR)/$(ROM_NAME).elf
58+
$(ROM_NAME).z64: $(ROM_NAME).dfs
5459

5560
# dfs #
56-
$(PROG_NAME).dfs: $(SPRITES) $(BGMS)
61+
$(ROM_NAME).dfs: $(SPRITES) $(BGMS)
5762
@mkdir -p ./filesystem/
5863
@echo `git rev-parse HEAD` > ./filesystem/hash
59-
$(MKDFSPATH) $@ ./filesystem/
60-
61-
# rom
62-
$(PROG_NAME).z64: $(PROG_NAME).bin $(PROG_NAME).dfs
63-
@rm -f $@
64-
$(N64TOOL) -l 16M -t "$(PROG_NAME)" -h $(ROOTDIR)/mips64-elf/lib/header -o $(PROG_NAME).z64 $(PROG_NAME).bin -s 1M $(PROG_NAME).dfs
65-
$(CHKSUM64PATH) $@
64+
$(N64_MKDFS) $@ ./filesystem/ >/dev/null
6665

6766
setup: ## Create dev environment (docker image).
68-
@docker build -q -t build - < Dockerfile > /dev/null
67+
@docker build --platform linux/amd64 -t build - < Dockerfile
6968

7069
resetup: ## Force recreate the dev environment (docker image).
7170
@echo "Rebuilding dev environment in docker..."
72-
@docker build -q -t build --no-cache - < Dockerfile > /dev/null
71+
@docker build --platform linux/amd64 -t build --no-cache - < Dockerfile
7372

74-
cen64: ## Start rom in CEN64 emulator.
75-
@echo "Starting cen64..."
76-
$(CEN64_DIR)/cen64 -multithread -controller num=1,pak=rumble $(CEN64_DIR)/pifdata.bin $(PROG_NAME).z64
73+
ares: ## Start rom in Ares emulator.
74+
@echo "Starting ares..."
75+
$(ARES_BIN) $(ROM_NAME).z64
7776

7877
flashair: ## Flash rom to EverDrive using a flashair SD card.
79-
curl -X POST -F 'file=@$(PROG_NAME).z64' http://flashair/upload.cgi
78+
curl -X POST -F 'file=@$(ROM_NAME).z64' http://flashair/upload.cgi
8079

8180
clean: ## Cleanup temp files.
8281
@echo "Cleaning up temp files..."
83-
rm -rf *.z64 *.elf src/*.o *.bin *.dfs filesystem/
82+
rm -rf $(BUILD_DIR) *.z64 *.elf src/*.o *.bin *.dfs filesystem/
8483

8584
help: ## Show this help.
8685
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/:.*##/:/'

include/bgm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* bgm.h -- bgm helpers header
22
*
3-
* Copyright (C) 2018 Victor Vieux
3+
* Copyright (C) 2018-2025 Victor Vieux
44
*
55
* This software may be modified and distributed under the terms
66
* of the Apache license. See the LICENSE file for details.

include/colors.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* colors.h -- colors helpers header
22
*
3-
* Copyright (C) 2018 Victor Vieux
3+
* Copyright (C) 2018-2025 Victor Vieux
44
*
55
* This software may be modified and distributed under the terms
66
* of the Apache license. See the LICENSE file for details.

include/controls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* controls.h -- controls helpers header
22
*
3-
* Copyright (C) 2018 Victor Vieux
3+
* Copyright (C) 2018-2025 Victor Vieux
44
*
55
* This software may be modified and distributed under the terms
66
* of the Apache license. See the LICENSE file for details.

include/debug.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

include/dfs.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

include/fps.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* fps.h -- fps helpers header
22
*
3-
* Copyright (C) 2018 Victor Vieux
3+
* Copyright (C) 2018-2025 Victor Vieux
44
*
55
* This software may be modified and distributed under the terms
66
* of the Apache license. See the LICENSE file for details.

0 commit comments

Comments
 (0)