Improvements to saving and cellFsStat

This commit is contained in:
Raul Tambre 2014-12-26 10:06:12 +02:00
parent 31aef6460d
commit 052692ac8c
6 changed files with 110 additions and 14 deletions

View File

@ -1845,12 +1845,12 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
}
break;
// Windows Clipping
// Windows Clipping (Doesn't seem to be relevant?)
case NV4097_SET_WINDOW_OFFSET:
{
const u16 x = ARGS(0);
const u16 y = ARGS(0) >> 16;
LOG_WARNING(RSX, "TODO: NV4097_SET_WINDOW_OFFSET: x=%d, y=%d", x, y);
//LOG_WARNING(RSX, "TODO: NV4097_SET_WINDOW_OFFSET: x=%d, y=%d", x, y);
}
break;

View File

@ -10,6 +10,14 @@
#include "Loader/PSF.h"
#include "cellSaveData.h"
#ifdef _WIN32
#include <windows.h>
#undef CreateFile
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif
extern Module *cellSysutil;
// Auxiliary Classes
@ -39,7 +47,6 @@ public:
}
};
// Auxiliary Functions
u64 getSaveDataSize(const std::string& dirName)
{
@ -69,6 +76,28 @@ void addSaveDataEntry(std::vector<SaveDataEntry>& saveEntries, const std::string
std::string localPath;
Emu.GetVFS().GetDevice(saveDir + "/ICON0.PNG", localPath);
u64 atime = 0;
u64 mtime = 0;
u64 ctime = 0;
cellSysutil->Error("Running _stat in cellSaveData. Please report this to a RPCS3 developer!");
std::string pathy;
Emu.GetVFS().GetDevice("dev_hdd0", pathy);
struct stat buf;
int result = stat((pathy.substr(0, pathy.length() - 9) + f.GetPath()).c_str(), &buf);
if (result != 0)
cellSysutil->Error("_stat failed! (%s)", (pathy.substr(0, pathy.length() - 9) + f.GetPath()).c_str());
else
{
atime = buf.st_atime;
mtime = buf.st_mtime;
ctime = buf.st_ctime;
}
SaveDataEntry saveEntry;
saveEntry.dirName = psf.GetString("SAVEDATA_DIRECTORY");
saveEntry.listParam = psf.GetString("SAVEDATA_LIST_PARAM");
@ -76,9 +105,9 @@ void addSaveDataEntry(std::vector<SaveDataEntry>& saveEntries, const std::string
saveEntry.subtitle = psf.GetString("SUB_TITLE");
saveEntry.details = psf.GetString("DETAIL");
saveEntry.sizeKB = (u32)(getSaveDataSize(saveDir) / 1024);
saveEntry.st_atime_ = 0; // TODO
saveEntry.st_mtime_ = 0; // TODO
saveEntry.st_ctime_ = 0; // TODO
saveEntry.st_atime_ = atime;
saveEntry.st_mtime_ = mtime;
saveEntry.st_ctime_ = ctime;
saveEntry.iconBuf = NULL; // TODO: Here should be the PNG buffer
saveEntry.iconBufSize = 0; // TODO: Size of the PNG file
saveEntry.isNew = false;
@ -238,7 +267,7 @@ s32 modifySaveDataFiles(vm::ptr<CellSaveDataFileCallback> funcFile, vm::ptr<Cell
cellSysutil->Error("modifySaveDataFiles: CellSaveDataFileCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message.
return CELL_SAVEDATA_ERROR_CBRESULT;
}
if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST) {
if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST || result->result == CELL_SAVEDATA_CBRESULT_OK_LAST_NOCONFIRM) {
break;
}

View File

@ -289,9 +289,9 @@ int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 as
cellSysutil->Warning("cellVideoOutGetResolutionAvailability(videoOut=%d, resolutionId=0x%x, option_addr=0x%x, aspect=%d, option=%d)",
videoOut, resolutionId, aspect, option);
if (!Ini.GS3DTV.GetValue() && resolutionId == CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING ||
if (!Ini.GS3DTV.GetValue() && (resolutionId == CELL_VIDEO_OUT_RESOLUTION_720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_1024x720_3D_FRAME_PACKING ||
resolutionId == CELL_VIDEO_OUT_RESOLUTION_960x720_3D_FRAME_PACKING || resolutionId == CELL_VIDEO_OUT_RESOLUTION_800x720_3D_FRAME_PACKING ||
resolutionId == CELL_VIDEO_OUT_RESOLUTION_640x720_3D_FRAME_PACKING)
resolutionId == CELL_VIDEO_OUT_RESOLUTION_640x720_3D_FRAME_PACKING))
return 0;
switch(videoOut)

View File

@ -9,6 +9,14 @@
#include "Emu/FS/vfsDir.h"
#include "lv2Fs.h"
#ifdef _WIN32
#include <windows.h>
#undef CreateFile
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif
extern Module *sys_fs;
struct FsRingBufferConfig
@ -235,16 +243,66 @@ s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
const std::string _path = path.get_ptr();
u32 mode = 0;
s32 uid = 0;
s32 gid = 0;
u64 atime = 0;
u64 mtime = 0;
u64 ctime = 0;
u64 size = 0;
int device = -1;
if (_path.substr(1, 8) == "dev_hdd0")
device = 0;
else if (_path.substr(1, 8) == "dev_hdd1")
device = 1;
else if (_path.substr(1, 8) == "dev_bdvd")
device = 2;
std::string pathy;
if (device == 0)
Emu.GetVFS().GetDevice("dev_hdd0", pathy);
else if (device == 1)
Emu.GetVFS().GetDevice("dev_hdd1", pathy);
else if (device == 2)
Emu.GetVFS().GetDevice("dev_bdvd", pathy);
struct stat buf;
int result = 1;
if (device == 2)
result = stat((pathy + _path.substr(9, _path.length())).c_str(), &buf);
else
result = stat((pathy.substr(0, pathy.length() - 9) + _path).c_str(), &buf);
if (result != 0)
sys_fs->Error("_stat failed! (%s)", (pathy.substr(0, pathy.length() - 9) + _path).c_str());
else
{
mode = buf.st_mode;
uid = buf.st_uid;
gid = buf.st_gid;
atime = buf.st_atime;
mtime = buf.st_mtime;
ctime = buf.st_ctime;
size = buf.st_size;
}
sb->st_mode =
CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR |
CELL_FS_S_IRGRP | CELL_FS_S_IWGRP | CELL_FS_S_IXGRP |
CELL_FS_S_IROTH | CELL_FS_S_IWOTH | CELL_FS_S_IXOTH;
sb->st_uid = 0;
sb->st_gid = 0;
sb->st_atime_ = 0; //TODO
sb->st_mtime_ = 0; //TODO
sb->st_ctime_ = 0; //TODO
if (sb->st_mode == mode)
sys_fs->Error("Mode is the same. Report this to a RPCS3 developer! (%d)", mode);
sb->st_uid = uid;
sb->st_gid = gid;
sb->st_atime_ = atime;
sb->st_mtime_ = mtime;
sb->st_ctime_ = ctime;
sb->st_blksize = 4096;
{
@ -266,6 +324,9 @@ s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
}
}
if (sb->st_size == size && size != 0)
sys_fs->Error("Size is the same. Report this to a RPCS3 developer! (%d)", size);
sys_fs->Warning("cellFsStat: \"%s\" not found.", path.get_ptr());
return CELL_ENOENT;
}

View File

@ -109,6 +109,8 @@ void sys_game_process_exitspawn(vm::ptr<const char> path, u32 argv_addr, u32 env
device = 0;
else if (_path.substr(1, 8) == "dev_hdd1")
device = 1;
else if (_path.substr(1, 8) == "dev_bdvd")
device = 2;
if (device != 0)
Emu.BootGame(_path.c_str(), true, device);
@ -189,6 +191,8 @@ void sys_game_process_exitspawn2(vm::ptr<const char> path, u32 argv_addr, u32 en
device = 0;
else if (_path.substr(1, 8) == "dev_hdd1")
device = 1;
else if (_path.substr(1, 8) == "dev_bdvd")
device = 2;
Emu.BootGame(_path.c_str(), true, device);

View File

@ -181,6 +181,8 @@ bool Emulator::BootGame(const std::string& path, bool direct, int device)
Emu.GetVFS().GetDevice("dev_hdd0", pathy);
else if (device == 1)
Emu.GetVFS().GetDevice("dev_hdd1", pathy);
else if (device == 2)
Emu.GetVFS().GetDevice("dev_bdvd", pathy);
curpath = pathy.substr(0, pathy.length() - 9) + path;