mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-04-24 23:37:24 -05:00
Update readme + small stuff
This commit is contained in:
parent
89ab57b8ea
commit
fceaf2e21f
19
README.MD
19
README.MD
|
|
@ -1,17 +1,16 @@
|
|||
# JKSV
|
||||
|
||||
WIP save manager for Switch. Started to get familiar with libnx and test my basic, _mostly_ self written graphics drawing file. **This is still a WIP. Nothing is final yet!**
|
||||
WIP tool/whatever I want for Switch.
|
||||
|
||||
**A custom 1280x720 background can be used by placing a JPEG named 'back.jpg' in the JKSV folder ex: "_sdmc:/JKSV/back.jpg_"**
|
||||
|
||||
**A custom font can be loaded by placing a TTF file in the folder named 'font.ttf' ex: "_sdmc:/JKSV/font.ttf_"**
|
||||
|
||||
More customization in the future, maybe.
|
||||
|
||||
<img src="https://dl.dropboxusercontent.com/s/wk5igkkdt89ytob/JKSV.jpg" alt="JKSV" width="240"></img>
|
||||
<img src="https://dl.dropboxusercontent.com/s/xaqycf724p8ut2n/JKSV_3.jpg" alt="JKSV" width="240"></img>
|
||||
<img src="https://dl.dropboxusercontent.com/s/e5qvbiz88hsrtbc/JKSV_2.jpg" alt="JKSV" width="240"></img>
|
||||
## Info
|
||||
JKSV started as a small project to test some things and get familiar with libnx. A list of what it currently can do:
|
||||
1. Dump and restore save data
|
||||
2. Dump system save data (Pressing all four shoulder buttons will activate this)
|
||||
3. Open and explore bis storage partitions via the dev menu and Adv Mode (Press L + R + Y to activate)
|
||||
* ^This requires you to build JKSV yourself for the time being. I'm not ready to update the release yet.
|
||||
4. JKSV also has a basic built in filebrowser that allows you to copy data to and from any location on your SD card to your saves. This is available in the folder selection screen.
|
||||
|
||||
I have a few things I would like to add that never made it to 3DS, but I don't like making promises I might not be able to keep.
|
||||
|
||||
# Building:
|
||||
1. Requires [devkitPro](https://devkitpro.org/) and [libnx](https://github.com/switchbrew/libnx)
|
||||
|
|
|
|||
|
|
@ -25,16 +25,17 @@ namespace ui
|
|||
{
|
||||
public:
|
||||
//Constructor. _max is the maximum value
|
||||
progBar(const unsigned& _max);
|
||||
progBar(const uint64_t& _max);
|
||||
|
||||
//Updates progress
|
||||
void update(const unsigned& _prog);
|
||||
void update(const uint64_t& _prog);
|
||||
|
||||
//Draws with text at top
|
||||
void draw(const std::string& text);
|
||||
|
||||
private:
|
||||
float max, prog, width;
|
||||
uint64_t max, prog;
|
||||
float width;
|
||||
};
|
||||
|
||||
class button
|
||||
|
|
|
|||
14
src/file.cpp
14
src/file.cpp
|
|
@ -115,6 +115,13 @@ namespace fs
|
|||
std::fstream f(from, std::ios::in | std::ios::binary);
|
||||
std::fstream t(to, std::ios::out | std::ios::binary);
|
||||
|
||||
if(!f.is_open() || !t.is_open())
|
||||
{
|
||||
f.close();
|
||||
t.close();
|
||||
return;
|
||||
}
|
||||
|
||||
f.seekg(0, f.end);
|
||||
size_t fileSize = f.tellg();
|
||||
f.seekg(0, f.beg);
|
||||
|
|
@ -147,6 +154,13 @@ namespace fs
|
|||
std::fstream f(from, std::ios::in | std::ios::binary);
|
||||
std::fstream t(to, std::ios::out | std::ios::binary);
|
||||
|
||||
if(!f.is_open() || !t.is_open())
|
||||
{
|
||||
f.close();
|
||||
t.close();
|
||||
return;
|
||||
}
|
||||
|
||||
f.seekg(0, f.end);
|
||||
size_t fileSize = f.tellg();
|
||||
f.seekg(0, f.beg);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ int main(int argc, const char *argv[])
|
|||
data::loadDataInfo();
|
||||
|
||||
//Kick back to user
|
||||
ui::mstate = USR_SEL;
|
||||
ui::mstate = ui::clsMode ? CLS_USR : USR_SEL;
|
||||
}
|
||||
}
|
||||
else if((held & KEY_ZL) && (held & KEY_ZR) && (held & KEY_Y) && ui::confirm("You are using this mode at your own risk."))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include <string>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <switch.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
@ -228,6 +229,7 @@ namespace ui
|
|||
devMenu.addOpt("Bis: SAFE");
|
||||
devMenu.addOpt("Bis: SYSTEM");
|
||||
devMenu.addOpt("Bis: USER");
|
||||
devMenu.addOpt("NAND Backup");
|
||||
}
|
||||
|
||||
void updateDevMenu(const uint64_t& down, const uint64_t& held, const touchPosition& p)
|
||||
|
|
@ -263,6 +265,51 @@ namespace ui
|
|||
fsOpenBisFileSystem(&sv, 30, "");
|
||||
fsdevMountDevice("sv", sv);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
fsdevUnmountDevice("sv");
|
||||
|
||||
FsStorage nand;
|
||||
fsOpenBisStorage(&nand, 20);
|
||||
uint64_t nandSize = 0, offset = 0;
|
||||
fsStorageGetSize(&nand, &nandSize);
|
||||
|
||||
std::fstream nandOut("sdmc:/nand.bin", std::ios::out | std::ios::binary);
|
||||
|
||||
size_t nandBuffSize = 1024 * 1024 * 6;
|
||||
uint8_t *nandBuff = new uint8_t[nandBuffSize];
|
||||
|
||||
progBar nandProg(nandSize);
|
||||
|
||||
while(offset < nandSize)
|
||||
{
|
||||
size_t readLen = 0;
|
||||
if(offset + nandBuffSize < nandSize)
|
||||
readLen = nandBuffSize;
|
||||
else
|
||||
readLen = nandSize - offset;
|
||||
|
||||
if(R_SUCCEEDED(fsStorageRead(&nand, offset, nandBuff, readLen)))
|
||||
{
|
||||
fsStorageFlush(&nand);
|
||||
nandOut.write((char *)nandBuff, readLen);
|
||||
offset += readLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui::showMessage("Something went wrong while dumping your NAND.");
|
||||
break;
|
||||
}
|
||||
|
||||
nandProg.update(offset);
|
||||
nandProg.draw("Backing up NAND...");
|
||||
gfxHandleBuffs();
|
||||
}
|
||||
|
||||
delete[] nandBuff;
|
||||
nandOut.close();
|
||||
fsStorageClose(&nand);
|
||||
break;
|
||||
}
|
||||
|
||||
advModePrep();
|
||||
|
|
|
|||
|
|
@ -8,16 +8,17 @@
|
|||
|
||||
namespace ui
|
||||
{
|
||||
progBar::progBar(const unsigned& _max)
|
||||
progBar::progBar(const uint64_t& _max)
|
||||
{
|
||||
max = (float)_max;
|
||||
max = _max;
|
||||
}
|
||||
|
||||
void progBar::update(const unsigned& _prog)
|
||||
void progBar::update(const uint64_t& _prog)
|
||||
{
|
||||
prog = (float)_prog;
|
||||
prog = _prog;
|
||||
|
||||
float percent = (float)(prog / max) * 100;
|
||||
float divProg = prog / max;
|
||||
float percent = (float)(divProg * 100);
|
||||
width = (float)(percent * 1088) / 100;
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ namespace ui
|
|||
drawRect(frameBuffer, 96, 400, (unsigned)width, 64, clrCreateU32(0xFF00CC00));
|
||||
|
||||
char tmp[128];
|
||||
sprintf(tmp, "%u KB/%u KB", (unsigned)prog / 1024, (unsigned)max / 1024);
|
||||
sprintf(tmp, "%lu KB/%lu KB", prog / 1024, max / 1024);
|
||||
int szX = 640 - (textGetWidth(tmp, shared, 24) / 2);
|
||||
|
||||
drawTextWrap(text.c_str(), frameBuffer, ui::shared, 80, 256, 18, txtClr, 752);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user