mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-03-21 17:24:37 -05:00
Stop loading icons i don't use
This commit is contained in:
parent
4420e7c164
commit
749c8fd654
|
|
@ -35,9 +35,6 @@ namespace data
|
|||
//Attempts to read title's info
|
||||
titledata(const FsSaveDataInfo& inf, NsApplicationControlData *dat);
|
||||
|
||||
//Attempts to mount data with uID + id. Returns false if fails. For filtering.
|
||||
bool isMountable(const AccountUid& uid);
|
||||
|
||||
//Returns title + title without forbidden chars
|
||||
std::string getTitle() const { return title;}
|
||||
std::string getTitleSafe() const { return titleSafe; }
|
||||
|
|
@ -56,6 +53,8 @@ namespace data
|
|||
uint64_t getSaveID() const { return saveID; }
|
||||
uint16_t getSaveIndex() const { return saveIndex; }
|
||||
FsSaveDataType getType() const { return (FsSaveDataType)saveDataType; }
|
||||
void setID(const uint64_t& _id){ id = _id; }
|
||||
void setIndex(const uint16_t& _ind){ saveIndex = _ind; }
|
||||
void setType(FsSaveDataType type) { saveDataType = type; }
|
||||
void setFav(bool setFav) { favorite = setFav; }
|
||||
bool getFav() const { return favorite; }
|
||||
|
|
|
|||
55
src/data.cpp
55
src/data.cpp
|
|
@ -128,12 +128,39 @@ static inline std::string getIDStr(const uint64_t& _id)
|
|||
|
||||
static inline bool accountSystemSaveCheck(const FsSaveDataInfo& _inf)
|
||||
{
|
||||
if(_inf.save_data_type == FsSaveDataType_System && util::accountUIDToU128(_inf.uid) != 1 && !data::accSysSave)
|
||||
if(_inf.save_data_type == FsSaveDataType_System && util::accountUIDToU128(_inf.uid) != 0 && !data::accSysSave)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Minimal init/test to avoid loading and creating things I don't need
|
||||
static bool testMount(const FsSaveDataInfo& _inf)
|
||||
{
|
||||
if(!data::forceMount)
|
||||
return true;
|
||||
|
||||
bool ret = false;
|
||||
uint64_t id;
|
||||
data::user tmpusr;
|
||||
data::titledata tmpdat;
|
||||
|
||||
if(_inf.save_data_type == FsSaveDataType_System || _inf.save_data_type == FsSaveDataType_SystemBcat)
|
||||
id = _inf.system_save_data_id;
|
||||
else
|
||||
id = _inf.application_id;
|
||||
|
||||
tmpusr.setUID(_inf.uid);
|
||||
tmpdat.setID(id);
|
||||
tmpdat.setIndex(_inf.save_data_index);
|
||||
tmpdat.setType((FsSaveDataType)_inf.save_data_type);
|
||||
|
||||
if((ret = fs::mountSave(tmpusr, tmpdat)))
|
||||
fs::unmountSave();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool data::loadUsersTitles(bool clearUsers)
|
||||
{
|
||||
FsSaveDataInfoReader it;
|
||||
|
|
@ -156,7 +183,7 @@ bool data::loadUsersTitles(bool clearUsers)
|
|||
tempPushed = false;
|
||||
users.emplace_back(util::u128ToAccountUID(3), "Device Saves", createDeviceIcon());
|
||||
users.emplace_back(util::u128ToAccountUID(2), "BCAT");
|
||||
users.emplace_back(util::u128ToAccountUID(1), "System");
|
||||
users.emplace_back(util::u128ToAccountUID(0), "System");
|
||||
}
|
||||
|
||||
NsApplicationControlData *dat = new NsApplicationControlData;
|
||||
|
|
@ -164,11 +191,6 @@ bool data::loadUsersTitles(bool clearUsers)
|
|||
{
|
||||
switch(info.save_data_type)
|
||||
{
|
||||
case FsSaveDataType_System:
|
||||
if(util::accountUIDToU128(info.uid) == 0)
|
||||
info.uid = util::u128ToAccountUID(1);
|
||||
break;
|
||||
|
||||
case FsSaveDataType_Bcat:
|
||||
info.uid = util::u128ToAccountUID(2);
|
||||
break;
|
||||
|
|
@ -206,7 +228,7 @@ bool data::loadUsersTitles(bool clearUsers)
|
|||
}
|
||||
|
||||
//Don't bother with this stuff
|
||||
if(blacklisted(info.application_id) || blacklisted(info.save_data_id) || !accountSystemSaveCheck(info))
|
||||
if(blacklisted(info.application_id) || blacklisted(info.save_data_id) || !accountSystemSaveCheck(info) || !testMount(info))
|
||||
continue;
|
||||
|
||||
int u = getUserIndex(info.uid);
|
||||
|
|
@ -215,10 +237,7 @@ bool data::loadUsersTitles(bool clearUsers)
|
|||
users.emplace(users.end() - 3, info.uid, "");
|
||||
u = getUserIndex(info.uid);
|
||||
}
|
||||
|
||||
data::titledata newData(info, dat);
|
||||
if(!forceMount || newData.isMountable(data::users[u].getUID()))
|
||||
users[u].titles.push_back(newData);
|
||||
users[u].titles.emplace_back(info, dat);
|
||||
}
|
||||
delete dat;
|
||||
fsSaveDataInfoReaderClose(&it);
|
||||
|
|
@ -321,18 +340,6 @@ data::titledata::titledata(const FsSaveDataInfo& inf, NsApplicationControlData *
|
|||
path = fs::getWorkDir() + titleSafe + "/";
|
||||
}
|
||||
|
||||
bool data::titledata::isMountable(const AccountUid& uid)
|
||||
{
|
||||
data::user tmpUser;
|
||||
tmpUser.setUID(uid);
|
||||
if(fs::mountSave(tmpUser, *this))
|
||||
{
|
||||
fs::unmountSave();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void data::titledata::createDir() const
|
||||
{
|
||||
mkdir(std::string(fs::getWorkDir() + titleSafe).c_str(), 777);
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ bool fs::mountSave(const data::user& usr, const data::titledata& open)
|
|||
switch(open.getType())
|
||||
{
|
||||
case FsSaveDataType_System:
|
||||
svOpen = fsOpen_SystemSaveData(&sv, FsSaveDataSpaceId_System, open.getID(), usr.getUID128() == 1 ? (AccountUid) { 0 } : usr.getUID());
|
||||
svOpen = fsOpen_SystemSaveData(&sv, FsSaveDataSpaceId_System, open.getID(), usr.getUID());
|
||||
break;
|
||||
|
||||
case FsSaveDataType_Account:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user