mirror of
https://github.com/Ryuzaki-MrL/savemii.git
synced 2026-04-25 15:41:31 -05:00
remove using namespace
This commit is contained in:
parent
7f804ec713
commit
e5024f8a3b
|
|
@ -20,8 +20,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <vpad/input.h>
|
#include <vpad/input.h>
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#define PATH_SIZE 0x400
|
#define PATH_SIZE 0x400
|
||||||
|
|
||||||
extern VPADStatus vpad_status;
|
extern VPADStatus vpad_status;
|
||||||
|
|
@ -70,11 +68,11 @@ extern uint8_t wiiuaccn, sdaccn;
|
||||||
|
|
||||||
void console_print_pos(int x, int y, const char *format, ...);
|
void console_print_pos(int x, int y, const char *format, ...);
|
||||||
|
|
||||||
bool promptConfirm(Style st, string question);
|
bool promptConfirm(Style st, std::string question);
|
||||||
|
|
||||||
void promptError(const char *message, ...);
|
void promptError(const char *message, ...);
|
||||||
|
|
||||||
string getUserID();
|
std::string getUserID();
|
||||||
|
|
||||||
void getAccountsWiiU();
|
void getAccountsWiiU();
|
||||||
|
|
||||||
|
|
@ -118,7 +116,7 @@ int32_t loadFilePart(const char *fPath, uint32_t start, uint32_t size, uint8_t *
|
||||||
|
|
||||||
int32_t loadTitleIcon(Title *title);
|
int32_t loadTitleIcon(Title *title);
|
||||||
|
|
||||||
void show_file_operation(string file_name, string file_src, string file_dest);
|
void show_file_operation(std::string file_name, std::string file_src, std::string file_dest);
|
||||||
|
|
||||||
void console_print_pos_multiline(int x, int y, char cdiv, const char *format, ...);
|
void console_print_pos_multiline(int x, int y, char cdiv, const char *format, ...);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,16 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace std;
|
bool replace(std::string &str, const std::string &from, const std::string &to);
|
||||||
|
std::string decodeXMLEscapeLine(std::string xmlString);
|
||||||
|
|
||||||
bool replace(string &str, const string &from, const string &to);
|
template<typename ... Args>
|
||||||
string decodeXMLEscapeLine(string xmlString);
|
std::string string_format( const std::string& format, Args ... args )
|
||||||
|
{
|
||||||
template<typename... Args>
|
int size_s = std::snprintf( nullptr, 0, format.c_str(), args ... ) + 1; // Extra space for '\0'
|
||||||
auto string_format(const string &format, Args... args) -> string {
|
if( size_s <= 0 ){ throw std::runtime_error( "Error during formatting." ); }
|
||||||
int size_s = snprintf(nullptr, 0, format.c_str(), args...) + 1; // Extra space for '\0'
|
auto size = static_cast<size_t>( size_s );
|
||||||
if (size_s <= 0) { throw runtime_error("Error during formatting."); }
|
std::unique_ptr<char[]> buf( new char[ size ] );
|
||||||
auto size = static_cast<size_t>(size_s);
|
std::snprintf( buf.get(), size, format.c_str(), args ... );
|
||||||
unique_ptr<char[]> buf(new char[size]);
|
return std::string( buf.get(), buf.get() + size - 1 ); // We don't want the '\0' inside
|
||||||
snprintf(buf.get(), size, format.c_str(), args...);
|
|
||||||
return string(buf.get(), buf.get() + size - 1); // We don't want the '\0' inside
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
15
src/json.cpp
15
src/json.cpp
|
|
@ -1,6 +1,8 @@
|
||||||
#include "json.h"
|
#include "json.h"
|
||||||
#include "string.hpp"
|
#include "string.hpp"
|
||||||
|
|
||||||
|
#define FS_ALIGN(x) ((x + 0x3F) & ~(0x3F))
|
||||||
|
|
||||||
json_t *load_json(const char *text) {
|
json_t *load_json(const char *text) {
|
||||||
json_t *root;
|
json_t *root;
|
||||||
json_error_t error;
|
json_error_t error;
|
||||||
|
|
@ -27,7 +29,6 @@ auto doit(char *text) -> char * {
|
||||||
auto dofile(char *filename) -> char * {
|
auto dofile(char *filename) -> char * {
|
||||||
FILE *f = nullptr;
|
FILE *f = nullptr;
|
||||||
long len = 0;
|
long len = 0;
|
||||||
char *data = nullptr;
|
|
||||||
|
|
||||||
/* open in read binary mode */
|
/* open in read binary mode */
|
||||||
f = fopen(filename, "rb");
|
f = fopen(filename, "rb");
|
||||||
|
|
@ -36,7 +37,7 @@ auto dofile(char *filename) -> char * {
|
||||||
len = ftell(f);
|
len = ftell(f);
|
||||||
fseek(f, 0, SEEK_SET);
|
fseek(f, 0, SEEK_SET);
|
||||||
|
|
||||||
data = (char *) malloc(len + 1);
|
char* data = (char *) aligned_alloc(0x40, FS_ALIGN(len + 1));
|
||||||
|
|
||||||
fread(data, 1, len, f);
|
fread(data, 1, len, f);
|
||||||
data[len] = '\0';
|
data[len] = '\0';
|
||||||
|
|
@ -47,17 +48,17 @@ auto dofile(char *filename) -> char * {
|
||||||
return stuff;
|
return stuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getSlotDate(uint32_t highID, uint32_t lowID, uint8_t slot) {
|
std::string getSlotDate(uint32_t highID, uint32_t lowID, uint8_t slot) {
|
||||||
string path = string_format("sd:/wiiu/backups/%08x%08x/%u/savemiiMeta.json", highID, lowID, slot);
|
std::string path = string_format("sd:/wiiu/backups/%08x%08x/%u/savemiiMeta.json", highID, lowID, slot);
|
||||||
if (checkEntry(path.c_str()) != 0) {
|
if (checkEntry(path.c_str()) != 0) {
|
||||||
string info = dofile((char *) path.c_str());
|
std::string info = dofile((char *) path.c_str());
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
auto setSlotDate(uint32_t highID, uint32_t lowID, uint8_t slot, string date) -> bool {
|
auto setSlotDate(uint32_t highID, uint32_t lowID, uint8_t slot, std::string date) -> bool {
|
||||||
string path = string_format("sd:/wiiu/backups/%08x%08x/%u/savemiiMeta.json", highID, lowID, slot);
|
std::string path = string_format("sd:/wiiu/backups/%08x%08x/%u/savemiiMeta.json", highID, lowID, slot);
|
||||||
|
|
||||||
json_t *config = json_object();
|
json_t *config = json_object();
|
||||||
if (config == nullptr)
|
if (config == nullptr)
|
||||||
|
|
|
||||||
20
src/main.cpp
20
src/main.cpp
|
|
@ -5,8 +5,6 @@
|
||||||
#include "savemng.h"
|
#include "savemng.h"
|
||||||
#include "string.hpp"
|
#include "string.hpp"
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 4
|
#define VERSION_MINOR 4
|
||||||
#define VERSION_MICRO 1
|
#define VERSION_MICRO 1
|
||||||
|
|
@ -101,7 +99,7 @@ Title *loadWiiUTitles(int run) {
|
||||||
int tNoSave = usable;
|
int tNoSave = usable;
|
||||||
for (int i = 0; i <= 1; i++) {
|
for (int i = 0; i <= 1; i++) {
|
||||||
for (uint8_t a = 0; a < 2; a++) {
|
for (uint8_t a = 0; a < 2; a++) {
|
||||||
string path = string_format("%s:/usr/save/%s", (i == 0) ? "usb" : "mlc", highIDs[a]);
|
std::string path = string_format("%s:/usr/save/%s", (i == 0) ? "usb" : "mlc", highIDs[a]);
|
||||||
DIR *dir = opendir(path.c_str());
|
DIR *dir = opendir(path.c_str());
|
||||||
if (dir != nullptr) {
|
if (dir != nullptr) {
|
||||||
struct dirent *data;
|
struct dirent *data;
|
||||||
|
|
@ -140,7 +138,7 @@ Title *loadWiiUTitles(int run) {
|
||||||
|
|
||||||
for (uint8_t a = 0; a < 2; a++) {
|
for (uint8_t a = 0; a < 2; a++) {
|
||||||
for (int i = 0; i <= 1; i++) {
|
for (int i = 0; i <= 1; i++) {
|
||||||
string path = string_format("%s:/usr/save/%s", (i == 0) ? "usb" : "mlc", highIDs[a]);
|
std::string path = string_format("%s:/usr/save/%s", (i == 0) ? "usb" : "mlc", highIDs[a]);
|
||||||
DIR *dir = opendir(path.c_str());
|
DIR *dir = opendir(path.c_str());
|
||||||
if (dir != nullptr) {
|
if (dir != nullptr) {
|
||||||
struct dirent *data;
|
struct dirent *data;
|
||||||
|
|
@ -184,7 +182,7 @@ Title *loadWiiUTitles(int run) {
|
||||||
uint32_t lowID = saves[i].lowID;
|
uint32_t lowID = saves[i].lowID;
|
||||||
bool isTitleOnUSB = saves[i].dev == 0u;
|
bool isTitleOnUSB = saves[i].dev == 0u;
|
||||||
|
|
||||||
const string path = string_format("%s:/usr/%s/%08x/%08x/meta/meta.xml", isTitleOnUSB ? "usb" : "mlc",
|
const std::string path = string_format("%s:/usr/%s/%08x/%08x/meta/meta.xml", isTitleOnUSB ? "usb" : "mlc",
|
||||||
saves[i].found ? "title" : "save", highID, lowID);
|
saves[i].found ? "title" : "save", highID, lowID);
|
||||||
titles[titleswiiu].saveInit = !saves[i].found;
|
titles[titleswiiu].saveInit = !saves[i].found;
|
||||||
|
|
||||||
|
|
@ -199,15 +197,15 @@ Title *loadWiiUTitles(int run) {
|
||||||
if (strcspn(cptr, "<") == 0)
|
if (strcspn(cptr, "<") == 0)
|
||||||
cptr = strchr(strstr(xmlBuf, "shortname_ja"), '>') + 1;
|
cptr = strchr(strstr(xmlBuf, "shortname_ja"), '>') + 1;
|
||||||
|
|
||||||
decodeXMLEscapeLine(string(cptr));
|
decodeXMLEscapeLine(std::string(cptr));
|
||||||
strlcpy(titles[titleswiiu].shortName, decodeXMLEscapeLine(string(cptr)).c_str(), strcspn(decodeXMLEscapeLine(string(cptr)).c_str(), "<") + 1);
|
strlcpy(titles[titleswiiu].shortName, decodeXMLEscapeLine(std::string(cptr)).c_str(), strcspn(decodeXMLEscapeLine(std::string(cptr)).c_str(), "<") + 1);
|
||||||
|
|
||||||
cptr = strchr(strstr(xmlBuf, "longname_en"), '>') + 1;
|
cptr = strchr(strstr(xmlBuf, "longname_en"), '>') + 1;
|
||||||
memset(titles[i].longName, 0, sizeof(titles[i].longName));
|
memset(titles[i].longName, 0, sizeof(titles[i].longName));
|
||||||
if (strcspn(cptr, "<") == 0)
|
if (strcspn(cptr, "<") == 0)
|
||||||
cptr = strchr(strstr(xmlBuf, "longname_ja"), '>') + 1;
|
cptr = strchr(strstr(xmlBuf, "longname_ja"), '>') + 1;
|
||||||
|
|
||||||
strlcpy(titles[titleswiiu].longName, decodeXMLEscapeLine(string(cptr)).c_str(), strcspn(decodeXMLEscapeLine(string(cptr)).c_str(), "<") + 1);
|
strlcpy(titles[titleswiiu].longName, decodeXMLEscapeLine(std::string(cptr)).c_str(), strcspn(decodeXMLEscapeLine(std::string(cptr)).c_str(), "<") + 1);
|
||||||
|
|
||||||
free(xmlBuf);
|
free(xmlBuf);
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +255,7 @@ Title *loadWiiTitles() {
|
||||||
{0x00010001, 0x48424344},
|
{0x00010001, 0x48424344},
|
||||||
{0x00010001, 0x554E454F}};
|
{0x00010001, 0x554E454F}};
|
||||||
|
|
||||||
string pathW;
|
std::string pathW;
|
||||||
for (int k = 0; k < 3; k++) {
|
for (int k = 0; k < 3; k++) {
|
||||||
pathW = string_format("slc:/title/%s", highIDs[k]);
|
pathW = string_format("slc:/title/%s", highIDs[k]);
|
||||||
DIR *dir = opendir(pathW.c_str());
|
DIR *dir = opendir(pathW.c_str());
|
||||||
|
|
@ -311,7 +309,7 @@ Title *loadWiiTitles() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const string path = string_format("slc:/title/%s/%s/data/banner.bin", highIDs[k], data->d_name);
|
const std::string path = string_format("slc:/title/%s/%s/data/banner.bin", highIDs[k], data->d_name);
|
||||||
FILE *file = fopen(path.c_str(), "rb");
|
FILE *file = fopen(path.c_str(), "rb");
|
||||||
if (file != nullptr) {
|
if (file != nullptr) {
|
||||||
fseek(file, 0x20, SEEK_SET);
|
fseek(file, 0x20, SEEK_SET);
|
||||||
|
|
@ -980,7 +978,7 @@ int main(void) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string path = string_format("%s:/usr/title/000%x/%x/code/fw.img",
|
std::string path = string_format("%s:/usr/title/000%x/%x/code/fw.img",
|
||||||
(titles[targ].isTitleOnUSB) ? "usb" : "mlc", titles[targ].highID,
|
(titles[targ].isTitleOnUSB) ? "usb" : "mlc", titles[targ].highID,
|
||||||
titles[targ].lowID);
|
titles[targ].lowID);
|
||||||
if ((mode == 0) && (checkEntry(path.c_str()) != 0))
|
if ((mode == 0) && (checkEntry(path.c_str()) != 0))
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ VPADReadError vpad_error;
|
||||||
|
|
||||||
KPADStatus kpad[4], kpad_status;
|
KPADStatus kpad[4], kpad_status;
|
||||||
|
|
||||||
static string newlibToFSA(string path) {
|
static std::string newlibToFSA(std::string path) {
|
||||||
if (path[3] == ':') {
|
if (path[3] == ':') {
|
||||||
switch (path[0]) {
|
switch (path[0]) {
|
||||||
case 'u':
|
case 'u':
|
||||||
|
|
@ -38,7 +38,7 @@ void setFSAFD(int fd) {
|
||||||
fsaFd = fd;
|
fsaFd = fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_file_operation(string file_name, string file_src, string file_dest) {
|
void show_file_operation(std::string file_name, std::string file_src, std::string file_dest) {
|
||||||
console_print_pos(-2, 0, "Copying file: %s", file_name.c_str());
|
console_print_pos(-2, 0, "Copying file: %s", file_name.c_str());
|
||||||
console_print_pos_multiline(-2, 2, '/', "From: %s", file_src.c_str());
|
console_print_pos_multiline(-2, 2, '/', "From: %s", file_src.c_str());
|
||||||
console_print_pos_multiline(-2, 8, '/', "To: %s", file_dest.c_str());
|
console_print_pos_multiline(-2, 8, '/', "To: %s", file_dest.c_str());
|
||||||
|
|
@ -102,7 +102,7 @@ int32_t loadTitleIcon(Title *title) {
|
||||||
uint32_t lowID = title->lowID;
|
uint32_t lowID = title->lowID;
|
||||||
bool isUSB = title->isTitleOnUSB;
|
bool isUSB = title->isTitleOnUSB;
|
||||||
bool isWii = ((highID & 0xFFFFFFF0) == 0x00010000);
|
bool isWii = ((highID & 0xFFFFFFF0) == 0x00010000);
|
||||||
string path;
|
std::string path;
|
||||||
|
|
||||||
if (isWii) {
|
if (isWii) {
|
||||||
if (title->saveInit) {
|
if (title->saveInit) {
|
||||||
|
|
@ -147,7 +147,7 @@ int folderEmpty(const char *fPath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int createFolder(const char *fPath) { //Adapted from mkdir_p made by JonathonReinhart
|
int createFolder(const char *fPath) { //Adapted from mkdir_p made by JonathonReinhart
|
||||||
string _path;
|
std::string _path;
|
||||||
char *p;
|
char *p;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
|
|
@ -177,7 +177,7 @@ void console_print_pos_aligned(int y, uint16_t offset, uint8_t align, const char
|
||||||
int x = 0;
|
int x = 0;
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
string tmp = string_format(format, va);
|
std::string tmp = string_format(format, va);
|
||||||
if (!tmp.empty()) {
|
if (!tmp.empty()) {
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -239,7 +239,7 @@ void console_print_pos_multiline(int x, int y, char cdiv, const char *format, ..
|
||||||
q[l1] = o;
|
q[l1] = o;
|
||||||
l1--;
|
l1--;
|
||||||
}
|
}
|
||||||
string buf;
|
std::string buf;
|
||||||
buf.assign(p);
|
buf.assign(p);
|
||||||
p = (char *) string_format("\n%s", buf.c_str()).c_str();
|
p = (char *) string_format("\n%s", buf.c_str()).c_str();
|
||||||
p++;
|
p++;
|
||||||
|
|
@ -253,12 +253,12 @@ void console_print_pos_multiline(int x, int y, char cdiv, const char *format, ..
|
||||||
free(tmp);
|
free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool promptConfirm(Style st, string question) {
|
bool promptConfirm(Style st, std::string question) {
|
||||||
clearBuffers();
|
clearBuffers();
|
||||||
WHBLogFreetypeDraw();
|
WHBLogFreetypeDraw();
|
||||||
const string msg1 = "\ue000 Yes - \ue001 No";
|
const std::string msg1 = "\ue000 Yes - \ue001 No";
|
||||||
const string msg2 = "\ue000 Confirm - \ue001 Cancel";
|
const std::string msg2 = "\ue000 Confirm - \ue001 Cancel";
|
||||||
string msg;
|
std::string msg;
|
||||||
switch (st & 0x0F) {
|
switch (st & 0x0F) {
|
||||||
case ST_YES_NO:
|
case ST_YES_NO:
|
||||||
msg = msg1;
|
msg = msg1;
|
||||||
|
|
@ -378,7 +378,7 @@ void getAccountsSD(Title *title, uint8_t slot) {
|
||||||
if (sdacc != nullptr)
|
if (sdacc != nullptr)
|
||||||
free(sdacc);
|
free(sdacc);
|
||||||
|
|
||||||
string path = string_format("sd:/wiiu/backups/%08x%08x/%u", highID, lowID, slot);
|
std::string path = string_format("sd:/wiiu/backups/%08x%08x/%u", highID, lowID, slot);
|
||||||
DIR *dir = opendir(path.c_str());
|
DIR *dir = opendir(path.c_str());
|
||||||
if (dir != nullptr) {
|
if (dir != nullptr) {
|
||||||
struct dirent *data;
|
struct dirent *data;
|
||||||
|
|
@ -407,7 +407,7 @@ void getAccountsSD(Title *title, uint8_t slot) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DumpFile(string pPath, string oPath) {
|
int DumpFile(std::string pPath, std::string oPath) {
|
||||||
FILE *source = fopen(pPath.c_str(), "rb");
|
FILE *source = fopen(pPath.c_str(), "rb");
|
||||||
if (source == nullptr)
|
if (source == nullptr)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -475,7 +475,7 @@ int DumpFile(string pPath, string oPath) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DumpDir(string pPath, string tPath) { // Source: ft2sd
|
int DumpDir(std::string pPath, std::string tPath) { // Source: ft2sd
|
||||||
DIR *dir = opendir(pPath.c_str());
|
DIR *dir = opendir(pPath.c_str());
|
||||||
if (dir == nullptr) {
|
if (dir == nullptr) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|
@ -491,7 +491,7 @@ int DumpDir(string pPath, string tPath) { // Source: ft2sd
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
string targetPath = string_format("%s/%s", tPath.c_str(), data->d_name);
|
std::string targetPath = string_format("%s/%s", tPath.c_str(), data->d_name);
|
||||||
|
|
||||||
if ((data->d_type & DT_DIR) != 0) {
|
if ((data->d_type & DT_DIR) != 0) {
|
||||||
mkdir(targetPath.c_str(), DEFFILEMODE);
|
mkdir(targetPath.c_str(), DEFFILEMODE);
|
||||||
|
|
@ -555,14 +555,14 @@ int DeleteDir(char *pPath) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getUserID() { // Source: loadiine_gx2
|
std::string getUserID() { // Source: loadiine_gx2
|
||||||
/* get persistent ID - thanks to Maschell */
|
/* get persistent ID - thanks to Maschell */
|
||||||
nn::act::Initialize();
|
nn::act::Initialize();
|
||||||
|
|
||||||
unsigned char slotno = nn::act::GetSlotNo();
|
unsigned char slotno = nn::act::GetSlotNo();
|
||||||
unsigned int persistentID = nn::act::GetPersistentIdEx(slotno);
|
unsigned int persistentID = nn::act::GetPersistentIdEx(slotno);
|
||||||
nn::act::Finalize();
|
nn::act::Finalize();
|
||||||
string out = string_format("%08X", persistentID);
|
std::string out = string_format("%08X", persistentID);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -631,7 +631,7 @@ int getLoadiineUserDir(char *out, const char *fullSavePath, const char *userID)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSlotEmpty(uint32_t highID, uint32_t lowID, uint8_t slot) {
|
bool isSlotEmpty(uint32_t highID, uint32_t lowID, uint8_t slot) {
|
||||||
string path;
|
std::string path;
|
||||||
if (((highID & 0xFFFFFFF0) == 0x00010000) && (slot == 255))
|
if (((highID & 0xFFFFFFF0) == 0x00010000) && (slot == 255))
|
||||||
path = string_format("sd:/savegames/%08x%08x", highID, lowID);
|
path = string_format("sd:/savegames/%08x%08x", highID, lowID);
|
||||||
else
|
else
|
||||||
|
|
@ -709,7 +709,7 @@ bool hasCommonSave(Title *title, bool inSD, bool iine, uint8_t slot, int version
|
||||||
if (isWii)
|
if (isWii)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string srcPath;
|
std::string srcPath;
|
||||||
if (!inSD) {
|
if (!inSD) {
|
||||||
const char *path = (isUSB ? "usb:/usr/save" : "mlc:/usr/save");
|
const char *path = (isUSB ? "usb:/usr/save" : "mlc:/usr/save");
|
||||||
srcPath = string_format("%s/%08x/%08x/%s/common", path, highID, lowID, "user");
|
srcPath = string_format("%s/%08x/%08x/%s/common", path, highID, lowID, "user");
|
||||||
|
|
@ -747,10 +747,10 @@ void copySavedata(Title *title, Title *titleb, int8_t allusers, int8_t allusers_
|
||||||
promptError("Backup done. Now copying Savedata.");
|
promptError("Backup done. Now copying Savedata.");
|
||||||
}
|
}
|
||||||
|
|
||||||
string path = (isUSB ? "usb:/usr/save" : "mlc:/usr/save");
|
std::string path = (isUSB ? "usb:/usr/save" : "mlc:/usr/save");
|
||||||
string pathb = (isUSBb ? "usb:/usr/save" : "mlc:/usr/save");
|
std::string pathb = (isUSBb ? "usb:/usr/save" : "mlc:/usr/save");
|
||||||
string srcPath = string_format("%s/%08x/%08x/%s", path.c_str(), highID, lowID, "user");
|
std::string srcPath = string_format("%s/%08x/%08x/%s", path.c_str(), highID, lowID, "user");
|
||||||
string dstPath = string_format("%s/%08x/%08x/%s", pathb.c_str(), highIDb, lowIDb, "user");
|
std::string dstPath = string_format("%s/%08x/%08x/%s", pathb.c_str(), highIDb, lowIDb, "user");
|
||||||
createFolder(dstPath.c_str());
|
createFolder(dstPath.c_str());
|
||||||
|
|
||||||
if (allusers > -1)
|
if (allusers > -1)
|
||||||
|
|
@ -776,7 +776,7 @@ void backupAllSave(Title *titles, int count, OSCalendarTime *date) {
|
||||||
dateTime.tm_mon++;
|
dateTime.tm_mon++;
|
||||||
}
|
}
|
||||||
|
|
||||||
string datetime = string_format("%04d-%02d-%02dT%02d%02d%02d", dateTime.tm_year, dateTime.tm_mon, dateTime.tm_mday,
|
std::string datetime = string_format("%04d-%02d-%02dT%02d%02d%02d", dateTime.tm_year, dateTime.tm_mon, dateTime.tm_mday,
|
||||||
dateTime.tm_hour, dateTime.tm_min, dateTime.tm_sec);
|
dateTime.tm_hour, dateTime.tm_min, dateTime.tm_sec);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (titles[i].highID == 0 || titles[i].lowID == 0 || !titles[i].saveInit)
|
if (titles[i].highID == 0 || titles[i].lowID == 0 || !titles[i].saveInit)
|
||||||
|
|
@ -786,9 +786,9 @@ void backupAllSave(Title *titles, int count, OSCalendarTime *date) {
|
||||||
uint32_t lowID = titles[i].lowID;
|
uint32_t lowID = titles[i].lowID;
|
||||||
bool isUSB = titles[i].isTitleOnUSB;
|
bool isUSB = titles[i].isTitleOnUSB;
|
||||||
bool isWii = ((highID & 0xFFFFFFF0) == 0x00010000);
|
bool isWii = ((highID & 0xFFFFFFF0) == 0x00010000);
|
||||||
const string path = (isWii ? "slc:/title" : (isUSB ? "usb:/usr/save" : "mlc:/usr/save"));
|
const std::string path = (isWii ? "slc:/title" : (isUSB ? "usb:/usr/save" : "mlc:/usr/save"));
|
||||||
string srcPath = string_format("%s/%08x/%08x/%s", path.c_str(), highID, lowID, isWii ? "data" : "user");
|
std::string srcPath = string_format("%s/%08x/%08x/%s", path.c_str(), highID, lowID, isWii ? "data" : "user");
|
||||||
string dstPath = string_format("sd:/wiiu/backups/batch/%s/%08x%08x", datetime.c_str(), highID, lowID);
|
std::string dstPath = string_format("sd:/wiiu/backups/batch/%s/%08x%08x", datetime.c_str(), highID, lowID);
|
||||||
|
|
||||||
createFolder(dstPath.c_str());
|
createFolder(dstPath.c_str());
|
||||||
if (DumpDir(srcPath, dstPath) != 0)
|
if (DumpDir(srcPath, dstPath) != 0)
|
||||||
|
|
@ -805,9 +805,9 @@ void backupSavedata(Title *title, uint8_t slot, int8_t allusers, bool common) {
|
||||||
uint32_t lowID = title->lowID;
|
uint32_t lowID = title->lowID;
|
||||||
bool isUSB = title->isTitleOnUSB;
|
bool isUSB = title->isTitleOnUSB;
|
||||||
bool isWii = ((highID & 0xFFFFFFF0) == 0x00010000);
|
bool isWii = ((highID & 0xFFFFFFF0) == 0x00010000);
|
||||||
const string path = (isWii ? "slc:/title" : (isUSB ? "usb:/usr/save" : "mlc:/usr/save"));
|
const std::string path = (isWii ? "slc:/title" : (isUSB ? "usb:/usr/save" : "mlc:/usr/save"));
|
||||||
string srcPath = string_format("%s/%08x/%08x/%s", path.c_str(), highID, lowID, isWii ? "data" : "user");
|
std::string srcPath = string_format("%s/%08x/%08x/%s", path.c_str(), highID, lowID, isWii ? "data" : "user");
|
||||||
string dstPath;
|
std::string dstPath;
|
||||||
if (isWii && (slot == 255))
|
if (isWii && (slot == 255))
|
||||||
dstPath = string_format("sd:/savegames/%08x%08x", highID, lowID);
|
dstPath = string_format("sd:/savegames/%08x%08x", highID, lowID);
|
||||||
else
|
else
|
||||||
|
|
@ -832,7 +832,7 @@ void backupSavedata(Title *title, uint8_t slot, int8_t allusers, bool common) {
|
||||||
promptError("Backup failed. DO NOT restore from this slot.");
|
promptError("Backup failed. DO NOT restore from this slot.");
|
||||||
OSCalendarTime now;
|
OSCalendarTime now;
|
||||||
OSTicksToCalendarTime(OSGetTime(), &now);
|
OSTicksToCalendarTime(OSGetTime(), &now);
|
||||||
string date = string_format("%02d/%02d/%d %02d:%02d", now.tm_mday, now.tm_mon, now.tm_year, now.tm_hour, now.tm_min);
|
std::string date = string_format("%02d/%02d/%d %02d:%02d", now.tm_mday, now.tm_mon, now.tm_year, now.tm_hour, now.tm_min);
|
||||||
setSlotDate(title->highID, title->lowID, slot, date);
|
setSlotDate(title->highID, title->lowID, slot, date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -850,13 +850,13 @@ void restoreSavedata(Title *title, uint8_t slot, int8_t sdusers, int8_t allusers
|
||||||
uint32_t lowID = title->lowID;
|
uint32_t lowID = title->lowID;
|
||||||
bool isUSB = title->isTitleOnUSB;
|
bool isUSB = title->isTitleOnUSB;
|
||||||
bool isWii = ((highID & 0xFFFFFFF0) == 0x00010000);
|
bool isWii = ((highID & 0xFFFFFFF0) == 0x00010000);
|
||||||
string srcPath;
|
std::string srcPath;
|
||||||
const string path = (isWii ? "slc:/title" : (isUSB ? "usb:/usr/save" : "mlc:/usr/save"));
|
const std::string path = (isWii ? "slc:/title" : (isUSB ? "usb:/usr/save" : "mlc:/usr/save"));
|
||||||
if (isWii && (slot == 255))
|
if (isWii && (slot == 255))
|
||||||
srcPath = string_format("sd:/savegames/%08x%08x", highID, lowID);
|
srcPath = string_format("sd:/savegames/%08x%08x", highID, lowID);
|
||||||
else
|
else
|
||||||
srcPath = string_format("sd:/wiiu/backups/%08x%08x/%u", highID, lowID, slot);
|
srcPath = string_format("sd:/wiiu/backups/%08x%08x/%u", highID, lowID, slot);
|
||||||
string dstPath = string_format("%s/%08x/%08x/%s", path.c_str(), highID, lowID, isWii ? "data" : "user");
|
std::string dstPath = string_format("%s/%08x/%08x/%s", path.c_str(), highID, lowID, isWii ? "data" : "user");
|
||||||
createFolder(dstPath.c_str());
|
createFolder(dstPath.c_str());
|
||||||
|
|
||||||
if ((sdusers > -1) && !isWii) {
|
if ((sdusers > -1) && !isWii) {
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
#include "string.hpp"
|
#include "string.hpp"
|
||||||
|
|
||||||
bool replace(string &str, const string &from, const string &to) {
|
bool replace(std::string &str, const std::string &from, const std::string &to) {
|
||||||
size_t start_pos = str.find(from);
|
size_t start_pos = str.find(from);
|
||||||
if (start_pos == string::npos)
|
if (start_pos == std::string::npos)
|
||||||
return false;
|
return false;
|
||||||
str.replace(start_pos, from.length(), to);
|
str.replace(start_pos, from.length(), to);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
string decodeXMLEscapeLine(string xmlString) {
|
std::string decodeXMLEscapeLine(std::string xmlString) {
|
||||||
replace(xmlString, """, "\"");
|
replace(xmlString, """, "\"");
|
||||||
replace(xmlString, "'", "'");
|
replace(xmlString, "'", "'");
|
||||||
replace(xmlString, "<", "<");
|
replace(xmlString, "<", "<");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user