commit 04840890c70cfe1a62b44c200eeba8902dad85b9 Author: frzysk <160762234+frzysk@users.noreply.github.com> Date: Fri Oct 4 19:07:54 2024 +0300 init: main * From 3ds template: https://github.com/TricksterGuy/3ds-template diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e232e18 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# Compile directories +build/ +output/ + +# Codeblocks +*.layout + +# Object files +*.o +*.ko +*.obj +*.elf +*.3ds +*.cia +*.3dsx +*.smdh +*.zip + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..0bc98f0 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 [Brandon W.] + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b160df8 --- /dev/null +++ b/Makefile @@ -0,0 +1,345 @@ +#--------------------------------------------------------------------------------- +.SUFFIXES: +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(DEVKITARM)),) +$(error "Please set DEVKITARM in your environment. export DEVKITARM=devkitARM") +endif + +TOPDIR ?= $(CURDIR) +include $(DEVKITARM)/3ds_rules + +#--------------------------------------------------------------------------------- +# TARGET is the name of the output +# BUILD is the directory where object files & intermediate files will be placed +# SOURCES is a list of directories containing source code +# DATA is a list of directories containing data files +# INCLUDES is a list of directories containing header files +# RESOURCES is the directory where AppInfo template.rsf etc can be found +# OUTPUT is the directory where final executables will be placed +# GRAPHICS is a list of directories containing graphics files +# GFXBUILD is the directory where converted graphics files will be placed +# If set to $(BUILD), it will statically link in the converted +# files as if they were data files. +# +# NO_SMDH: if set to anything, no SMDH file is generated. +# ROMFS is the directory which contains the RomFS, relative to the Makefile (Optional) +# APP_TITLE is the name of the app stored in the SMDH file (Optional) +# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional) +# APP_AUTHOR is the author of the app stored in the SMDH file (Optional) +# ICON is the filename of the icon (.png), relative to the project folder. +# If not set, it attempts to use one of the following (in this order): +# - .png +# - icon.png +# - /default_icon.png +#--------------------------------------------------------------------------------- +TARGET := $(notdir $(CURDIR)) +BUILD := build +SOURCES := source +DATA := data +INCLUDES := include +GRAPHICS := gfx +OUTPUT := output +RESOURCES := resources +ROMFS := romfs +GFXBUILD := $(ROMFS)/gfx +#--------------------------------------------------------------------------------- +# Resource Setup +#--------------------------------------------------------------------------------- +APP_INFO := $(RESOURCES)/AppInfo +BANNER_AUDIO := $(RESOURCES)/audio +BANNER_IMAGE := $(RESOURCES)/banner +ICON := $(RESOURCES)/icon.png +RSF := $(TOPDIR)/$(RESOURCES)/template.rsf + +#--------------------------------------------------------------------------------- +# options for code generation +#--------------------------------------------------------------------------------- +ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft +COMMON := -Wall -O2 -mword-relocations -fomit-frame-pointer -ffunction-sections $(ARCH) $(INCLUDE) -D__3DS__ +CFLAGS := $(COMMON) -std=gnu99 +CXXFLAGS := $(COMMON) -fno-rtti -fno-exceptions -std=gnu++11 +ASFLAGS := $(ARCH) +LDFLAGS = -specs=3dsx.specs $(ARCH) -Wl,-Map,$(notdir $*.map) + +#--------------------------------------------------------------------------------- +# Libraries needed to link into the executable. +#--------------------------------------------------------------------------------- +LIBS := -lcitro2d -lcitro3d -lctru -lm + +#--------------------------------------------------------------------------------- +# list of directories containing libraries, this must be the top level containing +# include and lib +#--------------------------------------------------------------------------------- +LIBDIRS := $(PORTLIBS) $(CTRULIB) + +#--------------------------------------------------------------------------------- +# no real need to edit anything past this point unless you need to add additional +# rules for different file extensions +#--------------------------------------------------------------------------------- +ifneq ($(BUILD),$(notdir $(CURDIR))) +#--------------------------------------------------------------------------------- + +export TOPDIR := $(CURDIR) +export OUTPUT_DIR := $(TOPDIR)/$(OUTPUT) +export OUTPUT_FILE := $(OUTPUT_DIR)/$(TARGET) +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ + $(foreach dir,$(GRAPHICS),$(CURDIR)/$(dir)) \ + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) + +export DEPSDIR := $(CURDIR)/$(BUILD) + +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) +PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.v.pica))) +SHLISTFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.shlist))) +GFXFILES := $(foreach dir,$(GRAPHICS),$(notdir $(wildcard $(dir)/*.t3s))) +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) + +#--------------------------------------------------------------------------------- +# use CXX for linking C++ projects, CC for standard C +#--------------------------------------------------------------------------------- +ifeq ($(strip $(CPPFILES)),) + export LD := $(CC) +else + export LD := $(CXX) +endif +#--------------------------------------------------------------------------------- +export T3XFILES := $(GFXFILES:.t3s=.t3x) + +export OFILES_SOURCES := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) +export OFILES_BIN := $(addsuffix .o,$(BINFILES)) \ + $(PICAFILES:.v.pica=.shbin.o) $(SHLISTFILES:.shlist=.shbin.o) \ + $(if $(filter $(BUILD),$(GFXBUILD)),$(addsuffix .o,$(T3XFILES))) +export OFILES := $(OFILES_BIN) $(OFILES_SOURCES) +export HFILES := $(PICAFILES:.v.pica=_shbin.h) $(SHLISTFILES:.shlist=_shbin.h) \ + $(addsuffix .h,$(subst .,_,$(BINFILES))) \ + $(GFXFILES:.t3s=.h) +export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) + +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) + +export _3DSXDEPS := $(if $(NO_SMDH),,$(OUTPUT_FILE).smdh) + +#--------------------------------------------------------------------------------- +# Inclusion of RomFS folder, App Icon, and building SMDH +#--------------------------------------------------------------------------------- + +ifeq ($(strip $(ICON)),) + icons := $(wildcard *.png) + ifneq (,$(findstring $(TARGET).png,$(icons))) + export APP_ICON := $(TOPDIR)/$(TARGET).png + else + ifneq (,$(findstring icon.png,$(icons))) + export APP_ICON := $(TOPDIR)/icon.png + endif + endif +else + export APP_ICON := $(TOPDIR)/$(ICON) +endif +ifeq ($(strip $(NO_SMDH)),) + export _3DSXFLAGS += --smdh=$(OUTPUT_FILE).smdh +endif + +ifneq ($(ROMFS),) + export _3DSXFLAGS += --romfs=$(CURDIR)/$(ROMFS) +endif + +#--------------------------------------------------------------------------------- +# First set of targets ensure the build/output directories are created and execute +# in the context of the BUILD directory. +#--------------------------------------------------------------------------------- +.PHONY : clean all bootstrap 3dsx cia elf 3ds citra release + +all : bootstrap + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + +3dsx : bootstrap + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ + +cia : bootstrap + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ + +3ds : bootstrap + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ + +elf : bootstrap + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ + +citra : bootstrap + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ + +release : bootstrap + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $@ + +bootstrap : + @[ -d $(BUILD) ] || mkdir -p $(BUILD) + @[ -d $(OUTPUT_DIR) ] || mkdir -p $(OUTPUT_DIR) + @[ -d $(GFXBUILD) ] || mkdir -p $(GFXBUILD) + +clean : + @echo clean ... + @rm -rf $(BUILD) $(OUTPUT) + +#--------------------------------------------------------------------------------- +else + +DEPENDS := $(OFILES:.o=.d) + +include $(TOPDIR)/$(APP_INFO) +APP_TITLE := $(shell echo "$(APP_TITLE)" | cut -c1-128) +APP_DESCRIPTION := $(shell echo "$(APP_DESCRIPTION)" | cut -c1-256) +APP_AUTHOR := $(shell echo "$(APP_AUTHOR)" | cut -c1-128) +APP_PRODUCT_CODE := $(shell echo $(APP_PRODUCT_CODE) | cut -c1-16) +APP_UNIQUE_ID := $(shell echo $(APP_UNIQUE_ID) | cut -c1-7) +APP_VERSION_MAJOR := $(shell echo $(APP_VERSION_MAJOR) | cut -c1-3) +APP_VERSION_MINOR := $(shell echo $(APP_VERSION_MINOR) | cut -c1-3) +APP_VERSION_MICRO := $(shell echo $(APP_VERSION_MICRO) | cut -c1-3) +APP_ROMFS := $(TOPDIR)/$(ROMFS) + +ifneq ("$(wildcard $(TOPDIR)/$(BANNER_IMAGE).cgfx)","") + BANNER_IMAGE_FILE := $(TOPDIR)/$(BANNER_IMAGE).cgfx + BANNER_IMAGE_ARG := -ci $(BANNER_IMAGE_FILE) +else + BANNER_IMAGE_FILE := $(TOPDIR)/$(BANNER_IMAGE).png + BANNER_IMAGE_ARG := -i $(BANNER_IMAGE_FILE) +endif + +ifneq ("$(wildcard $(TOPDIR)/$(BANNER_AUDIO).cwav)","") + BANNER_AUDIO_FILE := $(TOPDIR)/$(BANNER_AUDIO).cwav + BANNER_AUDIO_ARG := -ca $(BANNER_AUDIO_FILE) +else + BANNER_AUDIO_FILE := $(TOPDIR)/$(BANNER_AUDIO).wav + BANNER_AUDIO_ARG := -a $(BANNER_AUDIO_FILE) +endif + +COMMON_MAKEROM_PARAMS := -rsf $(RSF) -target t -exefslogo -elf $(OUTPUT_FILE).elf -icon icon.icn \ +-banner banner.bnr -DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" \ +-DAPP_UNIQUE_ID="$(APP_UNIQUE_ID)" -DAPP_ROMFS="$(APP_ROMFS)" -DAPP_SYSTEM_MODE="64MB" \ +-DAPP_SYSTEM_MODE_EXT="Legacy" -major "$(APP_VERSION_MAJOR)" -minor "$(APP_VERSION_MINOR)" \ +-micro "$(APP_VERSION_MICRO)" + +ifeq ($(OS),Windows_NT) + MAKEROM = makerom.exe + BANNERTOOL = bannertool.exe + CITRA = citra.exe + _3DSXTOOL = 3dsxtool.exe + SMDHTOOL = smdhtool.exe + TEX3DS = tex3ds.exe +else + MAKEROM = makerom + BANNERTOOL = bannertool + CITRA = citra + _3DSXTOOL = 3dsxtool + SMDHTOOL = smdhtool + TEX3DS = tex3ds +endif + +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +.PHONY: all 3dsx cia elf 3ds citra release + +$(OUTPUT_FILE).3dsx : $(OUTPUT_FILE).elf $(_3DSXDEPS) + $(_3DSXTOOL) $< $@ $(_3DSXFLAGS) + @echo built ... $(notdir $@) + +$(OUTPUT_FILE).smdh : $(APP_ICON) + @$(SMDHTOOL) --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@ + @echo built ... $(notdir $@) + +$(OFILES_SOURCES) : $(HFILES) + +$(OUTPUT_FILE).elf : $(OFILES) + +$(OUTPUT_FILE).3ds : $(OUTPUT_FILE).elf banner.bnr icon.icn + @$(MAKEROM) -f cci -o $(OUTPUT_FILE).3ds -DAPP_ENCRYPTED=true $(COMMON_MAKEROM_PARAMS) + @echo "built ... $(notdir $@)" + +$(OUTPUT_FILE).cia : $(OUTPUT_FILE).elf banner.bnr icon.icn + @$(MAKEROM) -f cia -o $(OUTPUT_FILE).cia -DAPP_ENCRYPTED=false $(COMMON_MAKEROM_PARAMS) + @echo "built ... $(notdir $@)" + +$(OUTPUT_FILE).zip : $(OUTPUT_FILE).smdh $(OUTPUT_FILE).3dsx + @cd $(OUTPUT_DIR) + mkdir -p 3ds/$(TARGET) + cp $(OUTPUT_FILE).3dsx 3ds/$(TARGET) + cp $(OUTPUT_FILE).smdh 3ds/$(TARGET) + zip -r $(OUTPUT_FILE).zip 3ds > /dev/null + rm -r 3ds + @echo built ... $(notdir $@) + +banner.bnr : $(BANNER_IMAGE_FILE) $(BANNER_AUDIO_FILE) + @$(BANNERTOOL) makebanner $(BANNER_IMAGE_ARG) $(BANNER_AUDIO_ARG) -o banner.bnr > /dev/null + @echo built ... $(notdir $@) + +icon.icn : $(APP_ICON) + @$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(APP_ICON) -o icon.icn > /dev/null + @echo built ... $(notdir $@) + +3dsx : $(OUTPUT_FILE).3dsx + +cia : $(OUTPUT_FILE).cia + +3ds : $(OUTPUT_FILE).3ds + +elf : $(OUTPUT_FILE).elf + +citra : 3dsx + $(CITRA) $(OUTPUT_FILE).3dsx + +release : $(OUTPUT_FILE).zip cia 3ds + +#--------------------------------------------------------------------------------- +# Binary Data Rules +#--------------------------------------------------------------------------------- +%.bin.o %_bin.h : %.bin +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(bin2o) +#--------------------------------------------------------------------------------- +.PRECIOUS : %.t3x +%.t3x.o %_t3x.h : %.t3x +#--------------------------------------------------------------------------------- + @$(bin2o) + +#--------------------------------------------------------------------------------- +# rules for assembling GPU shaders +#--------------------------------------------------------------------------------- +define shader-as + $(eval CURBIN := $*.shbin) + $(eval DEPSFILE := $(DEPSDIR)/$*.shbin.d) + echo "$(CURBIN).o: $< $1" > $(DEPSFILE) + 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 + picasso -o $(CURBIN) $1 + bin2s $(CURBIN) | $(AS) -o $*.shbin.o +endef + +%.shbin.o %_shbin.h : %.v.pica %.g.pica + @echo $(notdir $^) + @$(call shader-as,$^) + +%.shbin.o %_shbin.h : %.v.pica + @echo $(notdir $<) + @$(call shader-as,$<) + +%.shbin.o %_shbin.h : %.shlist + @echo $(notdir $<) + @$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)$(file))) + +#--------------------------------------------------------------------------------- +%.t3x %.h : %.t3s +#--------------------------------------------------------------------------------- + @echo $(notdir $<) + @$(TEX3DS) -i $< -H $*.h -d $*.d -o $(TOPDIR)/$(GFXBUILD)/$*.t3x + +-include $(DEPSDIR)/*.d + +#--------------------------------------------------------------------------------------- +endif +#--------------------------------------------------------------------------------------- diff --git a/README.md b/README.md new file mode 100644 index 0000000..dbf436c --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +# 3ds-template + +A starter template for various 3DS homebrew applications. This template is geared specifically towards the Code::Blocks IDE. This template can also be used without Code::Blocks just use the `Makefile` and directory structure provided. + +This is designed to be a simple and fairly minimal setup required to begin developing homebrew for the 3ds system. As such it doesn't include everything needed to build everything out of the box if you want to build 3ds or cia homebrew. + +## Usage + +| Targets | Action | +| ------------| ----------------------------------------------------------------------------------------- | +| 3ds | Builds `.3ds`. 1 +| 3dsx | Builds `.3dsx` and `.smdh`. +| cia | Builds `.cia`. 1 +| citra | Builds and automatically runs `citra` for testing.2 +| elf | Builds `.elf`. +| release | Release build, creates a `cia`, `3ds`, and a zip file containing the `smdh` and `3dsx`. 3 + +**Notes:** +* 1 This requires having [makerom] and [bannertool] in your `$PATH` +* 2 `make citra` requires having [citra] installed and in your `$PATH` +* 3 If you are on Windows you will need both of the following in your `$PATH` [zip] and [libbz2.dll] + +## Setting up devkitPro +* Follow the steps installing devkitPro at the gbatemp [wiki] + +### If you want to build cia and 3ds then follow these extra steps: +* Aquire makerom and bannertool binaries from [buildtools], or compile them yourself from [makerom] and [bannertool] +* Copy the makerom/bannertool to `$DEVKITARM/bin` or some other directory in your `$PATH` + +## Code::Blocks Setup +1. Simply open `3ds.cbp` in Code::Blocks +2. Choose File > Save as user-template and enter a template name. The project setup is now a user template to create new projects. +3. When creating a new project select File > New > From template and follow the wizard's instructions. +4. Ensure you have the environment variables plugin installed (in linux you can install this by installing the codeblocks-contrib package) +5. Choose Settings > Environment and scroll down to the Environment Variables section. +6. Add `DEVKITPRO` and point it to where devkitpro is installed +7. Add `DEVKITARM` and point it to where devkitarm is. + +To compile in Code::Blocks simply select your target from the list and click the Gear icon to automatically invoke the `Makefile` + +**Note** Make sure you are using MSYS2's make (make.exe) and not MINGW's make (mingw32-make.exe) + +## Creating a new project +1. Make a new Code::Blocks project via a user-template you just created above. Or simply copy this directory. +2. (Only needed for cia/3ds builds) Edit the file `resources/AppInfo` + 1. Edit those values and ensure you choose a unique id see [unique_id_list]. + 2. Replace the existing files in the `resources` directory to suit your needs. + +**Note** please ensure that no folder/directory used in the project contains spaces. Devkitpro's Makefiles apparently does not like this. +That is, do not have it in a folder like `C:/3DS Hacking/3ds-template` rather `C:/3DS_Hacking/3ds-template` + +## Credits +All of this would not have been possible without the work of +* [Smealum](https://github.com/smealum) +* [Steveice10](https://github.com/Steveice10) for the [buildtools] +* [amaredeus](https://github.com/amaredeus) for various improvements to the template (such as the formatting in this README) + + +[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax) + + +[buildtools]: +[bannertool]: +[citra]: +[libbz2.dll]: +[makerom]: +[unique_id_list]: +[wiki]: +[zip]: diff --git a/resources/AppInfo b/resources/AppInfo new file mode 100644 index 0000000..d04104f --- /dev/null +++ b/resources/AppInfo @@ -0,0 +1,8 @@ +APP_TITLE = Homebrew Template +APP_DESCRIPTION = A 3DS homebrew template. +APP_AUTHOR = YourName +APP_PRODUCT_CODE = Your-Code +APP_UNIQUE_ID = 0x1929 +APP_VERSION_MAJOR = 1 +APP_VERSION_MINOR = 0 +APP_VERSION_MICRO = 0 diff --git a/resources/audio.wav b/resources/audio.wav new file mode 100644 index 0000000..8bdb0e1 Binary files /dev/null and b/resources/audio.wav differ diff --git a/resources/banner.png b/resources/banner.png new file mode 100644 index 0000000..9267a0c Binary files /dev/null and b/resources/banner.png differ diff --git a/resources/icon.png b/resources/icon.png new file mode 100644 index 0000000..ea440f9 Binary files /dev/null and b/resources/icon.png differ diff --git a/resources/template.rsf b/resources/template.rsf new file mode 100644 index 0000000..aad12d6 --- /dev/null +++ b/resources/template.rsf @@ -0,0 +1,219 @@ +BasicInfo: + Title : $(APP_TITLE) + ProductCode : $(APP_PRODUCT_CODE) + Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem + +#RomFs: + # Specifies the root path of the read only file system to include in the ROM. + #RootPath : $(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, : + 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 + # : + 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 diff --git a/source/main.cpp b/source/main.cpp new file mode 100644 index 0000000..d01f026 --- /dev/null +++ b/source/main.cpp @@ -0,0 +1,25 @@ +#include <3ds.h> +#include + +int main(int argc, char **argv) { + gfxInitDefault(); + consoleInit(GFX_TOP, NULL); + + printf("Test Code::Blocks project!"); + + printf("\x1b[20;15HPress Start to exit."); + + while(aptMainLoop()) { + gspWaitForVBlank(); + hidScanInput(); + + if(hidKeysDown() & KEY_START) + break; + + gfxFlushBuffers(); + gfxSwapBuffers(); + } + + gfxExit(); + return 0; +}