Skip to content

Commit

Permalink
Refactor sysmodule
Browse files Browse the repository at this point in the history
* Deprecate brightness control
* Remove chainloader, implement config parsing in main sysmodule
* Remove libstratosphere dependency
* Simplify IPC API: remove profile subobjects
* Clean up accumulated cruft
  • Loading branch information
averne committed May 4, 2024
1 parent 438ffd6 commit 1d337fc
Show file tree
Hide file tree
Showing 55 changed files with 1,182 additions and 1,961 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
container: devkitpro/devkita64:20220216
container: devkitpro/devkita64:latest

steps:
- name: Install 7z
Expand All @@ -19,7 +19,6 @@ jobs:
run: |
make -C common -j$(nproc)
make dist -j$(nproc)
make dist-chl -j$(nproc)
- uses: actions/upload-artifact@master
with:
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
[submodule "lib/inih/inih"]
path = lib/inih/inih
url = https://github.com/benhoyt/inih.git
[submodule "lib/libstratosphere/libstratosphere"]
path = lib/libstratosphere/libstratosphere
url = https://github.com/averne/libstratosphere.git
[submodule "lib/libtesla"]
path = lib/libtesla
url = https://github.com/WerWolv/libtesla.git
Expand Down
14 changes: 0 additions & 14 deletions .vscode/Fizeau.code-workspace

This file was deleted.

11 changes: 3 additions & 8 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"${workspaceFolder}/lib/imgui/include",
"${workspaceFolder}/lib/imgui-nx/include",
"${workspaceFolder}/lib/inih/include",
"${workspaceFolder}/lib/libstratosphere/include",
"${workspaceFolder}/lib/nvjpg/oss-nvjpg/include",
"${workspaceFolder}/lib/libtesla/include",

Expand All @@ -22,20 +21,16 @@
"${DEVKITPRO}/portlibs/switch/include",

"${DEVKITPRO}/devkitA64/aarch64-none-elf/include",
"${DEVKITPRO}/devkitA64/lib/gcc/aarch64-none-elf/*/include",

"/usr/include"
"${DEVKITPRO}/devkitA64/lib/gcc/aarch64-none-elf/*/include"
],
"defines": [
"__aarch64__",
"__SWITCH__",
"DEBUG",
// "DEBUG",
"SYSMODULE",
// "TWILI",
"VERSION=\"0.0.0\"",
"COMMIT=\"0000000\"",
"ATMOSPHERE_IS_STRATOSPHERE",
"ATMOSPHERE_BOARD_NINTENDO_SWITCH"
"COMMIT=\"0000000\""
],
"compilerPath": "${DEVKITPRO}/devkitA64/bin/aarch64-none-elf-gcc",
"cStandard": "gnu11",
Expand Down
2 changes: 0 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
"*.nacp": true,
"*.nro": true
},
"licenser.license": "GPLv2",
"licenser.projectName": "Fizeau",
}
97 changes: 1 addition & 96 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"command": "make",
"args": [
"application",
"overlay",
"sysmodule",
"clean"
],
Expand All @@ -68,102 +69,6 @@
},
"problemMatcher": []
},
{
"label": "application all",
"type": "shell",
"command": "make",
"args": [
"application",
"-j$(nproc)"
],
"presentation": {
"reveal": "always",
"panel": "shared",
"clear": true
},
"problemMatcher": {
"base": "$gcc",
"fileLocation": "absolute"
}
},
{
"label": "application clean",
"type": "shell",
"command": "make",
"args": [
"application",
"clean"
],
"presentation": {
"panel": "shared",
"reveal": "never"
},
"problemMatcher": []
},
{
"label": "sysmodule all",
"type": "shell",
"command": "make",
"args": [
"sysmodule",
"-j$(nproc)"
],
"presentation": {
"reveal": "always",
"panel": "shared",
"clear": true
},
"problemMatcher": {
"base": "$gcc",
"fileLocation": "absolute"
}
},
{
"label": "sysmodule clean",
"type": "shell",
"command": "make",
"args": [
"sysmodule",
"clean"
],
"presentation": {
"panel": "shared",
"reveal": "never"
},
"problemMatcher": []
},
{
"label": "overlay all",
"type": "shell",
"command": "make",
"args": [
"overlay",
"-j$(nproc)"
],
"presentation": {
"reveal": "always",
"panel": "shared",
"clear": true
},
"problemMatcher": {
"base": "$gcc",
"fileLocation": "absolute"
}
},
{
"label": "overlay clean",
"type": "shell",
"command": "make",
"args": [
"overlay",
"clean"
],
"presentation": {
"panel": "shared",
"reveal": "never"
},
"problemMatcher": []
},
{
"label": "application run",
"type": "shell",
Expand Down
43 changes: 6 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export FZ_VERSION = 2.4.3
export FZ_COMMIT = $(shell git rev-parse --short HEAD)
export FZ_TID = 0100000000000F12
export FZ_CHL_TID = 010000000000CF12

# Vscode fails to parse non-english error codes
export LANG = en
Expand All @@ -16,21 +15,20 @@ export FZ_COMMIT := $(addsuffix -dirty,$(FZ_COMMIT))
endif

DIST_TARGET = $(OUT)/Fizeau-$(FZ_VERSION)-$(FZ_COMMIT).zip
DIST_CHL_TARGET = $(OUT)/Fizeau-chl-$(FZ_VERSION)-$(FZ_COMMIT).zip

# -----------------------------------------------

MODULES = application sysmodule overlay chainloader
MODULES = application sysmodule overlay

.PHONY: all dist dist-chl clean mrproper $(MODULES)
.PHONY: all dist clean mrproper $(MODULES)

all: $(MODULES)
@:

dist: $(DIST_TARGET)
@:

$(DIST_TARGET): | application overlay sysmodule
$(DIST_TARGET): | all
@rm -rf $(OUT)/Fizeau-?.?.?-*.zip

@mkdir -p $(OUT)/config/Fizeau
Expand All @@ -50,49 +48,20 @@ $(DIST_TARGET): | application overlay sysmodule
@rm -r $(OUT)/atmosphere $(OUT)/config $(OUT)/switch
@echo Compressed release to $@

dist-chl: $(DIST_CHL_TARGET)
@:

$(DIST_CHL_TARGET): | all
@rm -rf $(OUT)/Fizeau-chl*.zip

@mkdir -p $(OUT)/config/Fizeau
@mkdir -p $(OUT)/switch/Fizeau
@cp misc/default.ini $(OUT)/config/Fizeau/config.ini
@cp application/out/Fizeau.nro $(OUT)/switch/Fizeau/Fizeau.nro

@mkdir -p $(OUT)/switch/.overlays
@cp overlay/out/Fizeau.ovl $(OUT)/switch/.overlays/Fizeau.ovl

@mkdir -p $(OUT)/atmosphere/contents/$(FZ_TID)
@cp sysmodule/out/Fizeau.nsp $(OUT)/atmosphere/contents/$(FZ_TID)/exefs.nsp

@mkdir -p $(OUT)/atmosphere/contents/$(FZ_CHL_TID)/flags
@cp chainloader/out/Fizeau-chl.nsp $(OUT)/atmosphere/contents/$(FZ_CHL_TID)/exefs.nsp
@cp chainloader/toolbox.json $(OUT)/atmosphere/contents/$(FZ_CHL_TID)/toolbox.json
@touch $(OUT)/atmosphere/contents/$(FZ_CHL_TID)/flags/boot2.flag

@7z a $@ ./$(OUT)/atmosphere ./$(OUT)/config ./$(OUT)/switch >/dev/null
@rm -r $(OUT)/atmosphere $(OUT)/config $(OUT)/switch
@echo Compressed release to $@

clean:
@rm -rf out

mrproper: clean
@for dir in $(MODULES); do $(MAKE) --no-print-directory -C $$dir mrproper; done

application:
@$(MAKE) -s -C $@ $(filter-out $(MODULES) dist dist-chl,$(MAKECMDGOALS)) --no-print-directory
@$(MAKE) -s -C $@ $(filter-out $(MODULES) dist,$(MAKECMDGOALS)) --no-print-directory

sysmodule:
@$(MAKE) -s -C $@ $(filter-out $(MODULES) dist dist-chl,$(MAKECMDGOALS)) --no-print-directory
@$(MAKE) -s -C $@ $(filter-out $(MODULES) dist,$(MAKECMDGOALS)) --no-print-directory

overlay:
@$(MAKE) -s -C $@ $(filter-out $(MODULES) dist dist-chl,$(MAKECMDGOALS)) --no-print-directory

chainloader:
@$(MAKE) -s -C $@ $(filter-out $(MODULES) dist dist-chl,$(MAKECMDGOALS)) --no-print-directory
@$(MAKE) -s -C $@ $(filter-out $(MODULES) dist,$(MAKECMDGOALS)) --no-print-directory

%:
@:
3 changes: 1 addition & 2 deletions application/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ CUSTOM_LIBS = ../common ../lib/imgui-nx ../lib/imgui ../lib/inih ../lib
ROMFS = res

DEFINES = __SWITCH__ VERSION=\"$(FZ_VERSION)\" COMMIT=\"$(FZ_COMMIT)\" \
ATMOSPHERE_IS_STRATOSPHERE ATMOSPHERE_BOARD_NINTENDO_NX \
ATMOSPHERE_ARCH_ARM64 ATMOSPHERE_OS_HORIZON APPLICATION TWILI
APPLICATION NXLINK
ARCH = -march=armv8-a+crc+crypto+simd -mtune=cortex-a57 -mtp=soft -fpie
FLAGS = -Wall -pipe -g -O2 -ffunction-sections -fdata-sections
CFLAGS = -std=gnu11
Expand Down
4 changes: 2 additions & 2 deletions application/src/gfx.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 averne
// Copyright (c) 2024 averne
//
// This file is part of Fizeau.
//
Expand Down Expand Up @@ -259,7 +259,7 @@ void exit() {
deko3dExit();
}

void register_texture(dk::MemBlock memblk, dk::Image &image, const nj::Surface &surf, std::uint32_t sampler_id, std::uint32_t image_id) {
void register_texture(dk::MemBlock &memblk, dk::Image &image, const nj::Surface &surf, std::uint32_t sampler_id, std::uint32_t image_id) {
// upload data to deko3d
std::tie(memblk, image) = surf.to_deko3d(s_device, 0);

Expand Down
4 changes: 2 additions & 2 deletions application/src/gfx.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 averne
// Copyright (c) 2024 averne
//
// This file is part of Fizeau.
//
Expand Down Expand Up @@ -29,6 +29,6 @@ bool loop();
void render();
void exit();

void register_texture(dk::MemBlock memblk, dk::Image &image, const nj::Surface &surf, std::uint32_t sampler_id, std::uint32_t image_id);
void register_texture(dk::MemBlock &memblk, dk::Image &image, const nj::Surface &surf, std::uint32_t sampler_id, std::uint32_t image_id);

} // namespace fz::gfx
Loading

0 comments on commit 1d337fc

Please sign in to comment.