mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-03-21 17:24:37 -05:00
Add defineable path
This commit is contained in:
parent
d0a6aed45d
commit
052b24b1be
2
Makefile
2
Makefile
|
|
@ -38,7 +38,7 @@ INCLUDES := inc
|
|||
EXEFS_SRC := exefs_src
|
||||
APP_TITLE := JKSV
|
||||
APP_AUTHOR := JK
|
||||
APP_VERSION := 04.26.2020
|
||||
APP_VERSION := 04.30.2020
|
||||
ROMFS := romfs
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
# JKSV
|
||||
|
||||
Data Dump/Restore tool for Switch.
|
||||
<center>
|
||||
<img width="640" src="https://i.imgur.com/3hAVzkQ.jpg"/>
|
||||
</center>
|
||||
|
||||
## Info
|
||||
JKSV on Switch started as a small project/port to test some things and get familiar with libnx. A list of what it currently can do:
|
||||
|
|
@ -22,6 +20,8 @@ JKSV on Switch started as a small project/port to test some things and get famil
|
|||
* Hold R while opening a game or applet with Atmosphere so the homebrew menu loads. Open JKSV and press minus and select **Mount Process RomFS**. The romfs of the app should appear in the browser along with your SD on the right.
|
||||
|
||||
## Quick Guide
|
||||
**A custom path can be defined by creating "sdmc:/switch/jksv_dir.txt" and typing the path you want to use. For example, `sdmc:/switch/JKSV/` will force JKSV to create its folder in the switch homebrew folder.**
|
||||
|
||||
1. User Select
|
||||
* A opens the selected user's save files.
|
||||
* Y Dumps __all__ save data from __all users__, device save data, and BCAT save data. System save data is not included in this.
|
||||
|
|
|
|||
4
inc/ui.h
4
inc/ui.h
|
|
@ -62,10 +62,10 @@ namespace ui
|
|||
|
||||
extern std::vector<ui::button> selButtons;
|
||||
|
||||
//Sets colors and stuff
|
||||
//Sets colors and loads font for icon creation
|
||||
void initTheme();
|
||||
|
||||
//Loads in the A, B, X, Y button graphics
|
||||
//Loads graphics and stuff
|
||||
void init();
|
||||
void exit();
|
||||
|
||||
|
|
|
|||
3
src/ex.c
3
src/ex.c
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
Result fsOpenDataFileSystemByCurrentProcess(FsFileSystem *out)
|
||||
{
|
||||
/*Result ret = 0;
|
||||
/*
|
||||
Result ret = 0;
|
||||
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
|
|
|
|||
40
src/file.cpp
40
src/file.cpp
|
|
@ -128,13 +128,40 @@ static inline size_t fsize(const std::string& _f)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void mkdirRec(const std::string& _p)
|
||||
{
|
||||
//skip first slash
|
||||
size_t pos = _p.find('/', 0) + 1;
|
||||
while((pos = _p.find('/', pos)) != _p.npos)
|
||||
{
|
||||
std::string create;
|
||||
create.assign(_p.begin(), _p.begin() + pos);
|
||||
mkdir(create.c_str(), 777);
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
|
||||
namespace fs
|
||||
{
|
||||
void init()
|
||||
{
|
||||
mkdir("sdmc:/JKSV", 777);
|
||||
logOpen();
|
||||
wd = "sdmc:/JKSV/";
|
||||
if(fs::fileExists("sdmc:/switch/jksv_dir.txt"))
|
||||
{
|
||||
char tmp[256];
|
||||
FILE *getDir = fopen("sdmc:/switch/jksv_dir.txt", "r");
|
||||
fgets(tmp, 256, getDir);
|
||||
fclose(getDir);
|
||||
wd = tmp;
|
||||
util::stripNL(wd);
|
||||
mkdirRec(wd);
|
||||
}
|
||||
else
|
||||
{
|
||||
mkdir("sdmc:/JKSV", 777);
|
||||
wd = "sdmc:/JKSV/";
|
||||
}
|
||||
//to fix later
|
||||
//logOpen();
|
||||
}
|
||||
|
||||
void exit()
|
||||
|
|
@ -500,10 +527,11 @@ namespace fs
|
|||
|
||||
void logOpen()
|
||||
{
|
||||
remove("sdmc:/JKSV/log.txt");
|
||||
std::string logPath = wd + "log.txt";
|
||||
remove(logPath.c_str());
|
||||
FsFileSystem *sd = fsdevGetDeviceFileSystem("sdmc");
|
||||
fsFsCreateFile(sd, "/JKSV/log.txt", 0, FsWriteOption_Flush);
|
||||
fsFsOpenFile(sd, "/JKSV/log.txt", FsOpenMode_Write, &logFile);
|
||||
fsFsCreateFile(sd, logPath.c_str(), 0, FsWriteOption_Flush);
|
||||
fsFsOpenFile(sd, logPath.c_str(), FsOpenMode_Write, &logFile);
|
||||
}
|
||||
|
||||
void logWrite(const char *fmt, ...)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ bool graphicsInit(int windowWidth, int windowHeight)
|
|||
|
||||
framebufferCreate(&fb, window, windowWidth, windowHeight, PIXEL_FORMAT_RGBA_8888, 2);
|
||||
framebufferMakeLinear(&fb);
|
||||
plInitialize();
|
||||
plInitialize(PlServiceType_System);
|
||||
|
||||
//Make a fake tex that points to framebuffer
|
||||
frameBuffer = malloc(sizeof(tex));
|
||||
|
|
|
|||
63
src/ui.cpp
63
src/ui.cpp
|
|
@ -10,7 +10,7 @@
|
|||
#include "util.h"
|
||||
#include "file.h"
|
||||
|
||||
#define VER_STRING "v. 04.26.2020"
|
||||
#define VER_STRING "v. 04.30.2020"
|
||||
|
||||
//Nav buttons
|
||||
std::vector<ui::button> usrNav, ttlNav, fldNav;
|
||||
|
|
@ -94,25 +94,9 @@ namespace ui
|
|||
|
||||
setsysGetColorSetId(&thmID);
|
||||
|
||||
mnuTopLeft = texLoadPNGFile("romfs:/img/fb/menuTopLeft.png");
|
||||
mnuTopRight = texLoadPNGFile("romfs:/img/fb/menuTopRight.png");
|
||||
mnuBotLeft = texLoadPNGFile("romfs:/img/fb/menuBotLeft.png");
|
||||
mnuBotRight = texLoadPNGFile("romfs:/img/fb/menuBotRight.png");
|
||||
|
||||
switch(thmID)
|
||||
{
|
||||
case ColorSetId_Light:
|
||||
//Dark corners
|
||||
cornerTopLeft = texLoadPNGFile("romfs:/img/tboxDrk/tboxCornerTopLeft.png");
|
||||
cornerTopRight = texLoadPNGFile("romfs:/img/tboxDrk/tboxCornerTopRight.png");
|
||||
cornerBottomLeft = texLoadPNGFile("romfs:/img/tboxDrk/tboxCornerBotLeft.png");
|
||||
cornerBottomRight = texLoadPNGFile("romfs:/img/tboxDrk/tboxCornerBotRight.png");
|
||||
progCovLeft = texLoadPNGFile("romfs:/img/tboxDrk/progBarCoverLeftDrk.png");
|
||||
progCovRight = texLoadPNGFile("romfs:/img/tboxDrk/progBarCoverRightDrk.png");
|
||||
|
||||
icn = texLoadPNGFile("romfs:/img/icn/icnDrk.png");
|
||||
sideBar = texLoadPNGFile("romfs:/img/fb/lLight.png");
|
||||
|
||||
clearClr = clrCreateU32(0xFFEBEBEB);
|
||||
mnuTxt = clrCreateU32(0xFF000000);
|
||||
txtClr = clrCreateU32(0xFFFFFFFF);
|
||||
|
|
@ -127,17 +111,6 @@ namespace ui
|
|||
case ColorSetId_Dark:
|
||||
//jic
|
||||
thmID = ColorSetId_Dark;
|
||||
//Light corners
|
||||
cornerTopLeft = texLoadPNGFile("romfs:/img/tboxLght/tboxCornerTopLeft.png");
|
||||
cornerTopRight = texLoadPNGFile("romfs:/img/tboxLght/tboxCornerTopRight.png");
|
||||
cornerBottomLeft = texLoadPNGFile("romfs:/img/tboxLght/tboxCornerBotLeft.png");
|
||||
cornerBottomRight = texLoadPNGFile("romfs:/img/tboxLght/tboxCornerBotRight.png");
|
||||
progCovLeft = texLoadPNGFile("romfs:/img/tboxLght/progBarCoverLeftLight.png");
|
||||
progCovRight = texLoadPNGFile("romfs:/img/tboxLght/progBarCoverRightLight.png");
|
||||
|
||||
icn = texLoadPNGFile("romfs:/img/icn/icnLght.png");
|
||||
sideBar = texLoadPNGFile("romfs:/img/fb/lDark.png");
|
||||
|
||||
clearClr = clrCreateU32(0xFF2D2D2D);
|
||||
mnuTxt = clrCreateU32(0xFFFFFFFF);
|
||||
txtClr = clrCreateU32(0xFF000000);
|
||||
|
|
@ -152,6 +125,39 @@ namespace ui
|
|||
|
||||
void init()
|
||||
{
|
||||
mnuTopLeft = texLoadPNGFile("romfs:/img/fb/menuTopLeft.png");
|
||||
mnuTopRight = texLoadPNGFile("romfs:/img/fb/menuTopRight.png");
|
||||
mnuBotLeft = texLoadPNGFile("romfs:/img/fb/menuBotLeft.png");
|
||||
mnuBotRight = texLoadPNGFile("romfs:/img/fb/menuBotRight.png");
|
||||
switch(ui::thmID)
|
||||
{
|
||||
case ColorSetId_Light:
|
||||
//Dark corners
|
||||
cornerTopLeft = texLoadPNGFile("romfs:/img/tboxDrk/tboxCornerTopLeft.png");
|
||||
cornerTopRight = texLoadPNGFile("romfs:/img/tboxDrk/tboxCornerTopRight.png");
|
||||
cornerBottomLeft = texLoadPNGFile("romfs:/img/tboxDrk/tboxCornerBotLeft.png");
|
||||
cornerBottomRight = texLoadPNGFile("romfs:/img/tboxDrk/tboxCornerBotRight.png");
|
||||
progCovLeft = texLoadPNGFile("romfs:/img/tboxDrk/progBarCoverLeftDrk.png");
|
||||
progCovRight = texLoadPNGFile("romfs:/img/tboxDrk/progBarCoverRightDrk.png");
|
||||
|
||||
icn = texLoadPNGFile("romfs:/img/icn/icnDrk.png");
|
||||
sideBar = texLoadPNGFile("romfs:/img/fb/lLight.png");
|
||||
break;
|
||||
|
||||
default:
|
||||
//Light corners
|
||||
cornerTopLeft = texLoadPNGFile("romfs:/img/tboxLght/tboxCornerTopLeft.png");
|
||||
cornerTopRight = texLoadPNGFile("romfs:/img/tboxLght/tboxCornerTopRight.png");
|
||||
cornerBottomLeft = texLoadPNGFile("romfs:/img/tboxLght/tboxCornerBotLeft.png");
|
||||
cornerBottomRight = texLoadPNGFile("romfs:/img/tboxLght/tboxCornerBotRight.png");
|
||||
progCovLeft = texLoadPNGFile("romfs:/img/tboxLght/progBarCoverLeftLight.png");
|
||||
progCovRight = texLoadPNGFile("romfs:/img/tboxLght/progBarCoverRightLight.png");
|
||||
|
||||
icn = texLoadPNGFile("romfs:/img/icn/icnLght.png");
|
||||
sideBar = texLoadPNGFile("romfs:/img/fb/lDark.png");
|
||||
break;
|
||||
}
|
||||
|
||||
top = texCreate(1280, 88);
|
||||
bot = texCreate(1280, 72);
|
||||
|
||||
|
|
@ -193,7 +199,6 @@ namespace ui
|
|||
folderHelpX = 1220 - textGetWidth(folderHelp.c_str(), ui::shared, 18);
|
||||
optHelpX = 1220 - textGetWidth(optHelp.c_str(), ui::shared, 18);
|
||||
|
||||
|
||||
advCopyMenuPrep();
|
||||
ui::exMenuPrep();
|
||||
ui::optMenuInit();
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ void performCopyMenuOps()
|
|||
fs::getDirProps(fullPath, dirCnt, fileCnt, fileSize);
|
||||
char mess[256];
|
||||
sprintf(mess, "#%s#:\n%u Folders\n%u Files\nTotal Size: %.2fMB", fullPath.c_str(), dirCnt, fileCnt, (float)((float)fileSize / 1024 / 1024));
|
||||
ui::showMessage(mess, "Folder Props");
|
||||
ui::showMessage("Folder Properties", mess);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -250,6 +250,9 @@ namespace util
|
|||
size_t pos = 0;
|
||||
while((pos = _s.find('\n')) != _s.npos)
|
||||
_s.erase(pos, 1);
|
||||
|
||||
while((pos = _s.find('\r')) != _s.npos)
|
||||
_s.erase(pos, 1);
|
||||
}
|
||||
|
||||
void replaceButtonsInString(std::string& rep)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user