Compare commits
198 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad4dd48026 | ||
|
|
0474566576 | ||
|
|
09e8e50e69 | ||
|
|
db72e84c5b | ||
|
|
d47bb0a41d | ||
|
|
3b741f3180 | ||
|
|
a8965c0d4a | ||
|
|
87c277470e | ||
|
|
c1b6287437 | ||
|
|
4540dd0112 | ||
|
|
dbb0501420 | ||
|
|
28411fcdd1 | ||
|
|
7f2d0e72f2 | ||
|
|
c9552f9785 | ||
|
|
444ff3e2d1 | ||
|
|
7d56c8a381 | ||
|
|
da051f8d8f | ||
|
|
81e6bc5833 | ||
|
|
ca5ea827b2 | ||
|
|
b700fff9ac | ||
|
|
81741364a7 | ||
|
|
faebc42f0d | ||
|
|
63e11ca377 | ||
|
|
54a2215e04 | ||
|
|
5edc3869cd | ||
|
|
a772d660f3 | ||
|
|
3c504cc85d | ||
|
|
0a2c16db0c | ||
|
|
2bd84c8d5a | ||
|
|
7cd668efb7 | ||
|
|
a6265c3089 | ||
|
|
a2300c1a96 | ||
|
|
3dae3f9173 | ||
|
|
63c420d5d8 | ||
|
|
a94c6bb581 | ||
|
|
9fe0044a65 | ||
|
|
c05ce5eff4 | ||
|
|
a019103ed5 | ||
|
|
50e55f4fca | ||
|
|
0706683690 | ||
|
|
9cdb77bafa | ||
|
|
b476c54825 | ||
|
|
8b2e541b1d | ||
|
|
931531e799 | ||
|
|
1695d69aa3 | ||
|
|
217bd3bed3 | ||
|
|
384e8794bf | ||
|
|
61b398a89a | ||
|
|
ba78fd0dc5 | ||
|
|
43969a773e | ||
|
|
6e1eabbe0f | ||
|
|
b99d1e5dea | ||
|
|
6ce566aea5 | ||
|
|
a4209961e2 | ||
|
|
181ff3f2bf | ||
|
|
b85b522643 | ||
|
|
5158e264c0 | ||
|
|
fd67da0527 | ||
|
|
7bdec8457f | ||
|
|
bc75c9a89f | ||
|
|
c2e8734e85 | ||
|
|
22e965521a | ||
|
|
b6b1af5959 | ||
|
|
876be3b7b6 | ||
|
|
62f48353ba | ||
|
|
9c65e5a12d | ||
|
|
235e947186 | ||
|
|
0a8bc01870 | ||
|
|
f0bdc01156 | ||
|
|
cd6fed6aae | ||
|
|
7835ebc346 | ||
|
|
3c33581a08 | ||
|
|
3e9a8c9249 | ||
|
|
d6c8f120c6 | ||
|
|
cb2fa1abfc | ||
|
|
25f2cfbff2 | ||
|
|
3404d4cece | ||
|
|
44e1584461 | ||
|
|
8a16188996 | ||
|
|
70518762ae | ||
|
|
a0370912da | ||
|
|
3fee702ee2 | ||
|
|
54d73a6d3b | ||
|
|
9fe9c9d491 | ||
|
|
4300c9ee1b | ||
|
|
a3780bdcea | ||
|
|
6554b68efa | ||
|
|
1a00db9d55 | ||
|
|
fb3ad260da | ||
|
|
ed02b0f260 | ||
|
|
620334439c | ||
|
|
ab5c54b47a | ||
|
|
40e4616520 | ||
|
|
3ebb3bd055 | ||
|
|
25e19b22f7 | ||
|
|
c67266fe1a | ||
|
|
92d747a0f5 | ||
|
|
79b52ed13e | ||
|
|
bd3ad8782a | ||
|
|
6b57619871 | ||
|
|
c8644c80cd | ||
|
|
430ee2280a | ||
|
|
f71c10619c | ||
|
|
b6497c03f6 | ||
|
|
ecb470b938 | ||
|
|
a9d3734117 | ||
|
|
faf77d8212 | ||
|
|
3e6d7af720 | ||
|
|
f69cf8130d | ||
|
|
796208722e | ||
|
|
85dbc54641 | ||
|
|
8381446a69 | ||
|
|
97dc39620c | ||
|
|
7fb973c28d | ||
|
|
4421ac1ceb | ||
|
|
159abfa246 | ||
|
|
4b06700187 | ||
|
|
ee68ca54b8 | ||
|
|
0bfd336796 | ||
|
|
9b967a9af0 | ||
|
|
299aaa5359 | ||
|
|
4e3927bbd0 | ||
|
|
38f19ec778 | ||
|
|
168f4b0303 | ||
|
|
6f8300fb32 | ||
|
|
2ff2923d39 | ||
|
|
aa724e12ba | ||
|
|
e039309a77 | ||
|
|
a4f0a97088 | ||
|
|
9d4c431eef | ||
|
|
1f7179e941 | ||
|
|
4d27bf5492 | ||
|
|
6b85d2cef1 | ||
|
|
aae9930f5e | ||
|
|
eca19aa4bf | ||
|
|
8e02538405 | ||
|
|
928da0cbda | ||
|
|
267693c6ab | ||
|
|
3f99afaa38 | ||
|
|
8e67e5f0fc | ||
|
|
cb1508e6d5 | ||
|
|
070be1ff94 | ||
|
|
7730eacea8 | ||
|
|
c5e3373fe1 | ||
|
|
d7ec620173 | ||
|
|
1c72350d4a | ||
|
|
4ef15f8b81 | ||
|
|
8fc7b614a0 | ||
|
|
0789a69975 | ||
|
|
b405a816c9 | ||
|
|
99c1db3655 | ||
|
|
6b099de63c | ||
|
|
275707fe27 | ||
|
|
c535b96b12 | ||
|
|
6b77cbb0c0 | ||
|
|
a33d8e1061 | ||
|
|
aaf11211dc | ||
|
|
83b2aca942 | ||
|
|
fbae286dff | ||
|
|
ba9b6b54bf | ||
|
|
1677514355 | ||
|
|
ec1042efa3 | ||
|
|
b03ad4ade3 | ||
|
|
04f6e5d2a8 | ||
|
|
16c074db1a | ||
|
|
8d958a2d1d | ||
|
|
74c1cd3be0 | ||
|
|
0fd5f348e2 | ||
|
|
0c9433d0d3 | ||
|
|
8fb34d42dc | ||
|
|
be831eb04a | ||
|
|
43ebab52d4 | ||
|
|
a5f9eaa392 | ||
|
|
cc2064f296 | ||
|
|
f2462cff81 | ||
|
|
b2e25abf08 | ||
|
|
cd0817bd11 | ||
|
|
e88ca8ede1 | ||
|
|
7a83269d98 | ||
|
|
4be1d48215 | ||
|
|
8485ff1e99 | ||
|
|
be66b10f49 | ||
|
|
1f22971493 | ||
|
|
ea943088e5 | ||
|
|
298be4a344 | ||
|
|
f37fc13b7c | ||
|
|
506b74868e | ||
|
|
4a59d1cfda | ||
|
|
7201c8347f | ||
|
|
c8a3df3cfc | ||
|
|
2ef7742903 | ||
|
|
f98135325a | ||
|
|
fd765aa8c8 | ||
|
|
ec93dd5a7d | ||
|
|
0e885ff2d5 | ||
|
|
5893cb575e | ||
|
|
b46136b959 | ||
|
|
390c1e870d |
21
.github/workflows/build_presets.yml
vendored
@@ -1,6 +1,12 @@
|
|||||||
name: build
|
name: build
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- dev
|
||||||
|
pull_request:
|
||||||
|
branches-ignore:
|
||||||
|
- dev
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -8,7 +14,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
preset: [MinSizeRel]
|
preset: [Release]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
container: devkitpro/devkita64:latest
|
container: devkitpro/devkita64:latest
|
||||||
|
|
||||||
@@ -16,16 +22,17 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
# fetch latest cmake
|
# fetch latest cmake
|
||||||
- uses: lukka/get-cmake@latest
|
- uses: lukka/get-cmake@v3.31.6
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
run: |
|
run: cmake --preset ${{ matrix.preset }}
|
||||||
cmake --preset ${{ matrix.preset }} -DUSE_VFS_GC=0
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build --preset ${{ matrix.preset }} --parallel 4
|
run: cmake --build --preset ${{ matrix.preset }} --parallel $(nproc)
|
||||||
|
|
||||||
- uses: actions/upload-artifact@master
|
- name: Deploy
|
||||||
|
if: ${{ github.event_name != 'pull_request' && github.event.action != 'unassigned' }}
|
||||||
|
uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
name: sphaira-${{ matrix.preset }}
|
name: sphaira-${{ matrix.preset }}
|
||||||
path: build/${{ matrix.preset }}/sphaira.nro
|
path: build/${{ matrix.preset }}/sphaira.nro
|
||||||
|
|||||||
33
.github/workflows/python-usb-export.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: USB Export Python Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths: &python_usb_export_paths
|
||||||
|
- 'tools/tests/test_usb_export.py'
|
||||||
|
- 'tools/usb_export.py'
|
||||||
|
- 'tools/usb_common.py'
|
||||||
|
- 'tools/requirements.txt'
|
||||||
|
- '.github/workflows/python-usb-export.yml'
|
||||||
|
pull_request:
|
||||||
|
paths: *python_usb_export_paths
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python 3.11
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r tools/requirements.txt
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
python3 tools/tests/test_usb_export.py
|
||||||
33
.github/workflows/python-usb-install.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
name: USB Install Python Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths: &python_usb_install_paths
|
||||||
|
- 'tools/tests/test_usb_install.py'
|
||||||
|
- 'tools/usb_install.py'
|
||||||
|
- 'tools/usb_common.py'
|
||||||
|
- 'tools/requirements.txt'
|
||||||
|
- '.github/workflows/python-usb-install.yml'
|
||||||
|
pull_request:
|
||||||
|
paths: *python_usb_install_paths
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Python 3.11
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install -r tools/requirements.txt
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
python3 tools/tests/test_usb_install.py
|
||||||
55
.github/workflows/webusb-build.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
name: Build and Deploy WebUSB Site
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'tools/webusb/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout source
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Install minifiers
|
||||||
|
run: |
|
||||||
|
npm install -g html-minifier-terser terser csso-cli
|
||||||
|
|
||||||
|
- name: Minify HTML
|
||||||
|
run: |
|
||||||
|
html-minifier-terser --collapse-whitespace --remove-comments --minify-css true --minify-js true -o tools/webusb/index.html.min tools/webusb/index.html
|
||||||
|
|
||||||
|
- name: Minify JS
|
||||||
|
run: |
|
||||||
|
terser tools/webusb/index.js -c -m -o tools/webusb/index.js.min
|
||||||
|
|
||||||
|
- name: Minify CSS
|
||||||
|
run: |
|
||||||
|
csso tools/webusb/index.css --output tools/webusb/index.css.min
|
||||||
|
|
||||||
|
- name: Prepare deploy branch
|
||||||
|
run: |
|
||||||
|
rm -rf webusb
|
||||||
|
mkdir webusb
|
||||||
|
cp tools/webusb/index.html.min webusb/index.html
|
||||||
|
cp tools/webusb/index.js.min webusb/index.js
|
||||||
|
cp tools/webusb/index.css.min webusb/index.css
|
||||||
|
cp -r tools/webusb/assets webusb/assets
|
||||||
|
|
||||||
|
- name: Commit and force-push to webusb branch
|
||||||
|
run: |
|
||||||
|
cd webusb
|
||||||
|
git init
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add .
|
||||||
|
git commit -m "Deploy minified webusb build"
|
||||||
|
git branch -M webusb
|
||||||
|
git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
|
||||||
|
git push --force origin webusb
|
||||||
5
.gitignore
vendored
@@ -25,3 +25,8 @@ compile_commands.json
|
|||||||
out
|
out
|
||||||
|
|
||||||
usb_test/
|
usb_test/
|
||||||
|
__pycache__
|
||||||
|
usb_*.spec
|
||||||
|
|
||||||
|
CMakeUserPresets.json
|
||||||
|
build_patreon.sh
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
|
|||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
# enable LTO (only in release builds)
|
# enable LTO (only in release builds)
|
||||||
|
if (LTO)
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
|
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
|
||||||
@@ -35,6 +36,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel
|
|||||||
else()
|
else()
|
||||||
message(STATUS "IPO / LTO not enabled in debug build")
|
message(STATUS "IPO / LTO not enabled in debug build")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
function(dkp_fatal_if_not_found var package)
|
function(dkp_fatal_if_not_found var package)
|
||||||
if (DEFINED ${var}_NOT_FOUND OR DEFINED ${var}-NOTFOUND)
|
if (DEFINED ${var}_NOT_FOUND OR DEFINED ${var}-NOTFOUND)
|
||||||
|
|||||||
@@ -16,25 +16,49 @@
|
|||||||
"name": "Release",
|
"name": "Release",
|
||||||
"displayName": "Release",
|
"displayName": "Release",
|
||||||
"inherits":["core"],
|
"inherits":["core"],
|
||||||
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "MinSizeRel",
|
||||||
|
"LTO": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "RelWithDebInfo",
|
"name": "Lite",
|
||||||
"displayName": "RelWithDebInfo",
|
"displayName": "Lite",
|
||||||
"inherits":["core"],
|
"inherits":["core"],
|
||||||
"cacheVariables": { "CMAKE_BUILD_TYPE":"RelWithDebInfo" }
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "MinSizeRel",
|
||||||
|
"LTO": true,
|
||||||
|
|
||||||
|
"ENABLE_NVJPG": false,
|
||||||
|
"ENABLE_NSZ": false,
|
||||||
|
|
||||||
|
"ENABLE_LIBUSBHSFS": false,
|
||||||
|
"ENABLE_LIBUSBDVD": false,
|
||||||
|
"ENABLE_FTPSRV": false,
|
||||||
|
"ENABLE_LIBHAZE": false,
|
||||||
|
|
||||||
|
"ENABLE_AUDIO_MP3": false,
|
||||||
|
"ENABLE_AUDIO_OGG": false,
|
||||||
|
"ENABLE_AUDIO_WAV": false,
|
||||||
|
"ENABLE_AUDIO_FLAC": false,
|
||||||
|
|
||||||
|
"ENABLE_DEVOPTAB_HTTP": false,
|
||||||
|
"ENABLE_DEVOPTAB_NFS": false,
|
||||||
|
"ENABLE_DEVOPTAB_SMB2": false,
|
||||||
|
"ENABLE_DEVOPTAB_FTP": false,
|
||||||
|
"ENABLE_DEVOPTAB_SFTP": false,
|
||||||
|
"ENABLE_DEVOPTAB_WEBDAV": false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "MinSizeRel",
|
"name": "Dev",
|
||||||
"displayName": "MinSizeRel",
|
"displayName": "Dev",
|
||||||
"inherits":["core"],
|
"inherits":["core"],
|
||||||
"cacheVariables": { "CMAKE_BUILD_TYPE":"MinSizeRel" }
|
"cacheVariables": {
|
||||||
},
|
"CMAKE_BUILD_TYPE": "MinSizeRel",
|
||||||
{
|
"LTO": false,
|
||||||
"name": "Debug",
|
"DEV_BUILD": true
|
||||||
"displayName": "Debug",
|
}
|
||||||
"inherits":["core"],
|
|
||||||
"cacheVariables": { "CMAKE_BUILD_TYPE":"Debug" }
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"buildPresets": [
|
"buildPresets": [
|
||||||
@@ -44,18 +68,13 @@
|
|||||||
"jobs": 16
|
"jobs": 16
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "RelWithDebInfo",
|
"name": "Lite",
|
||||||
"configurePreset": "RelWithDebInfo",
|
"configurePreset": "Lite",
|
||||||
"jobs": 16
|
"jobs": 16
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "MinSizeRel",
|
"name": "Dev",
|
||||||
"configurePreset": "MinSizeRel",
|
"configurePreset": "Dev",
|
||||||
"jobs": 16
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Debug",
|
|
||||||
"configurePreset": "Debug",
|
|
||||||
"jobs": 16
|
"jobs": 16
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
40
README.md
@@ -4,16 +4,16 @@ A homebrew menu for the Nintendo Switch.
|
|||||||
|
|
||||||
[See the GBATemp thread for more details / discussion](https://gbatemp.net/threads/sphaira-hbmenu-replacement.664523/).
|
[See the GBATemp thread for more details / discussion](https://gbatemp.net/threads/sphaira-hbmenu-replacement.664523/).
|
||||||
|
|
||||||
[We have now have a Discord server!](https://discord.gg/8vZBsrprEc). Please use the issues tab to report bugs, as it is much easier for me to track.
|
[We have now have a Discord server!](https://discord.gg/8vZBsrprEc) Please use the issues tab to report bugs, as it is much easier for me to track.
|
||||||
|
|
||||||
## Showcase
|
## Showcase
|
||||||
|
|
||||||
| | |
|
| | |
|
||||||
:-------------------------:|:-------------------------:
|
:-------------------------:|:-------------------------:
|
||||||
 | 
|
 | 
|
||||||
 | 
|
 | 
|
||||||
 | 
|
 | 
|
||||||
 | 
|
 | 
|
||||||
|
|
||||||
## Bug reports
|
## Bug reports
|
||||||
|
|
||||||
@@ -86,16 +86,22 @@ The output will be found in `build/MinSizeRel/sphaira.nro`
|
|||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
- borealis
|
- [borealis](https://github.com/natinusala/borealis)
|
||||||
- stb
|
- [stb](https://github.com/nothings/stb)
|
||||||
- yyjson
|
- [yyjson](https://github.com/ibireme/yyjson)
|
||||||
- nx-hbmenu
|
- [nx-hbmenu](https://github.com/switchbrew/nx-hbmenu)
|
||||||
- nx-hbloader
|
- [nx-hbloader](https://github.com/switchbrew/nx-hbloader)
|
||||||
- deko3d-nanovg
|
- [deko3d-nanovg](https://github.com/Adubbz/nanovg-deko3d)
|
||||||
- libpulsar
|
- [libpulsar](https://github.com/p-sam/switch-libpulsar)
|
||||||
- minIni
|
- [minIni](https://github.com/compuphase/minIni)
|
||||||
- GBATemp
|
- [GBATemp](https://gbatemp.net/threads/sphaira-hbmenu-replacement.664523/)
|
||||||
- hb-appstore
|
- [hb-appstore](https://github.com/fortheusers/hb-appstore)
|
||||||
- haze
|
- [haze](https://github.com/Atmosphere-NX/Atmosphere/tree/master/troposphere/haze)
|
||||||
- nxdumptool (for gamecard bin dumping and rsa verify code)
|
- [nxdumptool](https://github.com/DarkMatterCore/nxdumptool) (for gamecard bin dumping and rsa verify code)
|
||||||
|
- [Liam0](https://github.com/ThatNerdyPikachu/switch-010editor-templates) (for ticket / cert structs)
|
||||||
|
- [libusbhsfs](https://github.com/DarkMatterCore/libusbhsfs)
|
||||||
|
- [libnxtc](https://github.com/DarkMatterCore/libnxtc)
|
||||||
|
- [oss-nvjpg](https://github.com/averne/oss-nvjpg)
|
||||||
|
- [nsz](https://github.com/nicoboss/nsz)
|
||||||
|
- [themezer](https://themezer.net/)
|
||||||
- Everyone who has contributed to this project!
|
- Everyone who has contributed to this project!
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"url": "https://github.com/ITotalJustice/ftpsrv",
|
|
||||||
"assets": [
|
|
||||||
{
|
|
||||||
"name": "switch"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"url": "https://github.com/ITotalJustice/untitled"
|
|
||||||
}
|
|
||||||
918
assets/romfs/i18n/zh-CN.json
Normal file
@@ -0,0 +1,918 @@
|
|||||||
|
{
|
||||||
|
"Homebrew": "自制软件",
|
||||||
|
"FileBrowser": "文件浏览器",
|
||||||
|
"Appstore": "应用商店",
|
||||||
|
"Corrupted": "已损坏",
|
||||||
|
"enable_install_info": [
|
||||||
|
"安装功能已禁用.\n",
|
||||||
|
"可以通过选择 菜单 (Y) -> 高级选项 -> 安装选项 -> 启用"
|
||||||
|
],
|
||||||
|
"On": "开启",
|
||||||
|
"Off": "关闭",
|
||||||
|
"Entry": "条目",
|
||||||
|
"Store": "商店",
|
||||||
|
"File": "文件",
|
||||||
|
"Files": "文件",
|
||||||
|
"FTP": "FTP",
|
||||||
|
"Games": "游戏",
|
||||||
|
"Meta": "元数据",
|
||||||
|
"Nca": "NCA",
|
||||||
|
"GC": "GC",
|
||||||
|
"GitHub": "GitHub",
|
||||||
|
"Apps": "应用",
|
||||||
|
"IRS": "IRS",
|
||||||
|
"MTP": "MTP",
|
||||||
|
"Saves": "存档",
|
||||||
|
"USB": "USB",
|
||||||
|
"Level 0 (no compression)": "",
|
||||||
|
"Level 1": "",
|
||||||
|
"Level 2": "",
|
||||||
|
"Level 3 (default)": "",
|
||||||
|
"Level 4": "",
|
||||||
|
"Level 5": "",
|
||||||
|
"Level 6": "",
|
||||||
|
"Level 7": "",
|
||||||
|
"Level 8": "",
|
||||||
|
"0 (single threaded)": "",
|
||||||
|
"1": "",
|
||||||
|
"2": "",
|
||||||
|
"3 (default)": "",
|
||||||
|
"4": "",
|
||||||
|
"16 KB": "",
|
||||||
|
"32 KB": "",
|
||||||
|
"64 KB": "",
|
||||||
|
"128 KB": "",
|
||||||
|
"256 KB": "",
|
||||||
|
"512 KB": "",
|
||||||
|
"1 MB (default)": "",
|
||||||
|
"2 MB": "",
|
||||||
|
"4 MB": "",
|
||||||
|
"8 MB": "",
|
||||||
|
"16 MB": "",
|
||||||
|
"Switch-Handheld!": "切换至掌机模式!",
|
||||||
|
"Switch-Docked!": "切换至底座模式!",
|
||||||
|
"Nxlink Connected": "Nxlink已连接",
|
||||||
|
"Nxlink Upload": "Nxlink上传中",
|
||||||
|
"Nxlink Finished": "Nxlink已结束",
|
||||||
|
"Restore hbmenu?": "恢复 hbmenu?",
|
||||||
|
"Back": "返回",
|
||||||
|
"Restore": "恢复",
|
||||||
|
"missing_hbmenu_info": [
|
||||||
|
"未找到 /switch/hbmenu.nro",
|
||||||
|
"请使用应用商店重新安装 hbmenu"
|
||||||
|
],
|
||||||
|
"OK": "确定",
|
||||||
|
"Failed to restore hbmenu, please re-download hbmenu": "恢复 hbmenu 失败,请重新下载 hbmenu",
|
||||||
|
"Failed to restore hbmenu, using sphaira instead": "恢复 hbmenu 失败,改用 Sphaira",
|
||||||
|
"Restored hbmenu, closing sphaira": "已恢复 hbmenu,正在关闭 Sphaira",
|
||||||
|
"Restored hbmenu": "已恢复 hbmenu",
|
||||||
|
"Restart Sphaira?": "重启 Sphaira?",
|
||||||
|
"Restart": "重启",
|
||||||
|
"Installing Forwarder": "正在生成前端应用",
|
||||||
|
"Failed to install forwarder": "前端应用安装失败",
|
||||||
|
"Installed!": "安装完成!",
|
||||||
|
"Warning! Logs are enabled, Sphaira will run slowly!": "警告!日志已启用,将导致Sphaira运行缓慢!",
|
||||||
|
"Audio disabled due to suspended game": "由于游戏暂停,音频已禁用",
|
||||||
|
"Theme Options": "主题选项",
|
||||||
|
"Select Theme": "选择主题",
|
||||||
|
"Customise the look of Sphaira by changing the theme": "通过更换主题来自定义Sphaira的外观",
|
||||||
|
"Music": "音乐",
|
||||||
|
"bgm_enable_info": [
|
||||||
|
"启用背景音乐\n",
|
||||||
|
"每个主题设置独立的音乐文件。",
|
||||||
|
"如果主题未设置音乐文件,则加载默认音乐(如果存在)。"
|
||||||
|
],
|
||||||
|
"Show IP address": "显示 IP 地址",
|
||||||
|
"display_ip_info": [
|
||||||
|
"在所有菜单中显示IP地址,包括WiFi信号栏。\n",
|
||||||
|
"注意:在小程序模式下,IP地址将被隐藏,因为小程序警告会显示在其位置。"
|
||||||
|
],
|
||||||
|
"Remove Background Music": "移除背景音乐",
|
||||||
|
"Removes the background music file": "删除背景音乐文件",
|
||||||
|
"No background music file is set": "未设置背景音乐文件",
|
||||||
|
"Menus": "菜单",
|
||||||
|
"Web": "网络",
|
||||||
|
"Enter custom URL": "输入自定义链接",
|
||||||
|
"Select URL": "选择链接",
|
||||||
|
"Enter URL": "输入网址",
|
||||||
|
"web_browser_info": [
|
||||||
|
"启动内置浏览器\n",
|
||||||
|
"注意:浏览器功能受限,某些网站可能无法加载,并且浏览器会在30分钟超时后关闭"
|
||||||
|
],
|
||||||
|
"Advanced Options": "高级选项",
|
||||||
|
"Slow": "慢",
|
||||||
|
"Normal": "正常",
|
||||||
|
"Fast": "快",
|
||||||
|
"Logging": "日志",
|
||||||
|
"Logs to /config/sphaira/log.txt": "日志输出到 /config/sphaira/log.txt",
|
||||||
|
"Replace hbmenu on exit": "退出后用Sphaira替换hbmenu",
|
||||||
|
"hbmenu_replace_info": [
|
||||||
|
"启用后,将用 Sphaira 替换 /hbmenu.nro,并将 hbmenu 备份到 /switch/hbmenu.nro \n",
|
||||||
|
"禁用后将为您提供还原 hbmenu 的选项。"
|
||||||
|
],
|
||||||
|
"Add / modify mounts": "添加/修改挂载点",
|
||||||
|
"mount_options_info": [
|
||||||
|
"创建、修改、删除网络挂载 (HTTP, FTP, SFTP, SMB, NFS)\n",
|
||||||
|
"挂载选项只需要设置 URL 和名称,其他字段(如端口、用户、密码等)为可选\n",
|
||||||
|
"任何更改都需要重启 Sphaira 后生效"
|
||||||
|
],
|
||||||
|
"Boost CPU during transfer": "传输时提升CPU频率",
|
||||||
|
"transfer_boost_info": [
|
||||||
|
"在传输期间启用加速模式,可提高传输速度。 ",
|
||||||
|
"这会将 CPU 设置为 1785MHz,并将 GPU 降至 76MHz"
|
||||||
|
],
|
||||||
|
"Text scroll speed": "文本滚动速度",
|
||||||
|
"Change how fast the scrolling text updates": "更改滚动文本的更新速度",
|
||||||
|
"Set center menu": "设置中间菜单",
|
||||||
|
"Press OK to restart Sphaira": "按OK键以重启shphaira菜单",
|
||||||
|
"Set the menu that appears on the center tab.": "设置显示在中间选项卡上的菜单。",
|
||||||
|
"Set left-side menu": "设置左侧菜单",
|
||||||
|
"Set the menu that appears on the left tab.": "设置显示在左侧选项卡上的菜单。",
|
||||||
|
"Set right-side menu": "设置右侧菜单",
|
||||||
|
"Set the menu that appears on the right tab.": "设置显示在右侧选项卡上的菜单。",
|
||||||
|
"Install options": "安装选项",
|
||||||
|
"install_options_info": [
|
||||||
|
"更改安装选项。\n",
|
||||||
|
"您可以在此启用安装功能"
|
||||||
|
],
|
||||||
|
"Export options": "导出选项",
|
||||||
|
"Change the export options.": "更改导出选项。",
|
||||||
|
"Install Options": "安装选项",
|
||||||
|
"System memory": "主机内存",
|
||||||
|
"microSD card": "SD卡",
|
||||||
|
"Enable sysmmc": "启用sysmmc",
|
||||||
|
"Enables installing whilst in sysMMC mode.": "允许在 sysMMC 模式下安装。",
|
||||||
|
"Enable emummc": "启用emummc",
|
||||||
|
"Enables installing whilst in emuMMC mode.": "允许在 emuMMC 模式下安装。",
|
||||||
|
"Install location": "安装位置",
|
||||||
|
"Allow downgrade": "允许降级",
|
||||||
|
"Allows for installing title updates that are lower than the currently installed update.": "允许安装低于当前已安装版本的游戏更新。",
|
||||||
|
"Skip if already installed": "若已安装则跳过",
|
||||||
|
"Skips installing titles / ncas if they're already installed.": "跳过已安装的游戏/NCA",
|
||||||
|
"Ticket only": "仅安装票据",
|
||||||
|
"Installs tickets only, useful if the title was already installed however the tickets were missing or corrupted.": "仅安装 tickets, 适用于已安装但损坏的游戏",
|
||||||
|
"Skip base": "跳过基础部分",
|
||||||
|
"Skips installing the base application.": "跳过安装基础应用程序。",
|
||||||
|
"Skip patch": "跳过更新补丁(UPD)",
|
||||||
|
"Skips installing updates.": "跳过安装更新。",
|
||||||
|
"Skip dlc": "跳过追加内容(DLC)",
|
||||||
|
"Skips installing DLC.": "跳过安装 DLC。",
|
||||||
|
"Skip data patch": "跳过数据补丁",
|
||||||
|
"Skips installing DLC update (data patch).": "跳过安装 DLC 更新(数据补丁)。",
|
||||||
|
"Skip ticket": "跳过票据",
|
||||||
|
"Skips installing tickets, not recommended.": "跳过安装票据,不推荐。",
|
||||||
|
"Skip NCA hash verify": "跳过 NCA 哈希验证",
|
||||||
|
"skip_nca_info": [
|
||||||
|
"启用跳过完整 NCA 的 sha256 验证。",
|
||||||
|
"用于验证 NCA 是否有效/未损坏。",
|
||||||
|
"当安装损坏的游戏时,您可能看到过\"检查损坏数据\"的选项",
|
||||||
|
"该检查会执行包括对 NCA 在内的各种哈希校验\n",
|
||||||
|
"建议保持禁用状态。"
|
||||||
|
],
|
||||||
|
"Skip RSA header verify": "跳过 RSA 头部验证",
|
||||||
|
"nca_verify_info": [
|
||||||
|
"启用跳过 RSA NCA固定密钥验证。",
|
||||||
|
"这是对NCA头的哈希值。它用于验证头部是否未被修改。 ",
|
||||||
|
"头部由任天堂签名,因此无法伪造,可以可靠地检测修改过的NCA头(如NSP/XCI转换)。\n",
|
||||||
|
"建议保持禁用状态,除非您需要安装nsp/xci转换文件。"
|
||||||
|
],
|
||||||
|
"Skip RSA NPDM verify": "跳过 RSA NPDM 验证",
|
||||||
|
"npdm_verify_info": [
|
||||||
|
"启用跳过RSA NPDM固定密钥验证\n",
|
||||||
|
"目前此选项未实现。"
|
||||||
|
],
|
||||||
|
"Ignore distribution bit": "忽略发行位",
|
||||||
|
"nca_distbit_info": [
|
||||||
|
"如果设置,将忽略 NCA 头部中的发行位",
|
||||||
|
"发行位用于标识NCA是来自Eshop还是游戏卡。",
|
||||||
|
"您通常无法启动将发行位设置为游戏卡的已安装游戏。\n",
|
||||||
|
"建议保持禁用状态。"
|
||||||
|
],
|
||||||
|
"Convert to common ticket": "转换为公共票据",
|
||||||
|
"ticket_convert_info": [
|
||||||
|
"[需要密钥] 将个人票据转换为公共(虚拟)票据。\n",
|
||||||
|
"建议保持启用状态。"
|
||||||
|
],
|
||||||
|
"Convert to standard crypto": "转换为标准加密方式",
|
||||||
|
"titlekey_crypto_info": [
|
||||||
|
"[需要密钥] 将标题密钥转换为标准加密,也称为\"无票据\"。\n",
|
||||||
|
"建议保持禁用状态。"
|
||||||
|
],
|
||||||
|
"Lower master key": "降低主密钥",
|
||||||
|
"keyarea_crypto_info": [
|
||||||
|
"[需要密钥] 使用主密钥0加密keak(密钥区域密钥),允许游戏在任何固件上启动。 ",
|
||||||
|
"隐式执行标准加密。\n",
|
||||||
|
"请注意,仅仅因为游戏可以在任何固件上启动(因为它可以被解密),并不意味着它就能正常工作。强烈建议更新您的固件和Atmosphere版本以玩游戏,而不是启用此选项。\n",
|
||||||
|
"建议保持禁用状态。"
|
||||||
|
],
|
||||||
|
"Lower system version": "降低系统版本",
|
||||||
|
"cnmt_fw_info": [
|
||||||
|
"将cnmt扩展头中的system_firmware字段设置为0。",
|
||||||
|
"注意:如果主密钥高于固件版本,游戏仍然无法启动,因为固件没有解密keak的密钥(见上文)。\n",
|
||||||
|
"建议保持禁用状态。"
|
||||||
|
],
|
||||||
|
"Export Options": "导出选项",
|
||||||
|
"Created nested folder": "已创建嵌套文件夹",
|
||||||
|
"game_folder_info": [
|
||||||
|
"使用游戏名称创建文件夹。\n",
|
||||||
|
"例如:/name/name.xci",
|
||||||
|
"禁用后将使用 /name.xci"
|
||||||
|
],
|
||||||
|
"Append folder with .xci": "用.xci附加文件夹",
|
||||||
|
"xci_folder_info": [
|
||||||
|
"XCI转储将使用.xci扩展名命名文件夹。\n",
|
||||||
|
"例如:/name.xci/name.xci\n",
|
||||||
|
"某些设备仅在xci文件夹名称与xci文件完全相同时才能正常工作。"
|
||||||
|
],
|
||||||
|
"Trim XCI": "裁剪 XCI",
|
||||||
|
"Removes the unused data at the end of the XCI, making the output smaller.": "移除 XCI 末尾未使用的数据,使输出更小。",
|
||||||
|
"Label trimmed XCI": "标记已裁剪的XCI",
|
||||||
|
"Names the trimmed xci.\nFor example, /name/name (trimmed).xci": "为修剪后的xci命名。\n例如:/name/name (trimmed).xci",
|
||||||
|
"Converts personalised ticket to a fake common ticket.": "将个人票据转换为虚拟公共票据。",
|
||||||
|
"NSZ level": "NSZ 压缩级别",
|
||||||
|
"compress_level_info": [
|
||||||
|
"设置导出NSZ时使用的压缩级别。\n",
|
||||||
|
"注意:Switch的CPU速度不是很快,将值设置得过高会导致导出耗时非常长,但文件大小仅有很小的改善。\n",
|
||||||
|
"建议将此值设置为3。"
|
||||||
|
],
|
||||||
|
"NSZ threads": "NSZ 线程数",
|
||||||
|
"compress_threads_info": [
|
||||||
|
"设置压缩NCA时使用的线程数。\n",
|
||||||
|
"小于3的值允许另一个线程自由运行,例如读/写线程。但在我的测试中,值为3时通常性能最佳。\n",
|
||||||
|
"值为0将不使用线程,仅应用于测试,因为它总是更慢。\n",
|
||||||
|
"建议将此值设置在1-3之间。"
|
||||||
|
],
|
||||||
|
"NSZ long distance mode": "NSZ 远距离模式",
|
||||||
|
"Enables \"Long Distance Mode\" which can reduce the output size at the cost of speed.": "启用\"远距离模式\",可以减少输出大小,但会降低速度。",
|
||||||
|
"NSZ block compression": "NSZ 块压缩",
|
||||||
|
"block_compress_info": [
|
||||||
|
"启用块压缩,将NCA压缩成块(代价是压缩率降低) ",
|
||||||
|
"允许随机访问,使NCZ可以作为文件系统挂载。\n",
|
||||||
|
"注意:Sphaira目前还不支持将NCZ作为文件系统挂载,但最终会添加此功能。"
|
||||||
|
],
|
||||||
|
"NSZ block size": "NSZ 块大小",
|
||||||
|
"Sets the size of each block. The smaller the size, the faster the random access is at the cost of compression ratio.": "设置每个块的大小。块越小,随机访问速度越快,但压缩率会降低。",
|
||||||
|
"NSZ block compression is disabled.": "NSZ 块压缩已禁用。",
|
||||||
|
"FTP Options": "FTP选项",
|
||||||
|
"Restarting FTP server...": "正在重启 FTP 服务器...",
|
||||||
|
"Enable": "启用",
|
||||||
|
"Enable FTP server to run in the background.": "启用 FTP 服务器后台运行。",
|
||||||
|
"Port": "端口号",
|
||||||
|
"Opens the FTP server on this port.": "在此端口上打开 FTP 服务器。",
|
||||||
|
"Anon": "匿名登录",
|
||||||
|
"login_require_info": [
|
||||||
|
"允许您无需设置用户名和密码即可登录。\n",
|
||||||
|
"如果禁用,您必须在下方设置用户名和密码!"
|
||||||
|
],
|
||||||
|
"User": "用户",
|
||||||
|
"Sets the username, must be set if anon is disabled.": "设置用户名,如果禁用匿名登录则必须设置。",
|
||||||
|
"Pass": "密码",
|
||||||
|
"Sets the password, must be set if anon is disabled.": "设置密码,如果禁用匿名登录则必须设置。",
|
||||||
|
"Show album": "显示相册",
|
||||||
|
"Shows the microSD card album folder.": "显示 microSD 卡的相册文件夹。",
|
||||||
|
"Show Atmosphere contents": "显示 Atmosphere 内容",
|
||||||
|
"Shows the shortcut for the /atmosphere/contents folder.": "显示 /atmosphere/contents 文件夹的快捷方式。",
|
||||||
|
"Show bis storage": "显示 bis 存储",
|
||||||
|
"bis_contents_info": [
|
||||||
|
"显示包含以下文件的bis文件夹:",
|
||||||
|
"- BootPartition1Root.bin",
|
||||||
|
"- BootPartition2Root.bin",
|
||||||
|
"- UserDataRoot.bin",
|
||||||
|
"- BootConfigAndPackage2Part1.bin",
|
||||||
|
"- BootConfigAndPackage2Part2.bin",
|
||||||
|
"- BootConfigAndPackage2Part3.bin",
|
||||||
|
"- BootConfigAndPackage2Part4.bin",
|
||||||
|
"- BootConfigAndPackage2Part5.bin",
|
||||||
|
"- BootConfigAndPackage2Part6.bin",
|
||||||
|
"- CalibrationFile.bin",
|
||||||
|
"- SafeMode.bin",
|
||||||
|
"- User.bin",
|
||||||
|
"- System.bin",
|
||||||
|
"- SystemProperEncryption.bin"
|
||||||
|
],
|
||||||
|
"Show bis file systems": "显示 bis 文件系统",
|
||||||
|
"bis_fs_info": [
|
||||||
|
"显示以下bis文件系统:",
|
||||||
|
"- bis_calibration_file",
|
||||||
|
"- bis_safe_mode",
|
||||||
|
"- bis_user",
|
||||||
|
"- bis_system"
|
||||||
|
],
|
||||||
|
"Show system contents": "显示系统内容",
|
||||||
|
"Shows the system contents folder.": "显示系统内容文件夹。",
|
||||||
|
"Show user contents": "显示用户内容",
|
||||||
|
"Shows the user contents folder.": "显示用户内容文件夹。",
|
||||||
|
"Show microSD contents": "显示 microSD 卡内容",
|
||||||
|
"microsd_contents_info": [
|
||||||
|
"显示microSD contents文件夹。\n",
|
||||||
|
"注意:这不是普通的microSD卡存储,而是NCA存储的位置。",
|
||||||
|
"普通microSD卡始终是挂载的。"
|
||||||
|
],
|
||||||
|
"Show games": "显示游戏",
|
||||||
|
"games_ftp_info": [
|
||||||
|
"显示games文件夹。\n",
|
||||||
|
"此文件夹包含您所有已安装的游戏,允许您通过FTP创建备份!\n",
|
||||||
|
"注意:此文件夹是只读的。您无法通过FTP删除游戏。"
|
||||||
|
],
|
||||||
|
"Show install": "显示安装文件夹",
|
||||||
|
"install_ftp_info": [
|
||||||
|
"显示install文件夹。\n",
|
||||||
|
"此文件夹用于通过FTP安装游戏。\n",
|
||||||
|
"注意:尝试安装游戏时必须打开\"FTP安装\"菜单!"
|
||||||
|
],
|
||||||
|
"Show mounts": "显示挂载点",
|
||||||
|
"mounts_ftp_info": [
|
||||||
|
"显示mounts文件夹。\n",
|
||||||
|
"此文件夹包含添加到Sphaira的所有挂载点,允许您通过FTP访问它们!",
|
||||||
|
"例如,您可以通过FTP访问SMB、WebDav或其他FTP挂载点。"
|
||||||
|
],
|
||||||
|
"Show switch": "显示 Switch 目录",
|
||||||
|
"homebrew_folder_info": [
|
||||||
|
"显示/switch文件夹的快捷方式。",
|
||||||
|
"这是包含所有自制软件(NRO)的文件夹。"
|
||||||
|
],
|
||||||
|
"MTP Options": "MTP选项",
|
||||||
|
"Restarting MTP server...": "正在重启 MTP 服务器...",
|
||||||
|
"Enable MTP server to run in the background.": "启用 MTP 服务器后台运行。",
|
||||||
|
"Pre-allocate file": "预分配文件",
|
||||||
|
"prealloc_info": [
|
||||||
|
"在写入前启用文件大小预分配。",
|
||||||
|
"这会加快文件写入速度,但如果同时满足以下所有条件,可能会导致超时:",
|
||||||
|
"- 使用 Windows 系统",
|
||||||
|
"- 使用 emuMMC",
|
||||||
|
"- 传输大文件(>1GB)\n",
|
||||||
|
"建议保持此选项启用,但如果您使用上述配置并遇到超时, ",
|
||||||
|
"请在禁用此选项后重试。"
|
||||||
|
],
|
||||||
|
"games_mtp_info": [
|
||||||
|
"显示games文件夹。\n",
|
||||||
|
"此文件夹包含您所有已安装的游戏,允许您通过MTP创建备份!\n",
|
||||||
|
"注意:此文件夹是只读的。您无法通过MTP删除游戏。"
|
||||||
|
],
|
||||||
|
"install_mtp_info": [
|
||||||
|
"显示install文件夹。\n",
|
||||||
|
"此文件夹用于通过MTP安装游戏。\n",
|
||||||
|
"注意:尝试安装游戏时必须打开\"MTP安装\"菜单!"
|
||||||
|
],
|
||||||
|
"mounts_mtp_info": [
|
||||||
|
"显示mounts文件夹。\n",
|
||||||
|
"此文件夹包含添加到Sphaira的所有挂载点,允许您通过MTP访问它们!",
|
||||||
|
"例如,您可以通过MTP访问SMB、WebDav和FTP挂载点。"
|
||||||
|
],
|
||||||
|
"Show DevNull": "显示 DevNull",
|
||||||
|
"usb_benchmark_info": [
|
||||||
|
"显示DevNull(速度测试)文件夹。\n",
|
||||||
|
"此文件夹用于USB上传的基准测试。",
|
||||||
|
"这是一个虚拟文件夹,实际上不会向磁盘写入任何内容。"
|
||||||
|
],
|
||||||
|
"HDD Options": "硬盘选项",
|
||||||
|
"mount_hdd_info": [
|
||||||
|
"启用已连接的USB/HDD设备挂载。 ",
|
||||||
|
"已连接的设备可在文件浏览器中使用,也可作为转储游戏和存档时的备份位置。"
|
||||||
|
],
|
||||||
|
"HDD write protect": "硬盘写保护",
|
||||||
|
"Makes the connected HDD read-only.": "将已连接的硬盘设置为只读。",
|
||||||
|
"Installing is disabled, enable now?": "安装功能已禁用,现在启用吗?",
|
||||||
|
"WARNING: Installing apps will lead to a ban!": "警告:安装应用程序将导致封禁!",
|
||||||
|
"Installing enabled!": "已启用安装!",
|
||||||
|
"microSD card (/dumps/)": "",
|
||||||
|
"USB export to PC (usb_export.py)": "",
|
||||||
|
"USB transfer (Switch 2 Switch)": "USB传输(Switch对Switch)",
|
||||||
|
"/dev/null (Speed Test)": "/dev/null(速度测试)",
|
||||||
|
"Waiting for USB connection...": "",
|
||||||
|
"USB connected, sending file list": "USB已连接,正在发送文件列表",
|
||||||
|
"Sent file list, waiting for command...": "已发送文件列表,正在等待命令...",
|
||||||
|
"waiting for usb connection...": "等待USB连接...",
|
||||||
|
"Exporting": "正在导出",
|
||||||
|
"Export failed!": "导出失败!",
|
||||||
|
"Export successfull!": "导出成功!",
|
||||||
|
"Select export location": "选择导出位置",
|
||||||
|
"Please launch MTP install menu before trying to install": "请在尝试安装前启动 MTP 安装菜单",
|
||||||
|
"Album": "专辑",
|
||||||
|
"Install (NSP, XCI, NSZ, XCZ)": "安装 (NSP, XCI, NSZ, XCZ)",
|
||||||
|
" (Read Only)": " (只读)",
|
||||||
|
"Unknown": "未知",
|
||||||
|
"Application": "",
|
||||||
|
"Creating Program": "正在创建程序",
|
||||||
|
"Creating Control": "正在创建控制器",
|
||||||
|
"Creating Meta": "正在创建元数据",
|
||||||
|
"Writing Nca": "正在写入Nca",
|
||||||
|
"Updating ncm database": "正在更新ncm数据库",
|
||||||
|
"Pushing application record": "正在推送应用记录",
|
||||||
|
"Failed to remove old forwarder, please manually remove it!": "删除旧前端应用失败,请手动删除!",
|
||||||
|
"An error occurred": "发生错误",
|
||||||
|
"If this message appears repeatedly, please open an issue.": "若此消息反复出现,请提交问题报告。",
|
||||||
|
"Failed to load music": "音乐加载失败",
|
||||||
|
"Artist: Unknown": "艺术家: 未知",
|
||||||
|
"Album: Unknown": "专辑: 未知",
|
||||||
|
"Select": "选择",
|
||||||
|
"Are you sure you wish to cancel?": "您确定要取消吗?",
|
||||||
|
"No": "否",
|
||||||
|
"Yes": "是",
|
||||||
|
"%zu hours %zu minutes remaining": "剩余 %zu 小时 %zu 分钟",
|
||||||
|
"%zu minutes %zu seconds remaining": "剩余 %zu 分钟 %zu 秒",
|
||||||
|
"%zu seconds remaining": "剩余 %zu 秒",
|
||||||
|
"Closing empty sidebar": "关闭空侧边栏",
|
||||||
|
"All": "全部",
|
||||||
|
"Emulators": "模拟器",
|
||||||
|
"Tools": "工具",
|
||||||
|
"Advanced": "高级",
|
||||||
|
"Themes": "主题",
|
||||||
|
"Legacy": "旧版",
|
||||||
|
"Misc": "拓展",
|
||||||
|
"Updated": "最近使用",
|
||||||
|
"Downloads": "下载",
|
||||||
|
"Size": "按大小",
|
||||||
|
"Alphabetical": "按字母顺序",
|
||||||
|
"Desc": "降序",
|
||||||
|
"Asc": "升序",
|
||||||
|
"Removing ": "正在移除 ",
|
||||||
|
"Downloading ": "正在下载 ",
|
||||||
|
"Checking MD5": "正在校验 MD5",
|
||||||
|
"Options": "选项",
|
||||||
|
"More by Author": "作者更多作品",
|
||||||
|
"Leave Feedback": "留言反馈",
|
||||||
|
"Visit Website": "访问网站",
|
||||||
|
"version: %s": "版本: %s",
|
||||||
|
"updated: %s": "更新时间: %s",
|
||||||
|
"category: %s": "分类: %s",
|
||||||
|
"extracted: %s": "已解压:%s",
|
||||||
|
"app_dls: %s": "下载量: %s",
|
||||||
|
"Loading...": "加载中...",
|
||||||
|
"Failed to download manifest": "下载清单失败",
|
||||||
|
"Details": "详情",
|
||||||
|
"Changelog": "更新日志",
|
||||||
|
"Downloaded ": "已下载 ",
|
||||||
|
"Uninstalling ": "正在卸载 ",
|
||||||
|
"Removed ": "已移除 ",
|
||||||
|
"Install": "安装",
|
||||||
|
"Update": "更新",
|
||||||
|
"Launch": "启动",
|
||||||
|
"Remove": "删除",
|
||||||
|
"Completely remove ": "彻底删除 ",
|
||||||
|
"AppStore": "应用商店",
|
||||||
|
"Info": "信息",
|
||||||
|
"AppStore Options": "应用商店选项",
|
||||||
|
"Descending": "降序",
|
||||||
|
"Ascending": "升序",
|
||||||
|
"List": "列表",
|
||||||
|
"Icon": "图标",
|
||||||
|
"Grid": "网格",
|
||||||
|
"Filter": "筛选",
|
||||||
|
"Sort": "排序",
|
||||||
|
"Order": "顺序",
|
||||||
|
"Layout": "布局",
|
||||||
|
"Search": "搜索",
|
||||||
|
"Empty!": "空空如也!",
|
||||||
|
"Filter: %s | Sort: %s | Order: %s": "筛选: %s | 排序: %s | 顺序: %s",
|
||||||
|
"File Picker": "文件选择器",
|
||||||
|
"Failed to parse nro": "解析 nro 失败",
|
||||||
|
"Name": "名称",
|
||||||
|
"Set the name of the application": "设置应用程序的名称",
|
||||||
|
"Author": "作者",
|
||||||
|
"Set the author of the application": "设置应用程序的作者",
|
||||||
|
"Version": "版本",
|
||||||
|
"Set the display version of the application": "设置应用程序的显示版本",
|
||||||
|
"Set the path to the icon for the forwarder": "设置前端启动器图标的路径",
|
||||||
|
"Create": "创建",
|
||||||
|
"Failed to load icon": "加载图标失败",
|
||||||
|
"Create the forwarder.": "创建前端启动器。",
|
||||||
|
"All fields must be non-empty!": "所有字段不能为空!",
|
||||||
|
"Open": "打开",
|
||||||
|
"Empty...": "空...",
|
||||||
|
"%zd files": "%zd 个文件",
|
||||||
|
"%zd dirs": "%zd 个文件夹",
|
||||||
|
"Open with DayBreak?": "使用DayBreak打开?",
|
||||||
|
"Launch ": "启动 ",
|
||||||
|
"Launch option for: ": "启动选项:",
|
||||||
|
"Select launcher for: ": "选择启动器用于:",
|
||||||
|
"Install Selected files?": "安装所选文件?",
|
||||||
|
"Installing ": "正在安装 ",
|
||||||
|
"Installed ": "已安装",
|
||||||
|
"File install failed!": "文件安装失败!",
|
||||||
|
"Extracting ": "正在解压",
|
||||||
|
"Extract failed!": "解压失败!",
|
||||||
|
"Extract success!": "解压成功!",
|
||||||
|
"Compressing ": "正在压缩 ",
|
||||||
|
"Compress failed!": "压缩失败",
|
||||||
|
"Compress success!": "压缩成功!",
|
||||||
|
"Failed to delete directory": "删除目录失败",
|
||||||
|
"Failed to delete file": "删除文件失败",
|
||||||
|
"Deleting": "正在删除",
|
||||||
|
"Scanning ": "正在扫描 ",
|
||||||
|
"Pasting": "正在粘贴",
|
||||||
|
"Pasting ": "正在粘贴 ",
|
||||||
|
"Creating ": "正在创建 ",
|
||||||
|
"Copying ": "正在复制 ",
|
||||||
|
"Deleting ": "正在删除 ",
|
||||||
|
"Hashing": "正在计算文件哈希",
|
||||||
|
"Failed to hash file...": "计算文件哈希失败...",
|
||||||
|
"File Options": "文件选项",
|
||||||
|
"Mount": "挂载",
|
||||||
|
"Sort By": "排序方式",
|
||||||
|
"Sort Options": "排序选项",
|
||||||
|
"Show Hidden": "显示隐藏项目",
|
||||||
|
"Folders First": "文件夹靠前",
|
||||||
|
"Hidden Last": "隐藏项目置后",
|
||||||
|
"Cut": "剪切",
|
||||||
|
"Copy": "复制",
|
||||||
|
"Paste": "粘贴",
|
||||||
|
"Paste file(s)?": "粘贴 个文件(夹)?",
|
||||||
|
"Rename": "重命名",
|
||||||
|
"Set new name": "设置新名称",
|
||||||
|
"Failed to rename file: ": "重命名文件失败: ",
|
||||||
|
"Delete": "删除",
|
||||||
|
"Delete Selected files?": "删除选中的文件?",
|
||||||
|
"Install Forwarder": "安装前端应用",
|
||||||
|
"Extract zip": "解压 zip",
|
||||||
|
"Extract Options": "解压选项",
|
||||||
|
"Extract here": "解压到这里",
|
||||||
|
"Extract to root": "解压到根目录",
|
||||||
|
"Are you sure you want to extract to root?": "您确定要解压到根目录吗?",
|
||||||
|
"Extract to...": "解压到...",
|
||||||
|
"Enter the path to the folder to extract into": "输入要解压到的文件夹的路径",
|
||||||
|
"Compress to zip": "压缩到zip",
|
||||||
|
"Compress Options": "压缩选项",
|
||||||
|
"Compress": "压缩",
|
||||||
|
"Compress to...": "压缩到...",
|
||||||
|
"Enter the path to the folder to compress into": "输入要压缩的文件夹路径",
|
||||||
|
"Create File": "新建文件",
|
||||||
|
"Set File Name": "输入文件名",
|
||||||
|
"Create Folder": "新建文件夹",
|
||||||
|
"Set Folder Name": "输入文件夹名",
|
||||||
|
"View as text (unfinished)": "以文本形式查看(未完善)",
|
||||||
|
"Set as background music": "设置为背景音乐",
|
||||||
|
"Failed to set default music path": "设置默认音乐路径失败",
|
||||||
|
"Hash": "哈希",
|
||||||
|
"Hash Options": "哈希选项",
|
||||||
|
"Ignore read only": "忽略只读",
|
||||||
|
"Failed to mount FS.": "文件系统挂载失败。",
|
||||||
|
"Close FileBrowser?": "是否关闭文件浏览器?",
|
||||||
|
"Split": "拆分",
|
||||||
|
"Close": "关闭",
|
||||||
|
"FTP Install": "通过 FTP 安装",
|
||||||
|
"Connection Type: WiFi | Strength: ": "连接类型:WiFi |强度:",
|
||||||
|
"Connection Type: Ethernet": "连接类型:以太网",
|
||||||
|
"Connection Type: None": "连接类型:无",
|
||||||
|
"Host:": "主机:",
|
||||||
|
"Port:": "端口:",
|
||||||
|
"Username:": "用户名:",
|
||||||
|
"Password:": "密码:",
|
||||||
|
"SSID:": "网络名称:",
|
||||||
|
"Passphrase:": "密码:",
|
||||||
|
"Success": "成功",
|
||||||
|
"Failed to launch application": "",
|
||||||
|
"Game Options": "游戏选项",
|
||||||
|
"Hide forwarders": "隐藏前端启动",
|
||||||
|
"View application content": "查看应用程序内容",
|
||||||
|
"Launch random game": "启动随机游戏",
|
||||||
|
"Export NSP": "导出 NSP",
|
||||||
|
"Not supported in Applet Mode": "小程序模式不支持",
|
||||||
|
"Export NSZ": "导出 NSZ",
|
||||||
|
"Exports to NSZ (compressed NSP)": "导出为 NSZ(压缩的 NSP)",
|
||||||
|
"Are you sure you want to delete ": "您确定要删除吗 ",
|
||||||
|
"Advanced options": "高级选项",
|
||||||
|
"Refresh": "刷新",
|
||||||
|
"Create contents folder": "创建内容文件夹",
|
||||||
|
"Folder create failed!": "文件夹创建失败!",
|
||||||
|
"Folder created!": "文件夹创建成功!",
|
||||||
|
"Create save": "创建存档",
|
||||||
|
"Select user to create save for": "选择要为其创建存档的用户",
|
||||||
|
"Delete title cache": "删除游戏缓存",
|
||||||
|
"Are you sure you want to delete the title cache?": "您确定要删除标题缓存吗?",
|
||||||
|
"Updating application record list": "更新应用程序记录列表",
|
||||||
|
"Delete failed!": "删除失败!",
|
||||||
|
"Delete successfull!": "删除成功!",
|
||||||
|
"Select content to export": "选择要导出的内容",
|
||||||
|
"Export All": "导出全部",
|
||||||
|
"Export Application": "导出应用程序",
|
||||||
|
"Export Patch": "导出补丁",
|
||||||
|
"Export AddOnContent": "导出追加内容(DLC)",
|
||||||
|
"Export DataPatch": "导出数据补丁",
|
||||||
|
"Creating": "正在创建",
|
||||||
|
"Save create failed!": "存档创建失败!",
|
||||||
|
"Save create successfull!": "存档创建成功!",
|
||||||
|
"Failed to delete meta entry": "删除元数据失败",
|
||||||
|
"None": "无",
|
||||||
|
"Common": "公共",
|
||||||
|
"Personalised": "个性化",
|
||||||
|
"Missing": "丢失",
|
||||||
|
"View Content": "查看内容",
|
||||||
|
"Content Options": "内容选项",
|
||||||
|
"Are you sure you want to delete the selected entries?": "您确定要删除选定的条目吗?",
|
||||||
|
"Reset required system version": "重置所需系统版本",
|
||||||
|
"Are you sure you want to reset required system version?": "您确定要重置所需的系统版本吗?",
|
||||||
|
"Reset": "重置",
|
||||||
|
"Failed to reset required system version": "重置所需系统版本失败",
|
||||||
|
"Required System Version: %u.%u.%u": "",
|
||||||
|
"Required Application Version: v%u": "",
|
||||||
|
"Content Count: %u (%u missing)": "",
|
||||||
|
"Content Count: %u": "",
|
||||||
|
"Ticket: %s": "",
|
||||||
|
"Key Generation: %u (%s)": "",
|
||||||
|
"Display Version: %s": "",
|
||||||
|
"Mount Fs": "挂载文件系统",
|
||||||
|
"Failed to mount NCA": "NCA 挂载失败",
|
||||||
|
"NCA Options": "NCA选项",
|
||||||
|
"Export NCA": "导出NCA",
|
||||||
|
"Export NCA decrypted": "导出已解密的 NCA",
|
||||||
|
"Exports the NCA with all fs sections decrypted (NCA header is still encrypted).": "导出所有文件系统分区已解密的 NCA(NCA 头仍为加密)。",
|
||||||
|
"Verify NCA 256 hash": "验证 NCA 256 哈希",
|
||||||
|
"NCA hash missmatch!": "NCA 哈希值不匹配!",
|
||||||
|
"NCA hash valid.": "NCA 哈希值有效。",
|
||||||
|
"nca_validate_info": [
|
||||||
|
"对NCA执行sha256哈希以检查其是否有效。\n",
|
||||||
|
"注意:这仅检测哈希是否不匹配,并不验证内容是否已被修改。"
|
||||||
|
],
|
||||||
|
"Verify NCA fixed key": "验证NCA固定密钥",
|
||||||
|
"NCA fixed key is invalid!": "NCA固定密钥无效!",
|
||||||
|
"NCA fixed key is valid.": "NCA固定密钥有效。",
|
||||||
|
"nca_fixedkey_info": [
|
||||||
|
"执行RSA NCA固定密钥验证。",
|
||||||
|
"这是对NCA头部的哈希值。它用于验证头部是否未被修改。 ",
|
||||||
|
"头部由任天堂签名,因此无法伪造,可以可靠地检测修改过的NCA头(如NSP/XCI转换)。"
|
||||||
|
],
|
||||||
|
"Failed to decrypt NCA": "解密 NCA 失败",
|
||||||
|
"Application Type: %s": "",
|
||||||
|
"Content Type: %s": "",
|
||||||
|
"Distribution Type: %s": "",
|
||||||
|
"Program ID: %016lX": "",
|
||||||
|
"SDK Version: %u.%u.%u.%u": "",
|
||||||
|
"Export XCI (Gamecard)": "",
|
||||||
|
"Export XCZ (Compressed XCI)": "",
|
||||||
|
"GameCard": "游戏卡",
|
||||||
|
"Gc install failed!": "游戏安装失败。",
|
||||||
|
"Gc install success!": "游戏安装成功。",
|
||||||
|
"Select content to dump": "选择要转储的内容",
|
||||||
|
"Export All Bins": "导出所有 Bin 文件",
|
||||||
|
"Export XCI": "导出 XCI",
|
||||||
|
"Export Card ID Set": "导出游戏卡ID集",
|
||||||
|
"Export Card UID": "导出游戏卡UID",
|
||||||
|
"Export Certificate": "导出证书",
|
||||||
|
"Export Initial Data": "导出初始数据",
|
||||||
|
"Failed to mount GameCard filesystem": "游戏卡文件系统挂载失败",
|
||||||
|
"System memory %.1f GB": "主机内存 %.1f GB",
|
||||||
|
"microSD card %.1f GB": "microSD卡 %.1f GB",
|
||||||
|
"App-ID: 0%lX": "",
|
||||||
|
"Key-Gen: %u (%s)": "",
|
||||||
|
"Size: %.2f GB": "",
|
||||||
|
"Base: %zu Patch: %zu Addon: %zu Data: %zu": "",
|
||||||
|
"Prev": "上一项",
|
||||||
|
"Next": "下一项",
|
||||||
|
"No GameCard inserted": "未插入游戏卡",
|
||||||
|
"WARNING: GameCard is already trimmed!": "警告:游戏卡已被修剪!",
|
||||||
|
"Continue": "继续",
|
||||||
|
"GameCard is trimmed, full dump is not possible!": "游戏卡已被裁剪,无法进行完整转储!",
|
||||||
|
"Downloading json": "正在下载JSON",
|
||||||
|
"Download": "下载",
|
||||||
|
"Failed to download json": "下载JSON失败",
|
||||||
|
"Select release to download for ": "选择要下载的版本:",
|
||||||
|
"Select asset to download for ": "选择要下载的资源:",
|
||||||
|
"Failed to download app!": "下载应用失败!",
|
||||||
|
"Unstar": "取消星标",
|
||||||
|
"Unstarred ": "取消星标 ",
|
||||||
|
"Star": "星标",
|
||||||
|
"Starred ": "已星标 ",
|
||||||
|
"Homebrew Options": "自制软件选项",
|
||||||
|
"Updated (Star)": "最近更新(星标优先)",
|
||||||
|
"Alphabetical (Star)": "按字母顺序(星标优先)",
|
||||||
|
"Size (Star)": "按大小(星标优先)",
|
||||||
|
"Display entries in Ascending or Descending order.": "以升序或降序显示条目。",
|
||||||
|
"Change the layout to List, Icon and Grid.": "切换布局:列表、图标和网格。",
|
||||||
|
"Show hidden": "显示隐藏项目",
|
||||||
|
"Shows all hidden homebrew.": "显示所有隐藏的自制软件。",
|
||||||
|
"Test": "测试",
|
||||||
|
"Hide": "隐藏",
|
||||||
|
"Hides the selected homebrew.\nTo unhide homebrew, enable \"Show hidden\" in the sort options.": "隐藏所选自制软件。\n要取消隐藏自制软件,请在排序选项中启用\"显示隐藏项目\"。",
|
||||||
|
"Mount NRO Fs": "挂载 NRO 文件系统",
|
||||||
|
"Failed to mount NRO FileSystem": "NRO 文件系统挂载失败",
|
||||||
|
"Mounts the NRO FileSystem (icon, nacp and RomFS).": "挂载 NRO 文件系统(图标、nacp 和 RomFS)。",
|
||||||
|
"hb_remove_info": [
|
||||||
|
"永久删除所选自制软件。\n",
|
||||||
|
"自制软件创建的文件和文件夹仍将保留。 ",
|
||||||
|
"请使用文件浏览器删除它们。"
|
||||||
|
],
|
||||||
|
"Failed to load image": "图片加载失败",
|
||||||
|
"Install failed!": "通过 FTP 安装失败。",
|
||||||
|
"Install success!": "通过 FTP 安装成功。",
|
||||||
|
"Drag'n'Drop (NSP, XCI, NSZ, XCZ) to the install folder": "拖放文件(NSP, XCI, NSZ, XCZ)至安装文件夹",
|
||||||
|
"Failed to install, press B to exit...": "通过 FTP 安装失败,按 B 键退出...",
|
||||||
|
"Irs": "红外成像",
|
||||||
|
"0 (Sideways)": "0度",
|
||||||
|
"90 (Flat)": "90度",
|
||||||
|
"180 (-Sideways)": "180度",
|
||||||
|
"270 (Upside down)": "270度",
|
||||||
|
"Grey": "灰色",
|
||||||
|
"Ironbow": "紫黄",
|
||||||
|
"Green": "绿色",
|
||||||
|
"Red": "红色",
|
||||||
|
"Blue": "蓝色",
|
||||||
|
"All leds": "全部",
|
||||||
|
"Bright group": "亮色组",
|
||||||
|
"Dim group": "暗色组",
|
||||||
|
"Normal image": "正常图像",
|
||||||
|
"Negative image": "负片图像",
|
||||||
|
"Controller": "控制器",
|
||||||
|
"Rotation": "旋转",
|
||||||
|
"Colour": "颜色",
|
||||||
|
"Light Target": "光源目标",
|
||||||
|
"Gain": "曝光",
|
||||||
|
"Negative Image": "负片图像",
|
||||||
|
"Format": "格式",
|
||||||
|
"Trimming Format": "修剪格式",
|
||||||
|
"External Light Filter": "外部光滤镜",
|
||||||
|
"Load Default": "加载默认值",
|
||||||
|
"Ambient Noise Level: ": "环境噪声等级:",
|
||||||
|
"Pad ": "手柄 ",
|
||||||
|
"HandHeld": "掌机模式",
|
||||||
|
" (Available)": " (可用)",
|
||||||
|
" (Unsupported)": " (不支持)",
|
||||||
|
" (Unconnected)": " (未连接)",
|
||||||
|
"The homebrew menu.\n\nAllows you to launch, delete and mount homebrew!": "自制软件菜单。\n\n允许您启动、删除和挂载自制软件!",
|
||||||
|
"Download and update apps.\n\nInternet connection required.": "下载和更新应用。\n\n需要互联网连接。",
|
||||||
|
"View all installed games. In this menu you can launch, backup, create savedata and much more.": "查看所有已安装的游戏。在此菜单中,您可以启动、备份、创建存档等操作。",
|
||||||
|
"Browse files on you SD Card. You can move, copy, delete, extract zip, create zip, upload and much more.\n\nA connected USB/HDD can be opened by mounting it in the advanced options.": "浏览您的SD卡文件。您可以移动、复制、删除、解压zip、创建zip、上传等更多操作。\n\n连接的USB/HDD可以通过在高级选项中挂载来打开。",
|
||||||
|
"View save data for each user. You can backup and restore saves.\n\nExperimental support for backing up system saves is possible.": "查看每个用户的存档数据。您可以备份和还原存档。\n\n可能支持备份系统存档(实验性功能)。",
|
||||||
|
"Download releases directly from GitHub. Custom entries can be added to /config/sphaira/github": "直接从GitHub下载发布版本。自定义条目可以添加到 /config/sphaira/github",
|
||||||
|
"Install apps via FTP.": "通过FTP安装应用。",
|
||||||
|
"MTP Install": "MTP安装",
|
||||||
|
"Install apps via MTP.": "通过MTP安装应用。",
|
||||||
|
"USB Install": "通过 USB 安装",
|
||||||
|
"Install apps via USB.\n\nA USB client is required on PC.": "通过USB安装应用。\n\n需要在PC上安装USB客户端。",
|
||||||
|
"View info on the inserted Game Card (GC). You can backup and install the inserted GC. To swap GC's, simply remove the old GC and insert the new one. You do not need to exit the menu.": "查看已插入游戏卡(GC)的信息。您可以备份和安装已插入的游戏卡。要更换游戏卡,只需取出旧游戏卡并插入新的。无需退出菜单。",
|
||||||
|
"IRS (Infrared Joycon Camera)": "IRS(Joycon红外摄像头)",
|
||||||
|
"InfraRed Sensor (IRS) is the small camera found on right JoyCon.": "红外传感器(IRS)是右侧JoyCon上的小型摄像头。",
|
||||||
|
"Update avaliable: ": "有可用更新!",
|
||||||
|
"Download via the Network options!": "通过网络选项下载!",
|
||||||
|
"Menu": "菜单",
|
||||||
|
"Menu Options": "菜单选项",
|
||||||
|
"Auto": "自动",
|
||||||
|
"English": "English",
|
||||||
|
"Japanese": "日本語",
|
||||||
|
"French": "Français",
|
||||||
|
"German": "Deutsch",
|
||||||
|
"Italian": "Italiano",
|
||||||
|
"Spanish": "Español",
|
||||||
|
"Chinese (Simplified)": "简体中文",
|
||||||
|
"Korean": "한국어",
|
||||||
|
"Dutch": "Dutch",
|
||||||
|
"Portuguese": "Português",
|
||||||
|
"Russian": "Русский",
|
||||||
|
"Chinese (Traditional)": "繁體中文",
|
||||||
|
"Swedish": "Svenska",
|
||||||
|
"Vietnamese": "Vietnamese",
|
||||||
|
"Ukrainian": "Українська",
|
||||||
|
"Launch one of Sphaira's menus:\n": "启动Sphaira的一个菜单:\n",
|
||||||
|
"\nYou can change the left/right menu in the Advanced Options.": "\n您可以在高级选项中更改左/右菜单。",
|
||||||
|
"Network": "网络",
|
||||||
|
"Network Options": "网络选项",
|
||||||
|
"Download update: ": "下载更新:",
|
||||||
|
"Failed to download update": "更新下载失败",
|
||||||
|
"Updated to ": "更新至 ",
|
||||||
|
"ftp_settings_info": [
|
||||||
|
"启用/修改FTP服务器设置,如端口、用户/密码以及显示的文件夹。\n",
|
||||||
|
"注意:更改任何选项将在退出选项菜单时自动重启FTP服务器。"
|
||||||
|
],
|
||||||
|
"mtp_settings_info": [
|
||||||
|
"启用/修改MTP响应器设置,如显示的文件夹。\n",
|
||||||
|
"注意:更改任何选项将在退出选项菜单时自动重启MTP服务器。"
|
||||||
|
],
|
||||||
|
"HDD": "硬盘",
|
||||||
|
"Enable / modify the HDD mount options.": "启用/修改 HDD 挂载选项。",
|
||||||
|
"NXlink": "NXlink",
|
||||||
|
"nxlink_enable_info": [
|
||||||
|
"启用NXlink服务器后台运行",
|
||||||
|
"NXlink用于从DC向Switch发送.nro文件\n",
|
||||||
|
"如果您不是开发者,可以禁用此选项。"
|
||||||
|
],
|
||||||
|
"nxlink_toggle_info": [
|
||||||
|
"切换FTP、MTP、HDD和NXlink\n",
|
||||||
|
"如果Sphaira有可用更新,您可以从此菜单下载"
|
||||||
|
],
|
||||||
|
"Theme": "主题",
|
||||||
|
"Language": "语言",
|
||||||
|
"translation_info": [
|
||||||
|
"更改语言\n",
|
||||||
|
"如果找不到您的语言或翻译缺失,请考虑在 github.com/ITotalJustice/sphaira 提交PR"
|
||||||
|
],
|
||||||
|
"advanced_options_info": [
|
||||||
|
"更改高级选项。",
|
||||||
|
"请查看信息框以更好地理解每个选项。"
|
||||||
|
],
|
||||||
|
"System %.1f GB": "系统 %.1f GB",
|
||||||
|
"microSD %.1f GB": "microSD %.1f GB",
|
||||||
|
"[Applet Mode]": "[小程序模式]",
|
||||||
|
"Ethernet": "以太网",
|
||||||
|
"No Internet": "网络未连接",
|
||||||
|
"State: %s | Speed: %s": "状态: %s | 速度: %s",
|
||||||
|
"Failed to mount save filesystem": "存档文件系统挂载失败",
|
||||||
|
"Save Options": "存档选项",
|
||||||
|
"System": "系统",
|
||||||
|
"Account": "账户",
|
||||||
|
"BCAT": "BCAT数据",
|
||||||
|
"Device": "设备",
|
||||||
|
"Temporary": "临时",
|
||||||
|
"Cache": "缓存",
|
||||||
|
"System BCAT": "系统备份",
|
||||||
|
"Data Type": "数据类型",
|
||||||
|
"Backup": "备份",
|
||||||
|
"Backup the selected save(s) to a location of your choice.": "将选中的存档备份到您选择的位置。",
|
||||||
|
"Backup to...": "备份到...",
|
||||||
|
"Backup the selected save(s) to a location of your choice, and set the name of the backup.": "将选定的存档备份到您选择的位置,并设置备份名称。",
|
||||||
|
"save_backuprestore_info": [
|
||||||
|
"还原当前游戏的存档。",
|
||||||
|
"如果启用了\"自动备份\",存档将首先被备份然后还原。 ",
|
||||||
|
"自动备份的存档名称中将包含\"Auto\"。"
|
||||||
|
],
|
||||||
|
"Auto backup on restore": "还原时自动备份",
|
||||||
|
"If enabled, when restoring a save, the current save will first be backed up.": "如果启用,当还原存档时,当前存档将首先被备份。",
|
||||||
|
"Compress backup": "压缩备份",
|
||||||
|
"save_backup_compress_info": [
|
||||||
|
"如果启用,备份将被压缩为zip文件。\n",
|
||||||
|
"注意:禁用此选项不会禁用zip文件,它只会禁用zip中存储文件的压缩。",
|
||||||
|
"禁用将使备份速度更快,但代价是文件大小增加。"
|
||||||
|
],
|
||||||
|
"Select backup location": "选择备份位置",
|
||||||
|
"Backup failed!": "备份失败!",
|
||||||
|
"Backup successfull!": "已备份成功!",
|
||||||
|
"Select restore location": "选择还原位置",
|
||||||
|
"Invalid location type!": "位置类型无效!",
|
||||||
|
"No saves found in ": "未找到存档 ",
|
||||||
|
"Restore save for: ": "还原备份文件: ",
|
||||||
|
"Are you sure you want to restore ": "您确定要还原已备份文件吗 ",
|
||||||
|
"Auto backup": "自动备份",
|
||||||
|
"Restore failed!": "还原失败!",
|
||||||
|
"Restore successfull!": "已还原成功!",
|
||||||
|
"Set name for ": "设置名称为:",
|
||||||
|
"Set backup name": "设备备份名称",
|
||||||
|
"Flushing zip to file": "将压缩包写入文件",
|
||||||
|
"Disable MTP for usb install": "暂时禁用 USB 安装的 MTP 功能",
|
||||||
|
"Re-enabled MTP": "重新启用 MTP",
|
||||||
|
"Installed via usb": "通过 USB 安装",
|
||||||
|
"USB install failed!": "USB 安装失败!",
|
||||||
|
"Usb install success!": "USB安装成功!",
|
||||||
|
"Waiting for connection...": "等待连接中...",
|
||||||
|
"Connected, waiting for file list...": "已连接,正在等待文件列表...",
|
||||||
|
"Connected, starting transfer...": "已连接,开始传输...",
|
||||||
|
"Transferring data...": "正在传输数据...",
|
||||||
|
"Press B to exit...": "按 B 键退出...",
|
||||||
|
"Failed to init usb, press B to exit...": "USB 初始化失败,按 B 键退出...",
|
||||||
|
"Detached": "已断开",
|
||||||
|
"Attached": "已连接",
|
||||||
|
"Powered": "已供电",
|
||||||
|
"Default": "默认",
|
||||||
|
"Address": "地址",
|
||||||
|
"Configured": "已配置",
|
||||||
|
"Suspended": "已挂起",
|
||||||
|
"USB 1.0 Low Speed": "USB 1.0 低速",
|
||||||
|
"USB 1.1 Full Speed": "USB 1.1 全速",
|
||||||
|
"USB 2.0 High Speed": "USB 2.0 高速",
|
||||||
|
"USB 3.0 Super Speed": "USB 3.0 超高速",
|
||||||
|
"Mount Creator": "创建挂载",
|
||||||
|
"Type": "类型",
|
||||||
|
"Select the type of the forwarder.": "选择前端启动器的类型。",
|
||||||
|
"URL": "",
|
||||||
|
"Set the URL of the application": "设置应用程序的 URL",
|
||||||
|
"Optional: Set the port of the server. If left empty, the default port for the protocol will be used.": "可选:设置服务器端口。如果留空,将使用协议的默认端口。",
|
||||||
|
"Timeout": "超时",
|
||||||
|
"Timeout in milliseconds": "超时(毫秒)",
|
||||||
|
"Optional: Set the timeout in seconds.": "可选:设置超时时间(秒)。",
|
||||||
|
"Optional: Set the username of the application": "可选:设置应用程序的用户名",
|
||||||
|
"Optional: Set the password of the application": "可选:设置应用程序的密码",
|
||||||
|
"Dump path": "转储路径",
|
||||||
|
"Optional: Set the dump path used when exporting games and saves.": "可选:设置导出游戏和存档时使用的转储路径。",
|
||||||
|
"Read only": "只读",
|
||||||
|
"mount_readonly_info": [
|
||||||
|
"将文件系统挂载为只读。\n",
|
||||||
|
"设置此选项还会隐藏挂载点,使其不显示为导出选项。"
|
||||||
|
],
|
||||||
|
"No stat file": "",
|
||||||
|
"filecheck_disable_info": [
|
||||||
|
"启用后将阻止文件浏览器检查每个文件的大小和时间戳。",
|
||||||
|
"这可以提高浏览性能。"
|
||||||
|
],
|
||||||
|
"No stat dir": "",
|
||||||
|
"dircheck_disable_info": [
|
||||||
|
"启用后,文件浏览器将停止检查文件夹中有多少文件和文件夹。",
|
||||||
|
"这可以提高浏览性能,尤其是对于目录列表速度慢的服务器。"
|
||||||
|
],
|
||||||
|
"FS hidden": "隐藏挂载点",
|
||||||
|
"Hide the mount from being visible in the file browser.": "隐藏挂载点,不在文件浏览器中显示。",
|
||||||
|
"Export hidden": "隐藏到处",
|
||||||
|
"Hide the mount from being visible as a export option for games and saves.": "隐藏挂载点,不显示为游戏和存档的导出选项。",
|
||||||
|
"Save": "保存",
|
||||||
|
"Mount entry saved. Restart Sphaira to apply changes.": "挂载条目已保存。重启 Sphaira 以应用更改。",
|
||||||
|
"Saves the mount entry.\n\nNOTE: You must restart Sphaira for changes to take effect!": "保存挂载条目。\n\n注意:您必须重启Sphaira才能使更改生效!",
|
||||||
|
"Name and URL must be set!": "必须设置名称和URL!",
|
||||||
|
"Devoptab Options": "Devoptab选项",
|
||||||
|
"Create New Entry": "创建新条目",
|
||||||
|
"Creates a new mount option.\n\nNOTE: You must restart Sphaira for changes to take effect!": "创建新的挂载选项。\n\n注意:您必须重启Sphaira才能使更改生效!",
|
||||||
|
"Modify Existing Entry": "修改现有条目",
|
||||||
|
"No mount entries found.": "未找到挂载条目。",
|
||||||
|
"Modify Entry": "修改条目",
|
||||||
|
"Modify an existing mount option.\n\nNOTE: You must restart Sphaira for changes to take effect!": "修改现有的挂载选项。\n\n注意:您必须重启Sphaira才能使更改生效!",
|
||||||
|
"Delete Existing Entry": "删除现有条目",
|
||||||
|
"Delete Entry": "删除条目",
|
||||||
|
"Delete an existing mount option.\n\nNOTE: You must restart Sphaira for changes to take effect!": "删除现有的挂载选项。\n\n注意:您必须重启Sphaira才能使更改生效!",
|
||||||
|
"Section #": ""
|
||||||
|
}
|
||||||
923
assets/romfs/i18n/zh-TW.json
Normal file
@@ -0,0 +1,923 @@
|
|||||||
|
{
|
||||||
|
"Homebrew": "自製軟體",
|
||||||
|
"FileBrowser": "檔案瀏覽器",
|
||||||
|
"Appstore": "程式商店",
|
||||||
|
"Corrupted": "已損毀",
|
||||||
|
"enable_install_info": [
|
||||||
|
"安裝功能已停用。\n",
|
||||||
|
"請在 選單 (Y) -> 進階 -> 安裝選項 -> 啟用 中開啟。"
|
||||||
|
],
|
||||||
|
"On": "開",
|
||||||
|
"Off": "關",
|
||||||
|
"Entry": "入口",
|
||||||
|
"Store": "商店",
|
||||||
|
"File": "檔案",
|
||||||
|
"Files": "檔案",
|
||||||
|
"FTP": "FTP",
|
||||||
|
"Games": "遊戲",
|
||||||
|
"Meta": "Meta",
|
||||||
|
"Nca": "NCA",
|
||||||
|
"GC": "卡匣",
|
||||||
|
"GitHub": "GitHub",
|
||||||
|
"Apps": "應用程式",
|
||||||
|
"IRS": "IRS",
|
||||||
|
"MTP": "MTP",
|
||||||
|
"Saves": "存檔",
|
||||||
|
"USB": "USB",
|
||||||
|
"Level 0 (no compression)": "等級 0 (無壓縮)",
|
||||||
|
"Level 1": "等級 1",
|
||||||
|
"Level 2": "等級 2",
|
||||||
|
"Level 3 (default)": "等級 3 (預設)",
|
||||||
|
"Level 4": "等級 4",
|
||||||
|
"Level 5": "等級 5",
|
||||||
|
"Level 6": "等級 6",
|
||||||
|
"Level 7": "等級 7",
|
||||||
|
"Level 8": "等級 8",
|
||||||
|
"0 (single threaded)": "0 (單執行緒)",
|
||||||
|
"1": "1",
|
||||||
|
"2": "2",
|
||||||
|
"3 (default)": "3 (預設)",
|
||||||
|
"4": "4",
|
||||||
|
"16 KB": "16 KB",
|
||||||
|
"32 KB": "32 KB",
|
||||||
|
"64 KB": "64 KB",
|
||||||
|
"128 KB": "128 KB",
|
||||||
|
"256 KB": "256 KB",
|
||||||
|
"512 KB": "512 KB",
|
||||||
|
"1 MB (default)": "1 MB (預設)",
|
||||||
|
"2 MB": "2 MB",
|
||||||
|
"4 MB": "4 MB",
|
||||||
|
"8 MB": "8 MB",
|
||||||
|
"16 MB": "16 MB",
|
||||||
|
"Switch-Handheld!": "切換到手提模式!",
|
||||||
|
"Switch-Docked!": "切換到底座模式!",
|
||||||
|
"Nxlink Connected": "Nxlink 已連線",
|
||||||
|
"Nxlink Upload": "Nxlink 上傳",
|
||||||
|
"Nxlink Finished": "Nxlink 完成",
|
||||||
|
"Restore hbmenu?": "還原 hbmenu?",
|
||||||
|
"Back": "返回",
|
||||||
|
"Restore": "還原",
|
||||||
|
"missing_hbmenu_info": [
|
||||||
|
"找不到 /switch/hbmenu.nro",
|
||||||
|
"請使用程式商店重新安裝 hbmenu"
|
||||||
|
],
|
||||||
|
"OK": "確定",
|
||||||
|
"Failed to restore hbmenu, please re-download hbmenu": "還原 hbmenu 失敗,請重新下載 hbmenu",
|
||||||
|
"Failed to restore hbmenu, using sphaira instead": "還原 hbmenu 失敗,改用 Sphaira",
|
||||||
|
"Restored hbmenu, closing sphaira": "已還原 hbmenu,正在關閉 Sphaira",
|
||||||
|
"Restored hbmenu": "已還原 hbmenu",
|
||||||
|
"Restart Sphaira?": "重新啟動 Sphaira?",
|
||||||
|
"Restart": "重新啟動",
|
||||||
|
"Installing Forwarder": "正在安裝前導程式",
|
||||||
|
"Failed to install forwarder": "安裝前導程式失敗",
|
||||||
|
"Installed!": "已安裝!",
|
||||||
|
"Warning! Logs are enabled, Sphaira will run slowly!": "警告!記錄檔已啟用,Sphaira 執行速度將變慢!",
|
||||||
|
"Audio disabled due to suspended game": "因遊戲暫停而停用音訊",
|
||||||
|
"Theme Options": "佈景主題選項",
|
||||||
|
"Select Theme": "選擇佈景主題",
|
||||||
|
"Customise the look of Sphaira by changing the theme": "更換佈景主題以自訂 Sphaira 的外觀",
|
||||||
|
"Music": "音樂",
|
||||||
|
"bgm_enable_info": [
|
||||||
|
"啟用背景音樂。",
|
||||||
|
"每個佈景主題都可以有自己的音樂檔案。",
|
||||||
|
"如果佈景主題未設定音樂檔案,則會載入預設音樂 (若存在)。"
|
||||||
|
],
|
||||||
|
"Show IP address": "顯示 IP 位址",
|
||||||
|
"display_ip_info": [
|
||||||
|
"在所有選單中顯示 IP 位址 (包含 WiFi 強度)。\n",
|
||||||
|
"注意:在小程式模式下,由於該位置會顯示警告訊息,IP 位址將被隱藏。"
|
||||||
|
],
|
||||||
|
"Remove Background Music": "移除背景音樂",
|
||||||
|
"Removes the background music file": "移除背景音樂檔案",
|
||||||
|
"No background music file is set": "未設定背景音樂檔案",
|
||||||
|
"Menus": "選單",
|
||||||
|
"Web": "網頁",
|
||||||
|
"Enter custom URL": "輸入自訂網址",
|
||||||
|
"Select URL": "選擇網址",
|
||||||
|
"Enter URL": "輸入網址",
|
||||||
|
"web_browser_info": [
|
||||||
|
"啟動內建網頁瀏覽器。\n",
|
||||||
|
"注意:此瀏覽器功能非常有限,部分網站可能無法載入,且有 30 分鐘逾時限制,超時後將關閉瀏覽器。"
|
||||||
|
],
|
||||||
|
"Advanced Options": "進階選項",
|
||||||
|
"Slow": "慢",
|
||||||
|
"Normal": "正常",
|
||||||
|
"Fast": "快",
|
||||||
|
"Logging": "記錄檔",
|
||||||
|
"Logs to /config/sphaira/log.txt": "記錄至 /config/sphaira/log.txt",
|
||||||
|
"Replace hbmenu on exit": "離開時取代 hbmenu",
|
||||||
|
"hbmenu_replace_info": [
|
||||||
|
"啟用後,會將 /hbmenu.nro 替換為 Sphaira,並將 hbmenu 備份至 /switch/hbmenu.nro\n",
|
||||||
|
"停用此選項將可選擇還原 hbmenu。"
|
||||||
|
],
|
||||||
|
"Add / modify mounts": "新增 / 修改掛載點",
|
||||||
|
"mount_options_info": [
|
||||||
|
"建立、修改、刪除網路掛載 (HTTP, FTP, SFTP, SMB, NFS)。",
|
||||||
|
"掛載選項僅需設定網址和名稱,其他欄位 (如連接埠、使用者、密碼等) 為選填。\n",
|
||||||
|
"任何變更都需要重新啟動 Sphaira 才能生效。"
|
||||||
|
],
|
||||||
|
"Boost CPU during transfer": "傳輸時加速 CPU",
|
||||||
|
"transfer_boost_info": [
|
||||||
|
"在傳輸期間啟用加速模式,可提高傳輸速度。",
|
||||||
|
"這會將 CPU 設定為 1785mhz 並將 GPU 降低至 76mhz。"
|
||||||
|
],
|
||||||
|
"Text scroll speed": "文字捲動速度",
|
||||||
|
"Change how fast the scrolling text updates": "更改捲動文字的更新速度",
|
||||||
|
"Set center menu": "設定中央選單",
|
||||||
|
"Press OK to restart Sphaira": "按 OK 重新啟動 Sphaira",
|
||||||
|
"Set the menu that appears on the center tab.": "設定顯示在中央分頁的選單。",
|
||||||
|
"Set left-side menu": "設定左側選單",
|
||||||
|
"Set the menu that appears on the left tab.": "設定顯示在左側分頁的選單。",
|
||||||
|
"Set right-side menu": "設定右側選單",
|
||||||
|
"Set the menu that appears on the right tab.": "設定顯示在右側分頁的選單。",
|
||||||
|
"Install options": "安裝選項",
|
||||||
|
"install_options_info": [
|
||||||
|
"更改安裝選項。",
|
||||||
|
"您可以從此處啟用安裝功能。"
|
||||||
|
],
|
||||||
|
"Export options": "匯出選項",
|
||||||
|
"Change the export options.": "更改匯出選項。",
|
||||||
|
"Install Options": "安裝選項",
|
||||||
|
"System memory": "系統記憶體",
|
||||||
|
"microSD card": "microSD 卡",
|
||||||
|
"Enable sysmmc": "啟用真實系統 (SysMMC)",
|
||||||
|
"Enables installing whilst in sysMMC mode.": "啟用在真實系統模式下進行安裝。",
|
||||||
|
"Enable emummc": "啟用虛擬系統 (EmuMMC)",
|
||||||
|
"Enables installing whilst in emuMMC mode.": "啟用在虛擬系統模式下進行安裝。",
|
||||||
|
"Install location": "安裝位置",
|
||||||
|
"Allow downgrade": "允許降級",
|
||||||
|
"Allows for installing title updates that are lower than the currently installed update.": "允許安裝比目前已安裝版本更舊的更新檔。",
|
||||||
|
"Skip if already installed": "若已安裝則跳過",
|
||||||
|
"Skips installing titles / ncas if they're already installed.": "若已安裝該 Title / NCA,則跳過安裝。",
|
||||||
|
"Ticket only": "僅安裝 Ticket",
|
||||||
|
"Installs tickets only, useful if the title was already installed however the tickets were missing or corrupted.": "僅安裝 Ticket,適用於遊戲已安裝但 Ticket 遺失或損毀的情況。",
|
||||||
|
"Skip base": "跳過本體",
|
||||||
|
"Skips installing the base application.": "跳過安裝應用程式本體。",
|
||||||
|
"Skip patch": "跳過更新檔 (UPD)",
|
||||||
|
"Skips installing updates.": "跳過安裝更新檔。",
|
||||||
|
"Skip dlc": "跳過追加內容 (DLC)",
|
||||||
|
"Skips installing DLC.": "跳過安裝 DLC。",
|
||||||
|
"Skip data patch": "跳過資料更新",
|
||||||
|
"Skips installing DLC update (data patch).": "跳過安裝 DLC 更新 (資料更新)。",
|
||||||
|
"Skip ticket": "跳過 Ticket",
|
||||||
|
"Skips installing tickets, not recommended.": "跳過安裝 Ticket,不建議使用。",
|
||||||
|
"Skip NCA hash verify": "跳過 NCA 雜湊驗證",
|
||||||
|
"skip_nca_info": [
|
||||||
|
"啟用此選項以跳過 sha256 驗證。這是針對整個 NCA 的雜湊檢查。",
|
||||||
|
"用於驗證 NCA 是否有效且未損毀。",
|
||||||
|
"您可能在安裝損毀的遊戲時看過「正在檢查損毀資料」的選項。",
|
||||||
|
"該檢查執行各種雜湊檢查,包括針對 NCA 的雜湊。\n",
|
||||||
|
"建議保持停用此選項。"
|
||||||
|
],
|
||||||
|
"Skip RSA header verify": "跳過 RSA 標頭驗證",
|
||||||
|
"nca_verify_info": [
|
||||||
|
"啟用此選項以跳過 RSA NCA 固定金鑰驗證。",
|
||||||
|
"這是針對 NCA 標頭的雜湊檢查,用於驗證標頭是否被修改。",
|
||||||
|
"標頭由任天堂簽署,因此無法偽造,能可靠地檢測修改過的 NCA 標頭 (如 NSP/XCI 轉換檔)。\n",
|
||||||
|
"建議保持停用此選項,除非您需要安裝 NSP/XCI 轉換檔。"
|
||||||
|
],
|
||||||
|
"Skip RSA NPDM verify": "跳過 RSA NPDM 驗證",
|
||||||
|
"npdm_verify_info": [
|
||||||
|
"啟用此選項以跳過 RSA NPDM 固定金鑰驗證。\n",
|
||||||
|
"目前此選項尚未實作 (Stubbed)。"
|
||||||
|
],
|
||||||
|
"Ignore distribution bit": "忽略分發位元",
|
||||||
|
"nca_distbit_info": [
|
||||||
|
"若設定,將忽略 NCA 標頭中的分發位元 (Distribution bit)。",
|
||||||
|
"分發位元用於標示 NCA 是 Eshop 版還是卡匣 (GameCard) 版。",
|
||||||
|
"您通常無法啟動安裝後且分發位元設為卡匣版的遊戲。\n",
|
||||||
|
"建議保持停用此選項。"
|
||||||
|
],
|
||||||
|
"Convert to common ticket": "轉換為通用 Ticket",
|
||||||
|
"ticket_convert_info": [
|
||||||
|
"[需要金鑰] 將個人化 Ticket 轉換為通用 (偽造) Ticket。\n",
|
||||||
|
"建議保持啟用此選項。"
|
||||||
|
],
|
||||||
|
"Convert to standard crypto": "轉換為標準加密",
|
||||||
|
"titlekey_crypto_info": [
|
||||||
|
"[需要金鑰] 將 TitleKey 轉換為標準加密,也稱為「無 Ticket (Ticketless)」。\n",
|
||||||
|
"建議保持停用此選項。"
|
||||||
|
],
|
||||||
|
"Lower master key": "降低主金鑰 (Master Key)",
|
||||||
|
"keyarea_crypto_info": [
|
||||||
|
"[需要金鑰] 使用主金鑰 0 加密 Keak (金鑰區域金鑰),允許遊戲在所有韌體版本上啟動。",
|
||||||
|
"隱含執行標準加密。\n",
|
||||||
|
"請注意,僅因遊戲可解密而在任何韌體上啟動,並不代表它能正常運作。強烈建議更新您的韌體和 Atmosphere 版本來遊玩遊戲,而不是啟用此選項。\n",
|
||||||
|
"建議保持停用此選項。"
|
||||||
|
],
|
||||||
|
"Lower system version": "降低系統版本要求",
|
||||||
|
"cnmt_fw_info": [
|
||||||
|
"將 CNMT 擴充標頭中的 system_firmware 欄位設定為 0。",
|
||||||
|
"注意:如果主金鑰高於韌體版本,遊戲仍無法啟動,因為韌體沒有解密 Keak 的金鑰 (見上文)。\n",
|
||||||
|
"建議保持停用此選項。"
|
||||||
|
],
|
||||||
|
"Export Options": "匯出選項",
|
||||||
|
"Created nested folder": "已建立巢狀資料夾",
|
||||||
|
"game_folder_info": [
|
||||||
|
"使用遊戲名稱建立資料夾。",
|
||||||
|
"例如:/名稱/名稱.xci",
|
||||||
|
"停用此選項將使用 /名稱.xci"
|
||||||
|
],
|
||||||
|
"Append folder with .xci": "資料夾名稱加上 .xci",
|
||||||
|
"xci_folder_info": [
|
||||||
|
"XCI 提取時會在資料夾名稱加上 .xci 副檔名。",
|
||||||
|
"例如:/名稱.xci/名稱.xci\n",
|
||||||
|
"某些裝置僅在 XCI 資料夾名稱與 XCI 檔案名稱完全相同時才能運作。"
|
||||||
|
],
|
||||||
|
"Trim XCI": "裁剪 XCI (瘦身)",
|
||||||
|
"Removes the unused data at the end of the XCI, making the output smaller.": "移除 XCI 尾端未使用的資料,讓輸出的檔案更小。",
|
||||||
|
"Label trimmed XCI": "標記已裁剪的 XCI",
|
||||||
|
"Names the trimmed xci.\nFor example, /name/name (trimmed).xci": "命名已裁剪的 XCI。\n例如:/名稱/名稱 (trimmed).xci",
|
||||||
|
"Converts personalised ticket to a fake common ticket.": "將個人化 Ticket 轉換為偽造的通用 Ticket。",
|
||||||
|
"NSZ level": "NSZ 壓縮等級",
|
||||||
|
"compress_level_info": [
|
||||||
|
"設定匯出為 NSZ 時使用的壓縮等級。\n",
|
||||||
|
"注意:Switch CPU 速度不快,設定太高的值會導致",
|
||||||
|
"匯出時間非常長,但檔案大小縮減有限。\n",
|
||||||
|
"建議將此值設定為 3。"
|
||||||
|
],
|
||||||
|
"NSZ threads": "NSZ 執行緒",
|
||||||
|
"compress_threads_info": [
|
||||||
|
"設定壓縮 NCA 時使用的執行緒數量。\n",
|
||||||
|
"小於 3 的值允許另一個執行緒自由運作,例如讀/寫執行緒。",
|
||||||
|
"但在測試中,值為 3 通常效能最佳。",
|
||||||
|
"值為 0 將不使用執行緒,僅應於測試時使用,因為速度總是較慢。\n",
|
||||||
|
"建議將此值設定在 1-3 之間。"
|
||||||
|
],
|
||||||
|
"NSZ long distance mode": "NSZ 長距離模式",
|
||||||
|
"Enables \"Long Distance Mode\" which can reduce the output size at the cost of speed.": "啟用「長距離模式」,可縮小輸出檔案大小,但會降低速度。",
|
||||||
|
"NSZ block compression": "NSZ 區塊壓縮",
|
||||||
|
"block_compress_info": [
|
||||||
|
"啟用區塊壓縮,將 NCA 壓縮成區塊 (代價是壓縮率較差),",
|
||||||
|
"這允許隨機存取,讓 NCZ 可以像檔案系統一樣被掛載。\n",
|
||||||
|
"注意:Sphaira 尚不支援將 NCZ 掛載為檔案系統,但最終將會加入此功能。"
|
||||||
|
],
|
||||||
|
"NSZ block size": "NSZ 區塊大小",
|
||||||
|
"Sets the size of each block. The smaller the size, the faster the random access is at the cost of compression ratio.": "設定每個區塊的大小。區塊越小,隨機存取速度越快,但壓縮率較低。",
|
||||||
|
"NSZ block compression is disabled.": "NSZ 區塊壓縮已停用。",
|
||||||
|
"FTP Options": "FTP 選項",
|
||||||
|
"Restarting FTP server...": "正在重新啟動 FTP 伺服器...",
|
||||||
|
"Enable": "啟用",
|
||||||
|
"Enable FTP server to run in the background.": "啟用 FTP 伺服器在背景執行。",
|
||||||
|
"Port": "連接埠",
|
||||||
|
"Opens the FTP server on this port.": "在此連接埠開啟 FTP 伺服器。",
|
||||||
|
"Anon": "匿名",
|
||||||
|
"login_require_info": [
|
||||||
|
"允許您在未設定使用者名稱和密碼的情況下登入。",
|
||||||
|
"如果停用,您必須在下方設定使用者名稱和密碼!"
|
||||||
|
],
|
||||||
|
"User": "使用者",
|
||||||
|
"Sets the username, must be set if anon is disabled.": "設定使用者名稱,若停用匿名則必須設定。",
|
||||||
|
"Pass": "密碼",
|
||||||
|
"Sets the password, must be set if anon is disabled.": "設定密碼,若停用匿名則必須設定。",
|
||||||
|
"Show album": "顯示相簿",
|
||||||
|
"Shows the microSD card album folder.": "顯示 microSD 卡的相簿資料夾。",
|
||||||
|
"Show Atmosphere contents": "顯示 Atmosphere contents",
|
||||||
|
"Shows the shortcut for the /atmosphere/contents folder.": "顯示 /atmosphere/contents 資料夾的捷徑。",
|
||||||
|
"Show bis storage": "顯示 BIS 儲存區",
|
||||||
|
"bis_contents_info": [
|
||||||
|
"顯示 BIS 資料夾,包含以下內容:",
|
||||||
|
"- BootPartition1Root.bin",
|
||||||
|
"- BootPartition2Root.bin",
|
||||||
|
"- UserDataRoot.bin",
|
||||||
|
"- BootConfigAndPackage2Part1.bin",
|
||||||
|
"- BootConfigAndPackage2Part2.bin",
|
||||||
|
"- BootConfigAndPackage2Part3.bin",
|
||||||
|
"- BootConfigAndPackage2Part4.bin",
|
||||||
|
"- BootConfigAndPackage2Part5.bin",
|
||||||
|
"- BootConfigAndPackage2Part6.bin",
|
||||||
|
"- CalibrationFile.bin",
|
||||||
|
"- SafeMode.bin",
|
||||||
|
"- User.bin",
|
||||||
|
"- System.bin",
|
||||||
|
"- SystemProperEncryption.bin"
|
||||||
|
],
|
||||||
|
"Show bis file systems": "顯示 BIS 檔案系統",
|
||||||
|
"bis_fs_info": [
|
||||||
|
"顯示以下 BIS 檔案系統:",
|
||||||
|
"- bis_calibration_file",
|
||||||
|
"- bis_safe_mode",
|
||||||
|
"- bis_user",
|
||||||
|
"- bis_system"
|
||||||
|
],
|
||||||
|
"Show system contents": "顯示系統 contents",
|
||||||
|
"Shows the system contents folder.": "顯示系統 contents 資料夾。",
|
||||||
|
"Show user contents": "顯示使用者 contents",
|
||||||
|
"Shows the user contents folder.": "顯示使用者 contents 資料夾。",
|
||||||
|
"Show microSD contents": "顯示 microSD contents",
|
||||||
|
"microsd_contents_info": [
|
||||||
|
"顯示 microSD contents 資料夾。\n",
|
||||||
|
"注意:這不是一般的 microSD 卡儲存空間,而是",
|
||||||
|
"儲存 NCA 的位置。一般的 microSD 卡總是會被掛載。"
|
||||||
|
],
|
||||||
|
"Show games": "顯示遊戲",
|
||||||
|
"games_ftp_info": [
|
||||||
|
"顯示遊戲資料夾。\n",
|
||||||
|
"此資料夾包含所有您已安裝的遊戲,允許您透過 FTP 建立備份!\n",
|
||||||
|
"注意:此資料夾為唯讀。您無法透過 FTP 刪除遊戲。"
|
||||||
|
],
|
||||||
|
"Show install": "顯示安裝目錄",
|
||||||
|
"install_ftp_info": [
|
||||||
|
"顯示安裝資料夾。\n",
|
||||||
|
"此資料夾用於透過 FTP 安裝遊戲。\n",
|
||||||
|
"注意:嘗試安裝遊戲時,您必須開啟「FTP 安裝」選單!"
|
||||||
|
],
|
||||||
|
"Show mounts": "顯示掛載點",
|
||||||
|
"mounts_ftp_info": [
|
||||||
|
"顯示掛載資料夾。\n",
|
||||||
|
"此資料夾包含所有新增至 Sphaira 的掛載點,允許您透過 FTP 存取它們!",
|
||||||
|
"例如,您可以透過 FTP 存取您的 SMB、WebDav 或其他 FTP 掛載。"
|
||||||
|
],
|
||||||
|
"Show switch": "顯示 Switch 目錄",
|
||||||
|
"homebrew_folder_info": [
|
||||||
|
"顯示 /switch 資料夾的捷徑。",
|
||||||
|
"這是包含您所有自製軟體 (NRO) 的資料夾。"
|
||||||
|
],
|
||||||
|
"MTP Options": "MTP 選項",
|
||||||
|
"Restarting MTP server...": "正在重新啟動 MTP 伺服器...",
|
||||||
|
"Enable MTP server to run in the background.": "啟用 MTP 伺服器在背景執行。",
|
||||||
|
"Pre-allocate file": "預先配置檔案",
|
||||||
|
"prealloc_info": [
|
||||||
|
"啟用在寫入前預先配置檔案大小。",
|
||||||
|
"這能加快檔案寫入速度,但如果符合以下所有條件,可能會導致逾時:",
|
||||||
|
"- 使用 Windows",
|
||||||
|
"- 使用虛擬系統 (emuMMC)",
|
||||||
|
"- 傳輸大型檔案 (>1GB)\n",
|
||||||
|
"此選項應保持啟用,但如果您符合上述條件並遇到逾時,",
|
||||||
|
"請嘗試停用此選項後重試。"
|
||||||
|
],
|
||||||
|
"games_mtp_info": [
|
||||||
|
"顯示遊戲資料夾。\n",
|
||||||
|
"此資料夾包含所有您已安裝的遊戲,允許您透過 MTP 建立備份!\n",
|
||||||
|
"注意:此資料夾為唯讀。您無法透過 MTP 刪除遊戲。"
|
||||||
|
],
|
||||||
|
"install_mtp_info": [
|
||||||
|
"顯示安裝資料夾。\n",
|
||||||
|
"此資料夾用於透過 MTP 安裝遊戲。\n",
|
||||||
|
"注意:嘗試安裝遊戲時,您必須開啟「MTP 安裝」選單!"
|
||||||
|
],
|
||||||
|
"mounts_mtp_info": [
|
||||||
|
"顯示掛載資料夾。\n",
|
||||||
|
"此資料夾包含所有新增至 Sphaira 的掛載點,允許您透過 MTP 存取它們!",
|
||||||
|
"例如,您可以透過 MTP 存取您的 SMB、WebDav 和 FTP 掛載。"
|
||||||
|
],
|
||||||
|
"Show DevNull": "顯示 DevNull",
|
||||||
|
"usb_benchmark_info": [
|
||||||
|
"顯示 DevNull (速度測試) 資料夾。\n",
|
||||||
|
"此資料夾用於測試 USB 上傳效能。",
|
||||||
|
"這是一個虛擬資料夾,實際上不會寫入任何資料到磁碟。"
|
||||||
|
],
|
||||||
|
"HDD Options": "硬碟選項",
|
||||||
|
"mount_hdd_info": [
|
||||||
|
"啟用掛載已連接的 USB/HDD 硬碟裝置。",
|
||||||
|
"連接的裝置可用於檔案瀏覽器,也可作為提取遊戲和存檔時的備份位置。"
|
||||||
|
],
|
||||||
|
"HDD write protect": "硬碟寫入保護",
|
||||||
|
"Makes the connected HDD read-only.": "將連接的硬碟設為唯讀。",
|
||||||
|
"Installing is disabled, enable now?": "安裝功能已停用,要現在啟用嗎?",
|
||||||
|
"WARNING: Installing apps will lead to a ban!": "警告:安裝未授權的應用程式會導致主機被 Ban!",
|
||||||
|
"Installing enabled!": "安裝功能已啟用!",
|
||||||
|
"microSD card (/dumps/)": "microSD 卡 (/dumps/)",
|
||||||
|
"USB export to PC (usb_export.py)": "USB 匯出至電腦 (usb_export.py)",
|
||||||
|
"USB transfer (Switch 2 Switch)": "USB 傳輸 (Switch 對 Switch)",
|
||||||
|
"/dev/null (Speed Test)": "/dev/null (速度測試)",
|
||||||
|
"Waiting for USB connection...": "等待 USB 連線中...",
|
||||||
|
"USB connected, sending file list": "USB 已連線,正在傳送檔案列表",
|
||||||
|
"Sent file list, waiting for command...": "已傳送檔案列表,等待指令中...",
|
||||||
|
"waiting for usb connection...": "等待 USB 連線中...",
|
||||||
|
"Exporting": "正在匯出",
|
||||||
|
"Export failed!": "匯出失敗!",
|
||||||
|
"Export successfull!": "匯出成功!",
|
||||||
|
"Select export location": "選擇匯出位置",
|
||||||
|
"Please launch MTP install menu before trying to install": "嘗試安裝前請先開啟 MTP 安裝選單",
|
||||||
|
"Album": "相簿",
|
||||||
|
"Install (NSP, XCI, NSZ, XCZ)": "安裝 (NSP、XCI、NSZ、XCZ)",
|
||||||
|
" (Read Only)": " (唯讀)",
|
||||||
|
"Unknown": "未知",
|
||||||
|
"Application": "應用程式",
|
||||||
|
"Creating Program": "正在建立程式",
|
||||||
|
"Creating Control": "正在建立控制項",
|
||||||
|
"Creating Meta": "正在建立 Meta",
|
||||||
|
"Writing Nca": "正在寫入 Nca",
|
||||||
|
"Updating ncm database": "正在更新 ncm 資料庫",
|
||||||
|
"Pushing application record": "正在推送應用程式記錄",
|
||||||
|
"Failed to remove old forwarder, please manually remove it!": "移除舊的前導程式失敗,請手動移除!",
|
||||||
|
"An error occurred": "發生錯誤",
|
||||||
|
"If this message appears repeatedly, please open an issue.": "如果此訊息重複出現,請回報問題 (Issue)。",
|
||||||
|
"Failed to load music": "無法載入音樂",
|
||||||
|
"Artist: Unknown": "演出者:未知",
|
||||||
|
"Album: Unknown": "專輯:未知",
|
||||||
|
"Select": "選擇",
|
||||||
|
"Are you sure you wish to cancel?": "您確定要取消嗎?",
|
||||||
|
"No": "否",
|
||||||
|
"Yes": "是",
|
||||||
|
"%zu hours %zu minutes remaining": "剩餘 %zu 時 %zu 分",
|
||||||
|
"%zu minutes %zu seconds remaining": "剩餘 %zu 分 %zu 秒",
|
||||||
|
"%zu seconds remaining": "剩餘 %zu 秒",
|
||||||
|
"Closing empty sidebar": "關閉空的側邊欄",
|
||||||
|
"All": "全部",
|
||||||
|
"Emulators": "模擬器",
|
||||||
|
"Tools": "工具",
|
||||||
|
"Advanced": "進階",
|
||||||
|
"Themes": "佈景主題",
|
||||||
|
"Legacy": "舊版相容",
|
||||||
|
"Misc": "雜項",
|
||||||
|
"Updated": "更新時間",
|
||||||
|
"Downloads": "下載次數",
|
||||||
|
"Size": "大小",
|
||||||
|
"Alphabetical": "按字母順序",
|
||||||
|
"Desc": "遞減",
|
||||||
|
"Asc": "遞增",
|
||||||
|
"Removing ": "正在移除 ",
|
||||||
|
"Downloading ": "正在下載 ",
|
||||||
|
"Checking MD5": "正在檢查 MD5",
|
||||||
|
"Options": "選項",
|
||||||
|
"More by Author": "作者的其他作品",
|
||||||
|
"Leave Feedback": "留下回饋",
|
||||||
|
"Visit Website": "造訪網站",
|
||||||
|
"version: %s": "版本:%s",
|
||||||
|
"updated: %s": "更新日期:%s",
|
||||||
|
"category: %s": "分類:%s",
|
||||||
|
"extracted: %s": "已解壓:%s",
|
||||||
|
"app_dls: %s": "下載次數:%s",
|
||||||
|
"Loading...": "載入中...",
|
||||||
|
"Failed to download manifest": "無法下載資訊清單",
|
||||||
|
"Details": "詳細資料",
|
||||||
|
"Changelog": "更新日誌",
|
||||||
|
"Downloaded ": "已下載 ",
|
||||||
|
"Uninstalling ": "正在解除安裝 ",
|
||||||
|
"Removed ": "已移除 ",
|
||||||
|
"Install": "安裝",
|
||||||
|
"Update": "更新",
|
||||||
|
"Launch": "啟動",
|
||||||
|
"Remove": "移除",
|
||||||
|
"Completely remove ": "完全移除 ",
|
||||||
|
"AppStore": "程式商店",
|
||||||
|
"Info": "資訊",
|
||||||
|
"AppStore Options": "程式商店選項",
|
||||||
|
"Descending": "遞減",
|
||||||
|
"Ascending": "遞增",
|
||||||
|
"List": "列表",
|
||||||
|
"Icon": "圖示",
|
||||||
|
"Grid": "格狀",
|
||||||
|
"Filter": "篩選",
|
||||||
|
"Sort": "排序",
|
||||||
|
"Order": "順序",
|
||||||
|
"Layout": "版面配置",
|
||||||
|
"Search": "搜尋",
|
||||||
|
"Empty!": "空的!",
|
||||||
|
"Filter: %s | Sort: %s | Order: %s": "篩選:%s | 排序:%s | 順序:%s",
|
||||||
|
"File Picker": "檔案選擇器",
|
||||||
|
"Failed to parse nro": "解析 NRO 失敗",
|
||||||
|
"Name": "名稱",
|
||||||
|
"Set the name of the application": "設定應用程式名稱",
|
||||||
|
"Author": "作者",
|
||||||
|
"Set the author of the application": "設定應用程式作者",
|
||||||
|
"Version": "版本",
|
||||||
|
"Set the display version of the application": "設定應用程式的顯示版本",
|
||||||
|
"Set the path to the icon for the forwarder": "設定前導程式的圖示路徑",
|
||||||
|
"Create": "建立",
|
||||||
|
"Failed to load icon": "載入圖示失敗",
|
||||||
|
"Create the forwarder.": "建立前導程式。",
|
||||||
|
"All fields must be non-empty!": "所有欄位都不能留空!",
|
||||||
|
"Open": "開啟",
|
||||||
|
"Empty...": "空的...",
|
||||||
|
"%zd files": "%zd 個檔案",
|
||||||
|
"%zd dirs": "%zd 個目錄",
|
||||||
|
"Open with DayBreak?": "用 DayBreak 開啟?",
|
||||||
|
"Launch ": "啟動 ",
|
||||||
|
"Launch option for: ": "啟動選項:",
|
||||||
|
"Select launcher for: ": "選擇啟動器:",
|
||||||
|
"Install Selected files?": "安裝選取的檔案?",
|
||||||
|
"Installing ": "正在安裝 ",
|
||||||
|
"Installed ": "已安裝 ",
|
||||||
|
"File install failed!": "檔案安裝失敗!",
|
||||||
|
"Extracting ": "正在解壓縮 ",
|
||||||
|
"Extract failed!": "解壓縮失敗!",
|
||||||
|
"Extract success!": "解壓縮成功!",
|
||||||
|
"Compressing ": "正在壓縮 ",
|
||||||
|
"Compress failed!": "壓縮失敗!",
|
||||||
|
"Compress success!": "壓縮成功!",
|
||||||
|
"Failed to delete directory": "無法刪除資料夾",
|
||||||
|
"Failed to delete file": "無法刪除檔案",
|
||||||
|
"Deleting": "正在刪除",
|
||||||
|
"Scanning ": "正在掃描 ",
|
||||||
|
"Pasting": "正在貼上",
|
||||||
|
"Pasting ": "正在貼上 ",
|
||||||
|
"Creating ": "正在建立 ",
|
||||||
|
"Copying ": "正在複製 ",
|
||||||
|
"Deleting ": "正在刪除 ",
|
||||||
|
"Hashing": "正在計算雜湊",
|
||||||
|
"Failed to hash file...": "計算檔案雜湊失敗...",
|
||||||
|
"File Options": "檔案選項",
|
||||||
|
"Mount": "掛載",
|
||||||
|
"Sort By": "排序依據",
|
||||||
|
"Sort Options": "排序選項",
|
||||||
|
"Show Hidden": "顯示隱藏檔",
|
||||||
|
"Folders First": "資料夾優先",
|
||||||
|
"Hidden Last": "隱藏檔置後",
|
||||||
|
"Cut": "剪下",
|
||||||
|
"Copy": "複製",
|
||||||
|
"Paste": "貼上",
|
||||||
|
"Paste file(s)?": "貼上檔案?",
|
||||||
|
"Rename": "重新命名",
|
||||||
|
"Set new name": "設定新名稱",
|
||||||
|
"Failed to rename file: ": "重新命名檔案失敗:",
|
||||||
|
"Delete": "刪除",
|
||||||
|
"Delete Selected files?": "刪除選取的檔案?",
|
||||||
|
"Install Forwarder": "安裝前導程式",
|
||||||
|
"Extract zip": "解壓縮 zip",
|
||||||
|
"Extract Options": "解壓縮選項",
|
||||||
|
"Extract here": "解壓縮至此",
|
||||||
|
"Extract to root": "解壓縮至根目錄",
|
||||||
|
"Are you sure you want to extract to root?": "確定要解壓縮至根目錄嗎?",
|
||||||
|
"Extract to...": "解壓縮至...",
|
||||||
|
"Enter the path to the folder to extract into": "輸入要解壓縮到的資料夾路徑",
|
||||||
|
"Compress to zip": "壓縮為 zip",
|
||||||
|
"Compress Options": "壓縮選項",
|
||||||
|
"Compress": "壓縮",
|
||||||
|
"Compress to...": "壓縮至...",
|
||||||
|
"Enter the path to the folder to compress into": "輸入要壓縮到的資料夾路徑",
|
||||||
|
"Create File": "建立檔案",
|
||||||
|
"Set File Name": "設定檔案名稱",
|
||||||
|
"Create Folder": "建立資料夾",
|
||||||
|
"Set Folder Name": "設定資料夾名稱",
|
||||||
|
"View as text (unfinished)": "以文字檢視 (未完成)",
|
||||||
|
"Set as background music": "設為背景音樂",
|
||||||
|
"Failed to set default music path": "設定預設音樂路徑失敗",
|
||||||
|
"Hash": "雜湊",
|
||||||
|
"Hash Options": "雜湊選項",
|
||||||
|
"Ignore read only": "忽略唯讀屬性",
|
||||||
|
"Failed to mount FS.": "掛載檔案系統失敗。",
|
||||||
|
"Close FileBrowser?": "關閉檔案瀏覽器?",
|
||||||
|
"Split": "分割",
|
||||||
|
"Close": "關閉",
|
||||||
|
"FTP Install": "FTP 安裝",
|
||||||
|
"Connection Type: WiFi | Strength: ": "連線類型:WiFi | 強度:",
|
||||||
|
"Connection Type: Ethernet": "連線類型:乙太網路",
|
||||||
|
"Connection Type: None": "連線類型:無",
|
||||||
|
"Host:": "主機:",
|
||||||
|
"Port:": "連接埠:",
|
||||||
|
"Username:": "使用者名稱:",
|
||||||
|
"Password:": "密碼:",
|
||||||
|
"SSID:": "SSID:",
|
||||||
|
"Passphrase:": "密碼:",
|
||||||
|
"Success": "成功",
|
||||||
|
"Failed to launch application": "啟動應用程式失敗",
|
||||||
|
"Game Options": "遊戲選項",
|
||||||
|
"Hide forwarders": "隱藏前導程式",
|
||||||
|
"View application content": "檢視應用程式內容",
|
||||||
|
"Launch random game": "隨機啟動遊戲",
|
||||||
|
"Export NSP": "匯出 NSP",
|
||||||
|
"Not supported in Applet Mode": "不支援小程式模式",
|
||||||
|
"Export NSZ": "匯出 NSZ",
|
||||||
|
"Exports to NSZ (compressed NSP)": "匯出為 NSZ (壓縮的 NSP)",
|
||||||
|
"Are you sure you want to delete ": "確定要刪除 ",
|
||||||
|
"Advanced options": "進階選項",
|
||||||
|
"Refresh": "重新整理",
|
||||||
|
"Create contents folder": "建立 contents 資料夾",
|
||||||
|
"Folder create failed!": "建立資料夾失敗!",
|
||||||
|
"Folder created!": "資料夾已建立!",
|
||||||
|
"Create save": "建立存檔",
|
||||||
|
"Select user to create save for": "選擇要建立存檔的使用者",
|
||||||
|
"Delete title cache": "刪除 Title 快取",
|
||||||
|
"Are you sure you want to delete the title cache?": "您確定要刪除 Title 快取嗎?",
|
||||||
|
"Updating application record list": "正在更新應用程式記錄列表",
|
||||||
|
"Delete failed!": "刪除失敗!",
|
||||||
|
"Delete successfull!": "刪除成功!",
|
||||||
|
"Select content to export": "選擇要匯出的內容",
|
||||||
|
"Export All": "匯出全部",
|
||||||
|
"Export Application": "匯出應用程式",
|
||||||
|
"Export Patch": "匯出更新檔 (Patch)",
|
||||||
|
"Export AddOnContent": "匯出追加內容 (DLC)",
|
||||||
|
"Export DataPatch": "匯出資料更新 (DataPatch)",
|
||||||
|
"Creating": "正在建立",
|
||||||
|
"Save create failed!": "建立存檔失敗!",
|
||||||
|
"Save create successfull!": "建立存檔成功!",
|
||||||
|
"Failed to delete meta entry": "刪除 Meta 項目失敗",
|
||||||
|
"None": "無",
|
||||||
|
"Common": "通用",
|
||||||
|
"Personalised": "個人化",
|
||||||
|
"Missing": "遺失",
|
||||||
|
"View Content": "檢視內容",
|
||||||
|
"Content Options": "內容選項",
|
||||||
|
"Are you sure you want to delete the selected entries?": "您確定要刪除選取的項目嗎?",
|
||||||
|
"Reset required system version": "重設系統版本要求",
|
||||||
|
"Are you sure you want to reset required system version?": "您確定要重設系統版本要求嗎?",
|
||||||
|
"Reset": "重設",
|
||||||
|
"Failed to reset required system version": "重設系統版本要求失敗",
|
||||||
|
"Required System Version: %u.%u.%u": "系統版本要求:%u.%u.%u",
|
||||||
|
"Required Application Version: v%u": "應用程式版本要求:v%u",
|
||||||
|
"Content Count: %u (%u missing)": "內容數量:%u (遺失 %u)",
|
||||||
|
"Content Count: %u": "內容數量:%u",
|
||||||
|
"Ticket: %s": "Ticket:%s",
|
||||||
|
"Key Generation: %u (%s)": "金鑰世代:%u (%s)",
|
||||||
|
"Display Version: %s": "顯示版本:%s",
|
||||||
|
"Mount Fs": "掛載檔案系統",
|
||||||
|
"Failed to mount NCA": "掛載 NCA 失敗",
|
||||||
|
"NCA Options": "NCA 選項",
|
||||||
|
"Export NCA": "匯出 NCA",
|
||||||
|
"Export NCA decrypted": "匯出已解密 NCA",
|
||||||
|
"Exports the NCA with all fs sections decrypted (NCA header is still encrypted).": "匯出所有檔案系統區段皆已解密的 NCA (NCA 標頭仍為加密狀態)。",
|
||||||
|
"Verify NCA 256 hash": "驗證 NCA 256 雜湊",
|
||||||
|
"NCA hash missmatch!": "NCA 雜湊不符!",
|
||||||
|
"NCA hash valid.": "NCA 雜湊有效。",
|
||||||
|
"nca_validate_info": [
|
||||||
|
"對 NCA 執行 sha256 雜湊運算以檢查其是否有效。\n",
|
||||||
|
"注意:這只能檢測雜湊是否不符,無法驗證",
|
||||||
|
"內容是否經過修改。"
|
||||||
|
],
|
||||||
|
"Verify NCA fixed key": "驗證 NCA 固定金鑰",
|
||||||
|
"NCA fixed key is invalid!": "NCA 固定金鑰無效!",
|
||||||
|
"NCA fixed key is valid.": "NCA 固定金鑰有效。",
|
||||||
|
"nca_fixedkey_info": [
|
||||||
|
"執行 RSA NCA 固定金鑰驗證。",
|
||||||
|
"這是針對 NCA 標頭的雜湊檢查,用於驗證標頭是否被修改。",
|
||||||
|
"標頭由任天堂簽署,因此無法偽造,能可靠地檢測修改過的 NCA 標頭 (如 NSP/XCI 轉換檔)。"
|
||||||
|
],
|
||||||
|
"Failed to decrypt NCA": "解密 NCA 失敗",
|
||||||
|
"Application Type: %s": "應用程式類型:%s",
|
||||||
|
"Content Type: %s": "內容類型:%s",
|
||||||
|
"Distribution Type: %s": "分發類型:%s",
|
||||||
|
"Program ID: %016lX": "程式 ID:%016lX",
|
||||||
|
"SDK Version: %u.%u.%u.%u": "SDK 版本:%u.%u.%u.%u",
|
||||||
|
"Export XCI (Gamecard)": "匯出 XCI (遊戲卡匣)",
|
||||||
|
"Export XCZ (Compressed XCI)": "匯出 XCZ (壓縮的 XCI)",
|
||||||
|
"GameCard": "遊戲卡匣",
|
||||||
|
"Gc install failed!": "卡匣安裝失敗!",
|
||||||
|
"Gc install success!": "卡匣安裝成功!",
|
||||||
|
"Select content to dump": "選擇要提取的內容",
|
||||||
|
"Export All Bins": "匯出所有 Bin",
|
||||||
|
"Export XCI": "匯出 XCI",
|
||||||
|
"Export Card ID Set": "匯出卡匣 ID Set",
|
||||||
|
"Export Card UID": "匯出卡匣 UID",
|
||||||
|
"Export Certificate": "匯出憑證",
|
||||||
|
"Export Initial Data": "匯出初始資料",
|
||||||
|
"Failed to mount GameCard filesystem": "掛載遊戲卡匣檔案系統失敗",
|
||||||
|
"System memory %.1f GB": "系統記憶體 %.1f GB",
|
||||||
|
"microSD card %.1f GB": "microSD 卡 %.1f GB",
|
||||||
|
"App-ID: 0%lX": "App-ID:0%lX",
|
||||||
|
"Key-Gen: %u (%s)": "金鑰世代:%u (%s)",
|
||||||
|
"Size: %.2f GB": "大小:%.2f GB",
|
||||||
|
"Base: %zu Patch: %zu Addon: %zu Data: %zu": "本體:%zu 更新:%zu DLC:%zu 資料:%zu",
|
||||||
|
"Prev": "上一個",
|
||||||
|
"Next": "下一個",
|
||||||
|
"No GameCard inserted": "未插入遊戲卡匣",
|
||||||
|
"WARNING: GameCard is already trimmed!": "警告:遊戲卡匣已經過裁剪!",
|
||||||
|
"Continue": "繼續",
|
||||||
|
"GameCard is trimmed, full dump is not possible!": "遊戲卡匣已經過裁剪,無法完整提取!",
|
||||||
|
"Downloading json": "正在下載 json",
|
||||||
|
"Download": "下載",
|
||||||
|
"Failed to download json": "下載 json 失敗",
|
||||||
|
"Select release to download for ": "選擇要下載的版本:",
|
||||||
|
"Select asset to download for ": "選擇要下載的資源檔:",
|
||||||
|
"Failed to download app!": "下載應用程式失敗!",
|
||||||
|
"Unstar": "取消星號",
|
||||||
|
"Unstarred ": "已取消星號 ",
|
||||||
|
"Star": "加上星號",
|
||||||
|
"Starred ": "已加星號 ",
|
||||||
|
"Homebrew Options": "自製軟體選項",
|
||||||
|
"Updated (Star)": "更新時間 (星號)",
|
||||||
|
"Alphabetical (Star)": "按字母順序 (星號)",
|
||||||
|
"Size (Star)": "大小 (星號)",
|
||||||
|
"Display entries in Ascending or Descending order.": "以遞增或遞減順序顯示項目。",
|
||||||
|
"Change the layout to List, Icon and Grid.": "將版面配置更改為列表、圖示和格狀。",
|
||||||
|
"Show hidden": "顯示隱藏檔",
|
||||||
|
"Shows all hidden homebrew.": "顯示所有隱藏的自製軟體。",
|
||||||
|
"Test": "測試",
|
||||||
|
"Hide": "隱藏",
|
||||||
|
"Hides the selected homebrew.\n\nTo unhide homebrew, enable \"Show hidden\" in the sort options.": "隱藏選取的自製軟體。\n\n若要取消隱藏,請在排序選項中啟用「顯示隱藏檔」。",
|
||||||
|
"Mount NRO Fs": "掛載 NRO 檔案系統",
|
||||||
|
"Failed to mount NRO FileSystem": "掛載 NRO 檔案系統失敗",
|
||||||
|
"Mounts the NRO FileSystem (icon, nacp and RomFS).": "掛載 NRO 檔案系統 (圖示、NACP 和 RomFS)。",
|
||||||
|
"hb_remove_info": [
|
||||||
|
"永久刪除選取的自製軟體。\n",
|
||||||
|
"該自製軟體建立的檔案和資料夾仍會保留。",
|
||||||
|
"請使用檔案瀏覽器刪除它們。"
|
||||||
|
],
|
||||||
|
"Failed to load image": "載入圖片失敗",
|
||||||
|
"Install failed!": "安裝失敗!",
|
||||||
|
"Install success!": "安裝成功!",
|
||||||
|
"Drag'n'Drop (NSP, XCI, NSZ, XCZ) to the install folder": "拖放檔案 (NSP、XCI、NSZ、XCZ) 至 install 資料夾",
|
||||||
|
"Failed to install, press B to exit...": "安裝失敗,請按 離開...",
|
||||||
|
"Irs": "紅外成像",
|
||||||
|
"0 (Sideways)": "0 (橫向)",
|
||||||
|
"90 (Flat)": "90 (平放)",
|
||||||
|
"180 (-Sideways)": "180 (反向橫向)",
|
||||||
|
"270 (Upside down)": "270 (倒置)",
|
||||||
|
"Grey": "灰色",
|
||||||
|
"Ironbow": "彩虹熱圖 (Ironbow)",
|
||||||
|
"Green": "綠色",
|
||||||
|
"Red": "紅色",
|
||||||
|
"Blue": "藍色",
|
||||||
|
"All leds": "所有 LED",
|
||||||
|
"Bright group": "高亮度群組",
|
||||||
|
"Dim group": "低亮度群組",
|
||||||
|
"Normal image": "正常影像",
|
||||||
|
"Negative image": "負片影像",
|
||||||
|
"Controller": "控制器",
|
||||||
|
"Rotation": "旋轉",
|
||||||
|
"Colour": "色彩",
|
||||||
|
"Light Target": "照明目標",
|
||||||
|
"Gain": "增益",
|
||||||
|
"Negative Image": "負片影像",
|
||||||
|
"Format": "格式",
|
||||||
|
"Trimming Format": "裁剪格式",
|
||||||
|
"External Light Filter": "外部濾光片",
|
||||||
|
"Load Default": "載入預設值",
|
||||||
|
"Ambient Noise Level: ": "環境噪音等級:",
|
||||||
|
"Pad ": "控制器 ",
|
||||||
|
"HandHeld": "手提模式",
|
||||||
|
" (Available)": " (可用)",
|
||||||
|
" (Unsupported)": " (不支援)",
|
||||||
|
" (Unconnected)": " (未連線)",
|
||||||
|
"The homebrew menu.\n\nAllows you to launch, delete and mount homebrew!": "自製軟體選單。\n\n允許您啟動、刪除和掛載自製軟體!",
|
||||||
|
"Download and update apps.\n\nInternet connection required.": "下載並更新應用程式。\n\n需要網際網路連線。",
|
||||||
|
"View all installed games. In this menu you can launch, backup, create savedata and much more.": "檢視所有已安裝的遊戲。您可以在此選單中啟動、備份、建立存檔等。",
|
||||||
|
"Browse files on you SD Card. You can move, copy, delete, extract zip, create zip, upload and much more.\n\nA connected USB/HDD can be opened by mounting it in the advanced options.": "瀏覽 SD 卡上的檔案。您可以移動、複製、刪除、解壓縮 zip、建立 zip、上傳等。\n\n連接的 USB/HDD 可透過進階選項中的掛載功能開啟。",
|
||||||
|
"View save data for each user. You can backup and restore saves.\n\nExperimental support for backing up system saves is possible.": "檢視每位使用者的存檔資料。您可以備份和還原存檔。\n\n支援實驗性的系統存檔備份功能。",
|
||||||
|
"Download releases directly from GitHub. Custom entries can be added to /config/sphaira/github": "直接從 GitHub 下載發行版本。可將自訂項目新增至 /config/sphaira/github",
|
||||||
|
"Install apps via FTP.": "透過 FTP 安裝應用程式。",
|
||||||
|
"MTP Install": "MTP 安裝",
|
||||||
|
"Install apps via MTP.": "透過 MTP 安裝應用程式。",
|
||||||
|
"USB Install": "USB 安裝",
|
||||||
|
"Install apps via USB.\n\nA USB client is required on PC.": "透過 USB 安裝應用程式。\n\n電腦端需要 USB 用戶端軟體。",
|
||||||
|
"View info on the inserted Game Card (GC). You can backup and install the inserted GC. To swap GC's, simply remove the old GC and insert the new one. You do not need to exit the menu.": "檢視已插入遊戲卡匣的資訊。您可以備份和安裝已插入的卡匣。如要更換卡匣,只需取出舊卡匣並插入新卡匣即可,無需離開選單。",
|
||||||
|
"IRS (Infrared Joycon Camera)": "IRS (紅外線 Joy-Con 攝影機)",
|
||||||
|
"InfraRed Sensor (IRS) is the small camera found on right JoyCon.": "紅外線感應器 (IRS) 是位於右側 Joy-Con 上的小型攝影機。",
|
||||||
|
"Update avaliable: ": "有可用更新:",
|
||||||
|
"Download via the Network options!": "請透過網路選項下載!",
|
||||||
|
"Menu": "選單",
|
||||||
|
"Menu Options": "選單選項",
|
||||||
|
"Auto": "自動",
|
||||||
|
"English": "English",
|
||||||
|
"Japanese": "日本語",
|
||||||
|
"French": "Français",
|
||||||
|
"German": "Deutsch",
|
||||||
|
"Italian": "Italiano",
|
||||||
|
"Spanish": "Español",
|
||||||
|
"Chinese (Simplified)": "简体中文",
|
||||||
|
"Korean": "한국어",
|
||||||
|
"Dutch": "Dutch",
|
||||||
|
"Portuguese": "Português",
|
||||||
|
"Russian": "Русский",
|
||||||
|
"Chinese (Traditional)": "繁體中文",
|
||||||
|
"Swedish": "Svenska",
|
||||||
|
"Vietnamese": "Vietnamese",
|
||||||
|
"Ukrainian": "Українська",
|
||||||
|
"Launch one of Sphaira's menus:\n": "啟動 Sphaira 的其中一個選單:\n",
|
||||||
|
"\nYou can change the left/right menu in the Advanced Options.": " \n您可以在進階選項中更改左側/右側選單。",
|
||||||
|
"Network": "網路",
|
||||||
|
"Network Options": "網路選項",
|
||||||
|
"Download update: ": "下載更新:",
|
||||||
|
"Failed to download update": "下載更新失敗",
|
||||||
|
"Updated to ": "已更新至 ",
|
||||||
|
"ftp_settings_info": [
|
||||||
|
"啟用 / 修改 FTP 伺服器設定,例如連接埠、使用者/密碼和顯示的資料夾。\n",
|
||||||
|
"注意:更改任何選項,會在離開選項選單時自動重新啟動 FTP 伺服器。"
|
||||||
|
],
|
||||||
|
"mtp_settings_info": [
|
||||||
|
"啟用 / 修改 MTP 回應端設定,例如顯示的資料夾。\n",
|
||||||
|
"注意:更改任何選項,會在離開選項選單時自動重新啟動 MTP 伺服器。"
|
||||||
|
],
|
||||||
|
"HDD": "HDD 硬碟",
|
||||||
|
"Enable / modify the HDD mount options.": "啟用 / 修改硬碟掛載選項。",
|
||||||
|
"NXlink": "NXlink",
|
||||||
|
"nxlink_enable_info": [
|
||||||
|
"啟用 NXlink 伺服器在背景執行。",
|
||||||
|
"NXlink 用於將 .nro 從電腦傳送到 Switch。\n",
|
||||||
|
"如果您不是開發者,可以停用此選項。"
|
||||||
|
],
|
||||||
|
"nxlink_toggle_info": [
|
||||||
|
"切換 FTP、MTP、硬碟 和 NXlink\n",
|
||||||
|
"如果 Sphaira 有可用更新,您可以從此選單下載。"
|
||||||
|
],
|
||||||
|
"Theme": "佈景主題",
|
||||||
|
"Language": "語言",
|
||||||
|
"translation_info": [
|
||||||
|
"更換語言。\n",
|
||||||
|
"如果找不到您的語言,或缺少翻譯,請考慮在 github.com/ITotalJustice/sphaira 提交 PR (Pull Request)。",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"advanced_options_info": [
|
||||||
|
"更改進階選項。",
|
||||||
|
"請查看資訊框以更了解每個選項。"
|
||||||
|
],
|
||||||
|
"System %.1f GB": "系統 %.1f GB",
|
||||||
|
"microSD %.1f GB": "microSD %.1f GB",
|
||||||
|
"[Applet Mode]": "[小程式模式]",
|
||||||
|
"Ethernet": "乙太網路",
|
||||||
|
"No Internet": "無網際網路連線",
|
||||||
|
"State: %s | Speed: %s": "狀態:%s | 速度:%s",
|
||||||
|
"Failed to mount save filesystem": "掛載存檔檔案系統失敗",
|
||||||
|
"Save Options": "存檔選項",
|
||||||
|
"System": "系統",
|
||||||
|
"Account": "帳號",
|
||||||
|
"BCAT": "BCAT",
|
||||||
|
"Device": "裝置",
|
||||||
|
"Temporary": "暫存",
|
||||||
|
"Cache": "快取",
|
||||||
|
"System BCAT": "系統 BCAT",
|
||||||
|
"Data Type": "資料類型",
|
||||||
|
"Backup": "備份",
|
||||||
|
"Backup the selected save(s) to a location of your choice.": "將選取的存檔備份至您選擇的位置。",
|
||||||
|
"Backup to...": "備份至...",
|
||||||
|
"Backup the selected save(s) to a location of your choice, and set the name of the backup.": "將選取的存檔備份至您選擇的位置,並設定備份名稱。",
|
||||||
|
"save_backuprestore_info": [
|
||||||
|
"還原目前 Title 的存檔。",
|
||||||
|
"如果啟用「自動備份」,存檔將先被備份然後才還原。",
|
||||||
|
"自動備份的存檔名稱中將包含「Auto」。"
|
||||||
|
],
|
||||||
|
"Auto backup on restore": "還原時自動備份",
|
||||||
|
"If enabled, when restoring a save, the current save will first be backed up.": "啟用時,還原存檔前會先備份目前的存檔。",
|
||||||
|
"Compress backup": "壓縮備份",
|
||||||
|
"save_backup_compress_info": [
|
||||||
|
"如果啟用,備份將被壓縮為 zip 檔案。\n",
|
||||||
|
"注意:停用此選項不會停用 zip 檔案格式,只會停用壓縮",
|
||||||
|
"儲存在 zip 中的檔案。",
|
||||||
|
"停用壓縮將使備份速度更快,但檔案較大。"
|
||||||
|
],
|
||||||
|
"Select backup location": "選擇備份位置",
|
||||||
|
"Backup failed!": "備份失敗!",
|
||||||
|
"Backup successfull!": "備份成功!",
|
||||||
|
"Select restore location": "選擇還原位置",
|
||||||
|
"Invalid location type!": "無效的位置類型!",
|
||||||
|
"No saves found in ": "找不到存檔於 ",
|
||||||
|
"Restore save for: ": "還原存檔給:",
|
||||||
|
"Are you sure you want to restore ": "您確定要還原 ",
|
||||||
|
"Auto backup": "自動備份",
|
||||||
|
"Restore failed!": "還原失敗!",
|
||||||
|
"Restore successfull!": "還原成功!",
|
||||||
|
"Set name for ": "設定名稱給 ",
|
||||||
|
"Set backup name": "設定備份名稱",
|
||||||
|
"Flushing zip to file": "正在將 zip 寫入檔案",
|
||||||
|
"Disable MTP for usb install": "為 USB 安裝停用 MTP",
|
||||||
|
"Re-enabled MTP": "已重新啟用 MTP",
|
||||||
|
"Installed via usb": "已透過 USB 安裝",
|
||||||
|
"USB install failed!": "USB 安裝失敗!",
|
||||||
|
"Usb install success!": "USB 安裝成功!",
|
||||||
|
"Waiting for connection...": "等待連線中...",
|
||||||
|
"Connected, waiting for file list...": "已連線,等待檔案列表中...",
|
||||||
|
"Connected, starting transfer...": "已連線,開始傳輸...",
|
||||||
|
"Transferring data...": "資料傳輸中...",
|
||||||
|
"Press B to exit...": "請按 離開...",
|
||||||
|
"Failed to init usb, press B to exit...": "USB 初始化失敗,請按 離開...",
|
||||||
|
"Detached": "已斷開",
|
||||||
|
"Attached": "已連接",
|
||||||
|
"Powered": "已供電",
|
||||||
|
"Default": "預設",
|
||||||
|
"Address": "位址",
|
||||||
|
"Configured": "已設定",
|
||||||
|
"Suspended": "已暫停",
|
||||||
|
"USB 1.0 Low Speed": "USB 1.0 低速",
|
||||||
|
"USB 1.1 Full Speed": "USB 1.1 全速",
|
||||||
|
"USB 2.0 High Speed": "USB 2.0 高速",
|
||||||
|
"USB 3.0 Super Speed": "USB 3.0 超高速",
|
||||||
|
"Mount Creator": "掛載建立器",
|
||||||
|
"Type": "類型",
|
||||||
|
"Select the type of the forwarder.": "選擇前導程式的類型。",
|
||||||
|
"URL": "網址",
|
||||||
|
"Set the URL of the application": "設定應用程式的網址",
|
||||||
|
"Optional: Set the port of the server. If left empty, the default port for the protocol will be used.": "選填:設定伺服器的連接埠。若留空,將使用通訊協定的預設連接埠。",
|
||||||
|
"Timeout": "逾時",
|
||||||
|
"Timeout in milliseconds": "逾時 (毫秒)",
|
||||||
|
"Optional: Set the timeout in seconds.": "選填:設定逾時秒數。",
|
||||||
|
"Optional: Set the username of the application": "選填:設定應用程式的使用者名稱",
|
||||||
|
"Optional: Set the password of the application": "選填:設定應用程式的密碼",
|
||||||
|
"Dump path": "提取路徑",
|
||||||
|
"Optional: Set the dump path used when exporting games and saves.": "選填:設定匯出遊戲和存檔時使用的提取路徑。",
|
||||||
|
"Read only": "唯讀",
|
||||||
|
"mount_readonly_info": [
|
||||||
|
"將檔案系統掛載為唯讀。\n",
|
||||||
|
"設定此選項也會隱藏該掛載點,使其不顯示為匯出選項。"
|
||||||
|
],
|
||||||
|
"No stat file": "不檢查檔案狀態",
|
||||||
|
"filecheck_disable_info": [
|
||||||
|
"啟用此選項可停止檔案瀏覽器檢查每個檔案的大小和時間戳記。",
|
||||||
|
"這能改善瀏覽效能。"
|
||||||
|
],
|
||||||
|
"No stat dir": "不檢查目錄狀態",
|
||||||
|
"dircheck_disable_info": [
|
||||||
|
"啟用此選項可停止檔案瀏覽器檢查資料夾中的檔案和資料夾數量。",
|
||||||
|
"這能改善瀏覽效能,特別是對於目錄列表速度較慢的伺服器。"
|
||||||
|
],
|
||||||
|
"FS hidden": "隱藏檔案系統",
|
||||||
|
"Hide the mount from being visible in the file browser.": "隱藏掛載點,使其不顯示於檔案瀏覽器中。",
|
||||||
|
"Export hidden": "隱藏匯出",
|
||||||
|
"Hide the mount from being visible as a export option for games and saves.": "隱藏掛載點,使其不顯示於遊戲和存檔的匯出選項中。",
|
||||||
|
"Save": "儲存",
|
||||||
|
"Mount entry saved. Restart Sphaira to apply changes.": "掛載項目已儲存。請重新啟動 Sphaira 以套用變更。",
|
||||||
|
"Saves the mount entry.\n\nNOTE: You must restart Sphaira for changes to take effect!": "儲存掛載項目。\n\n注意:您必須重新啟動 Sphaira 才能使變更生效!",
|
||||||
|
"Name and URL must be set!": "名稱和網址必須設定!",
|
||||||
|
"Devoptab Options": "Devoptab 選項",
|
||||||
|
"Create New Entry": "建立新項目",
|
||||||
|
"Creates a new mount option.\n\nNOTE: You must restart Sphaira for changes to take effect!": "建立新的掛載選項。\n\n注意:您必須重新啟動 Sphaira 才能使變更生效!",
|
||||||
|
"Modify Existing Entry": "修改現有項目",
|
||||||
|
"No mount entries found.": "找不到掛載項目。",
|
||||||
|
"Modify Entry": "修改項目",
|
||||||
|
"Modify an existing mount option.\n\nNOTE: You must restart Sphaira for changes to take effect!": "修改現有的掛載選項。\n\n注意:您必須重新啟動 Sphaira 才能使變更生效!",
|
||||||
|
"Delete Existing Entry": "刪除現有項目",
|
||||||
|
"Delete Entry": "刪除項目",
|
||||||
|
"Delete an existing mount option.\n\nNOTE: You must restart Sphaira for changes to take effect!": "刪除現有的掛載選項。\n\n注意:您必須重新啟動 Sphaira 才能使變更生效!",
|
||||||
|
"Section #": "區段 #"
|
||||||
|
}
|
||||||
@@ -1,392 +0,0 @@
|
|||||||
{
|
|
||||||
"[Applet Mode]": "[小程序模式]",
|
|
||||||
"No Internet": "网络未连接",
|
|
||||||
"Switch-Handheld!": "切换至掌机模式!",
|
|
||||||
"Switch-Docked!": "切换至底座模式!",
|
|
||||||
"Audio disabled due to suspended game": "由于游戏暂停,音频已禁用",
|
|
||||||
"Are you sure you wish to cancel?": "您确定要取消吗?",
|
|
||||||
"An error occurred": "",
|
|
||||||
"If this message appears repeatedly, please open an issue.": "若此消息反复出现,请提交问题报告。",
|
|
||||||
|
|
||||||
"Menu Options": "菜单选项",
|
|
||||||
"Menu": "菜单",
|
|
||||||
"Theme": "主题",
|
|
||||||
"Theme Options": "主题选项",
|
|
||||||
"Select Theme": "选择主题",
|
|
||||||
"Music": "音乐",
|
|
||||||
"12 Hour Time": "12小时制时间",
|
|
||||||
"Download Default Music": "下载默认音乐",
|
|
||||||
"Failed to download default_music.bfstm, please try again": "",
|
|
||||||
"Overwrite current default music?": "",
|
|
||||||
|
|
||||||
"Network": "网络",
|
|
||||||
"Network Options": "网络选项",
|
|
||||||
"Ftp": "FTP",
|
|
||||||
"Mtp": "MTP",
|
|
||||||
"Nxlink": "Nxlink插件提交",
|
|
||||||
"Nxlink Connected": "Nxlink 已连接",
|
|
||||||
"Nxlink Upload": "Nxlink 上传中",
|
|
||||||
"Nxlink Finished": "Nxlink 已结束",
|
|
||||||
|
|
||||||
"Language": "语言",
|
|
||||||
"Auto": "自动",
|
|
||||||
"English": "English",
|
|
||||||
"Japanese": "日本語",
|
|
||||||
"French": "Français",
|
|
||||||
"German": "Deutsch",
|
|
||||||
"Italian": "Italiano",
|
|
||||||
"Spanish": "Español",
|
|
||||||
"Chinese": "中文",
|
|
||||||
"Korean": "한국어",
|
|
||||||
"Dutch": "Dutch",
|
|
||||||
"Portuguese": "Português",
|
|
||||||
"Russian": "Русский",
|
|
||||||
"Swedish": "Svenska",
|
|
||||||
"Vietnamese": "Vietnamese",
|
|
||||||
"Ukrainian": "Українська",
|
|
||||||
|
|
||||||
"Misc": "拓展",
|
|
||||||
"Misc Options": "拓展设置",
|
|
||||||
"Games": "游戏",
|
|
||||||
"Game Options": "游戏选项",
|
|
||||||
"Hide forwarders": "隐藏前端启动",
|
|
||||||
"Launch random game": "开启随机游戏",
|
|
||||||
"List meta records": "列出元数据记录",
|
|
||||||
"Entries": "条目",
|
|
||||||
"Failed to list application meta entries": "",
|
|
||||||
"No meta entries found...\n": "",
|
|
||||||
"Updating application record list": "",
|
|
||||||
"Dump": "",
|
|
||||||
"Select content to dump": "",
|
|
||||||
"Dump All": "",
|
|
||||||
"Dump Application": "",
|
|
||||||
"Dump Patch": "",
|
|
||||||
"Dump AddOnContent": "",
|
|
||||||
"Dump DataPatch": "",
|
|
||||||
"Select dump location": "",
|
|
||||||
"microSD card (/dumps/NSP/)": "",
|
|
||||||
"USB transfer (Switch 2 Switch)": "",
|
|
||||||
"/dev/null (Speed Test)": "",
|
|
||||||
"Dumping": "",
|
|
||||||
"Dump successfull!": "",
|
|
||||||
"Dump failed!": "",
|
|
||||||
"Success": "",
|
|
||||||
"Delete successfull!": "",
|
|
||||||
"Delete failed!": "",
|
|
||||||
|
|
||||||
"Themezer": "在线主题",
|
|
||||||
"Themezer Options": "在线主题选项",
|
|
||||||
"Nsfw": "公共场合不宜的主题",
|
|
||||||
"Page": "页面",
|
|
||||||
"Page %zu / %zu": "页面 %zu / %zu",
|
|
||||||
"Enter Page Number": "输入跳转的页码",
|
|
||||||
"Bad Page": "错误的页面",
|
|
||||||
"Download theme?": "下载该主题?",
|
|
||||||
|
|
||||||
"GitHub": "GitHub",
|
|
||||||
"Downloading json": "正在下载 json",
|
|
||||||
"Select asset to download for ": "选择要下载的资源用于 ",
|
|
||||||
|
|
||||||
"FTP Install": "通过 FTP 安装",
|
|
||||||
"FTP Install (EXPERIMENTAL)": "通过 FTP 安装(实验性)",
|
|
||||||
"Connection Type: WiFi | Strength: ": "",
|
|
||||||
"Connection Type: Ethernet": "连接类型:以太网",
|
|
||||||
"Connection Type: None": "连接类型:无",
|
|
||||||
"Host:": "主机:",
|
|
||||||
"Port:": "端口:",
|
|
||||||
"Username:": "用户名:",
|
|
||||||
"Password:": "密码:",
|
|
||||||
"SSID:": "网络名称:",
|
|
||||||
"Passphrase:": "密码:",
|
|
||||||
"Failed to install via FTP, press B to exit...": "通过 FTP 安装失败,按 B 键退出...",
|
|
||||||
"Ftp install success!": "通过 FTP 安装成功。",
|
|
||||||
"Ftp install failed!": "通过 FTP 安装失败。",
|
|
||||||
"USB Install": "通过 USB 安装",
|
|
||||||
"USB": "USB",
|
|
||||||
"Connected, waiting for file list...": "",
|
|
||||||
"Connected, starting transfer...": "",
|
|
||||||
"Failed to init usb, press B to exit...": "USB 初始化失败,按 B 键退出...",
|
|
||||||
"Waiting for connection...": "等待连接中...",
|
|
||||||
"Transferring data...": "正在传输数据...",
|
|
||||||
"USB connected, sending file list": "",
|
|
||||||
"Sent file list, waiting for command...": "",
|
|
||||||
"waiting for usb connection...": "",
|
|
||||||
"Disable MTP for usb install": "暂时禁用 USB 安装的 MTP 功能",
|
|
||||||
"Re-enabled MTP": "重新启用 MTP",
|
|
||||||
"Installed via usb": "通过 USB 安装",
|
|
||||||
"Usb install success!": "通过 USB 安装成功。",
|
|
||||||
"Usb install failed!": "通过 USB 安装失败。",
|
|
||||||
"Press B to exit...": "按 B 键退出...",
|
|
||||||
"GameCard Install": "卡带安装",
|
|
||||||
"GameCard": "卡带",
|
|
||||||
"GC": "",
|
|
||||||
"System memory %.1f GB": "",
|
|
||||||
"microSD card %.1f GB": "",
|
|
||||||
"Nand Install": "",
|
|
||||||
"SD Card Install": "",
|
|
||||||
"Exit": "",
|
|
||||||
"Gc install success!": "游戏安装成功。",
|
|
||||||
"Gc install failed!": "游戏安装失败。",
|
|
||||||
|
|
||||||
"IRS (Infrared Joycon Camera)": "",
|
|
||||||
"IRS": "",
|
|
||||||
"Irs": "红外成像",
|
|
||||||
"Ambient Noise Level: ": "环境噪声等级:",
|
|
||||||
"Controller": "控制器",
|
|
||||||
"Pad ": "手柄 ",
|
|
||||||
"HandHeld": "掌机模式",
|
|
||||||
" (Available)": " (可用的)",
|
|
||||||
" (Unsupported)": " (不支持的)",
|
|
||||||
" (Unconnected)": " (未连接)",
|
|
||||||
"Rotation": "旋转",
|
|
||||||
"0 (Sideways)": "0度",
|
|
||||||
"90 (Flat)": "90度",
|
|
||||||
"180 (-Sideways)": "180度",
|
|
||||||
"270 (Upside down)": "270度",
|
|
||||||
"Colour": "颜色",
|
|
||||||
"Grey": "灰色",
|
|
||||||
"Ironbow": "紫黄",
|
|
||||||
"Green": "绿色",
|
|
||||||
"Red": "红色",
|
|
||||||
"Blue": "蓝色",
|
|
||||||
"Light Target": "光源目标",
|
|
||||||
"All leds": "全部",
|
|
||||||
"Bright group": "亮色组",
|
|
||||||
"Dim group": "暗色组",
|
|
||||||
"None": "无",
|
|
||||||
"Gain": "曝光",
|
|
||||||
"Negative Image": "负片图像",
|
|
||||||
"Normal image": "正常图像",
|
|
||||||
"Negative image": "负片图像",
|
|
||||||
"Format": "格式",
|
|
||||||
"Trimming Format": "裁剪格式",
|
|
||||||
"320x240": "320×240",
|
|
||||||
"160x120": "160×120",
|
|
||||||
"80x60": "80×60",
|
|
||||||
"40x30": "40×30",
|
|
||||||
"20x15": "20×15",
|
|
||||||
"External Light Filter": "外部光滤镜",
|
|
||||||
"Load Default": "加载默认值",
|
|
||||||
|
|
||||||
"Advanced": "高级",
|
|
||||||
"Advanced Options": "高级选项",
|
|
||||||
"Logging": "日志",
|
|
||||||
"Replace hbmenu on exit": "退出后用Sphaira替换hbmenu",
|
|
||||||
"Restore hbmenu?": "恢复 hbmenu?",
|
|
||||||
"Restore": "恢复",
|
|
||||||
"Failed to find /switch/hbmenu.nro\nUse the Appstore to re-install hbmenu": "未能找到 /switch/hbmenu.nro\n请使用应用商店重新安装 hbmenu",
|
|
||||||
"Failed to restore hbmenu, please re-download hbmenu": "恢复 hbmenu 失败,请重新下载 hbmenu",
|
|
||||||
"Failed to restore hbmenu, using sphaira instead": "恢复 hbmenu 失败,改用 Sphaira",
|
|
||||||
"Restored hbmenu, closing sphaira": "已恢复 hbmenu,正在关闭 Sphaira",
|
|
||||||
"Restored hbmenu": "已恢复 hbmenu",
|
|
||||||
"Restart Sphaira?": "重启 Sphaira?",
|
|
||||||
"Press OK to restart Sphaira": "按OK键以重启shphaira菜单",
|
|
||||||
"Text scroll speed": "文本滚动速度",
|
|
||||||
"Slow": "慢",
|
|
||||||
"Normal": "正常",
|
|
||||||
"Fast": "快",
|
|
||||||
"Set right-side menu": "",
|
|
||||||
"Install options": "安装选项",
|
|
||||||
"Install Options": "安装选项",
|
|
||||||
"Enable sysmmc": "",
|
|
||||||
"Enable emummc": "",
|
|
||||||
"Show install warning": "显示安装警告",
|
|
||||||
"Install location": "安装位置",
|
|
||||||
"System memory": "主机内存",
|
|
||||||
"microSD card": "SD卡",
|
|
||||||
"Boost CPU clock": "提升 CPU 频率",
|
|
||||||
"Allow downgrade": "允许降级",
|
|
||||||
"Skip if already installed": "若已安装则跳过",
|
|
||||||
"Ticket only": "仅安装票据",
|
|
||||||
"Skip base": "跳过基础部分",
|
|
||||||
"Skip patch": "跳过补丁",
|
|
||||||
"Skip dlc": "跳过 DLC(可下载内容)",
|
|
||||||
"Skip data patch": "跳过数据补丁",
|
|
||||||
"Skip ticket": "跳过票据",
|
|
||||||
"Skip NCA hash verify": "",
|
|
||||||
"Skip RSA header verify": "跳过 RSA 头部验证",
|
|
||||||
"Skip RSA NPDM verify": "跳过 RSA NPDM 验证",
|
|
||||||
"Ignore distribution bit": "忽略分布位",
|
|
||||||
"Convert to standard crypto": "转换为标准加密方式",
|
|
||||||
"Lower master key": "降低主密钥",
|
|
||||||
"Lower system version": "降低系统版本",
|
|
||||||
|
|
||||||
"Homebrew": "应用列表",
|
|
||||||
"Apps": "应用",
|
|
||||||
"Homebrew Options": "应用选项",
|
|
||||||
"Hide Sphaira": "在应用列表中隐藏Sphaira",
|
|
||||||
"Install Forwarder": "安装前端应用",
|
|
||||||
"WARNING: Installing forwarders will lead to a ban!": "警告:安装前端应用可能导致ban机!",
|
|
||||||
"Installing Forwarder": "正在生成前端应用",
|
|
||||||
"Creating Program": "正在创建程序",
|
|
||||||
"Creating Control": "正在创建控制器",
|
|
||||||
"Creating Meta": "正在创建元数据",
|
|
||||||
"Writing Nca": "正在写入Nca",
|
|
||||||
"Updating ncm databse": "正在更新ncm数据库",
|
|
||||||
"Pushing application record": "正在推送应用记录",
|
|
||||||
"Failed to install forwarder": "前端应用安装失败",
|
|
||||||
"Unstarred ": "取消星标 ",
|
|
||||||
"Starred ": "已星标 ",
|
|
||||||
"Failed to remove old forwarder, please manually remove it!": "",
|
|
||||||
|
|
||||||
"AppStore": "应用商店",
|
|
||||||
"Appstore": "",
|
|
||||||
"Store": "商店",
|
|
||||||
"Filter: %s | Sort: %s | Order: %s": "筛选: %s | 排序: %s | 顺序: %s",
|
|
||||||
"AppStore Options": "应用商店选项",
|
|
||||||
"Info": "信息",
|
|
||||||
"Changelog": "更新日志",
|
|
||||||
"Details": "详情",
|
|
||||||
"version: %s": "版本: %s",
|
|
||||||
"updated: %s": "更新时间: %s",
|
|
||||||
"category: %s": "分类: %s",
|
|
||||||
"extracted: %.2f MiB": "应用大小: %.2f MiB",
|
|
||||||
"app_dls: %s": "下载量: %s",
|
|
||||||
"More by Author": "作者更多作品",
|
|
||||||
"Leave Feedback": "留言反馈",
|
|
||||||
|
|
||||||
"FileBrowser": "文件浏览",
|
|
||||||
"Files": "文件",
|
|
||||||
"%zd files": "%zd 个文件",
|
|
||||||
"%zd dirs": "%zd 个文件夹",
|
|
||||||
"File Options": "文件选项",
|
|
||||||
"Show Hidden": "显示隐藏项目",
|
|
||||||
"Folders First": "文件夹靠前",
|
|
||||||
"Hidden Last": "隐藏项目置后",
|
|
||||||
"Cut": "剪切",
|
|
||||||
"Copy": "复制",
|
|
||||||
"Copying ": "正在复制 ",
|
|
||||||
"Paste": "粘贴",
|
|
||||||
"Paste ": "粘贴 ",
|
|
||||||
" file(s)?": "个文件(夹)?",
|
|
||||||
"Pasting ": "正在粘贴 ",
|
|
||||||
"Pasting": "正在粘贴",
|
|
||||||
"Rename": "重命名",
|
|
||||||
"Set New File Name": "输入新命名",
|
|
||||||
"Extract zip": "",
|
|
||||||
"Extract Options": "",
|
|
||||||
"Extract here": "",
|
|
||||||
"Extract to root": "",
|
|
||||||
"Are you sure you want to extract to root?": "",
|
|
||||||
"Extract to...": "",
|
|
||||||
"Enter the path to the folder to extract into": "",
|
|
||||||
"Extracting ": "",
|
|
||||||
"Extract success!": "",
|
|
||||||
"Extract failed!": "",
|
|
||||||
"Compress to zip": "压缩到zip",
|
|
||||||
"Compress Options": "",
|
|
||||||
"Compress": "",
|
|
||||||
"Compress to...": "",
|
|
||||||
"Compressing ": "",
|
|
||||||
"Compress success!": "",
|
|
||||||
"Compress failed!": "",
|
|
||||||
"Create File": "新建文件",
|
|
||||||
"Set File Name": "输入文件名",
|
|
||||||
"Create Folder": "新建文件夹",
|
|
||||||
"Set Folder Name": "输入文件夹名",
|
|
||||||
"Creating ": "正在创建 ",
|
|
||||||
"Upload": "",
|
|
||||||
"Select upload location": "",
|
|
||||||
"No upload locations set!": "",
|
|
||||||
"Uploading": "",
|
|
||||||
"Upload successfull!": "",
|
|
||||||
"Upload failed!": "",
|
|
||||||
"View as text (unfinished)": "以文本形式查看(未完善)",
|
|
||||||
"Ignore read only": "忽略只读",
|
|
||||||
"Mount": "挂载",
|
|
||||||
"Sd": "SD卡",
|
|
||||||
"Image System memory": "主机内存图像",
|
|
||||||
"Image microSD card": "SD卡图像",
|
|
||||||
"Empty...": "空...",
|
|
||||||
"Open with DayBreak?": "使用DayBreak打开?",
|
|
||||||
"Launch ": "启动 ",
|
|
||||||
"Launch option for: ": "启动选项:",
|
|
||||||
"Select launcher for: ": "选择启动器用于:",
|
|
||||||
|
|
||||||
"Sort By": "排序方式",
|
|
||||||
"Sort Options": "排序选项",
|
|
||||||
"Filter": "筛选",
|
|
||||||
"All": "全部",
|
|
||||||
"Emulators": "模拟器",
|
|
||||||
"Tools": "工具",
|
|
||||||
"Themes": "主题",
|
|
||||||
"Legacy": "可更新",
|
|
||||||
"Sort": "排序",
|
|
||||||
"Size": "按大小",
|
|
||||||
"Size (Star)": "按大小(星标优先)",
|
|
||||||
"Alphabetical": "按字母顺序",
|
|
||||||
"Alphabetical (Star)": "按字母顺序(星标优先)",
|
|
||||||
"Updated": "最近使用",
|
|
||||||
"Updated (Star)": "最近更新(星标优先)",
|
|
||||||
"Downloads": "下载",
|
|
||||||
"Likes": "点赞量",
|
|
||||||
"ID": "ID",
|
|
||||||
"Order": "顺序",
|
|
||||||
"Descending": "降序",
|
|
||||||
"Descending (down)": "降序",
|
|
||||||
"Desc": "降序",
|
|
||||||
"Ascending": "升序",
|
|
||||||
"Ascending (Up)": "升序",
|
|
||||||
"Asc": "升序",
|
|
||||||
"Layout": "",
|
|
||||||
"List": "",
|
|
||||||
"Icon": "",
|
|
||||||
"Grid": "",
|
|
||||||
"Search": "搜索",
|
|
||||||
|
|
||||||
"Options": "选项",
|
|
||||||
"OK": "确定",
|
|
||||||
"Back": "返回",
|
|
||||||
"Select": "选择",
|
|
||||||
"Open": "打开",
|
|
||||||
"Launch": "启动",
|
|
||||||
"Restart": "重启",
|
|
||||||
"Next": "下一项",
|
|
||||||
"Prev": "上一项",
|
|
||||||
"Unstar": "取消星标",
|
|
||||||
"Star": "星标",
|
|
||||||
"Yes": "是",
|
|
||||||
"No": "否",
|
|
||||||
"On": "",
|
|
||||||
"Off": "",
|
|
||||||
|
|
||||||
"Install": "安装",
|
|
||||||
"Install Selected files?": "安装所选文件?",
|
|
||||||
"Installing ": "正在安装 ",
|
|
||||||
"Installed ": "",
|
|
||||||
"Installed!": "安装完成!",
|
|
||||||
"Trying to load ": "尝试加载 ",
|
|
||||||
"Checking MD5": "正在校验 MD5",
|
|
||||||
|
|
||||||
"Delete": "删除",
|
|
||||||
"Delete Selected files?": "删除选中的文件?",
|
|
||||||
"Are you sure you want to delete ": "您确定要删除吗 ",
|
|
||||||
"Scanning ": "正在扫描 ",
|
|
||||||
"Deleting ": "正在删除 ",
|
|
||||||
"Deleting": "正在删除",
|
|
||||||
"Remove": "删除",
|
|
||||||
"Completely remove ": "彻底删除 ",
|
|
||||||
"Removing ": "正在移除 ",
|
|
||||||
"Removed ": "已移除 ",
|
|
||||||
"Uninstalling ": "正在卸载 ",
|
|
||||||
|
|
||||||
"Download": "下载",
|
|
||||||
"Downloading ": "正在下载 ",
|
|
||||||
"Downloaded ": "已下载 ",
|
|
||||||
|
|
||||||
"Update": "更新",
|
|
||||||
"Update avaliable: ": "有可用更新!",
|
|
||||||
"Download update: ": "下载更新:",
|
|
||||||
"Updated to ": "更新至 ",
|
|
||||||
"Failed to download update": "更新下载失败",
|
|
||||||
|
|
||||||
"%zu hours %zu minutes remaining": "",
|
|
||||||
"%zu minutes %zu seconds remaining": "",
|
|
||||||
"%zu seconds remaining": "",
|
|
||||||
|
|
||||||
"Loading...": "加载中...",
|
|
||||||
"Loading": "加载中",
|
|
||||||
"Empty!": "空空如野!",
|
|
||||||
"Not Ready...": "尚未准备好...",
|
|
||||||
"Error loading page!": "页面加载失败!"
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@ background = 0x2d2d2d
|
|||||||
grid = 0x46464630
|
grid = 0x46464630
|
||||||
popup = 0x2d2d2d
|
popup = 0x2d2d2d
|
||||||
error = 0xfa5a3a
|
error = 0xfa5a3a
|
||||||
|
focus = 0x000000b4
|
||||||
|
|
||||||
line = 0xfbfbfb
|
line = 0xfbfbfb
|
||||||
line_separator = 0x707070
|
line_separator = 0x707070
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ background = 0xebebeb
|
|||||||
grid = 0xf0f0f0
|
grid = 0xf0f0f0
|
||||||
popup = 0xebebeb
|
popup = 0xebebeb
|
||||||
error = 0xfa5a3a
|
error = 0xfa5a3a
|
||||||
|
focus = 0xd3d3d3a0
|
||||||
|
|
||||||
line = 0x373737
|
line = 0x373737
|
||||||
line_separator = 0x6d787a
|
line_separator = 0x6d787a
|
||||||
|
|||||||
30
assets/romfs/themes/default_theme.ini
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
[meta]
|
||||||
|
name=Default
|
||||||
|
author=ninstar
|
||||||
|
version=1.0.0
|
||||||
|
inherit=romfs:/themes/base_black_theme.ini
|
||||||
|
|
||||||
|
[theme]
|
||||||
|
background = 0x111f28
|
||||||
|
grid = 0x122430
|
||||||
|
popup = 0x143144
|
||||||
|
error = 0xfa3a5d
|
||||||
|
|
||||||
|
line = 0x335e77
|
||||||
|
line_separator = 0x163951
|
||||||
|
|
||||||
|
text = 0xfbfbfb
|
||||||
|
text_info = 0xbed0d6
|
||||||
|
text_selected = 0x32ffcf
|
||||||
|
selected_background = 0x143144
|
||||||
|
|
||||||
|
sidebar = 0x071013ef
|
||||||
|
|
||||||
|
scrollbar = 0x32ffcf
|
||||||
|
scrollbar_background = ; hide the background
|
||||||
|
|
||||||
|
progressbar = 0x32ffcf
|
||||||
|
progressbar_background = 0x0B1519
|
||||||
|
|
||||||
|
highlight_1 = 0x69ff8f
|
||||||
|
highlight_2 = 0x5cbeff
|
||||||
|
Before Width: | Height: | Size: 257 KiB |
|
Before Width: | Height: | Size: 169 KiB |
|
Before Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 278 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 116 KiB |
BIN
assets/screenshots/appstore.jpg
Normal file
|
After Width: | Height: | Size: 161 KiB |
BIN
assets/screenshots/appstore_page.jpg
Normal file
|
After Width: | Height: | Size: 235 KiB |
BIN
assets/screenshots/file_browser.jpg
Normal file
|
After Width: | Height: | Size: 131 KiB |
BIN
assets/screenshots/games.jpg
Normal file
|
After Width: | Height: | Size: 202 KiB |
BIN
assets/screenshots/homebrew.jpg
Normal file
|
After Width: | Height: | Size: 166 KiB |
BIN
assets/screenshots/launch_options.jpg
Normal file
|
After Width: | Height: | Size: 122 KiB |
BIN
assets/screenshots/themezer.jpg
Normal file
|
After Width: | Height: | Size: 246 KiB |
BIN
assets/screenshots/web.jpg
Normal file
|
After Width: | Height: | Size: 100 KiB |
@@ -8,13 +8,13 @@ build_preset() {
|
|||||||
cmake --build --preset $1
|
cmake --build --preset $1
|
||||||
}
|
}
|
||||||
|
|
||||||
build_preset MinSizeRel
|
build_preset Release
|
||||||
|
|
||||||
rm -rf out
|
rm -rf out
|
||||||
|
|
||||||
# --- SWITCH --- #
|
# --- SWITCH --- #
|
||||||
mkdir -p out/switch/sphaira/
|
mkdir -p out/switch/sphaira/
|
||||||
cp -r build/MinSizeRel/*.nro out/switch/sphaira/sphaira.nro
|
cp -r build/Release/*.nro out/switch/sphaira/sphaira.nro
|
||||||
pushd out
|
pushd out
|
||||||
zip -r9 sphaira.zip switch
|
zip -r9 sphaira.zip switch
|
||||||
popd
|
popd
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#define EXIT_DETECTION_STR "if this isn't replaced i will exit :)"
|
#define EXIT_DETECTION_STR "if this isn't replaced i will exit :)"
|
||||||
|
|
||||||
// this uses 3-4KiB more than nx-hbloader.
|
// this uses 16KiB less than nx-hbloader.
|
||||||
static char g_argv[2048] = {0};
|
static char g_argv[2048] = {0};
|
||||||
// this can and will be modified by libnx if launched nro calls envSetNextLoad().
|
// this can and will be modified by libnx if launched nro calls envSetNextLoad().
|
||||||
static char g_nextArgv[2048] = {0};
|
static char g_nextArgv[2048] = {0};
|
||||||
@@ -47,7 +46,7 @@ static void fix_nro_path(char* path) {
|
|||||||
|
|
||||||
// Credit to behemoth
|
// Credit to behemoth
|
||||||
// SOURCE: https://github.com/HookedBehemoth/nx-hbloader/commit/7f8000a41bc5e8a6ad96a097ef56634cfd2fabcb
|
// SOURCE: https://github.com/HookedBehemoth/nx-hbloader/commit/7f8000a41bc5e8a6ad96a097ef56634cfd2fabcb
|
||||||
static NX_NORETURN void selfExit(void) {
|
static void NX_NORETURN selfExit(void) {
|
||||||
Result rc = smInitialize();
|
Result rc = smInitialize();
|
||||||
if (R_FAILED(rc))
|
if (R_FAILED(rc))
|
||||||
goto fail0;
|
goto fail0;
|
||||||
@@ -162,7 +161,8 @@ static void getOwnProcessHandle(void) {
|
|||||||
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 12));
|
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 12));
|
||||||
|
|
||||||
Thread t;
|
Thread t;
|
||||||
rc = threadCreate(&t, &procHandleReceiveThread, (void*)(uintptr_t)server_handle, NULL, 0x1000, 0x20, 0);
|
u8* stack = g_heapAddr;
|
||||||
|
rc = threadCreate(&t, &procHandleReceiveThread, (void*)(uintptr_t)server_handle, stack, 0x1000, 0x20, 0);
|
||||||
if (R_FAILED(rc))
|
if (R_FAILED(rc))
|
||||||
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 10));
|
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 10));
|
||||||
|
|
||||||
@@ -290,10 +290,10 @@ void NX_NORETURN loadNro(void) {
|
|||||||
diagAbortWithResult(rc);
|
diagAbortWithResult(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8* romfs_dirs = malloc(romfs_header.dirTableSize); // should be 1 entry ("/")
|
u8 romfs_dirs[1024 * 2]; // should be 1 entry ("/")
|
||||||
u8* romfs_files = malloc(romfs_header.fileTableSize); // should be 2 entries (argv and nro)
|
u8 romfs_files[1024 * 4]; // should be 2 entries (argv and nro)
|
||||||
|
|
||||||
if (!romfs_dirs || !romfs_files) {
|
if (romfs_header.dirTableSize > sizeof(romfs_dirs) || romfs_header.fileTableSize > sizeof(romfs_files)) {
|
||||||
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, LibnxError_OutOfMemory));
|
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, LibnxError_OutOfMemory));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,8 +317,6 @@ void NX_NORETURN loadNro(void) {
|
|||||||
diagAbortWithResult(rc);
|
diagAbortWithResult(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(romfs_dirs);
|
|
||||||
free(romfs_files);
|
|
||||||
fsStorageClose(&s);
|
fsStorageClose(&s);
|
||||||
|
|
||||||
strcpy(g_defaultNroPath, g_nextNroPath);
|
strcpy(g_defaultNroPath, g_nextNroPath);
|
||||||
@@ -337,40 +335,24 @@ void NX_NORETURN loadNro(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *nrobuf = (uint8_t*) g_heapAddr;
|
uint8_t *nrobuf = (uint8_t*) g_heapAddr;
|
||||||
|
|
||||||
NroStart* start = (NroStart*) (nrobuf + 0);
|
NroStart* start = (NroStart*) (nrobuf + 0);
|
||||||
header = (NroHeader*) (nrobuf + sizeof(NroStart));
|
header = (NroHeader*) (nrobuf + sizeof(NroStart));
|
||||||
uint8_t* rest = (uint8_t*) (nrobuf + sizeof(NroStart) + sizeof(NroHeader));
|
|
||||||
|
|
||||||
FsFileSystem fs;
|
FsFileSystem fs;
|
||||||
FsFile f;
|
|
||||||
u64 bytes_read = 0;
|
|
||||||
s64 offset = 0;
|
|
||||||
|
|
||||||
if (R_FAILED(rc = fsOpenSdCardFileSystem(&fs))) {
|
if (R_FAILED(rc = fsOpenSdCardFileSystem(&fs))) {
|
||||||
diagAbortWithResult(rc);
|
diagAbortWithResult(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't fatal if we don't find the nro, exit to menu
|
// don't fatal if we don't find the nro, exit to menu
|
||||||
|
FsFile f;
|
||||||
if (R_FAILED(rc = fsFsOpenFile(&fs, fixedNextNroPath, FsOpenMode_Read, &f))) {
|
if (R_FAILED(rc = fsFsOpenFile(&fs, fixedNextNroPath, FsOpenMode_Read, &f))) {
|
||||||
diagAbortWithResult(rc);
|
diagAbortWithResult(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (R_FAILED(rc = fsFileRead(&f, offset, start, sizeof(*start), FsReadOption_None, &bytes_read)) ||
|
u64 bytes_read;
|
||||||
bytes_read != sizeof(*start)) {
|
if (R_FAILED(rc = fsFileRead(&f, 0, start, g_heapSize, FsReadOption_None, &bytes_read)) ||
|
||||||
diagAbortWithResult(rc);
|
header->magic != NROHEADER_MAGIC ||
|
||||||
}
|
bytes_read < sizeof(*start) + sizeof(*header) + header->size) {
|
||||||
offset += sizeof(*start);
|
|
||||||
|
|
||||||
if (R_FAILED(rc = fsFileRead(&f, offset, header, sizeof(*header), FsReadOption_None, &bytes_read)) ||
|
|
||||||
bytes_read != sizeof(*header) || header->magic != NROHEADER_MAGIC) {
|
|
||||||
diagAbortWithResult(rc);
|
|
||||||
}
|
|
||||||
offset += sizeof(*header);
|
|
||||||
|
|
||||||
const size_t rest_size = header->size - (sizeof(NroStart) + sizeof(NroHeader));
|
|
||||||
if (R_FAILED(rc = fsFileRead(&f, offset, rest, rest_size, FsReadOption_None, &bytes_read)) ||
|
|
||||||
bytes_read != rest_size) {
|
|
||||||
diagAbortWithResult(rc);
|
diagAbortWithResult(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,13 +495,11 @@ bool __nx_fsdev_support_cwd = false;
|
|||||||
// u32 __nx_applet_exit_mode = 0;
|
// u32 __nx_applet_exit_mode = 0;
|
||||||
|
|
||||||
void __libnx_initheap(void) {
|
void __libnx_initheap(void) {
|
||||||
static char g_innerheap[0x4000];
|
|
||||||
|
|
||||||
extern char* fake_heap_start;
|
extern char* fake_heap_start;
|
||||||
extern char* fake_heap_end;
|
extern char* fake_heap_end;
|
||||||
|
|
||||||
fake_heap_start = &g_innerheap[0];
|
fake_heap_start = NULL;
|
||||||
fake_heap_end = &g_innerheap[sizeof(g_innerheap)];
|
fake_heap_end = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __appInit(void) {
|
void __appInit(void) {
|
||||||
@@ -557,7 +537,20 @@ void __appExit(void) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void __wrap_exit(void) {
|
|
||||||
// exit() effectively never gets called, so let's stub it out.
|
// exit() effectively never gets called, so let's stub it out.
|
||||||
|
void __wrap_exit(void) {
|
||||||
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 39));
|
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 39));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stub alloc calls as they're not used (saves 4KiB).
|
||||||
|
void* __libnx_alloc(size_t size) {
|
||||||
|
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 40));
|
||||||
|
}
|
||||||
|
|
||||||
|
void* __libnx_aligned_alloc(size_t alignment, size_t size) {
|
||||||
|
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 41));
|
||||||
|
}
|
||||||
|
|
||||||
|
void __libnx_free(void* p) {
|
||||||
|
diagAbortWithResult(MAKERESULT(Module_HomebrewLoader, 43));
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,34 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
|
||||||
set(sphaira_VERSION 0.11.3)
|
# generic options.
|
||||||
|
option(ENABLE_NVJPG "" OFF)
|
||||||
|
option(ENABLE_NSZ "enables exporting to nsz" ON)
|
||||||
|
|
||||||
|
# lib options.
|
||||||
|
option(ENABLE_LIBUSBHSFS "enables FAT/exFAT hdd mounting" ON)
|
||||||
|
option(ENABLE_LIBUSBDVD "enables cd/dvd/iso/cue mounting" ON)
|
||||||
|
option(ENABLE_FTPSRV "enables MTP server support" ON)
|
||||||
|
option(ENABLE_LIBHAZE "enables MTP server support" ON)
|
||||||
|
|
||||||
|
# audio options.
|
||||||
|
option(ENABLE_AUDIO_MP3 "" ON)
|
||||||
|
option(ENABLE_AUDIO_OGG "" ON)
|
||||||
|
option(ENABLE_AUDIO_WAV "" ON)
|
||||||
|
option(ENABLE_AUDIO_FLAC "" ON)
|
||||||
|
|
||||||
|
# devoptab options.
|
||||||
|
option(ENABLE_DEVOPTAB_HTTP "" ON)
|
||||||
|
option(ENABLE_DEVOPTAB_NFS "" ON)
|
||||||
|
option(ENABLE_DEVOPTAB_SMB2 "" ON)
|
||||||
|
option(ENABLE_DEVOPTAB_FTP "" ON)
|
||||||
|
option(ENABLE_DEVOPTAB_WEBDAV "" ON)
|
||||||
|
# disable by default because we are CPU bound for upload/download.
|
||||||
|
# max speed is 8MiB/s, which is fine for wifi, but awful for ethernet.
|
||||||
|
# other clients get 36-40MiB/s.
|
||||||
|
# it also adds 230k to binary size, and i don't think anyone will use it.
|
||||||
|
option(ENABLE_DEVOPTAB_SFTP "" OFF)
|
||||||
|
|
||||||
|
set(sphaira_VERSION 1.0.0)
|
||||||
|
|
||||||
project(sphaira
|
project(sphaira
|
||||||
VERSION ${sphaira_VERSION}
|
VERSION ${sphaira_VERSION}
|
||||||
@@ -30,23 +58,32 @@ execute_process(
|
|||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
set(sphaira_VERSION_HASH "${sphaira_VERSION} [${GIT_COMMIT}]")
|
if (DEFINED sphaira_VERSION_OVERRIDE)
|
||||||
|
set(sphaira_DISPLAY_VERSION "${sphaira_VERSION_OVERRIDE} [${GIT_COMMIT}]")
|
||||||
|
else()
|
||||||
|
set(sphaira_DISPLAY_VERSION "${sphaira_VERSION} [${GIT_COMMIT}]")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_executable(sphaira
|
add_executable(sphaira
|
||||||
source/ui/menus/appstore.cpp
|
source/ui/menus/appstore.cpp
|
||||||
source/ui/menus/file_viewer.cpp
|
source/ui/menus/file_viewer.cpp
|
||||||
|
source/ui/menus/image_viewer.cpp
|
||||||
source/ui/menus/filebrowser.cpp
|
source/ui/menus/filebrowser.cpp
|
||||||
|
source/ui/menus/file_picker.cpp
|
||||||
source/ui/menus/homebrew.cpp
|
source/ui/menus/homebrew.cpp
|
||||||
source/ui/menus/irs_menu.cpp
|
source/ui/menus/irs_menu.cpp
|
||||||
source/ui/menus/main_menu.cpp
|
source/ui/menus/main_menu.cpp
|
||||||
source/ui/menus/menu_base.cpp
|
source/ui/menus/menu_base.cpp
|
||||||
|
source/ui/menus/save_menu.cpp
|
||||||
source/ui/menus/themezer.cpp
|
source/ui/menus/themezer.cpp
|
||||||
source/ui/menus/ghdl.cpp
|
source/ui/menus/ghdl.cpp
|
||||||
source/ui/menus/usb_menu.cpp
|
source/ui/menus/usb_menu.cpp
|
||||||
source/ui/menus/ftp_menu.cpp
|
|
||||||
source/ui/menus/gc_menu.cpp
|
source/ui/menus/gc_menu.cpp
|
||||||
source/ui/menus/game_menu.cpp
|
source/ui/menus/game_menu.cpp
|
||||||
|
source/ui/menus/game_meta_menu.cpp
|
||||||
|
source/ui/menus/game_nca_menu.cpp
|
||||||
source/ui/menus/grid_menu_base.cpp
|
source/ui/menus/grid_menu_base.cpp
|
||||||
|
source/ui/menus/install_stream_menu_base.cpp
|
||||||
|
|
||||||
source/ui/error_box.cpp
|
source/ui/error_box.cpp
|
||||||
source/ui/notification.cpp
|
source/ui/notification.cpp
|
||||||
@@ -59,6 +96,7 @@ add_executable(sphaira
|
|||||||
source/ui/widget.cpp
|
source/ui/widget.cpp
|
||||||
source/ui/list.cpp
|
source/ui/list.cpp
|
||||||
source/ui/scrolling_text.cpp
|
source/ui/scrolling_text.cpp
|
||||||
|
source/ui/music_player.cpp
|
||||||
|
|
||||||
source/app.cpp
|
source/app.cpp
|
||||||
source/download.cpp
|
source/download.cpp
|
||||||
@@ -77,34 +115,58 @@ add_executable(sphaira
|
|||||||
source/web.cpp
|
source/web.cpp
|
||||||
source/hasher.cpp
|
source/hasher.cpp
|
||||||
source/i18n.cpp
|
source/i18n.cpp
|
||||||
source/ftpsrv_helper.cpp
|
|
||||||
source/threaded_file_transfer.cpp
|
source/threaded_file_transfer.cpp
|
||||||
|
source/title_info.cpp
|
||||||
|
source/minizip_helper.cpp
|
||||||
|
|
||||||
|
source/utils/utils.cpp
|
||||||
|
source/utils/audio.cpp
|
||||||
|
source/utils/devoptab_common.cpp
|
||||||
|
source/utils/devoptab_romfs.cpp
|
||||||
|
source/utils/devoptab_save.cpp
|
||||||
|
source/utils/devoptab_nro.cpp
|
||||||
|
source/utils/devoptab_nca.cpp
|
||||||
|
source/utils/devoptab_nsp.cpp
|
||||||
|
source/utils/devoptab_xci.cpp
|
||||||
|
source/utils/devoptab_zip.cpp
|
||||||
|
source/utils/devoptab_bfsar.cpp
|
||||||
|
source/utils/devoptab_vfs.cpp
|
||||||
|
source/utils/devoptab_fatfs.cpp
|
||||||
|
source/utils/devoptab_game.cpp
|
||||||
|
source/utils/devoptab_mounts.cpp
|
||||||
|
source/utils/devoptab.cpp
|
||||||
|
|
||||||
source/usb/base.cpp
|
source/usb/base.cpp
|
||||||
source/usb/usbds.cpp
|
source/usb/usbds.cpp
|
||||||
source/usb/usbhs.cpp
|
source/usb/usbhs.cpp
|
||||||
source/usb/usb_uploader.cpp
|
source/usb/usb_uploader.cpp
|
||||||
|
source/usb/usb_installer.cpp
|
||||||
|
source/usb/usb_dumper.cpp
|
||||||
|
|
||||||
source/yati/yati.cpp
|
source/yati/yati.cpp
|
||||||
source/yati/container/nsp.cpp
|
source/yati/container/nsp.cpp
|
||||||
source/yati/container/xci.cpp
|
source/yati/container/xci.cpp
|
||||||
source/yati/source/file.cpp
|
source/yati/source/file.cpp
|
||||||
source/yati/source/usb.cpp
|
|
||||||
source/yati/source/stream.cpp
|
source/yati/source/stream.cpp
|
||||||
source/yati/source/stream_file.cpp
|
source/yati/source/stream_file.cpp
|
||||||
|
|
||||||
source/yati/nx/es.cpp
|
source/yati/nx/es.cpp
|
||||||
source/yati/nx/keys.cpp
|
source/yati/nx/keys.cpp
|
||||||
source/yati/nx/nca.cpp
|
source/yati/nx/nca.cpp
|
||||||
|
source/yati/nx/ncz.cpp
|
||||||
source/yati/nx/ncm.cpp
|
source/yati/nx/ncm.cpp
|
||||||
source/yati/nx/ns.cpp
|
source/yati/nx/ns.cpp
|
||||||
|
|
||||||
source/yati/nx/nxdumptool_rsa.c
|
source/yati/nx/nxdumptool_rsa.c
|
||||||
|
source/yati/nx/nxdumptool/save.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(sphaira PRIVATE
|
target_compile_definitions(sphaira PRIVATE
|
||||||
-DAPP_VERSION="${sphaira_VERSION}"
|
-DAPP_VERSION="${sphaira_VERSION}"
|
||||||
-DAPP_VERSION_HASH="${sphaira_VERSION_HASH}"
|
-DAPP_DISPLAY_VERSION="${sphaira_DISPLAY_VERSION}"
|
||||||
-DCURL_NO_OLDIES=1
|
-DCURL_NO_OLDIES=1
|
||||||
|
-DDEV_BUILD=$<BOOL:${DEV_BUILD}>
|
||||||
|
-DZSTD_STATIC_LINKING_ONLY=1
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(sphaira PRIVATE
|
target_compile_options(sphaira PRIVATE
|
||||||
@@ -126,6 +188,8 @@ target_compile_options(sphaira PRIVATE
|
|||||||
# disabled as it warns for strcat 2 paths together, but it will never
|
# disabled as it warns for strcat 2 paths together, but it will never
|
||||||
# overflow due to fs enforcing a max path len anyway.
|
# overflow due to fs enforcing a max path len anyway.
|
||||||
-Wno-format-truncation
|
-Wno-format-truncation
|
||||||
|
# many false positives when LTO is not enabled.
|
||||||
|
-Wno-suggest-final-types
|
||||||
|
|
||||||
# the below are taken from my gba emulator, they've served me well ;)
|
# the below are taken from my gba emulator, they've served me well ;)
|
||||||
-Wformat-overflow=2
|
-Wformat-overflow=2
|
||||||
@@ -142,28 +206,15 @@ target_compile_options(sphaira PRIVATE
|
|||||||
-Wcast-qual
|
-Wcast-qual
|
||||||
-Wcast-align
|
-Wcast-align
|
||||||
-Wimplicit-fallthrough=5
|
-Wimplicit-fallthrough=5
|
||||||
-Wsuggest-final-types
|
|
||||||
-Wuninitialized
|
-Wuninitialized
|
||||||
)
|
)
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
set(FETCHCONTENT_QUIET FALSE)
|
set(FETCHCONTENT_QUIET FALSE)
|
||||||
|
|
||||||
FetchContent_Declare(ftpsrv
|
|
||||||
GIT_REPOSITORY https://github.com/ITotalJustice/ftpsrv.git
|
|
||||||
# GIT_TAG 1.2.2
|
|
||||||
GIT_TAG 8c18431
|
|
||||||
SOURCE_SUBDIR NONE
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_Declare(libhaze
|
|
||||||
GIT_REPOSITORY https://github.com/ITotalJustice/libhaze.git
|
|
||||||
GIT_TAG 8e16df2
|
|
||||||
)
|
|
||||||
|
|
||||||
FetchContent_Declare(libpulsar
|
FetchContent_Declare(libpulsar
|
||||||
GIT_REPOSITORY https://github.com/ITotalJustice/switch-libpulsar.git
|
GIT_REPOSITORY https://github.com/ITotalJustice/switch-libpulsar.git
|
||||||
GIT_TAG de656e4
|
GIT_TAG ac7bc97
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_Declare(nanovg
|
FetchContent_Declare(nanovg
|
||||||
@@ -178,12 +229,12 @@ FetchContent_Declare(stb
|
|||||||
|
|
||||||
FetchContent_Declare(yyjson
|
FetchContent_Declare(yyjson
|
||||||
GIT_REPOSITORY https://github.com/ibireme/yyjson.git
|
GIT_REPOSITORY https://github.com/ibireme/yyjson.git
|
||||||
GIT_TAG 0.10.0
|
GIT_TAG 0.12.0
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_Declare(minIni
|
FetchContent_Declare(minIni
|
||||||
GIT_REPOSITORY https://github.com/ITotalJustice/minIni-nx.git
|
GIT_REPOSITORY https://github.com/ITotalJustice/minIni-nx.git
|
||||||
GIT_TAG 11cac8b
|
GIT_TAG 6e952b6
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_Declare(zstd
|
FetchContent_Declare(zstd
|
||||||
@@ -192,83 +243,128 @@ FetchContent_Declare(zstd
|
|||||||
SOURCE_SUBDIR build/cmake
|
SOURCE_SUBDIR build/cmake
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_Declare(libusbhsfs
|
FetchContent_Declare(libnxtc
|
||||||
GIT_REPOSITORY https://github.com/ITotalJustice/libusbhsfs.git
|
GIT_REPOSITORY https://github.com/ITotalJustice/libnxtc.git
|
||||||
GIT_TAG db2bf2a
|
GIT_TAG 88ce3d8
|
||||||
)
|
)
|
||||||
|
|
||||||
set(USE_NEW_ZSTD ON)
|
FetchContent_Declare(nvjpg
|
||||||
|
GIT_REPOSITORY https://github.com/ITotalJustice/oss-nvjpg.git
|
||||||
|
GIT_TAG 45680e7
|
||||||
|
)
|
||||||
|
|
||||||
set(ZSTD_BUILD_STATIC ON)
|
FetchContent_Declare(dr_libs
|
||||||
set(ZSTD_BUILD_SHARED OFF)
|
GIT_REPOSITORY https://github.com/mackron/dr_libs.git
|
||||||
set(ZSTD_BUILD_COMPRESSION OFF)
|
GIT_TAG b962384
|
||||||
set(ZSTD_BUILD_DECOMPRESSION ON)
|
SOURCE_SUBDIR NONE
|
||||||
set(ZSTD_BUILD_DICTBUILDER OFF)
|
)
|
||||||
set(ZSTD_LEGACY_SUPPORT OFF)
|
|
||||||
set(ZSTD_MULTITHREAD_SUPPORT OFF)
|
|
||||||
set(ZSTD_BUILD_PROGRAMS OFF)
|
|
||||||
set(ZSTD_BUILD_TESTS OFF)
|
|
||||||
|
|
||||||
set(MININI_LIB_NAME minIni)
|
if (ENABLE_NVJPG)
|
||||||
set(MININI_USE_STDIO ON)
|
FetchContent_Declare(nvjpg
|
||||||
set(MININI_USE_NX OFF)
|
GIT_REPOSITORY https://github.com/ITotalJustice/oss-nvjpg.git
|
||||||
set(MININI_USE_FLOAT OFF)
|
GIT_TAG 45680e7
|
||||||
|
)
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
FetchContent_MakeAvailable(nvjpg)
|
||||||
set(NANOVG_DEBUG ON)
|
|
||||||
|
add_library(nvjpg
|
||||||
|
${nvjpg_SOURCE_DIR}/lib/decoder.cpp
|
||||||
|
${nvjpg_SOURCE_DIR}/lib/image.cpp
|
||||||
|
${nvjpg_SOURCE_DIR}/lib/surface.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(nvjpg PUBLIC ${nvjpg_SOURCE_DIR}/include)
|
||||||
|
set_target_properties(nvjpg PROPERTIES CXX_STANDARD 26)
|
||||||
|
|
||||||
|
target_link_libraries(nvjpg PRIVATE nvjpg)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_NVJPG)
|
||||||
endif()
|
endif()
|
||||||
set(NANOVG_NO_JPEG OFF)
|
|
||||||
set(NANOVG_NO_PNG OFF)
|
|
||||||
set(NANOVG_NO_BMP ON)
|
|
||||||
set(NANOVG_NO_PSD ON)
|
|
||||||
set(NANOVG_NO_TGA ON)
|
|
||||||
set(NANOVG_NO_GIF ON)
|
|
||||||
set(NANOVG_NO_HDR ON)
|
|
||||||
set(NANOVG_NO_PIC ON)
|
|
||||||
set(NANOVG_NO_PNM ON)
|
|
||||||
|
|
||||||
set(YYJSON_DISABLE_READER OFF)
|
if (ENABLE_NSZ)
|
||||||
set(YYJSON_DISABLE_WRITER OFF)
|
target_sources(sphaira PRIVATE source/utils/nsz_dumper.cpp)
|
||||||
set(YYJSON_DISABLE_UTILS ON)
|
target_compile_definitions(sphaira PRIVATE ENABLE_NSZ)
|
||||||
set(YYJSON_DISABLE_FAST_FP_CONV ON)
|
endif()
|
||||||
set(YYJSON_DISABLE_NON_STANDARD ON)
|
|
||||||
set(YYJSON_DISABLE_UTF8_VALIDATION ON)
|
|
||||||
set(YYJSON_DISABLE_UNALIGNED_MEMORY_ACCESS OFF)
|
|
||||||
|
|
||||||
|
if (ENABLE_LIBUSBHSFS)
|
||||||
# enable this if you want ntfs and ext4 support, at the cost of a huge final binary size.
|
# enable this if you want ntfs and ext4 support, at the cost of a huge final binary size.
|
||||||
set(USBHSFS_GPL OFF)
|
set(USBHSFS_GPL OFF)
|
||||||
set(USBHSFS_SXOS_DISABLE ON)
|
set(USBHSFS_SXOS_DISABLE ON)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(
|
FetchContent_Declare(libusbhsfs
|
||||||
ftpsrv
|
GIT_REPOSITORY https://github.com/ITotalJustice/libusbhsfs.git
|
||||||
libhaze
|
GIT_TAG 625269b
|
||||||
libpulsar
|
|
||||||
nanovg
|
|
||||||
stb
|
|
||||||
minIni
|
|
||||||
yyjson
|
|
||||||
zstd
|
|
||||||
libusbhsfs
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(libusbhsfs)
|
||||||
|
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_LIBUSBHSFS)
|
||||||
|
target_link_libraries(sphaira PRIVATE libusbhsfs)
|
||||||
|
else()
|
||||||
|
target_sources(sphaira PRIVATE source/ff16/ffunicode.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_LIBUSBDVD)
|
||||||
|
FetchContent_Declare(libusbdvd
|
||||||
|
GIT_REPOSITORY https://github.com/proconsule/libusbdvd.git
|
||||||
|
GIT_TAG 3cb0613
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(libusbdvd)
|
||||||
|
|
||||||
|
add_library(libusbdvd
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/usbdvd.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/usbdvd_scsi.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/usbdvd_utils.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/fs/usbdvd_datadisc.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/fs/audiocdfs/audiocdfs.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/fs/audiocdfs/cdaudio_devoptab.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/fs/iso9660/usbdvd_iso9660.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/fs/iso9660/iso9660_devoptab.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/fs/udf/usbdvd_udf.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/fs/udf/udf_devoptab.cpp
|
||||||
|
${libusbdvd_SOURCE_DIR}/source/os/switch/switch_usb.cpp
|
||||||
|
|
||||||
|
)
|
||||||
|
target_include_directories(libusbdvd PRIVATE ${libusbdvd_SOURCE_DIR}/source/)
|
||||||
|
target_include_directories(libusbdvd PRIVATE ${libusbdvd_SOURCE_DIR}/source/os/switch)
|
||||||
|
target_include_directories(libusbdvd PRIVATE ${libusbdvd_SOURCE_DIR}/source/fs)
|
||||||
|
target_include_directories(libusbdvd PRIVATE ${libusbdvd_SOURCE_DIR}/source/fs/audiocdfs)
|
||||||
|
target_include_directories(libusbdvd PRIVATE ${libusbdvd_SOURCE_DIR}/source/fs/iso9660)
|
||||||
|
target_include_directories(libusbdvd PRIVATE ${libusbdvd_SOURCE_DIR}/source/fs/udf)
|
||||||
|
target_include_directories(libusbdvd PUBLIC ${libusbdvd_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_LIBUSBDVD)
|
||||||
|
target_link_libraries(sphaira PRIVATE libusbdvd)
|
||||||
|
target_sources(sphaira PRIVATE source/usbdvd.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_FTPSRV)
|
||||||
|
FetchContent_Declare(ftpsrv
|
||||||
|
GIT_REPOSITORY https://github.com/ITotalJustice/ftpsrv.git
|
||||||
|
GIT_TAG 7c82402
|
||||||
|
SOURCE_SUBDIR NONE
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(ftpsrv)
|
||||||
|
|
||||||
set(FTPSRV_LIB_BUILD TRUE)
|
set(FTPSRV_LIB_BUILD TRUE)
|
||||||
set(FTPSRV_LIB_SOCK_UNISTD TRUE)
|
|
||||||
set(FTPSRV_LIB_VFS_CUSTOM ${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs_nx.h)
|
set(FTPSRV_LIB_VFS_CUSTOM ${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs_nx.h)
|
||||||
set(FTPSRV_LIB_PATH_SIZE 0x301)
|
set(FTPSRV_LIB_PATH_SIZE 0x301)
|
||||||
set(FTPSRV_LIB_SESSIONS 16)
|
set(FTPSRV_LIB_SESSIONS 16)
|
||||||
set(FTPSRV_LIB_BUF_SIZE 1024*64)
|
set(FTPSRV_LIB_BUF_SIZE 1024*64)
|
||||||
|
|
||||||
set(FTPSRV_LIB_CUSTOM_DEFINES
|
set(FTPSRV_LIB_CUSTOM_DEFINES
|
||||||
USE_VFS_SAVE=$<BOOL:TRUE>
|
USE_VFS_SAVE=$<BOOL:FALSE>
|
||||||
USE_VFS_STORAGE=$<BOOL:TRUE>
|
USE_VFS_STORAGE=$<BOOL:TRUE>
|
||||||
# disabled as it may conflict with the gamecard menu.
|
# disabled as it may conflict with the gamecard menu.
|
||||||
USE_VFS_GC=$<BOOL:FALSE>
|
USE_VFS_GC=$<BOOL:FALSE>
|
||||||
USE_VFS_USBHSFS=$<BOOL:TRUE>
|
USE_VFS_USBHSFS=$<BOOL:FALSE>
|
||||||
VFS_NX_BUFFER_IO=$<BOOL:TRUE>
|
VFS_NX_BUFFER_IO=$<BOOL:TRUE>
|
||||||
# let sphaira handle init / closing of the hdd.
|
# let sphaira handle init / closing of the hdd.
|
||||||
USE_VFS_USBHSFS_INIT=$<BOOL:FALSE>
|
USE_VFS_USBHSFS_INIT=$<BOOL:FALSE>
|
||||||
# disable romfs mounting as otherwise we cannot write / modify sphaira.nro
|
# disable romfs mounting as otherwise we cannot write / modify sphaira.nro
|
||||||
USE_VFS_ROMFS=$<BOOL:FALSE>
|
USE_VFS_ROMFS=$<BOOL:FALSE>
|
||||||
|
FTP_SOCKET_HEADER="${ftpsrv_SOURCE_DIR}/src/platform/nx/socket_nx.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(${ftpsrv_SOURCE_DIR} binary_dir)
|
add_subdirectory(${ftpsrv_SOURCE_DIR} binary_dir)
|
||||||
@@ -278,19 +374,211 @@ add_library(ftpsrv_helper
|
|||||||
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_none.c
|
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_none.c
|
||||||
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_root.c
|
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_root.c
|
||||||
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_fs.c
|
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_fs.c
|
||||||
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_save.c
|
|
||||||
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_storage.c
|
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_storage.c
|
||||||
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_stdio.c
|
|
||||||
${ftpsrv_SOURCE_DIR}/src/platform/nx/vfs/vfs_nx_hdd.c
|
|
||||||
${ftpsrv_SOURCE_DIR}/src/platform/nx/utils.c
|
${ftpsrv_SOURCE_DIR}/src/platform/nx/utils.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(ftpsrv_helper PUBLIC ftpsrv libusbhsfs)
|
target_link_libraries(ftpsrv_helper PUBLIC ftpsrv)
|
||||||
target_include_directories(ftpsrv_helper PUBLIC ${ftpsrv_SOURCE_DIR}/src/platform)
|
target_include_directories(ftpsrv_helper PUBLIC ${ftpsrv_SOURCE_DIR}/src/platform)
|
||||||
|
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_FTPSRV)
|
||||||
|
target_link_libraries(sphaira PRIVATE ftpsrv_helper)
|
||||||
|
|
||||||
|
target_sources(sphaira PRIVATE
|
||||||
|
source/ftpsrv_helper.cpp
|
||||||
|
source/ui/menus/ftp_menu.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_LIBHAZE)
|
||||||
|
FetchContent_Declare(libhaze
|
||||||
|
GIT_REPOSITORY https://github.com/ITotalJustice/libhaze.git
|
||||||
|
GIT_TAG 81154c1
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(libhaze)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_LIBHAZE)
|
||||||
|
target_link_libraries(sphaira PRIVATE libhaze)
|
||||||
|
|
||||||
|
target_sources(sphaira PRIVATE
|
||||||
|
source/haze_helper.cpp
|
||||||
|
source/ui/menus/mtp_menu.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_DEVOPTAB_HTTP)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_DEVOPTAB_HTTP)
|
||||||
|
target_sources(sphaira PRIVATE source/utils/devoptab_http.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_DEVOPTAB_NFS)
|
||||||
|
FetchContent_Declare(libnfs
|
||||||
|
GIT_REPOSITORY https://github.com/ITotalJustice/libnfs.git
|
||||||
|
GIT_TAG 65f3e11
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(libnfs)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_DEVOPTAB_NFS)
|
||||||
|
target_link_libraries(sphaira PRIVATE nfs)
|
||||||
|
target_sources(sphaira PRIVATE source/utils/devoptab_nfs.cpp)
|
||||||
|
|
||||||
|
# todo: fix this upstream as nfs should export these folders.
|
||||||
|
target_include_directories(sphaira PRIVATE
|
||||||
|
${libnfs_SOURCE_DIR}/include
|
||||||
|
${libnfs_SOURCE_DIR}/include/nfsc
|
||||||
|
${libnfs_SOURCE_DIR}/nfs
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_DEVOPTAB_SMB2)
|
||||||
|
FetchContent_Declare(libsmb2
|
||||||
|
GIT_REPOSITORY https://github.com/ITotalJustice/libsmb2.git
|
||||||
|
GIT_TAG 867beea
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(libsmb2)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_DEVOPTAB_SMB2)
|
||||||
|
target_link_libraries(sphaira PRIVATE smb2)
|
||||||
|
target_sources(sphaira PRIVATE source/utils/devoptab_smb2.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_DEVOPTAB_FTP)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_DEVOPTAB_FTP)
|
||||||
|
target_sources(sphaira PRIVATE source/utils/devoptab_ftp.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_DEVOPTAB_SFTP)
|
||||||
|
# set to build from source, otherwise it will link against the older dkp libssh2.
|
||||||
|
if (1)
|
||||||
|
set(CRYPTO_BACKEND mbedTLS)
|
||||||
|
set(ENABLE_ZLIB_COMPRESSION ON)
|
||||||
|
set(ENABLE_DEBUG_LOGGING OFF)
|
||||||
|
set(BUILD_EXAMPLES OFF)
|
||||||
|
set(BUILD_TESTING OFF)
|
||||||
|
set(LINT OFF)
|
||||||
|
|
||||||
|
FetchContent_Declare(libssh2
|
||||||
|
GIT_REPOSITORY https://github.com/libssh2/libssh2.git
|
||||||
|
# GIT_TAG a0dafb3 # latest commit, works fine, but i'll stick to main release.
|
||||||
|
GIT_TAG libssh2-1.11.1
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(libssh2)
|
||||||
|
target_link_libraries(sphaira PRIVATE libssh2::libssh2)
|
||||||
|
else()
|
||||||
|
include(FindPkgConfig)
|
||||||
|
pkg_check_modules(LIBSSH2 libssh2 REQUIRED)
|
||||||
|
target_include_directories(sphaira PRIVATE ${LIBSSH2_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(sphaira PRIVATE ${LIBSSH2_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_DEVOPTAB_SFTP)
|
||||||
|
target_sources(sphaira PRIVATE source/utils/devoptab_sftp.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_DEVOPTAB_WEBDAV)
|
||||||
|
set(PUGIXML_NO_EXCEPTIONS ON)
|
||||||
|
set(PUGIXML_WCHAR_MODE OFF)
|
||||||
|
|
||||||
|
FetchContent_Declare(pugixml
|
||||||
|
GIT_REPOSITORY https://github.com/zeux/pugixml.git
|
||||||
|
GIT_TAG v1.15
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(pugixml)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_DEVOPTAB_WEBDAV)
|
||||||
|
target_link_libraries(sphaira PRIVATE pugixml)
|
||||||
|
target_sources(sphaira PRIVATE source/utils/devoptab_webdav.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_AUDIO_MP3)
|
||||||
|
FetchContent_Declare(id3v2lib
|
||||||
|
GIT_REPOSITORY https://github.com/larsbs/id3v2lib.git
|
||||||
|
GIT_TAG 141ffb8
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(id3v2lib)
|
||||||
|
target_link_libraries(sphaira PRIVATE id3v2lib)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_AUDIO_MP3)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_AUDIO_OGG)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_AUDIO_OGG)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_AUDIO_WAV)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_AUDIO_WAV)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_AUDIO_FLAC)
|
||||||
|
target_compile_definitions(sphaira PRIVATE ENABLE_AUDIO_FLAC)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ztsd
|
||||||
|
set(ZSTD_BUILD_STATIC ON)
|
||||||
|
set(ZSTD_BUILD_SHARED OFF)
|
||||||
|
set(ZSTD_BUILD_COMPRESSION ${ENABLE_NSZ})
|
||||||
|
set(ZSTD_MULTITHREAD_SUPPORT ${ENABLE_NSZ})
|
||||||
|
set(ZSTD_BUILD_DECOMPRESSION ON)
|
||||||
|
set(ZSTD_BUILD_DICTBUILDER OFF)
|
||||||
|
set(ZSTD_LEGACY_SUPPORT OFF)
|
||||||
|
set(ZSTD_BUILD_PROGRAMS OFF)
|
||||||
|
set(ZSTD_BUILD_TESTS OFF)
|
||||||
|
|
||||||
|
# minini
|
||||||
|
set(MININI_LIB_NAME minIni)
|
||||||
|
set(MININI_USE_STDIO ON)
|
||||||
|
set(MININI_USE_NX OFF)
|
||||||
|
set(MININI_USE_FLOAT ON)
|
||||||
|
|
||||||
|
# nanovg
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||||
|
set(NANOVG_DEBUG ON)
|
||||||
|
endif()
|
||||||
|
set(NANOVG_NO_JPEG OFF)
|
||||||
|
set(NANOVG_NO_PNG OFF)
|
||||||
|
set(NANOVG_NO_BMP OFF)
|
||||||
|
set(NANOVG_NO_PSD ON)
|
||||||
|
set(NANOVG_NO_TGA ON)
|
||||||
|
set(NANOVG_NO_GIF ON)
|
||||||
|
set(NANOVG_NO_HDR ON)
|
||||||
|
set(NANOVG_NO_PIC ON)
|
||||||
|
set(NANOVG_NO_PNM ON)
|
||||||
|
|
||||||
|
# yyjson
|
||||||
|
set(YYJSON_INSTALL OFF)
|
||||||
|
set(YYJSON_DISABLE_READER OFF)
|
||||||
|
set(YYJSON_DISABLE_WRITER OFF)
|
||||||
|
set(YYJSON_DISABLE_UTILS ON)
|
||||||
|
set(YYJSON_DISABLE_FAST_FP_CONV ON)
|
||||||
|
set(YYJSON_DISABLE_NON_STANDARD ON)
|
||||||
|
set(YYJSON_DISABLE_UTF8_VALIDATION ON)
|
||||||
|
set(YYJSON_DISABLE_UNALIGNED_MEMORY_ACCESS OFF)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(
|
||||||
|
libpulsar
|
||||||
|
nanovg
|
||||||
|
stb
|
||||||
|
minIni
|
||||||
|
yyjson
|
||||||
|
zstd
|
||||||
|
libnxtc
|
||||||
|
dr_libs
|
||||||
|
)
|
||||||
|
|
||||||
add_library(stb INTERFACE)
|
add_library(stb INTERFACE)
|
||||||
target_include_directories(stb INTERFACE ${stb_SOURCE_DIR})
|
target_include_directories(stb INTERFACE ${stb_SOURCE_DIR})
|
||||||
|
|
||||||
|
add_library(dr_libs INTERFACE)
|
||||||
|
target_include_directories(dr_libs INTERFACE ${dr_libs_SOURCE_DIR})
|
||||||
|
|
||||||
|
add_library(libnxtc
|
||||||
|
${libnxtc_SOURCE_DIR}/source/nxtc.c
|
||||||
|
${libnxtc_SOURCE_DIR}/source/nxtc_log.c
|
||||||
|
${libnxtc_SOURCE_DIR}/source/nxtc_utils.c
|
||||||
|
)
|
||||||
|
target_include_directories(libnxtc PUBLIC ${libnxtc_SOURCE_DIR}/include)
|
||||||
|
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
find_library(minizip_lib minizip REQUIRED)
|
find_library(minizip_lib minizip REQUIRED)
|
||||||
find_path(minizip_inc minizip REQUIRED)
|
find_path(minizip_inc minizip REQUIRED)
|
||||||
@@ -299,10 +587,12 @@ find_package(CURL REQUIRED)
|
|||||||
find_path(mbedtls_inc mbedtls REQUIRED)
|
find_path(mbedtls_inc mbedtls REQUIRED)
|
||||||
find_library(mbedcrypto_lib mbedcrypto REQUIRED)
|
find_library(mbedcrypto_lib mbedcrypto REQUIRED)
|
||||||
|
|
||||||
if (NOT USE_NEW_ZSTD)
|
add_library(fatfs
|
||||||
find_path(zstd_inc zstd.h REQUIRED)
|
source/ff16/diskio.c
|
||||||
find_library(zstd_lib zstd REQUIRED)
|
source/ff16/ff.c
|
||||||
endif()
|
)
|
||||||
|
|
||||||
|
target_include_directories(fatfs PUBLIC source/ff16)
|
||||||
|
|
||||||
set_target_properties(sphaira PROPERTIES
|
set_target_properties(sphaira PROPERTIES
|
||||||
C_STANDARD 23
|
C_STANDARD 23
|
||||||
@@ -312,14 +602,15 @@ set_target_properties(sphaira PROPERTIES
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(sphaira PRIVATE
|
target_link_libraries(sphaira PRIVATE
|
||||||
ftpsrv_helper
|
|
||||||
libhaze
|
|
||||||
libpulsar
|
libpulsar
|
||||||
minIni
|
minIni
|
||||||
nanovg
|
nanovg
|
||||||
stb
|
stb
|
||||||
yyjson
|
yyjson
|
||||||
# libusbhsfs
|
libnxtc
|
||||||
|
fatfs
|
||||||
|
dr_libs
|
||||||
|
libzstd_static
|
||||||
|
|
||||||
${minizip_lib}
|
${minizip_lib}
|
||||||
ZLIB::ZLIB
|
ZLIB::ZLIB
|
||||||
@@ -327,19 +618,11 @@ target_link_libraries(sphaira PRIVATE
|
|||||||
${mbedcrypto_lib}
|
${mbedcrypto_lib}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (USE_NEW_ZSTD)
|
|
||||||
message(STATUS "USING UPSTREAM ZSTD")
|
|
||||||
target_link_libraries(sphaira PRIVATE libzstd_static)
|
|
||||||
else()
|
|
||||||
message(STATUS "USING LOCAL ZSTD")
|
|
||||||
target_link_libraries(sphaira PRIVATE ${zstd_lib})
|
|
||||||
target_include_directories(sphaira PRIVATE ${zstd_inc})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(sphaira PRIVATE
|
target_include_directories(sphaira PRIVATE
|
||||||
include
|
include
|
||||||
${minizip_inc}
|
${minizip_inc}
|
||||||
${mbedtls_inc}
|
${mbedtls_inc}
|
||||||
|
include/yati/nx/nxdumptool
|
||||||
)
|
)
|
||||||
|
|
||||||
# copy the romfs
|
# copy the romfs
|
||||||
|
|||||||
@@ -2,32 +2,27 @@
|
|||||||
|
|
||||||
#include "nanovg.h"
|
#include "nanovg.h"
|
||||||
#include "nanovg/dk_renderer.hpp"
|
#include "nanovg/dk_renderer.hpp"
|
||||||
#include "pulsar.h"
|
|
||||||
#include "ui/widget.hpp"
|
#include "ui/widget.hpp"
|
||||||
#include "ui/notification.hpp"
|
#include "ui/notification.hpp"
|
||||||
#include "owo.hpp"
|
#include "owo.hpp"
|
||||||
#include "option.hpp"
|
#include "option.hpp"
|
||||||
#include "fs.hpp"
|
#include "fs.hpp"
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
|
#include "utils/audio.hpp"
|
||||||
|
|
||||||
|
#ifdef USE_NVJPG
|
||||||
|
#include <nvjpg.hpp>
|
||||||
|
#endif
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <span>
|
#include <span>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace sphaira {
|
namespace sphaira {
|
||||||
|
|
||||||
enum SoundEffect {
|
using SoundEffect = audio::SoundEffect;
|
||||||
SoundEffect_Music,
|
|
||||||
SoundEffect_Focus,
|
|
||||||
SoundEffect_Scroll,
|
|
||||||
SoundEffect_Limit,
|
|
||||||
SoundEffect_Startup,
|
|
||||||
SoundEffect_Install,
|
|
||||||
SoundEffect_Error,
|
|
||||||
SoundEffect_MAX,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class LaunchType {
|
enum class LaunchType {
|
||||||
Normal,
|
Normal,
|
||||||
@@ -55,12 +50,19 @@ public:
|
|||||||
static void Exit();
|
static void Exit();
|
||||||
static void ExitRestart();
|
static void ExitRestart();
|
||||||
static auto GetVg() -> NVGcontext*;
|
static auto GetVg() -> NVGcontext*;
|
||||||
static void Push(std::shared_ptr<ui::Widget>);
|
|
||||||
|
static void Push(std::unique_ptr<ui::Widget>&&);
|
||||||
|
|
||||||
|
template<ui::DerivedFromWidget T, typename... Args>
|
||||||
|
static void Push(Args&&... args) {
|
||||||
|
Push(std::make_unique<T>(std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
// pops all widgets above a menu
|
// pops all widgets above a menu
|
||||||
static void PopToMenu();
|
static void PopToMenu();
|
||||||
|
|
||||||
// this is thread safe
|
// this is thread safe
|
||||||
static void Notify(std::string text, ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
static void Notify(const std::string& text, ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
||||||
static void Notify(ui::NotifEntry entry);
|
static void Notify(ui::NotifEntry entry);
|
||||||
static void NotifyPop(ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
static void NotifyPop(ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
||||||
static void NotifyClear(ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
static void NotifyClear(ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
||||||
@@ -92,12 +94,14 @@ public:
|
|||||||
static auto GetInstallSysmmcEnable() -> bool;
|
static auto GetInstallSysmmcEnable() -> bool;
|
||||||
static auto GetInstallEmummcEnable() -> bool;
|
static auto GetInstallEmummcEnable() -> bool;
|
||||||
static auto GetInstallSdEnable() -> bool;
|
static auto GetInstallSdEnable() -> bool;
|
||||||
static auto GetInstallPrompt() -> bool;
|
|
||||||
static auto GetThemeMusicEnable() -> bool;
|
static auto GetThemeMusicEnable() -> bool;
|
||||||
static auto Get12HourTimeEnable() -> bool;
|
|
||||||
static auto GetLanguage() -> long;
|
static auto GetLanguage() -> long;
|
||||||
static auto GetTextScrollSpeed() -> long;
|
static auto GetTextScrollSpeed() -> long;
|
||||||
|
|
||||||
|
static auto GetNszCompressLevel() -> u8;
|
||||||
|
static auto GetNszThreadCount() -> u8;
|
||||||
|
static auto GetNszBlockExponent() -> u8;
|
||||||
|
|
||||||
static void SetMtpEnable(bool enable);
|
static void SetMtpEnable(bool enable);
|
||||||
static void SetFtpEnable(bool enable);
|
static void SetFtpEnable(bool enable);
|
||||||
static void SetNxlinkEnable(bool enable);
|
static void SetNxlinkEnable(bool enable);
|
||||||
@@ -122,10 +126,18 @@ public:
|
|||||||
static void DisplayThemeOptions(bool left_side = true);
|
static void DisplayThemeOptions(bool left_side = true);
|
||||||
// todo:
|
// todo:
|
||||||
static void DisplayNetworkOptions(bool left_side = true);
|
static void DisplayNetworkOptions(bool left_side = true);
|
||||||
static void DisplayMiscOptions(bool left_side = true);
|
static void DisplayMenuOptions(bool left_side = true);
|
||||||
static void DisplayAdvancedOptions(bool left_side = true);
|
static void DisplayAdvancedOptions(bool left_side = true);
|
||||||
static void DisplayInstallOptions(bool left_side = true);
|
static void DisplayInstallOptions(bool left_side = true);
|
||||||
static void DisplayDumpOptions(bool left_side = true);
|
static void DisplayDumpOptions(bool left_side = true);
|
||||||
|
static void DisplayFtpOptions(bool left_side = true);
|
||||||
|
static void DisplayMtpOptions(bool left_side = true);
|
||||||
|
static void DisplayHddOptions(bool left_side = true);
|
||||||
|
|
||||||
|
// helper for sidebar options to toggle install on/off
|
||||||
|
static void ShowEnableInstallPromptOption(option::OptionBool& option, bool& enable);
|
||||||
|
// displays an option box to enable installing, shows warning.
|
||||||
|
static void ShowEnableInstallPrompt();
|
||||||
|
|
||||||
void Draw();
|
void Draw();
|
||||||
void Update();
|
void Update();
|
||||||
@@ -138,8 +150,15 @@ public:
|
|||||||
|
|
||||||
void LoadTheme(const ThemeMeta& meta);
|
void LoadTheme(const ThemeMeta& meta);
|
||||||
void CloseTheme();
|
void CloseTheme();
|
||||||
|
void CloseThemeBackgroundMusic();
|
||||||
void ScanThemes(const std::string& path);
|
void ScanThemes(const std::string& path);
|
||||||
void ScanThemeEntries();
|
void ScanThemeEntries();
|
||||||
|
void LoadAndPlayThemeMusic();
|
||||||
|
static Result SetDefaultBackgroundMusic(fs::Fs* fs, const fs::FsPath& path);
|
||||||
|
static void SetBackgroundMusicPause(bool pause);
|
||||||
|
|
||||||
|
static Result GetSdSize(s64* free, s64* total);
|
||||||
|
static Result GetEmmcSize(s64* free, s64* total);
|
||||||
|
|
||||||
// helper that converts 1.2.3 to a u32 used for comparisons.
|
// helper that converts 1.2.3 to a u32 used for comparisons.
|
||||||
static auto GetVersionFromString(const char* str) -> u32;
|
static auto GetVersionFromString(const char* str) -> u32;
|
||||||
@@ -189,11 +208,59 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void SetBoostMode(bool enable, bool force = false) {
|
||||||
|
static Mutex mutex{};
|
||||||
|
static int ref_count{};
|
||||||
|
|
||||||
|
mutexLock(&mutex);
|
||||||
|
ON_SCOPE_EXIT(mutexUnlock(&mutex));
|
||||||
|
|
||||||
|
if (enable) {
|
||||||
|
ref_count++;
|
||||||
|
appletSetCpuBoostMode(ApmCpuBoostMode_FastLoad);
|
||||||
|
} else {
|
||||||
|
if (ref_count) {
|
||||||
|
ref_count--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ref_count || force) {
|
||||||
|
ref_count = 0;
|
||||||
|
appletSetCpuBoostMode(ApmCpuBoostMode_Normal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static auto GetAccountList() -> std::vector<AccountProfileBase> {
|
||||||
|
std::vector<AccountProfileBase> out;
|
||||||
|
|
||||||
|
AccountUid uids[ACC_USER_LIST_SIZE];
|
||||||
|
s32 account_count;
|
||||||
|
if (R_SUCCEEDED(accountListAllUsers(uids, std::size(uids), &account_count))) {
|
||||||
|
for (s32 i = 0; i < account_count; i++) {
|
||||||
|
AccountProfile profile;
|
||||||
|
if (R_SUCCEEDED(accountGetProfile(&profile, uids[i]))) {
|
||||||
|
ON_SCOPE_EXIT(accountProfileClose(&profile));
|
||||||
|
|
||||||
|
AccountProfileBase base;
|
||||||
|
if (R_SUCCEEDED(accountProfileGet(&profile, nullptr, &base))) {
|
||||||
|
// sometimes the uid for the acc can differ to the base.
|
||||||
|
base.uid = uids[i];
|
||||||
|
log_write("[ACC] found uid: 0x%016lX%016lX\n", uids[i].uid[0], uids[i].uid[1]);
|
||||||
|
log_write("[ACC] base uid: 0x%016lX%016lX\n", base.uid.uid[0], base.uid.uid[1]);
|
||||||
|
out.emplace_back(base);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
static constexpr inline auto CONFIG_PATH = "/config/sphaira/config.ini";
|
static constexpr inline auto CONFIG_PATH = "/config/sphaira/config.ini";
|
||||||
static constexpr inline auto PLAYLOG_PATH = "/config/sphaira/playlog.ini";
|
static constexpr inline auto PLAYLOG_PATH = "/config/sphaira/playlog.ini";
|
||||||
static constexpr inline auto INI_SECTION = "config";
|
static constexpr inline auto INI_SECTION = "config";
|
||||||
static constexpr inline auto DEFAULT_THEME_PATH = "romfs:/themes/abyss_theme.ini";
|
static constexpr inline auto DEFAULT_THEME_PATH = "romfs:/themes/default_theme.ini";
|
||||||
|
|
||||||
fs::FsPath m_app_path;
|
fs::FsPath m_app_path;
|
||||||
u64 m_start_timestamp{};
|
u64 m_start_timestamp{};
|
||||||
@@ -205,11 +272,12 @@ public:
|
|||||||
PadState m_pad{};
|
PadState m_pad{};
|
||||||
TouchInfo m_touch_info{};
|
TouchInfo m_touch_info{};
|
||||||
Controller m_controller{};
|
Controller m_controller{};
|
||||||
|
KeyboardState m_keyboard{};
|
||||||
std::vector<ThemeMeta> m_theme_meta_entries;
|
std::vector<ThemeMeta> m_theme_meta_entries;
|
||||||
|
|
||||||
Vec2 m_scale{1, 1};
|
Vec2 m_scale{1, 1};
|
||||||
|
|
||||||
std::vector<std::shared_ptr<ui::Widget>> m_widgets;
|
std::vector<std::unique_ptr<ui::Widget>> m_widgets;
|
||||||
u32 m_pop_count{};
|
u32 m_pop_count{};
|
||||||
ui::NotifMananger m_notif_manager{};
|
ui::NotifMananger m_notif_manager{};
|
||||||
|
|
||||||
@@ -231,10 +299,12 @@ public:
|
|||||||
|
|
||||||
option::OptionBool m_log_enabled{INI_SECTION, "log_enabled", false};
|
option::OptionBool m_log_enabled{INI_SECTION, "log_enabled", false};
|
||||||
option::OptionBool m_replace_hbmenu{INI_SECTION, "replace_hbmenu", false};
|
option::OptionBool m_replace_hbmenu{INI_SECTION, "replace_hbmenu", false};
|
||||||
|
option::OptionString m_default_music{INI_SECTION, "default_music", "/config/sphaira/themes/default_music.bfstm"};
|
||||||
option::OptionString m_theme_path{INI_SECTION, "theme", DEFAULT_THEME_PATH};
|
option::OptionString m_theme_path{INI_SECTION, "theme", DEFAULT_THEME_PATH};
|
||||||
option::OptionBool m_theme_music{INI_SECTION, "theme_music", true};
|
option::OptionBool m_theme_music{INI_SECTION, "theme_music", true};
|
||||||
option::OptionBool m_12hour_time{INI_SECTION, "12hour_time", false};
|
option::OptionBool m_show_ip_addr{INI_SECTION, "show_ip_addr", true};
|
||||||
option::OptionLong m_language{INI_SECTION, "language", 0}; // auto
|
option::OptionLong m_language{INI_SECTION, "language", 0}; // auto
|
||||||
|
option::OptionString m_center_menu{INI_SECTION, "center_side_menu", "Homebrew"};
|
||||||
option::OptionString m_left_menu{INI_SECTION, "left_side_menu", "FileBrowser"};
|
option::OptionString m_left_menu{INI_SECTION, "left_side_menu", "FileBrowser"};
|
||||||
option::OptionString m_right_menu{INI_SECTION, "right_side_menu", "Appstore"};
|
option::OptionString m_right_menu{INI_SECTION, "right_side_menu", "Appstore"};
|
||||||
option::OptionBool m_progress_boost_mode{INI_SECTION, "progress_boost_mode", true};
|
option::OptionBool m_progress_boost_mode{INI_SECTION, "progress_boost_mode", true};
|
||||||
@@ -243,7 +313,6 @@ public:
|
|||||||
option::OptionBool m_install_sysmmc{INI_SECTION, "install_sysmmc", false};
|
option::OptionBool m_install_sysmmc{INI_SECTION, "install_sysmmc", false};
|
||||||
option::OptionBool m_install_emummc{INI_SECTION, "install_emummc", false};
|
option::OptionBool m_install_emummc{INI_SECTION, "install_emummc", false};
|
||||||
option::OptionBool m_install_sd{INI_SECTION, "install_sd", true};
|
option::OptionBool m_install_sd{INI_SECTION, "install_sd", true};
|
||||||
option::OptionLong m_install_prompt{INI_SECTION, "install_prompt", true};
|
|
||||||
option::OptionBool m_allow_downgrade{INI_SECTION, "allow_downgrade", false};
|
option::OptionBool m_allow_downgrade{INI_SECTION, "allow_downgrade", false};
|
||||||
option::OptionBool m_skip_if_already_installed{INI_SECTION, "skip_if_already_installed", true};
|
option::OptionBool m_skip_if_already_installed{INI_SECTION, "skip_if_already_installed", true};
|
||||||
option::OptionBool m_ticket_only{INI_SECTION, "ticket_only", false};
|
option::OptionBool m_ticket_only{INI_SECTION, "ticket_only", false};
|
||||||
@@ -252,25 +321,75 @@ public:
|
|||||||
option::OptionBool m_skip_addon{INI_SECTION, "skip_addon", false};
|
option::OptionBool m_skip_addon{INI_SECTION, "skip_addon", false};
|
||||||
option::OptionBool m_skip_data_patch{INI_SECTION, "skip_data_patch", false};
|
option::OptionBool m_skip_data_patch{INI_SECTION, "skip_data_patch", false};
|
||||||
option::OptionBool m_skip_ticket{INI_SECTION, "skip_ticket", false};
|
option::OptionBool m_skip_ticket{INI_SECTION, "skip_ticket", false};
|
||||||
option::OptionBool m_skip_nca_hash_verify{INI_SECTION, "skip_nca_hash_verify", false};
|
option::OptionBool m_skip_nca_hash_verify{INI_SECTION, "skip_nca_hash_verify", true};
|
||||||
option::OptionBool m_skip_rsa_header_fixed_key_verify{INI_SECTION, "skip_rsa_header_fixed_key_verify", false};
|
option::OptionBool m_skip_rsa_header_fixed_key_verify{INI_SECTION, "skip_rsa_header_fixed_key_verify", true};
|
||||||
option::OptionBool m_skip_rsa_npdm_fixed_key_verify{INI_SECTION, "skip_rsa_npdm_fixed_key_verify", false};
|
option::OptionBool m_skip_rsa_npdm_fixed_key_verify{INI_SECTION, "skip_rsa_npdm_fixed_key_verify", true};
|
||||||
option::OptionBool m_ignore_distribution_bit{INI_SECTION, "ignore_distribution_bit", false};
|
option::OptionBool m_ignore_distribution_bit{INI_SECTION, "ignore_distribution_bit", false};
|
||||||
|
option::OptionBool m_convert_to_common_ticket{INI_SECTION, "convert_to_common_ticket", true};
|
||||||
option::OptionBool m_convert_to_standard_crypto{INI_SECTION, "convert_to_standard_crypto", false};
|
option::OptionBool m_convert_to_standard_crypto{INI_SECTION, "convert_to_standard_crypto", false};
|
||||||
option::OptionBool m_lower_master_key{INI_SECTION, "lower_master_key", false};
|
option::OptionBool m_lower_master_key{INI_SECTION, "lower_master_key", false};
|
||||||
option::OptionBool m_lower_system_version{INI_SECTION, "lower_system_version", false};
|
option::OptionBool m_lower_system_version{INI_SECTION, "lower_system_version", true};
|
||||||
|
|
||||||
// dump options
|
// dump options
|
||||||
option::OptionBool m_dump_app_folder{"dump", "app_folder", true};
|
option::OptionBool m_dump_app_folder{"dump", "app_folder", true};
|
||||||
option::OptionBool m_dump_append_folder_with_xci{"dump", "append_folder_with_xci", true};
|
option::OptionBool m_dump_append_folder_with_xci{"dump", "append_folder_with_xci", true};
|
||||||
option::OptionBool m_dump_trim_xci{"dump", "trim_xci", false};
|
option::OptionBool m_dump_trim_xci{"dump", "trim_xci", false};
|
||||||
option::OptionBool m_dump_label_trim_xci{"dump", "label_trim_xci", false};
|
option::OptionBool m_dump_label_trim_xci{"dump", "label_trim_xci", false};
|
||||||
option::OptionBool m_dump_usb_transfer_stream{"dump", "usb_transfer_stream", true};
|
option::OptionBool m_dump_convert_to_common_ticket{"dump", "convert_to_common_ticket", true};
|
||||||
|
option::OptionLong m_nsz_compress_level{"dump", "nsz_compress_level", 3};
|
||||||
|
option::OptionLong m_nsz_compress_threads{"dump", "nsz_compress_threads", 3};
|
||||||
|
option::OptionBool m_nsz_compress_ldm{"dump", "nsz_compress_ldm", true};
|
||||||
|
option::OptionBool m_nsz_compress_block{"dump", "nsz_compress_block", false};
|
||||||
|
option::OptionLong m_nsz_compress_block_exponent{"dump", "nsz_compress_block_exponent", 6};
|
||||||
|
|
||||||
// todo: move this into it's own menu
|
// todo: move this into it's own menu
|
||||||
option::OptionLong m_text_scroll_speed{"accessibility", "text_scroll_speed", 1}; // normal
|
option::OptionLong m_text_scroll_speed{"accessibility", "text_scroll_speed", 1}; // normal
|
||||||
|
|
||||||
PLSR_PlayerSoundId m_sound_ids[SoundEffect_MAX]{};
|
// ftp options.
|
||||||
|
option::OptionLong m_ftp_port{"ftp", "port", 5000};
|
||||||
|
option::OptionBool m_ftp_anon{"ftp", "anon", true};
|
||||||
|
option::OptionString m_ftp_user{"ftp", "user", ""};
|
||||||
|
option::OptionString m_ftp_pass{"ftp", "pass", ""};
|
||||||
|
option::OptionBool m_ftp_show_album{"ftp", "show_album", true};
|
||||||
|
option::OptionBool m_ftp_show_ams_contents{"ftp", "show_ams_contents", false};
|
||||||
|
option::OptionBool m_ftp_show_bis_storage{"ftp", "show_bis_storage", false};
|
||||||
|
option::OptionBool m_ftp_show_bis_fs{"ftp", "show_bis_fs", false};
|
||||||
|
option::OptionBool m_ftp_show_content_system{"ftp", "show_content_system", false};
|
||||||
|
option::OptionBool m_ftp_show_content_user{"ftp", "show_content_user", false};
|
||||||
|
option::OptionBool m_ftp_show_content_sd{"ftp", "show_content_sd", false};
|
||||||
|
// option::OptionBool m_ftp_show_content_sd0{"ftp", "show_content_sd0", false};
|
||||||
|
// option::OptionBool m_ftp_show_custom_system{"ftp", "show_custom_system", false};
|
||||||
|
// option::OptionBool m_ftp_show_custom_sd{"ftp", "show_custom_sd", false};
|
||||||
|
option::OptionBool m_ftp_show_games{"ftp", "show_games", true};
|
||||||
|
option::OptionBool m_ftp_show_install{"ftp", "show_install", true};
|
||||||
|
option::OptionBool m_ftp_show_mounts{"ftp", "show_mounts", false};
|
||||||
|
option::OptionBool m_ftp_show_switch{"ftp", "show_switch", false};
|
||||||
|
|
||||||
|
// mtp options.
|
||||||
|
option::OptionLong m_mtp_vid{"mtp", "vid", 0x057e}; // nintendo (hidden from ui)
|
||||||
|
option::OptionLong m_mtp_pid{"mtp", "pid", 0x201d}; // switch (hidden from ui)
|
||||||
|
option::OptionBool m_mtp_allocate_file{"mtp", "allocate_file", true};
|
||||||
|
option::OptionBool m_mtp_show_album{"mtp", "show_album", true};
|
||||||
|
option::OptionBool m_mtp_show_content_sd{"mtp", "show_content_sd", false};
|
||||||
|
option::OptionBool m_mtp_show_content_system{"mtp", "show_content_system", false};
|
||||||
|
option::OptionBool m_mtp_show_content_user{"mtp", "show_content_user", false};
|
||||||
|
option::OptionBool m_mtp_show_games{"mtp", "show_games", true};
|
||||||
|
option::OptionBool m_mtp_show_install{"mtp", "show_install", true};
|
||||||
|
option::OptionBool m_mtp_show_mounts{"mtp", "show_mounts", false};
|
||||||
|
option::OptionBool m_mtp_show_speedtest{"mtp", "show_speedtest", false};
|
||||||
|
|
||||||
|
std::shared_ptr<fs::FsNativeSd> m_fs{};
|
||||||
|
audio::SongID m_background_music{};
|
||||||
|
|
||||||
|
#ifdef USE_NVJPG
|
||||||
|
nj::Decoder m_decoder;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
double m_delta_time{};
|
||||||
|
|
||||||
|
static constexpr const char* INSTALL_DEPENDS_STR =
|
||||||
|
"Installing is disabled.\n\n"
|
||||||
|
"Enable in the options by selecting Menu (Y) -> Advanced -> Install options -> Enable.";
|
||||||
|
|
||||||
private: // from nanovg decko3d example by adubbz
|
private: // from nanovg decko3d example by adubbz
|
||||||
static constexpr unsigned NumFramebuffers = 2;
|
static constexpr unsigned NumFramebuffers = 2;
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ enum {
|
|||||||
Module_Npln = 321,
|
Module_Npln = 321,
|
||||||
Module_Tspm = 499,
|
Module_Tspm = 499,
|
||||||
Module_Devmenu = 500,
|
Module_Devmenu = 500,
|
||||||
|
Module_Sphaira = 505,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SvcError {
|
enum SvcError {
|
||||||
@@ -494,7 +495,337 @@ enum NcmError {
|
|||||||
NcmError_WriteToReadOnlyContentStorage = 0x17C05,
|
NcmError_WriteToReadOnlyContentStorage = 0x17C05,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define R_SUCCEED() return 0
|
enum class SphairaResult : Result {
|
||||||
|
TransferCancelled,
|
||||||
|
StreamBadSeek,
|
||||||
|
|
||||||
|
FsTooManyEntries,
|
||||||
|
FsNewPathTooLarge,
|
||||||
|
FsInvalidType,
|
||||||
|
FsEmpty,
|
||||||
|
FsAlreadyRoot,
|
||||||
|
FsNoCurrentPath,
|
||||||
|
FsBrokenCurrentPath,
|
||||||
|
FsIndexOutOfBounds,
|
||||||
|
FsFsNotActive,
|
||||||
|
FsNewPathEmpty,
|
||||||
|
FsLoadingCancelled,
|
||||||
|
FsBrokenRoot,
|
||||||
|
|
||||||
|
FsUnknownStdioError,
|
||||||
|
FsStdioFailedToSeek,
|
||||||
|
FsStdioFailedToRead,
|
||||||
|
FsStdioFailedToWrite,
|
||||||
|
FsStdioFailedToOpenFile,
|
||||||
|
FsStdioFailedToCreate,
|
||||||
|
FsStdioFailedToTruncate,
|
||||||
|
FsStdioFailedToFlush,
|
||||||
|
FsStdioFailedToCreateDirectory,
|
||||||
|
FsStdioFailedToDeleteFile,
|
||||||
|
FsStdioFailedToDeleteDirectory,
|
||||||
|
FsStdioFailedToOpenDirectory,
|
||||||
|
FsStdioFailedToRename,
|
||||||
|
FsStdioFailedToStat,
|
||||||
|
|
||||||
|
FsReadOnly,
|
||||||
|
FsNotActive,
|
||||||
|
FsFailedStdioStat,
|
||||||
|
FsFailedStdioOpendir,
|
||||||
|
|
||||||
|
NroBadMagic,
|
||||||
|
NroBadSize,
|
||||||
|
|
||||||
|
AppFailedMusicDownload,
|
||||||
|
CurlFailedEasyInit,
|
||||||
|
DumpFailedNetworkUpload,
|
||||||
|
|
||||||
|
UnzOpen2_64,
|
||||||
|
UnzGetGlobalInfo64,
|
||||||
|
UnzLocateFile,
|
||||||
|
UnzGoToFirstFile,
|
||||||
|
UnzGoToNextFile,
|
||||||
|
UnzOpenCurrentFile,
|
||||||
|
UnzGetCurrentFileInfo64,
|
||||||
|
UnzReadCurrentFile,
|
||||||
|
|
||||||
|
ZipOpen2_64,
|
||||||
|
ZipOpenNewFileInZip,
|
||||||
|
ZipWriteInFileInZip,
|
||||||
|
|
||||||
|
MmzBadLocalHeaderSig,
|
||||||
|
MmzBadLocalHeaderRead,
|
||||||
|
|
||||||
|
FileBrowserFailedUpload,
|
||||||
|
FileBrowserDirNotDaybreak,
|
||||||
|
|
||||||
|
AppstoreFailedZipDownload,
|
||||||
|
AppstoreFailedMd5,
|
||||||
|
AppstoreFailedParseManifest,
|
||||||
|
|
||||||
|
GameBadReadForDump,
|
||||||
|
GameEmptyMetaEntries,
|
||||||
|
GameMultipleKeysFound,
|
||||||
|
GameNoNspEntriesBuilt,
|
||||||
|
|
||||||
|
KeyMissingNcaKeyArea,
|
||||||
|
KeyMissingTitleKek,
|
||||||
|
KeyMissingMasterKey,
|
||||||
|
KeyFailedDecyptETicketDeviceKey,
|
||||||
|
|
||||||
|
NcaFailedNcaHeaderHashVerify,
|
||||||
|
NcaBadSigKeyGen,
|
||||||
|
|
||||||
|
GcBadReadForDump,
|
||||||
|
GcEmptyGamecard,
|
||||||
|
GcBadXciMagic,
|
||||||
|
GcBadXciRomSize,
|
||||||
|
GcFailedToGetSecurityInfo,
|
||||||
|
|
||||||
|
GhdlEmptyAsset,
|
||||||
|
GhdlFailedToDownloadAsset,
|
||||||
|
GhdlFailedToDownloadAssetJson,
|
||||||
|
|
||||||
|
ThemezerFailedToDownloadThemeMeta,
|
||||||
|
ThemezerFailedToDownloadTheme,
|
||||||
|
|
||||||
|
MainFailedToDownloadUpdate,
|
||||||
|
|
||||||
|
UsbDsBadDeviceSpeed,
|
||||||
|
|
||||||
|
NcaBadMagic,
|
||||||
|
NspBadMagic,
|
||||||
|
XciBadMagic,
|
||||||
|
XciSecurePartitionNotFound,
|
||||||
|
|
||||||
|
EsBadTitleKeyType,
|
||||||
|
EsPersonalisedTicketDeviceIdMissmatch,
|
||||||
|
EsFailedDecryptPersonalisedTicket,
|
||||||
|
EsBadDecryptedPersonalisedTicketSize,
|
||||||
|
EsBadTicketSize,
|
||||||
|
// found ticket has missmatching rights_id from it's name.
|
||||||
|
EsInvalidTicketBadRightsId,
|
||||||
|
EsInvalidTicketFromatVersion,
|
||||||
|
EsInvalidTicketKeyType,
|
||||||
|
EsInvalidTicketKeyRevision,
|
||||||
|
|
||||||
|
OwoBadArgs,
|
||||||
|
|
||||||
|
UsbCancelled,
|
||||||
|
UsbBadMagic,
|
||||||
|
UsbBadVersion,
|
||||||
|
UsbBadCount,
|
||||||
|
UsbBadBufferAlign,
|
||||||
|
UsbBadTransferSize,
|
||||||
|
UsbEmptyTransferSize,
|
||||||
|
UsbOverflowTransferSize,
|
||||||
|
UsbBadTotalSize,
|
||||||
|
|
||||||
|
UsbUploadBadMagic,
|
||||||
|
UsbUploadExit,
|
||||||
|
UsbUploadBadCount,
|
||||||
|
UsbUploadBadTransferSize,
|
||||||
|
UsbUploadBadTotalSize,
|
||||||
|
UsbUploadBadCommand,
|
||||||
|
|
||||||
|
// unkown container for the source provided.
|
||||||
|
YatiContainerNotFound,
|
||||||
|
// nca required by the cnmt but not found in collection.
|
||||||
|
YatiNcaNotFound,
|
||||||
|
YatiInvalidNcaReadSize,
|
||||||
|
YatiInvalidNcaSigKeyGen,
|
||||||
|
YatiInvalidNcaMagic,
|
||||||
|
YatiInvalidNcaSignature0,
|
||||||
|
YatiInvalidNcaSignature1,
|
||||||
|
// invalid sha256 over the entire nca.
|
||||||
|
YatiInvalidNcaSha256,
|
||||||
|
// section could not be found.
|
||||||
|
YatiNczSectionNotFound,
|
||||||
|
// section count == 0.
|
||||||
|
YatiInvalidNczSectionCount,
|
||||||
|
// block could not be found.
|
||||||
|
YatiNczBlockNotFound,
|
||||||
|
// block version != 2.
|
||||||
|
YatiInvalidNczBlockVersion,
|
||||||
|
// block type != 1.
|
||||||
|
YatiInvalidNczBlockType,
|
||||||
|
// block count == 0.
|
||||||
|
YatiInvalidNczBlockTotal,
|
||||||
|
// block size exponent < 14 || > 32.
|
||||||
|
YatiInvalidNczBlockSizeExponent,
|
||||||
|
// zstd error while decompressing ncz.
|
||||||
|
YatiInvalidNczZstdError,
|
||||||
|
// nca has rights_id but matching ticket wasn't found.
|
||||||
|
YatiTicketNotFound,
|
||||||
|
// found ticket has missmatching rights_id from it's name.
|
||||||
|
YatiInvalidTicketBadRightsId,
|
||||||
|
// cert not found for the ticket.
|
||||||
|
YatiCertNotFound,
|
||||||
|
// unable to fetch header from ncm database.
|
||||||
|
YatiNcmDbCorruptHeader,
|
||||||
|
// unable to total infos from ncm database.
|
||||||
|
YatiNcmDbCorruptInfos,
|
||||||
|
|
||||||
|
NszFailedCreateCctx,
|
||||||
|
NszFailedSetCompressionLevel,
|
||||||
|
NszFailedSetThreadCount,
|
||||||
|
NszFailedSetLongDistanceMode,
|
||||||
|
NszFailedResetCctx,
|
||||||
|
NszFailedCompress2,
|
||||||
|
NszFailedCompressStream2,
|
||||||
|
NszTooManyBlocks,
|
||||||
|
// set when nca finished but not all blocks were handled.
|
||||||
|
NszMissingBlocks,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAKE_SPHAIRA_RESULT_ENUM(x) Result_##x = MAKERESULT(Module_Sphaira, (Result)SphairaResult::x)
|
||||||
|
|
||||||
|
enum : Result {
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(TransferCancelled),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(StreamBadSeek),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsTooManyEntries),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsNewPathTooLarge),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsInvalidType),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsEmpty),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsAlreadyRoot),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsNoCurrentPath),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsBrokenCurrentPath),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsIndexOutOfBounds),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsFsNotActive),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsNewPathEmpty),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsLoadingCancelled),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsBrokenRoot),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsUnknownStdioError),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToSeek),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToRead),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToWrite),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToOpenFile),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToCreate),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToTruncate),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToFlush),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToCreateDirectory),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToDeleteFile),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToDeleteDirectory),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToOpenDirectory),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToRename),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsStdioFailedToStat),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsReadOnly),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsNotActive),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsFailedStdioStat),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FsFailedStdioOpendir),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NroBadMagic),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NroBadSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(AppFailedMusicDownload),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(CurlFailedEasyInit),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(DumpFailedNetworkUpload),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UnzOpen2_64),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UnzGetGlobalInfo64),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UnzLocateFile),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UnzGoToFirstFile),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UnzGoToNextFile),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UnzOpenCurrentFile),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UnzGetCurrentFileInfo64),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UnzReadCurrentFile),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(ZipOpen2_64),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(ZipOpenNewFileInZip),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(ZipWriteInFileInZip),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(MmzBadLocalHeaderSig),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(MmzBadLocalHeaderRead),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FileBrowserFailedUpload),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(FileBrowserDirNotDaybreak),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(AppstoreFailedZipDownload),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(AppstoreFailedMd5),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(AppstoreFailedParseManifest),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GameBadReadForDump),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GameEmptyMetaEntries),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GameMultipleKeysFound),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GameNoNspEntriesBuilt),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(KeyMissingNcaKeyArea),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(KeyMissingTitleKek),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(KeyMissingMasterKey),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(KeyFailedDecyptETicketDeviceKey),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NcaFailedNcaHeaderHashVerify),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NcaBadSigKeyGen),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GcBadReadForDump),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GcEmptyGamecard),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GcBadXciMagic),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GcBadXciRomSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GcFailedToGetSecurityInfo),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GhdlEmptyAsset),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GhdlFailedToDownloadAsset),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(GhdlFailedToDownloadAssetJson),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(ThemezerFailedToDownloadThemeMeta),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(ThemezerFailedToDownloadTheme),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(MainFailedToDownloadUpdate),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbDsBadDeviceSpeed),
|
||||||
|
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NspBadMagic),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(XciBadMagic),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NcaBadMagic),
|
||||||
|
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(XciSecurePartitionNotFound),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsBadTitleKeyType),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsPersonalisedTicketDeviceIdMissmatch),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsFailedDecryptPersonalisedTicket),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsBadDecryptedPersonalisedTicketSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsBadTicketSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsInvalidTicketBadRightsId),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsInvalidTicketFromatVersion),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsInvalidTicketKeyType),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(EsInvalidTicketKeyRevision),
|
||||||
|
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(OwoBadArgs),
|
||||||
|
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbCancelled),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbBadMagic),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbBadVersion),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbBadCount),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbBadBufferAlign),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbBadTransferSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbEmptyTransferSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbOverflowTransferSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbUploadBadMagic),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbUploadExit),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbUploadBadCount),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbUploadBadTransferSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbUploadBadTotalSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(UsbUploadBadCommand),
|
||||||
|
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiContainerNotFound),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiNcaNotFound),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNcaReadSize),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNcaSigKeyGen),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNcaMagic),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNcaSignature0),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNcaSignature1),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNcaSha256),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiNczSectionNotFound),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNczSectionCount),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiNczBlockNotFound),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNczBlockVersion),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNczBlockType),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNczBlockTotal),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNczBlockSizeExponent),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidNczZstdError),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiTicketNotFound),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiInvalidTicketBadRightsId),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiCertNotFound),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiNcmDbCorruptHeader),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(YatiNcmDbCorruptInfos),
|
||||||
|
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszFailedCreateCctx),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszFailedSetCompressionLevel),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszFailedSetThreadCount),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszFailedSetLongDistanceMode),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszFailedResetCctx),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszFailedCompress2),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszFailedCompressStream2),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszTooManyBlocks),
|
||||||
|
MAKE_SPHAIRA_RESULT_ENUM(NszMissingBlocks),
|
||||||
|
};
|
||||||
|
|
||||||
|
#undef MAKE_SPHAIRA_RESULT_ENUM
|
||||||
|
|
||||||
|
#define R_SUCCEED() return (Result)0
|
||||||
|
|
||||||
#define R_THROW(_rc) return _rc
|
#define R_THROW(_rc) return _rc
|
||||||
|
|
||||||
@@ -520,19 +851,83 @@ enum NcmError {
|
|||||||
#define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2)
|
#define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2)
|
||||||
#define ANONYMOUS_VARIABLE(pref) CONCATENATE(pref, __COUNTER__)
|
#define ANONYMOUS_VARIABLE(pref) CONCATENATE(pref, __COUNTER__)
|
||||||
|
|
||||||
#define ON_SCOPE_EXIT(_f) std::experimental::scope_exit ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){[&] { _f; }};
|
template<typename Function>
|
||||||
#define ON_SCOPE_FAIL(_f) std::experimental::scope_exit ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){[&] { if (R_FAILED(rc)) { _f; } }};
|
struct ScopeGuard {
|
||||||
#define ON_SCOPE_SUCCESS(_f) std::experimental::scope_exit ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){[&] { if (R_SUCCEEDED(rc)) { _f; } }};
|
ScopeGuard(Function&& function) : m_function(std::forward<Function>(function)) {
|
||||||
|
|
||||||
// threading helpers.
|
}
|
||||||
#define PRIO_PREEMPTIVE 0x3B
|
~ScopeGuard() {
|
||||||
|
m_function();
|
||||||
|
}
|
||||||
|
|
||||||
// threading affinity, use with svcSetThreadCoreMask().
|
ScopeGuard(const ScopeGuard&) = delete;
|
||||||
#define THREAD_AFFINITY_CORE0 BIT(0)
|
void operator=(const ScopeGuard&) = delete;
|
||||||
#define THREAD_AFFINITY_CORE1 BIT(1)
|
|
||||||
#define THREAD_AFFINITY_CORE2 BIT(2)
|
|
||||||
#define THREAD_AFFINITY_DEFAULT(core) (BIT(core)|THREAD_AFFINITY_CORE1|THREAD_AFFINITY_CORE2)
|
|
||||||
#define THREAD_AFFINITY_ALL (THREAD_AFFINITY_CORE0|THREAD_AFFINITY_CORE1|THREAD_AFFINITY_CORE2)
|
|
||||||
|
|
||||||
// mutex helpers.
|
private:
|
||||||
#define SCOPED_MUTEX(mutex) mutexLock(mutex); ON_SCOPE_EXIT(mutexUnlock(mutex))
|
const Function m_function;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ScopedMutex {
|
||||||
|
ScopedMutex(Mutex* mutex) : m_mutex{mutex} {
|
||||||
|
mutexLock(m_mutex);
|
||||||
|
}
|
||||||
|
~ScopedMutex() {
|
||||||
|
mutexUnlock(m_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopedMutex(const ScopedMutex&) = delete;
|
||||||
|
void operator=(const ScopedMutex&) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Mutex* const m_mutex;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ScopedRMutex {
|
||||||
|
ScopedRMutex(RMutex* _mutex) : mutex{_mutex} {
|
||||||
|
rmutexLock(mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
~ScopedRMutex() {
|
||||||
|
rmutexUnlock(mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopedRMutex(const ScopedRMutex&) = delete;
|
||||||
|
void operator=(const ScopedRMutex&) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RMutex* const mutex;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ScopedRwLock {
|
||||||
|
ScopedRwLock(RwLock* _lock, bool _write) : lock{_lock}, write{_write} {
|
||||||
|
if (write) {
|
||||||
|
rwlockWriteLock(lock);
|
||||||
|
} else {
|
||||||
|
rwlockReadLock(lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~ScopedRwLock() {
|
||||||
|
if (write) {
|
||||||
|
rwlockWriteUnlock(lock);
|
||||||
|
} else {
|
||||||
|
rwlockReadUnlock(lock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopedRwLock(const ScopedRwLock&) = delete;
|
||||||
|
void operator=(const ScopedRwLock&) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RwLock* const lock;
|
||||||
|
bool const write;
|
||||||
|
};
|
||||||
|
|
||||||
|
// #define ON_SCOPE_EXIT(_f) std::experimental::scope_exit ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){[&] { _f; }};
|
||||||
|
#define ON_SCOPE_EXIT(_f) ScopeGuard ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){[&] { _f; }};
|
||||||
|
#define SCOPED_MUTEX(_m) ScopedMutex ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){_m}
|
||||||
|
#define SCOPED_RMUTEX(_m) ScopedRMutex ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){_m}
|
||||||
|
#define SCOPED_RWLOCK(_m, _write) ScopedRwLock ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){_m, _write}
|
||||||
|
|
||||||
|
// #define ON_SCOPE_FAIL(_f) std::experimental::scope_exit ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){[&] { if (R_FAILED(rc)) { _f; } }};
|
||||||
|
// #define ON_SCOPE_SUCCESS(_f) std::experimental::scope_exit ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_){[&] { if (R_SUCCEEDED(rc)) { _f; } }};
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ struct Fields {
|
|||||||
|
|
||||||
struct Header {
|
struct Header {
|
||||||
Header() = default;
|
Header() = default;
|
||||||
Header(std::initializer_list<std::pair<const std::string, std::string>> p) : m_map{p} {}
|
Header(std::initializer_list<std::pair<const std::string, std::string>>&& p) : m_map{std::forward<decltype(p)>(p)} {}
|
||||||
std::unordered_map<std::string, std::string> m_map;
|
std::unordered_map<std::string, std::string> m_map;
|
||||||
|
|
||||||
auto Find(const std::string& key) const {
|
auto Find(const std::string& key) const {
|
||||||
@@ -91,7 +91,7 @@ struct UserPass {
|
|||||||
struct UploadInfo {
|
struct UploadInfo {
|
||||||
UploadInfo() = default;
|
UploadInfo() = default;
|
||||||
UploadInfo(const std::string& name) : m_name{name} {}
|
UploadInfo(const std::string& name) : m_name{name} {}
|
||||||
UploadInfo(const std::string& name, s64 size, OnUploadCallback cb) : m_name{name}, m_size{size}, m_callback{cb} {}
|
UploadInfo(const std::string& name, s64 size, const OnUploadCallback& cb) : m_name{name}, m_size{size}, m_callback{cb} {}
|
||||||
UploadInfo(const std::string& name, const std::vector<u8>& data) : m_name{name}, m_data{data} {}
|
UploadInfo(const std::string& name, const std::vector<u8>& data) : m_name{name}, m_data{data} {}
|
||||||
std::string m_name{};
|
std::string m_name{};
|
||||||
std::vector<u8> m_data{};
|
std::vector<u8> m_data{};
|
||||||
@@ -142,6 +142,7 @@ struct DownloadEventData {
|
|||||||
|
|
||||||
auto Init() -> bool;
|
auto Init() -> bool;
|
||||||
void Exit();
|
void Exit();
|
||||||
|
void ExitSignal();
|
||||||
|
|
||||||
// sync functions
|
// sync functions
|
||||||
auto ToMemory(const Api& e) -> ApiResult;
|
auto ToMemory(const Api& e) -> ApiResult;
|
||||||
|
|||||||
@@ -1,33 +1,47 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "fs.hpp"
|
#include "fs.hpp"
|
||||||
|
#include "location.hpp"
|
||||||
|
#include "ui/progress_box.hpp"
|
||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <minizip/ioapi.h>
|
||||||
|
|
||||||
namespace sphaira::dump {
|
namespace sphaira::dump {
|
||||||
|
|
||||||
enum DumpLocationType {
|
enum DumpLocationType {
|
||||||
// dump using native fs.
|
// dump using native fs.
|
||||||
DumpLocationType_SdCard,
|
DumpLocationType_SdCard,
|
||||||
|
// dump to usb pc.
|
||||||
|
DumpLocationType_Usb,
|
||||||
// dump to usb using tinfoil protocol.
|
// dump to usb using tinfoil protocol.
|
||||||
DumpLocationType_UsbS2S,
|
DumpLocationType_UsbS2S,
|
||||||
// speed test, only reads the data, doesn't write anything.
|
// speed test, only reads the data, doesn't write anything.
|
||||||
DumpLocationType_DevNull,
|
DumpLocationType_DevNull,
|
||||||
// dump to stdio, ideal for custom mount points using devoptab, such as hdd.
|
// dump to stdio, ideal for custom mount points using devoptab, such as hdd.
|
||||||
DumpLocationType_Stdio,
|
DumpLocationType_Stdio,
|
||||||
// dump to custom locations found in locations.ini.
|
|
||||||
DumpLocationType_Network,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DumpLocationFlag {
|
enum DumpLocationFlag {
|
||||||
DumpLocationFlag_SdCard = 1 << DumpLocationType_SdCard,
|
DumpLocationFlag_SdCard = 1 << DumpLocationType_SdCard,
|
||||||
|
DumpLocationFlag_Usb = 1 << DumpLocationType_Usb,
|
||||||
DumpLocationFlag_UsbS2S = 1 << DumpLocationType_UsbS2S,
|
DumpLocationFlag_UsbS2S = 1 << DumpLocationType_UsbS2S,
|
||||||
DumpLocationFlag_DevNull = 1 << DumpLocationType_DevNull,
|
DumpLocationFlag_DevNull = 1 << DumpLocationType_DevNull,
|
||||||
DumpLocationFlag_Stdio = 1 << DumpLocationType_Stdio,
|
DumpLocationFlag_Stdio = 1 << DumpLocationType_Stdio,
|
||||||
DumpLocationFlag_Network = 1 << DumpLocationType_Network,
|
DumpLocationFlag_All = DumpLocationFlag_SdCard | DumpLocationFlag_Usb | DumpLocationFlag_UsbS2S | DumpLocationFlag_DevNull | DumpLocationFlag_Stdio,
|
||||||
DumpLocationFlag_All = DumpLocationFlag_SdCard | DumpLocationFlag_UsbS2S | DumpLocationFlag_DevNull | DumpLocationFlag_Stdio | DumpLocationFlag_Network,
|
};
|
||||||
|
|
||||||
|
struct DumpEntry {
|
||||||
|
DumpLocationType type;
|
||||||
|
s32 index;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DumpLocation {
|
||||||
|
DumpEntry entry{};
|
||||||
|
location::StdioEntries stdio{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BaseSource {
|
struct BaseSource {
|
||||||
@@ -36,11 +50,36 @@ struct BaseSource {
|
|||||||
virtual auto GetName(const std::string& path) const -> std::string = 0;
|
virtual auto GetName(const std::string& path) const -> std::string = 0;
|
||||||
virtual auto GetSize(const std::string& path) const -> s64 = 0;
|
virtual auto GetSize(const std::string& path) const -> s64 = 0;
|
||||||
virtual auto GetIcon(const std::string& path) const -> int { return 0; }
|
virtual auto GetIcon(const std::string& path) const -> int { return 0; }
|
||||||
|
|
||||||
|
Result Read(const std::string& path, void* buf, s64 off, s64 size) {
|
||||||
|
u64 bytes_read;
|
||||||
|
return Read(path, buf, off, size, &bytes_read);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct WriteSource {
|
||||||
|
virtual ~WriteSource() = default;
|
||||||
|
virtual Result Write(const void* buf, s64 off, s64 size) = 0;
|
||||||
|
virtual Result SetSize(s64 size) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// called after dump has finished.
|
// called after dump has finished.
|
||||||
using OnExit = std::function<void(Result rc)>;
|
using OnExit = std::function<void(Result rc)>;
|
||||||
|
using OnLocation = std::function<void(const DumpLocation& loc)>;
|
||||||
|
|
||||||
void Dump(std::shared_ptr<BaseSource> source, const std::vector<fs::FsPath>& paths, OnExit on_exit = [](Result){}, u32 location_flags = DumpLocationFlag_All);
|
using CustomTransfer = std::function<Result(ui::ProgressBox* pbox, BaseSource* source, WriteSource* writer, const fs::FsPath& path)>;
|
||||||
|
|
||||||
|
// prompts the user to select dump location, calls on_loc on success with the selected location.
|
||||||
|
void DumpGetLocation(const std::string& title, u32 location_flags, const OnLocation& on_loc, const CustomTransfer& custom_transfer = nullptr);
|
||||||
|
|
||||||
|
Result Dump(ui::ProgressBox* pbox, const std::shared_ptr<BaseSource>& source, const DumpLocation& location, const std::vector<fs::FsPath>& paths, const CustomTransfer& custom_transfer = nullptr);
|
||||||
|
|
||||||
|
// dumps to a fetched location using DumpGetLocation().
|
||||||
|
void Dump(const std::shared_ptr<BaseSource>& source, const DumpLocation& location, const std::vector<fs::FsPath>& paths, const OnExit& on_exit, const CustomTransfer& custom_transfer = nullptr);
|
||||||
|
// DumpGetLocation() + Dump() all in one.
|
||||||
|
void Dump(const std::shared_ptr<BaseSource>& source, const std::vector<fs::FsPath>& paths, const OnExit& on_exit = nullptr, u32 location_flags = DumpLocationFlag_All);
|
||||||
|
void Dump(const std::shared_ptr<BaseSource>& source, const std::vector<fs::FsPath>& paths, const CustomTransfer& custom_transfer, const OnExit& on_exit = nullptr, u32 location_flags = DumpLocationFlag_All);
|
||||||
|
|
||||||
|
void FileFuncWriter(WriteSource* writer, zlib_filefunc64_def* funcs);
|
||||||
|
|
||||||
} // namespace sphaira::dump
|
} // namespace sphaira::dump
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <nxlink.h>
|
#include <nxlink.h>
|
||||||
#include <haze.h>
|
|
||||||
#include "download.hpp"
|
#include "download.hpp"
|
||||||
|
|
||||||
namespace sphaira::evman {
|
namespace sphaira::evman {
|
||||||
@@ -24,7 +23,6 @@ struct ExitEventData {
|
|||||||
using EventData = std::variant<
|
using EventData = std::variant<
|
||||||
LaunchNroEventData,
|
LaunchNroEventData,
|
||||||
ExitEventData,
|
ExitEventData,
|
||||||
HazeCallbackData,
|
|
||||||
NxlinkCallbackData,
|
NxlinkCallbackData,
|
||||||
curl::DownloadEventData
|
curl::DownloadEventData
|
||||||
>;
|
>;
|
||||||
|
|||||||
@@ -4,18 +4,36 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
#include <sys/syslimits.h>
|
||||||
#include "defines.hpp"
|
#include "defines.hpp"
|
||||||
|
|
||||||
namespace fs {
|
namespace fs {
|
||||||
|
|
||||||
|
enum OpenMode : u32 {
|
||||||
|
OpenMode_Read = FsOpenMode_Read,
|
||||||
|
OpenMode_Write = FsOpenMode_Write,
|
||||||
|
OpenMode_Append = FsOpenMode_Append,
|
||||||
|
|
||||||
|
// enables buffering for stdio based files.
|
||||||
|
OpenMode_EnableBuffer = 1 << 16,
|
||||||
|
OpenMode_ReadBuffered = OpenMode_Read | OpenMode_EnableBuffer,
|
||||||
|
OpenMode_WriteBuffered = OpenMode_Write | OpenMode_EnableBuffer,
|
||||||
|
OpenMode_AppendBuffered = OpenMode_Append | OpenMode_EnableBuffer,
|
||||||
|
};
|
||||||
|
|
||||||
struct FsPath {
|
struct FsPath {
|
||||||
FsPath() = default;
|
FsPath() = default;
|
||||||
constexpr FsPath(const auto& str) { From(str); }
|
|
||||||
|
constexpr FsPath(const FsPath& p) { From(p); }
|
||||||
|
constexpr FsPath(const char* str) { From(str); }
|
||||||
|
constexpr FsPath(const std::string& str) { From(str); }
|
||||||
|
constexpr FsPath(const std::string_view& str) { From(str); }
|
||||||
|
|
||||||
constexpr void From(const FsPath& p) {
|
constexpr void From(const FsPath& p) {
|
||||||
*this = p;
|
From(p.s);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr void From(const char* str) {
|
constexpr void From(const char* str) {
|
||||||
@@ -56,6 +74,19 @@ struct FsPath {
|
|||||||
s[0] = '\0';
|
s[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr auto starts_with(std::string_view str) const -> bool {
|
||||||
|
return !strncasecmp(s, str.data(), str.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr auto ends_with(std::string_view str) const -> bool {
|
||||||
|
const auto len = length();
|
||||||
|
if (len < str.length()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !strncasecmp(s + len - str.length(), str.data(), str.length());
|
||||||
|
}
|
||||||
|
|
||||||
constexpr operator const char*() const { return s; }
|
constexpr operator const char*() const { return s; }
|
||||||
constexpr operator char*() { return s; }
|
constexpr operator char*() { return s; }
|
||||||
constexpr operator std::string() { return s; }
|
constexpr operator std::string() { return s; }
|
||||||
@@ -65,6 +96,11 @@ struct FsPath {
|
|||||||
constexpr char& operator[](std::size_t idx) { return s[idx]; }
|
constexpr char& operator[](std::size_t idx) { return s[idx]; }
|
||||||
constexpr const char& operator[](std::size_t idx) const { return s[idx]; }
|
constexpr const char& operator[](std::size_t idx) const { return s[idx]; }
|
||||||
|
|
||||||
|
constexpr FsPath& operator=(const FsPath& p) noexcept {
|
||||||
|
From(p.s);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
constexpr FsPath operator+(const FsPath& v) const noexcept {
|
constexpr FsPath operator+(const FsPath& v) const noexcept {
|
||||||
FsPath r{*this};
|
FsPath r{*this};
|
||||||
return r += v;
|
return r += v;
|
||||||
@@ -116,20 +152,24 @@ struct FsPath {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static constexpr bool path_equal(std::string_view a, std::string_view b) {
|
||||||
|
return a.length() == b.length() && !strncasecmp(a.data(), b.data(), a.length());
|
||||||
|
}
|
||||||
|
|
||||||
constexpr bool operator==(const FsPath& v) const noexcept {
|
constexpr bool operator==(const FsPath& v) const noexcept {
|
||||||
return !strcasecmp(*this, v);
|
return path_equal(*this, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator==(const char* v) const noexcept {
|
constexpr bool operator==(const char* v) const noexcept {
|
||||||
return !strcasecmp(*this, v);
|
return path_equal(*this, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator==(const std::string& v) const noexcept {
|
constexpr bool operator==(const std::string& v) const noexcept {
|
||||||
return !strncasecmp(*this, v.data(), v.length());
|
return path_equal(*this, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool operator==(const std::string_view v) const noexcept {
|
constexpr bool operator==(const std::string_view v) const noexcept {
|
||||||
return !strncasecmp(*this, v.data(), v.length());
|
return path_equal(*this, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
static consteval bool Test(const auto& str) {
|
static consteval bool Test(const auto& str) {
|
||||||
@@ -142,7 +182,7 @@ struct FsPath {
|
|||||||
return path[0] == str[0];
|
return path[0] == str[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
char s[FS_MAX_PATH]{};
|
char s[PATH_MAX]{};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline FsPath operator+(const char* v, const FsPath& fp) {
|
inline FsPath operator+(const char* v, const FsPath& fp) {
|
||||||
@@ -160,15 +200,41 @@ inline FsPath operator+(const std::string_view& v, const FsPath& fp) {
|
|||||||
return r += fp;
|
return r += fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static_assert(FsPath::Test("abc"));
|
// Fs seems to be limted to file paths of 255 characters.
|
||||||
static_assert(FsPath::Test(std::string_view{"abc"}));
|
// i've disabled this as network mounts will often have very long paths
|
||||||
static_assert(FsPath::Test(std::string{"abc"}));
|
// that do not have this limit.
|
||||||
static_assert(FsPath::Test(FsPath{"abc"}));
|
// a proper fix would be to return an error if the path is too long and the path
|
||||||
|
// is native.
|
||||||
|
struct FsPathReal {
|
||||||
|
static constexpr inline size_t FS_REAL_MAX_LENGTH = PATH_MAX;
|
||||||
|
|
||||||
static_assert(FsPath::TestFrom("abc"));
|
constexpr FsPathReal(const FsPath& str) : FsPathReal{str.s} { }
|
||||||
static_assert(FsPath::TestFrom(std::string_view{"abc"}));
|
explicit constexpr FsPathReal(const char* str) {
|
||||||
static_assert(FsPath::TestFrom(std::string{"abc"}));
|
size_t real = 0;
|
||||||
static_assert(FsPath::TestFrom(FsPath{"abc"}));
|
for (size_t i = 0; str[i]; i++) {
|
||||||
|
// skip multiple slashes.
|
||||||
|
if (i && str[i] == '/' && str[i - 1] == '/') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// save single char.
|
||||||
|
s[real++] = str[i];
|
||||||
|
|
||||||
|
// check if we have exceeded the path.
|
||||||
|
if (real >= FS_REAL_MAX_LENGTH) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// null the end.
|
||||||
|
s[real] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr operator const char*() const { return s; }
|
||||||
|
constexpr operator std::string_view() const { return s; }
|
||||||
|
|
||||||
|
char s[PATH_MAX];
|
||||||
|
};
|
||||||
|
|
||||||
// fwd
|
// fwd
|
||||||
struct Fs;
|
struct Fs;
|
||||||
@@ -185,16 +251,14 @@ struct File {
|
|||||||
fs::Fs* m_fs{};
|
fs::Fs* m_fs{};
|
||||||
FsFile m_native{};
|
FsFile m_native{};
|
||||||
std::FILE* m_stdio{};
|
std::FILE* m_stdio{};
|
||||||
s64 m_stdio_off{};
|
u32 m_mode{};
|
||||||
// sadly, fatfs doesn't support fstat, so we have to manually
|
|
||||||
// stat the file to get it's size.
|
|
||||||
FsPath m_path{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Dir {
|
struct Dir {
|
||||||
~Dir();
|
~Dir();
|
||||||
|
|
||||||
Result GetEntryCount(s64* out);
|
Result GetEntryCount(s64* out);
|
||||||
|
Result Read(s64 *total_entries, size_t max_entries, FsDirectoryEntry *buf);
|
||||||
Result ReadAll(std::vector<FsDirectoryEntry>& buf);
|
Result ReadAll(std::vector<FsDirectoryEntry>& buf);
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
@@ -206,44 +270,38 @@ struct Dir {
|
|||||||
|
|
||||||
FsPath AppendPath(const fs::FsPath& root_path, const fs::FsPath& file_path);
|
FsPath AppendPath(const fs::FsPath& root_path, const fs::FsPath& file_path);
|
||||||
|
|
||||||
Result CreateFile(FsFileSystem* fs, const FsPath& path, u64 size = 0, u32 option = 0, bool ignore_read_only = true);
|
Result CreateFile(FsFileSystem* fs, const FsPathReal& path, u64 size = 0, u32 option = 0, bool ignore_read_only = true);
|
||||||
Result CreateDirectory(FsFileSystem* fs, const FsPath& path, bool ignore_read_only = true);
|
Result CreateDirectory(FsFileSystem* fs, const FsPathReal& path, bool ignore_read_only = true);
|
||||||
Result CreateDirectoryRecursively(FsFileSystem* fs, const FsPath& path, bool ignore_read_only = true);
|
Result CreateDirectoryRecursively(FsFileSystem* fs, const FsPath& path, bool ignore_read_only = true);
|
||||||
Result CreateDirectoryRecursivelyWithPath(FsFileSystem* fs, const FsPath& path, bool ignore_read_only = true);
|
Result CreateDirectoryRecursivelyWithPath(FsFileSystem* fs, const FsPath& path, bool ignore_read_only = true);
|
||||||
Result DeleteFile(FsFileSystem* fs, const FsPath& path, bool ignore_read_only = true);
|
Result DeleteFile(FsFileSystem* fs, const FsPathReal& path, bool ignore_read_only = true);
|
||||||
Result DeleteDirectory(FsFileSystem* fs, const FsPath& path, bool ignore_read_only = true);
|
Result DeleteDirectory(FsFileSystem* fs, const FsPathReal& path, bool ignore_read_only = true);
|
||||||
Result DeleteDirectoryRecursively(FsFileSystem* fs, const FsPath& path, bool ignore_read_only = true);
|
Result DeleteDirectoryRecursively(FsFileSystem* fs, const FsPathReal& path, bool ignore_read_only = true);
|
||||||
Result RenameFile(FsFileSystem* fs, const FsPath& src, const FsPath& dst, bool ignore_read_only = true);
|
Result RenameFile(FsFileSystem* fs, const FsPathReal& src, const FsPathReal& dst, bool ignore_read_only = true);
|
||||||
Result RenameDirectory(FsFileSystem* fs, const FsPath& src, const FsPath& dst, bool ignore_read_only = true);
|
Result RenameDirectory(FsFileSystem* fs, const FsPathReal& src, const FsPathReal& dst, bool ignore_read_only = true);
|
||||||
Result GetEntryType(FsFileSystem* fs, const FsPath& path, FsDirEntryType* out);
|
Result GetEntryType(FsFileSystem* fs, const FsPathReal& path, FsDirEntryType* out);
|
||||||
Result GetFileTimeStampRaw(FsFileSystem* fs, const FsPath& path, FsTimeStampRaw *out);
|
Result GetFileTimeStampRaw(FsFileSystem* fs, const FsPathReal& path, FsTimeStampRaw *out);
|
||||||
Result SetTimestamp(FsFileSystem* fs, const FsPath& path, const FsTimeStampRaw* ts);
|
Result SetTimestamp(FsFileSystem* fs, const FsPathReal& path, const FsTimeStampRaw* ts);
|
||||||
bool FileExists(FsFileSystem* fs, const FsPath& path);
|
bool FileExists(FsFileSystem* fs, const FsPath& path);
|
||||||
bool DirExists(FsFileSystem* fs, const FsPath& path);
|
bool DirExists(FsFileSystem* fs, const FsPath& path);
|
||||||
Result read_entire_file(FsFileSystem* fs, const FsPath& path, std::vector<u8>& out);
|
|
||||||
Result write_entire_file(FsFileSystem* fs, const FsPath& path, const std::vector<u8>& in, bool ignore_read_only = true);
|
|
||||||
Result copy_entire_file(FsFileSystem* fs, const FsPath& dst, const FsPath& src, bool ignore_read_only = true);
|
|
||||||
|
|
||||||
Result CreateFile(const FsPath& path, u64 size = 0, u32 option = 0, bool ignore_read_only = true);
|
Result CreateFile(const FsPathReal& path, u64 size = 0, u32 option = 0, bool ignore_read_only = true);
|
||||||
Result CreateDirectory(const FsPath& path, bool ignore_read_only = true);
|
Result CreateDirectory(const FsPathReal& path, bool ignore_read_only = true);
|
||||||
Result CreateDirectoryRecursively(const FsPath& path, bool ignore_read_only = true);
|
Result CreateDirectoryRecursively(const FsPath& path, bool ignore_read_only = true);
|
||||||
Result CreateDirectoryRecursivelyWithPath(const FsPath& path, bool ignore_read_only = true);
|
Result CreateDirectoryRecursivelyWithPath(const FsPath& path, bool ignore_read_only = true);
|
||||||
Result DeleteFile(const FsPath& path, bool ignore_read_only = true);
|
Result DeleteFile(const FsPathReal& path, bool ignore_read_only = true);
|
||||||
Result DeleteDirectory(const FsPath& path, bool ignore_read_only = true);
|
Result DeleteDirectory(const FsPathReal& path, bool ignore_read_only = true);
|
||||||
Result DeleteDirectoryRecursively(const FsPath& path, bool ignore_read_only = true);
|
Result DeleteDirectoryRecursively(const FsPath& path, bool ignore_read_only = true);
|
||||||
Result RenameFile(const FsPath& src, const FsPath& dst, bool ignore_read_only = true);
|
Result RenameFile(const FsPathReal& src, const FsPathReal& dst, bool ignore_read_only = true);
|
||||||
Result RenameDirectory(const FsPath& src, const FsPath& dst, bool ignore_read_only = true);
|
Result RenameDirectory(const FsPathReal& src, const FsPathReal& dst, bool ignore_read_only = true);
|
||||||
Result GetEntryType(const FsPath& path, FsDirEntryType* out);
|
Result GetEntryType(const FsPathReal& path, FsDirEntryType* out);
|
||||||
Result GetFileTimeStampRaw(const FsPath& path, FsTimeStampRaw *out);
|
Result GetFileTimeStampRaw(const FsPathReal& path, FsTimeStampRaw *out);
|
||||||
Result SetTimestamp(const FsPath& path, const FsTimeStampRaw* ts);
|
Result SetTimestamp(const FsPathReal& path, const FsTimeStampRaw* ts);
|
||||||
bool FileExists(const FsPath& path);
|
bool FileExists(const FsPath& path);
|
||||||
bool DirExists(const FsPath& path);
|
bool DirExists(const FsPath& path);
|
||||||
Result read_entire_file(const FsPath& path, std::vector<u8>& out);
|
|
||||||
Result write_entire_file(const FsPath& path, const std::vector<u8>& in, bool ignore_read_only = true);
|
|
||||||
Result copy_entire_file(const FsPath& dst, const FsPath& src, bool ignore_read_only = true);
|
|
||||||
|
|
||||||
Result OpenFile(fs::Fs* fs, const fs::FsPath& path, u32 mode, File* f);
|
Result OpenFile(fs::Fs* fs, const FsPathReal& path, u32 mode, File* f);
|
||||||
Result OpenDirectory(fs::Fs* fs, const fs::FsPath& path, u32 mode, Dir* d);
|
Result OpenDirectory(fs::Fs* fs, const FsPathReal& path, u32 mode, Dir* d);
|
||||||
|
|
||||||
// opens dir, fetches count for all entries.
|
// opens dir, fetches count for all entries.
|
||||||
// NOTE: this function will be slow on non-native fs, due to multiple
|
// NOTE: this function will be slow on non-native fs, due to multiple
|
||||||
@@ -260,23 +318,12 @@ Result DirGetEntryCount(fs::Fs* fs, const fs::FsPath& path, s64* file_count, s64
|
|||||||
Result FileGetSizeAndTimestamp(fs::Fs* fs, const FsPath& path, FsTimeStampRaw* ts, s64* size);
|
Result FileGetSizeAndTimestamp(fs::Fs* fs, const FsPath& path, FsTimeStampRaw* ts, s64* size);
|
||||||
Result IsDirEmpty(fs::Fs* m_fs, const fs::FsPath& path, bool* out);
|
Result IsDirEmpty(fs::Fs* m_fs, const fs::FsPath& path, bool* out);
|
||||||
|
|
||||||
struct Fs {
|
// helpers.
|
||||||
static constexpr inline u32 FsModule = 505;
|
Result read_entire_file(Fs* fs, const FsPath& path, std::vector<u8>& out);
|
||||||
static constexpr inline Result ResultTooManyEntries = MAKERESULT(FsModule, 1);
|
Result write_entire_file(Fs* fs, const FsPath& path, std::span<const u8> in, bool ignore_read_only = true);
|
||||||
static constexpr inline Result ResultNewPathTooLarge = MAKERESULT(FsModule, 2);
|
Result copy_entire_file(Fs* fs, const FsPath& dst, const FsPath& src, bool ignore_read_only = true);
|
||||||
static constexpr inline Result ResultInvalidType = MAKERESULT(FsModule, 3);
|
|
||||||
static constexpr inline Result ResultEmpty = MAKERESULT(FsModule, 4);
|
|
||||||
static constexpr inline Result ResultAlreadyRoot = MAKERESULT(FsModule, 5);
|
|
||||||
static constexpr inline Result ResultNoCurrentPath = MAKERESULT(FsModule, 6);
|
|
||||||
static constexpr inline Result ResultBrokenCurrentPath = MAKERESULT(FsModule, 7);
|
|
||||||
static constexpr inline Result ResultIndexOutOfBounds = MAKERESULT(FsModule, 8);
|
|
||||||
static constexpr inline Result ResultFsNotActive = MAKERESULT(FsModule, 9);
|
|
||||||
static constexpr inline Result ResultNewPathEmpty = MAKERESULT(FsModule, 10);
|
|
||||||
static constexpr inline Result ResultLoadingCancelled = MAKERESULT(FsModule, 11);
|
|
||||||
static constexpr inline Result ResultBrokenRoot = MAKERESULT(FsModule, 12);
|
|
||||||
static constexpr inline Result ResultUnknownStdioError = MAKERESULT(FsModule, 13);
|
|
||||||
static constexpr inline Result ResultReadOnly = MAKERESULT(FsModule, 14);
|
|
||||||
|
|
||||||
|
struct Fs {
|
||||||
Fs(bool ignore_read_only = true) : m_ignore_read_only{ignore_read_only} {}
|
Fs(bool ignore_read_only = true) : m_ignore_read_only{ignore_read_only} {}
|
||||||
virtual ~Fs() = default;
|
virtual ~Fs() = default;
|
||||||
|
|
||||||
@@ -292,13 +339,12 @@ struct Fs {
|
|||||||
virtual Result GetEntryType(const FsPath& path, FsDirEntryType* out) = 0;
|
virtual Result GetEntryType(const FsPath& path, FsDirEntryType* out) = 0;
|
||||||
virtual Result GetFileTimeStampRaw(const FsPath& path, FsTimeStampRaw *out) = 0;
|
virtual Result GetFileTimeStampRaw(const FsPath& path, FsTimeStampRaw *out) = 0;
|
||||||
virtual Result SetTimestamp(const FsPath& path, const FsTimeStampRaw* ts) = 0;
|
virtual Result SetTimestamp(const FsPath& path, const FsTimeStampRaw* ts) = 0;
|
||||||
|
virtual Result Commit() = 0;
|
||||||
virtual bool FileExists(const FsPath& path) = 0;
|
virtual bool FileExists(const FsPath& path) = 0;
|
||||||
virtual bool DirExists(const FsPath& path) = 0;
|
virtual bool DirExists(const FsPath& path) = 0;
|
||||||
virtual bool IsNative() const = 0;
|
virtual bool IsNative() const = 0;
|
||||||
|
virtual bool IsSd() const { return false; }
|
||||||
virtual FsPath Root() const { return "/"; }
|
virtual FsPath Root() const { return "/"; }
|
||||||
virtual Result read_entire_file(const FsPath& path, std::vector<u8>& out) = 0;
|
|
||||||
virtual Result write_entire_file(const FsPath& path, const std::vector<u8>& in) = 0;
|
|
||||||
virtual Result copy_entire_file(const FsPath& dst, const FsPath& src) = 0;
|
|
||||||
|
|
||||||
Result OpenFile(const fs::FsPath& path, u32 mode, File* f) {
|
Result OpenFile(const fs::FsPath& path, u32 mode, File* f) {
|
||||||
return fs::OpenFile(this, path, mode, f);
|
return fs::OpenFile(this, path, mode, f);
|
||||||
@@ -318,6 +364,15 @@ struct Fs {
|
|||||||
Result IsDirEmpty(const fs::FsPath& path, bool* out) {
|
Result IsDirEmpty(const fs::FsPath& path, bool* out) {
|
||||||
return fs::IsDirEmpty(this, path, out);
|
return fs::IsDirEmpty(this, path, out);
|
||||||
}
|
}
|
||||||
|
Result read_entire_file(const FsPath& path, std::vector<u8>& out) {
|
||||||
|
return fs::read_entire_file(this, path, out);
|
||||||
|
}
|
||||||
|
Result write_entire_file(const FsPath& path, std::span<const u8> in) {
|
||||||
|
return fs::write_entire_file(this, path, in, m_ignore_read_only);
|
||||||
|
}
|
||||||
|
Result copy_entire_file(const FsPath& dst, const FsPath& src) {
|
||||||
|
return fs::copy_entire_file(this, dst, src, m_ignore_read_only);
|
||||||
|
}
|
||||||
|
|
||||||
void SetIgnoreReadOnly(bool enable) {
|
void SetIgnoreReadOnly(bool enable) {
|
||||||
m_ignore_read_only = enable;
|
m_ignore_read_only = enable;
|
||||||
@@ -367,6 +422,9 @@ struct FsStdio : Fs {
|
|||||||
Result SetTimestamp(const FsPath& path, const FsTimeStampRaw *ts) override {
|
Result SetTimestamp(const FsPath& path, const FsTimeStampRaw *ts) override {
|
||||||
return fs::SetTimestamp(path, ts);
|
return fs::SetTimestamp(path, ts);
|
||||||
}
|
}
|
||||||
|
Result Commit() override {
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
bool FileExists(const FsPath& path) override {
|
bool FileExists(const FsPath& path) override {
|
||||||
return fs::FileExists(path);
|
return fs::FileExists(path);
|
||||||
}
|
}
|
||||||
@@ -379,15 +437,6 @@ struct FsStdio : Fs {
|
|||||||
FsPath Root() const override {
|
FsPath Root() const override {
|
||||||
return m_root;
|
return m_root;
|
||||||
}
|
}
|
||||||
Result read_entire_file(const FsPath& path, std::vector<u8>& out) override {
|
|
||||||
return fs::read_entire_file(path, out);
|
|
||||||
}
|
|
||||||
Result write_entire_file(const FsPath& path, const std::vector<u8>& in) override {
|
|
||||||
return fs::write_entire_file(path, in, m_ignore_read_only);
|
|
||||||
}
|
|
||||||
Result copy_entire_file(const FsPath& dst, const FsPath& src) override {
|
|
||||||
return fs::copy_entire_file(dst, src, m_ignore_read_only);
|
|
||||||
}
|
|
||||||
|
|
||||||
const FsPath m_root;
|
const FsPath m_root;
|
||||||
};
|
};
|
||||||
@@ -402,10 +451,6 @@ struct FsNative : Fs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result Commit() {
|
|
||||||
return fsFsCommit(&m_fs);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result GetFreeSpace(const FsPath& path, s64* out) {
|
Result GetFreeSpace(const FsPath& path, s64* out) {
|
||||||
return fsFsGetFreeSpace(&m_fs, path, out);
|
return fsFsGetFreeSpace(&m_fs, path, out);
|
||||||
}
|
}
|
||||||
@@ -414,36 +459,6 @@ struct FsNative : Fs {
|
|||||||
return fsFsGetTotalSpace(&m_fs, path, out);
|
return fsFsGetTotalSpace(&m_fs, path, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Result OpenDirectory(const FsPath& path, u32 mode, FsDir *out) {
|
|
||||||
// return fsFsOpenDirectory(&m_fs, path, mode, out);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void DirClose(FsDir *d) {
|
|
||||||
// fsDirClose(d);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Result DirGetEntryCount(FsDir *d, s64* out) {
|
|
||||||
// return fsDirGetEntryCount(d, out);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Result DirGetEntryCount(const FsPath& path, u32 mode, s64* out) {
|
|
||||||
// FsDir d;
|
|
||||||
// R_TRY(OpenDirectory(path, mode, &d));
|
|
||||||
// ON_SCOPE_EXIT(DirClose(&d));
|
|
||||||
// return DirGetEntryCount(&d, out);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Result DirRead(FsDir *d, s64 *total_entries, size_t max_entries, FsDirectoryEntry *buf) {
|
|
||||||
// return fsDirRead(d, total_entries, max_entries, buf);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Result DirRead(const FsPath& path, u32 mode, s64 *total_entries, size_t max_entries, FsDirectoryEntry *buf) {
|
|
||||||
// FsDir d;
|
|
||||||
// R_TRY(OpenDirectory(path, mode, &d));
|
|
||||||
// ON_SCOPE_EXIT(DirClose(&d));
|
|
||||||
// return DirRead(&d, total_entries, max_entries, buf);
|
|
||||||
// }
|
|
||||||
|
|
||||||
virtual bool IsFsActive() {
|
virtual bool IsFsActive() {
|
||||||
return serviceIsActive(&m_fs.s);
|
return serviceIsActive(&m_fs.s);
|
||||||
}
|
}
|
||||||
@@ -488,6 +503,9 @@ struct FsNative : Fs {
|
|||||||
Result SetTimestamp(const FsPath& path, const FsTimeStampRaw *ts) override {
|
Result SetTimestamp(const FsPath& path, const FsTimeStampRaw *ts) override {
|
||||||
return fs::SetTimestamp(&m_fs, path, ts);
|
return fs::SetTimestamp(&m_fs, path, ts);
|
||||||
}
|
}
|
||||||
|
Result Commit() override {
|
||||||
|
return fsFsCommit(&m_fs);
|
||||||
|
}
|
||||||
bool FileExists(const FsPath& path) override {
|
bool FileExists(const FsPath& path) override {
|
||||||
return fs::FileExists(&m_fs, path);
|
return fs::FileExists(&m_fs, path);
|
||||||
}
|
}
|
||||||
@@ -497,19 +515,10 @@ struct FsNative : Fs {
|
|||||||
bool IsNative() const override {
|
bool IsNative() const override {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Result read_entire_file(const FsPath& path, std::vector<u8>& out) override {
|
|
||||||
return fs::read_entire_file(&m_fs, path, out);
|
|
||||||
}
|
|
||||||
Result write_entire_file(const FsPath& path, const std::vector<u8>& in) override {
|
|
||||||
return fs::write_entire_file(&m_fs, path, in, m_ignore_read_only);
|
|
||||||
}
|
|
||||||
Result copy_entire_file(const FsPath& dst, const FsPath& src) override {
|
|
||||||
return fs::copy_entire_file(&m_fs, dst, src, m_ignore_read_only);
|
|
||||||
}
|
|
||||||
|
|
||||||
FsFileSystem m_fs{};
|
FsFileSystem m_fs{};
|
||||||
Result m_open_result{};
|
Result m_open_result{};
|
||||||
bool m_own{true};
|
const bool m_own{true};
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -523,31 +532,53 @@ struct FsNativeSd final : FsNative {
|
|||||||
FsNativeSd(bool ignore_read_only = true) : FsNative{fsdevGetDeviceFileSystem("sdmc:"), false, ignore_read_only} {
|
FsNativeSd(bool ignore_read_only = true) : FsNative{fsdevGetDeviceFileSystem("sdmc:"), false, ignore_read_only} {
|
||||||
m_open_result = 0;
|
m_open_result = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsSd() const override { return true; }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct FsNativeBis final : FsNative {
|
struct FsNativeBis final : FsNative {
|
||||||
FsNativeBis(FsBisPartitionId id, const FsPath& string, bool ignore_read_only = true) : FsNative{ignore_read_only} {
|
FsNativeBis(FsBisPartitionId id, const FsPath& string) {
|
||||||
m_open_result = fsOpenBisFileSystem(&m_fs, id, string);
|
m_open_result = fsOpenBisFileSystem(&m_fs, id, string);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FsNativeImage final : FsNative {
|
struct FsNativeImage final : FsNative {
|
||||||
FsNativeImage(FsImageDirectoryId id, bool ignore_read_only = true) : FsNative{ignore_read_only} {
|
FsNativeImage(FsImageDirectoryId id) {
|
||||||
m_open_result = fsOpenImageDirectoryFileSystem(&m_fs, id);
|
m_open_result = fsOpenImageDirectoryFileSystem(&m_fs, id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FsNativeContentStorage final : FsNative {
|
struct FsNativeContentStorage final : FsNative {
|
||||||
FsNativeContentStorage(FsContentStorageId id, bool ignore_read_only = true) : FsNative{ignore_read_only} {
|
FsNativeContentStorage(FsContentStorageId id) {
|
||||||
m_open_result = fsOpenContentStorageFileSystem(&m_fs, id);
|
m_open_result = fsOpenContentStorageFileSystem(&m_fs, id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FsNativeGameCard final : FsNative {
|
struct FsNativeGameCard final : FsNative {
|
||||||
FsNativeGameCard(const FsGameCardHandle* handle, FsGameCardPartition partition, bool ignore_read_only = true) : FsNative{ignore_read_only} {
|
FsNativeGameCard(const FsGameCardHandle* handle, FsGameCardPartition partition) {
|
||||||
m_open_result = fsOpenGameCardFileSystem(&m_fs, handle, partition);
|
m_open_result = fsOpenGameCardFileSystem(&m_fs, handle, partition);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FsNativeSave final : FsNative {
|
||||||
|
FsNativeSave(FsSaveDataType data_type, FsSaveDataSpaceId save_data_space_id, const FsSaveDataAttribute *attr, bool read_only) {
|
||||||
|
if (data_type == FsSaveDataType_System || data_type == FsSaveDataType_SystemBcat) {
|
||||||
|
m_open_result = fsOpenSaveDataFileSystemBySystemSaveDataId(&m_fs, FsSaveDataSpaceId_System, attr);
|
||||||
|
} else {
|
||||||
|
if (read_only) {
|
||||||
|
m_open_result = fsOpenReadOnlySaveDataFileSystem(&m_fs, save_data_space_id, attr);
|
||||||
|
} else {
|
||||||
|
m_open_result = fsOpenSaveDataFileSystem(&m_fs, save_data_space_id, attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FsNativeId final : FsNative {
|
||||||
|
FsNativeId(u64 program_id, FsFileSystemType type, const FsPath& path, FsContentAttributes attr = FsContentAttributes_All) {
|
||||||
|
m_open_result = fsOpenFileSystemWithId(&m_fs, program_id, type, path, attr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace fs
|
} // namespace fs
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ namespace sphaira::ftpsrv {
|
|||||||
|
|
||||||
bool Init();
|
bool Init();
|
||||||
void Exit();
|
void Exit();
|
||||||
|
void ExitSignal();
|
||||||
|
|
||||||
using OnInstallStart = std::function<bool(void* user, const char* path)>;
|
using OnInstallStart = std::function<bool(const char* path)>;
|
||||||
using OnInstallWrite = std::function<bool(void* user, const void* buf, size_t size)>;
|
using OnInstallWrite = std::function<bool(const void* buf, size_t size)>;
|
||||||
using OnInstallClose = std::function<void(void* user)>;
|
using OnInstallClose = std::function<void()>;
|
||||||
|
|
||||||
void InitInstallMode(void* user, OnInstallStart on_start, OnInstallWrite on_write, OnInstallClose on_close);
|
void InitInstallMode(const OnInstallStart& on_start, const OnInstallWrite& on_write, const OnInstallClose& on_close);
|
||||||
void DisableInstallMode();
|
void DisableInstallMode();
|
||||||
|
|
||||||
unsigned GetPort();
|
unsigned GetPort();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "ui/progress_box.hpp"
|
#include "ui/progress_box.hpp"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <span>
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
namespace sphaira::hash {
|
namespace sphaira::hash {
|
||||||
@@ -13,6 +14,7 @@ enum class Type {
|
|||||||
Md5,
|
Md5,
|
||||||
Sha1,
|
Sha1,
|
||||||
Sha256,
|
Sha256,
|
||||||
|
Null,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BaseSource {
|
struct BaseSource {
|
||||||
@@ -24,7 +26,8 @@ struct BaseSource {
|
|||||||
auto GetTypeStr(Type type) -> const char*;
|
auto GetTypeStr(Type type) -> const char*;
|
||||||
|
|
||||||
// returns the hash string.
|
// returns the hash string.
|
||||||
Result Hash(ui::ProgressBox* pbox, Type type, std::shared_ptr<BaseSource> source, std::string& out);
|
Result Hash(ui::ProgressBox* pbox, Type type, BaseSource* source, std::string& out);
|
||||||
Result Hash(ui::ProgressBox* pbox, Type type, fs::Fs* fs, const fs::FsPath& path, std::string& out);
|
Result Hash(ui::ProgressBox* pbox, Type type, fs::Fs* fs, const fs::FsPath& path, std::string& out);
|
||||||
|
Result Hash(ui::ProgressBox* pbox, Type type, std::span<const u8> data, std::string& out);
|
||||||
|
|
||||||
} // namespace sphaira::hash
|
} // namespace sphaira::hash
|
||||||
|
|||||||
18
sphaira/include/haze_helper.hpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace sphaira::libhaze {
|
||||||
|
|
||||||
|
bool Init();
|
||||||
|
bool IsInit();
|
||||||
|
void Exit();
|
||||||
|
|
||||||
|
using OnInstallStart = std::function<bool(const char* path)>;
|
||||||
|
using OnInstallWrite = std::function<bool(const void* buf, size_t size)>;
|
||||||
|
using OnInstallClose = std::function<void()>;
|
||||||
|
|
||||||
|
void InitInstallMode(const OnInstallStart& on_start, const OnInstallWrite& on_write, const OnInstallClose& on_close);
|
||||||
|
void DisableInstallMode();
|
||||||
|
|
||||||
|
} // namespace sphaira::libhaze
|
||||||
@@ -5,10 +5,21 @@
|
|||||||
|
|
||||||
namespace sphaira::i18n {
|
namespace sphaira::i18n {
|
||||||
|
|
||||||
|
enum class WordOrder {
|
||||||
|
PhraseName, // default: SVO (English, French, German, etc.)
|
||||||
|
NamePhrase // SOV (Japanese, Korean)
|
||||||
|
};
|
||||||
|
|
||||||
bool init(long index);
|
bool init(long index);
|
||||||
void exit();
|
void exit();
|
||||||
|
|
||||||
std::string get(std::string_view str);
|
std::string get(std::string_view str);
|
||||||
|
std::string get(std::string_view str, std::string_view fallback);
|
||||||
|
|
||||||
|
WordOrder GetWordOrder();
|
||||||
|
bool WordOrderLocale();
|
||||||
|
|
||||||
|
std::string Reorder(std::string_view phrase, std::string_view name);
|
||||||
|
|
||||||
} // namespace sphaira::i18n
|
} // namespace sphaira::i18n
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,14 @@ struct ImageResult {
|
|||||||
int w, h;
|
int w, h;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto ImageLoadFromMemory(std::span<const u8> data) -> ImageResult;
|
enum ImageFlag {
|
||||||
auto ImageLoadFromFile(const fs::FsPath& file) -> ImageResult;
|
ImageFlag_None = 0,
|
||||||
|
// set this if the image is a jpeg, will use oss-nvjpg to load.
|
||||||
|
ImageFlag_JPEG = 1 << 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
auto ImageLoadFromMemory(std::span<const u8> data, u32 flags = ImageFlag_None) -> ImageResult;
|
||||||
|
auto ImageLoadFromFile(const fs::FsPath& file, u32 flags = ImageFlag_None) -> ImageResult;
|
||||||
auto ImageResize(std::span<const u8> data, int inx, int iny, int outx, int outy) -> ImageResult;
|
auto ImageResize(std::span<const u8> data, int inx, int iny, int outx, int outy) -> ImageResult;
|
||||||
auto ImageConvertToJpg(std::span<const u8> data, int x, int y) -> ImageResult;
|
auto ImageConvertToJpg(std::span<const u8> data, int x, int y) -> ImageResult;
|
||||||
|
|
||||||
|
|||||||
@@ -3,23 +3,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
// to import FsEntryFlags.
|
||||||
|
// todo: this should be part of a smaller header, such as filesystem_types.hpp
|
||||||
|
#include "ui/menus/filebrowser.hpp"
|
||||||
|
|
||||||
namespace sphaira::location {
|
namespace sphaira::location {
|
||||||
|
|
||||||
struct Entry {
|
using FsEntryFlag = ui::menu::filebrowser::FsEntryFlag;
|
||||||
std::string name{};
|
|
||||||
std::string url{};
|
|
||||||
std::string user{};
|
|
||||||
std::string pass{};
|
|
||||||
std::string bearer{};
|
|
||||||
std::string pub_key{};
|
|
||||||
std::string priv_key{};
|
|
||||||
u16 port{};
|
|
||||||
};
|
|
||||||
using Entries = std::vector<Entry>;
|
|
||||||
|
|
||||||
auto Load() -> Entries;
|
|
||||||
void Add(const Entry& e);
|
|
||||||
|
|
||||||
// helper for hdd devices.
|
// helper for hdd devices.
|
||||||
// this doesn't really belong in this header, however
|
// this doesn't really belong in this header, however
|
||||||
@@ -29,8 +19,14 @@ struct StdioEntry {
|
|||||||
std::string mount{};
|
std::string mount{};
|
||||||
// ums0: (USB Flash Disk)
|
// ums0: (USB Flash Disk)
|
||||||
std::string name{};
|
std::string name{};
|
||||||
// set if read-only.
|
// FsEntryFlag
|
||||||
bool write_protect;
|
u32 flags{};
|
||||||
|
// optional dump path inside the mount point.
|
||||||
|
std::string dump_path{};
|
||||||
|
// set to hide for filebrowser.
|
||||||
|
bool fs_hidden{};
|
||||||
|
// set to hide in dump list.
|
||||||
|
bool dump_hidden{};
|
||||||
};
|
};
|
||||||
|
|
||||||
using StdioEntries = std::vector<StdioEntry>;
|
using StdioEntries = std::vector<StdioEntry>;
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ extern "C" {
|
|||||||
bool log_file_init();
|
bool log_file_init();
|
||||||
bool log_nxlink_init();
|
bool log_nxlink_init();
|
||||||
void log_file_exit();
|
void log_file_exit();
|
||||||
|
bool log_is_init();
|
||||||
|
|
||||||
void log_nxlink_exit();
|
void log_nxlink_exit();
|
||||||
void log_write(const char* s, ...) __attribute__ ((format (printf, 1, 2)));
|
void log_write(const char* s, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
void log_write_arg(const char* s, va_list* v);
|
void log_write_arg(const char* s, va_list* v);
|
||||||
|
|||||||
32
sphaira/include/minizip_helper.hpp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <minizip/ioapi.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <span>
|
||||||
|
#include <switch.h>
|
||||||
|
#include "fs.hpp"
|
||||||
|
|
||||||
|
namespace sphaira::mz {
|
||||||
|
|
||||||
|
struct MzMem {
|
||||||
|
std::vector<u8> buf;
|
||||||
|
size_t offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MzSpan {
|
||||||
|
std::span<const u8> buf;
|
||||||
|
size_t offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
void FileFuncMem(MzMem* mem, zlib_filefunc64_def* funcs);
|
||||||
|
void FileFuncSpan(MzSpan* span, zlib_filefunc64_def* funcs);
|
||||||
|
void FileFuncStdio(zlib_filefunc64_def* funcs);
|
||||||
|
void FileFuncNative(zlib_filefunc64_def* funcs);
|
||||||
|
|
||||||
|
// minizip takes 18ms to open a zip and 4ms to parse the first file entry.
|
||||||
|
// this results in a dropped frame.
|
||||||
|
// this version simply reads the local header + file name in 2 reads,
|
||||||
|
// which takes 1-2ms.
|
||||||
|
Result PeekFirstFileName(fs::Fs* fs, const fs::FsPath& path, fs::FsPath& name);
|
||||||
|
|
||||||
|
} // namespace sphaira::mz
|
||||||
@@ -9,8 +9,14 @@
|
|||||||
|
|
||||||
namespace sphaira {
|
namespace sphaira {
|
||||||
|
|
||||||
|
struct NroData {
|
||||||
|
NroStart start;
|
||||||
|
NroHeader header;
|
||||||
|
};
|
||||||
|
|
||||||
struct Hbini {
|
struct Hbini {
|
||||||
u64 timestamp{}; // timestamp of last launch
|
u64 timestamp{}; // timestamp of last launch
|
||||||
|
bool hidden{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MiniNacp {
|
struct MiniNacp {
|
||||||
@@ -61,7 +67,7 @@ auto nro_parse(const fs::FsPath& path, NroEntry& entry) -> Result;
|
|||||||
* nro found.
|
* nro found.
|
||||||
* this does nothing if nested=false.
|
* this does nothing if nested=false.
|
||||||
*/
|
*/
|
||||||
auto nro_scan(const fs::FsPath& path, std::vector<NroEntry>& nros, bool hide_spahira, bool nested = true, bool scan_all_dir = true) -> Result;
|
auto nro_scan(const fs::FsPath& path, std::vector<NroEntry>& nros, bool nested = true, bool scan_all_dir = true) -> Result;
|
||||||
|
|
||||||
auto nro_get_icon(const fs::FsPath& path, u64 size, u64 offset) -> std::vector<u8>;
|
auto nro_get_icon(const fs::FsPath& path, u64 size, u64 offset) -> std::vector<u8>;
|
||||||
auto nro_get_icon(const fs::FsPath& path) -> std::vector<u8>;
|
auto nro_get_icon(const fs::FsPath& path) -> std::vector<u8>;
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ bool nxlinkInitialize(NxlinkCallback callback);
|
|||||||
// signal for the event to close and then join the thread.
|
// signal for the event to close and then join the thread.
|
||||||
void nxlinkExit();
|
void nxlinkExit();
|
||||||
|
|
||||||
|
// async the exit, call this first and then call exit later to avoid blocking.
|
||||||
|
void nxlinkSignalExit();
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -7,10 +7,11 @@ namespace sphaira::option {
|
|||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct OptionBase {
|
struct OptionBase {
|
||||||
OptionBase(const std::string& section, const std::string& name, T default_value)
|
OptionBase(const std::string& section, const std::string& name, T default_value, bool file = true)
|
||||||
: m_section{section}
|
: m_section{section}
|
||||||
, m_name{name}
|
, m_name{name}
|
||||||
, m_default_value{default_value}
|
, m_default_value{default_value}
|
||||||
|
, m_file{file}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
auto Get() -> T;
|
auto Get() -> T;
|
||||||
@@ -29,11 +30,13 @@ private:
|
|||||||
const std::string m_section;
|
const std::string m_section;
|
||||||
const std::string m_name;
|
const std::string m_name;
|
||||||
const T m_default_value;
|
const T m_default_value;
|
||||||
|
const bool m_file;
|
||||||
std::optional<T> m_value;
|
std::optional<T> m_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
using OptionBool = OptionBase<bool>;
|
using OptionBool = OptionBase<bool>;
|
||||||
using OptionLong = OptionBase<long>;
|
using OptionLong = OptionBase<long>;
|
||||||
|
using OptionFloat = OptionBase<float>;
|
||||||
using OptionString = OptionBase<std::string>;
|
using OptionString = OptionBase<std::string>;
|
||||||
|
|
||||||
} // namespace sphaira::option
|
} // namespace sphaira::option
|
||||||
|
|||||||
@@ -20,17 +20,6 @@ struct OwoConfig {
|
|||||||
std::vector<u8> program_nca{};
|
std::vector<u8> program_nca{};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
Module_Owo = 424,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum OwoError {
|
|
||||||
OwoError_BadArgs = MAKERESULT(Module_Owo, 1),
|
|
||||||
};
|
|
||||||
|
|
||||||
// fwd
|
|
||||||
// struct ui::ProgressBox;
|
|
||||||
|
|
||||||
auto install_forwarder(OwoConfig& config, NcmStorageId storage_id) -> Result;
|
auto install_forwarder(OwoConfig& config, NcmStorageId storage_id) -> Result;
|
||||||
auto install_forwarder(ui::ProgressBox* pbox, OwoConfig& config, NcmStorageId storage_id) -> Result;
|
auto install_forwarder(ui::ProgressBox* pbox, OwoConfig& config, NcmStorageId storage_id) -> Result;
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sys/syslimits.h>
|
||||||
|
|
||||||
namespace sphaira::swkbd {
|
namespace sphaira::swkbd {
|
||||||
|
|
||||||
Result ShowText(std::string& out, const char* guide = nullptr, const char* initial = nullptr, s64 len_min = -1, s64 len_max = FS_MAX_PATH);
|
Result ShowText(std::string& out, const char* header = nullptr, const char* guide = nullptr, const char* initial = nullptr, s64 len_min = -1, s64 len_max = PATH_MAX);
|
||||||
Result ShowNumPad(s64& out, const char* guide = nullptr, const char* initial = nullptr, s64 len_min = -1, s64 len_max = FS_MAX_PATH);
|
Result ShowNumPad(s64& out, const char* header = nullptr, const char* guide = nullptr, const char* initial = nullptr, s64 len_min = -1, s64 len_max = PATH_MAX);
|
||||||
|
|
||||||
} // namespace sphaira::swkbd
|
} // namespace sphaira::swkbd
|
||||||
|
|||||||
@@ -6,7 +6,19 @@
|
|||||||
|
|
||||||
namespace sphaira::thread {
|
namespace sphaira::thread {
|
||||||
|
|
||||||
|
enum class Mode {
|
||||||
|
// default, always multi-thread.
|
||||||
|
MultiThreaded,
|
||||||
|
// always single-thread.
|
||||||
|
SingleThreaded,
|
||||||
|
// check buffer size, if smaller, single thread.
|
||||||
|
SingleThreadedIfSmaller,
|
||||||
|
};
|
||||||
|
|
||||||
|
using DecompressWriteCallback = std::function<Result(const void* data, s64 size)>;
|
||||||
|
|
||||||
using ReadCallback = std::function<Result(void* data, s64 off, s64 size, u64* bytes_read)>;
|
using ReadCallback = std::function<Result(void* data, s64 off, s64 size, u64* bytes_read)>;
|
||||||
|
using DecompressCallback = std::function<Result(void* data, s64 off, s64 size, const DecompressWriteCallback& callback)>;
|
||||||
using WriteCallback = std::function<Result(const void* data, s64 off, s64 size)>;
|
using WriteCallback = std::function<Result(const void* data, s64 off, s64 size)>;
|
||||||
|
|
||||||
// used for pull api
|
// used for pull api
|
||||||
@@ -23,10 +35,26 @@ using StartCallback = std::function<Result(PullCallback pull)>;
|
|||||||
using StartCallback2 = std::function<Result(StartThreadCallback start, PullCallback pull)>;
|
using StartCallback2 = std::function<Result(StartThreadCallback start, PullCallback pull)>;
|
||||||
|
|
||||||
// reads data from rfunc into wfunc.
|
// reads data from rfunc into wfunc.
|
||||||
Result Transfer(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, WriteCallback wfunc);
|
Result Transfer(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const WriteCallback& wfunc, Mode mode = Mode::MultiThreaded);
|
||||||
|
Result Transfer(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const DecompressCallback& dfunc, const WriteCallback& wfunc, Mode mode = Mode::MultiThreaded);
|
||||||
|
|
||||||
// reads data from rfunc, pull data from provided pull() callback.
|
// reads data from rfunc, pull data from provided pull() callback.
|
||||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, StartCallback sfunc);
|
Result TransferPull(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const StartCallback& sfunc, Mode mode = Mode::MultiThreaded);
|
||||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, StartCallback2 sfunc);
|
Result TransferPull(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const StartCallback2& sfunc, Mode mode = Mode::MultiThreaded);
|
||||||
|
|
||||||
|
// helper for extract zips.
|
||||||
|
// this will multi-thread unzip if size >= 512KiB, otherwise it'll single pass.
|
||||||
|
Result TransferUnzip(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs::FsPath& path, s64 size, u32 crc32 = 0, Mode mode = Mode::SingleThreadedIfSmaller);
|
||||||
|
|
||||||
|
// same as above but for zipping files.
|
||||||
|
Result TransferZip(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs::FsPath& path, u32* crc32 = nullptr, Mode mode = Mode::SingleThreadedIfSmaller);
|
||||||
|
|
||||||
|
// passes the name inside the zip an final output path.
|
||||||
|
using UnzipAllFilter = std::function<bool(const fs::FsPath& name, fs::FsPath& path)>;
|
||||||
|
|
||||||
|
// helper all-in-one unzip function that unzips a zip (either open or path provided).
|
||||||
|
// the filter function can be used to modify the path and filter out unwanted files.
|
||||||
|
Result TransferUnzipAll(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs::FsPath& base_path, const UnzipAllFilter& filter = nullptr, Mode mode = Mode::SingleThreadedIfSmaller);
|
||||||
|
Result TransferUnzipAll(ui::ProgressBox* pbox, const fs::FsPath& zip_out, fs::Fs* fs, const fs::FsPath& base_path, const UnzipAllFilter& filter = nullptr, Mode mode = Mode::SingleThreadedIfSmaller);
|
||||||
|
|
||||||
} // namespace sphaira::thread
|
} // namespace sphaira::thread
|
||||||
|
|||||||
83
sphaira/include/title_info.hpp
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "fs.hpp"
|
||||||
|
#include <optional>
|
||||||
|
#include <span>
|
||||||
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
#include <functional>
|
||||||
|
#include <switch.h>
|
||||||
|
|
||||||
|
namespace sphaira::title {
|
||||||
|
|
||||||
|
constexpr u32 ContentMetaTypeToContentFlag(u8 meta_type) {
|
||||||
|
if (meta_type & 0x80) {
|
||||||
|
return 1 << (meta_type - 0x80);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ContentFlag {
|
||||||
|
ContentFlag_Application = ContentMetaTypeToContentFlag(NcmContentMetaType_Application),
|
||||||
|
ContentFlag_Patch = ContentMetaTypeToContentFlag(NcmContentMetaType_Patch),
|
||||||
|
ContentFlag_AddOnContent = ContentMetaTypeToContentFlag(NcmContentMetaType_AddOnContent),
|
||||||
|
ContentFlag_DataPatch = ContentMetaTypeToContentFlag(NcmContentMetaType_DataPatch),
|
||||||
|
|
||||||
|
// nca locations where a control.nacp can exist.
|
||||||
|
ContentFlag_Nacp = ContentFlag_Application | ContentFlag_Patch,
|
||||||
|
// all of the above.
|
||||||
|
ContentFlag_All = ContentFlag_Application | ContentFlag_Patch | ContentFlag_AddOnContent | ContentFlag_DataPatch,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class NacpLoadStatus {
|
||||||
|
// not yet attempted to be loaded.
|
||||||
|
None,
|
||||||
|
// started loading.
|
||||||
|
Progress,
|
||||||
|
// loaded, ready to parse.
|
||||||
|
Loaded,
|
||||||
|
// failed to load, do not attempt to load again!
|
||||||
|
Error,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ThreadResultData {
|
||||||
|
u64 id{};
|
||||||
|
std::vector<u8> icon;
|
||||||
|
NacpLanguageEntry lang{};
|
||||||
|
NacpLoadStatus status{NacpLoadStatus::None};
|
||||||
|
};
|
||||||
|
|
||||||
|
using MetaEntries = std::vector<NsApplicationContentMetaStatus>;
|
||||||
|
|
||||||
|
// starts background thread (ref counted).
|
||||||
|
Result Init();
|
||||||
|
// closes the background thread.
|
||||||
|
void Exit();
|
||||||
|
// clears cache and empties the result array.
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
// adds new entry to queue.
|
||||||
|
void PushAsync(u64 app_id);
|
||||||
|
void PushAsync(const std::span<const NsApplicationRecord> app_ids);
|
||||||
|
// gets entry without removing it from the queue.
|
||||||
|
auto GetAsync(u64 app_id) -> ThreadResultData*;
|
||||||
|
// single threaded title info fetch.
|
||||||
|
auto Get(u64 app_id, bool* cached = nullptr) -> ThreadResultData*;
|
||||||
|
|
||||||
|
auto GetNcmCs(u8 storage_id) -> NcmContentStorage&;
|
||||||
|
auto GetNcmDb(u8 storage_id) -> NcmContentMetaDatabase&;
|
||||||
|
|
||||||
|
// gets all meta entries for an id.
|
||||||
|
Result GetMetaEntries(u64 id, MetaEntries& out, u32 flags = ContentFlag_All);
|
||||||
|
|
||||||
|
// returns the nca path of a control nca.
|
||||||
|
Result GetControlPathFromStatus(const NsApplicationContentMetaStatus& status, u64* out_program_id, fs::FsPath* out_path);
|
||||||
|
|
||||||
|
// taken from nxdumptool.
|
||||||
|
void utilsReplaceIllegalCharacters(char *str, bool ascii_only);
|
||||||
|
|
||||||
|
// /atmosphere/contents/xxx
|
||||||
|
auto GetContentsPath(u64 app_id) -> fs::FsPath;
|
||||||
|
|
||||||
|
} // namespace sphaira::title
|
||||||
@@ -16,6 +16,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::optional<Result> m_code{};
|
std::optional<Result> m_code{};
|
||||||
std::string m_message{};
|
std::string m_message{};
|
||||||
|
std::string m_code_message{};
|
||||||
|
std::string m_code_module{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sphaira::ui
|
} // namespace sphaira::ui
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ struct List final : Object {
|
|||||||
GRID,
|
GRID,
|
||||||
};
|
};
|
||||||
|
|
||||||
using Callback = std::function<void(NVGcontext* vg, Theme* theme, Vec4 v, s64 index)>;
|
using Callback = std::function<void(NVGcontext* vg, Theme* theme, const Vec4& v, s64 index)>;
|
||||||
using TouchCallback = std::function<void(bool touch, s64 index)>;
|
using TouchCallback = std::function<void(bool touch, s64 index)>;
|
||||||
|
|
||||||
List(s64 row, s64 page, const Vec4& pos, const Vec4& v, const Vec2& pad = {});
|
List(s64 row, s64 page, const Vec4& pos, const Vec4& v, const Vec2& pad = {});
|
||||||
|
|
||||||
void OnUpdate(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback);
|
void OnUpdate(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback);
|
||||||
|
|
||||||
void Draw(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const;
|
void Draw(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const;
|
||||||
|
|
||||||
auto SetScrollBarPos(float x, float y, float h) {
|
auto SetScrollBarPos(float x, float y, float h) {
|
||||||
m_scrollbar.x = x;
|
m_scrollbar.x = x;
|
||||||
@@ -73,10 +73,10 @@ private:
|
|||||||
auto ClampX(float x, s64 count) const -> float;
|
auto ClampX(float x, s64 count) const -> float;
|
||||||
auto ClampY(float y, s64 count) const -> float;
|
auto ClampY(float y, s64 count) const -> float;
|
||||||
|
|
||||||
void OnUpdateHome(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback);
|
void OnUpdateHome(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback);
|
||||||
void OnUpdateGrid(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback);
|
void OnUpdateGrid(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback);
|
||||||
void DrawHome(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const;
|
void DrawHome(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const;
|
||||||
void DrawGrid(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const;
|
void DrawGrid(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const s64 m_row;
|
const s64 m_row;
|
||||||
|
|||||||
@@ -86,14 +86,16 @@ struct EntryMenu final : MenuBase {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct Option {
|
struct Option {
|
||||||
Option(const std::string& dt, const std::string& ct, std::function<void(void)> f)
|
using Callback = std::function<void(void)>;
|
||||||
|
|
||||||
|
Option(const std::string& dt, const std::string& ct, const Callback& f)
|
||||||
: display_text{dt}, confirm_text{ct}, func{f} {}
|
: display_text{dt}, confirm_text{ct}, func{f} {}
|
||||||
Option(const std::string& dt, std::function<void(void)> f)
|
Option(const std::string& dt, const Callback& f)
|
||||||
: display_text{dt}, func{f} {}
|
: display_text{dt}, func{f} {}
|
||||||
|
|
||||||
std::string display_text{};
|
const std::string display_text;
|
||||||
std::string confirm_text{};
|
const std::string confirm_text;
|
||||||
std::function<void(void)> func{};
|
const Callback func{};
|
||||||
};
|
};
|
||||||
|
|
||||||
Entry& m_entry;
|
Entry& m_entry;
|
||||||
@@ -105,11 +107,14 @@ private:
|
|||||||
LazyImage m_banner{};
|
LazyImage m_banner{};
|
||||||
std::unique_ptr<List> m_list{};
|
std::unique_ptr<List> m_list{};
|
||||||
|
|
||||||
std::shared_ptr<ScrollableText> m_details{};
|
std::unique_ptr<ScrollableText> m_details{};
|
||||||
std::shared_ptr<ScrollableText> m_changelog{};
|
std::unique_ptr<ScrollableText> m_changelog{};
|
||||||
std::shared_ptr<ScrollableText> m_detail_changelog{};
|
ScrollableText* m_detail_changelog{};
|
||||||
|
std::unique_ptr<ScrollableText> m_manifest_list{};
|
||||||
|
|
||||||
bool m_show_changlog{};
|
bool m_show_changlog{};
|
||||||
|
bool m_show_file_list{};
|
||||||
|
ImageDownloadState m_file_list_state{};
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Filter {
|
enum Filter {
|
||||||
|
|||||||
19
sphaira/include/ui/menus/file_picker.hpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/menus/filebrowser.hpp"
|
||||||
|
|
||||||
|
namespace sphaira::ui::menu::filebrowser::picker {
|
||||||
|
|
||||||
|
using Callback = std::function<bool(const fs::FsPath& path)>;
|
||||||
|
|
||||||
|
struct Menu final : Base {
|
||||||
|
explicit Menu(const Callback& cb, const std::vector<std::string>& filter = {}, const fs::FsPath& path = {});
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnClick(FsView* view, const FsEntry& fs_entry, const FileEntry& entry, const fs::FsPath& path) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const Callback m_callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sphaira::ui::menu::filebrowser::picker
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
namespace sphaira::ui::menu::fileview {
|
namespace sphaira::ui::menu::fileview {
|
||||||
|
|
||||||
struct Menu final : MenuBase {
|
struct Menu final : MenuBase {
|
||||||
Menu(const fs::FsPath& path);
|
Menu(fs::Fs* fs, const fs::FsPath& path);
|
||||||
|
|
||||||
auto GetShortTitle() const -> const char* override { return "File"; };
|
auto GetShortTitle() const -> const char* override { return "File"; };
|
||||||
void Update(Controller* controller, TouchInfo* touch) override;
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
@@ -15,8 +15,8 @@ struct Menu final : MenuBase {
|
|||||||
void OnFocusGained() override;
|
void OnFocusGained() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
fs::Fs* const m_fs;
|
||||||
const fs::FsPath m_path;
|
const fs::FsPath m_path;
|
||||||
fs::FsNativeSd m_fs{};
|
|
||||||
fs::File m_file{};
|
fs::File m_file{};
|
||||||
s64 m_file_size{};
|
s64 m_file_size{};
|
||||||
s64 m_file_offset{};
|
s64 m_file_offset{};
|
||||||
|
|||||||
@@ -2,21 +2,48 @@
|
|||||||
|
|
||||||
#include "ui/menus/menu_base.hpp"
|
#include "ui/menus/menu_base.hpp"
|
||||||
#include "ui/scrolling_text.hpp"
|
#include "ui/scrolling_text.hpp"
|
||||||
|
#include "ui/progress_box.hpp"
|
||||||
#include "ui/list.hpp"
|
#include "ui/list.hpp"
|
||||||
#include "fs.hpp"
|
#include "fs.hpp"
|
||||||
#include "option.hpp"
|
#include "option.hpp"
|
||||||
#include "hasher.hpp"
|
#include "hasher.hpp"
|
||||||
// #include <optional>
|
#include "nro.hpp"
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
||||||
namespace sphaira::ui::menu::filebrowser {
|
namespace sphaira::ui::menu::filebrowser {
|
||||||
|
|
||||||
|
enum FsOption : u32 {
|
||||||
|
FsOption_NONE,
|
||||||
|
|
||||||
|
// can split screen.
|
||||||
|
FsOption_CanSplit = BIT(0),
|
||||||
|
// can selected multiple files.
|
||||||
|
FsOption_CanSelect = BIT(1),
|
||||||
|
// shows the option to install.
|
||||||
|
FsOption_CanInstall = BIT(2),
|
||||||
|
// loads file assoc.
|
||||||
|
FsOption_LoadAssoc = BIT(3),
|
||||||
|
// do not prompt on exit even if not tabbed.
|
||||||
|
FsOption_DoNotPrompt = BIT(4),
|
||||||
|
|
||||||
|
FsOption_Normal = FsOption_LoadAssoc | FsOption_CanInstall | FsOption_CanSplit | FsOption_CanSelect,
|
||||||
|
FsOption_All = FsOption_DoNotPrompt | FsOption_Normal,
|
||||||
|
FsOption_Picker = FsOption_NONE,
|
||||||
|
};
|
||||||
|
|
||||||
enum FsEntryFlag {
|
enum FsEntryFlag {
|
||||||
FsEntryFlag_None,
|
FsEntryFlag_None,
|
||||||
// write protected.
|
// write protected.
|
||||||
FsEntryFlag_ReadOnly = 1 << 0,
|
FsEntryFlag_ReadOnly = 1 << 0,
|
||||||
// supports file assoc.
|
// supports file assoc.
|
||||||
FsEntryFlag_Assoc = 1 << 1,
|
FsEntryFlag_Assoc = 1 << 1,
|
||||||
|
// this is an sd card, files can be launched from here.
|
||||||
|
FsEntryFlag_IsSd = 1 << 2, // todo: remove this.
|
||||||
|
// do not stat files in this entry (faster for network mount).
|
||||||
|
FsEntryFlag_NoStatFile = 1 << 3,
|
||||||
|
FsEntryFlag_NoStatDir = 1 << 4,
|
||||||
|
FsEntryFlag_NoRandomReads = 1 << 5,
|
||||||
|
FsEntryFlag_NoRandomWrites = 1 << 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class FsType {
|
enum class FsType {
|
||||||
@@ -24,6 +51,7 @@ enum class FsType {
|
|||||||
ImageNand,
|
ImageNand,
|
||||||
ImageSd,
|
ImageSd,
|
||||||
Stdio,
|
Stdio,
|
||||||
|
Custom,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SelectedType {
|
enum class SelectedType {
|
||||||
@@ -62,13 +90,33 @@ struct FsEntry {
|
|||||||
return flags & FsEntryFlag_Assoc;
|
return flags & FsEntryFlag_Assoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto IsSd() const -> bool {
|
||||||
|
return flags & FsEntryFlag_IsSd;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto IsNoStatFile() const -> bool {
|
||||||
|
return flags & FsEntryFlag_NoStatFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto IsNoStatDir() const -> bool {
|
||||||
|
return flags & FsEntryFlag_NoStatDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto IsNoRandomReads() const -> bool {
|
||||||
|
return flags & FsEntryFlag_NoRandomReads;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto IsNoRandomWrites() const -> bool {
|
||||||
|
return flags & FsEntryFlag_NoRandomWrites;
|
||||||
|
}
|
||||||
|
|
||||||
auto IsSame(const FsEntry& e) const {
|
auto IsSame(const FsEntry& e) const {
|
||||||
return root == e.root && type == e.type;
|
return root == e.root && type == e.type;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// roughly 1kib in size per entry
|
// roughly 1kib in size per entry
|
||||||
struct FileEntry : FsDirectoryEntry {
|
struct FileEntry final : FsDirectoryEntry {
|
||||||
std::string extension{}; // if any
|
std::string extension{}; // if any
|
||||||
std::string internal_name{}; // if any
|
std::string internal_name{}; // if any
|
||||||
std::string internal_extension{}; // if any
|
std::string internal_extension{}; // if any
|
||||||
@@ -78,6 +126,7 @@ struct FileEntry : FsDirectoryEntry {
|
|||||||
bool checked_extension{}; // did we already search for an ext?
|
bool checked_extension{}; // did we already search for an ext?
|
||||||
bool checked_internal_extension{}; // did we already search for an ext?
|
bool checked_internal_extension{}; // did we already search for an ext?
|
||||||
bool selected{}; // is this file selected?
|
bool selected{}; // is this file selected?
|
||||||
|
bool done_stat{}; // have we checked file_size / count.
|
||||||
|
|
||||||
auto IsFile() const -> bool {
|
auto IsFile() const -> bool {
|
||||||
return type == FsDirEntryType_File;
|
return type == FsDirEntryType_File;
|
||||||
@@ -96,6 +145,11 @@ struct FileEntry : FsDirectoryEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto GetExtension() const -> std::string {
|
auto GetExtension() const -> std::string {
|
||||||
|
if (!checked_extension) {
|
||||||
|
if (auto ext = std::strrchr(name, '.')) {
|
||||||
|
return ext+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,13 +208,16 @@ struct FsDirCollection {
|
|||||||
|
|
||||||
using FsDirCollections = std::vector<FsDirCollection>;
|
using FsDirCollections = std::vector<FsDirCollection>;
|
||||||
|
|
||||||
struct Menu;
|
void SignalChange();
|
||||||
|
|
||||||
|
struct Base;
|
||||||
|
|
||||||
struct FsView final : Widget {
|
struct FsView final : Widget {
|
||||||
friend class Menu;
|
friend class Base;
|
||||||
|
|
||||||
FsView(Menu* menu, ViewSide side);
|
FsView(FsView* view, ViewSide side);
|
||||||
FsView(Menu* menu, const fs::FsPath& path, const FsEntry& entry, ViewSide side);
|
FsView(Base* menu, ViewSide side);
|
||||||
|
FsView(Base* menu, const std::shared_ptr<fs::Fs>& fs, const fs::FsPath& path, const FsEntry& entry, ViewSide side);
|
||||||
~FsView();
|
~FsView();
|
||||||
|
|
||||||
void Update(Controller* controller, TouchInfo* touch) override;
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
@@ -181,7 +238,13 @@ struct FsView final : Widget {
|
|||||||
|
|
||||||
void SetSide(ViewSide side);
|
void SetSide(ViewSide side);
|
||||||
|
|
||||||
private:
|
static Result DeleteAllCollections(ProgressBox* pbox, fs::Fs* fs, const FsDirCollections& collections, u32 mode = FsDirOpenMode_ReadDirs|FsDirOpenMode_ReadFiles);
|
||||||
|
static auto get_collection(fs::Fs* fs, const fs::FsPath& path, const fs::FsPath& parent_name, FsDirCollection& out, bool inc_file, bool inc_dir, bool inc_size) -> Result;
|
||||||
|
static auto get_collections(fs::Fs* fs, const fs::FsPath& path, const fs::FsPath& parent_name, FsDirCollections& out, bool inc_size = false) -> Result;
|
||||||
|
|
||||||
|
// private:
|
||||||
|
void OnClick();
|
||||||
|
|
||||||
void SetIndex(s64 index);
|
void SetIndex(s64 index);
|
||||||
void InstallForwarder();
|
void InstallForwarder();
|
||||||
|
|
||||||
@@ -190,7 +253,7 @@ private:
|
|||||||
void ZipFiles(fs::FsPath zip_path);
|
void ZipFiles(fs::FsPath zip_path);
|
||||||
void UploadFiles();
|
void UploadFiles();
|
||||||
|
|
||||||
auto Scan(const fs::FsPath& new_path, bool is_walk_up = false) -> Result;
|
auto Scan(fs::FsPath new_path, bool is_walk_up = false) -> Result;
|
||||||
|
|
||||||
auto GetNewPath(const FileEntry& entry) const -> fs::FsPath {
|
auto GetNewPath(const FileEntry& entry) const -> fs::FsPath {
|
||||||
return GetNewPath(m_path, entry.name);
|
return GetNewPath(m_path, entry.name);
|
||||||
@@ -237,11 +300,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto IsSd() const -> bool {
|
auto IsSd() const -> bool {
|
||||||
return m_fs_entry.type == FsType::Sd;
|
return m_fs_entry.IsSd();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sort();
|
void Sort();
|
||||||
void SortAndFindLastFile();
|
void SortAndFindLastFile(bool scan = false);
|
||||||
void SetIndexFromLastFile(const LastFile& last_file);
|
void SetIndexFromLastFile(const LastFile& last_file);
|
||||||
|
|
||||||
void OnDeleteCallback();
|
void OnDeleteCallback();
|
||||||
@@ -249,13 +312,10 @@ private:
|
|||||||
void OnRenameCallback();
|
void OnRenameCallback();
|
||||||
auto CheckIfUpdateFolder() -> Result;
|
auto CheckIfUpdateFolder() -> Result;
|
||||||
|
|
||||||
static auto get_collection(fs::Fs* fs, const fs::FsPath& path, const fs::FsPath& parent_name, FsDirCollection& out, bool inc_file, bool inc_dir, bool inc_size) -> Result;
|
|
||||||
static auto get_collections(fs::Fs* fs, const fs::FsPath& path, const fs::FsPath& parent_name, FsDirCollections& out, bool inc_size = false) -> Result;
|
|
||||||
|
|
||||||
auto get_collection(const fs::FsPath& path, const fs::FsPath& parent_name, FsDirCollection& out, bool inc_file, bool inc_dir, bool inc_size) -> Result;
|
auto get_collection(const fs::FsPath& path, const fs::FsPath& parent_name, FsDirCollection& out, bool inc_file, bool inc_dir, bool inc_size) -> Result;
|
||||||
auto get_collections(const fs::FsPath& path, const fs::FsPath& parent_name, FsDirCollections& out, bool inc_size = false) -> Result;
|
auto get_collections(const fs::FsPath& path, const fs::FsPath& parent_name, FsDirCollections& out, bool inc_size = false) -> Result;
|
||||||
|
|
||||||
void SetFs(const fs::FsPath& new_path, const FsEntry& new_entry);
|
void SetFs(const std::shared_ptr<fs::Fs>& fs, const fs::FsPath& new_path, const FsEntry& new_entry);
|
||||||
|
|
||||||
auto GetNative() -> fs::FsNative* {
|
auto GetNative() -> fs::FsNative* {
|
||||||
return (fs::FsNative*)m_fs.get();
|
return (fs::FsNative*)m_fs.get();
|
||||||
@@ -266,11 +326,17 @@ private:
|
|||||||
void DisplayOptions();
|
void DisplayOptions();
|
||||||
void DisplayAdvancedOptions();
|
void DisplayAdvancedOptions();
|
||||||
|
|
||||||
private:
|
using MountFsFunc = Result(*)(fs::Fs *fs, const fs::FsPath &path, fs::FsPath &out_path);
|
||||||
Menu* m_menu{};
|
// using MountFsFunc = std::function<Result(fs::Fs *fs, const fs::FsPath &path, fs::FsPath &out_path)>;
|
||||||
|
using UmountFsFunc = std::function<void(const fs::FsPath &mount)>;
|
||||||
|
|
||||||
|
void MountFileFs(const MountFsFunc& mount_func, const UmountFsFunc& umount_func);
|
||||||
|
|
||||||
|
// private:
|
||||||
|
Base* m_menu{};
|
||||||
ViewSide m_side{};
|
ViewSide m_side{};
|
||||||
|
|
||||||
std::unique_ptr<fs::Fs> m_fs{};
|
std::shared_ptr<fs::Fs> m_fs{};
|
||||||
FsEntry m_fs_entry{};
|
FsEntry m_fs_entry{};
|
||||||
fs::FsPath m_path{};
|
fs::FsPath m_path{};
|
||||||
std::vector<FileEntry> m_entries{};
|
std::vector<FileEntry> m_entries{};
|
||||||
@@ -296,7 +362,7 @@ private:
|
|||||||
|
|
||||||
// contains all selected files for a command, such as copy, delete, cut etc.
|
// contains all selected files for a command, such as copy, delete, cut etc.
|
||||||
struct SelectedStash {
|
struct SelectedStash {
|
||||||
void Add(std::shared_ptr<FsView> view, SelectedType type, const std::vector<FileEntry>& files, const fs::FsPath& path) {
|
void Add(FsView* view, SelectedType type, const std::vector<FileEntry>& files, const fs::FsPath& path) {
|
||||||
if (files.empty()) {
|
if (files.empty()) {
|
||||||
Reset();
|
Reset();
|
||||||
} else {
|
} else {
|
||||||
@@ -331,28 +397,34 @@ struct SelectedStash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
std::shared_ptr<FsView> m_view{};
|
FsView* m_view{};
|
||||||
std::vector<FileEntry> m_files{};
|
std::vector<FileEntry> m_files{};
|
||||||
fs::FsPath m_path{};
|
fs::FsPath m_path{};
|
||||||
SelectedType m_type{SelectedType::None};
|
SelectedType m_type{SelectedType::None};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Menu final : MenuBase {
|
struct Base : MenuBase {
|
||||||
friend class FsView;
|
friend class FsView;
|
||||||
|
|
||||||
Menu(u32 flags);
|
Base(u32 flags, u32 options);
|
||||||
~Menu();
|
Base(const std::shared_ptr<fs::Fs>& fs, const FsEntry& fs_entry, const fs::FsPath& path, bool is_custom, u32 flags, u32 options);
|
||||||
|
|
||||||
|
void SetFilter(const std::vector<std::string>& filter) {
|
||||||
|
m_filter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
auto GetShortTitle() const -> const char* override { return "Files"; };
|
auto GetShortTitle() const -> const char* override { return "Files"; };
|
||||||
void Update(Controller* controller, TouchInfo* touch) override;
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
void OnFocusGained() override;
|
virtual void OnFocusGained() override;
|
||||||
|
|
||||||
static auto GetNewPath(const fs::FsPath& root_path, const fs::FsPath& file_path) -> fs::FsPath {
|
static auto GetNewPath(const fs::FsPath& root_path, const fs::FsPath& file_path) -> fs::FsPath {
|
||||||
return fs::AppendPath(root_path, file_path);
|
return fs::AppendPath(root_path, file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
virtual void OnClick(FsView* view, const FsEntry& fs_entry, const FileEntry& entry, const fs::FsPath& path);
|
||||||
|
|
||||||
|
protected:
|
||||||
auto IsSplitScreen() const {
|
auto IsSplitScreen() const {
|
||||||
return m_split_screen;
|
return m_split_screen;
|
||||||
}
|
}
|
||||||
@@ -382,23 +454,40 @@ private:
|
|||||||
|
|
||||||
void PromptIfShouldExit();
|
void PromptIfShouldExit();
|
||||||
|
|
||||||
|
auto CanInstall() const {
|
||||||
|
return m_options & FsOption_CanInstall;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto CreateFs(const FsEntry& fs_entry) -> std::shared_ptr<fs::Fs>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Init(const std::shared_ptr<fs::Fs>& fs, const FsEntry& fs_entry, const fs::FsPath& path, bool is_custom);
|
||||||
|
|
||||||
|
protected:
|
||||||
static constexpr inline const char* INI_SECTION = "filebrowser";
|
static constexpr inline const char* INI_SECTION = "filebrowser";
|
||||||
|
|
||||||
std::shared_ptr<FsView> view{};
|
const u32 m_options;
|
||||||
std::shared_ptr<FsView> view_left{};
|
|
||||||
std::shared_ptr<FsView> view_right{};
|
std::shared_ptr<fs::Fs> m_custom_fs{};
|
||||||
|
FsEntry m_custom_fs_entry{};
|
||||||
|
|
||||||
|
FsView* view{};
|
||||||
|
std::unique_ptr<FsView> view_left{};
|
||||||
|
std::unique_ptr<FsView> view_right{};
|
||||||
|
|
||||||
std::vector<FileAssocEntry> m_assoc_entries{};
|
std::vector<FileAssocEntry> m_assoc_entries{};
|
||||||
SelectedStash m_selected{};
|
SelectedStash m_selected{};
|
||||||
|
|
||||||
// this keeps track of the highlighted file before opening a folder
|
std::vector<std::string> m_filter{};
|
||||||
// if the user presses B to go back to the previous dir
|
|
||||||
// this vector is popped, then, that entry is checked if it still exists
|
// local copy of nro entries that is loaded in LoadAssocEntriesPath()
|
||||||
// if it does, the index becomes that file.
|
// if homebrew::GetNroEntries() returns nothing, usually due to
|
||||||
std::vector<LastFile> m_previous_highlighted_file{};
|
// the menu not being loaded.
|
||||||
s64 m_index{};
|
// this is a bit of a hack to support replacing the homebrew menu tab,
|
||||||
s64 m_selected_count{};
|
// sphaira wasn't really designed for this.
|
||||||
|
// however this will work for now, until i add support for additional
|
||||||
|
// nro scan mounts, at which point this won't scale.
|
||||||
|
std::vector<NroEntry> m_nro_entries{};
|
||||||
|
|
||||||
option::OptionLong m_sort{INI_SECTION, "sort", SortType::SortType_Alphabetical};
|
option::OptionLong m_sort{INI_SECTION, "sort", SortType::SortType_Alphabetical};
|
||||||
option::OptionLong m_order{INI_SECTION, "order", OrderType::OrderType_Descending};
|
option::OptionLong m_order{INI_SECTION, "order", OrderType::OrderType_Descending};
|
||||||
@@ -408,8 +497,39 @@ private:
|
|||||||
option::OptionBool m_ignore_read_only{INI_SECTION, "ignore_read_only", false};
|
option::OptionBool m_ignore_read_only{INI_SECTION, "ignore_read_only", false};
|
||||||
|
|
||||||
bool m_loaded_assoc_entries{};
|
bool m_loaded_assoc_entries{};
|
||||||
bool m_is_update_folder{};
|
|
||||||
bool m_split_screen{};
|
bool m_split_screen{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Menu final : Base {
|
||||||
|
Menu(u32 flags, u32 options = FsOption_All) : Base{flags, options} {
|
||||||
|
}
|
||||||
|
|
||||||
|
Menu(const std::shared_ptr<fs::Fs>& fs, const FsEntry& fs_entry, const fs::FsPath& path, u32 options = FsOption_All)
|
||||||
|
: Base{fs, fs_entry, path, true, MenuFlag_None, options} {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// case insensitive check
|
||||||
|
auto IsSamePath(std::string_view a, std::string_view b) -> bool;
|
||||||
|
auto IsExtension(std::string_view ext1, std::string_view ext2) -> bool;
|
||||||
|
auto IsExtension(std::string_view ext, std::span<const std::string_view> list) -> bool;
|
||||||
|
|
||||||
|
struct FsStdioWrapper final : fs::FsStdio {
|
||||||
|
using OnExit = std::function<void(void)>;
|
||||||
|
FsStdioWrapper(const fs::FsPath& root, const OnExit& on_exit) : fs::FsStdio{true, root}, m_on_exit{on_exit} {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
~FsStdioWrapper() {
|
||||||
|
if (m_on_exit) {
|
||||||
|
m_on_exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const OnExit m_on_exit;
|
||||||
|
};
|
||||||
|
|
||||||
|
void MountFsHelper(const std::shared_ptr<fs::Fs>& fs, const fs::FsPath& name);
|
||||||
|
|
||||||
} // namespace sphaira::ui::menu::filebrowser
|
} // namespace sphaira::ui::menu::filebrowser
|
||||||
|
|||||||
@@ -1,56 +1,20 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/menus/menu_base.hpp"
|
#include "ui/menus/menu_base.hpp"
|
||||||
#include "yati/source/stream.hpp"
|
#include "ui/menus/install_stream_menu_base.hpp"
|
||||||
|
|
||||||
namespace sphaira::ui::menu::ftp {
|
namespace sphaira::ui::menu::ftp {
|
||||||
|
|
||||||
enum class State {
|
struct Menu final : stream::Menu {
|
||||||
// not connected.
|
|
||||||
None,
|
|
||||||
// just connected, starts the transfer.
|
|
||||||
Connected,
|
|
||||||
// set whilst transfer is in progress.
|
|
||||||
Progress,
|
|
||||||
// set when the transfer is finished.
|
|
||||||
Done,
|
|
||||||
// failed to connect.
|
|
||||||
Failed,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct StreamFtp final : yati::source::Stream {
|
|
||||||
StreamFtp(const fs::FsPath& path, std::stop_token token);
|
|
||||||
|
|
||||||
Result ReadChunk(void* buf, s64 size, u64* bytes_read) override;
|
|
||||||
bool Push(const void* buf, s64 size);
|
|
||||||
void Disable();
|
|
||||||
|
|
||||||
// private:
|
|
||||||
fs::FsPath m_path{};
|
|
||||||
std::stop_token m_token{};
|
|
||||||
std::vector<u8> m_buffer{};
|
|
||||||
Mutex m_mutex{};
|
|
||||||
bool m_active{};
|
|
||||||
// bool m_push_exit{};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Menu final : MenuBase {
|
|
||||||
Menu(u32 flags);
|
Menu(u32 flags);
|
||||||
~Menu();
|
~Menu();
|
||||||
|
|
||||||
auto GetShortTitle() const -> const char* override { return "FTP"; };
|
auto GetShortTitle() const -> const char* override { return "FTP"; };
|
||||||
void Update(Controller* controller, TouchInfo* touch) override;
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
void OnFocusGained() override;
|
void OnDisableInstallMode() override;
|
||||||
|
|
||||||
// this should be private
|
|
||||||
// private:
|
|
||||||
std::shared_ptr<StreamFtp> m_source{};
|
|
||||||
Thread m_thread{};
|
|
||||||
Mutex m_mutex{};
|
|
||||||
// the below are shared across threads, lock with the above mutex!
|
|
||||||
State m_state{State::None};
|
|
||||||
|
|
||||||
|
private:
|
||||||
const char* m_user{};
|
const char* m_user{};
|
||||||
const char* m_pass{};
|
const char* m_pass{};
|
||||||
unsigned m_port{};
|
unsigned m_port{};
|
||||||
|
|||||||
@@ -2,34 +2,26 @@
|
|||||||
|
|
||||||
#include "ui/menus/grid_menu_base.hpp"
|
#include "ui/menus/grid_menu_base.hpp"
|
||||||
#include "ui/list.hpp"
|
#include "ui/list.hpp"
|
||||||
|
|
||||||
|
#include "yati/container/base.hpp"
|
||||||
|
#include "yati/nx/keys.hpp"
|
||||||
|
|
||||||
|
#include "title_info.hpp"
|
||||||
#include "fs.hpp"
|
#include "fs.hpp"
|
||||||
#include "option.hpp"
|
#include "option.hpp"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
namespace sphaira::ui::menu::game {
|
namespace sphaira::ui::menu::game {
|
||||||
|
|
||||||
enum class NacpLoadStatus {
|
|
||||||
// not yet attempted to be loaded.
|
|
||||||
None,
|
|
||||||
// started loading.
|
|
||||||
Progress,
|
|
||||||
// loaded, ready to parse.
|
|
||||||
Loaded,
|
|
||||||
// failed to load, do not attempt to load again!
|
|
||||||
Error,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Entry {
|
struct Entry {
|
||||||
u64 app_id{};
|
u64 app_id{};
|
||||||
char display_version[0x10]{};
|
u8 last_event{};
|
||||||
NacpLanguageEntry lang{};
|
NacpLanguageEntry lang{};
|
||||||
int image{};
|
int image{};
|
||||||
bool selected{};
|
bool selected{};
|
||||||
|
title::NacpLoadStatus status{title::NacpLoadStatus::None};
|
||||||
std::shared_ptr<NsApplicationControlData> control{};
|
|
||||||
u64 control_size{};
|
|
||||||
NacpLoadStatus status{NacpLoadStatus::None};
|
|
||||||
|
|
||||||
auto GetName() const -> const char* {
|
auto GetName() const -> const char* {
|
||||||
return lang.name;
|
return lang.name;
|
||||||
@@ -38,42 +30,6 @@ struct Entry {
|
|||||||
auto GetAuthor() const -> const char* {
|
auto GetAuthor() const -> const char* {
|
||||||
return lang.author;
|
return lang.author;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto GetDisplayVersion() const -> const char* {
|
|
||||||
return display_version;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ThreadResultData {
|
|
||||||
u64 id{};
|
|
||||||
std::shared_ptr<NsApplicationControlData> control{};
|
|
||||||
u64 control_size{};
|
|
||||||
char display_version[0x10]{};
|
|
||||||
NacpLanguageEntry lang{};
|
|
||||||
NacpLoadStatus status{NacpLoadStatus::None};
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ThreadData {
|
|
||||||
ThreadData();
|
|
||||||
|
|
||||||
auto IsRunning() const -> bool;
|
|
||||||
void Run();
|
|
||||||
void Close();
|
|
||||||
void Push(u64 id);
|
|
||||||
void Push(std::span<const Entry> entries);
|
|
||||||
void Pop(std::vector<ThreadResultData>& out);
|
|
||||||
|
|
||||||
private:
|
|
||||||
UEvent m_uevent{};
|
|
||||||
Mutex m_mutex_id{};
|
|
||||||
Mutex m_mutex_result{};
|
|
||||||
|
|
||||||
// app_ids pushed to the queue, signal uevent when pushed.
|
|
||||||
std::vector<u64> m_ids{};
|
|
||||||
// control data pushed to the queue.
|
|
||||||
std::vector<ThreadResultData> m_result{};
|
|
||||||
|
|
||||||
std::atomic_bool m_running{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SortType {
|
enum SortType {
|
||||||
@@ -87,6 +43,8 @@ enum OrderType {
|
|||||||
|
|
||||||
using LayoutType = grid::LayoutType;
|
using LayoutType = grid::LayoutType;
|
||||||
|
|
||||||
|
void SignalChange();
|
||||||
|
|
||||||
struct Menu final : grid::Menu {
|
struct Menu final : grid::Menu {
|
||||||
Menu(u32 flags);
|
Menu(u32 flags);
|
||||||
~Menu();
|
~Menu();
|
||||||
@@ -128,7 +86,9 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeleteGames();
|
void DeleteGames();
|
||||||
void DumpGames(u32 flags);
|
void ExportOptions(bool to_nsz);
|
||||||
|
void DumpGames(u32 flags, bool to_nsz);
|
||||||
|
void CreateSaves(AccountUid uid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr inline const char* INI_SECTION = "games";
|
static constexpr inline const char* INI_SECTION = "games";
|
||||||
@@ -141,13 +101,79 @@ private:
|
|||||||
bool m_is_reversed{};
|
bool m_is_reversed{};
|
||||||
bool m_dirty{};
|
bool m_dirty{};
|
||||||
|
|
||||||
ThreadData m_thread_data{};
|
// use for detection game card removal to force a refresh.
|
||||||
Thread m_thread{};
|
Event m_gc_event{};
|
||||||
|
FsEventNotifier m_gc_event_notifier{};
|
||||||
|
|
||||||
option::OptionLong m_sort{INI_SECTION, "sort", SortType::SortType_Updated};
|
option::OptionLong m_sort{INI_SECTION, "sort", SortType::SortType_Updated};
|
||||||
option::OptionLong m_order{INI_SECTION, "order", OrderType::OrderType_Descending};
|
option::OptionLong m_order{INI_SECTION, "order", OrderType::OrderType_Descending};
|
||||||
option::OptionLong m_layout{INI_SECTION, "layout", LayoutType::LayoutType_GridDetail};
|
option::OptionLong m_layout{INI_SECTION, "layout", LayoutType::LayoutType_Grid};
|
||||||
option::OptionBool m_hide_forwarders{INI_SECTION, "hide_forwarders", false};
|
option::OptionBool m_hide_forwarders{INI_SECTION, "hide_forwarders", false};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct NcmMetaData {
|
||||||
|
// points to global service, do not close manually!
|
||||||
|
NcmContentStorage* cs{};
|
||||||
|
NcmContentMetaDatabase* db{};
|
||||||
|
u64 app_id{};
|
||||||
|
NcmContentMetaKey key{};
|
||||||
|
};
|
||||||
|
|
||||||
|
Result GetMetaEntries(const Entry& e, title::MetaEntries& out, u32 flags = title::ContentFlag_All);
|
||||||
|
|
||||||
|
Result GetNcmMetaFromMetaStatus(const NsApplicationContentMetaStatus& status, NcmMetaData& out);
|
||||||
|
void DeleteMetaEntries(u64 app_id, int image, const std::string& name, const title::MetaEntries& entries);
|
||||||
|
|
||||||
|
struct TikEntry {
|
||||||
|
FsRightsId id{};
|
||||||
|
u8 key_gen{};
|
||||||
|
std::vector<u8> tik_data{};
|
||||||
|
std::vector<u8> cert_data{};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct NspEntry {
|
||||||
|
// application name.
|
||||||
|
std::string application_name{};
|
||||||
|
// name of the nsp (name [id][v0][BASE].nsp).
|
||||||
|
fs::FsPath path{};
|
||||||
|
// tickets and cert data, will be empty if title key crypto isn't used.
|
||||||
|
std::vector<TikEntry> tickets{};
|
||||||
|
// all the collections for this nsp, such as nca's and tickets.
|
||||||
|
std::vector<yati::container::CollectionEntry> collections{};
|
||||||
|
// raw nsp data (header, file table and string table).
|
||||||
|
std::vector<u8> nsp_data{};
|
||||||
|
// size of the entier nsp.
|
||||||
|
s64 nsp_size{};
|
||||||
|
// copy of ncm cs, it is not closed.
|
||||||
|
NcmContentStorage cs{};
|
||||||
|
// copy of the icon, if invalid, it will use the default icon.
|
||||||
|
int icon{};
|
||||||
|
|
||||||
|
Result Read(void* buf, s64 off, s64 size, u64* bytes_read);
|
||||||
|
|
||||||
|
private:
|
||||||
|
static auto InRange(s64 off, s64 offset, s64 size) -> bool {
|
||||||
|
return off < offset + size && off >= offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static auto ClipSize(s64 off, s64 size, s64 file_size) -> s64 {
|
||||||
|
return std::min(size, file_size - off);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ContentInfoEntry {
|
||||||
|
NsApplicationContentMetaStatus status{};
|
||||||
|
std::vector<NcmContentInfo> content_infos{};
|
||||||
|
std::vector<NcmRightsId> ncm_rights_id{};
|
||||||
|
};
|
||||||
|
|
||||||
|
auto BuildNspPath(const Entry& e, const NsApplicationContentMetaStatus& status, bool to_nsz = false) -> fs::FsPath;
|
||||||
|
Result BuildContentEntry(const NsApplicationContentMetaStatus& status, ContentInfoEntry& out, bool to_nsz = false);
|
||||||
|
Result BuildNspEntry(const Entry& e, const ContentInfoEntry& info, const keys::Keys& keys, NspEntry& out, bool to_nsz = false);
|
||||||
|
Result BuildNspEntries(Entry& e, const title::MetaEntries& meta_entries, std::vector<NspEntry>& out, bool to_nsz = false);
|
||||||
|
Result BuildNspEntries(Entry& e, u32 flags, std::vector<NspEntry>& out, bool to_nsz = false);
|
||||||
|
|
||||||
|
// dumps the array of nsp entries.
|
||||||
|
void DumpNsp(const std::vector<NspEntry>& entries, bool to_nsz);
|
||||||
|
|
||||||
} // namespace sphaira::ui::menu::game
|
} // namespace sphaira::ui::menu::game
|
||||||
|
|||||||
111
sphaira/include/ui/menus/game_meta_menu.hpp
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/menus/menu_base.hpp"
|
||||||
|
#include "ui/menus/game_menu.hpp"
|
||||||
|
#include "ui/list.hpp"
|
||||||
|
#include "yati/nx/ncm.hpp"
|
||||||
|
#include <span>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace sphaira::ui::menu::game::meta {
|
||||||
|
|
||||||
|
enum TicketType : u8 {
|
||||||
|
TicketType_None,
|
||||||
|
TicketType_Common,
|
||||||
|
TicketType_Personalised,
|
||||||
|
TicketType_Missing,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MiniNacp {
|
||||||
|
char display_version[0x10];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MetaEntry {
|
||||||
|
NsApplicationContentMetaStatus status{};
|
||||||
|
ncm::ContentMeta content_meta{};
|
||||||
|
// small version of nacp to speed up loading.
|
||||||
|
MiniNacp nacp{};
|
||||||
|
// total size of all ncas.
|
||||||
|
s64 size{};
|
||||||
|
// set to the key gen (if possible), only if title key encrypted.
|
||||||
|
u8 key_gen{};
|
||||||
|
// set to the ticket type.
|
||||||
|
u8 ticket_type{TicketType_None};
|
||||||
|
// set if it has missing ncas.
|
||||||
|
u8 missing_count{};
|
||||||
|
// set if selected.
|
||||||
|
bool selected{};
|
||||||
|
// set if we have checked the above meta data.
|
||||||
|
bool checked{};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Menu final : MenuBase {
|
||||||
|
Menu(Entry& entry);
|
||||||
|
~Menu();
|
||||||
|
|
||||||
|
auto GetShortTitle() const -> const char* override { return "Meta"; };
|
||||||
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetIndex(s64 index);
|
||||||
|
void Scan();
|
||||||
|
void UpdateSubheading();
|
||||||
|
|
||||||
|
auto GetSelectedEntries() const {
|
||||||
|
title::MetaEntries out;
|
||||||
|
for (auto& e : m_entries) {
|
||||||
|
if (e.selected) {
|
||||||
|
out.emplace_back(e.status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_entries.empty() && out.empty()) {
|
||||||
|
out.emplace_back(m_entries[m_index].status);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearSelection() {
|
||||||
|
for (auto& e : m_entries) {
|
||||||
|
e.selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_selected_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry(u32 index) -> MetaEntry& {
|
||||||
|
return m_entries[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry(u32 index) const -> const MetaEntry& {
|
||||||
|
return m_entries[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry() -> MetaEntry& {
|
||||||
|
return GetEntry(m_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry() const -> const MetaEntry& {
|
||||||
|
return GetEntry(m_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DumpGames(bool to_nsz);
|
||||||
|
void DeleteGames();
|
||||||
|
Result ResetRequiredSystemVersion(MetaEntry& entry) const;
|
||||||
|
Result GetNcmSizeOfMetaStatus(MetaEntry& entry) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Entry& m_entry;
|
||||||
|
std::vector<MetaEntry> m_entries{};
|
||||||
|
s64 m_index{};
|
||||||
|
s64 m_selected_count{};
|
||||||
|
std::unique_ptr<List> m_list{};
|
||||||
|
bool m_dirty{};
|
||||||
|
|
||||||
|
std::vector<FsRightsId> m_common_tickets{};
|
||||||
|
std::vector<FsRightsId> m_personalised_tickets{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sphaira::ui::menu::game::meta
|
||||||
92
sphaira/include/ui/menus/game_nca_menu.hpp
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/menus/menu_base.hpp"
|
||||||
|
#include "ui/menus/game_meta_menu.hpp"
|
||||||
|
#include "ui/list.hpp"
|
||||||
|
#include "yati/nx/nca.hpp"
|
||||||
|
#include "yati/nx/ncm.hpp"
|
||||||
|
#include <span>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace sphaira::ui::menu::game::meta_nca {
|
||||||
|
|
||||||
|
struct NcaEntry {
|
||||||
|
NcmContentId content_id{};
|
||||||
|
u64 size{};
|
||||||
|
u8 content_type{};
|
||||||
|
// decrypted nca header.
|
||||||
|
nca::Header header{};
|
||||||
|
// set if missing.
|
||||||
|
bool missing{};
|
||||||
|
// set if selected.
|
||||||
|
bool selected{};
|
||||||
|
// set if we have checked the above meta data.
|
||||||
|
bool checked{};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Menu final : MenuBase {
|
||||||
|
Menu(Entry& entry, const meta::MetaEntry& meta_entry);
|
||||||
|
~Menu();
|
||||||
|
|
||||||
|
auto GetShortTitle() const -> const char* override { return "Nca"; };
|
||||||
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetIndex(s64 index);
|
||||||
|
void Scan();
|
||||||
|
void UpdateSubheading();
|
||||||
|
|
||||||
|
auto GetSelectedEntries() const {
|
||||||
|
std::vector<NcaEntry> out;
|
||||||
|
for (auto& e : m_entries) {
|
||||||
|
if (e.selected && !e.missing) {
|
||||||
|
out.emplace_back(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_entries.empty() && out.empty()) {
|
||||||
|
out.emplace_back(m_entries[m_index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearSelection() {
|
||||||
|
for (auto& e : m_entries) {
|
||||||
|
e.selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_selected_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry(u32 index) -> NcaEntry& {
|
||||||
|
return m_entries[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry(u32 index) const -> const NcaEntry& {
|
||||||
|
return m_entries[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry() -> NcaEntry& {
|
||||||
|
return GetEntry(m_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry() const -> const NcaEntry& {
|
||||||
|
return GetEntry(m_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DumpNcas();
|
||||||
|
Result MountNcaFs();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Entry& m_entry;
|
||||||
|
const meta::MetaEntry& m_meta_entry;
|
||||||
|
NcmMetaData m_meta{};
|
||||||
|
std::vector<NcaEntry> m_entries{};
|
||||||
|
s64 m_index{};
|
||||||
|
s64 m_selected_count{};
|
||||||
|
std::unique_ptr<List> m_list{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sphaira::ui::menu::game::meta_nca
|
||||||
@@ -7,7 +7,8 @@
|
|||||||
#include <span>
|
#include <span>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace sphaira::ui::menu::gc {
|
// todo: pr to libnx
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FsGameCardPartitionRaw_None = -1,
|
FsGameCardPartitionRaw_None = -1,
|
||||||
@@ -15,6 +16,13 @@ typedef enum {
|
|||||||
FsGameCardPartitionRaw_Secure = 1,
|
FsGameCardPartitionRaw_Secure = 1,
|
||||||
} FsGameCardPartitionRaw;
|
} FsGameCardPartitionRaw;
|
||||||
|
|
||||||
|
Result fsOpenGameCardStorage(FsStorage* out, const FsGameCardHandle* handle, FsGameCardPartitionRaw partition);
|
||||||
|
Result fsOpenGameCardDetectionEventNotifier(FsEventNotifier* out);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace sphaira::ui::menu::gc {
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
// The below structs are taken from nxdumptool./
|
// The below structs are taken from nxdumptool./
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
@@ -88,6 +96,33 @@ typedef struct {
|
|||||||
|
|
||||||
static_assert(sizeof(GameCardInitialData) == 0x200);
|
static_assert(sizeof(GameCardInitialData) == 0x200);
|
||||||
|
|
||||||
|
/// Encrypted using AES-128-CTR with the key and IV/counter from the `GameCardTitleKeyAreaEncryption` section. Assumed to be all zeroes in retail gamecards.
|
||||||
|
typedef struct {
|
||||||
|
u8 titlekey[0x10]; ///< Decrypted titlekey from the `GameCardInitialData` section.
|
||||||
|
u8 reserved[0xCF0];
|
||||||
|
} GameCardTitleKeyArea;
|
||||||
|
|
||||||
|
static_assert(sizeof(GameCardTitleKeyArea) == 0xD00);
|
||||||
|
|
||||||
|
/// Encrypted using RSA-2048-OAEP and a private OAEP key from AuthoringTool. Assumed to be all zeroes in retail gamecards.
|
||||||
|
typedef struct {
|
||||||
|
u8 titlekey_encryption_key[0x10]; ///< Used as the AES-128-CTR key for the `GameCardTitleKeyArea` section. Randomly generated during XCI creation by AuthoringTool.
|
||||||
|
u8 titlekey_encryption_iv[0x10]; ///< Used as the AES-128-CTR IV/counter for the `GameCardTitleKeyArea` section. Randomly generated during XCI creation by AuthoringTool.
|
||||||
|
u8 reserved[0xE0];
|
||||||
|
} GameCardTitleKeyAreaEncryption;
|
||||||
|
|
||||||
|
static_assert(sizeof(GameCardTitleKeyAreaEncryption) == 0x100);
|
||||||
|
|
||||||
|
/// Used to secure communications between the Lotus and the inserted gamecard.
|
||||||
|
/// Supposedly precedes the gamecard header.
|
||||||
|
typedef struct {
|
||||||
|
GameCardInitialData initial_data;
|
||||||
|
GameCardTitleKeyArea titlekey_area;
|
||||||
|
GameCardTitleKeyAreaEncryption titlekey_area_encryption;
|
||||||
|
} GameCardKeyArea;
|
||||||
|
|
||||||
|
static_assert(sizeof(GameCardKeyArea) == 0x1000);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 maker_code; ///< GameCardUidMakerCode.
|
u8 maker_code; ///< GameCardUidMakerCode.
|
||||||
u8 version; ///< TODO: determine whether this matches GameCardVersion or not.
|
u8 version; ///< TODO: determine whether this matches GameCardVersion or not.
|
||||||
@@ -151,8 +186,7 @@ struct ApplicationEntry {
|
|||||||
u64 app_id{};
|
u64 app_id{};
|
||||||
u32 version{};
|
u32 version{};
|
||||||
u8 key_gen{};
|
u8 key_gen{};
|
||||||
std::unique_ptr<NsApplicationControlData> control{};
|
std::vector<u8> icon;
|
||||||
u64 control_size{};
|
|
||||||
NacpLanguageEntry lang_entry{};
|
NacpLanguageEntry lang_entry{};
|
||||||
|
|
||||||
std::vector<GcCollections> application{};
|
std::vector<GcCollections> application{};
|
||||||
@@ -199,6 +233,9 @@ private:
|
|||||||
void FreeImage();
|
void FreeImage();
|
||||||
void OnChangeIndex(s64 new_index);
|
void OnChangeIndex(s64 new_index);
|
||||||
Result DumpGames(u32 flags);
|
Result DumpGames(u32 flags);
|
||||||
|
Result DumpXcz(u32 flags);
|
||||||
|
|
||||||
|
Result MountGcFs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FsDeviceOperator m_dev_op{};
|
FsDeviceOperator m_dev_op{};
|
||||||
@@ -221,12 +258,12 @@ private:
|
|||||||
|
|
||||||
FsStorage m_storage{};
|
FsStorage m_storage{};
|
||||||
// size of normal partition.
|
// size of normal partition.
|
||||||
s64 m_parition_normal_size{};
|
s64 m_partition_normal_size{};
|
||||||
// size of secure partition.
|
// size of secure partition.
|
||||||
s64 m_parition_secure_size{};
|
s64 m_partition_secure_size{};
|
||||||
// used size reported in the xci header.
|
// used size reported in the xci header.
|
||||||
s64 m_storage_trimmed_size{};
|
s64 m_storage_trimmed_size{};
|
||||||
// total size of m_parition_normal_size + m_parition_secure_size.
|
// total size of m_partition_normal_size + m_partition_secure_size.
|
||||||
s64 m_storage_total_size{};
|
s64 m_storage_total_size{};
|
||||||
// reported size via rom_size in the xci header.
|
// reported size via rom_size in the xci header.
|
||||||
s64 m_storage_full_size{};
|
s64 m_storage_full_size{};
|
||||||
|
|||||||
@@ -32,12 +32,15 @@ struct GhApiAsset {
|
|||||||
std::string content_type{};
|
std::string content_type{};
|
||||||
u64 size{};
|
u64 size{};
|
||||||
u64 download_count{};
|
u64 download_count{};
|
||||||
|
std::string updated_at{};
|
||||||
std::string browser_download_url{};
|
std::string browser_download_url{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GhApiEntry {
|
struct GhApiEntry {
|
||||||
std::string tag_name{};
|
std::string tag_name{};
|
||||||
std::string name{};
|
std::string name{};
|
||||||
|
std::string published_at{};
|
||||||
|
bool prerelease{};
|
||||||
std::vector<GhApiAsset> assets{};
|
std::vector<GhApiAsset> assets{};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -72,4 +75,18 @@ private:
|
|||||||
std::unique_ptr<List> m_list{};
|
std::unique_ptr<List> m_list{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// creates a popup box on another thread.
|
||||||
|
void DownloadEntries(const Entry& entry);
|
||||||
|
|
||||||
|
// parses the params into entry struct and calls DonwloadEntries
|
||||||
|
bool Download(const std::string& url, const std::vector<AssetEntry>& assets = {}, const std::string& tag = {}, const std::string& pre_install_message = {}, const std::string& post_install_message = {});
|
||||||
|
|
||||||
|
// calls the above function by pushing the asset to an array.
|
||||||
|
inline bool Download(const std::string& url, const AssetEntry& asset, const std::string& tag = {}, const std::string& pre_install_message = {}, const std::string& post_install_message = {}) {
|
||||||
|
std::vector<AssetEntry> assets;
|
||||||
|
assets.emplace_back(asset);
|
||||||
|
|
||||||
|
return Download(url, assets, tag, pre_install_message, post_install_message);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sphaira::ui::menu::gh
|
} // namespace sphaira::ui::menu::gh
|
||||||
|
|||||||
@@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
namespace sphaira::ui::menu::homebrew {
|
namespace sphaira::ui::menu::homebrew {
|
||||||
|
|
||||||
|
enum Filter {
|
||||||
|
Filter_All,
|
||||||
|
Filter_HideHidden,
|
||||||
|
Filter_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
enum SortType {
|
enum SortType {
|
||||||
SortType_Updated,
|
SortType_Updated,
|
||||||
SortType_Alphabetical,
|
SortType_Alphabetical,
|
||||||
@@ -25,9 +31,10 @@ enum OrderType {
|
|||||||
using LayoutType = grid::LayoutType;
|
using LayoutType = grid::LayoutType;
|
||||||
|
|
||||||
auto GetNroEntries() -> std::span<const NroEntry>;
|
auto GetNroEntries() -> std::span<const NroEntry>;
|
||||||
|
void SignalChange();
|
||||||
|
|
||||||
struct Menu final : grid::Menu {
|
struct Menu final : grid::Menu {
|
||||||
Menu();
|
Menu(u32 flags);
|
||||||
~Menu();
|
~Menu();
|
||||||
|
|
||||||
auto GetShortTitle() const -> const char* override { return "Apps"; };
|
auto GetShortTitle() const -> const char* override { return "Apps"; };
|
||||||
@@ -42,30 +49,45 @@ struct Menu final : grid::Menu {
|
|||||||
static Result InstallHomebrew(const fs::FsPath& path, const std::vector<u8>& icon);
|
static Result InstallHomebrew(const fs::FsPath& path, const std::vector<u8>& icon);
|
||||||
static Result InstallHomebrewFromPath(const fs::FsPath& path);
|
static Result InstallHomebrewFromPath(const fs::FsPath& path);
|
||||||
|
|
||||||
|
auto GetEntry(s64 i) -> NroEntry& {
|
||||||
|
return m_entries[m_entries_current[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetEntry() -> NroEntry& {
|
||||||
|
return GetEntry(m_index);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetIndex(s64 index);
|
void SetIndex(s64 index);
|
||||||
void InstallHomebrew();
|
void InstallHomebrew();
|
||||||
void ScanHomebrew();
|
void ScanHomebrew();
|
||||||
void Sort();
|
void Sort();
|
||||||
void SortAndFindLastFile();
|
void SortAndFindLastFile(bool scan = false);
|
||||||
void FreeEntries();
|
void FreeEntries();
|
||||||
void OnLayoutChange();
|
void OnLayoutChange();
|
||||||
|
void DisplayOptions();
|
||||||
|
|
||||||
auto IsStarEnabled() -> bool {
|
auto IsStarEnabled() -> bool {
|
||||||
return m_sort.Get() >= SortType_UpdatedStar;
|
return m_sort.Get() >= SortType_UpdatedStar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result MountNroFs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr inline const char* INI_SECTION = "homebrew";
|
static constexpr inline const char* INI_SECTION = "homebrew";
|
||||||
|
|
||||||
std::vector<NroEntry> m_entries{};
|
std::vector<NroEntry> m_entries{};
|
||||||
|
std::vector<u32> m_entries_index[Filter_MAX]{};
|
||||||
|
std::span<u32> m_entries_current{};
|
||||||
|
|
||||||
s64 m_index{}; // where i am in the array
|
s64 m_index{}; // where i am in the array
|
||||||
std::unique_ptr<List> m_list{};
|
std::unique_ptr<List> m_list{};
|
||||||
|
bool m_dirty{};
|
||||||
|
|
||||||
option::OptionLong m_sort{INI_SECTION, "sort", SortType::SortType_AlphabeticalStar};
|
option::OptionLong m_sort{INI_SECTION, "sort", SortType::SortType_AlphabeticalStar};
|
||||||
option::OptionLong m_order{INI_SECTION, "order", OrderType::OrderType_Descending};
|
option::OptionLong m_order{INI_SECTION, "order", OrderType::OrderType_Descending};
|
||||||
option::OptionLong m_layout{INI_SECTION, "layout", LayoutType::LayoutType_GridDetail};
|
option::OptionLong m_layout{INI_SECTION, "layout", LayoutType::LayoutType_GridDetail};
|
||||||
option::OptionBool m_hide_sphaira{INI_SECTION, "hide_sphaira", false};
|
option::OptionBool m_show_hidden{INI_SECTION, "show_hidden", false};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sphaira::ui::menu::homebrew
|
} // namespace sphaira::ui::menu::homebrew
|
||||||
|
|||||||
36
sphaira/include/ui/menus/image_viewer.hpp
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/widget.hpp"
|
||||||
|
#include "fs.hpp"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace sphaira::ui::menu::imageview {
|
||||||
|
|
||||||
|
struct Menu final : Widget {
|
||||||
|
Menu(fs::Fs* fs, const fs::FsPath& path);
|
||||||
|
~Menu();
|
||||||
|
|
||||||
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
|
|
||||||
|
auto IsMenu() const -> bool override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateSize();
|
||||||
|
|
||||||
|
private:
|
||||||
|
const fs::FsPath m_path;
|
||||||
|
int m_image{};
|
||||||
|
float m_image_width{};
|
||||||
|
float m_image_height{};
|
||||||
|
|
||||||
|
// for zoom, 0.1 - 1.0
|
||||||
|
float m_zoom{1};
|
||||||
|
|
||||||
|
// for pan.
|
||||||
|
float m_xoff{};
|
||||||
|
float m_yoff{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sphaira::ui::menu::imageview
|
||||||
65
sphaira/include/ui/menus/install_stream_menu_base.hpp
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/menus/menu_base.hpp"
|
||||||
|
#include "yati/source/stream.hpp"
|
||||||
|
|
||||||
|
namespace sphaira::ui::menu::stream {
|
||||||
|
|
||||||
|
enum class State {
|
||||||
|
// not connected.
|
||||||
|
None,
|
||||||
|
// just connected, starts the transfer.
|
||||||
|
Connected,
|
||||||
|
// set whilst transfer is in progress.
|
||||||
|
Progress,
|
||||||
|
// set when the transfer is finished.
|
||||||
|
Done,
|
||||||
|
// failed to connect.
|
||||||
|
Failed,
|
||||||
|
};
|
||||||
|
|
||||||
|
using OnInstallStart = std::function<bool(const char* path)>;
|
||||||
|
using OnInstallWrite = std::function<bool(const void* buf, size_t size)>;
|
||||||
|
using OnInstallClose = std::function<void()>;
|
||||||
|
|
||||||
|
struct Stream final : yati::source::Stream {
|
||||||
|
Stream(const fs::FsPath& path, std::stop_token token);
|
||||||
|
|
||||||
|
Result ReadChunk(void* buf, s64 size, u64* bytes_read) override;
|
||||||
|
bool Push(const void* buf, s64 size);
|
||||||
|
void Disable();
|
||||||
|
auto& GetPath() const { return m_path; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
fs::FsPath m_path{};
|
||||||
|
std::stop_token m_token{};
|
||||||
|
std::vector<u8> m_buffer{};
|
||||||
|
CondVar m_can_read{};
|
||||||
|
CondVar m_can_write{};
|
||||||
|
|
||||||
|
public:
|
||||||
|
Mutex m_mutex{};
|
||||||
|
std::atomic_bool m_active{};
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Menu : MenuBase {
|
||||||
|
Menu(const std::string& title, u32 flags);
|
||||||
|
virtual ~Menu();
|
||||||
|
|
||||||
|
virtual void Update(Controller* controller, TouchInfo* touch);
|
||||||
|
virtual void Draw(NVGcontext* vg, Theme* theme);
|
||||||
|
virtual void OnDisableInstallMode() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool OnInstallStart(const char* path);
|
||||||
|
bool OnInstallWrite(const void* buf, size_t size);
|
||||||
|
void OnInstallClose();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<Stream> m_source{};
|
||||||
|
Thread m_thread{};
|
||||||
|
Mutex m_mutex{};
|
||||||
|
State m_state{State::None};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sphaira::ui::menu::stream
|
||||||
@@ -17,7 +17,7 @@ enum class UpdateState {
|
|||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
using MiscMenuFunction = std::function<std::shared_ptr<ui::menu::MenuBase>(u32 flags)>;
|
using MiscMenuFunction = std::function<std::unique_ptr<MenuBase>(u32 flags)>;
|
||||||
|
|
||||||
enum MiscMenuFlag : u8 {
|
enum MiscMenuFlag : u8 {
|
||||||
// can be set as the rightside menu.
|
// can be set as the rightside menu.
|
||||||
@@ -31,6 +31,7 @@ struct MiscMenuEntry {
|
|||||||
const char* title;
|
const char* title;
|
||||||
MiscMenuFunction func;
|
MiscMenuFunction func;
|
||||||
u8 flag;
|
u8 flag;
|
||||||
|
const char* info;
|
||||||
|
|
||||||
auto IsShortcut() const -> bool {
|
auto IsShortcut() const -> bool {
|
||||||
return flag & MiscMenuFlag_Shortcut;
|
return flag & MiscMenuFlag_Shortcut;
|
||||||
@@ -41,7 +42,7 @@ struct MiscMenuEntry {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto GetMiscMenuEntries() -> std::span<const MiscMenuEntry>;
|
auto GetMenuMenuEntries() -> std::span<const MiscMenuEntry>;
|
||||||
|
|
||||||
// this holds 2 menus and allows for switching between them
|
// this holds 2 menus and allows for switching between them
|
||||||
struct MainMenu final : Widget {
|
struct MainMenu final : Widget {
|
||||||
@@ -58,14 +59,14 @@ struct MainMenu final : Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnLRPress(std::shared_ptr<MenuBase> menu, Button b);
|
void OnLRPress(MenuBase* menu, Button b);
|
||||||
void AddOnLRPress();
|
void AddOnLRPress();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<MenuBase> m_centre_menu{};
|
std::unique_ptr<MenuBase> m_centre_menu{};
|
||||||
std::shared_ptr<MenuBase> m_left_menu{};
|
std::unique_ptr<MenuBase> m_left_menu{};
|
||||||
std::shared_ptr<MenuBase> m_right_menu{};
|
std::unique_ptr<MenuBase> m_right_menu{};
|
||||||
std::shared_ptr<MenuBase> m_current_menu{};
|
MenuBase* m_current_menu{};
|
||||||
|
|
||||||
std::string m_update_url{};
|
std::string m_update_url{};
|
||||||
std::string m_update_version{};
|
std::string m_update_version{};
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ enum MenuFlag {
|
|||||||
|
|
||||||
struct PolledData {
|
struct PolledData {
|
||||||
struct tm tm{};
|
struct tm tm{};
|
||||||
u32 battery_percetange{};
|
|
||||||
PsmChargerType charger_type{};
|
|
||||||
NifmInternetConnectionType type{};
|
NifmInternetConnectionType type{};
|
||||||
NifmInternetConnectionStatus status{};
|
NifmInternetConnectionStatus status{};
|
||||||
u32 strength{};
|
u32 strength{};
|
||||||
u32 ip{};
|
u32 ip{};
|
||||||
|
s64 sd_free{1};
|
||||||
|
s64 sd_total{1};
|
||||||
|
s64 emmc_free{1};
|
||||||
|
s64 emmc_total{1};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MenuBase : Widget {
|
struct MenuBase : Widget {
|
||||||
@@ -33,9 +35,17 @@ struct MenuBase : Widget {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTitle(std::string title);
|
void SetTitle(const std::string& title) {
|
||||||
void SetTitleSubHeading(std::string sub_heading);
|
m_title = title;
|
||||||
void SetSubHeading(std::string sub_heading);
|
}
|
||||||
|
|
||||||
|
void SetTitleSubHeading(const std::string& sub_heading) {
|
||||||
|
m_title_sub_heading = sub_heading;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetSubHeading(const std::string& sub_heading) {
|
||||||
|
m_sub_heading = sub_heading;
|
||||||
|
}
|
||||||
|
|
||||||
auto GetTitle() const {
|
auto GetTitle() const {
|
||||||
return m_title;
|
return m_title;
|
||||||
|
|||||||
19
sphaira/include/ui/menus/mtp_menu.hpp
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/menus/install_stream_menu_base.hpp"
|
||||||
|
|
||||||
|
namespace sphaira::ui::menu::mtp {
|
||||||
|
|
||||||
|
struct Menu final : stream::Menu {
|
||||||
|
Menu(u32 flags);
|
||||||
|
~Menu();
|
||||||
|
|
||||||
|
auto GetShortTitle() const -> const char* override { return "MTP"; };
|
||||||
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
|
void OnDisableInstallMode() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_was_mtp_enabled{};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sphaira::ui::menu::mtp
|
||||||
124
sphaira/include/ui/menus/save_menu.hpp
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/menus/grid_menu_base.hpp"
|
||||||
|
#include "ui/list.hpp"
|
||||||
|
#include "title_info.hpp"
|
||||||
|
#include "fs.hpp"
|
||||||
|
#include "option.hpp"
|
||||||
|
#include "dumper.hpp"
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
#include <span>
|
||||||
|
|
||||||
|
namespace sphaira::ui::menu::save {
|
||||||
|
|
||||||
|
enum BackupFlag {
|
||||||
|
BackupFlag_None = 0,
|
||||||
|
// option to allow the user to set the save file name.
|
||||||
|
BackupFlag_SetName = 1 << 0,
|
||||||
|
// set if this is a auto backup (on restore).
|
||||||
|
BackupFlag_IsAuto = 1 << 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Entry final : FsSaveDataInfo {
|
||||||
|
NacpLanguageEntry lang{};
|
||||||
|
int image{};
|
||||||
|
bool selected{};
|
||||||
|
title::NacpLoadStatus status{title::NacpLoadStatus::None};
|
||||||
|
|
||||||
|
auto GetName() const -> const char* {
|
||||||
|
return lang.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto GetAuthor() const -> const char* {
|
||||||
|
return lang.author;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SortType {
|
||||||
|
SortType_Updated,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum OrderType {
|
||||||
|
OrderType_Descending,
|
||||||
|
OrderType_Ascending,
|
||||||
|
};
|
||||||
|
|
||||||
|
using LayoutType = grid::LayoutType;
|
||||||
|
|
||||||
|
void SignalChange();
|
||||||
|
|
||||||
|
struct Menu final : grid::Menu {
|
||||||
|
Menu(u32 flags);
|
||||||
|
~Menu();
|
||||||
|
|
||||||
|
auto GetShortTitle() const -> const char* override { return "Saves"; };
|
||||||
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
|
void OnFocusGained() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetIndex(s64 index);
|
||||||
|
void ScanHomebrew();
|
||||||
|
void Sort();
|
||||||
|
void SortAndFindLastFile(bool scan);
|
||||||
|
void FreeEntries();
|
||||||
|
void OnLayoutChange();
|
||||||
|
|
||||||
|
auto GetSelectedEntries() const {
|
||||||
|
std::vector<Entry> out;
|
||||||
|
for (auto& e : m_entries) {
|
||||||
|
if (e.selected) {
|
||||||
|
out.emplace_back(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_entries.empty() && out.empty()) {
|
||||||
|
out.emplace_back(m_entries[m_index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearSelection() {
|
||||||
|
for (auto& e : m_entries) {
|
||||||
|
e.selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_selected_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayOptions();
|
||||||
|
|
||||||
|
void BackupSaves(std::vector<std::reference_wrapper<Entry>>& entries, u32 flags);
|
||||||
|
void RestoreSave();
|
||||||
|
|
||||||
|
auto BuildSavePath(const Entry& e, u32 flags) const -> fs::FsPath;
|
||||||
|
Result RestoreSaveInternal(ProgressBox* pbox, const Entry& e, const fs::FsPath& path);
|
||||||
|
Result BackupSaveInternal(ProgressBox* pbox, const dump::DumpLocation& location, Entry& e, u32 flags);
|
||||||
|
Result BackupSaveInternal(ProgressBox* pbox, const dump::DumpLocation& location, std::span<const std::reference_wrapper<Entry>> entries, u32 flags);
|
||||||
|
|
||||||
|
Result MountSaveFs();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static constexpr inline const char* INI_SECTION = "saves";
|
||||||
|
|
||||||
|
std::vector<Entry> m_entries{};
|
||||||
|
s64 m_index{}; // where i am in the array
|
||||||
|
s64 m_selected_count{};
|
||||||
|
std::unique_ptr<List> m_list{};
|
||||||
|
bool m_is_reversed{};
|
||||||
|
bool m_dirty{};
|
||||||
|
|
||||||
|
std::vector<AccountProfileBase> m_accounts{};
|
||||||
|
s64 m_account_index{};
|
||||||
|
u8 m_data_type{FsSaveDataType_Account};
|
||||||
|
|
||||||
|
option::OptionLong m_sort{INI_SECTION, "sort", SortType::SortType_Updated};
|
||||||
|
option::OptionLong m_order{INI_SECTION, "order", OrderType::OrderType_Descending};
|
||||||
|
option::OptionLong m_layout{INI_SECTION, "layout", LayoutType::LayoutType_Grid};
|
||||||
|
option::OptionBool m_auto_backup_on_restore{INI_SECTION, "auto_backup_on_restore", true};
|
||||||
|
option::OptionBool m_compress_save_backup{INI_SECTION, "compress_save_backup", true};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sphaira::ui::menu::save
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#if 0
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/menus/menu_base.hpp"
|
#include "ui/menus/menu_base.hpp"
|
||||||
@@ -104,7 +105,7 @@ struct Config {
|
|||||||
u32 limit{18};
|
u32 limit{18};
|
||||||
bool nsfw{false};
|
bool nsfw{false};
|
||||||
|
|
||||||
void SetQuery(std::string new_query) {
|
void SetQuery(const std::string& new_query) {
|
||||||
query = new_query;
|
query = new_query;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +113,7 @@ struct Config {
|
|||||||
query.clear();
|
query.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCreator(Creator new_creator) {
|
void SetCreator(const Creator& new_creator) {
|
||||||
creator = new_creator.id;
|
creator = new_creator.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,6 +139,7 @@ struct Menu final : MenuBase {
|
|||||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
void OnFocusGained() override;
|
void OnFocusGained() override;
|
||||||
|
|
||||||
|
private:
|
||||||
void SetIndex(s64 index) {
|
void SetIndex(s64 index) {
|
||||||
m_index = index;
|
m_index = index;
|
||||||
if (!m_index) {
|
if (!m_index) {
|
||||||
@@ -147,7 +149,7 @@ struct Menu final : MenuBase {
|
|||||||
|
|
||||||
void InvalidateAllPages();
|
void InvalidateAllPages();
|
||||||
void PackListDownload();
|
void PackListDownload();
|
||||||
void OnPackListDownload();
|
void DisplayOptions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr inline const char* INI_SECTION = "themezer";
|
static constexpr inline const char* INI_SECTION = "themezer";
|
||||||
@@ -169,6 +171,9 @@ private:
|
|||||||
option::OptionLong m_sort{INI_SECTION, "sort", 0};
|
option::OptionLong m_sort{INI_SECTION, "sort", 0};
|
||||||
option::OptionLong m_order{INI_SECTION, "order", 0};
|
option::OptionLong m_order{INI_SECTION, "order", 0};
|
||||||
option::OptionBool m_nsfw{INI_SECTION, "nsfw", false};
|
option::OptionBool m_nsfw{INI_SECTION, "nsfw", false};
|
||||||
|
|
||||||
|
bool m_checked_for_nro{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sphaira::ui::menu::themezer
|
} // namespace sphaira::ui::menu::themezer
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -27,19 +27,16 @@ struct Menu final : MenuBase {
|
|||||||
auto GetShortTitle() const -> const char* override { return "USB"; };
|
auto GetShortTitle() const -> const char* override { return "USB"; };
|
||||||
void Update(Controller* controller, TouchInfo* touch) override;
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
void OnFocusGained() override;
|
|
||||||
|
|
||||||
// this should be private
|
void ThreadFunction();
|
||||||
// private:
|
|
||||||
std::shared_ptr<yati::source::Usb> m_usb_source{};
|
private:
|
||||||
|
std::unique_ptr<yati::source::Usb> m_usb_source{};
|
||||||
bool m_was_mtp_enabled{};
|
bool m_was_mtp_enabled{};
|
||||||
|
|
||||||
Thread m_thread{};
|
Thread m_thread{};
|
||||||
Mutex m_mutex{};
|
std::atomic<State> m_state{State::None};
|
||||||
// the below are shared across threads, lock with the above mutex!
|
|
||||||
State m_state{State::None};
|
|
||||||
std::vector<std::string> m_names{};
|
std::vector<std::string> m_names{};
|
||||||
bool m_usb_has_connection{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sphaira::ui::menu::usb
|
} // namespace sphaira::ui::menu::usb
|
||||||
|
|||||||
45
sphaira/include/ui/music_player.hpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ui/widget.hpp"
|
||||||
|
#include "ui/scrolling_text.hpp"
|
||||||
|
#include "fs.hpp"
|
||||||
|
#include "utils/audio.hpp"
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
namespace sphaira::ui::music {
|
||||||
|
|
||||||
|
struct Menu final : Widget {
|
||||||
|
Menu(fs::Fs* fs, const fs::FsPath& path);
|
||||||
|
~Menu();
|
||||||
|
|
||||||
|
void Update(Controller* controller, TouchInfo* touch) override;
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void PauseToggle();
|
||||||
|
void SeekForward();
|
||||||
|
void SeekBack();
|
||||||
|
|
||||||
|
void IncreaseVolume();
|
||||||
|
void DecreaseVolume();
|
||||||
|
|
||||||
|
private:
|
||||||
|
audio::SongID m_song{};
|
||||||
|
audio::Info m_info{};
|
||||||
|
audio::Meta m_meta{};
|
||||||
|
// only set if metadata was loaded.
|
||||||
|
int m_icon{};
|
||||||
|
|
||||||
|
ScrollingText m_scroll_title{};
|
||||||
|
ScrollingText m_scroll_artist{};
|
||||||
|
ScrollingText m_scroll_album{};
|
||||||
|
|
||||||
|
// from movienx
|
||||||
|
static constexpr Vec4 osd_progress_bar{400.f, 550, 1280.f - (400.f * 2.f), 10.f};
|
||||||
|
// static constexpr Vec4 osd_progress_bar{300.f, SCREEN_HEIGHT / 2 - 15 / 2, 1280.f - (300.f * 2.f), 10.f};
|
||||||
|
static constexpr Vec2 osd_time_text_left{osd_progress_bar.x - 12.f, osd_progress_bar.y - 2.f};
|
||||||
|
static constexpr Vec2 osd_time_text_right{osd_progress_bar.x + osd_progress_bar.w + 12.f, osd_progress_bar.y - 2.f};
|
||||||
|
static constexpr Vec4 osd_bar_outline{osd_time_text_left.x - 80, osd_progress_bar.y - 30, osd_progress_bar.w + 80 * 2 + 30, osd_progress_bar.h + 30 + 30};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace sphaira::ui::music
|
||||||
@@ -11,8 +11,7 @@ public:
|
|||||||
enum class Side { LEFT, RIGHT };
|
enum class Side { LEFT, RIGHT };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NotifEntry(std::string text, Side side);
|
NotifEntry(const std::string& text, Side side);
|
||||||
~NotifEntry() = default;
|
|
||||||
|
|
||||||
auto Draw(NVGcontext* vg, Theme* theme, float y) -> bool;
|
auto Draw(NVGcontext* vg, Theme* theme, float y) -> bool;
|
||||||
auto GetSide() const noexcept { return m_side; }
|
auto GetSide() const noexcept { return m_side; }
|
||||||
@@ -22,17 +21,14 @@ private:
|
|||||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_text{};
|
std::string m_text;
|
||||||
|
Side m_side;
|
||||||
std::size_t m_count{180}; // count down to zero
|
std::size_t m_count{180}; // count down to zero
|
||||||
Side m_side{};
|
|
||||||
bool m_bounds_measured{};
|
bool m_bounds_measured{};
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotifMananger final : public Object {
|
class NotifMananger final : public Object {
|
||||||
public:
|
public:
|
||||||
NotifMananger() = default;
|
|
||||||
~NotifMananger() = default;
|
|
||||||
|
|
||||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
|
|
||||||
void Push(const NotifEntry& entry);
|
void Push(const NotifEntry& entry);
|
||||||
@@ -45,6 +41,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void Draw(NVGcontext* vg, Theme* theme, Entries& entries);
|
void Draw(NVGcontext* vg, Theme* theme, Entries& entries);
|
||||||
|
auto GetEntries(NotifEntry::Side side) -> Entries&;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Entries m_entries_left{};
|
Entries m_entries_left{};
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
namespace sphaira::ui::gfx {
|
namespace sphaira::ui::gfx {
|
||||||
|
|
||||||
void drawImage(NVGcontext*, float x, float y, float w, float h, int texture, float rounded = 0.F);
|
void drawImage(NVGcontext*, float x, float y, float w, float h, int texture, float rounded = 0.F, float alpha = 1.0F);
|
||||||
void drawImage(NVGcontext*, const Vec4& v, int texture, float rounded = 0.F);
|
void drawImage(NVGcontext*, const Vec4& v, int texture, float rounded = 0.F, float alpha = 1.0F);
|
||||||
|
|
||||||
void dimBackground(NVGcontext*);
|
void dimBackground(NVGcontext*);
|
||||||
|
|
||||||
@@ -30,7 +30,8 @@ void drawTextArgs(NVGcontext*, float x, float y, float size, int align, const NV
|
|||||||
|
|
||||||
void drawTextBox(NVGcontext*, float x, float y, float size, float bound, const NVGcolor& c, const char* str, int align = NVG_ALIGN_LEFT | NVG_ALIGN_TOP, const char* end = nullptr);
|
void drawTextBox(NVGcontext*, float x, float y, float size, float bound, const NVGcolor& c, const char* str, int align = NVG_ALIGN_LEFT | NVG_ALIGN_TOP, const char* end = nullptr);
|
||||||
|
|
||||||
void textBounds(NVGcontext*, float x, float y, float *bounds, const char* str, ...) __attribute__ ((format (printf, 5, 6)));
|
void textBounds(NVGcontext*, float x, float y, float *bounds, const char* str);
|
||||||
|
void textBoundsArgs(NVGcontext*, float x, float y, float *bounds, const char* str, ...) __attribute__ ((format (printf, 5, 6)));
|
||||||
|
|
||||||
auto getButton(Button button) -> const char*;
|
auto getButton(Button button) -> const char*;
|
||||||
void drawScrollbar(NVGcontext*, const Theme*, u32 index_off, u32 count, u32 max_per_page);
|
void drawScrollbar(NVGcontext*, const Theme*, u32 index_off, u32 count, u32 max_per_page);
|
||||||
@@ -41,6 +42,8 @@ void drawScrollbar2(NVGcontext*, const Theme*, s64 index_off, s64 count, s64 row
|
|||||||
|
|
||||||
void drawAppLable(NVGcontext* vg, const Theme*, ScrollingText& st, float x, float y, float w, const char* name);
|
void drawAppLable(NVGcontext* vg, const Theme*, ScrollingText& st, float x, float y, float w, const char* name);
|
||||||
|
|
||||||
|
void drawSpinner(NVGcontext* vg, const Theme*, float cx, float cy, float r, float t);
|
||||||
|
|
||||||
void updateHighlightAnimation();
|
void updateHighlightAnimation();
|
||||||
void getHighlightAnimation(float* gradientX, float* gradientY, float* color);
|
void getHighlightAnimation(float* gradientX, float* gradientY, float* color);
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
m_pos = { x, y, w, h };
|
m_pos = { x, y, w, h };
|
||||||
}
|
}
|
||||||
|
|
||||||
auto SetPos(Vec4 v) noexcept -> void {
|
auto SetPos(const Vec4& v) noexcept -> void {
|
||||||
m_pos = v;
|
m_pos = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class OptionBoxEntry final : public Widget {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OptionBoxEntry(const std::string& text, Vec4 pos);
|
OptionBoxEntry(const std::string& text, const Vec4& pos);
|
||||||
|
|
||||||
auto Update(Controller* controller, TouchInfo* touch) -> void override {}
|
auto Update(Controller* controller, TouchInfo* touch) -> void override {}
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
||||||
@@ -32,9 +32,10 @@ public:
|
|||||||
using Options = std::vector<Option>;
|
using Options = std::vector<Option>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OptionBox(const std::string& message, const Option& a, Callback cb = [](auto){}, int image = 0); // confirm
|
OptionBox(const std::string& message, const Option& a, const Callback& cb = [](auto){}, int image = 0, bool own_image = false); // confirm
|
||||||
OptionBox(const std::string& message, const Option& a, const Option& b, Callback cb, int image = 0); // yesno
|
OptionBox(const std::string& message, const Option& a, const Option& b, const Callback& cb, int image = 0, bool own_image = false); // yesno
|
||||||
OptionBox(const std::string& message, const Option& a, const Option& b, s64 index, Callback cb, int image = 0); // yesno
|
OptionBox(const std::string& message, const Option& a, const Option& b, s64 index, const Callback& cb, int image = 0, bool own_image = false); // yesno
|
||||||
|
~OptionBox();
|
||||||
|
|
||||||
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
||||||
@@ -46,9 +47,10 @@ private:
|
|||||||
void SetIndex(s64 index);
|
void SetIndex(s64 index);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_message{};
|
const std::string m_message;
|
||||||
Callback m_callback{};
|
const Callback m_callback;
|
||||||
int m_image{};
|
const int m_image;
|
||||||
|
const bool m_own_image;
|
||||||
|
|
||||||
Vec4 m_spacer_line{};
|
Vec4 m_spacer_line{};
|
||||||
|
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ public:
|
|||||||
using Callback = std::function<void(std::optional<s64>)>;
|
using Callback = std::function<void(std::optional<s64>)>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PopupList(std::string title, Items items, Callback cb, s64 index = 0);
|
explicit PopupList(const std::string& title, const Items& items, const Callback& cb, s64 index = 0);
|
||||||
PopupList(std::string title, Items items, Callback cb, std::string index);
|
PopupList(const std::string& title, const Items& items, const Callback& cb, const std::string& index);
|
||||||
PopupList(std::string title, Items items, std::string& index_str_ref, s64& index);
|
PopupList(const std::string& title, const Items& items, std::string& index_str_ref, s64& index);
|
||||||
PopupList(std::string title, Items items, std::string& index_ref);
|
PopupList(const std::string& title, const Items& items, std::string& index_ref);
|
||||||
PopupList(std::string title, Items items, s64& index_ref);
|
PopupList(const std::string& title, const Items& items, s64& index_ref);
|
||||||
|
|
||||||
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
||||||
@@ -29,12 +29,12 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr Vec2 m_title_pos{70.f, 28.f};
|
static constexpr Vec2 m_title_pos{70.f, 28.f};
|
||||||
static constexpr Vec4 m_block{280.f, 110.f, 720.f, 60.f};
|
static constexpr Vec4 m_block{280.f, 110.f, SCREEN_HEIGHT, 60.f};
|
||||||
static constexpr float m_text_xoffset{15.f};
|
static constexpr float m_text_xoffset{15.f};
|
||||||
static constexpr float m_line_width{1220.f};
|
static constexpr float m_line_width{1220.f};
|
||||||
|
|
||||||
std::string m_title{};
|
const std::string m_title;
|
||||||
Items m_items{};
|
const Items m_items;
|
||||||
Callback m_callback{};
|
Callback m_callback{};
|
||||||
s64 m_index{}; // index in list array
|
s64 m_index{}; // index in list array
|
||||||
s64 m_starting_index{};
|
s64 m_starting_index{};
|
||||||
|
|||||||
@@ -11,22 +11,25 @@ namespace sphaira::ui {
|
|||||||
struct ProgressBox;
|
struct ProgressBox;
|
||||||
using ProgressBoxCallback = std::function<Result(ProgressBox*)>;
|
using ProgressBoxCallback = std::function<Result(ProgressBox*)>;
|
||||||
using ProgressBoxDoneCallback = std::function<void(Result rc)>;
|
using ProgressBoxDoneCallback = std::function<void(Result rc)>;
|
||||||
|
// using CancelCallback = std::function<void()>;
|
||||||
|
|
||||||
struct ProgressBox final : Widget {
|
struct ProgressBox final : Widget {
|
||||||
ProgressBox(
|
ProgressBox(
|
||||||
int image,
|
int image,
|
||||||
const std::string& action,
|
const std::string& action,
|
||||||
const std::string& title,
|
const std::string& title,
|
||||||
ProgressBoxCallback callback, ProgressBoxDoneCallback done = [](Result rc){},
|
const ProgressBoxCallback& callback, const ProgressBoxDoneCallback& done = nullptr
|
||||||
int cpuid = 1, int prio = PRIO_PREEMPTIVE, int stack_size = 1024*128
|
|
||||||
);
|
);
|
||||||
~ProgressBox();
|
~ProgressBox();
|
||||||
|
|
||||||
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
||||||
|
|
||||||
|
auto SetActionName(const std::string& action) -> ProgressBox&;
|
||||||
auto SetTitle(const std::string& title) -> ProgressBox&;
|
auto SetTitle(const std::string& title) -> ProgressBox&;
|
||||||
auto NewTransfer(const std::string& transfer) -> ProgressBox&;
|
auto NewTransfer(const std::string& transfer) -> ProgressBox&;
|
||||||
|
// zeros the saved offset.
|
||||||
|
auto ResetTranfser() -> ProgressBox&;
|
||||||
auto UpdateTransfer(s64 offset, s64 size) -> ProgressBox&;
|
auto UpdateTransfer(s64 offset, s64 size) -> ProgressBox&;
|
||||||
// not const in order to avoid copy by using std::swap
|
// not const in order to avoid copy by using std::swap
|
||||||
auto SetImage(int image) -> ProgressBox&;
|
auto SetImage(int image) -> ProgressBox&;
|
||||||
@@ -37,15 +40,14 @@ struct ProgressBox final : Widget {
|
|||||||
auto ShouldExit() -> bool;
|
auto ShouldExit() -> bool;
|
||||||
auto ShouldExitResult() -> Result;
|
auto ShouldExitResult() -> Result;
|
||||||
|
|
||||||
// helper functions
|
void AddCancelEvent(UEvent* event);
|
||||||
auto CopyFile(fs::Fs* fs_src, fs::Fs* fs_dst, const fs::FsPath& src, const fs::FsPath& dst) -> Result;
|
void RemoveCancelEvent(const UEvent* event);
|
||||||
auto CopyFile(fs::Fs* fs, const fs::FsPath& src, const fs::FsPath& dst) -> Result;
|
|
||||||
auto CopyFile(const fs::FsPath& src, const fs::FsPath& dst) -> Result;
|
|
||||||
void Yield();
|
|
||||||
|
|
||||||
auto GetCpuId() const {
|
// helper functions
|
||||||
return m_cpuid;
|
auto CopyFile(fs::Fs* fs_src, fs::Fs* fs_dst, const fs::FsPath& src, const fs::FsPath& dst, bool single_threaded = false) -> Result;
|
||||||
}
|
auto CopyFile(fs::Fs* fs, const fs::FsPath& src, const fs::FsPath& dst, bool single_threaded = false) -> Result;
|
||||||
|
auto CopyFile(const fs::FsPath& src, const fs::FsPath& dst, bool single_threaded = false) -> Result;
|
||||||
|
void Yield();
|
||||||
|
|
||||||
auto OnDownloadProgressCallback() {
|
auto OnDownloadProgressCallback() {
|
||||||
return [this](s64 dltotal, s64 dlnow, s64 ultotal, s64 ulnow){
|
return [this](s64 dltotal, s64 dlnow, s64 ultotal, s64 ulnow){
|
||||||
@@ -63,6 +65,11 @@ struct ProgressBox final : Widget {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// auto-clear = false
|
||||||
|
auto GetCancelEvent() {
|
||||||
|
return &m_uevent;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void FreeImage();
|
void FreeImage();
|
||||||
|
|
||||||
@@ -74,10 +81,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
UEvent m_uevent{};
|
||||||
Mutex m_mutex{};
|
Mutex m_mutex{};
|
||||||
Thread m_thread{};
|
Thread m_thread{};
|
||||||
ThreadData m_thread_data{};
|
ThreadData m_thread_data{};
|
||||||
ProgressBoxDoneCallback m_done{};
|
ProgressBoxDoneCallback m_done{};
|
||||||
|
std::vector<UEvent*> m_cancel_events{};
|
||||||
|
|
||||||
// shared data start.
|
// shared data start.
|
||||||
std::string m_action{};
|
std::string m_action{};
|
||||||
@@ -96,7 +105,6 @@ private:
|
|||||||
ScrollingText m_scroll_title{};
|
ScrollingText m_scroll_title{};
|
||||||
ScrollingText m_scroll_transfer{};
|
ScrollingText m_scroll_transfer{};
|
||||||
|
|
||||||
int m_cpuid{};
|
|
||||||
int m_image{};
|
int m_image{};
|
||||||
bool m_own_image{};
|
bool m_own_image{};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,47 +2,136 @@
|
|||||||
|
|
||||||
#include "ui/widget.hpp"
|
#include "ui/widget.hpp"
|
||||||
#include "ui/list.hpp"
|
#include "ui/list.hpp"
|
||||||
|
#include "ui/scrolling_text.hpp"
|
||||||
|
#include "option.hpp"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <concepts>
|
||||||
|
#include <utility>
|
||||||
|
#include <sys/syslimits.h>
|
||||||
|
|
||||||
namespace sphaira::ui {
|
namespace sphaira::ui {
|
||||||
|
|
||||||
class SidebarEntryBase : public Widget {
|
class SidebarEntryBase : public Widget {
|
||||||
public:
|
public:
|
||||||
SidebarEntryBase(std::string&& title);
|
using DependsCallback = std::function<bool(void)>;
|
||||||
virtual auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
using DependsClickCallback = std::function<void(void)>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SidebarEntryBase(const std::string& title, const std::string& info);
|
||||||
|
|
||||||
|
using Widget::Draw;
|
||||||
|
virtual void Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos, bool left);
|
||||||
|
auto OnFocusGained() noexcept -> void override;
|
||||||
|
auto OnFocusLost() noexcept -> void override;
|
||||||
|
|
||||||
|
void DrawEntry(NVGcontext* vg, Theme* theme, const std::string& left, const std::string& right, bool use_selected);
|
||||||
|
|
||||||
|
void Depends(const DependsCallback& callback, const std::string& depends_info, const DependsClickCallback& depends_click = {}) {
|
||||||
|
m_depends_callback = callback;
|
||||||
|
m_depends_info = depends_info;
|
||||||
|
m_depends_click = depends_click;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Depends(bool& value, const std::string& depends_info, const DependsClickCallback& depends_click = {}) {
|
||||||
|
m_depends_callback = [&value](){ return value; };
|
||||||
|
m_depends_info = depends_info;
|
||||||
|
m_depends_click = depends_click;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Depends(option::OptionBool& value, const std::string& depends_info, const DependsClickCallback& depends_click = {}) {
|
||||||
|
m_depends_callback = [&value](){ return value.Get(); };
|
||||||
|
m_depends_info = depends_info;
|
||||||
|
m_depends_click = depends_click;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDirty(bool dirty = true) {
|
||||||
|
m_dirty = dirty;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto IsDirty() const -> bool {
|
||||||
|
return m_dirty;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string m_title;
|
auto IsEnabled() const -> bool {
|
||||||
|
if (m_depends_callback) {
|
||||||
|
return m_depends_callback();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DependsClick() const {
|
||||||
|
if (m_depends_click) {
|
||||||
|
m_depends_click();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const std::string m_title;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const std::string m_info;
|
||||||
|
std::string m_depends_info{};
|
||||||
|
DependsCallback m_depends_callback{};
|
||||||
|
DependsClickCallback m_depends_click{};
|
||||||
|
ScrollingText m_scolling_title{};
|
||||||
|
ScrollingText m_scolling_value{};
|
||||||
|
bool m_dirty{};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
concept DerivedFromSidebarBase = std::is_base_of_v<SidebarEntryBase, T>;
|
||||||
|
|
||||||
class SidebarEntryBool final : public SidebarEntryBase {
|
class SidebarEntryBool final : public SidebarEntryBase {
|
||||||
public:
|
public:
|
||||||
using Callback = std::function<void(bool&)>;
|
using Callback = std::function<void(bool&)>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SidebarEntryBool(std::string title, bool option, Callback cb, std::string true_str = "On", std::string false_str = "Off");
|
explicit SidebarEntryBool(const std::string& title, bool option, const Callback& cb, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||||
SidebarEntryBool(std::string title, bool& option, std::string true_str = "On", std::string false_str = "Off");
|
explicit SidebarEntryBool(const std::string& title, bool& option, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||||
|
explicit SidebarEntryBool(const std::string& title, option::OptionBool& option, const Callback& cb, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||||
|
explicit SidebarEntryBool(const std::string& title, option::OptionBool& option, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos, bool left) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
|
||||||
|
|
||||||
bool m_option;
|
bool m_option;
|
||||||
Callback m_callback;
|
Callback m_callback;
|
||||||
std::string m_true_str;
|
std::string m_true_str;
|
||||||
std::string m_false_str;
|
std::string m_false_str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SidebarEntrySlider final : public SidebarEntryBase {
|
||||||
|
public:
|
||||||
|
using Callback = std::function<void(float&)>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SidebarEntrySlider(const std::string& title, float value, float min, float max, int steps, const Callback& cb, const std::string& info = "");
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos, bool left) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
float m_value;
|
||||||
|
float m_min;
|
||||||
|
float m_max;
|
||||||
|
int m_steps;
|
||||||
|
Callback m_callback;
|
||||||
|
|
||||||
|
float m_duration;
|
||||||
|
float m_inc;
|
||||||
|
};
|
||||||
|
|
||||||
class SidebarEntryCallback final : public SidebarEntryBase {
|
class SidebarEntryCallback final : public SidebarEntryBase {
|
||||||
public:
|
public:
|
||||||
using Callback = std::function<void()>;
|
using Callback = std::function<void()>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SidebarEntryCallback(std::string title, Callback cb, bool pop_on_click = false);
|
explicit SidebarEntryCallback(const std::string& title, const Callback& cb, const std::string& info);
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
explicit SidebarEntryCallback(const std::string& title, const Callback& cb, bool pop_on_click = false, const std::string& info = "");
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos, bool left) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Callback m_callback;
|
const Callback m_callback;
|
||||||
bool m_pop_on_click;
|
const bool m_pop_on_click;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SidebarEntryArray final : public SidebarEntryBase {
|
class SidebarEntryArray final : public SidebarEntryBase {
|
||||||
@@ -52,85 +141,144 @@ public:
|
|||||||
using Callback = std::function<void(s64& index)>;
|
using Callback = std::function<void(s64& index)>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SidebarEntryArray(std::string title, Items items, Callback cb, s64 index = 0);
|
explicit SidebarEntryArray(const std::string& title, const Items& items, const Callback& cb, s64 index = 0, const std::string& info = "");
|
||||||
SidebarEntryArray(std::string title, Items items, Callback cb, std::string index);
|
explicit SidebarEntryArray(const std::string& title, const Items& items, const Callback& cb, const std::string& index, const std::string& info = "");
|
||||||
SidebarEntryArray(std::string title, Items items, std::string& index);
|
explicit SidebarEntryArray(const std::string& title, const Items& items, std::string& index, const std::string& info = "");
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos, bool left) override;
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
|
||||||
auto OnFocusGained() noexcept -> void override;
|
|
||||||
auto OnFocusLost() noexcept -> void override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Items m_items;
|
const Items m_items;
|
||||||
ListCallback m_list_callback;
|
const Callback m_callback;
|
||||||
Callback m_callback;
|
|
||||||
s64 m_index;
|
s64 m_index;
|
||||||
s64 m_tick{};
|
ListCallback m_list_callback{};
|
||||||
float m_text_yoff{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
// single text entry.
|
||||||
class SidebarEntrySlider final : public SidebarEntryBase {
|
// the callback is called when the entry is clicked.
|
||||||
|
// usually, the within the callback the text will be changed, use SetText().
|
||||||
|
class SidebarEntryTextBase : public SidebarEntryBase {
|
||||||
public:
|
public:
|
||||||
SidebarEntrySlider(std::string title, T& value, T min, T max)
|
using Callback = std::function<void(void)>;
|
||||||
: SidebarEntryBase{title}
|
|
||||||
, m_value{value}
|
|
||||||
, m_min{min}
|
|
||||||
, m_max{max} {
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit SidebarEntryTextBase(const std::string& title, const std::string& value, const Callback& cb, const std::string& info = "");
|
||||||
|
|
||||||
|
void Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos, bool left) override;
|
||||||
|
|
||||||
|
void SetCallback(const Callback& cb) {
|
||||||
|
m_callback = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
auto GetValue() const -> const std::string& {
|
||||||
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
return m_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetValue(const std::string& value) {
|
||||||
|
m_value = value;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T& m_value;
|
std::string m_value;
|
||||||
T m_min;
|
Callback m_callback;
|
||||||
T m_max;
|
|
||||||
T m_step{};
|
|
||||||
Vec4 m_bar{};
|
|
||||||
Vec4 m_bar_fill{};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Sidebar final : public Widget {
|
class SidebarEntryTextInput final : public SidebarEntryTextBase {
|
||||||
public:
|
public:
|
||||||
enum class Side { LEFT, RIGHT };
|
using Callback = std::function<void(SidebarEntryTextInput* input)>;
|
||||||
using Items = std::vector<std::shared_ptr<SidebarEntryBase>>;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Sidebar(std::string title, Side side, Items&& items);
|
// uses normal keyboard.
|
||||||
Sidebar(std::string title, Side side);
|
explicit SidebarEntryTextInput(const std::string& title, const std::string& value, const std::string& header = {}, const std::string& guide = {}, s64 len_min = -1, s64 len_max = PATH_MAX, const std::string& info = "", const Callback& callback = nullptr);
|
||||||
Sidebar(std::string title, std::string sub, Side side, Items&& items);
|
// uses numpad.
|
||||||
Sidebar(std::string title, std::string sub, Side side);
|
explicit SidebarEntryTextInput(const std::string& title, s64 value, const std::string& header = {}, const std::string& guide = {}, s64 len_min = -1, s64 len_max = PATH_MAX, const std::string& info = "", const Callback& callback = nullptr);
|
||||||
|
|
||||||
|
auto GetNumValue() const -> s64 {
|
||||||
|
return std::stoul(GetValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetNumValue(s64 value) {
|
||||||
|
SetValue(std::to_string(value));
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
const std::string m_header;
|
||||||
|
const std::string m_guide;
|
||||||
|
const s64 m_len_min;
|
||||||
|
const s64 m_len_max;
|
||||||
|
const Callback m_callback;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SidebarEntryFilePicker final : public SidebarEntryTextBase {
|
||||||
|
public:
|
||||||
|
explicit SidebarEntryFilePicker(const std::string& title, const std::string& value, const std::vector<std::string>& filter, const std::string& info = "");
|
||||||
|
|
||||||
|
// extension filter.
|
||||||
|
void SetFilter(const std::vector<std::string>& filter) {
|
||||||
|
m_filter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<std::string> m_filter{};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Sidebar : public Widget {
|
||||||
|
public:
|
||||||
|
enum class Side { LEFT, RIGHT };
|
||||||
|
using Items = std::vector<std::unique_ptr<SidebarEntryBase>>;
|
||||||
|
using OnExitWhenChangedCallback = std::function<void()>;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Sidebar(const std::string& title, Side side, float width = 450.f);
|
||||||
|
explicit Sidebar(const std::string& title, const std::string& sub, Side side, float width = 450.f);
|
||||||
|
~Sidebar();
|
||||||
|
|
||||||
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
||||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
||||||
auto OnFocusGained() noexcept -> void override;
|
auto OnFocusGained() noexcept -> void override;
|
||||||
auto OnFocusLost() noexcept -> void override;
|
auto OnFocusLost() noexcept -> void override;
|
||||||
|
|
||||||
void Add(std::shared_ptr<SidebarEntryBase> entry);
|
auto Add(std::unique_ptr<SidebarEntryBase>&& entry) -> SidebarEntryBase*;
|
||||||
|
|
||||||
|
template<DerivedFromSidebarBase T, typename... Args>
|
||||||
|
auto Add(Args&&... args) -> T* {
|
||||||
|
return (T*)Add(std::make_unique<T>(std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
|
// sets a callback that is called on exit when the any options were changed.
|
||||||
|
// the change detection isn't perfect, it just checks if the A button was pressed...
|
||||||
|
void SetOnExitWhenChanged(const OnExitWhenChangedCallback& cb) {
|
||||||
|
m_on_exit_when_changed = cb;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetIndex(s64 index);
|
void SetIndex(s64 index);
|
||||||
void SetupButtons();
|
void SetupButtons();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_title;
|
const std::string m_title;
|
||||||
std::string m_sub;
|
const std::string m_sub;
|
||||||
Side m_side;
|
const Side m_side;
|
||||||
Items m_items;
|
Items m_items{};
|
||||||
s64 m_index{};
|
s64 m_index{};
|
||||||
|
|
||||||
std::unique_ptr<List> m_list;
|
std::unique_ptr<List> m_list{};
|
||||||
|
|
||||||
Vec4 m_top_bar{};
|
Vec4 m_top_bar{};
|
||||||
Vec4 m_bottom_bar{};
|
Vec4 m_bottom_bar{};
|
||||||
Vec2 m_title_pos{};
|
Vec2 m_title_pos{};
|
||||||
Vec4 m_base_pos{};
|
Vec4 m_base_pos{};
|
||||||
|
|
||||||
|
OnExitWhenChangedCallback m_on_exit_when_changed{};
|
||||||
|
|
||||||
static constexpr float m_title_size{28.f};
|
static constexpr float m_title_size{28.f};
|
||||||
// static constexpr Vec2 box_size{380.f, 70.f};
|
// static constexpr Vec2 box_size{380.f, 70.f};
|
||||||
static constexpr Vec2 m_box_size{400.f, 70.f};
|
static constexpr Vec2 m_box_size{400.f, 70.f};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class FormSidebar : public Sidebar {
|
||||||
|
public:
|
||||||
|
explicit FormSidebar(const std::string& title) : Sidebar{title, Side::LEFT, 540.f} {
|
||||||
|
// explicit FormSidebar(const std::string& title) : Sidebar{title, Side::LEFT} {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace sphaira::ui
|
} // namespace sphaira::ui
|
||||||
|
|||||||