mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Use PSP memory directly in GETSIZES for savedata.
This commit is contained in:
parent
8734b29105
commit
8f0d3c55fb
2 changed files with 15 additions and 22 deletions
|
@ -972,29 +972,24 @@ bool SavedataParam::GetSize(SceUtilitySavedataParam *param)
|
||||||
PSPFileInfo info = pspFileSystem.GetFileInfo(saveDir);
|
PSPFileInfo info = pspFileSystem.GetFileInfo(saveDir);
|
||||||
bool exists = info.exists;
|
bool exists = info.exists;
|
||||||
|
|
||||||
if (Memory::IsValidAddress(param->sizeAddr))
|
if (param->sizeInfo.Valid())
|
||||||
{
|
{
|
||||||
PspUtilitySavedataSizeInfo sizeInfo;
|
|
||||||
Memory::ReadStruct(param->sizeAddr, &sizeInfo);
|
|
||||||
|
|
||||||
// TODO: Read the entries and count up the size vs. existing size?
|
// TODO: Read the entries and count up the size vs. existing size?
|
||||||
|
|
||||||
sizeInfo.sectorSize = (int)MemoryStick_SectorSize();
|
param->sizeInfo->sectorSize = (int)MemoryStick_SectorSize();
|
||||||
sizeInfo.freeSectors = (int)(MemoryStick_FreeSpace() / MemoryStick_SectorSize());
|
param->sizeInfo->freeSectors = (int)(MemoryStick_FreeSpace() / MemoryStick_SectorSize());
|
||||||
|
|
||||||
// TODO: Is this after the specified files? Before?
|
// TODO: Is this after the specified files? Before?
|
||||||
sizeInfo.freeKB = (int)(MemoryStick_FreeSpace() / 1024);
|
param->sizeInfo->freeKB = (int)(MemoryStick_FreeSpace() / 1024);
|
||||||
std::string spaceTxt = SavedataParam::GetSpaceText((int)MemoryStick_FreeSpace());
|
std::string spaceTxt = SavedataParam::GetSpaceText((int)MemoryStick_FreeSpace());
|
||||||
strncpy(sizeInfo.freeString, spaceTxt.c_str(), 8);
|
strncpy(param->sizeInfo->freeString, spaceTxt.c_str(), 8);
|
||||||
sizeInfo.freeString[7] = '\0';
|
param->sizeInfo->freeString[7] = '\0';
|
||||||
|
|
||||||
// TODO.
|
// TODO.
|
||||||
sizeInfo.neededKB = 0;
|
param->sizeInfo->neededKB = 0;
|
||||||
strcpy(sizeInfo.neededString, "0 KB");
|
strcpy(param->sizeInfo->neededString, "0 KB");
|
||||||
sizeInfo.overwriteKB = 0;
|
param->sizeInfo->overwriteKB = 0;
|
||||||
strcpy(sizeInfo.overwriteString, "0 KB");
|
strcpy(param->sizeInfo->overwriteString, "0 KB");
|
||||||
|
|
||||||
Memory::WriteStruct(param->sizeAddr, &sizeInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return exists;
|
return exists;
|
||||||
|
|
|
@ -85,18 +85,16 @@ struct PspUtilitySavedataFileData {
|
||||||
int unknown;
|
int unknown;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: According to JPCSP, should verify.
|
|
||||||
struct PspUtilitySavedataSizeEntry {
|
struct PspUtilitySavedataSizeEntry {
|
||||||
u64 size;
|
u64 size;
|
||||||
char name[16];
|
char name[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: According to JPCSP, should verify.
|
|
||||||
struct PspUtilitySavedataSizeInfo {
|
struct PspUtilitySavedataSizeInfo {
|
||||||
int secureNumEntries;
|
int numSecureEntries;
|
||||||
int numEntries;
|
int numNormalEntries;
|
||||||
u32 secureEntriesPtr;
|
PSPPointer<PspUtilitySavedataSizeEntry> secureEntries;
|
||||||
u32 entriesPtr;
|
PSPPointer<PspUtilitySavedataSizeEntry> normalEntries;
|
||||||
int sectorSize;
|
int sectorSize;
|
||||||
int freeSectors;
|
int freeSectors;
|
||||||
int freeKB;
|
int freeKB;
|
||||||
|
@ -225,7 +223,7 @@ struct SceUtilitySavedataParam
|
||||||
PSPPointer<SceUtilitySavedataFileListInfo> fileList;
|
PSPPointer<SceUtilitySavedataFileListInfo> fileList;
|
||||||
|
|
||||||
// Function 22 GETSIZES
|
// Function 22 GETSIZES
|
||||||
u32 sizeAddr;
|
PSPPointer<PspUtilitySavedataSizeInfo> sizeInfo;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue