Skip to content

Commit 8e764dc

Browse files
authored
Add support for Horizon 21.x, add ROM source code (#36)
1 parent 94d45dc commit 8e764dc

File tree

11 files changed

+1145
-3
lines changed

11 files changed

+1145
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ There are numerous reasons why this could be, see the following main reasons:
188188
forwarder has a hardcoded file path that it loads the NRO from when launched.
189189
2. You may have since updated Atmosphere or your Firmware which broke the changes you made to the bootloader that enabled
190190
the use of custom NSP files. As this project does not support piracy on any Nintendo system, support is not provided.
191-
4. It's possible a firmware update has broken the [forwarder ROM][ROM] that is used and needs
192-
to be updated. Both Firmware 9.0.0, 12.0.0 and 19.0.0 have previously broken different forwarder ROMs requiring updates.
193-
If you believe this to be the case then please make an Issue.
191+
4. It's possible a firmware update has broken the Forwarder ROM binary (source under /rom in this repo) and needs
192+
to be re-compiled against a newer libnx / devkitpro version. Firmware 9.0.0, 12.0.0, 19.0.0, and 21.0.0 have previously
193+
broken different forwarder ROMs requiring updates. If you believe this to be the case then please make an Issue.
194194

195195
If after reading all of these troubleshooting steps, you still cannot get the NSP forwarder to work, then I do not
196196
recommend the use of them and instead recommend using the Homebrew launcher from the album or from title takeover
@@ -263,3 +263,4 @@ binaries within the bin folder.
263263
* * *
264264

265265
© rlaphoenix 2022-2025
266+

nton/assets/exefs/main

-1.81 KB
Binary file not shown.

nton/assets/exefs/main.npdm

0 Bytes
Binary file not shown.

rom/LICENSE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Copyright 2017-2018 nx-hbloader Authors
2+
3+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4+
5+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

rom/Makefile

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
#---------------------------------------------------------------------------------
2+
.SUFFIXES:
3+
#---------------------------------------------------------------------------------
4+
5+
ifeq ($(strip $(DEVKITPRO)),)
6+
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/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+
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
19+
#
20+
# NO_ICON: if set to anything, do not use icon.
21+
# NO_NACP: if set to anything, no .nacp file is generated.
22+
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
23+
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
24+
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
25+
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
26+
# ICON is the filename of the icon (.jpg), relative to the project folder.
27+
# If not set, it attempts to use one of the following (in this order):
28+
# - <Project name>.jpg
29+
# - icon.jpg
30+
# - <libnx folder>/default_icon.jpg
31+
#
32+
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
33+
# If not set, it attempts to use one of the following (in this order):
34+
# - <Project name>.json
35+
# - config.json
36+
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
37+
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
38+
# NACP building is skipped as well.
39+
#---------------------------------------------------------------------------------
40+
TARGET := hbl
41+
BUILD := build
42+
SOURCES := source
43+
DATA := data
44+
INCLUDES := include
45+
ROMFS := romfs
46+
APP_VERSION := 2.4.5
47+
48+
ifeq ($(RELEASE),)
49+
APP_VERSION := $(APP_VERSION)-$(shell git describe --dirty --always)
50+
endif
51+
52+
#---------------------------------------------------------------------------------
53+
# options for code generation
54+
#---------------------------------------------------------------------------------
55+
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
56+
57+
CFLAGS := -g -Wall -O2 -ffunction-sections \
58+
$(ARCH) $(DEFINES)
59+
60+
CFLAGS += $(INCLUDE) -D__SWITCH__ -DVERSION=\"v$(APP_VERSION)\"
61+
62+
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
63+
64+
ASFLAGS := -g $(ARCH)
65+
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-wrap,exit -Wl,-Map,$(notdir $*.map)
66+
67+
LIBS := -lnx
68+
69+
#---------------------------------------------------------------------------------
70+
# list of directories containing libraries, this must be the top level containing
71+
# include and lib
72+
#---------------------------------------------------------------------------------
73+
LIBDIRS := $(PORTLIBS) $(LIBNX)
74+
75+
76+
#---------------------------------------------------------------------------------
77+
# no real need to edit anything past this point unless you need to add additional
78+
# rules for different file extensions
79+
#---------------------------------------------------------------------------------
80+
ifneq ($(BUILD),$(notdir $(CURDIR)))
81+
#---------------------------------------------------------------------------------
82+
83+
export OUTPUT := $(CURDIR)/$(TARGET)
84+
export TOPDIR := $(CURDIR)
85+
86+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
87+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
88+
89+
export DEPSDIR := $(CURDIR)/$(BUILD)
90+
91+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
92+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
93+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
94+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
95+
96+
#---------------------------------------------------------------------------------
97+
# use CXX for linking C++ projects, CC for standard C
98+
#---------------------------------------------------------------------------------
99+
ifeq ($(strip $(CPPFILES)),)
100+
#---------------------------------------------------------------------------------
101+
export LD := $(CC)
102+
#---------------------------------------------------------------------------------
103+
else
104+
#---------------------------------------------------------------------------------
105+
export LD := $(CXX)
106+
#---------------------------------------------------------------------------------
107+
endif
108+
#---------------------------------------------------------------------------------
109+
110+
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
111+
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
112+
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
113+
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
114+
115+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
116+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
117+
-I$(CURDIR)/$(BUILD)
118+
119+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
120+
121+
ifeq ($(strip $(CONFIG_JSON)),)
122+
jsons := $(wildcard *.json)
123+
ifneq (,$(findstring $(TARGET).json,$(jsons)))
124+
export APP_JSON := $(TOPDIR)/$(TARGET).json
125+
else
126+
ifneq (,$(findstring config.json,$(jsons)))
127+
export APP_JSON := $(TOPDIR)/config.json
128+
endif
129+
endif
130+
else
131+
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
132+
endif
133+
134+
ifeq ($(strip $(ICON)),)
135+
icons := $(wildcard *.jpg)
136+
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
137+
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
138+
else
139+
ifneq (,$(findstring icon.jpg,$(icons)))
140+
export APP_ICON := $(TOPDIR)/icon.jpg
141+
endif
142+
endif
143+
else
144+
export APP_ICON := $(TOPDIR)/$(ICON)
145+
endif
146+
147+
ifeq ($(strip $(NO_ICON)),)
148+
export NROFLAGS += --icon=$(APP_ICON)
149+
endif
150+
151+
ifeq ($(strip $(NO_NACP)),)
152+
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
153+
endif
154+
155+
ifneq ($(APP_TITLEID),)
156+
export NACPFLAGS += --titleid=$(APP_TITLEID)
157+
endif
158+
159+
ifneq ($(ROMFS),)
160+
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
161+
endif
162+
163+
.PHONY: $(BUILD) clean all
164+
165+
#---------------------------------------------------------------------------------
166+
all: $(BUILD)
167+
168+
$(BUILD):
169+
@[ -d $@ ] || mkdir -p $@
170+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
171+
172+
#---------------------------------------------------------------------------------
173+
clean:
174+
@echo clean ...
175+
ifeq ($(strip $(APP_JSON)),)
176+
@rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
177+
else
178+
@rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
179+
endif
180+
181+
182+
#---------------------------------------------------------------------------------
183+
else
184+
.PHONY: all
185+
186+
DEPENDS := $(OFILES:.o=.d)
187+
188+
#---------------------------------------------------------------------------------
189+
# main targets
190+
#---------------------------------------------------------------------------------
191+
ifeq ($(strip $(APP_JSON)),)
192+
193+
all : $(OUTPUT).nro
194+
195+
ifeq ($(strip $(NO_NACP)),)
196+
$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
197+
else
198+
$(OUTPUT).nro : $(OUTPUT).elf
199+
endif
200+
201+
else
202+
203+
all : $(OUTPUT).nsp
204+
205+
$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm
206+
207+
$(OUTPUT).nso : $(OUTPUT).elf
208+
209+
endif
210+
211+
$(OUTPUT).elf : $(OFILES)
212+
213+
$(OFILES_SRC) : $(HFILES_BIN)
214+
215+
#---------------------------------------------------------------------------------
216+
# you need a rule like this for each extension you use as binary data
217+
#---------------------------------------------------------------------------------
218+
%.bin.o %_bin.h : %.bin
219+
#---------------------------------------------------------------------------------
220+
@echo $(notdir $<)
221+
@$(bin2o)
222+
223+
-include $(DEPENDS)
224+
225+
#---------------------------------------------------------------------------------------
226+
endif
227+
#---------------------------------------------------------------------------------------

rom/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Forwarder Template ROM Source - Based on Forwarder-Mod of nx-hbloader
2+
Host process for loading Switch homebrew NROs. This mod allows to create NROs/Retroarch Forwarders.
3+
4+
# Use
5+
Compile this sub dir using devkitpro, it will generate hbl.nso (main) and hbl.npdm (main.npdm) binary files.
6+
7+
The results of the compilation are used as the template file for all NSP's generated by nton.
8+
9+
These only need recompiled when there is a major ABI change, like in 21.x.
10+
11+
# Notes
12+
This template ROM is based on nx-hbloader, with patches applied to allow forwarding to any NRO.
13+
14+
Sources:
15+
16+
https://github.com/switchbrew/nx-hbloader
17+
https://github.com/Skywalker25/Forwarder-Mod
18+
19+
# Changelog
20+
2026-01-17 Applied Forwarder-Mod to latest nx-hbloader, recompiled against latest libnx via devkitpro
21+
22+
# credits
23+
nx-hbloader from switchbrew
24+
nx-hbloader-retroarch-forwarder-mod from natinusala
25+
Forwarder-Mod from Skywalker25
26+

rom/Romfs/nextArgv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

rom/Romfs/nextNroPath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)