本文整理汇总了C++中mem64_t类的典型用法代码示例。如果您正苦于以下问题:C++ mem64_t类的具体用法?C++ mem64_t怎么用?C++ mem64_t使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了mem64_t类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sys_event_flag_trywait
int sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result)
{
sys_event_flag.Warning("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)",
eflag_id, bitptn, mode, result.GetAddr());
if (result.IsGood()) result = 0;
switch (mode & 0xf)
{
case SYS_EVENT_FLAG_WAIT_AND: break;
case SYS_EVENT_FLAG_WAIT_OR: break;
default: return CELL_EINVAL;
}
switch (mode & ~0xf)
{
case 0: break; // ???
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
default: return CELL_EINVAL;
}
EventFlag* ef;
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
SMutexLocker lock(ef->m_mutex);
u64 flags = ef->flags;
if (((mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & bitptn) == bitptn) ||
((mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & bitptn)))
{
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
{
ef->flags &= ~bitptn;
}
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
{
ef->flags = 0;
}
if (result.IsGood())
{
result = flags;
return CELL_OK;
}
if (!result.GetAddr())
{
return CELL_OK;
}
return CELL_EFAULT;
}
return CELL_EBUSY;
}
示例2: cellFsStRead
int cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize)
{
sys_fs.Warning("TODO: cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr = 0x%x)", fd, buf_addr, size, rsize.GetAddr());
vfsStream* file;
if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH;
if (rsize.GetAddr() && !rsize.IsGood()) return CELL_EFAULT;
m_fs_config.m_regid += size;
rsize = m_fs_config.m_regid;
return CELL_OK;
}
示例3: cellPamfGetHeaderSize2
int cellPamfGetHeaderSize2(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, u32 attribute, mem64_t pSize)
{
cellPamf.Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)",
pAddr.GetAddr(), fileSize, attribute, pSize.GetAddr());
if (!pAddr.IsGood() || !pSize.IsGood())
return CELL_PAMF_ERROR_INVALID_ARG;
//if ((u32)pAddr->magic != 0x464d4150)
//return CELL_PAMF_ERROR_UNKNOWN_TYPE;
const u64 offset = (u64)pAddr->data_offset << 11;
pSize = offset;
return CELL_OK;
}
示例4: sceNpTrophyGetRequiredDiskSpace
int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, mem64_t reqspace, u64 options)
{
sceNpTrophy.Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)",
context, handle, reqspace.GetAddr(), options);
if (!s_npTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
if (!reqspace.IsGood())
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
// TODO: There are other possible errors
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value
return CELL_OK;
}
示例5: cellFsReaddir
int cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread)
{
sys_fs.Log("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.GetAddr(), nread.GetAddr());
vfsDirBase* directory;
if(!sys_fs.CheckId(fd, directory))
return CELL_ESRCH;
if(!dir.IsGood() || !nread.IsGood())
return CELL_EFAULT;
const DirEntryInfo* info = directory->Read();
if(info)
{
nread = 1;
Memory.WriteString(dir.GetAddr()+2, info->name.wx_str());
dir->d_namlen = info->name.Length();
dir->d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY;
}
else
{
nread = 0;
}
return CELL_OK;
}
示例6: cellFsRead
int cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread)
{
sys_fs.Log("cellFsRead(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nread_addr=0x%x)",
fd, buf_addr, nbytes, nread.GetAddr());
vfsStream* file;
if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH;
if (nread.GetAddr() && !nread.IsGood()) return CELL_EFAULT;
u32 res = 0;
u32 count = nbytes;
if (nbytes != (u64)count) return CELL_ENOMEM;
if (!Memory.IsGoodAddr(buf_addr)) return CELL_EFAULT;
if (count) if (u32 frag = buf_addr & 4095) // memory page fragment
{
u32 req = min(count, 4096 - frag);
u32 read = file->Read(Memory + buf_addr, req);
buf_addr += req;
res += read;
count -= req;
if (read < req) goto fin;
}
for (u32 pages = count / 4096; pages > 0; pages--) // full pages
{
if (!Memory.IsGoodAddr(buf_addr)) goto fin; // ??? (probably EFAULT)
u32 read = file->Read(Memory + buf_addr, 4096);
buf_addr += 4096;
res += read;
count -= 4096;
if (read < 4096) goto fin;
}
if (count) // last fragment
{
if (!Memory.IsGoodAddr(buf_addr)) goto fin;
res += file->Read(Memory + buf_addr, count);
}
fin:
if (nread.GetAddr()) nread = res; // write value if not NULL
return CELL_OK;
}
示例7: cellPamfGetStreamOffsetAndSize
int cellPamfGetStreamOffsetAndSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, mem64_t pOffset, mem64_t pSize)
{
cellPamf.Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)",
pAddr.GetAddr(), fileSize, pOffset.GetAddr(), pSize.GetAddr());
if (!pAddr.IsGood() || !pOffset.IsGood() || !pSize.IsGood())
return CELL_PAMF_ERROR_INVALID_ARG;
//if ((u32)pAddr->magic != 0x464d4150)
//return CELL_PAMF_ERROR_UNKNOWN_TYPE;
const u64 offset = (u64)pAddr->data_offset << 11;
pOffset = offset;
const u64 size = (u64)pAddr->data_size << 11;
pSize = size;
return CELL_OK;
}
示例8: cellFsWrite
s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite)
{
sys_fs->Log("cellFsWrite(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nwrite_addr=0x%x)",
fd, buf_addr, nbytes, nwrite.GetAddr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
if (nbytes != (u32)nbytes) return CELL_ENOMEM;
// TODO: checks
const u64 res = nbytes ? file->Write(Memory.GetMemFromAddr(buf_addr), nbytes) : 0;
if (nwrite.GetAddr()) nwrite = res; // write value if not NULL
return CELL_OK;
}
示例9: sys_spu_thread_read_ls
//182
int sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
{
sc_spu.Log("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)",
id, address, value.GetAddr(), type);
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))
{
return CELL_ESRCH;
}
if (!thr->IsRunning())
{
return CELL_ESTAT;
}
if(!value.IsGood())
{
return CELL_EFAULT;
}
if (!(*(SPUThread*)thr).IsGoodLSA(address) || (address % type)) // +check alignment
{
return CELL_EINVAL;
}
switch (type)
{
case 1:
value = (*(SPUThread*)thr).ReadLS8(address);
return CELL_OK;
case 2:
value = (*(SPUThread*)thr).ReadLS16(address);
return CELL_OK;
case 4:
value = (*(SPUThread*)thr).ReadLS32(address);
return CELL_OK;
case 8:
value = (*(SPUThread*)thr).ReadLS64(address);
return CELL_OK;
default:
return CELL_EINVAL;
}
}
示例10: cellFsReadWithOffset
int cellFsReadWithOffset(u32 fd, u64 offset, u32 buf_addr, u64 buffer_size, mem64_t nread)
{
sys_fs.Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf_addr=0x%x, buffer_size=%lld nread=0x%llx)",
fd, offset, buf_addr, buffer_size, nread.GetAddr());
int ret;
MemoryAllocator<be_t<u64>> oldPos, newPos;
ret = cellFsLseek(fd, 0, CELL_SEEK_CUR, oldPos.GetAddr()); // Save the current position
if (ret) return ret;
ret = cellFsLseek(fd, offset, CELL_SEEK_SET, newPos.GetAddr()); // Move to the specified offset
if (ret) return ret;
ret = cellFsRead(fd, buf_addr, buffer_size, nread.GetAddr()); // Read the file
if (ret) return ret;
ret = cellFsLseek(fd, Memory.Read64(oldPos.GetAddr()), CELL_SEEK_SET, newPos.GetAddr()); // Return to the old position
if (ret) return ret;
return CELL_OK;
}
示例11: cellFsGetFreeSize
int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count)
{
const wxString& ps3_path = Memory.ReadString(path_addr);
sys_fs.Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)",
ps3_path.wx_str(), block_size.GetAddr(), block_count.GetAddr());
if (!Memory.IsGoodAddr(path_addr) || !block_size.IsGood() || !block_count.IsGood())
return CELL_EFAULT;
if (ps3_path.empty())
return CELL_EINVAL;
// TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks
block_size = 4096; // ?
block_count = 10485760; // ?
return CELL_OK;
}
示例12: cellFsStReadGetCurrentAddr
int cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
{
sys_fs.Warning("TODO: cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.GetAddr());
vfsStream* file;
if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH;
if (!addr_addr.IsGood() && !size.IsGood()) return CELL_EFAULT;
return CELL_OK;
}
示例13: cellFsRead
int cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread)
{
sys_fs.Log("cellFsRead(fd: %d, buf_addr: 0x%x, nbytes: 0x%llx, nread_addr: 0x%x)",
fd, buf_addr, nbytes, nread.GetAddr());
vfsStream* file;
if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH;
if(Memory.IsGoodAddr(buf_addr) && !Memory.IsGoodAddr(buf_addr, nbytes))
{
MemoryBlock& block = Memory.GetMemByAddr(buf_addr);
nbytes = block.GetSize() - (buf_addr - block.GetStartAddr());
}
const u64 res = nbytes ? file->Read(Memory.GetMemFromAddr(buf_addr), nbytes) : 0;
if(nread.IsGood())
nread = res;
return CELL_OK;
}
示例14: cellFsStReadGetStatus
int cellFsStReadGetStatus(u32 fd, mem64_t status)
{
sys_fs.Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.GetAddr());
vfsStream* file;
if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH;
status = m_fs_config.m_fs_status;
return CELL_OK;
}
示例15: cellFsWrite
int cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite)
{
sys_fs.Log("cellFsWrite(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nwrite_addr=0x%x)",
fd, buf_addr, nbytes, nwrite.GetAddr());
vfsStream* file;
if(!sys_fs.CheckId(fd, file)) return CELL_ESRCH;
if(Memory.IsGoodAddr(buf_addr) && !Memory.IsGoodAddr(buf_addr, nbytes))
{
MemoryBlock& block = Memory.GetMemByAddr(buf_addr);
nbytes = block.GetSize() - (buf_addr - block.GetStartAddr());
}
const u64 res = nbytes ? file->Write(Memory.GetMemFromAddr(buf_addr), nbytes) : 0;
if(nwrite.IsGood())
nwrite = res;
return CELL_OK;
}