added NitroFS support (#14)

This commit is contained in:
NotImplementedLife 2024-07-31 18:01:49 +03:00
parent 1558a81899
commit 77909be2ed
9 changed files with 41 additions and 6 deletions

3
.gitignore vendored
View File

@ -10,4 +10,5 @@ FSPDS.layout
*.nds
run.bat
arm9/source/build_counter.c
*.pdn
*.pdn
*.ppm

View File

@ -12,6 +12,8 @@ export GAME_ICON := $(CURDIR)/icon.bmp
export TARGET := FSPDS
export NDS_FILE := $(TARGET)
NITRO := nitrofs
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
@ -33,6 +35,7 @@ TARGET_BUILD_VERSION := ${shell python build_counter.py}
all: $(TARGET).nds
#---------------------------------------------------------------------------------
ifneq ($(strip $(NITRO)),)
$(TARGET).nds : arm7/$(TARGET).elf arm9/$(TARGET).elf $(NITRO_FILES)
@ndstool -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf -b $(GAME_ICON) "$(GAME_TITLE)" -d $(NITRO_FILES) -c $(TARGET).nds

View File

@ -8,6 +8,18 @@ endif
include $(DEVKITARM)/ds_rules
MAKEFILE_PATH:=$(realpath $(shell dirname $(firstword $(MAKEFILE_LIST))))
$(info MAKEFILE_PATH=$(MAKEFILE_PATH))
# Read value of NTFS attribute in ../config.ini (default 0)
USE_NTFS := ${shell grep -E "^NTFS\s*\=\s*.*\s*$$" $(MAKEFILE_PATH)/../config.ini | sed -E "s/^NTFS\s*\=\s*(.*)\s*$$/\1/" | grep . || echo "0"}
$(info Build Configuration)
$(info NTFS Enabled = $(USE_NTFS))
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
@ -25,7 +37,17 @@ DATA := data
# specify a directory which contains the nitro filesystem
# this is relative to the Makefile
NITRO :=
ifeq ($(USE_NTFS), 1)
$(info NTFS)
NITRO := nitrofs
else
$(info NO_NTFS)
NITRO :=
endif
# $(error x)
#---------------------------------------------------------------------------------
# options for code generation
@ -33,7 +55,7 @@ NITRO :=
ARCH := -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s
CFLAGS := -g -Wall -O3\
$(ARCH) $(INCLUDE) -DARM9
$(ARCH) $(INCLUDE) -DARM9 -DUSE_NTFS=$(USE_NTFS)
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=ds_arm9.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)

Binary file not shown.

1
arm9/nitrofs/empty Normal file
View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1 @@
.

View File

@ -1,13 +1,19 @@
#include "scenes.hpp"
#include <fat.h>
#include <filesystem.h>
#include "globals.hpp"
using namespace DSC;
void DSC::init_main_scene()
{
set_fat_inited(fatInitDefault());
DSC::Debug::log("NITRO = %i\n", USE_NTFS);
#if USE_NTFS==1
set_fat_inited(nitroFSInit(NULL));
#else
set_fat_inited(fatInitDefault());
#endif
DSC::__MAIN_SCENE__= gen_title_scene();
}

1
config.ini Normal file
View File

@ -0,0 +1 @@
NTFS = 1

View File

@ -1,3 +1,3 @@
BUILD_TYPE = 'R'
BUILD_TYPE = 'D'
MAJOR = 1
MINOR = 0
MINOR = 1