Refactor makefile and fix banner audio

Also bumped version.
This commit is contained in:
Joel16 2017-12-14 22:19:56 -06:00
parent a275861c64
commit a180a21157
3 changed files with 155 additions and 220 deletions

162
Makefile
View File

@ -27,46 +27,45 @@ include $(DEVKITARM)/3ds_rules
# - icon.png # - icon.png
# - <libctru folder>/default_icon.png # - <libctru folder>/default_icon.png
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR)) APP_TITLE := 3DSident
BUILD := build APP_DESCRIPTION := Identity tool for the Nintendo 3DS.
RESOURCES := resources APP_AUTHOR := Joel16
SOURCES := source source/services
DATA := data
INCLUDES := include include/services
APP_TITLE := 3DSident TARGET := $(subst $e ,_,$(notdir $(APP_TITLE)))
APP_DESCRIPTION := Get more info about your 3DS, firmware, region etc. OUTDIR := out
APP_AUTHOR := Joel16 BUILD := build
RESOURCES := resources
SOURCES := source source/graphics source/services
DATA := data
INCLUDES := include include/graphics include/services
ICON := $(RESOURCES)/icon.png ICON := $(RESOURCES)/icon.png
BANNER := $(RESOURCES)/banner.png BANNER := $(RESOURCES)/banner.png
JINGLE := $(RESOURCES)/banner.wav JINGLE := $(RESOURCES)/banner.wav
LOGO := $(RESOURCES)/logo.bcma.lz ICON_FLAGS := nosavebackups,visible
# CIA # CIA
APP_PRODUCT_CODE := 3DS-I APP_PRODUCT_CODE := CTR-C-3DSI
APP_UNIQUE_ID := 0x16000 APP_UNIQUE_ID := 0x16000
APP_SYSTEM_MODE := 64MB RSF_FILE := resources/cia.rsf
APP_SYSTEM_MODE_EXT := Legacy
RSF_FILE := resources/cia.rsf
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# options for code generation # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
CFLAGS := -g -Werror -O2 -mword-relocations \ CFLAGS := -g -Werror -O2 -mword-relocations \
-fomit-frame-pointer -ffunction-sections \ -fomit-frame-pointer -ffunction-sections \
$(ARCH) $(ARCH)
CFLAGS += $(INCLUDE) -DARM11 -D_3DS CFLAGS += $(INCLUDE) -DARM11 -D_3DS
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
ASFLAGS := -g $(ARCH) ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lctru -lm -lpng16 -lz LIBS := -lctru -lm -lpng16 -lz
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing # list of directories containing libraries, this must be the top level containing
@ -81,7 +80,7 @@ LIBDIRS := $(CTRULIB) $(PORTLIBS)
ifneq ($(BUILD),$(notdir $(CURDIR))) ifneq ($(BUILD),$(notdir $(CURDIR)))
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET) export OUTPUT := $(CURDIR)/$(OUTDIR)/$(TARGET)
export TOPDIR := $(CURDIR) export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
@ -110,14 +109,9 @@ else
endif endif
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) export OFILES := $(addsuffix .o,$(BINFILES)) \
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
$(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o)
export OFILES := $(OFILES_BIN) $(OFILES_SOURCES)
export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
@ -139,36 +133,79 @@ else
endif endif
ifeq ($(strip $(NO_SMDH)),) ifeq ($(strip $(NO_SMDH)),)
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh export _3DSXFLAGS += --smdh=$(OUTPUT).smdh
endif endif
ifneq ($(ROMFS),) ifneq ($(ROMFS),)
export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS)
endif endif
.PHONY: $(BUILD) clean all cia .PHONY: $(BUILD) clean all
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
all: $(BUILD) all: 3dsx cia
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
3dsx: $(BUILD) $(OUTPUT).3dsx
cia : $(BUILD) $(OUTPUT).cia
citra: export CITRA_MODE = 1
citra: 3dsx
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
$(BUILD): $(BUILD):
@[ -d $@ ] || mkdir -p $@ @mkdir -p $(OUTDIR)
@[ -d "$@" ] || mkdir -p "$@"
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
clean: clean:
@echo clean ... @echo clean ...
@rm -fr $(BUILD) $(TARGET).bin $(TARGET).3dsx $(TARGET).smdh $(TARGET).cia $(TARGET).elf @rm -fr $(BUILD) $(OUTDIR)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
cia: $(BUILD) ifeq ($(strip $(NO_SMDH)),)
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile cia $(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
else
$(OUTPUT).3dsx : $(OUTPUT).elf
endif
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
3dsx: $(BUILD) MAKEROM ?= makerom
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 3dsx
MAKEROM_ARGS := -elf "$(OUTPUT).elf" -rsf "$(RSF_FILE)" -banner "$(BUILD)/banner.bnr" -icon "$(BUILD)/icon.icn" -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(APP_UNIQUE_ID)"
ifneq ($(strip $(LOGO)),)
MAKEROM_ARGS += -logo "$(LOGO)"
endif
ifeq ($(strip $(ROMFS)),)
$(OUTPUT).cia: $(OUTPUT).elf $(BUILD)/banner.bnr $(BUILD)/icon.icn
$(MAKEROM) -f cia -o "$@" -target t -exefslogo $(MAKEROM_ARGS)
else
$(OUTPUT).cia: $(OUTPUT).elf $(BUILD)/banner.bnr $(BUILD)/icon.icn
$(MAKEROM) -f cia -o "$@" -target t -exefslogo $(MAKEROM_ARGS)
endif
BANNERTOOL ?= bannertool
ifeq ($(suffix $(BANNER)),.cgfx)
BANNER_ARG := -ci
else
BANNER_ARG := -i
endif
ifeq ($(suffix $(JINGLE)),.cwav)
JINGLE_ARG := -ca
else
JINGLE_ARG := -a
endif
$(BUILD)/banner.bnr : $(BANNER) $(JINGLE)
$(BANNERTOOL) makebanner $(BANNER_ARG) "$(BANNER)" $(JINGLE_ARG) "$(JINGLE)" -o "$@"
$(BUILD)/icon.icn : $(APP_ICON)
$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i "$(APP_ICON)" -f "$(ICON_FLAGS)" -o "$@"
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
else else
@ -178,35 +215,8 @@ DEPENDS := $(OFILES:.o=.d)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# main targets # main targets
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
all: $(OUTPUT).cia $(OUTPUT).3dsx
3dsx: $(OUTPUT).3dsx $(OUTPUT).elf : $(OFILES)
cia: $(OUTPUT).cia
ifeq ($(strip $(NO_SMDH)),)
$(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
$(OUTPUT).smdh : $(TOPDIR)/Makefile
else
$(OUTPUT).3dsx : $(OUTPUT).elf
endif
$(OUTPUT).elf : $(OFILES)
$(OUTPUT).smdh : $(APP_ICON)
@bannertool makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o $@
@echo "built ... $(notdir $@)"
$(OUTPUT).cia : $(OUTPUT).elf $(OUTPUT).smdh $(TARGET).bnr
@makerom -f cia -o $(OUTPUT).cia -DAPP_ENCRYPTED=false -DAPP_UNIQUE_ID=$(APP_UNIQUE_ID) \
-elf $(OUTPUT).elf -rsf $(TOPDIR)/$(RSF_FILE) \
-icon $(OUTPUT).smdh -banner $(TARGET).bnr \
-exefslogo -target t
@echo "built ... $(notdir $@)"
$(TARGET).bnr : $(TOPDIR)/$(BANNER) $(TOPDIR)/$(JINGLE)
@bannertool makebanner -o $@ -i $(TOPDIR)/$(BANNER) -ca $(TOPDIR)/$(JINGLE)
@echo "built ... $@"
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data # you need a rule like this for each extension you use as binary data
@ -215,7 +225,7 @@ $(TARGET).bnr : $(TOPDIR)/$(BANNER) $(TOPDIR)/$(JINGLE)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
@echo $(notdir $<) @echo $(notdir $<)
@$(bin2o) @$(bin2o)
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------
endif endif
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------

View File

@ -1,11 +1,11 @@
BasicInfo: BasicInfo:
Title : $(APP_TITLE) Title : "3DSident"
ProductCode : $(APP_PRODUCT_CODE) ProductCode : "CTR-C-3DSI"
Logo : Homebrew Logo : Homebrew
TitleInfo: TitleInfo:
Category : Application Category : Application
UniqueId : $(APP_UNIQUE_ID) UniqueId : 0x16000
Option: Option:
UseOnSD : true # true if App is to be installed to SD UseOnSD : true # true if App is to be installed to SD
@ -15,21 +15,6 @@ Option:
EnableCompress : true # Compresses where applicable (currently only exefs:/.code) EnableCompress : true # Compresses where applicable (currently only exefs:/.code)
AccessControlInfo: 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: FileSystemAccess:
- CategorySystemApplication - CategorySystemApplication
- CategoryHardwareCheck - CategoryHardwareCheck
@ -63,149 +48,88 @@ AccessControlInfo:
- CreateSeed - CreateSeed
- UseCardSpi - UseCardSpi
# Process Settings
MemoryType : Application # Application/System/Base
SystemMode : $(APP_SYSTEM_MODE) # 64MB(Default)/96MB/80MB/72MB/32MB
IdealProcessor : 0 IdealProcessor : 0
AffinityMask : 1 AffinityMask : 1
Priority : 16 Priority : 16
MaxCpu : 0x9E # Default MaxCpu : 0x9E # Default
HandleTableSize : 0x200
DisableDebug : false DisableDebug : false
EnableForceDebug : false EnableForceDebug : false
CanWriteSharedPage : true CanWriteSharedPage : false
CanUsePrivilegedPriority : false CanUsePrivilegedPriority : false
CanUseNonAlphabetAndNumber : true CanUseNonAlphabetAndNumber : false
PermitMainFunctionArgument : true PermitMainFunctionArgument : false
CanShareDeviceMemory : true CanShareDeviceMemory : false
RunnableOnSleep : false RunnableOnSleep : false
SpecialMemoryArrange : true SpecialMemoryArrange : false
CoreVersion : 2
# New3DS Exclusive Process Settings DescVersion : 2
SystemModeExt : $(APP_SYSTEM_MODE_EXT) # Legacy(Default)/124MB/178MB Legacy:Use Old3DS SystemMode
CpuSpeed : $(APP_CPU_SPEED) # 268MHz(Default)/804MHz ReleaseKernelMajor : "02"
EnableL2Cache : true # false(default)/true ReleaseKernelMinor : "33"
CanAccessCore2 : true MemoryType : Application
HandleTableSize: 512
# Virtual Address Mappings IORegisterMapping:
IORegisterMapping: - 1ff50000-1ff57fff
- 1ff00000-1ff7ffff # DSP memory - 1ff70000-1ff77fff
MemoryMapping: MemoryMapping:
- 1f000000-1f5fffff:r # VRAM - 1f000000-1f5fffff:r
# Accessible SVCs, <Name>:<ID>
SystemCallAccess: SystemCallAccess:
ControlMemory: 1
QueryMemory: 2
ExitProcess: 3
GetProcessAffinityMask: 4
SetProcessAffinityMask: 5
GetProcessIdealProcessor: 6
SetProcessIdealProcessor: 7
CreateThread: 8
ExitThread: 9
SleepThread: 10
GetThreadPriority: 11
SetThreadPriority: 12
GetThreadAffinityMask: 13
SetThreadAffinityMask: 14
GetThreadIdealProcessor: 15
SetThreadIdealProcessor: 16
GetCurrentProcessorNumber: 17
Run: 18
CreateMutex: 19
ReleaseMutex: 20
CreateSemaphore: 21
ReleaseSemaphore: 22
CreateEvent: 23
SignalEvent: 24
ClearEvent: 25
CreateTimer: 26
SetTimer: 27
CancelTimer: 28
ClearTimer: 29
CreateMemoryBlock: 30
MapMemoryBlock: 31
UnmapMemoryBlock: 32
CreateAddressArbiter: 33
ArbitrateAddress: 34 ArbitrateAddress: 34
Break: 60
CancelTimer: 28
ClearEvent: 25
ClearTimer: 29
CloseHandle: 35 CloseHandle: 35
WaitSynchronization1: 36
WaitSynchronizationN: 37
SignalAndWait: 38
DuplicateHandle: 39
GetSystemTick: 40
GetHandleInfo: 41
GetSystemInfo: 42
GetProcessInfo: 43
GetThreadInfo: 44
ConnectToPort: 45 ConnectToPort: 45
ControlMemory: 1
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 SendSyncRequest1: 46
SendSyncRequest2: 47 SendSyncRequest2: 47
SendSyncRequest3: 48 SendSyncRequest3: 48
SendSyncRequest4: 49 SendSyncRequest4: 49
SendSyncRequest: 50 SendSyncRequest: 50
OpenProcess: 51 SetThreadPriority: 12
OpenThread: 52 SetTimer: 27
GetProcessId: 53 SignalEvent: 24
GetProcessIdOfThread: 54 SleepThread: 10
GetThreadId: 55 UnmapMemoryBlock: 32
GetResourceLimit: 56 WaitSynchronization1: 36
GetResourceLimitLimitValues: 57 WaitSynchronizationN: 37
GetResourceLimitCurrentValues: 58 InterruptNumbers:
GetThreadContext: 59 ServiceAccessControl:
Break: 60
OutputDebugString: 61
ControlPerformanceCounter: 62
CreatePort: 71
CreateSessionToPort: 72
CreateSession: 73
AcceptSession: 74
ReplyAndReceive1: 75
ReplyAndReceive2: 76
ReplyAndReceive3: 77
ReplyAndReceive4: 78
ReplyAndReceive: 79
BindInterrupt: 80
UnbindInterrupt: 81
InvalidateProcessDataCache: 82
StoreProcessDataCache: 83
FlushProcessDataCache: 84
StartInterProcessDma: 85
StopDma: 86
GetDmaState: 87
RestartDma: 88
DebugActiveProcess: 96
BreakDebugProcess: 97
TerminateDebugProcess: 98
GetProcessDebugEvent: 99
ContinueDebugEvent: 100
GetProcessList: 101
GetThreadList: 102
GetDebugThreadContext: 103
SetDebugThreadContext: 104
QueryDebugProcessMemory: 105
ReadProcessMemory: 106
WriteProcessMemory: 107
SetHardwareBreakPoint: 108
GetDebugThreadParam: 109
ControlProcessMemory: 112
MapProcessMemory: 113
UnmapProcessMemory: 114
CreateCodeSet: 115
CreateProcess: 117
TerminateProcess: 118
SetProcessResourceLimits: 119
CreateResourceLimit: 120
SetResourceLimitValues: 121
AddCodeSegment: 122
Backdoor: 123
KernelSetState: 124
QueryProcessMemory: 125
# Service List
# Maximum 34 services (32 if firmware is prior to 9.6.0)
ServiceAccessControl:
- APT:U - APT:U
- ac:u - ac:u
- act:u - act:u
@ -230,6 +154,7 @@ AccessControlInfo:
- mcu::HWC - mcu::HWC
- ndm:u - ndm:u
- news:s - news:s
- nim:u
- nwm::EXT - nwm::EXT
- nwm::UDS - nwm::UDS
- ps:ps - ps:ps

View File

@ -180,7 +180,7 @@ int main(int argc, char *argv[])
consoleInit(GFX_TOP, NULL); consoleInit(GFX_TOP, NULL);
printf("\x1b[1;1H"); //Move the cursor to the top left corner of the screen printf("\x1b[1;1H"); //Move the cursor to the top left corner of the screen
printf("\x1b[32;1m3DSident 0.7.7\x1b[0m\n\n"); printf("\x1b[32;1m3DSident 0.7.8\x1b[0m\n\n");
//=====================================================================// //=====================================================================//
//------------------------------Firm Info------------------------------// //------------------------------Firm Info------------------------------//