Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
bscarell authored Nov 12, 2023
1 parent 89b8604 commit 137bbf0
Show file tree
Hide file tree
Showing 62 changed files with 49,610 additions and 49,215 deletions.
82 changes: 41 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
export GITHASH := $(shell git rev-parse --short HEAD)
export VERSION := 2.0.0
export API_VERSION := 4
export WANT_FLAC := 1
export WANT_MP3 := 1
export WANT_WAV := 1

all: overlay nxExt module

clean:
$(MAKE) -C sys-tune/nxExt clean
$(MAKE) -C overlay clean
$(MAKE) -C sys-tune clean
-rm -r dist
-rm sys-tune-*-*.zip

overlay:
$(MAKE) -C overlay

nxExt:
$(MAKE) -C sys-tune/nxExt

module:
$(MAKE) -C sys-tune

dist: all
mkdir -p dist/switch/.overlays
mkdir -p dist/atmosphere/contents/4200000000000000
cp sys-tune/sys-tune.nsp dist/atmosphere/contents/4200000000000000/exefs.nsp
cp overlay/sys-tune-overlay.ovl dist/switch/.overlays/
cp sys-tune/toolbox.json dist/atmosphere/contents/4200000000000000/
cd dist; zip -r sys-tune-$(VERSION)-$(GITHASH).zip ./**/; cd ../;
-hactool -t nso sys-tune/sys-tune.nso

wah:
$(MAKE) overlay -j66
$(MAKE) sys-tune/nxExt -j66
$(MAKE) sys-tune -j66
$(MAKE) all -j66

.PHONY: all overlay module
export GITHASH := $(shell git rev-parse --short HEAD)
export VERSION := 2.0.0
export API_VERSION := 4
export WANT_FLAC := 1
export WANT_MP3 := 1
export WANT_WAV := 1

all: overlay nxExt module

clean:
$(MAKE) -C sys-tune/nxExt clean
$(MAKE) -C overlay clean
$(MAKE) -C sys-tune clean
-rm -r dist
-rm sys-tune-*-*.zip

overlay:
$(MAKE) -C overlay

nxExt:
$(MAKE) -C sys-tune/nxExt

module:
$(MAKE) -C sys-tune

dist: all
mkdir -p dist/switch/.overlays
mkdir -p dist/atmosphere/contents/4200000000000000
cp sys-tune/sys-tune.nsp dist/atmosphere/contents/4200000000000000/exefs.nsp
cp overlay/sys-tune-overlay.ovl dist/switch/.overlays/
cp sys-tune/toolbox.json dist/atmosphere/contents/4200000000000000/
cd dist; zip -r sys-tune-$(VERSION)-$(GITHASH).zip ./**/; cd ../;
-hactool -t nso sys-tune/sys-tune.nso

wah:
$(MAKE) overlay -j66
$(MAKE) sys-tune/nxExt -j66
$(MAKE) sys-tune -j66
$(MAKE) all -j66

.PHONY: all overlay module
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
sys-tune is fixed yall
# sys-tune
## Background audio player for the Nintendo switch + Tesla overlay

## Installation
1. Download the release zip from [here](https://github.com/HookedBehemoth/sys-tune/releases/latest)
2. Extract the zip to the root of your sd card.
3. Put mp3, flac, wav or wave files to your sd card.

You can manage playback via the Tesla overlay in the release.

## Screenshots
![Main](/sample/libtesla_1586882452.jpg)
![Main](/sample/libtesla_1586882672.jpg)
![Main](/sample/libtesla_1586882735.jpg)
(Alpha values are wrong in these screenshots. The overlay will be less transparent.)

## Special thanks to:
- [mackron](http://mackron.github.io/) who made the awesome [audio decoders used here.](https://github.com/mackron/dr_libs/)
- [WerWolv](https://werwolv.net/) for making libtesla, the UI library used for the control overlay.
- [TotalJustice](https://github.com/ITotalJustice) for bug fixes, adding some features and bad code.

## Info for developers
I implemented an IPC interface accessible via service wrappers [here](/ipc/).

My [Tesla overlay](/overlay/source/) uses these bindings.
246 changes: 123 additions & 123 deletions common/config/config.cpp
Original file line number Diff line number Diff line change
@@ -1,123 +1,123 @@
#include "config.hpp"
#include "sdmc/sdmc.hpp"
#include "minIni/minIni.h"
#include <cstdio>

namespace config {

namespace {

const char CONFIG_PATH[]{"/config/sys-tune/config.ini"};
// blacklist uses it's own config file because eventually a database
// may be setup and users can easily update their blacklist by downloading
// an updated blacklist.ini.
// Also, the blacklist lookup needs to be as fast as possible
// (literally a race until the title opens audren), so a seperate, smaller file is ideal.
const char BLACKLIST_PATH[]{"/config/sys-tune/blacklist.ini"};

void create_config_dir() {
/* Creating directory on every set call looks sus, but the user may delete the dir */
/* whilst the sys-mod is running and then any changes made via the overlay */
/* is lost, which sucks. */
sdmc::CreateFolder("/config");
sdmc::CreateFolder("/config/sys-tune");
}

auto get_tid_str(u64 tid) -> const char* {
static char buf[21]{};
std::sprintf(buf, "%016lX", tid);
return buf;
}

}

auto get_shuffle() -> bool {
return ini_getbool("config", "shuffle", false, CONFIG_PATH);
}

void set_shuffle(bool value) {
create_config_dir();
ini_putl("config", "shuffle", value, CONFIG_PATH);
}

auto get_repeat() -> int {
return ini_getl("config", "repeat", 1, CONFIG_PATH);
}

void set_repeat(int value) {
create_config_dir();
ini_putl("config", "repeat", value, CONFIG_PATH);
}

auto get_bass() -> double {
return ini_getf("config", "bass", 1.f, CONFIG_PATH);
}

void set_bass(double value) {
create_config_dir();
ini_putf("config", "bass", value, CONFIG_PATH);
}

auto get_volume() -> double {
return ini_getf("config", "volume", 1.f, CONFIG_PATH);
}

void set_volume(double value) {
create_config_dir();
ini_putf("config", "volume", value, CONFIG_PATH);
}

auto has_title_enabled(u64 tid) -> bool {
return ini_haskey("title", get_tid_str(tid), CONFIG_PATH);
}

auto get_title_enabled(u64 tid) -> bool {
return ini_getbool("title", get_tid_str(tid), true, CONFIG_PATH);
}

void set_title_enabled(u64 tid, bool value) {
create_config_dir();
ini_putl("title", get_tid_str(tid), value, CONFIG_PATH);
}

auto get_title_enabled_default() -> bool {
return ini_getbool("title", "default", true, CONFIG_PATH);
}

void set_title_enabled_default(bool value) {
create_config_dir();
ini_putl("title", "default", value, CONFIG_PATH);
}

auto has_title_volume(u64 tid) -> bool {
return ini_haskey("volume", get_tid_str(tid), CONFIG_PATH);
}

auto get_title_volume(u64 tid) -> double {
return ini_getf("volume", get_tid_str(tid), 1.f, CONFIG_PATH);
}

void set_title_volume(u64 tid, double value) {
create_config_dir();
ini_putf("volume", get_tid_str(tid), value, CONFIG_PATH);
}

auto get_default_title_volume() -> double {
return ini_getf("config", "global_volume", 1.f, CONFIG_PATH);
}

void set_default_title_volume(double value) {
create_config_dir();
ini_putf("config", "global_volume", value, CONFIG_PATH);
}

auto get_title_blacklist(u64 tid) -> bool {
return ini_getbool("blacklist", get_tid_str(tid), false, BLACKLIST_PATH);
}

void set_title_blacklist(u64 tid, bool value) {
create_config_dir();
ini_putl("blacklist", get_tid_str(tid), value, BLACKLIST_PATH);
}

}
#include "config.hpp"
#include "sdmc/sdmc.hpp"
#include "minIni/minIni.h"
#include <cstdio>

namespace config {

namespace {

const char CONFIG_PATH[]{"/config/sys-tune/config.ini"};
// blacklist uses it's own config file because eventually a database
// may be setup and users can easily update their blacklist by downloading
// an updated blacklist.ini.
// Also, the blacklist lookup needs to be as fast as possible
// (literally a race until the title opens audren), so a seperate, smaller file is ideal.
const char BLACKLIST_PATH[]{"/config/sys-tune/blacklist.ini"};

void create_config_dir() {
/* Creating directory on every set call looks sus, but the user may delete the dir */
/* whilst the sys-mod is running and then any changes made via the overlay */
/* is lost, which sucks. */
sdmc::CreateFolder("/config");
sdmc::CreateFolder("/config/sys-tune");
}

auto get_tid_str(u64 tid) -> const char* {
static char buf[21]{};
std::sprintf(buf, "%016lX", tid);
return buf;
}

}

auto get_shuffle() -> bool {
return ini_getbool("config", "shuffle", false, CONFIG_PATH);
}

void set_shuffle(bool value) {
create_config_dir();
ini_putl("config", "shuffle", value, CONFIG_PATH);
}

auto get_repeat() -> int {
return ini_getl("config", "repeat", 1, CONFIG_PATH);
}

void set_repeat(int value) {
create_config_dir();
ini_putl("config", "repeat", value, CONFIG_PATH);
}

auto get_bass() -> double {
return ini_getf("config", "bass", 1.f, CONFIG_PATH);
}

void set_bass(double value) {
create_config_dir();
ini_putf("config", "bass", value, CONFIG_PATH);
}

auto get_volume() -> double {
return ini_getf("config", "volume", 1.f, CONFIG_PATH);
}

void set_volume(double value) {
create_config_dir();
ini_putf("config", "volume", value, CONFIG_PATH);
}

auto has_title_enabled(u64 tid) -> bool {
return ini_haskey("title", get_tid_str(tid), CONFIG_PATH);
}

auto get_title_enabled(u64 tid) -> bool {
return ini_getbool("title", get_tid_str(tid), true, CONFIG_PATH);
}

void set_title_enabled(u64 tid, bool value) {
create_config_dir();
ini_putl("title", get_tid_str(tid), value, CONFIG_PATH);
}

auto get_title_enabled_default() -> bool {
return ini_getbool("title", "default", true, CONFIG_PATH);
}

void set_title_enabled_default(bool value) {
create_config_dir();
ini_putl("title", "default", value, CONFIG_PATH);
}

auto has_title_volume(u64 tid) -> bool {
return ini_haskey("volume", get_tid_str(tid), CONFIG_PATH);
}

auto get_title_volume(u64 tid) -> double {
return ini_getf("volume", get_tid_str(tid), 1.f, CONFIG_PATH);
}

void set_title_volume(u64 tid, double value) {
create_config_dir();
ini_putf("volume", get_tid_str(tid), value, CONFIG_PATH);
}

auto get_default_title_volume() -> double {
return ini_getf("config", "global_volume", 1.f, CONFIG_PATH);
}

void set_default_title_volume(double value) {
create_config_dir();
ini_putf("config", "global_volume", value, CONFIG_PATH);
}

auto get_title_blacklist(u64 tid) -> bool {
return ini_getbool("blacklist", get_tid_str(tid), false, BLACKLIST_PATH);
}

void set_title_blacklist(u64 tid, bool value) {
create_config_dir();
ini_putl("blacklist", get_tid_str(tid), value, BLACKLIST_PATH);
}

}
Loading

0 comments on commit 137bbf0

Please sign in to comment.