Skip to content

Commit

Permalink
Reduce executable size for DS when extnrom support is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ccawley2011 committed May 26, 2024
1 parent 6653d77 commit 285ac51
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ LD=$(CC)
ARM9_ARCH = -mthumb -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS += $(ARM9_ARCH) -ffunction-sections -fdata-sections -DSYSTEM_nds -DARM9 -DUSE_FAKEMAIN -DNO_OPEN64 -isystem $(DEVKITPRO)/libnds/include -Wno-cast-align -Wno-format
LDFLAGS += -specs=ds_arm9.specs -g $(ARM9_ARCH) -Wl,--gc-sections -L$(DEVKITPRO)/libnds/lib
LIBS += -lfilesystem -lfat -lnds9
ifeq (${EXTNROM_SUPPORT},yes)
LIBS += -lfilesystem
endif
LIBS += -lfat -lnds9
OBJS += nds/main.o nds/img/bg.o nds/img/keys.o
ifneq ($(DEBUG),yes)
CFLAGS += -DNDEBUG
Expand All @@ -197,9 +200,13 @@ TARGET = ArcEm.elf
all: ArcEm.nds

%.nds: %.elf %.arm7.elf nds/arc.bmp
ifeq (${EXTNROM_SUPPORT},yes)
mkdir -p romfs/extnrom
cp support_modules/*/*,ffa romfs/extnrom
ndstool -c $@ -9 $< -7 $*.arm7.elf -b nds/arc.bmp "ArcEm;Archimedes Emulator;WIP" -d romfs
else
ndstool -c $@ -9 $< -7 $*.arm7.elf -b nds/arc.bmp "ArcEm;Archimedes Emulator;WIP"
endif

%.s %.h: %.png %.grit
grit $< -fts -o$*
Expand Down
10 changes: 10 additions & 0 deletions nds/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,26 @@
#include "../arch/ControlPane.h"

#include <nds.h>
#if defined(EXTNROM_SUPPORT)
#include <filesystem.h>
#else
#include <fat.h>
#endif

static ArcemConfig hArcemConfig;

int main(int argc,char *argv[]) {
Prof_Init();

#if defined(EXTNROM_SUPPORT)
if (!nitroFSInit(NULL)) {
ControlPane_Error(EXIT_FAILURE, "Failed to initialise filesystem");
}
#else
if (!fatInitDefault()) {
ControlPane_Error(EXIT_FAILURE, "Failed to initialise filesystem");
}
#endif

// Setup the default values for the config system
ArcemConfig_SetupDefaults(&hArcemConfig);
Expand Down

0 comments on commit 285ac51

Please sign in to comment.