Skip to content

Commit

Permalink
Merge pull request #12 from TraceEntertains/pretendo
Browse files Browse the repository at this point in the history
Juxtaposition patches, SSL patch, CIA building, code.bin decompressing guide, and more
  • Loading branch information
jonbarrow authored Jul 6, 2023
2 parents 4bcb6ab + 5d54a74 commit 2f10aef
Show file tree
Hide file tree
Showing 29 changed files with 496 additions and 56 deletions.
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,19 @@

# 3ds
*.elf
*.cia
*.3dsx
*.smdh
*.t3x
*.bin
*.ips
build
out
luma
target
*.bin
*.ips

# region file from script to say what region of code.bin you have
*.region

# VSCode
.vscode
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "patches/ssl"]
path = patches/ssl
url = https://github.com/TraceEntertains/3DS-SSL-Patch
33 changes: 33 additions & 0 deletions DECOMPRESSING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Decompressing code.bin files
This is a tutorial on how to get, extract, and decompress code.bin files for patch compilation.

## Method 1
1. Have a hacked 3DS
2. Open GodMode9, press the HOME button, then open "Title manager" -> "NAND / TWL"
3. For each module you need (list below), then press A, then press "Open title folder".
4. Then press A on the .app file in the folder, select "NCCH image options...".
5. Select "Extract .code"
6. 0:/gm9/out should now have a file called <ModuleTitleID>.dec.code, which is your code.bin for that app.
7. Repeat steps 3-6 for the remaining modules.
8. For each module, move it to its proper folder named as code.bin (folder names are next to module names in module list below)
9. Done!

### Modules to dump
- Account (act): 0004013000003802
- Friends (friends): 0004013000003202
- SSL (ssl): 0004013000002F02
- Miiverse (miiverse):
- JPN: 000400300000BC02
- USA: 000400300000BD02
- EUR: 000400300000BE02

Any miiverse module is fine and should generate a patch that works and + is identical for all regions.

## Method 2 (Requires running a GM9 script)
1. Have a hacked 3DS
2. Download dump_modules.gm9 from [here](https://github.com/TraceEntertains/nimbus-module-extractor/releases/latest)
3. Put it in sd:/gm9/scripts
4. Run the script (Home Button -> Scripts -> dump_modules.gm9)
5. Turn off your 3DS and remove the SD card.
6. Copy the folder (named patches) from the nimbusmodules folder located on your SD card to your local clone of nimbus, and merge when prompted.
7. Done!
64 changes: 48 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,59 @@
.PHONY: all patches app clean
.PHONY: all clean

all: patches app
OUT_FOLDER := out

FRIEND_TITLE_ID := 0004013000003202
CIA_OUT_FOLDER := $(OUT_FOLDER)/cia_out
3DSX_OUT_FOLDER := $(OUT_FOLDER)/3dsx_out

3DS_OUT := 3ds
CIA_OUT := cias

LUMA_OUT := luma/titles

FRIENDS_TITLE_ID := 0004013000003202
ACT_TITLE_ID := 0004013000003802
SSL_TITLE_ID := 0004013000002F02
MIIVERSE_ID_JPN := 000400300000BC02
MIIVERSE_ID_USA := 000400300000BD02
MIIVERSE_ID_EUR := 000400300000BE02

FRIENDS_OUT := $(LUMA_OUT)/$(FRIENDS_TITLE_ID)
ACT_OUT := $(LUMA_OUT)/$(ACT_TITLE_ID)
SSL_OUT := $(LUMA_OUT)/$(SSL_TITLE_ID)
MIIVERSE_OUT_JPN := $(LUMA_OUT)/$(MIIVERSE_ID_JPN)
MIIVERSE_OUT_USA := $(LUMA_OUT)/$(MIIVERSE_ID_USA)
MIIVERSE_OUT_EUR := $(LUMA_OUT)/$(MIIVERSE_ID_EUR)

3DS_OUT := out/3ds
LUMA_OUT := out/luma/titles
FRIEND_OUT := $(LUMA_OUT)/$(FRIEND_TITLE_ID)
ACT_OUT := $(LUMA_OUT)/$(ACT_TITLE_ID)
all:
@rm -rf $(OUT_FOLDER)

patches:
@mkdir -p $(FRIEND_OUT) $(ACT_OUT)
@mkdir -p $(3DSX_OUT_FOLDER)/$(FRIENDS_OUT) $(3DSX_OUT_FOLDER)/$(ACT_OUT)
@mkdir -p $(3DSX_OUT_FOLDER)/$(SSL_OUT) $(3DSX_OUT_FOLDER)/$(MIIVERSE_OUT_JPN)
@mkdir -p $(3DSX_OUT_FOLDER)/$(MIIVERSE_OUT_USA) $(3DSX_OUT_FOLDER)/$(MIIVERSE_OUT_EUR)
@mkdir -p $(3DSX_OUT_FOLDER)/$(3DS_OUT) $(CIA_OUT_FOLDER)
@mkdir -p $(CIA_OUT_FOLDER)/$(CIA_OUT)

@$(MAKE) -C patches
@cp -r patches/friends/out/* $(FRIEND_OUT)
@cp -r patches/act/out/* $(ACT_OUT)

@cp -r patches/friends/out/* $(3DSX_OUT_FOLDER)/$(FRIENDS_OUT)
@cp -r patches/act/out/* $(3DSX_OUT_FOLDER)/$(ACT_OUT)
@cp -r patches/ssl/out/* $(3DSX_OUT_FOLDER)/$(SSL_OUT)
@cp -r patches/miiverse/out/* $(3DSX_OUT_FOLDER)/$(MIIVERSE_OUT_JPN)
@cp -r patches/miiverse/out/* $(3DSX_OUT_FOLDER)/$(MIIVERSE_OUT_USA)
@cp -r patches/miiverse/out/* $(3DSX_OUT_FOLDER)/$(MIIVERSE_OUT_EUR)
@cp -r patches/miiverse/*.pem $(3DSX_OUT_FOLDER)/$(3DS_OUT)

@cp -r $(3DSX_OUT_FOLDER)/* $(CIA_OUT_FOLDER)

app:
@$(MAKE) -C app
@mkdir -p $(3DS_OUT)
@cp app/*.3dsx $(3DS_OUT)
@$(MAKE) -C app 3dsx
@echo copied 3dsx to 3dsx out folder...
@cp app/*.3dsx $(3DSX_OUT_FOLDER)/$(3DS_OUT)

@$(MAKE) -C app cia
@echo copied cia to cia out folder...
@cp app/*.cia $(CIA_OUT_FOLDER)/$(CIA_OUT)

clean:
@$(MAKE) -C patches clean
@$(MAKE) -C app clean
@rm -rf out
@rm -rf $(OUT_FOLDER)
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@
## Usage

1. Grab the latest app and IPS patches from the [Releases](https://github.com/PretendoNetwork/nimbus/releases) page
2. Extract to the root of your 3ds SD card
3. Run the Nimbus homebrew and select either to use a Pretendo or Nintendo account
2. Extract to the root of your 3DS SD card
3. Install the Nimbus homebrew using FBI if using the CIA build
4. Run the Nimbus homebrew and select either to use a Pretendo or Nintendo account

## Building

1. Install devkitARM, libctru, [armips](https://github.com/Kingcom/armips), and [flips](https://github.com/Alcaro/Flips)
2. Copy decompressed `code.bin` files from the friends and act sysmodules in their respective `patches` directories
1. Install devkitARM, libctru, [armips](https://github.com/Kingcom/armips), [makerom](https://github.com/3DSGuy/Project_CTR), [bannertool](https://github.com/Steveice10/bannertool) and [flips](https://github.com/Alcaro/Flips)
2. Copy [decompressed `code.bin`](https://github.com/PretendoNetwork/nimbus/blob/main/DECOMPRESSING.md) files from the friends, ssl, miiverse, and act sysmodules in their respective `patches` directories (any Miiverse code.bin works for the miiverse module)
3. Run `make`

## Credits

Thanks to:

- [pinklimes](https://github.com/gitlimes) for the CIA version banner
- [TraceEntertains](https://github.com/TraceEntertains) for making a CIA version of Nimbus and a few other things
- [SciresM](https://github.com/SciresM) for making the 3DS SSL patches
- [zaksabeast](https://github.com/zaksabeast) for the original 3ds-Friend-Account-Manager and all the research into the friends and act system titles
- [shutterbug2000](https://github.com/shutterbug2000) for the GUI
- [libctru](https://github.com/devkitPro/libctru) for the `frda.c` base, homebrew template, and all of the library functions
- All 3ds researchers
- All other 3DS researchers
102 changes: 75 additions & 27 deletions app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,37 +31,48 @@ include $(DEVKITARM)/3ds_rules
# - icon.png
# - <libctru folder>/default_icon.png
#---------------------------------------------------------------------------------
APP_TITLE := Nimbus
APP_DESCRIPTION := Pretendo account manager
APP_AUTHOR := Zaksabeast, shutterbug2000
APP_TITLE := Nimbus
APP_DESCRIPTION := Nimbus
APP_AUTHOR := Zaksabeast, shutterbug2000
TARGET := nimbus
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
GRAPHICS := gfx
GFXBUILD := $(BUILD)
ROMFS := romfs
GRAPHICS := $(ROMFS)/gfx
GFXBUILD := $(BUILD)

RSF_FILE := meta/nimbus-cia.rsf

ICON := meta/icon.png
BNR_IMAGE := meta/banner.png
BNR_AUDIO := meta/audio.wav

VERSION_MAJOR := 1
VERSION_MINOR := 0
VERSION_MICRO := 2

#ROMFS := romfs
#GFXBUILD := $(ROMFS)/gfx

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
OPTIMIZE := -O2
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft

CFLAGS := -g -Wall -O2 -mword-relocations \
-ffunction-sections \
$(ARCH)
CFLAGS := -g -Wall $(OPTIMIZE) -mword-relocations \
-ffunction-sections \
$(ARCH)

CFLAGS += $(INCLUDE) -D__3DS__
CFLAGS += $(INCLUDE) -D__3DS__

CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11

ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) $(OPTIMIZE)

LIBS := -lcitro2d -lcitro3d -lctru -lm
LIBS := -lcitro2d -lcitro3d -lctru -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
Expand Down Expand Up @@ -166,7 +177,7 @@ endif

#---------------------------------------------------------------------------------
all: $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES)
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@'$(MAKE)' --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

$(BUILD):
@mkdir -p $@
Expand All @@ -182,28 +193,52 @@ $(DEPSDIR):
endif

#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).3dsx $(OUTPUT).smdh $(TARGET).elf $(GFXBUILD)

#---------------------------------------------------------------------------------
$(GFXBUILD)/%.t3x $(BUILD)/%.h : %.t3s
$(GFXBUILD)/%.t3x $(BUILD)/%.h: %.t3s
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@tex3ds -i $< -H $(BUILD)/$*.h -d $(DEPSDIR)/$*.d -o $(GFXBUILD)/$*.t3x

3dsx: $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES)
@'$(MAKE)' --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 3dsx

cia: $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES)
@'$(MAKE)' --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile cia

3dslink: 3dsx
@3dslink $(OUTPUT).3dsx

#---------------------------------------------------------------------------------
else
clean:
@echo clean ...
@$(RM) -r $(BUILD) \
$(TARGET).3dsx \
$(OUTPUT).smdh \
$(TARGET).elf \
$(TARGET).cia

#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).3dsx : $(OUTPUT).elf $(_3DSXDEPS)
all: 3dsx cia

3dsx: $(OUTPUT).3dsx

$(OFILES_SOURCES) : $(HFILES)
cia: $(OUTPUT).cia

$(OUTPUT).elf : $(OFILES)
ifeq ($(strip $(NO_SMDH)),)
.PHONY: all
all: $(OUTPUT).3dsx $(OUTPUT).smdh
$(OUTPUT).smdh: $(TOPDIR)/Makefile $(TOPDIR)/Makefile
$(OUTPUT).3dsx: $(OUTPUT).smdh
endif

$(OUTPUT).3dsx: $(OUTPUT).elf $(_3DSXDEPS)

$(OFILES_SOURCES): $(HFILES)

$(OUTPUT).elf: $(OFILES)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
Expand Down Expand Up @@ -251,9 +286,22 @@ endef
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@tex3ds -i $< -H $*.h -d $*.d -o $*.t3x

$(OUTPUT).cia: $(OUTPUT).elf $(OUTPUT).smdh $(TARGET).bnr $(TOPDIR)/$(RSF_FILE)
@makerom -f cia -target t -exefslogo -o $@ \
-elf $(OUTPUT).elf -rsf $(TOPDIR)/$(RSF_FILE) \
-ver "$$(($(VERSION_MAJOR)*1024+$(VERSION_MINOR)*16+$(VERSION_MICRO)))" \
-banner $(TARGET).bnr \
-icon $(OUTPUT).smdh
@echo "built ... $(notdir $@)"

$(TARGET).bnr: $(TOPDIR)/$(BNR_IMAGE) $(TOPDIR)/$(BNR_AUDIO)
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
@bannertool makebanner -o $@ -i $(TOPDIR)/$(BNR_IMAGE) -a $(TOPDIR)/$(BNR_AUDIO)
@echo "built ... $@"

-include $(DEPSDIR)/*.d

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------
Binary file added app/meta/audio.wav
Binary file not shown.
Binary file added app/meta/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading

0 comments on commit 2f10aef

Please sign in to comment.