├── icon.jpg ├── source └── main.cpp ├── README.md └── Makefile /icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klockee/EasyPower/HEAD/icon.jpg -------------------------------------------------------------------------------- /source/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | int main(int argc, char **argv) 7 | { 8 | gfxInitDefault(); 9 | consoleInit(NULL); 10 | bpcInitialize(); 11 | bpcRebootSystem(); 12 | return 0; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EasyPower 2 | ![Icon](https://raw.githubusercontent.com/klockee/EasyPower/master/icon.jpg) 3 | 4 | A quick utility to reboot the Nintendo Switch - load the .nro through hbmenu or any other method to reboot the console immediately. 5 | 6 | An installable version created with The-4n's [hacBrewPack](https://github.com/The-4n/hacBrewPack) is also available, which has the titleID 0104561737950000. 7 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------------------------------- 2 | .SUFFIXES: 3 | #--------------------------------------------------------------------------------- 4 | 5 | ifeq ($(strip $(DEVKITPRO)),) 6 | $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro") 7 | endif 8 | 9 | TOPDIR ?= $(CURDIR) 10 | include $(DEVKITPRO)/libnx/switch_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 | # EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm". 19 | # ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional) 20 | # 21 | # NO_ICON: if set to anything, do not use icon. 22 | # NO_NACP: if set to anything, no .nacp file is generated. 23 | # APP_TITLE is the name of the app stored in the .nacp file (Optional) 24 | # APP_AUTHOR is the author of the app stored in the .nacp file (Optional) 25 | # APP_VERSION is the version of the app stored in the .nacp file (Optional) 26 | # APP_TITLEID is the titleID of the app stored in the .nacp file (Optional) 27 | # ICON is the filename of the icon (.jpg), relative to the project folder. 28 | # If not set, it attempts to use one of the following (in this order): 29 | # - .jpg 30 | # - icon.jpg 31 | # - /default_icon.jpg 32 | #--------------------------------------------------------------------------------- 33 | APP_TITLE := EasyPower 34 | APP_AUTHOR := klock 35 | APP_VERSION := 0.2 36 | APP_TITLEID := 0104561737950000 37 | ICON := icon.jpg 38 | 39 | TARGET := $(notdir $(CURDIR)) 40 | BUILD := build 41 | SOURCES := source 42 | DATA := data 43 | INCLUDES := include 44 | EXEFS_SRC := exefs_src 45 | #ROMFS := romfs 46 | 47 | #--------------------------------------------------------------------------------- 48 | # options for code generation 49 | #--------------------------------------------------------------------------------- 50 | ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE 51 | 52 | CFLAGS := -g -Wall -O2 -ffunction-sections \ 53 | $(ARCH) $(DEFINES) 54 | 55 | CFLAGS += $(INCLUDE) -D__SWITCH__ 56 | 57 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions -std=gnu++11 58 | 59 | ASFLAGS := -g $(ARCH) 60 | LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map) 61 | 62 | LIBS := -lnx 63 | 64 | #--------------------------------------------------------------------------------- 65 | # list of directories containing libraries, this must be the top level containing 66 | # include and lib 67 | #--------------------------------------------------------------------------------- 68 | LIBDIRS := $(PORTLIBS) $(LIBNX) 69 | 70 | 71 | #--------------------------------------------------------------------------------- 72 | # no real need to edit anything past this point unless you need to add additional 73 | # rules for different file extensions 74 | #--------------------------------------------------------------------------------- 75 | ifneq ($(BUILD),$(notdir $(CURDIR))) 76 | #--------------------------------------------------------------------------------- 77 | 78 | export OUTPUT := $(CURDIR)/$(TARGET) 79 | export TOPDIR := $(CURDIR) 80 | 81 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ 82 | $(foreach dir,$(DATA),$(CURDIR)/$(dir)) 83 | 84 | export DEPSDIR := $(CURDIR)/$(BUILD) 85 | 86 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) 87 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) 88 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 89 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) 90 | 91 | #--------------------------------------------------------------------------------- 92 | # use CXX for linking C++ projects, CC for standard C 93 | #--------------------------------------------------------------------------------- 94 | ifeq ($(strip $(CPPFILES)),) 95 | #--------------------------------------------------------------------------------- 96 | export LD := $(CC) 97 | #--------------------------------------------------------------------------------- 98 | else 99 | #--------------------------------------------------------------------------------- 100 | export LD := $(CXX) 101 | #--------------------------------------------------------------------------------- 102 | endif 103 | #--------------------------------------------------------------------------------- 104 | 105 | export OFILES_BIN := $(addsuffix .o,$(BINFILES)) 106 | export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) 107 | export OFILES := $(OFILES_BIN) $(OFILES_SRC) 108 | export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) 109 | 110 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ 111 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ 112 | -I$(CURDIR)/$(BUILD) 113 | 114 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) 115 | 116 | export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC) 117 | 118 | ifeq ($(strip $(ICON)),) 119 | icons := $(wildcard *.jpg) 120 | ifneq (,$(findstring $(TARGET).jpg,$(icons))) 121 | export APP_ICON := $(TOPDIR)/$(TARGET).jpg 122 | else 123 | ifneq (,$(findstring icon.jpg,$(icons))) 124 | export APP_ICON := $(TOPDIR)/icon.jpg 125 | endif 126 | endif 127 | else 128 | export APP_ICON := $(TOPDIR)/$(ICON) 129 | endif 130 | 131 | ifeq ($(strip $(NO_ICON)),) 132 | export NROFLAGS += --icon=$(APP_ICON) 133 | endif 134 | 135 | ifeq ($(strip $(NO_NACP)),) 136 | export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp 137 | endif 138 | 139 | ifneq ($(APP_TITLEID),) 140 | export NACPFLAGS += --titleid=$(APP_TITLEID) 141 | endif 142 | 143 | ifneq ($(ROMFS),) 144 | export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS) 145 | endif 146 | 147 | .PHONY: $(BUILD) clean all 148 | 149 | #--------------------------------------------------------------------------------- 150 | all: $(BUILD) 151 | 152 | $(BUILD): 153 | @[ -d $@ ] || mkdir -p $@ 154 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile 155 | 156 | #--------------------------------------------------------------------------------- 157 | clean: 158 | @echo clean ... 159 | @rm -fr $(BUILD) $(TARGET).pfs0 $(TARGET).nso $(TARGET).nro $(TARGET).nacp $(TARGET).elf 160 | 161 | 162 | #--------------------------------------------------------------------------------- 163 | else 164 | .PHONY: all 165 | 166 | DEPENDS := $(OFILES:.o=.d) 167 | 168 | #--------------------------------------------------------------------------------- 169 | # main targets 170 | #--------------------------------------------------------------------------------- 171 | all : $(OUTPUT).pfs0 $(OUTPUT).nro 172 | 173 | $(OUTPUT).pfs0 : $(OUTPUT).nso 174 | 175 | $(OUTPUT).nso : $(OUTPUT).elf 176 | 177 | ifeq ($(strip $(NO_NACP)),) 178 | $(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp 179 | else 180 | $(OUTPUT).nro : $(OUTPUT).elf 181 | endif 182 | 183 | $(OUTPUT).elf : $(OFILES) 184 | 185 | $(OFILES_SRC) : $(HFILES_BIN) 186 | 187 | #--------------------------------------------------------------------------------- 188 | # you need a rule like this for each extension you use as binary data 189 | #--------------------------------------------------------------------------------- 190 | %.bin.o %_bin.h : %.bin 191 | #--------------------------------------------------------------------------------- 192 | @echo $(notdir $<) 193 | @$(bin2o) 194 | 195 | -include $(DEPENDS) 196 | 197 | #--------------------------------------------------------------------------------------- 198 | endif 199 | #--------------------------------------------------------------------------------------- 200 | --------------------------------------------------------------------------------