mirror of
https://github.com/DarkStore-3DS/buildtools.git
synced 2026-07-04 00:39:24 +00:00
Initial commit.
This commit is contained in:
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,218 @@
|
||||
BasicInfo:
|
||||
Title : $(APP_TITLE)
|
||||
ProductCode : $(APP_PRODUCT_CODE)
|
||||
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
|
||||
|
||||
RomFs:
|
||||
$(APP_ROMFS)
|
||||
|
||||
TitleInfo:
|
||||
Category : Application
|
||||
UniqueId : $(APP_UNIQUE_ID)
|
||||
|
||||
Option:
|
||||
UseOnSD : true # true if App is to be installed to SD
|
||||
FreeProductCode : true # Removes limitations on ProductCode
|
||||
MediaFootPadding : false # If true CCI files are created with padding
|
||||
EnableCrypt : $(APP_ENCRYPTED) # Enables encryption for NCCH and CIA
|
||||
EnableCompress : true # Compresses where applicable (currently only exefs:/.code)
|
||||
|
||||
AccessControlInfo:
|
||||
CoreVersion : 2
|
||||
|
||||
# Exheader Format Version
|
||||
DescVersion : 2
|
||||
|
||||
# Minimum Required Kernel Version (below is for 4.5.0)
|
||||
ReleaseKernelMajor : "02"
|
||||
ReleaseKernelMinor : "33"
|
||||
|
||||
# ExtData
|
||||
UseExtSaveData : false # enables ExtData
|
||||
#ExtSaveDataId : 0x300 # only set this when the ID is different to the UniqueId
|
||||
|
||||
# FS:USER Archive Access Permissions
|
||||
# Uncomment as required
|
||||
FileSystemAccess:
|
||||
#- CategorySystemApplication
|
||||
#- CategoryHardwareCheck
|
||||
- CategoryFileSystemTool
|
||||
#- Debug
|
||||
#- TwlCardBackup
|
||||
#- TwlNandData
|
||||
#- Boss
|
||||
- DirectSdmc
|
||||
#- Core
|
||||
#- CtrNandRo
|
||||
#- CtrNandRw
|
||||
#- CtrNandRoWrite
|
||||
#- CategorySystemSettings
|
||||
#- CardBoard
|
||||
#- ExportImportIvs
|
||||
#- DirectSdmcWrite
|
||||
#- SwitchCleanup
|
||||
#- SaveDataMove
|
||||
#- Shop
|
||||
#- Shell
|
||||
#- CategoryHomeMenu
|
||||
|
||||
# Process Settings
|
||||
MemoryType : Application # Application/System/Base
|
||||
SystemMode : $(APP_SYSTEM_MODE) # 64MB(Default)/96MB/80MB/72MB/32MB
|
||||
IdealProcessor : 0
|
||||
AffinityMask : 1
|
||||
Priority : 16
|
||||
MaxCpu : 0x9E # Default
|
||||
HandleTableSize : 0x200
|
||||
DisableDebug : false
|
||||
EnableForceDebug : false
|
||||
CanWriteSharedPage : true
|
||||
CanUsePrivilegedPriority : false
|
||||
CanUseNonAlphabetAndNumber : true
|
||||
PermitMainFunctionArgument : true
|
||||
CanShareDeviceMemory : true
|
||||
RunnableOnSleep : false
|
||||
SpecialMemoryArrange : true
|
||||
|
||||
# New3DS Exclusive Process Settings
|
||||
SystemModeExt : $(APP_SYSTEM_MODE_EXT) # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode
|
||||
CpuSpeed : 804MHz # 256MHz(Default)/804MHz
|
||||
EnableL2Cache : true # false(default)/true
|
||||
CanAccessCore2 : true
|
||||
|
||||
# Virtual Address Mappings
|
||||
IORegisterMapping:
|
||||
- 1ff00000-1ff7ffff # DSP memory
|
||||
MemoryMapping:
|
||||
- 1f000000-1f5fffff:r # VRAM
|
||||
|
||||
# Accessible SVCs, <Name>:<ID>
|
||||
SystemCallAccess:
|
||||
ArbitrateAddress: 34
|
||||
Backdoor: 123
|
||||
Break: 60
|
||||
CancelTimer: 28
|
||||
ClearEvent: 25
|
||||
ClearTimer: 29
|
||||
CloseHandle: 35
|
||||
ConnectToPort: 45
|
||||
ControlMemory: 1
|
||||
ControlProcessMemory: 112
|
||||
CreateAddressArbiter: 33
|
||||
CreateEvent: 23
|
||||
CreateMemoryBlock: 30
|
||||
CreateMutex: 19
|
||||
CreateSemaphore: 21
|
||||
CreateThread: 8
|
||||
CreateTimer: 26
|
||||
DuplicateHandle: 39
|
||||
ExitProcess: 3
|
||||
ExitThread: 9
|
||||
GetCurrentProcessorNumber: 17
|
||||
GetHandleInfo: 41
|
||||
GetProcessId: 53
|
||||
GetProcessIdOfThread: 54
|
||||
GetProcessIdealProcessor: 6
|
||||
GetProcessInfo: 43
|
||||
GetResourceLimit: 56
|
||||
GetResourceLimitCurrentValues: 58
|
||||
GetResourceLimitLimitValues: 57
|
||||
GetSystemInfo: 42
|
||||
GetSystemTick: 40
|
||||
GetThreadContext: 59
|
||||
GetThreadId: 55
|
||||
GetThreadIdealProcessor: 15
|
||||
GetThreadInfo: 44
|
||||
GetThreadPriority: 11
|
||||
MapMemoryBlock: 31
|
||||
OutputDebugString: 61
|
||||
QueryMemory: 2
|
||||
ReleaseMutex: 20
|
||||
ReleaseSemaphore: 22
|
||||
SendSyncRequest1: 46
|
||||
SendSyncRequest2: 47
|
||||
SendSyncRequest3: 48
|
||||
SendSyncRequest4: 49
|
||||
SendSyncRequest: 50
|
||||
SetThreadPriority: 12
|
||||
SetTimer: 27
|
||||
SignalEvent: 24
|
||||
SleepThread: 10
|
||||
UnmapMemoryBlock: 32
|
||||
WaitSynchronization1: 36
|
||||
WaitSynchronizationN: 37
|
||||
|
||||
# Service List
|
||||
# Maximum 34 services (32 if firmware is prior to 9.6.0)
|
||||
ServiceAccessControl:
|
||||
- APT:U
|
||||
- ac:u
|
||||
- am:net
|
||||
- boss:U
|
||||
- cam:u
|
||||
- cecd:u
|
||||
- cfg:nor
|
||||
- cfg:u
|
||||
- csnd:SND
|
||||
- dsp::DSP
|
||||
- frd:u
|
||||
- fs:USER
|
||||
- gsp::Gpu
|
||||
- hid:USER
|
||||
- http:C
|
||||
- ir:rst
|
||||
- ir:u
|
||||
- ir:USER
|
||||
- mic:u
|
||||
- ndm:u
|
||||
- news:u
|
||||
- nwm::UDS
|
||||
- ptm:u
|
||||
- pxi:dev
|
||||
- soc:U
|
||||
- ssl:C
|
||||
- y2r:u
|
||||
|
||||
|
||||
SystemControlInfo:
|
||||
SaveDataSize: 0KB # Change if the app uses savedata
|
||||
RemasterVersion: 2
|
||||
StackSize: 0x40000
|
||||
|
||||
# Modules that run services listed above should be included below
|
||||
# Maximum 48 dependencies
|
||||
# <module name>:<module titleid>
|
||||
Dependency:
|
||||
ac: 0x0004013000002402
|
||||
#act: 0x0004013000003802
|
||||
am: 0x0004013000001502
|
||||
boss: 0x0004013000003402
|
||||
camera: 0x0004013000001602
|
||||
cecd: 0x0004013000002602
|
||||
cfg: 0x0004013000001702
|
||||
codec: 0x0004013000001802
|
||||
csnd: 0x0004013000002702
|
||||
dlp: 0x0004013000002802
|
||||
dsp: 0x0004013000001a02
|
||||
friends: 0x0004013000003202
|
||||
gpio: 0x0004013000001b02
|
||||
gsp: 0x0004013000001c02
|
||||
hid: 0x0004013000001d02
|
||||
http: 0x0004013000002902
|
||||
i2c: 0x0004013000001e02
|
||||
ir: 0x0004013000003302
|
||||
mcu: 0x0004013000001f02
|
||||
mic: 0x0004013000002002
|
||||
ndm: 0x0004013000002b02
|
||||
news: 0x0004013000003502
|
||||
#nfc: 0x0004013000004002
|
||||
nim: 0x0004013000002c02
|
||||
nwm: 0x0004013000002d02
|
||||
pdn: 0x0004013000002102
|
||||
ps: 0x0004013000003102
|
||||
ptm: 0x0004013000002202
|
||||
#qtm: 0x0004013020004202
|
||||
ro: 0x0004013000003702
|
||||
socket: 0x0004013000002e02
|
||||
spi: 0x0004013000002302
|
||||
ssl: 0x0004013000002f02
|
||||
@@ -0,0 +1,237 @@
|
||||
ifeq ($(TARGET),3DS)
|
||||
ifeq ($(strip $(DEVKITPRO)),)
|
||||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(DEVKITARM)),)
|
||||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
|
||||
endif
|
||||
endif
|
||||
|
||||
# TOOLS #
|
||||
|
||||
BUILDTOOLS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
define createdirrule
|
||||
$(1): | $(dir $(1))
|
||||
|
||||
ifndef $(dir $(1))_DIRECTORY_RULE_IS_DEFINED
|
||||
$(dir $(1)):
|
||||
@mkdir -p $$@
|
||||
|
||||
$(dir $(1))_DIRECTORY_RULE_IS_DEFINED := 1
|
||||
endif
|
||||
endef
|
||||
|
||||
rwildcard=$(wildcard $1/$2) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2))
|
||||
|
||||
# SETUP #
|
||||
|
||||
OBJECT_FILES := $(foreach dir,$(SOURCE_DIRS), \
|
||||
$(patsubst %.c,$(BUILD_DIR)/%.o,$(call rwildcard,$(dir),*.c)) \
|
||||
$(patsubst %.cpp,$(BUILD_DIR)/%.o,$(call rwildcard,$(dir),*.cpp)) \
|
||||
$(patsubst %.s,$(BUILD_DIR)/%.o,$(call rwildcard,$(dir),*.s)) \
|
||||
$(patsubst %.bin,$(BUILD_DIR)/%.bin.o,$(call rwildcard,$(dir),*.bin)) \
|
||||
$(patsubst %.v.pica,$(BUILD_DIR)/%.shbin.o,$(call rwildcard,$(dir),*.v.pica)) \
|
||||
$(patsubst %.shlist,$(BUILD_DIR)/%.shbin.o,$(call rwildcard,$(dir),*.shlist)) \
|
||||
)
|
||||
|
||||
OUTPUT_ZIP_FILE := $(OUTPUT_DIR)/$(NAME).zip
|
||||
ifeq ($(LIBRARY),1)
|
||||
OUTPUT_FILES := $(OUTPUT_DIR)/lib$(NAME).a $(OUTPUT_DIR)/lib$(NAME).so
|
||||
else ifeq ($(TARGET),3DS)
|
||||
OUTPUT_FILES := $(OUTPUT_DIR)/$(NAME).elf $(OUTPUT_DIR)/3ds/$(NAME)/$(NAME).smdh $(OUTPUT_DIR)/3ds/$(NAME)/$(NAME).3dsx $(OUTPUT_DIR)/$(NAME).3ds $(OUTPUT_DIR)/$(NAME).cia
|
||||
else
|
||||
OUTPUT_FILES := $(OUTPUT_DIR)/$(NAME)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),3DS)
|
||||
AR := $(DEVKITARM)/bin/arm-none-eabi-ar
|
||||
AS := $(DEVKITARM)/bin/arm-none-eabi-as
|
||||
CC := $(DEVKITARM)/bin/arm-none-eabi-gcc
|
||||
CXX := $(DEVKITARM)/bin/arm-none-eabi-g++
|
||||
else
|
||||
AR := ar
|
||||
AS := as
|
||||
CC := gcc
|
||||
CXX := g++
|
||||
endif
|
||||
|
||||
LD_FLAGS := $(patsubst %,-L%/lib,$(LIBRARY_DIRS)) $(patsubst %,-l%,$(LIBRARIES))
|
||||
COMMON_CC_FLAGS := $(patsubst %,-I%,$(INCLUDE_DIRS)) $(patsubst %,-I%/include,$(LIBRARY_DIRS)) -g -Wall -O2 $(BUILD_FLAGS)
|
||||
ifeq ($(LIBRARY),1)
|
||||
COMMON_CC_FLAGS += -fPIC
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),3DS)
|
||||
COMMON_CC_FLAGS += -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -DARM11 -D_3DS
|
||||
LD_FLAGS += -specs=3dsx.specs
|
||||
endif
|
||||
|
||||
CC_FLAGS := $(COMMON_CC_FLAGS) -std=gnu99
|
||||
CXX_FLAGS := $(COMMON_CC_FLAGS) -std=gnu++11
|
||||
|
||||
ifeq ($(TARGET),3DS)
|
||||
ifeq ($(suffix $(BANNER_IMAGE)),".cgfx")
|
||||
BANNER_IMAGE_ARG := -ci
|
||||
else
|
||||
BANNER_IMAGE_ARG := -i
|
||||
endif
|
||||
|
||||
ifeq ($(suffix $(BANNER_AUDIO)),".cwav")
|
||||
BANNER_AUDIO_ARG := -ca
|
||||
else
|
||||
BANNER_AUDIO_ARG := -a
|
||||
endif
|
||||
|
||||
RSF := $(BUILDTOOLS_DIR)/3ds/template.rsf
|
||||
|
||||
ROMFS_PARAM :=
|
||||
ifneq ("$(wildcard $(ROMFS_DIR))","")
|
||||
ROMFS_PARAM := -DAPP_ROMFS="RootPath: $(ROMFS_DIR)"
|
||||
endif
|
||||
|
||||
COMMON_MAKEROM_PARAMS := -rsf $(RSF) -target t -exefslogo -icon $(BUILD_DIR)/icon.icn -banner $(BUILD_DIR)/banner.bnr -DAPP_TITLE="$(NAME)" -DAPP_PRODUCT_CODE="$(PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(UNIQUE_ID)" $(ROMFS_PARAM) -DAPP_SYSTEM_MODE="$(SYSTEM_MODE)" -DAPP_SYSTEM_MODE_EXT="$(SYSTEM_MODE_EXT)"
|
||||
|
||||
SMDHTOOL := $(DEVKITARM)/bin/smdhtool
|
||||
_3DSXTOOL := $(DEVKITARM)/bin/3dsxtool
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
MAKEROM := $(BUILDTOOLS_DIR)/3ds/makerom.exe
|
||||
BANNERTOOL := $(BUILDTOOLS_DIR)/3ds/bannertool.exe
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
MAKEROM := $(BUILDTOOLS_DIR)/3ds/makerom-linux
|
||||
BANNERTOOL := $(BUILDTOOLS_DIR)/3ds/bannertool-linux
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
MAKEROM := $(BUILDTOOLS_DIR)/3ds/makerom-mac
|
||||
BANNERTOOL := $(BUILDTOOLS_DIR)/3ds/bannertool-mac
|
||||
endif
|
||||
endif
|
||||
|
||||
_3DSXFLAGS :=
|
||||
ifneq ("$(wildcard $(ROMFS_DIR))","")
|
||||
_3DSXFLAGS += --romfs=$(ROMFS_DIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
# RULES #
|
||||
|
||||
.PHONY: all run clean
|
||||
.PRECIOUS: %.bnr %.icn
|
||||
|
||||
all: $(OUTPUT_ZIP_FILE)
|
||||
|
||||
ifneq ($(LIBRARY),1)
|
||||
run: $(OUTPUT_FILES)
|
||||
./$< $(RUN_FLAGS)
|
||||
endif
|
||||
|
||||
clean:
|
||||
@rm -rf $(BUILD_DIR) $(OUTPUT_DIR)
|
||||
@echo "Cleaned."
|
||||
|
||||
$(foreach file,$(OBJECT_FILES),$(eval $(call createdirrule,$(file))))
|
||||
$(foreach file,$(OUTPUT_FILES),$(eval $(call createdirrule,$(file))))
|
||||
|
||||
$(OUTPUT_ZIP_FILE): $(OUTPUT_FILES)
|
||||
@echo $@
|
||||
@cd $(OUTPUT_DIR); \
|
||||
zip -r $(patsubst $(OUTPUT_DIR)/%,%,$@ $^) > /dev/null
|
||||
|
||||
$(OUTPUT_DIR)/$(NAME): $(OBJECT_FILES)
|
||||
@echo $@
|
||||
@$(CXX) $(CXX_FLAGS) $^ -o $@ $(LD_FLAGS)
|
||||
|
||||
%.elf: $(OBJECT_FILES)
|
||||
@echo $@
|
||||
@$(CXX) $(CXX_FLAGS) $^ -o $@ $(LD_FLAGS)
|
||||
|
||||
%.a: $(OBJECT_FILES)
|
||||
@echo $@
|
||||
@$(AR) -rc $@ $^
|
||||
|
||||
%.so: $(OBJECT_FILES)
|
||||
@echo $@
|
||||
@$(CXX) $(CXX_FLAGS) -shared $^ -o $@ $(LD_FLAGS)
|
||||
|
||||
$(BUILD_DIR)/%.o: %.c
|
||||
@echo $@
|
||||
@$(CC) -c $(CC_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.cpp
|
||||
@echo $@
|
||||
@$(CXX) -c $(CXX_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.s
|
||||
@echo $@
|
||||
@$(CC) -c $(CC_FLAGS) -MMD -MP -MF -x assembler-with-cpp $(BUILD_DIR)/$*.d $< -o $@
|
||||
|
||||
$(BUILD_DIR)/%.o: %.S
|
||||
@echo $@
|
||||
@$(CC) -c $(CC_FLAGS) -MMD -MP -MF -x assembler-with-cpp $(BUILD_DIR)/$*.d $< -o $@
|
||||
|
||||
ifeq ($(TARGET),3DS)
|
||||
define bin2o
|
||||
bin2s $< | $(AS) -o $(@)
|
||||
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
|
||||
endef
|
||||
|
||||
$(BUILD_DIR)/%.bin.o: %.bin
|
||||
@echo $@
|
||||
@$(bin2o)
|
||||
|
||||
define shader-as
|
||||
$(eval CURBIN := $(patsubst %.shbin.o,%.shbin,$(notdir $@)))
|
||||
picasso -o $(CURBIN) $1
|
||||
bin2s $(CURBIN) | $(AS) -o $@
|
||||
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(CURBIN) | tr . _)`.h
|
||||
echo "extern const u8" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h
|
||||
echo "extern const u32" `(echo $(CURBIN) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(CURBIN) | tr . _)`.h
|
||||
endef
|
||||
|
||||
$(BUILD_DIR)/%.shbin.o : %.v.pica %.g.pica
|
||||
@echo $@
|
||||
@$(call shader-as,$^)
|
||||
|
||||
$(BUILD_DIR)/%.shbin.o : %.v.pica
|
||||
@echo $@
|
||||
@$(call shader-as,$<)
|
||||
|
||||
$(BUILD_DIR)/%.shbin.o : %.shlist
|
||||
@echo $@
|
||||
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file)))
|
||||
|
||||
%.bnr: $(BANNER_IMAGE) $(BANNER_AUDIO)
|
||||
@echo $@
|
||||
@$(BANNERTOOL) makebanner $(BANNER_IMAGE_ARG) $(BANNER_IMAGE) $(BANNER_AUDIO_ARG) $(BANNER_AUDIO) -o $@ > /dev/null
|
||||
|
||||
%.icn: $(ICON)
|
||||
@echo $@
|
||||
@$(BANNERTOOL) makesmdh -s "$(NAME)" -l "$(DESCRIPTION)" -p "$(AUTHOR)" -i $(ICON) -o $@ > /dev/null
|
||||
|
||||
%.smdh: $(ICON)
|
||||
@echo $@
|
||||
@$(SMDHTOOL) --create "$(NAME)" "$(DESCRIPTION)" "$(AUTHOR)" $(ICON) $@
|
||||
|
||||
$(OUTPUT_DIR)/3ds/$(NAME)/%.3dsx: $(OUTPUT_DIR)/%.elf $(OUTPUT_DIR)/3ds/$(NAME)/%.smdh
|
||||
@echo $@
|
||||
@$(_3DSXTOOL) $< $@ --smdh=$(word 2,$^) $(_3DSXFLAGS)
|
||||
|
||||
%.3ds: %.elf $(BUILD_DIR)/banner.bnr $(BUILD_DIR)/icon.icn
|
||||
@echo $@
|
||||
@$(MAKEROM) -f cci -o $@ -elf $< -DAPP_ENCRYPTED=true $(COMMON_MAKEROM_PARAMS)
|
||||
|
||||
%.cia: %.elf $(BUILD_DIR)/banner.bnr $(BUILD_DIR)/icon.icn
|
||||
@echo $@
|
||||
@$(MAKEROM) -f cia -o $@ -elf $< -DAPP_ENCRYPTED=false $(COMMON_MAKEROM_PARAMS)
|
||||
endif
|
||||
|
||||
# DEPENDS #
|
||||
|
||||
DEPENDS := $(OBJECT_FILES:.o=.d)
|
||||
-include $(DEPENDS)
|
||||
Reference in New Issue
Block a user