├── .github
└── workflows
│ └── docker-image.yml
├── .gitignore
├── .gitmodules
├── CMakeLists.txt
├── Dockerfile
├── LICENSE
├── README.md
├── cmake
├── FindLIBNX.cmake
├── borealisLib.cmake
├── clang-dev-tools.cmake
├── devkita64-libnx.cmake
├── nx-utils.cmake
├── options.cmake
└── utils.cmake
├── resources
├── icon_corner.psd
└── icon_gui.psd
├── screenshots
├── 1.jpg
├── 2.jpg
├── 3.jpg
├── 4.jpg
├── 5.jpg
├── 6.jpg
└── overlay
│ ├── 0.png
│ ├── 1.png
│ ├── 2.png
│ └── 3.png
├── setup_env.sh
├── src
├── Applications
│ ├── CMakeLists.txt
│ ├── SimpleModManager
│ │ ├── CMakeLists.txt
│ │ ├── include
│ │ │ └── SimpleModManager.h
│ │ ├── resources
│ │ │ ├── assets
│ │ │ │ └── icon_gui.jpg
│ │ │ └── romfs
│ │ │ │ └── images
│ │ │ │ ├── icon_corner.png
│ │ │ │ ├── portrait.jpg
│ │ │ │ └── unknown.png
│ │ └── src
│ │ │ └── SimpleModManager.cpp
│ ├── SimpleModManagerConsole
│ │ ├── CMakeLists.txt
│ │ ├── assets
│ │ │ ├── icon.jpg
│ │ │ └── icon.png
│ │ └── src
│ │ │ └── SimpleModManagerConsole.cpp
│ └── SimpleModManagerOverlay
│ │ ├── CMakeLists.txt
│ │ ├── assets
│ │ ├── icon.jpg
│ │ └── icon.png
│ │ ├── include
│ │ ├── ExampleGui.h
│ │ ├── GameBrowserGui.h
│ │ ├── OverlayGuiLoader.h
│ │ └── implementation
│ │ │ ├── GameBrowserGui.impl.h
│ │ │ └── OverlayGui.impl.h
│ │ └── src
│ │ └── SimpleModManagerOverlay.cpp
├── CMakeLists.txt
├── ModManagerCore
│ ├── CMakeLists.txt
│ ├── include
│ │ ├── ConfigHandler.h
│ │ ├── ConsoleHandler.h
│ │ ├── GameBrowser.h
│ │ ├── ModManager.h
│ │ ├── ModsPresetHandler.h
│ │ ├── Selector.h
│ │ └── Toolbox.h
│ └── src
│ │ ├── ConfigHandler.cpp
│ │ ├── GameBrowser.cpp
│ │ ├── ModManager.cpp
│ │ ├── ModsPreseter.cpp
│ │ ├── Selector.cpp
│ │ └── Toolbox.cpp
├── ModManagerGui
│ ├── CMakeLists.txt
│ ├── CoreExtension
│ │ ├── CMakeLists.txt
│ │ ├── include
│ │ │ └── GuiModManager.h
│ │ └── src
│ │ │ └── GuiModManager.cpp
│ ├── FrameGameBrowser
│ │ ├── CMakeLists.txt
│ │ ├── include
│ │ │ ├── FrameRoot.h
│ │ │ ├── TabAbout.h
│ │ │ ├── TabGames.h
│ │ │ └── TabGeneralSettings.h
│ │ └── src
│ │ │ ├── FrameRoot.cpp
│ │ │ ├── TabAbout.cpp
│ │ │ ├── TabGames.cpp
│ │ │ └── TabGeneralSettings.cpp
│ └── FrameModBrowser
│ │ ├── CMakeLists.txt
│ │ ├── include
│ │ ├── FrameModBrowser.h
│ │ ├── TabModBrowser.h
│ │ ├── TabModOptions.h
│ │ ├── TabModPlugins.h
│ │ ├── TabModPresets.h
│ │ └── ThumbnailPresetEditor.h
│ │ └── src
│ │ ├── FrameModBrowser.cpp
│ │ ├── TabModBrowser.cpp
│ │ ├── TabModOptions.cpp
│ │ ├── TabModPlugins.cpp
│ │ ├── TabModPresets.cpp
│ │ └── ThumbnailPresetEditor.cpp
└── ModManagerOverlay
│ ├── CMakeLists.txt
│ ├── include
│ ├── ChangeConfigPresetGui.h
│ └── ModBrowserGui.h
│ └── src
│ ├── ChangeConfigPresetGui.cpp
│ └── ModBrowserGui.cpp
└── version_config.h.in
/.github/workflows/docker-image.yml:
--------------------------------------------------------------------------------
1 | name: Docker Image CI
2 |
3 | on:
4 | push:
5 | branches: [ "main" ]
6 | pull_request:
7 | branches: [ "main" ]
8 |
9 | jobs:
10 |
11 | build:
12 |
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - uses: actions/checkout@v3
17 | - name: Build the Docker image
18 | run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignored files
2 | external
3 | cmake-build-release
4 | build
5 |
6 | # Don't track IDE caches
7 | .vscode
8 | .idea
9 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "submodules/borealis"]
2 | path = submodules/borealis
3 | url = https://github.com/nadrino/borealis
4 | [submodule "submodules/libtesla"]
5 | path = submodules/libtesla
6 | url = https://github.com/nadrino/libtesla.git
7 | [submodule "submodules/cpp-generic-toolbox"]
8 | path = submodules/cpp-generic-toolbox
9 | url = https://github.com/nadrino/cpp-generic-toolbox.git
10 | [submodule "submodules/simple-cpp-logger"]
11 | path = submodules/simple-cpp-logger
12 | url = https://github.com/nadrino/simple-cpp-logger.git
13 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright 2019 SwitchPy Team. All rights reserved.
2 | # Licensed under the MIT license.
3 | # Refer to the LICENSE file included.
4 | #
5 | # libnx CMake template for Nintendo Switch homebrew development.
6 |
7 | cmake_minimum_required(VERSION 3.10)
8 |
9 | project(SimpleModManager)
10 |
11 | list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
12 | include(options)
13 | include(utils)
14 | include(devkita64-libnx)
15 |
16 | # needed by tesla lib
17 | set( CMAKE_CXX_STANDARD 20 )
18 |
19 | find_package(LIBNX REQUIRED)
20 | if (NOT LIBNX_FOUND)
21 | cmake_panic("Unable to detect libnx on this system.")
22 | endif ()
23 |
24 |
25 | find_package(ZLIB REQUIRED)
26 | if (${ZLIB_FOUND})
27 | message("ZLIB found : ${ZLIB_VERSION_STRING}")
28 | message("ZLIB_INCLUDE_DIRS = ${ZLIB_INCLUDE_DIRS}")
29 | message("ZLIB_LIBRARIES = ${ZLIB_LIBRARIES}")
30 | else()
31 | message(FATAL_ERROR "ZLIB has not been found.")
32 | endif ()
33 |
34 | find_package(Freetype REQUIRED)
35 | if (${FREETYPE_FOUND})
36 | message("Freetype found : ${FREETYPE_VERSION_STRING}")
37 | message("FREETYPE_INCLUDE_DIRS = ${FREETYPE_INCLUDE_DIRS}")
38 | message("FREETYPE_LIBRARIES = ${FREETYPE_LIBRARIES}")
39 | else()
40 | message(FATAL_ERROR "FREETYPE has not been found.")
41 | endif ()
42 |
43 |
44 | find_package(BZip2 REQUIRED)
45 | if (${BZIP2_FOUND})
46 | message("BZIP2 found : ${BZIP2_VERSION_STRING}")
47 | message("BZIP2_INCLUDE_DIRS = ${BZIP2_INCLUDE_DIRS}")
48 | message("BZIP2_LIBRARIES = ${BZIP2_LIBRARIES}")
49 | else()
50 | message(FATAL_ERROR "BZIP2 has not been found.")
51 | endif ()
52 |
53 | #find_package(SDL2 REQUIRED)
54 | #message("SDL2_INCLUDE_DIRS = ${SDL2_INCLUDE_DIRS}")
55 | #message("SDL2_LIBRARIES = ${SDL2_LIBRARIES}")
56 |
57 |
58 | include_directories(${PROJECT_BINARY_DIR})
59 | include_directories("${PORTLIBS}/include")
60 | include_directories("${LIBNX}/include")
61 | include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
62 | include_directories("${ZLIB_INCLUDE_DIRS}")
63 | include_directories("${FREETYPE_INCLUDE_DIRS}")
64 | #include_directories("${SDL2_INCLUDE_DIRS}")
65 |
66 | set(VERSION_MAJOR 2)
67 | set(VERSION_MINOR 1)
68 | set(VERSION_MICRO 4)
69 | set(VERSION_TAG "\"\"")
70 | set(APP_VERSION
71 | "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}")
72 |
73 | add_definitions( -DVERSION_APP=${APP_VERSION} )
74 | add_definitions( -DVERSION_MAJOR_APP=${VERSION_MAJOR} )
75 | add_definitions( -DVERSION_MINOR_APP=${VERSION_MINOR} )
76 | add_definitions( -DVERSION_MICRO_APP=${VERSION_MICRO} )
77 |
78 | if (NOT DEFINED CMAKE_BUILD_TYPE_INIT)
79 | set(CMAKE_BUILD_TYPE_INIT Release)
80 | endif ()
81 |
82 |
83 | include(nx-utils)
84 |
85 | cmake_info("Building ${APP_TITLE} version ${APP_VERSION}.")
86 |
87 | # SimpleModManager Core
88 | set(SMM_CORE_DIR ${PROJECT_SOURCE_DIR}/core)
89 | set(SMM_CORE_SOURCE_DIR ${SMM_CORE_DIR}/source)
90 | set(SMM_CORE_INCLUDE_DIR ${SMM_CORE_DIR}/include)
91 |
92 | include_directories(${SMM_CORE_INCLUDE_DIR})
93 |
94 | # Submodules
95 | set( SUBMODULES_DIR ${PROJECT_SOURCE_DIR}/submodules )
96 | include_directories( ${SUBMODULES_DIR}/cpp-generic-toolbox/include )
97 |
98 | include_directories( ${SUBMODULES_DIR}/simple-cpp-logger/include )
99 | add_definitions( -D LOGGER_MAX_LOG_LEVEL_PRINTED=6 )
100 | add_definitions( -D LOGGER_PREFIX_LEVEL=3 )
101 | add_definitions( -D LOGGER_ENABLE_COLORS_ON_USER_HEADER=1 )
102 | add_definitions( -D LOGGER_TIME_FORMAT="\\\"%d/%m/%Y %H:%M:%S"\\\" )
103 | add_definitions( -D LOGGER_PREFIX_FORMAT="\\\"{TIME} {USER_HEADER} {FILELINE}"\\\" )
104 |
105 | # Auto Generated
106 | configure_file( version_config.h.in ${CMAKE_BINARY_DIR}/generated/version_config.h )
107 | include_directories( ${CMAKE_BINARY_DIR}/generated/ )
108 |
109 | include( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/borealisLib.cmake )
110 |
111 | # This project
112 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/src )
113 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM devkitpro/devkita64 as base
2 |
3 | ENV DEVKITPRO /opt/devkitpro
4 | ENV DEVKITA64 ${DEVKITPRO}/devkitA64
5 | ENV DEVKITARM ${DEVKITPRO}/devkitARM
6 | ENV DEVKITPPC ${DEVKITPRO}/devkitPPC
7 | ENV PORTLIBS_PREFIX ${DEVKITPRO}/portlibs/switch
8 |
9 | ENV PATH ${DEVKITPRO}/tools/bin:$PATH
10 | ENV PATH ${DEVKITA64}/bin/:$PATH
11 |
12 | ENV WORK_DIR /home/work
13 | RUN mkdir -p $WORK_DIR
14 | WORKDIR $WORK_DIR
15 |
16 | ENV REPO_DIR $WORK_DIR/repo
17 | ENV BUILD_DIR $WORK_DIR/build
18 | ENV INSTALL_DIR $WORK_DIR/install
19 |
20 | RUN mkdir -p $REPO_DIR
21 | RUN mkdir -p $BUILD_DIR
22 | RUN mkdir -p $INSTALL_DIR
23 |
24 | SHELL ["/bin/bash", "-c"]
25 |
26 | RUN mkdir -p $REPO_DIR/SimpleModManager
27 | RUN mkdir -p $BUILD_DIR/SimpleModManager
28 | COPY . $REPO_DIR/SimpleModManager
29 |
30 | RUN cd $REPO_DIR/SimpleModManager && \
31 | git submodule update --init --recursive && \
32 | cd $BUILD_DIR/SimpleModManager && \
33 | # for some reason yaml-cpp in not found by cmake, so put the paths manually
34 | cmake \
35 | -D CMAKE_INSTALL_PREFIX=$INSTALL_DIR \
36 | -D CMAKE_TOOLCHAIN_FILE=$REPO_DIR/SimpleModManager/cmake/devkita64-libnx.cmake \
37 | $REPO_DIR/SimpleModManager && \
38 | make -j3 install
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |  [](https://github.com/nadrino/SimpleModManager/releases/) [](https://GitHub.com/nadrino/SimpleModManager/releases/)
2 |
3 | # SimpleModManager
4 |
5 | SimpleModManager is an homebrew app for the Nintendo Switch CFW : Atmosphere.
6 | It allows to manage your mods (via LayeredFS).
7 |
8 |

9 |
10 | ## Screenshots
11 |
12 | 
13 |
14 |
15 | Spoiler: More Screenshots
16 |
17 | 
18 | 
19 | 
20 | 
21 | 
22 |
23 |
24 |
25 |
26 | ## How to install (manually)
27 | - Download the latest version in the [release page](https://github.com/nadrino/SimpleModManager/releases)
28 | - Place the .nro file in the `/switch/` folder of your SDcard.
29 | - At the root of your SDcard, create a `/mods/` folder.
30 | - Tree structure : `/mods///`
31 | - For plugins: `/mods//.plugins/.smm`
32 |
33 | Example : `/mods/The Legend of Zelda - Breath of the Wild/First Person View/contents/01007EF00011E000/romfs/Actor/Pack/GameRomCamera.sbactorpack`
34 |
35 |
36 | ## Build From Source
37 |
38 | ### Prerequisites (macos)
39 | - Install XCode via the App Store
40 | - Launch :
41 | ```bash
42 | xcode-select --install
43 | ```
44 | - Download DevKitPro : https://github.com/devkitPro/pacman/releases
45 | ```bash
46 | sudo installer -pkg /path/to/devkitpro-pacman-installer.pkg -target /
47 | ```
48 | - Define environment (add the following lines to your bashrc) :
49 | ```bash
50 | function setup_devkitpro()
51 | {
52 | echo "Seting up DevKitPro..." >&2
53 | export DEVKITPRO=/opt/devkitpro
54 | export DEVKITA64=${DEVKITPRO}/devkitA64
55 | export DEVKITARM=${DEVKITPRO}/devkitARM
56 | export DEVKITPPC=${DEVKITPRO}/devkitPPC
57 | export PORTLIBS_PREFIX=${DEVKITPRO}/portlibs/switch
58 |
59 | export PATH=${DEVKITPRO}/tools/bin:$PATH
60 | export PATH=${DEVKITA64}/bin/:$PATH
61 |
62 | source $DEVKITPRO/switchvars.sh
63 | return;
64 | }
65 | export -f setup_devkitpro
66 | ```
67 | - Source your bashrc and execute "setup_devkitpro"
68 | - Install packages (all are not needed, this is just a reminder for me!)
69 | ```bash
70 | sudo dkp-pacman -Sy \
71 | switch-bulletphysics switch-bzip2 switch-curl\
72 | switch-examples switch-ffmpeg switch-flac switch-freetype\
73 | switch-giflib switch-glad switch-glfw switch-glm\
74 | switch-jansson switch-libass switch-libconfig\
75 | switch-libdrm_nouveau switch-libexpat switch-libfribidi\
76 | switch-libgd switch-libjpeg-turbo switch-libjson-c\
77 | switch-liblzma switch-liblzo2 switch-libmad switch-libmikmod\
78 | switch-libmodplug switch-libogg switch-libopus\
79 | switch-libpcre2 switch-libpng switch-libsamplerate\
80 | switch-libsodium switch-libtheora switch-libtimidity\
81 | switch-libvorbis switch-libvorbisidec switch-libvpx\
82 | switch-libwebp switch-libxml2 switch-mbedtls switch-mesa\
83 | switch-miniupnpc switch-mpg123 switch-ode switch-oniguruma\
84 | switch-opusfile switch-pkg-config switch-sdl2 switch-sdl2_gfx\
85 | switch-sdl2_image switch-sdl2_mixer switch-sdl2_net\
86 | switch-sdl2_ttf switch-smpeg2 switch-zlib switch-zziplib\
87 | devkitA64 devkitpro-keyring general-tools pkg-config\
88 | libnx libfilesystem switch-tools devkitpro-pkgbuild-helpers\
89 | -r /System/Volumes/Data
90 | sudo dkp-pacman -Suy -r /System/Volumes/Data
91 | ```
92 |
93 | ### Compile
94 | ```bash
95 | git clone https://github.com/nadrino/SimpleModManager.git
96 | cd SimpleModManager
97 | mkdir build
98 | cd build
99 | cmake ../ -DCMAKE_TOOLCHAIN_FILE=../cmake/devkita64-libnx.cmake
100 | make
101 | ```
102 |
103 |
104 |
105 |
106 | ## Plugins
107 | Plugins can be any hbmenu nro, but should be linked against [libsmm](https://github.com/withertech/libsmm) and have the
108 | ```c++
109 | void smmInit();
110 | ```
111 | called in initialization and
112 | ```c++
113 | void smmExit();
114 | ```
115 | called in deinitialization
116 |
117 | use
118 | ```c++
119 | std::string smmModPathForCfwPath(std::string path);
120 | ```
121 | to get the path to a file under `sdmc:/mods/...` from a path to a file under `sdmc:/atmosphere/...`
122 |
123 | and include
124 | ```c++
125 | #import
126 | ```
127 | and add
128 | ```makefile
129 | LIBS := -lsmm -lnx
130 | ```
131 | to your makefile
132 |
133 | Example :
134 |
135 |
136 | main.cpp
137 |
138 | ```c++
139 |
140 | // Include the most common headers from the C standard library
141 | #include
142 | #include
143 | #include
144 |
145 | // Include the main libnx system header, for Switch development
146 | #include
147 |
148 | #include
149 |
150 | // Main program entrypoint
151 | int main(int argc, char* argv[])
152 | {
153 | // This example uses a text console, as a simple way to output text to the screen.
154 | // If you want to write a software-rendered graphics application,
155 | // take a look at the graphics/simplegfx example, which uses the libnx Framebuffer API instead.
156 | // If on the other hand you want to write an OpenGL based application,
157 | // take a look at the graphics/opengl set of examples, which uses EGL instead.
158 | consoleInit(NULL);
159 | smmInit();
160 | // Configure our supported input layout: a single player with standard controller styles
161 | padConfigureInput(1, HidNpadStyleSet_NpadStandard);
162 |
163 | // Initialize the default gamepad (which reads handheld mode inputs as well as the first connected controller)
164 | PadState pad;
165 | padInitializeDefault(&pad);
166 |
167 | // Other initialization goes here. As a demonstration, we print hello world.
168 | printf(smmModPathForCfwPath("sdmc:/atmosphere/contents/01000A10041EA000/romfs/Skyrim.ini").c_str());
169 |
170 | // Main loop
171 | while (appletMainLoop())
172 | {
173 | // Scan the gamepad. This should be done once for each frame
174 | padUpdate(&pad);
175 |
176 | // padGetButtonsDown returns the set of buttons that have been
177 | // newly pressed in this frame compared to the previous one
178 | u64 kDown = padGetButtonsDown(&pad);
179 |
180 | if (kDown & HidNpadButton_Plus)
181 | break; // break in order to return to hbmenu
182 |
183 | // Your code goes here
184 |
185 | // Update the console, sending a new frame to the display
186 | consoleUpdate(NULL);
187 | }
188 |
189 | smmExit();
190 | // Deinitialize and clean up resources used by the console (important!)
191 | consoleExit(NULL);
192 | return 0;
193 | }
194 | ```
195 |
196 |
197 |
198 | makefile
199 |
200 | ```makefile
201 | #---------------------------------------------------------------------------------
202 | .SUFFIXES:
203 | #---------------------------------------------------------------------------------
204 |
205 | ifeq ($(strip $(DEVKITPRO)),)
206 | $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro")
207 | endif
208 |
209 | TOPDIR ?= $(CURDIR)
210 | include $(DEVKITPRO)/libnx/switch_rules
211 |
212 | #---------------------------------------------------------------------------------
213 | # TARGET is the name of the output
214 | # BUILD is the directory where object files & intermediate files will be placed
215 | # SOURCES is a list of directories containing source code
216 | # DATA is a list of directories containing data files
217 | # INCLUDES is a list of directories containing header files
218 | # EXEFS_SRC is the optional input directory containing data copied into exefs, if anything this normally should only contain "main.npdm".
219 | # ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
220 | #
221 | # NO_ICON: if set to anything, do not use icon.
222 | # NO_NACP: if set to anything, no .nacp file is generated.
223 | # APP_TITLE is the name of the app stored in the .nacp file (Optional)
224 | # APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
225 | # APP_VERSION is the version of the app stored in the .nacp file (Optional)
226 | # APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
227 | # ICON is the filename of the icon (.jpg), relative to the project folder.
228 | # If not set, it attempts to use one of the following (in this order):
229 | # - .jpg
230 | # - icon.jpg
231 | # - /default_icon.jpg
232 | #---------------------------------------------------------------------------------
233 | TARGET := $(notdir $(CURDIR))
234 | BUILD := build
235 | SOURCES := source
236 | DATA := data
237 | INCLUDES := include
238 | EXEFS_SRC := exefs_src
239 | #ROMFS := romfs
240 |
241 | #---------------------------------------------------------------------------------
242 | # options for code generation
243 | #---------------------------------------------------------------------------------
244 | ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
245 |
246 | CFLAGS := -g -Wall -O2 -ffunction-sections \
247 | $(ARCH) $(DEFINES)
248 |
249 | CFLAGS += $(INCLUDE) -D__SWITCH__
250 |
251 | CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
252 |
253 | ASFLAGS := -g $(ARCH)
254 | LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
255 |
256 | LIBS := -lsmm -lnx
257 |
258 | #---------------------------------------------------------------------------------
259 | # list of directories containing libraries, this must be the top level containing
260 | # include and lib
261 | #---------------------------------------------------------------------------------
262 | LIBDIRS := $(PORTLIBS) $(LIBNX)
263 |
264 |
265 | #---------------------------------------------------------------------------------
266 | # no real need to edit anything past this point unless you need to add additional
267 | # rules for different file extensions
268 | #---------------------------------------------------------------------------------
269 | ifneq ($(BUILD),$(notdir $(CURDIR)))
270 | #---------------------------------------------------------------------------------
271 |
272 | export OUTPUT := $(CURDIR)/$(TARGET)
273 | export TOPDIR := $(CURDIR)
274 |
275 | export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
276 | $(foreach dir,$(DATA),$(CURDIR)/$(dir))
277 |
278 | export DEPSDIR := $(CURDIR)/$(BUILD)
279 |
280 | CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
281 | CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
282 | SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
283 | BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
284 |
285 | #---------------------------------------------------------------------------------
286 | # use CXX for linking C++ projects, CC for standard C
287 | #---------------------------------------------------------------------------------
288 | ifeq ($(strip $(CPPFILES)),)
289 | #---------------------------------------------------------------------------------
290 | export LD := $(CC)
291 | #---------------------------------------------------------------------------------
292 | else
293 | #---------------------------------------------------------------------------------
294 | export LD := $(CXX)
295 | #---------------------------------------------------------------------------------
296 | endif
297 | #---------------------------------------------------------------------------------
298 |
299 | export OFILES_BIN := $(addsuffix .o,$(BINFILES))
300 | export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
301 | export OFILES := $(OFILES_BIN) $(OFILES_SRC)
302 | export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
303 |
304 | export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
305 | $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
306 | -I$(CURDIR)/$(BUILD)
307 |
308 | export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
309 |
310 | export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC)
311 |
312 | ifeq ($(strip $(ICON)),)
313 | icons := $(wildcard *.jpg)
314 | ifneq (,$(findstring $(TARGET).jpg,$(icons)))
315 | export APP_ICON := $(TOPDIR)/$(TARGET).jpg
316 | else
317 | ifneq (,$(findstring icon.jpg,$(icons)))
318 | export APP_ICON := $(TOPDIR)/icon.jpg
319 | endif
320 | endif
321 | else
322 | export APP_ICON := $(TOPDIR)/$(ICON)
323 | endif
324 |
325 | ifeq ($(strip $(NO_ICON)),)
326 | export NROFLAGS += --icon=$(APP_ICON)
327 | endif
328 |
329 | ifeq ($(strip $(NO_NACP)),)
330 | export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
331 | endif
332 |
333 | ifneq ($(APP_TITLEID),)
334 | export NACPFLAGS += --titleid=$(APP_TITLEID)
335 | endif
336 |
337 | ifneq ($(ROMFS),)
338 | export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
339 | endif
340 |
341 | .PHONY: $(BUILD) clean all
342 |
343 | #---------------------------------------------------------------------------------
344 | all: $(BUILD)
345 |
346 | $(BUILD):
347 | @[ -d $@ ] || mkdir -p $@
348 | @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
349 |
350 | #---------------------------------------------------------------------------------
351 | clean:
352 | @echo clean ...
353 | @rm -fr $(BUILD) $(TARGET).pfs0 $(TARGET).nso $(TARGET).nro $(TARGET).nacp $(TARGET).elf
354 |
355 |
356 | #---------------------------------------------------------------------------------
357 | else
358 | .PHONY: all
359 |
360 | DEPENDS := $(OFILES:.o=.d)
361 |
362 | #---------------------------------------------------------------------------------
363 | # main targets
364 | #---------------------------------------------------------------------------------
365 | all : $(OUTPUT).pfs0 $(OUTPUT).nro
366 |
367 | $(OUTPUT).pfs0 : $(OUTPUT).nso
368 |
369 | $(OUTPUT).nso : $(OUTPUT).elf
370 |
371 | ifeq ($(strip $(NO_NACP)),)
372 | $(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
373 | else
374 | $(OUTPUT).nro : $(OUTPUT).elf
375 | endif
376 |
377 | $(OUTPUT).elf : $(OFILES)
378 |
379 | $(OFILES_SRC) : $(HFILES_BIN)
380 |
381 | #---------------------------------------------------------------------------------
382 | # you need a rule like this for each extension you use as binary data
383 | #---------------------------------------------------------------------------------
384 | %.bin.o %_bin.h : %.bin
385 | #---------------------------------------------------------------------------------
386 | @echo $(notdir $<)
387 | @$(bin2o)
388 |
389 | -include $(DEPENDS)
390 |
391 | #---------------------------------------------------------------------------------------
392 | endif
393 | #---------------------------------------------------------------------------------------
394 | ```
395 |
396 |
397 | ## Prebuilt Binaries
398 | - To download please refer to this link : [Releases](https://github.com/nadrino/SimpleModManager/releases).
399 | - For libsmm there is a dkp-pacman package in the releases for [libsmm](https://github.com/withertech/libsmm/releases)
400 |
401 |
402 |
403 |
--------------------------------------------------------------------------------
/cmake/FindLIBNX.cmake:
--------------------------------------------------------------------------------
1 | # Tries to find libnx
2 | # Once done, this will define:
3 | # > LIBNX_FOUND - The system has libnx
4 | # > LIBNX_INCLUDE_DIRS - The libnx include directories
5 | # > LIBNX_LIBRARIES - The libnx libraries required for using it
6 | #
7 | # It also adds an imported target named `switch::libnx`.
8 |
9 | if (NOT SWITCH)
10 | cmake_panic("This helper can only be used if you are using the Switch toolchain file.")
11 | endif ()
12 |
13 | set(LIBNX_PATHS $ENV{LIBNX} libnx ${LIBNX} ${DEVKITPRO}/libnx)
14 |
15 | find_path(LIBNX_INCLUDE_DIR switch.h
16 | PATHS ${LIBNX_PATHS}
17 | PATH_SUFFIXES include)
18 |
19 | find_library(LIBNX_LIBRARY NAMES libnx.a
20 | PATHS ${LIBNX_PATHS}
21 | PATH_SUFFIXES lib)
22 |
23 | set(LIBNX_INCLUDE_DIRS ${LIBNX_INCLUDE_DIR})
24 | set(LIBNX_LIBRARIES ${LIBNX_LIBRARY})
25 |
26 | # Handle the QUIETLY and REQUIRED arguments and set LIBNX_FOUND to TRUE if all above variables are TRUE.
27 | include(FindPackageHandleStandardArgs)
28 | find_package_handle_standard_args(LIBNX DEFAULT_MSG
29 | LIBNX_INCLUDE_DIR LIBNX_LIBRARY)
30 |
31 | mark_as_advanced(LIBNX_INCLUDE_DIR LIBNX_LIBRARY)
32 | if (LIBNX_FOUND)
33 | set(LIBNX ${LIBNX_INCLUDE_DIR}/..)
34 | cmake_info("Setting LIBNX to ${LIBNX}")
35 |
36 | add_library(switch::libnx STATIC IMPORTED GLOBAL)
37 | set_target_properties(switch::libnx PROPERTIES
38 | IMPORTED_LOCATION ${LIBNX_LIBRARY}
39 | INTERFACE_INCLUDE_DIRECTORIES ${LIBNX_INCLUDE_DIR})
40 | endif ()
41 |
--------------------------------------------------------------------------------
/cmake/borealisLib.cmake:
--------------------------------------------------------------------------------
1 | ###########################
2 | # Definition of Borealis lib build
3 | ###########################
4 |
5 | set( BOREALIS_DIR ${SUBMODULES_DIR}/borealis )
6 | set(BOREALIS_INC_DIR ${BOREALIS_DIR}/library/include)
7 |
8 | cmake_info("BOREALIS_DIR is ${BOREALIS_DIR}")
9 | add_compile_definitions( BOREALIS_RESOURCES=\"romfs:/borealis/\" )
10 |
11 |
12 | file( GLOB BOREALIS_SRC
13 | "${BOREALIS_DIR}/library/lib/*.cpp"
14 | "${BOREALIS_DIR}/library/lib/extern/*/*.c"
15 | "${BOREALIS_DIR}/library/lib/extern/*/*/*.c"
16 | "${BOREALIS_DIR}/library/lib/*.cpp"
17 | "${BOREALIS_DIR}/library/lib/*.c"
18 | "${BOREALIS_DIR}/library/lib/extern/glad/*.c"
19 | "${BOREALIS_DIR}/library/lib/extern/nanovg/*.c"
20 | "${BOREALIS_DIR}/library/lib/extern/libretro-common/compat/*.c"
21 | "${BOREALIS_DIR}/library/lib/extern/libretro-common/encodings/*.c"
22 | "${BOREALIS_DIR}/library/lib/extern/libretro-common/features/*.c"
23 | "${BOREALIS_DIR}/library/lib/extern/fmt/src/*.cc"
24 | )
25 |
26 | add_library( Borealis STATIC ${BOREALIS_SRC} )
27 | install( TARGETS Borealis DESTINATION lib )
28 |
29 | target_include_directories( Borealis PUBLIC
30 | ${BOREALIS_DIR}/library/lib/extern/fmt/include
31 | ${BOREALIS_INC_DIR}
32 | ${BOREALIS_INC_DIR}/borealis
33 | ${BOREALIS_INC_DIR}/borealis/extern
34 | ${BOREALIS_INC_DIR}/borealis/extern/glad
35 | ${BOREALIS_INC_DIR}/borealis/extern/nanovg
36 | ${BOREALIS_INC_DIR}/borealis/extern/libretro-common
37 | ${PROJECT_SOURCE_DIR}/shortcuts
38 | ${PROJECT_SOURCE_DIR}/shortcuts/libretro-common
39 | # ${SUBMODULES_DIR}/json/include
40 | )
41 |
42 | target_link_libraries( Borealis PUBLIC
43 | switch::libnx
44 | -L/opt/devkitpro/portlibs/switch/lib
45 | -L/opt/devkitpro/libnx/lib
46 | ${ZLIB_LIBRARIES}
47 | ${FREETYPE_LIBRARIES}
48 | -lglfw3 -lEGL -lglad -lglapi -ldrm_nouveau -lm -lnx
49 | )
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/cmake/clang-dev-tools.cmake:
--------------------------------------------------------------------------------
1 | file(GLOB_RECURSE
2 | ALL_CXX_SOURCE_FILES
3 | *.c *.cpp *.cc *.h *.hpp)
4 |
5 | find_program(CLANG_FORMAT "clang-format")
6 | if (CLANG_FORMAT)
7 | add_custom_target(
8 | clang_format
9 | COMMAND /usr/bin/clang-format
10 | -i
11 | -style=file
12 | ${ALL_CXX_SOURCE_FILES})
13 | endif ()
14 |
15 | find_program(CLANG_TIDY "clang-tidy")
16 | if (CLANG_TIDY)
17 | add_custom_target(
18 | clang-tidy
19 | COMMAND /usr/bin/clang-tidy
20 | ${ALL_CXX_SOURCE_FILES}
21 | -config=''
22 | --
23 | -std=c++${CMAKE_CXX_STANDARD}
24 | ${INCLUDE_DIRECTORIES})
25 | endif ()
26 |
--------------------------------------------------------------------------------
/cmake/devkita64-libnx.cmake:
--------------------------------------------------------------------------------
1 | if (NOT DEFINED ENV{DEVKITPRO})
2 | cmake_panic("Please set DEVKITPRO in your environment. export DEVKITPRO=/devkitpro")
3 | endif ()
4 |
5 | set(CMAKE_SYSTEM_NAME Generic)
6 | set(CMAKE_SYSTEM_PROCESSOR aarch64)
7 | set(SWITCH TRUE) # To be used for multiplatform projects
8 |
9 | # devkitPro paths are broken on Windows. We need to use this macro to fix those.
10 | macro(msys_to_cmake_path msys_path resulting_path)
11 | if (WIN32)
12 | string(REGEX REPLACE "^/([a-zA-Z])/" "\\1:/" ${resulting_path} ${msys_path})
13 | else ()
14 | set(${resulting_path} ${msys_path})
15 | endif ()
16 | endmacro()
17 |
18 | msys_to_cmake_path($ENV{DEVKITPRO} DEVKITPRO)
19 | set(DEVKITA64 ${DEVKITPRO}/devkitA64)
20 | set(LIBNX ${DEVKITPRO}/libnx)
21 | set(PORTLIBS_PATH ${DEVKITPRO}/portlibs)
22 | set(PORTLIBS ${PORTLIBS_PATH}/switch)
23 |
24 | set(TOOLCHAIN_PREFIX ${DEVKITA64}/bin/aarch64-none-elf-)
25 | if (WIN32)
26 | set(TOOLCHAIN_SUFFIX ".exe")
27 | else ()
28 | set(TOOLCHAIN_SUFFIX "")
29 | endif ()
30 |
31 | set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc${TOOLCHAIN_SUFFIX})
32 | set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++${TOOLCHAIN_SUFFIX})
33 | set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}as${TOOLCHAIN_SUFFIX})
34 |
35 | set(PKG_CONFIG_EXECUTABLE ${TOOLCHAIN_PREFIX}pkg-config${TOOLCHAIN_SUFFIX})
36 | set(CMAKE_AR ${TOOLCHAIN_PREFIX}gcc-ar${TOOLCHAIN_SUFFIX} CACHE STRING "")
37 | set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}gcc-ranlib${TOOLCHAIN_SUFFIX} CACHE STRING "")
38 | set(CMAKE_LD "/${TOOLCHAIN_PREFIX}ld${TOOLCHAIN_SUFFIX}" CACHE INTERNAL "")
39 | set(CMAKE_OBJCOPY "${TOOLCHAIN_PREFIX}objcopy${TOOLCHAIN_SUFFIX}" CACHE INTERNAL "")
40 | set(CMAKE_SIZE_UTIL "${TOOLCHAIN_PREFIX}size${TOOLCHAIN_SUFFIX}" CACHE INTERNAL "")
41 |
42 | set(WITH_PORTLIBS ON CACHE BOOL "use portlibs ?")
43 | if (WITH_PORTLIBS)
44 | set(CMAKE_FIND_ROOT_PATH ${DEVKITA64} ${DEVKITPRO} ${LIBNX} ${PORTLIBS})
45 | else ()
46 | set(CMAKE_FIND_ROOT_PATH ${DEVKITA64} ${DEVKITPRO} ${LIBNX})
47 | endif ()
48 |
49 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
50 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
51 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
52 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
53 |
54 | add_definitions(-D__SWITCH__)
55 | set(ARCH "-march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE")
56 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MMD -MP -g -Wall -O2 -ffunction-sections ${ARCH}")
57 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -fexceptions -Os -fdata-sections -ffunction-sections")
58 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -fno-exceptions")
59 | #set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
60 | set(CMAKE_EXE_LINKER_FLAGS_INIT "${ARCH} -ftls-model=local-exec -L${LIBNX}/lib -L${PORTLIBS}/lib -Wl,--gc-sections")
61 | set(CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
62 |
63 | set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Shared libs not available")
64 | set(CMAKE_INSTALL_PREFIX ${PORTLIBS})
65 | set(CMAKE_PREFIX_PATH ${PORTLIBS})
66 |
--------------------------------------------------------------------------------
/cmake/nx-utils.cmake:
--------------------------------------------------------------------------------
1 | if (NOT SWITCH)
2 | cmake_panic("These utils can only be used if you are using the Switch toolchain file.")
3 | endif ()
4 |
5 | #############
6 | ## ELF2NRO ##
7 | #############
8 | if (NOT ELF2NRO)
9 | find_program(ELF2NRO elf2nro ${DEVKITPRO}/tools/bin)
10 | if (ELF2NRO)
11 | cmake_info("elf2nro: ${ELF2NRO} - found")
12 | else ()
13 | cmake_warning("elf2nro - not found")
14 | endif ()
15 | endif ()
16 |
17 | #############
18 | ## ELF2KIP ##
19 | #############
20 | if (NOT ELF2KIP)
21 | find_program(ELF2KIP elf2kip ${DEVKITPRO}/tools/bin)
22 | if (ELF2KIP)
23 | cmake_info("elf2kip: ${ELF2KIP} - found")
24 | else ()
25 | cmake_warning("elf2kip - not found")
26 | endif ()
27 | endif ()
28 |
29 | #############
30 | ## ELF2NSO ##
31 | #############
32 | if (NOT ELF2NSO)
33 | find_program(ELF2NSO elf2nso ${DEVKITPRO}/tools/bin)
34 | if (ELF2NSO)
35 | cmake_info("elf2nso: ${ELF2NSO} - found")
36 | else ()
37 | cmake_warning("elf2nso - not found")
38 | endif ()
39 | endif ()
40 |
41 | #############
42 | ## BIN2S ##
43 | #############
44 | if (NOT BIN2S)
45 | find_program(BIN2S bin2s ${DEVKITPRO}/tools/bin)
46 | if (BIN2S)
47 | cmake_info("bin2s: ${BIN2S} - found")
48 | else ()
49 | cmake_warning("bin2s - not found")
50 | endif ()
51 | endif ()
52 |
53 | #############
54 | ## RAW2C ##
55 | #############
56 | if (NOT RAW2C)
57 | find_program(RAW2C raw2c ${DEVKITPRO}/tools/bin)
58 | if (RAW2C)
59 | cmake_info("raw2c: ${RAW2C} - found")
60 | else ()
61 | cmake_warning("raw2c - not found")
62 | endif ()
63 | endif ()
64 |
65 | ##################
66 | ## BUILD_PFS0 ##
67 | ##################
68 | if (NOT BUILD_PFS0)
69 | find_program(BUILD_PFS0 build_pfs0 ${DEVKITPRO}/tools/bin)
70 | if (BUILD_PFS0)
71 | cmake_info("build_pfs0: ${BUILD_PFS0} - found")
72 | else ()
73 | cmake_warning("build_pfs0 - not found")
74 | endif ()
75 | endif ()
76 |
77 | ################
78 | ## NACPTOOL ##
79 | ################
80 | if (NOT NACPTOOL)
81 | find_program(NACPTOOL nacptool ${DEVKITPRO}/tools/bin)
82 | if (NACPTOOL)
83 | cmake_info("nacptool: ${NACPTOOL} - found")
84 | else ()
85 | cmake_warning("nacptool - not found")
86 | endif ()
87 | endif ()
88 |
89 | macro(acquire_homebrew_icon target)
90 | # This basically imitates the behavior of the Makefiles
91 | # from the switchbrew/switch-examples repository.
92 | message(${target}.jpg)
93 | if (EXISTS ${target}.jpg)
94 | set(APP_ICON ${target}.jpg)
95 | elseif (EXISTS ${PROJECT_SOURCE_DIR}/assets/icon.jpg)
96 | set(APP_ICON ${PROJECT_SOURCE_DIR}/assets/icon.jpg)
97 | elseif (LIBNX)
98 | set(APP_ICON ${LIBNX}/default_icon.jpg)
99 | else ()
100 | cmake_panic("No icon found, please provide one!")
101 | endif ()
102 | endmacro()
103 |
104 | function(add_nso_target target)
105 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.nso
106 | COMMAND ${ELF2NSO} ${CMAKE_CURRENT_BINARY_DIR}/${target}.elf ${CMAKE_CURRENT_BINARY_DIR}/${target}.nso
107 | WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
108 | VERBATIM)
109 |
110 | if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
111 | add_custom_target(${target}.nso ALL SOURCES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target}.nso)
112 | else ()
113 | add_custom_target(${target}.nso ALL SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${target}.nso)
114 | endif ()
115 | endfunction()
116 |
117 | function(add_nacp target)
118 | set(__NACP_COMMAND ${NACPTOOL} --create ${APP_TITLE} ${APP_AUTHOR} ${APP_VERSION} ${CMAKE_CURRENT_BINARY_DIR}/${target})
119 |
120 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}
121 | COMMAND ${__NACP_COMMAND}
122 | WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
123 | VERBATIM)
124 | endfunction()
125 |
126 | function(add_nro_target target)
127 |
128 | if (NOT APP_ROMFS)
129 | set(__NRO_COMMAND ${ELF2NRO}
130 | $
131 | ${CMAKE_CURRENT_BINARY_DIR}/${target}.nro
132 | --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp
133 | --icon=${APP_ICON}
134 | )
135 | else()
136 | message("Building with ROMFS: ${APP_ROMFS}")
137 | set(__NRO_COMMAND ${ELF2NRO}
138 | $
139 | ${CMAKE_CURRENT_BINARY_DIR}/${target}.nro
140 | --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp
141 | --romfsdir=${APP_ROMFS}
142 | --icon=${APP_ICON}
143 | )
144 | endif()
145 |
146 | # set(__NRO_COMMAND
147 | # ${ELF2NRO} $ ${CMAKE_CURRENT_BINARY_DIR}/${target}.nro --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp --icon=${APP_ICON})
148 |
149 | if (NOT ${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp)
150 | add_nacp(${target}.nacp)
151 | endif ()
152 |
153 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.nro
154 | COMMAND ${__NRO_COMMAND}
155 | DEPENDS ${target}.elf ${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp
156 | VERBATIM)
157 |
158 | if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
159 | add_custom_target(${target}.nro ALL SOURCES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target}.nro)
160 | else ()
161 | add_custom_target(${target}.nro ALL SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${target}.nro)
162 | endif ()
163 | endfunction()
164 |
165 | function(add_ovl_target target)
166 |
167 | if (NOT APP_ROMFS)
168 | set(__NRO_COMMAND ${ELF2NRO}
169 | $
170 | ${CMAKE_CURRENT_BINARY_DIR}/${target}.ovl
171 | --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp
172 | --icon=${APP_ICON}
173 | )
174 | else()
175 | set(__NRO_COMMAND ${ELF2NRO}
176 | $
177 | ${CMAKE_CURRENT_BINARY_DIR}/${target}.ovl
178 | --nacp=${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp
179 | --romfs=${APP_ROMFS}
180 | --icon=${APP_ICON}
181 | )
182 | endif()
183 |
184 | if (NOT ${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp)
185 | add_nacp(${target}.nacp)
186 | endif ()
187 |
188 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.ovl
189 | COMMAND ${__NRO_COMMAND}
190 | DEPENDS ${target}.elf ${CMAKE_CURRENT_BINARY_DIR}/${target}.nacp
191 | VERBATIM)
192 |
193 | if (CMAKE_RUNTIME_OUTPUT_DIRECTORY)
194 | add_custom_target(${target}.ovl ALL SOURCES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target}.ovl)
195 | else ()
196 | add_custom_target(${target}.ovl ALL SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${target}.ovl)
197 | endif ()
198 | endfunction()
199 |
200 | function(build_switch_binaries target)
201 | get_filename_component(target_we ${target} NAME_WE)
202 |
203 | if (${ARGC} GREATER 1)
204 | set(APP_TITLE ${ARGV1})
205 | else ()
206 | if (NOT APP_TITLE)
207 | set(APP_TITLE ${target_we})
208 | endif ()
209 | endif ()
210 |
211 | if (${ARGC} GREATER 2)
212 | set(APP_AUTHOR ${ARGV2})
213 | else ()
214 | if (NOT APP_AUTHOR)
215 | set(APP_AUTHOR "Unspecified Author")
216 | endif ()
217 | endif ()
218 |
219 | if (${ARGC} GREATER 3)
220 | set(APP_ICON ${ARGV3})
221 | else ()
222 | if (NOT APP_ICON)
223 | acquire_homebrew_icon(${target_we})
224 | endif ()
225 | endif ()
226 |
227 | if (${ARGC} GREATER 4)
228 | set(APP_VERSION ${ARGV4})
229 | else ()
230 | if (NOT APP_VERSION)
231 | set(APP_VERSION "1.0.0")
232 | endif ()
233 | endif ()
234 |
235 | if (${ARGC} GREATER 5)
236 | set(APP_ROMFS ${ARGV5})
237 | endif ()
238 |
239 | # Build the binaries
240 | # add_nso_target(${target_we})
241 | add_nro_target(${target_we})
242 | endfunction()
243 |
244 | function(build_switch_ovl_binaries target)
245 |
246 | get_filename_component(target_we ${target} NAME_WE)
247 |
248 | if (${ARGC} GREATER 1)
249 | set(APP_TITLE ${ARGV1})
250 | else ()
251 | if (NOT APP_TITLE)
252 | set(APP_TITLE ${target_we})
253 | endif ()
254 | endif ()
255 |
256 | if (${ARGC} GREATER 2)
257 | set(APP_AUTHOR ${ARGV2})
258 | else ()
259 | if (NOT APP_AUTHOR)
260 | set(APP_AUTHOR "Unspecified Author")
261 | endif ()
262 | endif ()
263 |
264 | if (${ARGC} GREATER 3)
265 | set(APP_ICON ${ARGV3})
266 | else ()
267 | if (NOT APP_ICON)
268 | acquire_homebrew_icon(${target_we})
269 | endif ()
270 | endif ()
271 |
272 | if (${ARGC} GREATER 4)
273 | set(APP_VERSION ${ARGV4})
274 | else ()
275 | if (NOT APP_VERSION)
276 | set(APP_VERSION "1.0.0")
277 | endif ()
278 | endif ()
279 |
280 | # Build the binaries
281 | # add_nso_target(${target_we})
282 | add_ovl_target(${target_we})
283 | endfunction()
284 |
--------------------------------------------------------------------------------
/cmake/options.cmake:
--------------------------------------------------------------------------------
1 | # If the verbose mode is activated, CMake will log more
2 | # information while building. This information may include
3 | # statistics, dependencies and versions.
4 | option(cmake_VERBOSE "Enable for verbose logging." ON)
5 |
6 | # Whether to set the language standard to C++ 17 or C++ 11.
7 | option(USE_CPP_17 "Enable this for C++17 language standard." ON)
8 |
--------------------------------------------------------------------------------
/cmake/utils.cmake:
--------------------------------------------------------------------------------
1 | function(cmake_info message)
2 | if (cmake_VERBOSE)
3 | message("Build-Info: ${message}")
4 | endif ()
5 | endfunction()
6 |
7 | function(cmake_warning message)
8 | if (cmake_VERBOSE)
9 | message(WARNING "${message}")
10 | endif ()
11 | endfunction()
12 |
13 | function(cmake_panic message)
14 | message(FATAL_ERROR "${message}")
15 | endfunction()
16 |
--------------------------------------------------------------------------------
/resources/icon_corner.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/resources/icon_corner.psd
--------------------------------------------------------------------------------
/resources/icon_gui.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/resources/icon_gui.psd
--------------------------------------------------------------------------------
/screenshots/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/1.jpg
--------------------------------------------------------------------------------
/screenshots/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/2.jpg
--------------------------------------------------------------------------------
/screenshots/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/3.jpg
--------------------------------------------------------------------------------
/screenshots/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/4.jpg
--------------------------------------------------------------------------------
/screenshots/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/5.jpg
--------------------------------------------------------------------------------
/screenshots/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/6.jpg
--------------------------------------------------------------------------------
/screenshots/overlay/0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/overlay/0.png
--------------------------------------------------------------------------------
/screenshots/overlay/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/overlay/1.png
--------------------------------------------------------------------------------
/screenshots/overlay/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/overlay/2.png
--------------------------------------------------------------------------------
/screenshots/overlay/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/screenshots/overlay/3.png
--------------------------------------------------------------------------------
/setup_env.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | function setup_devkitpro()
4 | {
5 | echo "Seting up DevKitPro..." >&2
6 | export DEVKITPRO=/opt/devkitpro
7 | export DEVKITA64=${DEVKITPRO}/devkitA64
8 | export DEVKITARM=${DEVKITPRO}/devkitARM
9 | export DEVKITPPC=${DEVKITPRO}/devkitPPC
10 | export PORTLIBS_PREFIX=${DEVKITPRO}/portlibs/switch
11 |
12 | export PATH=${DEVKITPRO}/tools/bin:$PATH
13 | export PATH=${DEVKITA64}/bin/:$PATH
14 |
15 | return;
16 | }; export -f setup_devkitpro
17 |
18 | function send_file(){
19 |
20 | HOST='192.168.1.75:5000'
21 | lftp -e "cd $2; put $1; bye" $HOST
22 |
23 | }; export -f send_file
24 |
25 |
26 | setup_devkitpro
27 |
--------------------------------------------------------------------------------
/src/Applications/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # Applications definition
3 | #
4 |
5 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/SimpleModManager )
6 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/SimpleModManagerConsole )
7 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/SimpleModManagerOverlay )
8 |
9 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManager/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Building GUI app
2 |
3 |
4 |
5 | # Replace this with the name of your application
6 | set( GUI_NAME "SimpleModManager")
7 | set( GUI_APP "${GUI_NAME}")
8 | set( GUI_DIR ${PROJECT_SOURCE_DIR}/gui)
9 |
10 | # Meta information about the app
11 | set( GUI_TITLE ${GUI_NAME})
12 | set( GUI_AUTHOR "Nadrino")
13 | set( GUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/assets/icon_gui.jpg")
14 | set( GUI_ROMFS "${CMAKE_CURRENT_SOURCE_DIR}/resources/romfs")
15 |
16 | set( SRC_FILES src/SimpleModManager.cpp )
17 |
18 |
19 | add_executable( ${GUI_APP}.elf ${SRC_FILES} )
20 | target_include_directories( ${GUI_APP}.elf PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include )
21 |
22 | target_link_libraries(
23 | ${GUI_APP}.elf PUBLIC
24 | CoreExtension
25 | FrameGameBrowser
26 | FrameModBrowser
27 | Borealis
28 | switch::libnx
29 | -L/opt/devkitpro/portlibs/switch/lib
30 | -L/opt/devkitpro/libnx/lib
31 | ${ZLIB_LIBRARIES}
32 | ${FREETYPE_LIBRARIES}
33 | -lglfw3 -lEGL -lglad -lglapi -ldrm_nouveau -lm -lnx
34 | )
35 |
36 | set_target_properties(${GUI_APP}.elf PROPERTIES
37 | LINKER_LANGUAGE CXX # Replace this with C if you have C source files
38 | LINK_FLAGS "-specs=${LIBNX}/switch.specs -Wl,-no-as-needed -Wl,-Map,.map"
39 | )
40 |
41 |
42 | set(CMAKE_BUILD_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${GUI_APP}.elf.dir)
43 | set(BUILD_ROMFS ${CMAKE_BUILD_DIRECTORY}/Resources)
44 | cmake_info("Resources will be gathered in: ${BUILD_ROMFS}")
45 | add_custom_command(
46 | TARGET ${GUI_APP}.elf
47 | PRE_BUILD
48 | COMMAND ${CMAKE_COMMAND} -E echo "Gathering resources..."
49 | COMMAND ${CMAKE_COMMAND} -E remove_directory ${BUILD_ROMFS}
50 | COMMAND ${CMAKE_COMMAND} -E make_directory ${BUILD_ROMFS}
51 | COMMAND ${CMAKE_COMMAND} -E make_directory ${BUILD_ROMFS}/borealis
52 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${GUI_ROMFS}/. ${BUILD_ROMFS}/.
53 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${BOREALIS_DIR}/resources/. ${BUILD_ROMFS}/borealis/.
54 | COMMAND ${CMAKE_COMMAND} -E echo "Resources have been gathered."
55 | )
56 |
57 | build_switch_binaries(
58 | ${GUI_APP}.elf
59 | ${GUI_TITLE} ${GUI_AUTHOR} ${GUI_ICON} ${APP_VERSION} ${BUILD_ROMFS}
60 | )
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManager/include/SimpleModManager.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Adrien Blanchet on 14/04/2023.
3 | //
4 |
5 | #ifndef SIMPLEMODMANAGER_SIMPLEMODMANAGER_H
6 | #define SIMPLEMODMANAGER_SIMPLEMODMANAGER_H
7 |
8 | void runGui();
9 |
10 |
11 | #endif //SIMPLEMODMANAGER_SIMPLEMODMANAGER_H
12 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManager/resources/assets/icon_gui.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/src/Applications/SimpleModManager/resources/assets/icon_gui.jpg
--------------------------------------------------------------------------------
/src/Applications/SimpleModManager/resources/romfs/images/icon_corner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/src/Applications/SimpleModManager/resources/romfs/images/icon_corner.png
--------------------------------------------------------------------------------
/src/Applications/SimpleModManager/resources/romfs/images/portrait.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/src/Applications/SimpleModManager/resources/romfs/images/portrait.jpg
--------------------------------------------------------------------------------
/src/Applications/SimpleModManager/resources/romfs/images/unknown.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/src/Applications/SimpleModManager/resources/romfs/images/unknown.png
--------------------------------------------------------------------------------
/src/Applications/SimpleModManager/src/SimpleModManager.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Adrien Blanchet on 14/04/2023.
3 | //
4 |
5 |
6 | #include "SimpleModManager.h"
7 |
8 | #include
9 | #include "ConsoleHandler.h"
10 |
11 | #include "ConfigHandler.h"
12 |
13 | #include "Logger.h"
14 |
15 | #include
16 |
17 | #include
18 | #include
19 | #include "iostream"
20 |
21 | #include "switch.h"
22 |
23 |
24 | LoggerInit([]{
25 | Logger::setUserHeaderStr("[SimpleModManager.nro]");
26 | });
27 |
28 |
29 | int main(int argc, char* argv[]){
30 | LogInfo << "SimpleModManager is starting..." << std::endl;
31 |
32 | // https://github.com/jbeder/yaml-cpp/wiki/Tutorial
33 | // YAML::Node config = YAML::LoadFile("config.yaml");
34 | // if (config["lastLogin"]) {
35 | // std::cout << "Last logged in: " << config["lastLogin"].as() << "\n";
36 | // }
37 | // const auto username = config["username"].as();
38 | // const auto password = config["password"].as();
39 |
40 | ConfigHandler c;
41 | if( c.getConfig().useGui ){ runGui(); }
42 | else{
43 | consoleInit(nullptr);
44 | ConsoleHandler::run();
45 | consoleExit(nullptr);
46 | }
47 |
48 | // Exit
49 | return EXIT_SUCCESS;
50 | }
51 |
52 |
53 | void runGui(){
54 | LogInfo << "Starting GUI..." << std::endl;
55 | LogThrowIf(R_FAILED(nsInitialize()), "nsInitialize Failed");
56 |
57 | brls::Logger::setLogLevel(brls::LogLevel::ERROR);
58 |
59 | brls::i18n::loadTranslations("en-US");
60 | LogThrowIf(not brls::Application::init("SimpleModManager"), "Unable to init Borealis application");
61 |
62 | LogInfo << "Creating root frame..." << std::endl;
63 | auto* mainFrame = new FrameRoot();
64 |
65 | LogInfo << "Pushing to view" << std::endl;
66 | brls::Application::pushView( mainFrame );
67 | mainFrame->registerAction( "", brls::Key::PLUS, []{return true;}, true );
68 | mainFrame->updateActionHint( brls::Key::PLUS, "" ); // make the change visible
69 |
70 | while( brls::Application::mainLoop() ){ }
71 |
72 | nsExit();
73 | }
74 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerConsole/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # CMakeLists for the Homebrew Application
3 | #
4 |
5 | # Replace this with the name of your application
6 | set(HOMEBREW_NAME "SimpleModManagerConsole")
7 | set(HOMEBREW_APP "${HOMEBREW_NAME}")
8 |
9 | # Meta information about the app
10 | set(HOMEBREW_TITLE ${HOMEBREW_NAME})
11 | set(HOMEBREW_AUTHOR "Nadrino")
12 | set(HOMEBREW_ICON "${CMAKE_CURRENT_SOURCE_DIR}/assets/icon.jpg")
13 |
14 | set( SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/SimpleModManagerConsole.cpp )
15 |
16 | build_switch_binaries( ${HOMEBREW_APP}.elf
17 | ${HOMEBREW_TITLE} ${HOMEBREW_AUTHOR} ${HOMEBREW_ICON} ${APP_VERSION}) # need to be defined before add_executable... CMake works in myterious ways
18 |
19 | add_executable(${HOMEBREW_APP}.elf
20 | ${SRC_FILES}
21 | )
22 |
23 | target_link_libraries( ${HOMEBREW_APP}.elf
24 | ModManagerCore
25 | switch::libnx
26 | -L/opt/devkitpro/portlibs/switch/lib
27 | ${ZLIB_LIBRARIES}
28 | # -lSDL2 -march=armv8-a -fPIE -L/opt/devkitpro/libnx/lib -lEGL -lglapi -ldrm_nouveau -lnx
29 | )
30 |
31 | set_target_properties(${HOMEBREW_APP}.elf PROPERTIES
32 | LINKER_LANGUAGE CXX # Replace this with C if you have C source files
33 | LINK_FLAGS "-specs=${LIBNX}/switch.specs -Wl,-no-as-needed -Wl,-Map,.map"
34 | )
35 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerConsole/assets/icon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/src/Applications/SimpleModManagerConsole/assets/icon.jpg
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerConsole/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/src/Applications/SimpleModManagerConsole/assets/icon.png
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerConsole/src/SimpleModManagerConsole.cpp:
--------------------------------------------------------------------------------
1 |
2 |
3 | #include "ConsoleHandler.h"
4 |
5 | #include
6 |
7 | #include "chrono"
8 | #include "thread"
9 |
10 |
11 | // MAIN
12 | int main( int argc, char **argv ){
13 | consoleInit(nullptr);
14 | ConsoleHandler::run();
15 | consoleExit(nullptr);
16 | return EXIT_SUCCESS;
17 | }
18 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # CMakeLists for the Tesla Overlay
3 | #
4 |
5 | # Replace this with the name of your application
6 | set( OVL_NAME "SimpleModManagerOverlay" )
7 | set( OVL_APP "${OVL_NAME}" )
8 |
9 | # Meta information about the app
10 | set( OVL_TITLE "SimpleModManager" )
11 | set( OVL_AUTHOR "Nadrino" )
12 | set( OVL_ICON ${CMAKE_CURRENT_SOURCE_DIR}/assets/icon.jpg )
13 |
14 | # sources
15 | set( SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/SimpleModManagerOverlay.cpp )
16 |
17 |
18 | add_executable( ${OVL_APP}.elf ${SRC_FILES} )
19 | target_include_directories( ${OVL_APP}.elf PUBLIC
20 | ${CMAKE_CURRENT_SOURCE_DIR}/include
21 | ${SUBMODULES_DIR}/libtesla/include
22 | )
23 |
24 | target_link_libraries( ${OVL_APP}.elf
25 | # ModManagerOverlay
26 | ModManagerCore
27 | switch::libnx
28 | -L/opt/devkitpro/portlibs/switch/lib
29 | ${ZLIB_LIBRARIES}
30 | )
31 |
32 | set_target_properties( ${OVL_APP}.elf PROPERTIES
33 | LINKER_LANGUAGE CXX # Replace this with C if you have C source files
34 | LINK_FLAGS "-specs=${LIBNX}/switch.specs -Wl,-no-as-needed -Wl,-Map,.map"
35 | )
36 |
37 | build_switch_ovl_binaries( ${OVL_APP}.elf ${OVL_TITLE} ${OVL_AUTHOR} ${OVL_ICON} ${APP_VERSION} )
38 |
39 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/assets/icon.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/src/Applications/SimpleModManagerOverlay/assets/icon.jpg
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/assets/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nadrino/SimpleModManager/09061cec78460bcc8cf0ff8d3c90dc2e065c494e/src/Applications/SimpleModManagerOverlay/assets/icon.png
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/include/ExampleGui.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Adrien Blanchet on 18/04/2023.
3 | //
4 |
5 | #ifndef SIMPLEMODMANAGER_EXAMPLEGUI_H
6 | #define SIMPLEMODMANAGER_EXAMPLEGUI_H
7 |
8 | #include "tesla.hpp"
9 |
10 |
11 | class GuiSecondary : public tsl::Gui {
12 | public:
13 | GuiSecondary() {}
14 |
15 | virtual tsl::elm::Element* createUI() override {
16 | auto *rootFrame = new tsl::elm::OverlayFrame("Tesla Example", "v1.3.2 - Secondary Gui");
17 |
18 | rootFrame->setContent(new tsl::elm::DebugRectangle(tsl::Color{ 0x8, 0x3, 0x8, 0xF }));
19 |
20 | return rootFrame;
21 | }
22 | };
23 |
24 | class GuiTest : public tsl::Gui {
25 | public:
26 | GuiTest(u8 arg1, u8 arg2, bool arg3) { }
27 |
28 | // Called when this Gui gets loaded to create the UI
29 | // Allocate all elements on the heap. libtesla will make sure to clean them up when not needed anymore
30 | virtual tsl::elm::Element* createUI() override {
31 | // A OverlayFrame is the base element every overlay consists of. This will draw the default Title and Subtitle.
32 | // If you need more information in the header or want to change it's look, use a HeaderOverlayFrame.
33 | auto frame = new tsl::elm::OverlayFrame("Tesla Example", "v1.3.2");
34 |
35 | // A list that can contain sub elements and handles scrolling
36 | auto list = new tsl::elm::List();
37 |
38 | // List Items
39 | list->addItem(new tsl::elm::CategoryHeader("List items"));
40 |
41 | auto *clickableListItem = new tsl::elm::ListItem("Clickable List Item", "...");
42 | clickableListItem->setClickListener([](u64 keys) {
43 | if (keys & HidNpadButton_A) {
44 | tsl::changeTo();
45 | return true;
46 | }
47 |
48 | return false;
49 | });
50 |
51 | list->addItem(clickableListItem);
52 | list->addItem(new tsl::elm::ListItem("Default List Item"));
53 | list->addItem(new tsl::elm::ListItem("Default List Item with an extra long name to trigger truncation and scrolling"));
54 | list->addItem(new tsl::elm::ToggleListItem("Toggle List Item", true));
55 |
56 | // Custom Drawer, a element that gives direct access to the renderer
57 | list->addItem(new tsl::elm::CategoryHeader("Custom Drawer", true));
58 | list->addItem(new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
59 | renderer->drawCircle(x + 40, y + 40, 20, true, renderer->a(0xF00F));
60 | renderer->drawCircle(x + 50, y + 50, 20, true, renderer->a(0xF0F0));
61 | renderer->drawRect(x + 130, y + 30, 60, 40, renderer->a(0xFF00));
62 | renderer->drawString("Hello :)", false, x + 250, y + 70, 20, renderer->a(0xFF0F));
63 | renderer->drawRect(x + 40, y + 90, 300, 10, renderer->a(0xF0FF));
64 | }), 100);
65 |
66 | // Track bars
67 | list->addItem(new tsl::elm::CategoryHeader("Track bars"));
68 | list->addItem(new tsl::elm::TrackBar("\u2600"));
69 | list->addItem(new tsl::elm::StepTrackBar("\uE13C", 20));
70 | list->addItem(new tsl::elm::NamedStepTrackBar("\uE132", { "Selection 1", "Selection 2", "Selection 3" }));
71 |
72 | // Add the list to the frame for it to be drawn
73 | frame->setContent(list);
74 |
75 | // Return the frame to have it become the top level element of this Gui
76 | return frame;
77 | }
78 |
79 | // Called once every frame to update values
80 | virtual void update() override {
81 |
82 | }
83 |
84 | // Called once every frame to handle inputs not handled by other UI elements
85 | virtual bool handleInput(u64 keysDown, u64 keysHeld, const HidTouchState &touchPos, HidAnalogStickState joyStickPosLeft, HidAnalogStickState joyStickPosRight) override {
86 | return false; // Return true here to signal the inputs have been consumed
87 | }
88 | };
89 |
90 | class OverlayTest : public tsl::Overlay {
91 | public:
92 | // libtesla already initialized fs, hid, pl, pmdmnt, hid:sys and set:sys
93 | virtual void initServices() override {} // Called at the start to initialize all services necessary for this Overlay
94 | virtual void exitServices() override {} // Called at the end to clean up all services previously initialized
95 |
96 | virtual void onShow() override {} // Called before overlay wants to change from invisible to visible state
97 | virtual void onHide() override {} // Called before overlay wants to change from visible to invisible state
98 |
99 | virtual std::unique_ptr loadInitialGui() override {
100 | return initially(1, 2, true); // Initial Gui to load. It's possible to pass arguments to it's constructor like this
101 | }
102 | };
103 |
104 | #endif //SIMPLEMODMANAGER_EXAMPLEGUI_H
105 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/include/GameBrowserGui.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Nadrino on 06/06/2020.
3 | //
4 |
5 | #ifndef SIMPLEMODMANAGER_GAMEBROWSERGUI_H
6 | #define SIMPLEMODMANAGER_GAMEBROWSERGUI_H
7 |
8 | #include "GameBrowser.h"
9 | #include "ConfigHandler.h"
10 |
11 | #include
12 |
13 | #include "memory"
14 |
15 |
16 | class GameBrowserGui : public tsl::Gui {
17 |
18 | public:
19 | GameBrowserGui() = default;
20 |
21 | // Called when this Gui gets loaded to create the UI
22 | // Allocate all elements on the heap. libtesla will make sure to clean them up when not needed anymore
23 | tsl::elm::Element* createUI() override;
24 |
25 |
26 | void update() override;
27 |
28 | // Called once every frame to handle inputs not handled by other UI elements
29 | bool handleInput(u64 keysDown, u64 keysHeld, const HidTouchState &touchPos, HidAnalogStickState leftJoyStick, HidAnalogStickState rightJoyStick) override;
30 |
31 | protected:
32 | void fillItemList();
33 |
34 | private:
35 | // GameBrowser _gameBrowser_;
36 | // ConfigHandler c;
37 | // std::unique_ptr _gameBrowser_{nullptr};
38 | // std::unique_ptr _h_{};
39 | std::unique_ptr _c_{};
40 |
41 | tsl::elm::OverlayFrame* _frame_{nullptr};
42 | tsl::elm::List* _list_{nullptr};
43 |
44 | };
45 |
46 | #include "implementation/GameBrowserGui.impl.h"
47 |
48 |
49 | #endif //SIMPLEMODMANAGER_GAMEBROWSERGUI_H
50 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/include/OverlayGuiLoader.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Adrien Blanchet on 18/04/2023.
3 | //
4 |
5 | #ifndef SIMPLEMODMANAGER_OVERLAYGUILOADER_H
6 | #define SIMPLEMODMANAGER_OVERLAYGUILOADER_H
7 |
8 | #include "tesla.hpp"
9 |
10 |
11 | class OverlayGuiLoader : public tsl::Overlay {
12 |
13 | public:
14 | std::unique_ptr loadInitialGui() override;
15 |
16 | void initServices() override;
17 | void exitServices() override;
18 |
19 | void onShow() override;
20 | void onHide() override;
21 |
22 | };
23 |
24 | #include "implementation/OverlayGui.impl.h"
25 |
26 | #endif //SIMPLEMODMANAGER_OVERLAYGUILOADER_H
27 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/include/implementation/GameBrowserGui.impl.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Nadrino on 06/06/2020.
3 | //
4 |
5 | #ifndef SIMPLEMODMANAGER_GAMEBROWSERGUI_IMPL_H
6 | #define SIMPLEMODMANAGER_GAMEBROWSERGUI_IMPL_H
7 |
8 |
9 | #include "GameBrowserGui.h"
10 |
11 | //
12 | //#include
13 | #include "ConfigHandler.h"
14 | //#include "GameBrowser.h"
15 | #include "Toolbox.h"
16 |
17 |
18 | tsl::elm::Element *GameBrowserGui::createUI() {
19 | // A OverlayFrame is the base element every overlay consists of. This will draw the default Title and Subtitle.
20 | // If you need more information in the header or want to change it's look, use a HeaderOverlayFrame.
21 | _frame_ = new tsl::elm::OverlayFrame("SimpleModManager", "DOESPATH v" + Toolbox::getAppVersion());
22 |
23 | // _gameBrowser_ = std::make_unique();
24 | // _c_ = std::make_unique();
25 |
26 | GenericToolbox::isFile("/config/SimpleModManager/parameters.ini");
27 |
28 | // A list that can contain sub elements and handles scrolling
29 | _list_ = new tsl::elm::List();
30 |
31 | fillItemList();
32 |
33 | // Return the frame to have it become the top level element of this Gui
34 | return _frame_;
35 | }
36 |
37 | void GameBrowserGui::update() {
38 | // Called once every frame to update values
39 | }
40 | bool GameBrowserGui::handleInput(u64 keysDown, u64 keysHeld, const HidTouchState &touchPos, HidAnalogStickState leftJoyStick, HidAnalogStickState rightJoyStick) {
41 | // Return true here to singal the inputs have been consumed
42 | return false;
43 | }
44 |
45 |
46 | void GameBrowserGui::fillItemList() {
47 |
48 | _list_->clear();
49 |
50 | // List Items
51 | _list_->addItem(new tsl::elm::CategoryHeader("Folder : "));
52 |
53 |
54 |
55 | auto *clickableListItem = new tsl::elm::ListItem("TEST");
56 | clickableListItem->setClickListener([](u64 keys) {
57 | if (keys & HidNpadButton_A) {
58 | ConfigHolder g;
59 | return true;
60 | }
61 | return false;
62 | });
63 | _list_->addItem(clickableListItem);
64 |
65 |
66 | // auto mod_folders_list = GlobalObjects::gGameBrowser.getSelector().getSelectionList();
67 | // for (int i_folder = 0; i_folder < int(mod_folders_list.size()); i_folder++) {
68 | //
69 | // auto *clickableListItem = new tsl::elm::ListItem(mod_folders_list[i_folder]);
70 | // std::string selected_folder = mod_folders_list[i_folder];
71 | // clickableListItem->setClickListener([selected_folder](u64 keys) {
72 | //// if (keys & HidNpadButton_A) {
73 | //// tsl::changeTo(selected_folder);
74 | //// return true;
75 | //// }
76 | // return false;
77 | // });
78 | // _list_->addItem(clickableListItem);
79 | //
80 | // }
81 | //
82 | //
83 | // _list_->addItem(new tsl::elm::ToggleListItem("Toggle List Item", true));
84 | //
85 | // // Custom Drawer, a element that gives direct access to the renderer
86 | // _list_->addItem(new tsl::elm::CategoryHeader("Custom Drawer", true));
87 | //
88 | // _list_->addItem(new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
89 | // renderer->drawCircle(x + 40, y + 40, 20, true, renderer->a(0xF00F));
90 | // renderer->drawCircle(x + 50, y + 50, 20, true, renderer->a(0xF0F0));
91 | // renderer->drawRect(x + 130, y + 30, 60, 40, renderer->a(0xFF00));
92 | // renderer->drawString("Hello :)", false, x + 250, y + 70, 20, renderer->a(0xFF0F));
93 | // renderer->drawRect(x + 40, y + 90, 300, 10, renderer->a(0xF0FF));
94 | // }), 100);
95 | //
96 | // // Track bars
97 | // _list_->addItem(new tsl::elm::CategoryHeader("Track bars"));
98 | // _list_->addItem(new tsl::elm::TrackBar("\u2600"));
99 | // _list_->addItem(new tsl::elm::StepTrackBar("\uE13C", 20));
100 | // _list_->addItem(new tsl::elm::NamedStepTrackBar("\uE132", { "Selection 1", "Selection 2", "Selection 3" }));
101 |
102 | // Add the list to the frame for it to be drawn
103 | _frame_->setContent(_list_);
104 |
105 | }
106 |
107 | #endif // SIMPLEMODMANAGER_GAMEBROWSERGUI_IMPL_H
108 |
109 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/include/implementation/OverlayGui.impl.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Adrien Blanchet on 18/04/2023.
3 | //
4 |
5 | #ifndef SIMPLEMODMANAGER_OVERLAYGUI_IMPL_H
6 | #define SIMPLEMODMANAGER_OVERLAYGUI_IMPL_H
7 |
8 | #include "OverlayGuiLoader.h"
9 |
10 | #include
11 |
12 |
13 | std::unique_ptr OverlayGuiLoader::loadInitialGui() {
14 | // Initial Gui to load. It's possible to pass arguments to its constructor like this
15 | return initially();
16 | }
17 |
18 | void OverlayGuiLoader::initServices() {
19 | // libtesla already initialized fs, hid, pl, pmdmnt, hid:sys and set:sys
20 | tsl::hlp::ScopeGuard dirGuard( [&]{} );
21 | }
22 | void OverlayGuiLoader::exitServices() {
23 | // Called at the end to clean up all services previously initialized
24 | }
25 |
26 | void OverlayGuiLoader::onShow(){
27 | // Called before overlay wants to change from invisible to visible state
28 | }
29 | void OverlayGuiLoader::onHide(){
30 | // Called before overlay wants to change from visible to invisible state
31 | }
32 |
33 |
34 | #endif //SIMPLEMODMANAGER_OVERLAYGUI_IMPL_H
35 |
--------------------------------------------------------------------------------
/src/Applications/SimpleModManagerOverlay/src/SimpleModManagerOverlay.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Adrien Blanchet on 18/04/2023.
3 | //
4 |
5 | // Needed before including tesla header in multiple files
6 | #define TESLA_INIT_IMPL
7 |
8 | #include "OverlayGuiLoader.h"
9 | //#include "ExampleGui.h"
10 |
11 | #include // The Tesla Header
12 |
13 | #include "switch.h"
14 |
15 |
16 | int main(int argc, char **argv) {
17 | return tsl::loop(argc, argv);
18 | }
19 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # Applications & Libs
3 | #
4 |
5 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/Applications )
6 |
7 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/ModManagerCore )
8 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/ModManagerGui )
9 | add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/ModManagerOverlay )
10 |
11 |
--------------------------------------------------------------------------------
/src/ModManagerCore/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | #
2 | # Building ModManagerCore lib
3 | #
4 |
5 |
6 | set( SRC_FILES
7 | ${CMAKE_CURRENT_SOURCE_DIR}/src/GameBrowser.cpp
8 | ${CMAKE_CURRENT_SOURCE_DIR}/src/ModManager.cpp
9 | ${CMAKE_CURRENT_SOURCE_DIR}/src/ModsPreseter.cpp
10 | ${CMAKE_CURRENT_SOURCE_DIR}/src/ConfigHandler.cpp
11 | ${CMAKE_CURRENT_SOURCE_DIR}/src/Selector.cpp
12 | ${CMAKE_CURRENT_SOURCE_DIR}/src/Toolbox.cpp
13 | )
14 |
15 |
16 | add_library( ModManagerCore STATIC ${SRC_FILES} )
17 | install( TARGETS ModManagerCore DESTINATION lib )
18 |
19 | target_include_directories( ModManagerCore PUBLIC
20 | ${CMAKE_CURRENT_SOURCE_DIR}/include
21 | )
22 |
23 | target_link_libraries( ModManagerCore PUBLIC
24 | switch::libnx
25 | -L/opt/devkitpro/portlibs/switch/lib
26 | -L/opt/devkitpro/libnx/lib
27 | ${ZLIB_LIBRARIES}
28 | ${FREETYPE_LIBRARIES}
29 | # -lglfw3 -lEGL -lglad -lglapi -ldrm_nouveau -lm -lnx
30 | )
31 |
--------------------------------------------------------------------------------
/src/ModManagerCore/include/ConfigHandler.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Nadrino on 16/10/2019.
3 | //
4 |
5 | #ifndef SIMPLEMODMANAGER_CONFIGHANDLER_H
6 | #define SIMPLEMODMANAGER_CONFIGHANDLER_H
7 |
8 |
9 | #include "GenericToolbox.String.h"
10 | #include "GenericToolbox.Macro.h"
11 |
12 | #include