Add old files
This commit is contained in:
commit
f5b8d1cdf2
19 changed files with 695 additions and 0 deletions
39
.gitignore
vendored
Normal file
39
.gitignore
vendored
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
!/tools/*
|
||||||
|
|
||||||
|
# custom 3ds guff
|
||||||
|
build/
|
||||||
|
output/
|
||||||
|
*.smdh
|
||||||
|
*.zip
|
||||||
|
*.cia
|
||||||
|
*.elf
|
||||||
|
*.3dsx
|
19
LICENSE
Normal file
19
LICENSE
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Copyright (c) 2016 Joshua Goins
|
||||||
|
|
||||||
|
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
|
||||||
|
SOFTWARE.
|
226
Makefile
Normal file
226
Makefile
Normal file
|
@ -0,0 +1,226 @@
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Environment Setup
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
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
|
||||||
|
|
||||||
|
include $(DEVKITARM)/3ds_rules
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Directory Setup
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
BUILD := build
|
||||||
|
OUTPUT := output
|
||||||
|
RESOURCES := resources
|
||||||
|
DATA := data
|
||||||
|
ROMFS := romfs
|
||||||
|
SOURCES := source
|
||||||
|
INCLUDES := $(SOURCES) include
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Resource Setup
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
APP_INFO := $(RESOURCES)/AppInfo
|
||||||
|
BANNER_AUDIO := $(RESOURCES)/audio
|
||||||
|
BANNER_IMAGE := $(RESOURCES)/banner
|
||||||
|
ICON := $(RESOURCES)/icon.png
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Build Setup
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard
|
||||||
|
|
||||||
|
COMMON_FLAGS := -g -Wall -Wno-strict-aliasing -O3 -mword-relocations -fomit-frame-pointer -ffast-math $(ARCH) $(INCLUDE) -DARM11 -D_3DS $(BUILD_FLAGS) -fpermissive
|
||||||
|
CFLAGS := $(COMMON_FLAGS) -std=gnu99
|
||||||
|
CXXFLAGS := $(COMMON_FLAGS) -std=c++11
|
||||||
|
ifeq ($(ENABLE_EXCEPTIONS),)
|
||||||
|
CXXFLAGS += -fno-rtti -fno-exceptions
|
||||||
|
endif
|
||||||
|
|
||||||
|
ASFLAGS := -g $(ARCH)
|
||||||
|
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
||||||
|
|
||||||
|
LIBS := -lctru -lm
|
||||||
|
LIBDIRS := $(PORTLIBS) $(CTRULIB) ./lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Build Variable Setup
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
recurse = $(shell find $2 -type $1 -name '$3' 2> /dev/null)
|
||||||
|
|
||||||
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.c)))
|
||||||
|
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.cpp)))
|
||||||
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.s)))
|
||||||
|
PICAFILES := $(foreach dir,$(SOURCES),$(notdir $(call recurse,f,$(dir),*.pica)))
|
||||||
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(call recurse,f,$(dir),*.*)))
|
||||||
|
|
||||||
|
export OFILES := $(addsuffix .o,$(BINFILES)) $(PICAFILES:.pica=.shbin.o) $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
||||||
|
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)
|
||||||
|
|
||||||
|
ifeq ($(strip $(CPPFILES)),)
|
||||||
|
export LD := $(CC)
|
||||||
|
else
|
||||||
|
export LD := $(CXX)
|
||||||
|
endif
|
||||||
|
|
||||||
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
||||||
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir) $(call recurse,d,$(CURDIR)/$(dir),*)) $(foreach dir,$(DATA),$(CURDIR)/$(dir) $(call recurse,d,$(CURDIR)/$(dir),*))
|
||||||
|
|
||||||
|
export TOPDIR := $(CURDIR)
|
||||||
|
|
||||||
|
.PHONY: $(BUILD) clean all
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Initial Targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
all: $(BUILD)
|
||||||
|
|
||||||
|
$(BUILD):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo clean ...
|
||||||
|
@rm -fr $(BUILD) $(OUTPUT)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
else
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Build Information Setup
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
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)
|
||||||
|
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
|
||||||
|
|
||||||
|
EMPTY :=
|
||||||
|
SPACE := $(EMPTY) $(EMPTY)
|
||||||
|
OUTPUT_NAME := $(subst $(SPACE),,$(APP_TITLE))
|
||||||
|
OUTPUT_DIR := $(TOPDIR)/$(OUTPUT)
|
||||||
|
OUTPUT_FILE := $(OUTPUT_DIR)/$(OUTPUT_NAME)
|
||||||
|
|
||||||
|
APP_ICON := $(TOPDIR)/$(ICON)
|
||||||
|
APP_ROMFS := $(TOPDIR)/$(ROMFS)
|
||||||
|
|
||||||
|
RSF := $(TOPDIR)/tools/template.rsf
|
||||||
|
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"
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
MAKEROM = $(TOPDIR)/tools/makerom.exe
|
||||||
|
BANNERTOOL = $(TOPDIR)/tools/bannertool.exe
|
||||||
|
else
|
||||||
|
UNAME_S := $(shell uname -s)
|
||||||
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
MAKEROM = $(TOPDIR)/tools/makerom-linux
|
||||||
|
BANNERTOOL = $(TOPDIR)/tools/bannertool-linux
|
||||||
|
endif
|
||||||
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
MAKEROM = $(TOPDIR)/tools/makerom-mac
|
||||||
|
BANNERTOOL = $(TOPDIR)/tools/bannertool-mac
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
ZIP_CMD = $(TOPDIR)/tools/7za.exe a -tzip $(OUTPUT_FILE).zip $(OUTPUT_NAME).elf $(OUTPUT_NAME).3ds $(OUTPUT_NAME).cia
|
||||||
|
DEL_CMD = rm -r $(TOPDIR)/output/3ds
|
||||||
|
else
|
||||||
|
ZIP_CMD = zip -r $(OUTPUT_FILE).zip $(OUTPUT_NAME).elf $(OUTPUT_NAME).3ds $(OUTPUT_NAME).cia 3ds > /dev/null; \
|
||||||
|
DEL_CMD = rm -r 3ds
|
||||||
|
endif
|
||||||
|
|
||||||
|
_3DSXFLAGS += --smdh=$(OUTPUT_FILE).smdh
|
||||||
|
ifneq ("$(wildcard $(TOPDIR)/$(ROMFS))","")
|
||||||
|
_3DSXFLAGS += --romfs=$(TOPDIR)/$(ROMFS)
|
||||||
|
endif
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Main Targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
.PHONY: all
|
||||||
|
all: $(OUTPUT_FILE).zip
|
||||||
|
|
||||||
|
$(OUTPUT_DIR):
|
||||||
|
@[ -d $@ ] || mkdir -p $@
|
||||||
|
|
||||||
|
banner.bnr: $(BANNER_IMAGE_FILE) $(BANNER_AUDIO_FILE)
|
||||||
|
@$(BANNERTOOL) makebanner $(BANNER_IMAGE_ARG) $(BANNER_AUDIO_ARG) -o banner.bnr > /dev/null
|
||||||
|
|
||||||
|
icon.icn: $(TOPDIR)/$(ICON)
|
||||||
|
@$(BANNERTOOL) makesmdh -s "$(APP_TITLE)" -l "$(APP_TITLE)" -p "$(APP_AUTHOR)" -i $(TOPDIR)/$(ICON) -o icon.icn > /dev/null
|
||||||
|
|
||||||
|
$(OUTPUT_FILE).elf: $(OFILES)
|
||||||
|
|
||||||
|
$(OUTPUT_FILE).3dsx: $(OUTPUT_FILE).elf
|
||||||
|
|
||||||
|
$(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_DIR) $(OUTPUT_FILE).elf $(OUTPUT_FILE).smdh $(OUTPUT_FILE).3dsx $(OUTPUT_FILE).3ds $(OUTPUT_FILE).cia
|
||||||
|
@cd $(OUTPUT_DIR); \
|
||||||
|
mkdir -p 3ds/$(OUTPUT_NAME); \
|
||||||
|
cp $(OUTPUT_FILE).3dsx 3ds/$(OUTPUT_NAME); \
|
||||||
|
cp $(OUTPUT_FILE).smdh 3ds/$(OUTPUT_NAME); \
|
||||||
|
$(ZIP_CMD)
|
||||||
|
$(DEL_CMD)
|
||||||
|
@echo "built ... $(notdir $@)"
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# Binary Data Rules
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
%.bin.o: %.bin
|
||||||
|
@echo $(notdir $<)
|
||||||
|
@$(bin2o)
|
||||||
|
|
||||||
|
%.shbin.o: %.pica
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(eval CURBIN := $(patsubst %.pica,%.shbin,$(notdir $<)))
|
||||||
|
$(eval CURH := $(patsubst %.pica,%.psh.h,$(notdir $<)))
|
||||||
|
@picasso -h $(CURH) -o $(CURBIN) $<
|
||||||
|
@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
|
||||||
|
|
||||||
|
-include $(DEPENDS)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
endif
|
||||||
|
#---------------------------------------------------------------------------------
|
25
README.md
Normal file
25
README.md
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# arm9switcher
|
||||||
|
|
||||||
|
(This is a project from February 2016)
|
||||||
|
|
||||||
|
A payload switcher for arm9loaderhax with it's only purpose is to switch two files. You can change the default file names in the defines at the top of the source file.
|
||||||
|
|
||||||
|
`#define EMUNAND_BIN "arm9loaderhax_emunand.bin"`
|
||||||
|
|
||||||
|
`#define SYSNAND_BIN "arm9loaderhax_sysnand.bin"`
|
||||||
|
|
||||||
|
`#define PAYLOAD_BIN "arm9loaderhax.bin"`
|
||||||
|
|
||||||
|
Precompiled builds can be found at the [Releases](https://github.com/thatbooisaspy/arm9switcher/releases) page.
|
||||||
|
|
||||||
|
# Building
|
||||||
|
Just run make inside the root directory.
|
||||||
|
|
||||||
|
`make`
|
||||||
|
|
||||||
|
Binary files (.cia, .3dsx, .elf) will show up in the `output` directory.
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
* Uses [thedax's homebrew template](https://github.com/thedax/3DSHomebrewTemplate) with a updated makerom and zip support on windows.
|
||||||
|
* Thanks to the contributors of [ctrulib](https://github.com/smealum/ctrulib)
|
||||||
|
* [Apache Thunder for the idea](https://gbatemp.net/threads/post-homebrew-ideas-suggestion-requests-here.370320/page-70#post-6085934)
|
5
resources/AppInfo
Normal file
5
resources/AppInfo
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
APP_TITLE = Arm9Switcher
|
||||||
|
APP_DESCRIPTION = Switches arm9 payloads
|
||||||
|
APP_AUTHOR = boo
|
||||||
|
APP_PRODUCT_CODE = CTR-P-SWTC
|
||||||
|
APP_UNIQUE_ID = 0x1182
|
BIN
resources/audio.wav
Normal file
BIN
resources/audio.wav
Normal file
Binary file not shown.
BIN
resources/banner.png
Normal file
BIN
resources/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
resources/icon.png
Normal file
BIN
resources/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 237 B |
162
source/main.cpp
Normal file
162
source/main.cpp
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
#include <3ds.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
//Filenames
|
||||||
|
#define EMUNAND_BIN "arm9loaderhax_emunand.bin"
|
||||||
|
#define SYSNAND_BIN "arm9loaderhax_sysnand.bin"
|
||||||
|
#define PAYLOAD_BIN "arm9loaderhax.bin"
|
||||||
|
|
||||||
|
//Options
|
||||||
|
#define USERINPUT true
|
||||||
|
|
||||||
|
bool choice(const char* msg, const char* ch1, const char* ch2) {
|
||||||
|
printf(msg);
|
||||||
|
printf(ch1);
|
||||||
|
printf(ch2);
|
||||||
|
|
||||||
|
while(aptMainLoop()) {
|
||||||
|
gspWaitForVBlank();
|
||||||
|
hidScanInput();
|
||||||
|
|
||||||
|
if(hidKeysDown() & KEY_A) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hidKeysDown() & KEY_B) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
gfxFlushBuffers();
|
||||||
|
gfxSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool fileExists(const char* path) {
|
||||||
|
if( access( path, F_OK ) != -1 ) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void changetoEmunand() {
|
||||||
|
printf("Changing to emunand...\n");
|
||||||
|
|
||||||
|
//TODO: Prompt user for conflict
|
||||||
|
if(fileExists(SYSNAND_BIN)) {
|
||||||
|
if(choice("Already existing sysnand bin! Remove?\n", "A: Yes\n", "B: No\n")) {
|
||||||
|
remove(SYSNAND_BIN);
|
||||||
|
printf("Removed existing sysnand bin...\n");
|
||||||
|
} else {
|
||||||
|
printf("Cancelling...\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Rename files
|
||||||
|
bool a = rename(PAYLOAD_BIN, SYSNAND_BIN);
|
||||||
|
if(!a) {
|
||||||
|
printf("Error while renaming file!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
rename(EMUNAND_BIN, PAYLOAD_BIN);
|
||||||
|
|
||||||
|
//Die
|
||||||
|
printf("Successfully changed payload to emunand!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void changetoSysnand() {
|
||||||
|
printf("Changing to sysnand...\n");
|
||||||
|
|
||||||
|
//TODO: Prompt user for conflict
|
||||||
|
if(fileExists(EMUNAND_BIN)) {
|
||||||
|
if(choice("Already existing emunand bin! Remove?\n", "A: Yes\n", "B: No\n")) {
|
||||||
|
remove(EMUNAND_BIN);
|
||||||
|
printf("Removed existing emunand bin...\n");
|
||||||
|
} else {
|
||||||
|
printf("Cancelling...\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Rename files
|
||||||
|
bool a = rename(PAYLOAD_BIN, EMUNAND_BIN);
|
||||||
|
if(!a) {
|
||||||
|
printf("Error while renaming file!\n");
|
||||||
|
}
|
||||||
|
rename(SYSNAND_BIN, PAYLOAD_BIN);
|
||||||
|
|
||||||
|
//Die
|
||||||
|
printf("Successfully changed payload to sysnand!");
|
||||||
|
}
|
||||||
|
|
||||||
|
void scan() {
|
||||||
|
//Checks if this exists at all
|
||||||
|
if(fileExists(PAYLOAD_BIN)) {
|
||||||
|
printf("Found arm9loaderhax.bin\n");
|
||||||
|
|
||||||
|
//Change to emunand
|
||||||
|
if(fileExists(EMUNAND_BIN)) {
|
||||||
|
printf("Found emunand bin!\n");
|
||||||
|
changetoEmunand();
|
||||||
|
} else {
|
||||||
|
//Change to sysnand
|
||||||
|
if(fileExists(SYSNAND_BIN)) {
|
||||||
|
printf("Found sysnand bin!\n");
|
||||||
|
changetoSysnand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//If both files exist, default to sysnand
|
||||||
|
if(fileExists(EMUNAND_BIN) && fileExists(SYSNAND_BIN)) {
|
||||||
|
printf("Changing to sysnand...\n");
|
||||||
|
|
||||||
|
//Rename files
|
||||||
|
rename(SYSNAND_BIN, PAYLOAD_BIN);
|
||||||
|
|
||||||
|
//Die
|
||||||
|
printf("Successfully changed payload to sysnand!");
|
||||||
|
} else {
|
||||||
|
//Redundant?
|
||||||
|
if(fileExists(SYSNAND_BIN)) {
|
||||||
|
changetoSysnand();
|
||||||
|
} else {
|
||||||
|
//Try emunand bin
|
||||||
|
if(fileExists(EMUNAND_BIN)) {
|
||||||
|
changetoEmunand();
|
||||||
|
} else {
|
||||||
|
//Die
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
gfxInitDefault();
|
||||||
|
consoleInit(GFX_BOTTOM, NULL);
|
||||||
|
|
||||||
|
printf("Checking for files on SD card...\n");
|
||||||
|
|
||||||
|
scan();
|
||||||
|
|
||||||
|
if(USERINPUT) {
|
||||||
|
printf("Press START to exit.");
|
||||||
|
|
||||||
|
while(aptMainLoop()) {
|
||||||
|
gspWaitForVBlank();
|
||||||
|
hidScanInput();
|
||||||
|
|
||||||
|
if(hidKeysDown() & KEY_START)
|
||||||
|
break;
|
||||||
|
|
||||||
|
gfxFlushBuffers();
|
||||||
|
gfxSwapBuffers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gfxExit();
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
tools/7za.dll
Normal file
BIN
tools/7za.dll
Normal file
Binary file not shown.
BIN
tools/7za.exe
Normal file
BIN
tools/7za.exe
Normal file
Binary file not shown.
BIN
tools/7zxa.dll
Normal file
BIN
tools/7zxa.dll
Normal file
Binary file not shown.
BIN
tools/bannertool-linux
Normal file
BIN
tools/bannertool-linux
Normal file
Binary file not shown.
BIN
tools/bannertool-mac
Normal file
BIN
tools/bannertool-mac
Normal file
Binary file not shown.
BIN
tools/bannertool.exe
Normal file
BIN
tools/bannertool.exe
Normal file
Binary file not shown.
BIN
tools/makerom-linux
Normal file
BIN
tools/makerom-linux
Normal file
Binary file not shown.
BIN
tools/makerom-mac
Normal file
BIN
tools/makerom-mac
Normal file
Binary file not shown.
BIN
tools/makerom.exe
Normal file
BIN
tools/makerom.exe
Normal file
Binary file not shown.
219
tools/template.rsf
Normal file
219
tools/template.rsf
Normal file
|
@ -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, <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
|
Reference in a new issue