Fix CellVideoOut values, formatting fixes

This commit is contained in:
Raul Tambre 2014-11-29 19:01:04 +02:00
parent a8c9898253
commit bfff7ff5f9
6 changed files with 87 additions and 57 deletions

View file

@ -16,8 +16,8 @@ enum VideoErrorCode
enum CellVideoOut enum CellVideoOut
{ {
CELL_VIDEO_OUT_PRIMARY, CELL_VIDEO_OUT_PRIMARY = 0,
CELL_VIDEO_OUT_SECONDARY, CELL_VIDEO_OUT_SECONDARY = 1,
}; };
enum CellVideoOutResolutionId enum CellVideoOutResolutionId

View file

@ -40,7 +40,7 @@ s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::p
LV2_LOCK(0); LV2_LOCK(0);
s32 _oflags = flags; s32 _oflags = flags;
if(flags & CELL_O_CREAT) if (flags & CELL_O_CREAT)
{ {
_oflags &= ~CELL_O_CREAT; _oflags &= ~CELL_O_CREAT;
Emu.GetVFS().CreateFile(_path); Emu.GetVFS().CreateFile(_path);
@ -48,7 +48,7 @@ s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::p
vfsOpenMode o_mode; vfsOpenMode o_mode;
switch(flags & CELL_O_ACCMODE) switch (flags & CELL_O_ACCMODE)
{ {
case CELL_O_RDONLY: case CELL_O_RDONLY:
_oflags &= ~CELL_O_RDONLY; _oflags &= ~CELL_O_RDONLY;
@ -88,7 +88,7 @@ s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::p
break; break;
} }
if(_oflags != 0) if (_oflags != 0)
{ {
sys_fs->Error("\"%s\" has unknown flags! flags: 0x%08x", path.get_ptr(), flags); sys_fs->Error("\"%s\" has unknown flags! flags: 0x%08x", path.get_ptr(), flags);
return CELL_EINVAL; return CELL_EINVAL;
@ -102,7 +102,7 @@ s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::p
vfsFileBase* stream = Emu.GetVFS().OpenFile(_path, o_mode); vfsFileBase* stream = Emu.GetVFS().OpenFile(_path, o_mode);
if(!stream || !stream->IsOpened()) if (!stream || !stream->IsOpened())
{ {
delete stream; delete stream;
sys_fs->Error("\"%s\" not found! flags: 0x%08x", path.get_ptr(), flags); sys_fs->Error("\"%s\" not found! flags: 0x%08x", path.get_ptr(), flags);
@ -124,9 +124,11 @@ s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
if (nbytes != (u32)nbytes) return CELL_ENOMEM; if (nbytes != (u32)nbytes)
return CELL_ENOMEM;
// TODO: checks // TODO: checks
@ -145,7 +147,7 @@ s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<u64> nwrite
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
if (nbytes != (u32)nbytes) return CELL_ENOMEM; if (nbytes != (u32)nbytes) return CELL_ENOMEM;
@ -164,7 +166,7 @@ s32 cellFsClose(u32 fd)
LV2_LOCK(0); LV2_LOCK(0);
if(!Emu.GetIdManager().RemoveID(fd)) if (!Emu.GetIdManager().RemoveID(fd))
return CELL_ESRCH; return CELL_ESRCH;
return CELL_OK; return CELL_OK;
@ -177,7 +179,7 @@ s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<u32> fd)
LV2_LOCK(0); LV2_LOCK(0);
vfsDirBase* dir = Emu.GetVFS().OpenDir(path.get_ptr()); vfsDirBase* dir = Emu.GetVFS().OpenDir(path.get_ptr());
if(!dir || !dir->IsOpened()) if (!dir || !dir->IsOpened())
{ {
delete dir; delete dir;
return CELL_ENOENT; return CELL_ENOENT;
@ -194,11 +196,11 @@ s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<u64> nread)
LV2_LOCK(0); LV2_LOCK(0);
vfsDirBase* directory; vfsDirBase* directory;
if(!sys_fs->CheckId(fd, directory)) if (!sys_fs->CheckId(fd, directory))
return CELL_ESRCH; return CELL_ESRCH;
const DirEntryInfo* info = directory->Read(); const DirEntryInfo* info = directory->Read();
if(info) if (info)
{ {
dir->d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY; dir->d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY;
dir->d_namlen = u8(std::min((u32)info->name.length(), (u32)CELL_MAX_FS_FILE_NAME_LENGTH)); dir->d_namlen = u8(std::min((u32)info->name.length(), (u32)CELL_MAX_FS_FILE_NAME_LENGTH));
@ -219,7 +221,7 @@ s32 cellFsClosedir(u32 fd)
LV2_LOCK(0); LV2_LOCK(0);
if(!Emu.GetIdManager().RemoveID(fd)) if (!Emu.GetIdManager().RemoveID(fd))
return CELL_ESRCH; return CELL_ESRCH;
return CELL_OK; return CELL_OK;
@ -276,9 +278,8 @@ s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb)
IDType type; IDType type;
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) { if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE)
return CELL_ESRCH; return CELL_ESRCH;
}
sb->st_mode = sb->st_mode =
CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR | CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR |
@ -305,9 +306,9 @@ s32 cellFsMkdir(vm::ptr<const char> path, u32 mode)
const std::string _path = path.get_ptr(); const std::string _path = path.get_ptr();
if(Emu.GetVFS().ExistsDir(_path)) if (Emu.GetVFS().ExistsDir(_path))
return CELL_EEXIST; return CELL_EEXIST;
if(!Emu.GetVFS().CreateDir(_path)) if (!Emu.GetVFS().CreateDir(_path))
return CELL_EBUSY; return CELL_EBUSY;
return CELL_OK; return CELL_OK;
@ -378,10 +379,10 @@ s32 cellFsRmdir(vm::ptr<const char> path)
std::string _path = path.get_ptr(); std::string _path = path.get_ptr();
vfsDir d; vfsDir d;
if(!d.IsExists(_path)) if (!d.IsExists(_path))
return CELL_ENOENT; return CELL_ENOENT;
if(!d.Remove(_path)) if (!d.Remove(_path))
return CELL_EBUSY; return CELL_EBUSY;
return CELL_OK; return CELL_OK;
@ -426,9 +427,9 @@ s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos)
IDType type; IDType type;
vfsStream* file; vfsStream* file;
if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) { if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE)
return CELL_ESRCH; return CELL_ESRCH;
}
*pos = file->Seek(offset, seek_mode); *pos = file->Seek(offset, seek_mode);
return CELL_OK; return CELL_OK;
} }
@ -441,9 +442,9 @@ s32 cellFsFtruncate(u32 fd, u64 size)
IDType type; IDType type;
vfsStream* file; vfsStream* file;
if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) { if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE)
return CELL_ESRCH; return CELL_ESRCH;
}
u64 initialSize = file->GetSize(); u64 initialSize = file->GetSize();
if (initialSize < size) if (initialSize < size)
@ -471,7 +472,7 @@ s32 cellFsTruncate(vm::ptr<const char> path, u64 size)
LV2_LOCK(0); LV2_LOCK(0);
vfsFile f(path.get_ptr(), vfsReadWrite); vfsFile f(path.get_ptr(), vfsReadWrite);
if(!f.IsOpened()) if (!f.IsOpened())
{ {
sys_fs->Warning("cellFsTruncate: \"%s\" not found.", path.get_ptr()); sys_fs->Warning("cellFsTruncate: \"%s\" not found.", path.get_ptr());
return CELL_ENOENT; return CELL_ENOENT;
@ -504,7 +505,8 @@ s32 cellFsFGetBlockSize(u32 fd, vm::ptr<u64> sector_size, vm::ptr<u64> block_siz
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
*sector_size = 4096; // ? *sector_size = 4096; // ?
*block_size = 4096; // ? *block_size = 4096; // ?
@ -547,11 +549,11 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32
LV2_LOCK(0); LV2_LOCK(0);
vfsDirBase* directory; vfsDirBase* directory;
if(!sys_fs->CheckId(fd, directory)) if (!sys_fs->CheckId(fd, directory))
return CELL_ESRCH; return CELL_ESRCH;
const DirEntryInfo* info = directory->Read(); const DirEntryInfo* info = directory->Read();
if(info) if (info)
{ {
entries->attribute.st_mode = entries->attribute.st_mode =
CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR | CELL_FS_S_IRUSR | CELL_FS_S_IWUSR | CELL_FS_S_IXUSR |
@ -585,17 +587,16 @@ s32 cellFsStReadInit(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
fs_config.m_ring_buffer = *ringbuf; fs_config.m_ring_buffer = *ringbuf;
// If the size is less than 1MB // If the size is less than 1MB
if(ringbuf->ringbuf_size < 0x40000000) { if (ringbuf->ringbuf_size < 0x40000000)
fs_config.m_alloc_mem_size = (((u32)ringbuf->ringbuf_size + 64 * 1024 - 1) / (64 * 1024)) * (64 * 1024); fs_config.m_alloc_mem_size = (((u32)ringbuf->ringbuf_size + 64 * 1024 - 1) / (64 * 1024)) * (64 * 1024);
} else
else {
fs_config.m_alloc_mem_size = (((u32)ringbuf->ringbuf_size + 1024 * 1024 - 1) / (1024 * 1024)) * (1024 * 1024); fs_config.m_alloc_mem_size = (((u32)ringbuf->ringbuf_size + 1024 * 1024 - 1) / (1024 * 1024)) * (1024 * 1024);
}
// alloc memory // alloc memory
fs_config.m_buffer = (u32)Memory.Alloc(fs_config.m_alloc_mem_size, 1024); fs_config.m_buffer = (u32)Memory.Alloc(fs_config.m_alloc_mem_size, 1024);
@ -613,7 +614,8 @@ s32 cellFsStReadFinish(u32 fd)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
Memory.Free(fs_config.m_buffer); Memory.Free(fs_config.m_buffer);
fs_config.m_fs_status = CELL_FS_ST_NOT_INITIALIZED; fs_config.m_fs_status = CELL_FS_ST_NOT_INITIALIZED;
@ -628,7 +630,8 @@ s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
*ringbuf = fs_config.m_ring_buffer; *ringbuf = fs_config.m_ring_buffer;
@ -644,7 +647,8 @@ s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
*status = fs_config.m_fs_status; *status = fs_config.m_fs_status;
@ -658,7 +662,8 @@ s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
*regid = fs_config.m_regid; *regid = fs_config.m_regid;
@ -672,7 +677,8 @@ s32 cellFsStReadStart(u32 fd, u64 offset, u64 size)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
fs_config.m_current_addr = fs_config.m_buffer + (u32)offset; fs_config.m_current_addr = fs_config.m_buffer + (u32)offset;
fs_config.m_fs_status = CELL_FS_ST_PROGRESS; fs_config.m_fs_status = CELL_FS_ST_PROGRESS;
@ -687,7 +693,8 @@ s32 cellFsStReadStop(u32 fd)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
fs_config.m_fs_status = CELL_FS_ST_STOP; fs_config.m_fs_status = CELL_FS_ST_STOP;
@ -701,7 +708,8 @@ s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, vm::ptr<u64> rsize)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
// TODO: use ringbuffer (fs_config) // TODO: use ringbuffer (fs_config)
fs_config.m_regid += size; fs_config.m_regid += size;
@ -721,7 +729,8 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<u32> addr, vm::ptr<u64> size)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
return CELL_OK; return CELL_OK;
} }
@ -733,7 +742,8 @@ s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
return CELL_OK; return CELL_OK;
} }
@ -745,7 +755,8 @@ s32 cellFsStReadWait(u32 fd, u64 size)
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
return CELL_OK; return CELL_OK;
} }
@ -757,7 +768,8 @@ s32 cellFsStReadWaitCallback(u32 fd, u64 size, vm::ptr<void (*)(int xfd, u64 xsi
LV2_LOCK(0); LV2_LOCK(0);
vfsStream* file; vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH; if (!sys_fs->CheckId(fd, file))
return CELL_ESRCH;
return CELL_OK; return CELL_OK;
} }

View file

@ -30,9 +30,7 @@ u32 EventFlag::check()
} }
if (m_protocol == SYS_SYNC_PRIORITY) if (m_protocol == SYS_SYNC_PRIORITY)
{
target = sq.pop_prio(); target = sq.pop_prio();
}
return target; return target;
} }
@ -42,13 +40,13 @@ s32 sys_event_flag_create(vm::ptr<u32> eflag_id, vm::ptr<sys_event_flag_attr> at
sys_event_flag.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)", sys_event_flag.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)",
eflag_id.addr(), attr.addr(), init); eflag_id.addr(), attr.addr(), init);
if (eflag_id.addr() == NULL) if (!eflag_id)
{ {
sys_event_flag.Error("sys_event_flag_create(): invalid memory access (eflag_id_addr=0x%x)", eflag_id.addr()); sys_event_flag.Error("sys_event_flag_create(): invalid memory access (eflag_id_addr=0x%x)", eflag_id.addr());
return CELL_EFAULT; return CELL_EFAULT;
} }
if (attr.addr() == NULL) if (!attr)
{ {
sys_event_flag.Error("sys_event_flag_create(): invalid memory access (attr_addr=0x%x)", attr.addr()); sys_event_flag.Error("sys_event_flag_create(): invalid memory access (attr_addr=0x%x)", attr.addr());
return CELL_EFAULT; return CELL_EFAULT;
@ -64,9 +62,7 @@ s32 sys_event_flag_create(vm::ptr<u32> eflag_id, vm::ptr<sys_event_flag_attr> at
} }
if (attr->pshared.ToBE() != se32(0x200)) if (attr->pshared.ToBE() != se32(0x200))
{
return CELL_EINVAL; return CELL_EINVAL;
}
switch (attr->type.ToBE()) switch (attr->type.ToBE())
{ {
@ -370,7 +366,7 @@ s32 sys_event_flag_get(u32 eflag_id, vm::ptr<u64> flags)
{ {
sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.addr()); sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.addr());
if (flags.addr() == NULL) if (!flags)
{ {
sys_event_flag.Error("sys_event_flag_create(): invalid memory access (flags_addr=0x%x)", flags.addr()); sys_event_flag.Error("sys_event_flag_create(): invalid memory access (flags_addr=0x%x)", flags.addr());
return CELL_EFAULT; return CELL_EFAULT;

View file

@ -28,7 +28,7 @@ s32 sys_memory_allocate(u32 size, u32 flags, u32 alloc_addr_addr)
default: return CELL_EINVAL; default: return CELL_EINVAL;
} }
if(!addr) if (!addr)
return CELL_ENOMEM; return CELL_ENOMEM;
// Write back the start address of the allocated area. // Write back the start address of the allocated area.

View file

@ -73,16 +73,27 @@ void sys_game_process_exitspawn(
envp++; envp++;
} }
for (auto &arg : argv){ for (auto &arg : argv) {
sys_process.Log("argument: %s", arg.c_str()); sys_process.Log("argument: %s", arg.c_str());
} }
for (auto &en : env){
for (auto &en : env) {
sys_process.Log("env_argument: %s", en.c_str()); sys_process.Log("env_argument: %s", en.c_str());
} }
//TODO: execute the file in <path> with the args in argv //TODO: execute the file in <path> with the args in argv
//and the environment parameters in envp and copy the data //and the environment parameters in envp and copy the data
//from data_addr into the adress space of the new process //from data_addr into the adress space of the new process
//then kill the current process //then kill the current process
Emu.Pause();
sys_process.Success("Process finished");
CallAfter([]()
{
Emu.Stop();
});
return; return;
} }
@ -121,16 +132,27 @@ void sys_game_process_exitspawn2(
envp++; envp++;
} }
for (auto &arg : argv){ for (auto &arg : argv) {
sys_process.Log("argument: %s", arg.c_str()); sys_process.Log("argument: %s", arg.c_str());
} }
for (auto &en : env){
for (auto &en : env) {
sys_process.Log("env_argument: %s", en.c_str()); sys_process.Log("env_argument: %s", en.c_str());
} }
//TODO: execute the file in <path> with the args in argv //TODO: execute the file in <path> with the args in argv
//and the environment parameters in envp and copy the data //and the environment parameters in envp and copy the data
//from data_addr into the adress space of the new process //from data_addr into the adress space of the new process
//then kill the current process //then kill the current process
Emu.Pause();
sys_process.Success("Process finished");
CallAfter([]()
{
Emu.Stop();
});
return; return;
} }

View file

@ -147,7 +147,7 @@ void KernelExplorer::Update()
sprintf(name, "Modules (%d)", count); sprintf(name, "Modules (%d)", count);
const auto& node = m_tree->AppendItem(root, name); const auto& node = m_tree->AppendItem(root, name);
const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_PRX); const auto& objects = Emu.GetIdManager().GetTypeIDs(TYPE_PRX);
sprintf(name, "Segment List (%d)", 2 * objects.size()); // TODO: Assuming 2 segments per PRX file is not good sprintf(name, "Segment List (%l)", 2 * objects.size()); // TODO: Assuming 2 segments per PRX file is not good
m_tree->AppendItem(node, name); m_tree->AppendItem(node, name);
for (const auto& id : objects) for (const auto& id : objects)
{ {