1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-12-22 16:42:11 +00:00

Integrate borealis main branch into the nxdumptool codebase.

Only builds the borealis demo atm.
This commit is contained in:
Pablo Curiel 2021-06-22 09:17:55 -04:00
parent 980d1c7680
commit 1654862198
61 changed files with 831 additions and 190 deletions

1
.gitignore vendored
View file

@ -14,5 +14,6 @@ host/nxdumptool
*.log
*.spec
*.exe
*.dksh
main.cpp
/code_templates/tmp/*

View file

@ -40,7 +40,7 @@ include $(DEVKITPRO)/libnx/switch_rules
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GIT_COMMIT := $(shell git rev-parse --short HEAD)
GIT_REV := ${GIT_BRANCH}.${GIT_COMMIT}
GIT_REV := ${GIT_BRANCH}-${GIT_COMMIT}
ifneq (, $(strip $(shell git status --porcelain 2>/dev/null)))
GIT_REV := $(GIT_REV)-dirty
@ -54,6 +54,7 @@ APP_TITLE := nxdumptool
APP_AUTHOR := DarkMatterCore
APP_VERSION := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_MICRO}
# TODO: remove this after the PoC builds are no longer needed.
ifneq ($(origin BUILD_TYPE),undefined)
APP_TITLE := ${BUILD_TYPE}
endif
@ -62,14 +63,16 @@ TARGET := ${APP_TITLE}
BUILD := build
SOURCES := source source/core source/fatfs
DATA := data
ICON := romfs/icon/${APP_TITLE}.jpg
ICON := resources/img/${APP_TITLE}.jpg
INCLUDES := include include/core include/fatfs
ROMFS := romfs
ROMFS := resources
BOREALIS_PATH := libs/borealis
USBHSFS_PATH := $(TOPDIR)/libs/libusbhsfs
BOREALIS_PATH := libs/borealis
BOREALIS_RESOURCES := romfs:/
# Output folders for autogenerated files in RomFS.
OUT_SHADERS := shaders
#---------------------------------------------------------------------------------
# options for code generation
@ -80,18 +83,21 @@ CFLAGS := -g -Wall -Werror -O2 -ffunction-sections $(ARCH) $(DEFINES) $(INCLUDE
CFLAGS += -DVERSION_MAJOR=${VERSION_MAJOR} -DVERSION_MINOR=${VERSION_MINOR} -DVERSION_MICRO=${VERSION_MICRO}
CFLAGS += -DAPP_TITLE=\"${APP_TITLE}\" -DAPP_AUTHOR=\"${APP_AUTHOR}\" -DAPP_VERSION=\"${APP_VERSION}\"
CFLAGS += -DGIT_BRANCH=\"${GIT_BRANCH}\" -DGIT_COMMIT=\"${GIT_COMMIT}\" -DGIT_REV=\"${GIT_REV}\"
CFLAGS += -DBOREALIS_RESOURCES="\"${BOREALIS_RESOURCES}\""
CFLAGS += `aarch64-none-elf-pkg-config zlib --cflags`
CFLAGS += `aarch64-none-elf-pkg-config libxml-2.0 --cflags`
CFLAGS += `aarch64-none-elf-pkg-config json-c --cflags`
CFLAGS += `aarch64-none-elf-pkg-config libturbojpeg --cflags`
#CFLAGS += `aarch64-none-elf-pkg-config json-c --cflags`
CXXFLAGS := $(CFLAGS) -std=c++20 -O2 -Wno-volatile -Wno-unused-parameter
CXXFLAGS := $(CFLAGS) -std=c++20 -O2 -Wno-volatile
# TODO: remove this if a fix is ever pushed to borealis.
CFLAGS += -Wno-unused-function -Wno-misleading-indentation
CXXFLAGS += -Wno-unused-function -Wno-misleading-indentation
ASFLAGS := -g $(ARCH)
LDFLAGS := -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lcurl -lmbedtls -lmbedx509 -lmbedcrypto -lxml2 -lz -lusbhsfs -lntfs-3g -llwext4 -lnx
#LIBS += -ljson-c
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
@ -119,6 +125,7 @@ export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
GLSLFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.glsl)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
@ -140,6 +147,18 @@ export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
ifneq ($(strip $(ROMFS)),)
ROMFS_TARGETS :=
ROMFS_FOLDERS :=
ifneq ($(strip $(OUT_SHADERS)),)
ROMFS_SHADERS := $(ROMFS)/$(OUT_SHADERS)
ROMFS_TARGETS += $(patsubst %.glsl, $(ROMFS_SHADERS)/%.dksh, $(GLSLFILES))
ROMFS_FOLDERS += $(ROMFS_SHADERS)
endif
export ROMFS_DEPS := $(foreach file,$(ROMFS_TARGETS),$(CURDIR)/$(file))
endif
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
@ -188,10 +207,10 @@ ifneq ($(ROMFS),)
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
endif
.PHONY: $(BUILD) clean clean_all all
.PHONY: all clean clean_all
#---------------------------------------------------------------------------------
all: $(BUILD)
all: $(ROMFS_TARGETS) | $(BUILD)
$(BUILD): usbhsfs
@[ -d $@ ] || mkdir -p $@
@ -200,13 +219,46 @@ $(BUILD): usbhsfs
usbhsfs:
@$(MAKE) --no-print-directory -C $(USBHSFS_PATH) BUILD_TYPE=GPL release
ifneq ($(strip $(ROMFS_TARGETS)),)
$(ROMFS_TARGETS): | $(ROMFS_FOLDERS)
$(ROMFS_FOLDERS):
@mkdir -p $@
$(ROMFS_SHADERS)/%_vsh.dksh: %_vsh.glsl
@echo {vert} $(notdir $<)
@uam -s vert -o $@ $<
$(ROMFS_SHADERS)/%_tcsh.dksh: %_tcsh.glsl
@echo {tess_ctrl} $(notdir $<)
@uam -s tess_ctrl -o $@ $<
$(ROMFS_SHADERS)/%_tesh.dksh: %_tesh.glsl
@echo {tess_eval} $(notdir $<)
@uam -s tess_eval -o $@ $<
$(ROMFS_SHADERS)/%_gsh.dksh: %_gsh.glsl
@echo {geom} $(notdir $<)
@uam -s geom -o $@ $<
$(ROMFS_SHADERS)/%_fsh.dksh: %_fsh.glsl
@echo {frag} $(notdir $<)
@uam -s frag -o $@ $<
$(ROMFS_SHADERS)/%.dksh: %.glsl
@echo {comp} $(notdir $<)
@uam -s comp -o $@ $<
endif
#---------------------------------------------------------------------------------
clean:
@echo clean ...
ifeq ($(strip $(APP_JSON)),)
@rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
@rm -fr $(BUILD) $(ROMFS_FOLDERS) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
else
@rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
@rm -fr $(BUILD) $(ROMFS_FOLDERS) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
endif
clean_all: clean
@ -226,9 +278,9 @@ ifeq ($(strip $(APP_JSON)),)
all : $(OUTPUT).nro
ifeq ($(strip $(NO_NACP)),)
$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp $(ROMFS_DEPS)
else
$(OUTPUT).nro : $(OUTPUT).elf
$(OUTPUT).nro : $(OUTPUT).elf $(ROMFS_DEPS)
endif
else

View file

@ -264,7 +264,7 @@ static void nspDump(TitleInfo *title_info, u64 free_space)
consolePrint("%s #%u initialize nca ctx succeeded\n", titleGetNcmContentTypeName(content_info->content_type), content_info->id_offset);
// don't go any further with this nca if we can't access its fs data because it's pointless
// to do: add preload warning
// TODO: add preload warning
if (cur_nca_ctx->rights_id_available && !cur_nca_ctx->titlekey_retrieved)
{
j++;

View file

@ -254,7 +254,7 @@ static void dump_thread_func(void *arg)
consolePrint("%s #%u initialize nca ctx succeeded\n", titleGetNcmContentTypeName(content_info->content_type), content_info->id_offset);
// don't go any further with this nca if we can't access its fs data because it's pointless
// to do: add preload warning
// TODO: add preload warning
if (cur_nca_ctx->rights_id_available && !cur_nca_ctx->titlekey_retrieved)
{
j++;

View file

@ -0,0 +1,34 @@
/*
Copyright 2020-2021 natinusala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <borealis.hpp>
class CaptionedImage : public brls::Box
{
public:
CaptionedImage();
void onChildFocusGained(brls::View* directChild, brls::View* focusedView) override;
void onChildFocusLost(brls::View* directChild, brls::View* focusedView) override;
static brls::View* create();
private:
BRLS_BIND(brls::Image, image, "image");
BRLS_BIND(brls::Label, label, "label");
};

View file

@ -0,0 +1,30 @@
/*
Copyright 2021 natinusala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <borealis.hpp>
class ComponentsTab : public brls::Box
{
public:
ComponentsTab();
static brls::View* create();
private:
bool onPrimaryButtonClicked(brls::View* view);
};

View file

@ -1,5 +1,5 @@
/*
* bfsar.h
* nxdt_bfsar.h
*
* Copyright (c) 2020-2021, DarkMatterCore <pabloacurielz@gmail.com>.
*
@ -21,8 +21,8 @@
#pragma once
#ifndef __BFSAR_H__
#define __BFSAR_H__
#ifndef __NXDT_BFSAR_H__
#define __NXDT_BFSAR_H__
#ifdef __cplusplus
extern "C" {
@ -41,4 +41,4 @@ const char *bfsarGetFilePath(void);
}
#endif
#endif /* __BFSAR_H__ */
#endif /* __NXDT_BFSAR_H__ */

26
include/main_activity.hpp Normal file
View file

@ -0,0 +1,26 @@
/*
Copyright 2020-2021 natinusala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <borealis.hpp>
class MainActivity : public brls::Activity
{
public:
// Declare that the content of this activity is the given XML file
CONTENT_FROM_XML_RES("activity/main.xml");
};

View file

@ -0,0 +1,27 @@
/*
Copyright 2020-2021 natinusala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include <borealis.hpp>
class RecyclingListTab : public brls::Box
{
public:
RecyclingListTab();
static brls::View* create();
};

@ -1 +1 @@
Subproject commit 44a95c77bae903623d822dab1c3a505810f1f30f
Subproject commit 53e96bd1b3b249f897eb22a96dd388492ae1a0cd

View file

@ -0,0 +1,48 @@
{
"title": "Borealis Demo App",
"tabs": {
"components": "Basic components",
"layout": "Layout and alignment",
"recycling": "Recycling lists",
"popups": "Popups, notifications and dialogs",
"hos_layout": "Horizon layouts",
"misc_layouts": "Misc. layouts",
"misc_components": "Misc. components",
"misc_tools": "Misc. dev tools",
"about": "About borealis"
},
"welcome": "Welcome to the borealis demo! Feel free to explore and discover what the library can do.",
"components": {
"buttons_header": "Buttons",
"button_primary": "Primary button",
"button_highlight": "\uE13C Highlight button",
"button_wrapping": "Default button with wrapping text",
"button_bordered": "Bordered button",
"button_borderless": "Borderless button",
"labels_header": "Labels",
"regular_label": "This is a label. By default, they will automatically wrap and expand their height, should the remaining vertical space allow it. Otherwise, they will be truncated, like some of the tabs of the sidebar.",
"label_left": "This label is left-aligned",
"label_center": "This label is center-aligned",
"label_right": "This label is right-aligned",
"images_header_title": "Images",
"images_header_subtitle": "Focus them to see the scaling method",
"images_downscaled": "Downscaled",
"images_original": "Original",
"images_upscaled": "Upscaled",
"images_stretched": "Stretched",
"images_cropped": "Cropped"
},
"about": {
"title": "borealis",
"description": "A hardware accelerated, controller and TV oriented UI library for PC and Nintendo Switch (libnx).",
"github": "Find it on github.com/natinusala/borealis",
"licence": "Licensed under Apache 2.0",
"logo_credit": "Logo by @MeganRoshelle"
}
}

View file

@ -0,0 +1,15 @@
{
"hints": {
"ok": "OK",
"back": "Retour",
"exit": "Quitter"
},
"crash_frame": {
"button": "OK"
},
"thumbnail_sidebar": {
"save": "Sauvegarder"
}
}

View file

@ -0,0 +1 @@
{}

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

BIN
resources/img/tiles.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View file

@ -0,0 +1,102 @@
<brls:TabFrame
title="@i18n/demo/title"
iconInterpolation="linear"
icon="@res/img/borealis_96.png">
<!-- Dynamic tab - required to get references to the views in the code -->
<brls:Tab label="@i18n/demo/tabs/components" >
<ComponentsTab />
</brls:Tab>
<!-- Static tab linking to another XML -->
<brls:Tab label="@i18n/demo/tabs/layout" >
<brls:View xml="@res/xml/tabs/layout.xml" />
</brls:Tab>
<brls:Tab label="@i18n/demo/tabs/recycling">
<RecyclingListTab />
</brls:Tab>
<brls:Separator />
<brls:Tab label="@i18n/demo/tabs/popups" />
<brls:Tab label="@i18n/demo/tabs/hos_layout" />
<brls:Separator />
<brls:Tab label="@i18n/demo/tabs/misc_layouts" />
<brls:Tab label="@i18n/demo/tabs/misc_components" />
<brls:Tab label="@i18n/demo/tabs/misc_tools" />
<brls:Separator />
<!-- Static tab with inline XML -->
<brls:Tab label="@i18n/demo/tabs/about" >
<brls:Box
width="auto"
height="auto"
axis="column"
paddingTop="@style/about/padding_top_bottom"
paddingBottom="@style/about/padding_top_bottom"
paddingLeft="@style/about/padding_sides"
paddingRight="@style/about/padding_sides" >
<brls:Image
width="auto"
height="33%"
image="@res/img/borealis_256.png"
marginBottom="@style/about/description_margin"/>
<brls:Box
width="auto"
height="auto"
axis="row"
marginBottom="@style/about/description_margin">
<brls:Label
width="40%"
height="auto"
text="@i18n/demo/about/title"
fontSize="36"
horizontalAlign="right"
verticalAlign="top" />
<brls:Label
width="auto"
height="auto"
text="@i18n/demo/about/description"
marginLeft="@style/about/description_margin" />
</brls:Box>
<brls:Box
width="auto"
height="auto"
axis="column"
alignItems="center"
justifyContent="spaceEvenly"
grow="1.0" >
<brls:Label
width="auto"
height="auto"
text="@i18n/demo/about/github" />
<brls:Label
width="auto"
height="auto"
text="@i18n/demo/about/licence" />
<brls:Label
width="auto"
height="auto"
text="@i18n/demo/about/logo_credit" />
</brls:Box>
</brls:Box>
</brls:Tab>
</brls:TabFrame>

View file

@ -0,0 +1,216 @@
<brls:Box
width="auto"
height="auto">
<brls:ScrollingFrame
width="auto"
height="auto"
grow="1.0" >
<brls:Box
width="auto"
height="auto"
axis="column"
paddingLeft="@style/brls/tab_frame/content_padding_sides"
paddingRight="@style/brls/tab_frame/content_padding_sides"
paddingTop="@style/brls/tab_frame/content_padding_top_bottom"
paddingBottom="@style/brls/tab_frame/content_padding_top_bottom">
<brls:Label
width="auto"
height="auto"
text="@i18n/demo/welcome"
marginBottom="10px" />
<!-- Buttons -->
<brls:Header
width="auto"
height="auto"
title="@i18n/demo/components/buttons_header"
marginBottom="30px" />
<brls:Box
width="100%"
height="auto"
axis="row"
marginBottom="30px">
<brls:Button
id="button_primary"
width="auto"
height="auto"
style="primary"
grow="1.0"
marginRight="30px"
text="@i18n/demo/components/button_primary" />
<brls:Button
id="button_highlight"
width="auto"
height="auto"
style="highlight"
text="@i18n/demo/components/button_highlight"
focusDown="button_bordered" />
</brls:Box>
<brls:Box
width="100%"
height="auto"
axis="row"
marginBottom="30px">
<brls:Button
width="33%"
height="auto"
marginRight="30px"
text="@i18n/demo/components/button_wrapping" />
<brls:Box
width="auto"
height="auto"
grow="1.0"
axis="column">
<brls:Button
id="button_bordered"
width="auto"
height="auto"
padding="10px"
style="bordered"
fontSize="16"
text="@i18n/demo/components/button_bordered"
marginBottom="30px" />
<brls:Button
width="auto"
height="auto"
padding="10px"
style="borderless"
fontSize="16"
text="@i18n/demo/components/button_borderless" />
</brls:Box>
</brls:Box>
<!-- Labels -->
<brls:Header
width="auto"
height="auto"
title="@i18n/demo/components/labels_header"
marginBottom="30px" />
<brls:Label
width="auto"
height="auto"
text="@i18n/demo/components/regular_label"
marginBottom="30px" />
<brls:Box
width="auto"
height="auto"
axis="row"
justifyContent="spaceEvenly"
marginBottom="30px" >
<brls:Label
width="30%"
height="auto"
text="@i18n/demo/components/label_left"
horizontalAlign="left" />
<brls:Label
width="30%"
height="auto"
text="@i18n/demo/components/label_center"
horizontalAlign="center" />
<brls:Label
width="30%"
height="auto"
text="@i18n/demo/components/label_right"
horizontalAlign="right" />
</brls:Box>
<!-- Images -->
<brls:Header
width="auto"
height="auto"
title="@i18n/demo/components/images_header_title"
subtitle="@i18n/demo/components/images_header_subtitle"
marginBottom="30px" />
<brls:Box
width="auto"
height="auto"
axis="row"
alignItems="center"
justifyContent="spaceEvenly"
marginBottom="30px">
<CaptionedImage
width="auto"
height="auto"
imageWidth="76px"
imageHeight="76px"
image="@res/img/tiles.png"
caption="@i18n/demo/components/images_downscaled" />
<CaptionedImage
id="image_original"
width="auto"
height="auto"
imageWidth="auto"
imageHeight="auto"
image="@res/img/tiles.png"
caption="@i18n/demo/components/images_original" />
<CaptionedImage
id="image_upscaled"
width="auto"
height="auto"
imageWidth="170px"
imageHeight="170px"
maxWidth="170px"
image="@res/img/tiles.png"
caption="@i18n/demo/components/images_upscaled"
focusDown="image_cropped" />
</brls:Box>
<brls:Box
width="auto"
height="auto"
axis="row"
alignItems="center"
justifyContent="spaceEvenly">
<CaptionedImage
width="auto"
height="auto"
imageWidth="400px"
imageHeight="75px"
image="@res/img/tiles.png"
scalingType="stretch"
caption="@i18n/demo/components/images_stretched" />
<CaptionedImage
id="image_cropped"
width="auto"
height="auto"
imageWidth="auto"
imageHeight="75px"
image="@res/img/tiles.png"
scalingType="crop"
caption="@i18n/demo/components/images_cropped"
focusUp="image_upscaled" />
</brls:Box>
</brls:Box>
</brls:ScrollingFrame>
</brls:Box>

View file

@ -0,0 +1,4 @@
<brls:Rectangle
width="auto"
height="auto"
color="#50FFDD" />

View file

@ -0,0 +1,11 @@
<brls:Box
width="auto"
height="auto">
<brls:Rectangle
width="auto"
height="auto"
grow="1.0"
color="#0000FF" />
</brls:Box>

View file

@ -0,0 +1,21 @@
<brls:Box
width="auto"
height="auto"
axis="column"
alignItems="center">
<brls:Image
id="image"
width="auto"
height="auto"
focusable="true"
marginBottom="20px" />
<brls:Label
id="label"
width="auto"
height="auto"
horizontalAlign="center"
textColor="@theme/captioned_image/caption" />
</brls:Box>

View file

@ -1,34 +0,0 @@
{
"description": "Nintendo Switch Dump Tool",
"copyright": "Licensed under GPLv3+\n\u00A9 2020 - 2021 {0}\n{1}",
"dependencies": {
"header": "Dependencies",
"line_00": "\uE016 {0} is powered by Borealis, a hardware-accelerated UI library: {1}.",
"line_01": "\uE016 USB Mass Storage device support is powered by libusbhsfs: {0}.",
"line_02": "\uE016 FatFs is used to mount FAT volumes from the eMMC storage: {0}.",
"line_03": "\uE016 LZ4 is used to decompress NSO binaries: {0}."
},
"acknowledgments": {
"header": "Acknowledgments",
"line_00": "\uE016 Switchbrew and libnx contributors.",
"line_01": "\uE016 SciresM, for hactool and Atmosphère-NX.",
"line_02": "\uE016 shchmue, for Lockpick and its runtime key-collection algorithm, as well as helping in reverse engineering tasks.",
"line_03": "\uE016 Adubbz, for Tinfoil and its ES service bindings.",
"line_04": "\uE016 RattletraPM, for the awesome icon.",
"line_05": "\uE016 Whovian9369, for being a key piece throughout the whole development by providing with lots of testing and cool ideas.",
"line_06": "\uE016 0Liam, Shadów and SimonTime, for their tremendous help in understanding Nintendo Switch file and data formats.",
"line_07": "\uE016 The folks from NSWDB.COM and No-Intro.org, for being kind enough to put up public APIs to perform online checksum lookups.",
"line_08": "\uE016 The folks at the nxdumptool Discord server.",
"line_09": "\uE016 The Comfy Boyes, for always being awesome and supportive. You know who you are.",
"line_10": "\uE016 My girlfriend, for always being by my side and motivating me to keep working on all my projects. I love you. \uE87D",
"line_11": "\uE016 And, at last but not least, you! Thank you for using my work!"
},
"links": {
"header": "Additional links and resources",
"line_00": "\uE016 Discord server: {0}."
}
}

View file

@ -1,57 +0,0 @@
{
"notification": "Gamecard status change detected!",
"error_frame": {
"not_inserted": "No gamecard inserted.",
"processing": "Processing gamecard, please wait...",
"nogc_enabled": "A gamecard has been inserted, but the \"nogc\" patch is enabled.\nNothing at all can be done with the inserted gamecard.\nDisabling this patch *will* update the Lotus ASIC firmware if it's outdated.\nConsider disabling this patch if you wish to use gamecard dumping features.",
"lafw_update_required": "A gamecard has been inserted, but a Lotus ASIC firmware update is required.\nUpdate your console using the inserted gamecard and try again.",
"info_not_loaded": "A gamecard has been inserted, but an unexpected I/O error occurred.\nPlease report this issue at \"{0}\"."
},
"list": {
"properties_table": {
"header": "Gamecard properties",
"capacity": "Capacity",
"total_size": "Total size",
"trimmed_size": "Trimmed size",
"update_version": "Bundled update version",
"lafw_version": "Required LAFW version",
"lafw_version_value": "%lu or greater (%s)",
"sdk_version": "SDK version",
"compatibility_type": "Compatibility type"
},
"dump_options": "Dump options",
"dump_card_image": {
"label": "Dump gamecard image (XCI)",
"description": "Generates a raw gamecard image. This is the option most people will want to use."
},
"dump_certificate": {
"label": "Dump gamecard certificate",
"description": "The gamecard certificate is used to unequivocally identify each individual gamecard."
},
"dump_header": {
"label": "Dump gamecard header",
"description": "The gamecard header holds information such as the location of the root HFS partition and the gamecard capacity.\nOnly useful for developers, preservationists and advanced users."
},
"dump_decrypted_cardinfo": {
"label": "Dump decrypted CardInfo area",
"description": "The CardInfo area holds information such as the bundled system update version and the Lotus ASIC firmware version required by the gamecard.\nThis area is part of the gamecard header, but it's always encrypted.\nOnly useful for developers, preservationists and advanced users."
},
"dump_initial_data": {
"label": "Dump InitialData area",
"description": "The InitialData area holds cryptographic information used by the Lotus ASIC to communicate with the gamecard.\nIt can't be dumped through normal means - it's not part of the storage areas from gamecard images.\nOnly useful for developers, preservationists and advanced users."
},
"dump_hfs_partitions": {
"label": "Dump Hash File System (HFS) partitions",
"description": "Dumps data from the HFS partitions within the gamecard storage areas, in both raw and extracted forms."
}
}
}

View file

@ -1,3 +0,0 @@
{
"unknown": "Unknown"
}

View file

@ -1,15 +0,0 @@
{
"applet_mode": "\uE8B2 Applet Mode \uE8B2",
"date": "{1:02d}/{2:02d}/{0} {3:02d}:{4:02d}:{5:02d} {6}",
"not_connected": "Not connected",
"tabs": {
"gamecard": "Gamecard",
"user_titles": "User titles",
"system_titles": "System titles",
"options": "Options",
"about": "About"
}
}

View file

@ -1,4 +0,0 @@
{
"no_titles_available": "No user titles available.",
"notification": "User titles list updated!"
}

View file

@ -0,0 +1,65 @@
/*
Copyright 2020-2021 natinusala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "captioned_image.hpp"
CaptionedImage::CaptionedImage()
{
// Load the XML file and inflate ourself with its content
// The top-level Box in the XML corresponds to us, and every XML child
// is added to our children (and the attributes are applied)
// The CaptionedImage instance basically becomes what's written in the XML
this->inflateFromXMLRes("xml/views/captioned_image.xml");
// The label stays hidden until focused, so hide it right away
this->label->hide([] {});
// Forward Image and Label XML attributes
this->forwardXMLAttribute("scalingType", this->image);
this->forwardXMLAttribute("image", this->image);
this->forwardXMLAttribute("focusUp", this->image);
this->forwardXMLAttribute("focusRight", this->image);
this->forwardXMLAttribute("focusDown", this->image);
this->forwardXMLAttribute("focusLeft", this->image);
this->forwardXMLAttribute("imageWidth", this->image, "width");
this->forwardXMLAttribute("imageHeight", this->image, "height");
this->forwardXMLAttribute("caption", this->label, "text");
}
void CaptionedImage::onChildFocusGained(brls::View* directChild, brls::View* focusedView)
{
// Called when a child of ours gets focused, in that case it's the Image
Box::onChildFocusGained(directChild, focusedView);
this->label->show([] {});
}
void CaptionedImage::onChildFocusLost(brls::View* directChild, brls::View* focusedView)
{
// Called when a child of ours losts focused, in that case it's the Image
Box::onChildFocusLost(directChild, focusedView);
this->label->hide([] {});
}
brls::View* CaptionedImage::create()
{
// Called by the XML engine to create a new CaptionedImage
return new CaptionedImage();
}

43
source/components_tab.cpp Normal file
View file

@ -0,0 +1,43 @@
/*
Copyright 2021 natinusala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "components_tab.hpp"
ComponentsTab::ComponentsTab()
{
// Inflate the tab from the XML file
this->inflateFromXMLRes("xml/tabs/components.xml");
// Bind the button click to a method using the macro (just for the sake of showcasing it, it's overkill in this situation)
BRLS_REGISTER_CLICK_BY_ID("button_primary", this->onPrimaryButtonClicked);
// Get a handle to the button and register the action directly
brls::Button* highlightButton = (brls::Button*)this->getView("button_highlight");
highlightButton->registerAction(
"Honk", brls::BUTTON_A, [](brls::View* view) { return true; }, false, brls::SOUND_HONK);
}
bool ComponentsTab::onPrimaryButtonClicked(brls::View* view)
{
brls::Logger::info("Clicked");
return true;
}
brls::View* ComponentsTab::create()
{
// Called by the XML engine to create a new ComponentsTab
return new ComponentsTab();
}

View file

@ -961,7 +961,7 @@ static bool gamecardGetHandleAndStorage(u32 partition)
NX_INLINE void gamecardCloseHandle(void)
{
/* TO DO: find a way to properly close a gamecard handle. */
/* TODO: find a way to properly close a gamecard handle. */
if (!g_gameCardHandle.value) return;
svcCloseHandle(g_gameCardHandle.value);
g_gameCardHandle.value = 0;

View file

@ -1,5 +1,5 @@
/*
* bfsar.c
* nxdt_bfsar.c
*
* Copyright (c) 2020-2021, DarkMatterCore <pabloacurielz@gmail.com>.
*
@ -20,7 +20,7 @@
*/
#include "nxdt_utils.h"
#include "bfsar.h"
#include "nxdt_bfsar.h"
#include "romfs.h"
#include "title.h"
@ -75,6 +75,8 @@ bool bfsarInitialize(void)
/* Create BFSAR file in the SD card root directory. */
if (use_root) sprintf(g_bfsarPath, "/" BFSAR_FILENAME);
LOG_MSG("BFSAR path: \"%s\".", g_bfsarPath);
/* Check if the BFSAR file is already available and not empty. */
bfsar_file = fopen(g_bfsarPath, "rb");
if (bfsar_file)
@ -104,16 +106,16 @@ bool bfsarInitialize(void)
}
/* Initialize NCA context. */
if (!ncaInitializeContext(nca_ctx, NcmStorageId_BuiltInSystem, 0, titleGetContentInfoByTypeAndIdOffset(title_info, NcmContentType_Data, 0), NULL))
if (!ncaInitializeContext(nca_ctx, NcmStorageId_BuiltInSystem, 0, titleGetContentInfoByTypeAndIdOffset(title_info, NcmContentType_Program, 0), NULL))
{
LOG_MSG("Failed to initialize qlaunch Data NCA context!");
LOG_MSG("Failed to initialize qlaunch Program NCA context!");
break;
}
/* Initialize RomFS context. */
if (!romfsInitializeContext(&romfs_ctx, &(nca_ctx->fs_ctx[0])))
if (!romfsInitializeContext(&romfs_ctx, &(nca_ctx->fs_ctx[1])))
{
LOG_MSG("Failed to initialize RomFS context for qlaunch Data NCA!");
LOG_MSG("Failed to initialize RomFS context for qlaunch Program NCA!");
break;
}
@ -185,7 +187,7 @@ void bfsarExit(void)
{
/* Clear BFSAR file path. */
*g_bfsarPath = '\0';
g_bfttfInterfaceInit = false;
g_bfsarInterfaceInit = false;
}
}
@ -195,7 +197,7 @@ const char *bfsarGetFilePath(void)
SCOPED_TRY_LOCK(&g_bfsarMutex)
{
if (g_bfttfInterfaceInit) ret = (const char*)g_bfsarPath;
if (g_bfsarInterfaceInit) ret = (const char*)g_bfsarPath;
}
return ret;

View file

@ -29,7 +29,7 @@
#include "usb.h"
#include "title.h"
#include "bfttf.h"
#include "bfsar.h"
#include "nxdt_bfsar.h"
#include "fatfs/ff.h"
/* Reference: https://docs.microsoft.com/en-us/windows/win32/fileio/filesystem-functionality-comparison#limits. */
@ -87,7 +87,7 @@ static size_t utilsGetUtf8CodepointCount(const char *str, size_t str_size, size_
bool utilsInitializeResources(const int program_argc, const char **program_argv)
{
Result rc = 0;
bool ret = false;
bool ret = false, flag = false;
SCOPED_LOCK(&g_resourcesMutex)
{
@ -160,7 +160,12 @@ bool utilsInitializeResources(const int program_argc, const char **program_argv)
/* Mount eMMC BIS System partition. */
if (!utilsMountEmmcBisSystemPartitionStorage()) break;
/* Enable video recording. */
rc = appletIsGamePlayRecordingSupported(&flag);
if (R_SUCCEEDED(rc) && flag) appletInitializeGamePlayRecording();
/* Disable screen dimming and auto sleep. */
/* TODO: only use this function right before starting a dump procedure - make sure to handle power button presses as well. */
appletSetMediaPlaybackState(true);
/* Overclock system. */
@ -839,7 +844,7 @@ static void utilsOverclockSystemAppletHook(AppletHookType hook, void *param)
if (hook != AppletHookType_OnOperationMode && hook != AppletHookType_OnPerformanceMode) return;
/* TO DO: read config here to actually know the value to use with utilsOverclockSystem. */
/* TODO: read config here to actually know the value to use with utilsOverclockSystem. */
utilsOverclockSystem(true);
}

View file

@ -1,54 +1,59 @@
/*
* main.cpp
*
* Copyright (c) 2020-2021, DarkMatterCore <pabloacurielz@gmail.com>.
*
* This file is part of nxdumptool (https://github.com/DarkMatterCore/nxdumptool).
*
* nxdumptool is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nxdumptool is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <nxdt_utils.h>
#include <scope_guard.hpp>
#include <root_view.hpp>
int main(int argc, char *argv[])
#include <borealis.hpp>
#include "captioned_image.hpp"
#include "components_tab.hpp"
#include "main_activity.hpp"
#include "recycling_list_tab.hpp"
using namespace brls::literals; // for _i18n
int main(int argc, char* argv[])
{
/* Set scope guard to clean up resources at exit. */
ON_SCOPE_EXIT { utilsCloseResources(); };
/* Initialize application resources. */
if (!utilsInitializeResources(argc, (const char**)argv)) return EXIT_FAILURE;
/* Set Borealis log level. */
// Set log level
// We recommend to use INFO for real apps
brls::Logger::setLogLevel(brls::LogLevel::DEBUG);
/* Load Borealis translation files. */
brls::i18n::loadTranslations();
/* Initialize Borealis. */
if (!brls::Application::init(APP_TITLE)) return EXIT_FAILURE;
/* Create root view. */
nxdt::views::RootView *root_view = new nxdt::views::RootView();
/* Add the root view to the stack. */
brls::Application::pushView(root_view);
/* Run the application. */
while(brls::Application::mainLoop());
/* Exit. */
// Init the app and i18n
if (!brls::Application::init())
{
brls::Logger::error("Unable to init Borealis application");
return EXIT_FAILURE;
}
brls::Application::createWindow("demo/title"_i18n);
// Have the application register an action on every activity that will quit when you press BUTTON_START
brls::Application::setGlobalQuit(true);
// Register custom views (including tabs, which are views)
brls::Application::registerXMLView("CaptionedImage", CaptionedImage::create);
brls::Application::registerXMLView("RecyclingListTab", RecyclingListTab::create);
brls::Application::registerXMLView("ComponentsTab", ComponentsTab::create);
// Add custom values to the theme
brls::getLightTheme().addColor("captioned_image/caption", nvgRGB(2, 176, 183));
brls::getDarkTheme().addColor("captioned_image/caption", nvgRGB(51, 186, 227));
// Add custom values to the style
brls::getStyle().addMetric("about/padding_top_bottom", 50);
brls::getStyle().addMetric("about/padding_sides", 75);
brls::getStyle().addMetric("about/description_margin", 50);
// Create and push the main activity to the stack
brls::Application::pushActivity(new MainActivity());
// Run the app
while (brls::Application::mainLoop());
// Exit
return EXIT_SUCCESS;
}

17
source/main_activity.cpp Normal file
View file

@ -0,0 +1,17 @@
/*
Copyright 2020-2021 natinusala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "main_activity.hpp"

View file

@ -0,0 +1,29 @@
/*
Copyright 2020-2021 natinusala
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "recycling_list_tab.hpp"
RecyclingListTab::RecyclingListTab()
{
// Inflate the tab from the XML file
this->inflateFromXMLRes("xml/tabs/recycling_list.xml");
}
brls::View* RecyclingListTab::create()
{
// Called by the XML engine to create a new RecyclingListTab
return new RecyclingListTab();
}