Skip to content

Commit b4c89c9

Browse files
committed
Fix cia/3dsx not working
1 parent 959b27e commit b4c89c9

File tree

17 files changed

+153
-412
lines changed

17 files changed

+153
-412
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "buildtools"]
2+
path = buildtools
3+
url = https://github.com/Steveice10/buildtools.git

Makefile

Lines changed: 141 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -1,204 +1,157 @@
1-
#---------------------------------------------------------------------------------
2-
.SUFFIXES:
3-
#---------------------------------------------------------------------------------
1+
# This Makefile is an edited version of the file found here:
42

5-
ifeq ($(strip $(DEVKITARM)),)
6-
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
7-
endif
3+
# https://github.com/Steveice10/FBI and has been released under MIT Licence as
84

9-
TOPDIR ?= $(CURDIR)
10-
include $(DEVKITARM)/3ds_rules
5+
# follows:
116

12-
#---------------------------------------------------------------------------------
13-
# TARGET is the name of the output
14-
# BUILD is the directory where object files & intermediate files will be placed
15-
# SOURCES is a list of directories containing source code
16-
# DATA is a list of directories containing data files
17-
# INCLUDES is a list of directories containing header files
187
#
19-
# NO_SMDH: if set to anything, no SMDH file is generated.
20-
# ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional)
21-
# APP_TITLE is the name of the app stored in the SMDH file (Optional)
22-
# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
23-
# APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
24-
# ICON is the filename of the icon (.png), relative to the project folder.
25-
# If not set, it attempts to use one of the following (in this order):
26-
# - <Project name>.png
27-
# - icon.png
28-
# - <libctru folder>/default_icon.png
29-
#---------------------------------------------------------------------------------
30-
TARGET := $(notdir $(CURDIR))
31-
BUILD := build
32-
SOURCES := source
33-
DATA := data
34-
INCLUDES := include
35-
APP_TITLE := Mk7se
36-
APP_DESCRIPTION := Mario Kart 7 save editor
37-
APP_AUTHOR := Kartik
38-
#ROMFS := romfs
39-
40-
#---------------------------------------------------------------------------------
41-
# options for code generation
42-
#---------------------------------------------------------------------------------
43-
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
44-
45-
CFLAGS := -g -Wall -O2 -mword-relocations \
46-
-fomit-frame-pointer -ffunction-sections \
47-
$(ARCH)
48-
49-
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
50-
51-
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
52-
53-
ASFLAGS := -g $(ARCH)
54-
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
55-
56-
LIBS := -lsftd -lfreetype -lpng -lz -lsf2d -lcitro3d -lctru -lm
57-
58-
#---------------------------------------------------------------------------------
59-
# list of directories containing libraries, this must be the top level containing
60-
# include and lib
61-
#---------------------------------------------------------------------------------
62-
LIBDIRS := $(CTRULIB)
63-
64-
65-
#---------------------------------------------------------------------------------
66-
# no real need to edit anything past this point unless you need to add additional
67-
# rules for different file extensions
68-
#---------------------------------------------------------------------------------
69-
ifneq ($(BUILD),$(notdir $(CURDIR)))
70-
#---------------------------------------------------------------------------------
71-
72-
export OUTPUT := $(CURDIR)/$(TARGET)
73-
export TOPDIR := $(CURDIR)
74-
75-
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
76-
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
77-
78-
export DEPSDIR := $(CURDIR)/$(BUILD)
79-
80-
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
81-
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
82-
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
83-
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica)))
84-
SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist)))
85-
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
86-
87-
#---------------------------------------------------------------------------------
88-
# use CXX for linking C++ projects, CC for standard C
89-
#---------------------------------------------------------------------------------
90-
ifeq ($(strip $(CPPFILES)),)
91-
#---------------------------------------------------------------------------------
92-
export LD := $(CC)
93-
#---------------------------------------------------------------------------------
94-
else
95-
#---------------------------------------------------------------------------------
96-
export LD := $(CXX)
97-
#---------------------------------------------------------------------------------
98-
endif
99-
#---------------------------------------------------------------------------------
100-
101-
export OFILES := $(addsuffix .o,$(BINFILES)) \
102-
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \
103-
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
104-
105-
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
106-
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
107-
-I$(CURDIR)/$(BUILD)
108-
109-
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
110-
111-
ifeq ($(strip $(ICON)),)
112-
icons := $(wildcard *.png)
113-
ifneq (,$(findstring $(TARGET).png,$(icons)))
114-
export APP_ICON := $(TOPDIR)/$(TARGET).png
115-
else
116-
ifneq (,$(findstring icon.png,$(icons)))
117-
export APP_ICON := $(TOPDIR)/icon.png
118-
endif
119-
endif
120-
else
121-
export APP_ICON := $(TOPDIR)/$(ICON)
122-
endif
1238

124-
ifeq ($(strip $(NO_SMDH)),)
125-
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
126-
endif
9+
# Copyright © 2015 Steveice10
12710

128-
ifneq ($(ROMFS),)
129-
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
130-
endif
11+
#
13112

132-
.PHONY: $(BUILD) clean all
13+
# Permission is hereby granted, free of charge, to any person obtaining a copy
13314

134-
#---------------------------------------------------------------------------------
135-
all: $(BUILD)
15+
# of this software and associated documentation files (the "Software"), to deal
13616

137-
$(BUILD):
138-
@[ -d $@ ] || mkdir -p $@
139-
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
17+
# in the Software without restriction, including without limitation the rights
14018

141-
#---------------------------------------------------------------------------------
142-
clean:
143-
@echo clean ...
144-
@rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
19+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14520

21+
# copies of the Software, and to permit persons to whom the Software is
14622

147-
#---------------------------------------------------------------------------------
148-
else
23+
# furnished to do so, subject to the following conditions:
14924

150-
DEPENDS := $(OFILES:.o=.d)
25+
#
26+
27+
# The above copyright notice and this permission notice shall be included in
28+
29+
# all copies or substantial portions of the Software.
30+
31+
#
32+
33+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34+
35+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36+
37+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38+
39+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40+
41+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42+
43+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44+
45+
# SOFTWARE.
46+
47+
48+
49+
# TARGET #
15150

152-
#---------------------------------------------------------------------------------
153-
# main targets
154-
#---------------------------------------------------------------------------------
155-
ifeq ($(strip $(NO_SMDH)),)
156-
$(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
157-
else
158-
$(OUTPUT).3dsx : $(OUTPUT).elf
159-
endif
16051

161-
$(OUTPUT).elf : $(OFILES)
162-
163-
#---------------------------------------------------------------------------------
164-
# you need a rule like this for each extension you use as binary data
165-
#---------------------------------------------------------------------------------
166-
%.bin.o : %.bin
167-
#---------------------------------------------------------------------------------
168-
@echo $(notdir $<)
169-
@$(bin2o)
170-
171-
#---------------------------------------------------------------------------------
172-
%.ttf.o : %.ttf
173-
#---------------------------------------------------------------------------------
174-
@echo $(notdir $<)
175-
@$(bin2o)
176-
#---------------------------------------------------------------------------------
177-
# rules for assembling GPU shaders
178-
#---------------------------------------------------------------------------------
179-
define shader-as
180-
$(eval CURBIN := $(patsubst %.shbin.o,%.shbin,$(notdir $@)))
181-
picasso -o $(CURBIN) $1
182-
bin2s $(CURBIN) | $(AS) -o $@
183-
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h
184-
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h
185-
echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h
186-
endef
187-
188-
%.shbin.o : %.v.pica %.g.pica
189-
@echo $(notdir $^)
190-
@$(call shader-as,$^)
191-
192-
%.shbin.o : %.v.pica
193-
@echo $(notdir $<)
194-
@$(call shader-as,$<)
195-
196-
%.shbin.o : %.shlist
197-
@echo $(notdir $<)
198-
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file)))
199-
200-
-include $(DEPENDS)
201-
202-
#---------------------------------------------------------------------------------------
52+
53+
TARGET := 3DS
54+
55+
LIBRARY := 0
56+
57+
58+
59+
ifeq ($(TARGET),3DS)
60+
61+
ifeq ($(strip $(DEVKITPRO)),)
62+
63+
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
64+
65+
endif
66+
67+
68+
69+
ifeq ($(strip $(DEVKITARM)),)
70+
71+
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
72+
73+
endif
74+
20375
endif
204-
#---------------------------------------------------------------------------------------
76+
77+
78+
79+
# COMMON CONFIGURATION #
80+
81+
82+
83+
NAME := MK7SE
84+
85+
86+
87+
BUILD_DIR := build
88+
89+
OUTPUT_DIR := output
90+
91+
INCLUDE_DIRS := source/include
92+
93+
SOURCE_DIRS := source
94+
95+
96+
97+
EXTRA_OUTPUT_FILES :=
98+
99+
100+
101+
LIBRARY_DIRS := $(DEVKITPRO)/libctru
102+
103+
LIBRARIES := sftd freetype png z sf2d citro3d ctru m
104+
105+
106+
107+
BUILD_FLAGS := -Wall -Wextra
108+
109+
RUN_FLAGS :=
110+
111+
VERSION_MAJOR := 3
112+
113+
VERSION_MINOR := 2
114+
115+
VERSION_MICRO := 0
116+
117+
118+
119+
# 3DS CONFIGURATION #
120+
121+
122+
123+
TITLE := $(NAME)
124+
125+
DESCRIPTION := Mario Kart 7 Save Editor
126+
127+
AUTHOR := Kartik
128+
129+
PRODUCT_CODE := CTR-E-SE
130+
131+
UNIQUE_ID := 0x1035
132+
133+
CATEGORY := Application
134+
135+
USE_ON_SD := true
136+
137+
MEMORY_TYPE := Application
138+
139+
SYSTEM_MODE := 64MB
140+
141+
SYSTEM_MODE_EXT := Legacy
142+
143+
CPU_SPEED := 268MHz
144+
145+
ENABLE_L2_CACHE := true
146+
147+
BANNER_AUDIO := resources/audio.wav
148+
149+
BANNER_IMAGE := resources/banner.png
150+
151+
ICON := resources/icon.png
152+
153+
154+
155+
# INTERNAL #
156+
157+
include buildtools/make_base

0 commit comments

Comments
 (0)