Skip to content

Commit c7b02b3

Browse files
committed
Online
1 parent 6253e9a commit c7b02b3

32 files changed

+91029
-89891
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ include $(DEVKITPRO)/libnx/switch_rules
3131
# - <libnx folder>/default_icon.jpg
3232
#---------------------------------------------------------------------------------
3333
VERSION_MAJOR := 1
34-
VERSION_MINOR := 3
34+
VERSION_MINOR := 4
3535
VERSION_MICRO := 0
3636

3737
APP_TITLE := RipJKAnime NX

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ En Atmosphere: abre cualquier juego que tengas mientras mantienes presionado el
99

1010
En SX OS: abre cualquier juego que tengas mientras mantienes presionado el botón R. en vez de abrirse tu juego se ejecutará homebrew menu, entonces desde ahí abres RipJKAnimeNX.
1111

12+
Ver Online
13+
----------------------------------------
14+
Ver Online solo está soportado por Atmosphere, y para que funcione debes instalar el RipJKForwader.nsp y ejecutar el homebrew desde ahí.
15+
1216
Advertencia:
1317
----------------------------------------
1418
Si la app se cierra al intentar abrirla, es porque se cayó JKAnime y debes intentar más tarde.

RipJKForwader/BuildTools/hacbrewpack

372 KB
Binary file not shown.
1020 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
^http*

RipJKForwader/Icon.jpg

58.7 KB
Loading

RipJKForwader/Include/Forwarder.hpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
/*
3+
4+
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5+
Copyright (C) 2018-2019 XorTroll
6+
7+
This program is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
*/
21+
22+
#include <string>
23+
#include <vector>
24+
#include <switch.h>
25+
#include <cstring>
26+
#include <iostream>
27+
#include <fstream>
28+
#include "hbl.h"
29+
30+
static std::vector<std::string> GoldleafPaths =
31+
{
32+
"switch/RipJKAnime_NX/RipJKAnime_NX.nro",
33+
"switch/RipJKAnime_NX.nro",
34+
};
35+
36+
inline std::string GetGoldleaf()
37+
{
38+
std::string gp;
39+
for(u32 i = 0; i < GoldleafPaths.size(); i++)
40+
{
41+
std::string gnro = "sdmc:/" + GoldleafPaths[i];
42+
std::ifstream ifs(gnro);
43+
bool iok = ifs.good();
44+
ifs.close();
45+
if(iok)
46+
{
47+
gp = gnro;
48+
break;
49+
}
50+
}
51+
return gp;
52+
}
53+
54+
inline void FatalError(std::string Err, std::string MoreInfo)
55+
{
56+
consoleInit(NULL);
57+
std::cout << std::endl << "FATAL - An error ocurred attempting to " << Err << "." << std::endl << MoreInfo;
58+
consoleUpdate(NULL);
59+
while(true);
60+
}

RipJKForwader/Include/hbl.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifdef __cplusplus
2+
extern "C" {
3+
#endif
4+
5+
void targetNro(const char *path, const char *argv);
6+
7+
#ifdef __cplusplus
8+
}
9+
#endif

RipJKForwader/Logo/NintendoLogo.png

3.86 KB
Loading

RipJKForwader/Logo/StartupMovie.gif

42.5 KB
Loading

RipJKForwader/Makefile

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
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+
# 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+
# - <Project name>.jpg
30+
# - icon.jpg
31+
# - <libnx folder>/default_icon.jpg
32+
#---------------------------------------------------------------------------------
33+
TARGET := $(notdir $(CURDIR))
34+
BUILD := build
35+
SOURCES := Source
36+
DATA := data
37+
INCLUDES := Include
38+
EXEFS_SRC := exefs_src
39+
# ROMFS := romfs
40+
41+
APP_TITLE := RipJKAnime NX
42+
APP_AUTHOR := AngelXex
43+
APP_VERSION := 0.1 (forwarder)
44+
APP_TITLEID := 05B9DB505ABBE000
45+
46+
#---------------------------------------------------------------------------------
47+
# options for code generation
48+
#---------------------------------------------------------------------------------
49+
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
50+
51+
CFLAGS := -g -Wall -O2 -ffunction-sections \
52+
$(ARCH) $(DEFINES)
53+
54+
CFLAGS += $(INCLUDE) -D__SWITCH__
55+
56+
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
57+
58+
ASFLAGS := -g $(ARCH)
59+
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
60+
61+
LIBS := -lnx
62+
63+
#---------------------------------------------------------------------------------
64+
# list of directories containing libraries, this must be the top level containing
65+
# include and lib
66+
#---------------------------------------------------------------------------------
67+
LIBDIRS := $(PORTLIBS) $(LIBNX)
68+
69+
70+
#---------------------------------------------------------------------------------
71+
# no real need to edit anything past this point unless you need to add additional
72+
# rules for different file extensions
73+
#---------------------------------------------------------------------------------
74+
ifneq ($(BUILD),$(notdir $(CURDIR)))
75+
#---------------------------------------------------------------------------------
76+
77+
export OUTPUT := $(CURDIR)/Output/temp/$(TARGET)
78+
export TOPDIR := $(CURDIR)
79+
80+
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
81+
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
82+
83+
export DEPSDIR := $(CURDIR)/$(BUILD)
84+
85+
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
86+
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
87+
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
88+
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
89+
90+
#---------------------------------------------------------------------------------
91+
# use CXX for linking C++ projects, CC for standard C
92+
#---------------------------------------------------------------------------------
93+
ifeq ($(strip $(CPPFILES)),)
94+
#---------------------------------------------------------------------------------
95+
export LD := $(CC)
96+
#---------------------------------------------------------------------------------
97+
else
98+
#---------------------------------------------------------------------------------
99+
export LD := $(CXX)
100+
#---------------------------------------------------------------------------------
101+
endif
102+
#---------------------------------------------------------------------------------
103+
104+
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
105+
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
106+
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
107+
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
108+
109+
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
110+
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
111+
-I$(CURDIR)/$(BUILD)
112+
113+
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
114+
115+
export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC)
116+
117+
ifeq ($(strip $(ICON)),)
118+
icons := $(wildcard *.jpg)
119+
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
120+
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
121+
else
122+
ifneq (,$(findstring icon.jpg,$(icons)))
123+
export APP_ICON := $(TOPDIR)/icon.jpg
124+
endif
125+
endif
126+
else
127+
export APP_ICON := $(TOPDIR)/$(ICON)
128+
endif
129+
130+
ifeq ($(strip $(NO_ICON)),)
131+
export NROFLAGS += --icon=$(APP_ICON)
132+
endif
133+
134+
ifeq ($(strip $(NO_NACP)),)
135+
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
136+
endif
137+
138+
ifneq ($(APP_TITLEID),)
139+
export NACPFLAGS += --titleid=$(APP_TITLEID)
140+
endif
141+
142+
ifneq ($(ROMFS),)
143+
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
144+
endif
145+
146+
.PHONY: $(BUILD) clean all
147+
148+
#---------------------------------------------------------------------------------
149+
all: $(BUILD)
150+
151+
$(BUILD):
152+
@[ -d $@ ] || mkdir -p $@
153+
@[ -d $(CURDIR)/Output/temp ] || mkdir -p $(CURDIR)/Output/temp
154+
@[ -d $(CURDIR)/Output/control ] || mkdir -p $(CURDIR)/Output/control
155+
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
156+
@rm -rf $(CURDIR)/Control
157+
mkdir -p $(CURDIR)/Control
158+
@cp $(OUTPUT).nacp $(CURDIR)/Output/control/control.nacp
159+
@cp $(CURDIR)/Icon.jpg $(CURDIR)/Output/control/icon_AmericanEnglish.dat
160+
@$(CURDIR)/BuildTools/hacbrewpack.exe -k $(CURDIR)/BuildTools/keys.dat --titleid 05B9DB505ABBE000 --exefsdir $(BUILD)/exefs --noromfs --logodir $(CURDIR)/Logo --controldir $(CURDIR)/Output/control --htmldocdir $(CURDIR)/HtmlDoc --nspdir $(CURDIR)/build
161+
@rm -rf $(CURDIR)/Output/control
162+
@rm -rf $(CURDIR)/Output/temp
163+
@mv $(CURDIR)/build/05b9db505abbe000.nsp $(CURDIR)/Output/ripjkforwader.nsp
164+
165+
#---------------------------------------------------------------------------------
166+
clean:
167+
@echo clean ...
168+
@rm -fr $(BUILD) $(TARGET).nso $(TARGET).elf
169+
170+
171+
#---------------------------------------------------------------------------------
172+
else
173+
.PHONY: all
174+
175+
DEPENDS := $(OFILES:.o=.d)
176+
177+
#---------------------------------------------------------------------------------
178+
# main targets
179+
#---------------------------------------------------------------------------------
180+
all : $(OUTPUT).nso $(OUTPUT).pfs0 $(OUTPUT).nacp
181+
182+
$(OUTPUT).nso : $(OUTPUT).elf
183+
184+
$(OUTPUT).elf : $(OFILES)
185+
186+
$(OFILES_SRC) : $(HFILES_BIN)
187+
188+
#---------------------------------------------------------------------------------
189+
# you need a rule like this for each extension you use as binary data
190+
#---------------------------------------------------------------------------------
191+
%.bin.o %_bin.h : %.bin
192+
#---------------------------------------------------------------------------------
193+
@echo $(notdir $<)
194+
@$(bin2o)
195+
196+
-include $(DEPENDS)
197+
198+
#---------------------------------------------------------------------------------------
199+
endif
200+
#---------------------------------------------------------------------------------------

RipJKForwader/Source/Main.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
/*
3+
4+
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5+
Copyright (C) 2018-2019 XorTroll
6+
7+
This program is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
*/
21+
22+
#include <Forwarder.hpp>
23+
24+
int main()
25+
{
26+
std::string gnro = GetGoldleaf();
27+
if(gnro.empty()) FatalError("find RipJKAnime_NX.NRO", "Place it on 'sd:/switch' (or 'sd:/switch/RipJKAnime_NX') folder.");
28+
targetNro(gnro.c_str(), gnro.c_str());
29+
}

RipJKForwader/Source/hbl-Trampoline.s

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.section .text.nroEntrypointTrampoline, "ax", %progbits
2+
3+
.global nroEntrypointTrampoline
4+
.type nroEntrypointTrampoline, %function
5+
.align 2
6+
7+
.global __libnx_exception_entry
8+
.type __libnx_exception_entry, %function
9+
10+
.cfi_startproc
11+
12+
nroEntrypointTrampoline:
13+
14+
// Reset stack pointer.
15+
adrp x8, __stack_top //Defined in libnx.
16+
ldr x8, [x8, #:lo12:__stack_top]
17+
mov sp, x8
18+
19+
// Call NRO.
20+
blr x2
21+
22+
// Save retval
23+
adrp x1, g_lastRet
24+
str w0, [x1, #:lo12:g_lastRet]
25+
26+
// Reset stack pointer and load next NRO.
27+
adrp x8, __stack_top
28+
ldr x8, [x8, #:lo12:__stack_top]
29+
mov sp, x8
30+
31+
b loadNro
32+
33+
.cfi_endproc
34+
35+
.section .text.__libnx_exception_entry, "ax", %progbits
36+
.align 2
37+
38+
.cfi_startproc
39+
40+
__libnx_exception_entry:
41+
adrp x7, g_nroAddr
42+
ldr x7, [x7, #:lo12:g_nroAddr]
43+
cbz x7, __libnx_exception_entry_fail
44+
br x7
45+
46+
__libnx_exception_entry_fail:
47+
mov w0, #0xf801
48+
bl svcReturnFromException
49+
b .
50+
51+
.cfi_endproc

0 commit comments

Comments
 (0)