Skip to content

Commit d2a7a05

Browse files
committed
Initial commit.
0 parents  commit d2a7a05

21 files changed

+746
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*~
2+
*.3dsx
3+
*.elf
4+
*.smdh
5+
*.bat
6+
Thumbs.db
7+
build/

Makefile

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
#---------------------------------------------------------------------------------
2+
.SUFFIXES:
3+
#---------------------------------------------------------------------------------
4+
5+
ifeq ($(strip $(DEVKITARM)),)
6+
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
7+
endif
8+
9+
TOPDIR ?= $(CURDIR)
10+
include $(DEVKITARM)/3ds_rules
11+
12+
#---------------------------------------------------------------------------------
13+
# TARGET is the name of the output
14+
# BUILD is the directory where object files & intermediate files will be placed
15+
# SOURCES is a list of directories containing source code
16+
# DATA is a list of directories containing data files
17+
# INCLUDES is a list of directories containing header files
18+
#
19+
# NO_SMDH: if set to anything, no SMDH file is generated.
20+
# APP_TITLE is the name of the app stored in the SMDH file (Optional)
21+
# APP_DESCRIPTION is the description of the app stored in the SMDH file (Optional)
22+
# APP_AUTHOR is the author of the app stored in the SMDH file (Optional)
23+
# ICON is the filename of the icon (.png), relative to the project folder.
24+
# If not set, it attempts to use one of the following (in this order):
25+
# - <Project name>.png
26+
# - icon.png
27+
# - <libctru folder>/default_icon.png
28+
#---------------------------------------------------------------------------------
29+
TARGET := $(notdir $(CURDIR))
30+
BUILD := build
31+
SOURCES := source
32+
DATA := data
33+
INCLUDES := include
34+
35+
APP_TITLE := sysUpdater
36+
APP_DESCRIPTION := sysUpdater
37+
APP_AUTHOR := profi200
38+
ICON := /app/icon48x48.png
39+
40+
#---------------------------------------------------------------------------------
41+
# options for code generation
42+
#---------------------------------------------------------------------------------
43+
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard
44+
45+
CFLAGS := -g -Wall -O2 -mword-relocations \
46+
-fomit-frame-pointer -ffast-math \
47+
$(ARCH)
48+
49+
CFLAGS += $(INCLUDE) -DARM11 -D_3DS
50+
51+
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
52+
53+
ASFLAGS := -g $(ARCH)
54+
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
55+
56+
LIBS := -lctru -lm
57+
58+
#---------------------------------------------------------------------------------
59+
# list of directories containing libraries, this must be the top level containing
60+
# include and lib
61+
#---------------------------------------------------------------------------------
62+
LIBDIRS := $(CTRULIB)
63+
64+
65+
#---------------------------------------------------------------------------------
66+
# no real need to edit anything past this point unless you need to add additional
67+
# rules for different file extensions
68+
#---------------------------------------------------------------------------------
69+
ifneq ($(BUILD),$(notdir $(CURDIR)))
70+
#---------------------------------------------------------------------------------
71+
72+
export OUTPUT := $(CURDIR)/$(TARGET)
73+
export TOPDIR := $(CURDIR)
74+
75+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
76+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
77+
78+
export DEPSDIR := $(CURDIR)/$(BUILD)
79+
80+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
81+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
82+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
83+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
84+
85+
#---------------------------------------------------------------------------------
86+
# use CXX for linking C++ projects, CC for standard C
87+
#---------------------------------------------------------------------------------
88+
ifeq ($(strip $(CPPFILES)),)
89+
#---------------------------------------------------------------------------------
90+
export LD := $(CC)
91+
#---------------------------------------------------------------------------------
92+
else
93+
#---------------------------------------------------------------------------------
94+
export LD := $(CXX)
95+
#---------------------------------------------------------------------------------
96+
endif
97+
#---------------------------------------------------------------------------------
98+
99+
export OFILES := $(addsuffix .o,$(BINFILES)) \
100+
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
101+
102+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
103+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
104+
-I$(CURDIR)/$(BUILD)
105+
106+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
107+
108+
ifeq ($(strip $(ICON)),)
109+
icons := $(wildcard *.png)
110+
ifneq (,$(findstring $(TARGET).png,$(icons)))
111+
export APP_ICON := $(TOPDIR)/$(TARGET).png
112+
else
113+
ifneq (,$(findstring icon.png,$(icons)))
114+
export APP_ICON := $(TOPDIR)/icon.png
115+
endif
116+
endif
117+
else
118+
export APP_ICON := $(TOPDIR)/$(ICON)
119+
endif
120+
121+
ifeq ($(strip $(NO_SMDH)),)
122+
export _3DSXFLAGS += --smdh=$(CURDIR)/$(TARGET).smdh
123+
endif
124+
125+
.PHONY: $(BUILD) clean all
126+
127+
#---------------------------------------------------------------------------------
128+
all: $(BUILD)
129+
130+
$(BUILD):
131+
@[ -d $@ ] || mkdir -p $@
132+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
133+
134+
#---------------------------------------------------------------------------------
135+
clean:
136+
@echo clean ...
137+
@rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf
138+
139+
140+
#---------------------------------------------------------------------------------
141+
else
142+
143+
DEPENDS := $(OFILES:.o=.d)
144+
145+
#---------------------------------------------------------------------------------
146+
# main targets
147+
#---------------------------------------------------------------------------------
148+
ifeq ($(strip $(NO_SMDH)),)
149+
$(OUTPUT).3dsx : $(OUTPUT).elf $(OUTPUT).smdh
150+
else
151+
$(OUTPUT).3dsx : $(OUTPUT).elf
152+
endif
153+
154+
$(OUTPUT).elf : $(OFILES)
155+
156+
#---------------------------------------------------------------------------------
157+
# you need a rule like this for each extension you use as binary data
158+
#---------------------------------------------------------------------------------
159+
%.bin.o : %.bin
160+
#---------------------------------------------------------------------------------
161+
@echo $(notdir $<)
162+
@$(bin2o)
163+
164+
# WARNING: This is not the right way to do this! TODO: Do it right!
165+
#---------------------------------------------------------------------------------
166+
%.vsh.o : %.vsh
167+
#---------------------------------------------------------------------------------
168+
@echo $(notdir $<)
169+
@python $(AEMSTRO)/aemstro_as.py $< ../$(notdir $<).shbin
170+
@bin2s ../$(notdir $<).shbin | $(PREFIX)as -o $@
171+
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(notdir $<).shbin | tr . _)`.h
172+
@echo "extern const u8" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(notdir $<).shbin | tr . _)`.h
173+
@echo "extern const u32" `(echo $(notdir $<).shbin | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(notdir $<).shbin | tr . _)`.h
174+
@rm ../$(notdir $<).shbin
175+
176+
-include $(DEPENDS)
177+
178+
#---------------------------------------------------------------------------------------
179+
endif
180+
#---------------------------------------------------------------------------------------

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sysUpdater
2+
=======
3+
4+
A quick tool for manually updating a 3DS using CIA files.
5+

app/BannerAudio.bcwav

56.2 KB
Binary file not shown.

app/IcnSettings.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#-display text: enter your info between the quotes
2+
#-don't use unicode (i.e. weird characters) or program will barf
3+
#-not certain about string length limits so be conservative
4+
5+
longtitle="sysUpdater"
6+
shortitle="sysUpdater"
7+
publisher="profi200"
8+
9+
#-setting flags: don't change unless you know what you're doing
10+
#-1 is on, 0 is off
11+
#-for more info, visit http://3dbrew.org/wiki/SMDH#Flags
12+
13+
visibility =1
14+
autoBoot =0
15+
use3D =0
16+
requireEULA =0
17+
autoSaveOnExit=0
18+
extendedBanner=0
19+
gameRatings =0
20+
useSaveData =0
21+
recordAppUsage=0 # App usage is recorded regardless of if this is enabled or not.
22+
disableSaveBU =1

app/banner.bnr

58.6 KB
Binary file not shown.

app/banner.png

1.03 KB
Loading

app/build-cia.rsf

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
BasicInfo:
2+
Title : "udtr"
3+
CompanyCode : "00"
4+
ProductCode : "CTR-N-UDTR"
5+
ContentType : Application # Application / SystemUpdate / Manual / Child / Trial
6+
Logo : Nintendo # Nintendo / Licensed / Distributed / iQue / iQueForSystem
7+
8+
RomFs:
9+
# Specifies the root path of the file system to include in the ROM.
10+
# HostRoot : "$(ROMFS_ROOT)"
11+
12+
13+
TitleInfo:
14+
UniqueId : 0xf0007
15+
Category : Application # Application / SystemApplication / Applet / Firmware / Base / DlpChild / Demo / Contents / SystemContents / SharedContents / AddOnContents / Patch / AutoUpdateContents
16+
17+
CardInfo:
18+
MediaSize : 128MB # 128MB / 256MB / 512MB / 1GB / 2GB / 4GB / 8GB / 16GB / 32GB
19+
MediaType : Card1 # Card1 / Card2
20+
CardDevice : None # NorFlash / None
21+
22+
23+
Option:
24+
UseOnSD : true # true if App is to be installed to SD
25+
EnableCompress : true # Compresses exefs code
26+
FreeProductCode : false # Removes limitations on ProductCode
27+
EnableCrypt : false # Enables encryption for NCCH and CIA
28+
MediaFootPadding : false # If true CCI files are created with padding
29+
30+
ExeFs: # these are the program segments from the ELF, check your elf for the appropriate segment names
31+
ReadOnly:
32+
- .rodata
33+
- RO
34+
ReadWrite:
35+
- .data
36+
- RO
37+
Text:
38+
- .init
39+
- .text
40+
- STUP_ENTRY
41+
42+
PlainRegion: # only used with SDK ELFs
43+
# - .module_id
44+
45+
AccessControlInfo:
46+
FileSystemAccess:
47+
- DirectSdmc
48+
IoAccessControl:
49+
50+
IdealProcessor : 0
51+
AffinityMask : 1
52+
53+
Priority : 16
54+
55+
MaxCpu : 0x9E # Default
56+
57+
DisableDebug : true
58+
EnableForceDebug : false
59+
CanWriteSharedPage : false
60+
CanUsePrivilegedPriority : false
61+
CanUseNonAlphabetAndNumber : false
62+
PermitMainFunctionArgument : false
63+
CanShareDeviceMemory : false
64+
RunnableOnSleep : false
65+
SpecialMemoryArrange : false
66+
67+
CoreVersion : 2
68+
DescVersion : 2
69+
70+
ReleaseKernelMajor : "02"
71+
ReleaseKernelMinor : "33"
72+
MemoryType : Application # Application / System / Base
73+
HandleTableSize: 512
74+
IORegisterMapping:
75+
- 1ff50000-1ff57fff
76+
- 1ff70000-1ff77fff
77+
MemoryMapping:
78+
- 1f000000-1f5fffff:r
79+
SystemCallAccess:
80+
ArbitrateAddress: 34
81+
Break: 60
82+
CancelTimer: 28
83+
ClearEvent: 25
84+
ClearTimer: 29
85+
CloseHandle: 35
86+
ConnectToPort: 45
87+
ControlMemory: 1
88+
CreateAddressArbiter: 33
89+
CreateEvent: 23
90+
CreateMemoryBlock: 30
91+
CreateMutex: 19
92+
CreateSemaphore: 21
93+
CreateThread: 8
94+
CreateTimer: 26
95+
DuplicateHandle: 39
96+
ExitProcess: 3
97+
ExitThread: 9
98+
GetCurrentProcessorNumber: 17
99+
GetHandleInfo: 41
100+
GetProcessId: 53
101+
GetProcessIdOfThread: 54
102+
GetProcessIdealProcessor: 6
103+
GetProcessInfo: 43
104+
GetResourceLimit: 56
105+
GetResourceLimitCurrentValues: 58
106+
GetResourceLimitLimitValues: 57
107+
GetSystemInfo: 42
108+
GetSystemTick: 40
109+
GetThreadContext: 59
110+
GetThreadId: 55
111+
GetThreadIdealProcessor: 15
112+
GetThreadInfo: 44
113+
GetThreadPriority: 11
114+
MapMemoryBlock: 31
115+
OutputDebugString: 61
116+
QueryMemory: 2
117+
ReleaseMutex: 20
118+
ReleaseSemaphore: 22
119+
SendSyncRequest1: 46
120+
SendSyncRequest2: 47
121+
SendSyncRequest3: 48
122+
SendSyncRequest4: 49
123+
SendSyncRequest: 50
124+
SetThreadPriority: 12
125+
SetTimer: 27
126+
SignalEvent: 24
127+
SleepThread: 10
128+
UnmapMemoryBlock: 32
129+
WaitSynchronization1: 36
130+
WaitSynchronizationN: 37
131+
InterruptNumbers:
132+
ServiceAccessControl:
133+
- APT:U
134+
- cfg:u
135+
- fs:USER
136+
- gsp::Gpu
137+
- hid:USER
138+
- am:u
139+
140+
141+
SystemControlInfo:
142+
SaveDataSize: 0KB
143+
RemasterVersion: 0
144+
StackSize: 0x1000
145+
# JumpId: 0
146+
Dependency:
147+
am: 0x0004013000001502L
148+
cfg: 0x0004013000001702L
149+
hid: 0x0004013000001d02L
150+
ps: 0x0004013000003102L

app/icon.icn

13.7 KB
Binary file not shown.

app/icon24x24.png

457 Bytes
Loading

app/icon48x48.png

568 Bytes
Loading

include/error.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef _ERROR_H_
2+
#define _ERROR_H_
3+
4+
#define ERR_NULL_PTR (-1)
5+
#define ERR_NOT_ENOUGH_MEM (-2)
6+
#define ERR_PATH_TOO_LONG (-3)
7+
8+
#endif

0 commit comments

Comments
 (0)