本文整理汇总了C++中mem32_t::GetAddr方法的典型用法代码示例。如果您正苦于以下问题:C++ mem32_t::GetAddr方法的具体用法?C++ mem32_t::GetAddr怎么用?C++ mem32_t::GetAddr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mem32_t
的用法示例。
在下文中一共展示了mem32_t::GetAddr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sys_event_flag_cancel
int sys_event_flag_cancel(u32 eflag_id, mem32_t num)
{
sys_event_flag.Warning("sys_event_flag_cancel(eflag_id=%d, num_addr=0x%x)", eflag_id, num.GetAddr());
EventFlag* ef;
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
Array<u32> tids;
{
SMutexLocker lock(ef->m_mutex);
tids.SetCount(ef->waiters.GetCount());
for (u32 i = 0; i < ef->waiters.GetCount(); i++)
{
tids[i] = ef->waiters[i].tid;
}
ef->waiters.Clear();
}
for (u32 i = 0; i < tids.GetCount(); i++)
{
if (Emu.IsStopped()) break;
ef->signal.lock(tids[i]);
}
if (Emu.IsStopped())
{
ConLog.Warning("sys_event_flag_cancel(id=%d) aborted", eflag_id);
return CELL_OK;
}
if (num.IsGood())
{
num = tids.GetCount();
return CELL_OK;
}
if (!num.GetAddr())
{
return CELL_OK;
}
return CELL_EFAULT;
}
示例2: cellVdecOpen
int cellVdecOpen(const mem_ptr_t<CellVdecType> type, const mem_ptr_t<CellVdecResource> res, const mem_ptr_t<CellVdecCb> cb, mem32_t handle)
{
cellVdec.Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.GetAddr(), res.GetAddr(), cb.GetAddr(), handle.GetAddr());
if (!type.IsGood() || !res.IsGood() || !cb.IsGood() || !handle.IsGood())
{
return CELL_VDEC_ERROR_FATAL;
}
if (!Memory.IsGoodAddr(res->memAddr, res->memSize) || !Memory.IsGoodAddr(cb->cbFunc))
{
return CELL_VDEC_ERROR_FATAL;
}
handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
return CELL_OK;
}
示例3: sys_process_get_id
int sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_size)
{
sc_p.Warning("TODO: sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)",
object, buffer.GetAddr(), size, set_size.GetAddr());
switch(object)
{
#define ADD_OBJECTS(objects) { \
u32 i=0; \
for(auto id=objects.begin(); i<size && id!=objects.end(); id++, i++) \
buffer[i] = *id; \
set_size = i; \
}
case SYS_MEM_OBJECT: ADD_OBJECTS(procObjects.mem_objects); break;
case SYS_MUTEX_OBJECT: ADD_OBJECTS(procObjects.mutex_objects); break;
case SYS_COND_OBJECT: ADD_OBJECTS(procObjects.cond_objects); break;
case SYS_RWLOCK_OBJECT: ADD_OBJECTS(procObjects.rwlock_objects); break;
case SYS_INTR_TAG_OBJECT: ADD_OBJECTS(procObjects.intr_tag_objects); break;
case SYS_INTR_SERVICE_HANDLE_OBJECT: ADD_OBJECTS(procObjects.intr_service_handle_objects); break;
case SYS_EVENT_QUEUE_OBJECT: ADD_OBJECTS(procObjects.event_queue_objects); break;
case SYS_EVENT_PORT_OBJECT: ADD_OBJECTS(procObjects.event_port_objects); break;
case SYS_TRACE_OBJECT: ADD_OBJECTS(procObjects.trace_objects); break;
case SYS_SPUIMAGE_OBJECT: ADD_OBJECTS(procObjects.spuimage_objects); break;
case SYS_PRX_OBJECT: ADD_OBJECTS(procObjects.prx_objects); break;
case SYS_SPUPORT_OBJECT: ADD_OBJECTS(procObjects.spuport_objects); break;
case SYS_LWMUTEX_OBJECT: ADD_OBJECTS(procObjects.lwmutex_objects); break;
case SYS_TIMER_OBJECT: ADD_OBJECTS(procObjects.timer_objects); break;
case SYS_SEMAPHORE_OBJECT: ADD_OBJECTS(procObjects.semaphore_objects); break;
case SYS_FS_FD_OBJECT: ADD_OBJECTS(procObjects.fs_fd_objects); break;
case SYS_LWCOND_OBJECT: ADD_OBJECTS(procObjects.lwcond_objects); break;
case SYS_EVENT_FLAG_OBJECT: ADD_OBJECTS(procObjects.event_flag_objects); break;
#undef ADD_OBJECTS
default:
return CELL_EINVAL;
}
return CELL_OK;
}
示例4: sys_mutex_create
s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
{
sys_mutex.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.GetAddr(), attr.GetAddr());
switch (attr->protocol.ToBE())
{
case se32(SYS_SYNC_FIFO): break;
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mutex.Todo("sys_mutex_create(): SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_mutex.Error("sys_mutex_create(): SYS_SYNC_RETRY"); return CELL_EINVAL;
default: sys_mutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
}
bool is_recursive;
switch (attr->recursive.ToBE())
{
case se32(SYS_SYNC_RECURSIVE): is_recursive = true; break;
case se32(SYS_SYNC_NOT_RECURSIVE): is_recursive = false; break;
default: sys_mutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->recursive); return CELL_EINVAL;
}
if (attr->pshared.ToBE() != se32(0x200))
{
sys_mutex.Error("Unknown pshared attribute(0x%x)", (u32)attr->pshared);
return CELL_EINVAL;
}
u32 tid = GetCurrentPPUThread().GetId();
Mutex* mutex = new Mutex((u32)attr->protocol, is_recursive, attr->name_u64);
u32 id = sys_mutex.GetNewId(mutex, TYPE_MUTEX);
mutex->m_mutex.lock(tid);
mutex->id = id;
mutex_id = id;
mutex->m_mutex.unlock(tid);
sys_mutex.Warning("*** mutex created [%s] (protocol=0x%x, recursive=%s): id = %d",
std::string(attr->name, 8).c_str(), (u32) attr->protocol,
(is_recursive ? "true" : "false"), mutex_id.GetValue());
// TODO: unlock mutex when owner thread does exit
return CELL_OK;
}
示例5: sys_spu_thread_group_create
//170
int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr)
{
ConLog.Write("sys_spu_thread_group_create:");
ConLog.Write("*** id_addr=0x%x", id.GetAddr());
ConLog.Write("*** num=%d", num);
ConLog.Write("*** prio=%d", prio);
ConLog.Write("*** attr_addr=0x%x", attr.GetAddr());
ConLog.Write("*** attr.name_len=%d", attr->name_len.ToLE());
ConLog.Write("*** attr.name_addr=0x%x", attr->name_addr.ToLE());
ConLog.Write("*** attr.type=%d", attr->type.ToLE());
ConLog.Write("*** attr.option.ct=%d", attr->option.ct.ToLE());
const wxString name = Memory.ReadString(attr->name_addr, attr->name_len).mb_str();
ConLog.Write("*** name='%s'", name.c_str());
id = Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group '%s'", name), new SpuGroupInfo(*attr));
return CELL_OK;
}
示例6: sys_raw_spu_read_puint_mb
s32 sys_raw_spu_read_puint_mb(u32 id, mem32_t value)
{
sc_spu.Log("sys_raw_spu_read_puint_mb(id=%d, value_addr=0x%x)", id, value.GetAddr());
if (!value.IsGood())
{
return CELL_EFAULT;
}
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
if (!t)
{
return CELL_ESRCH;
}
u32 v;
t->SPU.Out_IntrMBox.PopUncond(v);
value = v;
return CELL_OK;
}
示例7: sys_mutex_create
int sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
{
sys_mtx.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.GetAddr(), attr.GetAddr());
if (!mutex_id.IsGood() || !attr.IsGood())
{
return CELL_EFAULT;
}
switch (attr->protocol.ToBE())
{
case se32(SYS_SYNC_FIFO): break;
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mtx.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT protocol"); break;
case se32(SYS_SYNC_RETRY): sys_mtx.Error("Invalid SYS_SYNC_RETRY protocol"); return CELL_EINVAL;
default: sys_mtx.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
}
bool is_recursive;
switch (attr->recursive.ToBE())
{
case se32(SYS_SYNC_RECURSIVE): is_recursive = true; break;
case se32(SYS_SYNC_NOT_RECURSIVE): is_recursive = false; break;
default: sys_mtx.Error("Unknown recursive attribute(0x%x)", (u32)attr->recursive); return CELL_EINVAL;
}
if (attr->pshared.ToBE() != se32(0x200))
{
sys_mtx.Error("Unknown pshared attribute(0x%x)", (u32)attr->pshared);
return CELL_EINVAL;
}
mutex_id = sys_mtx.GetNewId(new Mutex((u32)attr->protocol, is_recursive, attr->name_u64));
sys_mtx.Warning("*** mutex created [%s] (protocol=0x%x, recursive=%s): id = %d",
wxString(attr->name, 8).wx_str(), (u32)attr->protocol,
wxString(is_recursive ? "true" : "false").wx_str(), mutex_id.GetValue());
// TODO: unlock mutex when owner thread does exit
return CELL_OK;
}
示例8: sys_mmapper_allocate_memory_from_container
s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, mem32_t mem_id)
{
sys_mmapper.Warning("sys_mmapper_allocate_memory_from_container(size=0x%x, cid=%d, flags=0x%llx, mem_id_addr=0x%x)",
size, cid, flags, mem_id.GetAddr());
if(!mem_id.IsGood())
return CELL_EFAULT;
// Check if this container ID is valid.
MemoryContainerInfo* ct;
if(!sys_mmapper.CheckId(cid, ct))
return CELL_ESRCH;
// Check page granularity.
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
{
case SYS_MEMORY_PAGE_SIZE_1M:
if(size & 0xfffff)
return CELL_EALIGN;
ct->addr = Memory.Alloc(size, 0x100000);
break;
case SYS_MEMORY_PAGE_SIZE_64K:
if(size & 0xffff)
return CELL_EALIGN;
ct->addr = Memory.Alloc(size, 0x10000);
break;
default:
return CELL_EINVAL;
}
if(!ct->addr)
return CELL_ENOMEM;
ct->size = size;
// Generate a new mem ID.
mem_id = sys_mmapper.GetNewId(new mmapper_info(ct->addr, ct->size, flags));
return CELL_OK;
}
示例9: sys_memory_container_create
int sys_memory_container_create(mem32_t cid, u32 yield_size)
{
sc_mem.Warning("sys_memory_container_create(cid_addr=0x%x, yield_size=0x%x)", cid.GetAddr(), yield_size);
if (!cid.IsGood())
return CELL_EFAULT;
yield_size &= ~0xfffff; //round down to 1 MB granularity
u64 addr = Memory.Alloc(yield_size, 0x100000); //1 MB alignment
if(!addr)
return CELL_ENOMEM;
// Wrap the allocated memory in a memory container.
MemoryContainerInfo *ct = new MemoryContainerInfo(addr, yield_size);
cid = sc_mem.GetNewId(ct);
sc_mem.Warning("*** memory_container created(addr=0x%llx): id = %d", addr, cid.GetValue());
return CELL_OK;
}
示例10: sys_semaphore_get_value
int sys_semaphore_get_value(u32 sem_id, mem32_t count)
{
sys_sem.Log("sys_semaphore_get_value(sem_id=%d, count_addr=0x%x)", sem_id, count.GetAddr());
if (!count.IsGood())
{
return CELL_EFAULT;
}
Semaphore* sem;
if (!Emu.GetIdManager().GetIDData(sem_id, sem))
{
return CELL_ESRCH;
}
std::lock_guard<std::mutex> lock(sem->m_mutex);
count = sem->m_value;
return CELL_OK;
}
示例11: sys_raw_spu_load
int sys_raw_spu_load(int id, u32 path_addr, mem32_t entry)
{
const std::string path = Memory.ReadString(path_addr);
sysPrxForUser->Warning("sys_raw_spu_load(id=0x%x, path=0x%x [%s], entry_addr=0x%x)",
id, path_addr, path.c_str(), entry.GetAddr());
vfsFile f(path);
if(!f.IsOpened())
{
sysPrxForUser->Error("sys_raw_spu_load error: '%s' not found!", path.c_str());
return CELL_ENOENT;
}
ELFLoader l(f);
l.LoadInfo();
l.LoadData(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id);
entry = l.GetEntry();
return CELL_OK;
}
示例12: cellSpursCreateTask
int cellSpursCreateTask(mem_ptr_t<CellSpursTaskset> taskset, mem32_t taskID, mem_ptr_t<void> elf_addr,
mem_ptr_t<void> context_addr, u32 context_size, mem_ptr_t<CellSpursTaskLsPattern> lsPattern,
mem_ptr_t<CellSpursTaskArgument> argument)
{
cellSpurs->Todo("cellSpursCreateTask(taskset_addr=0x%x, taskID_addr=0x%x, elf_addr_addr=0x%x, context_addr_addr=0x%x, context_size=%u, lsPattern_addr=0x%x, argument_addr=0x%x)",
taskset.GetAddr(), taskID.GetAddr(), elf_addr.GetAddr(), context_addr.GetAddr(), context_size, lsPattern.GetAddr(), argument.GetAddr());
if (taskset.GetAddr() % 128 != 0)
{
cellSpurs->Error("cellSpursCreateTask : CELL_SPURS_TASK_ERROR_ALIGN");
return CELL_SPURS_TASK_ERROR_ALIGN;
}
if (!taskset.IsGood())
{
cellSpurs->Error("cellSpursCreateTask : CELL_SPURS_TASK_ERROR_NULL_POINTER");
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
}
return CELL_OK;
}
示例13: cellPngDecOpen
int cellPngDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellPngDecSrc> src, u32 openInfo)
{
cellPngDec.Warning("cellPngDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)",
mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo);
if (!subHandle.IsGood() || !src.IsGood())
return CELL_PNGDEC_ERROR_ARG;
CellPngDecSubHandle *current_subHandle = new CellPngDecSubHandle;
current_subHandle->fd = NULL;
current_subHandle->src = *src;
switch(src->srcSelect.ToBE())
{
case const_se_t<u32, CELL_PNGDEC_BUFFER>::value:
current_subHandle->fileSize = src->streamSize.ToLE();
break;
case const_se_t<u32, CELL_PNGDEC_FILE>::value:
// Get file descriptor
MemoryAllocator<be_t<u32>> fd;
int ret = cellFsOpen(src->fileName_addr, 0, fd.GetAddr(), NULL, 0);
current_subHandle->fd = fd->ToLE();
if(ret != CELL_OK) return CELL_PNGDEC_ERROR_OPEN_FILE;
// Get size of file
MemoryAllocator<CellFsStat> sb; // Alloc a CellFsStat struct
ret = cellFsFstat(current_subHandle->fd, sb.GetAddr());
if(ret != CELL_OK) return ret;
current_subHandle->fileSize = sb->st_size; // Get CellFsStat.st_size
break;
}
// From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct.
subHandle = cellPngDec.GetNewId(current_subHandle);
return CELL_OK;
}
示例14: cellAudioCreateNotifyEventQueue
// Utility Functions
int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key)
{
cellAudio.Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.GetAddr(), key.GetAddr());
if (Emu.GetEventManager().CheckKey(0x80004d494f323221))
{
return CELL_AUDIO_ERROR_EVENT_QUEUE;
}
EventQueue* eq = new EventQueue(SYS_SYNC_FIFO, SYS_PPU_QUEUE, 0x80004d494f323221, 0x80004d494f323221, 32);
if (!Emu.GetEventManager().RegisterKey(eq, 0x80004d494f323221))
{
delete eq;
return CELL_AUDIO_ERROR_EVENT_QUEUE;
}
id = cellAudio.GetNewId(eq);
key = 0x80004d494f323221;
return CELL_OK;
}
示例15: sceNpTrophyCreateContext
int sceNpTrophyCreateContext(mem32_t context, mem_ptr_t<SceNpCommunicationId> commID, mem_ptr_t<SceNpCommunicationSignature> commSign, u64 options)
{
sceNpTrophy.Warning("sceNpTrophyCreateContext(context_addr=0x%x, commID_addr=0x%x, commSign_addr=0x%x, options=0x%llx)",
context.GetAddr(), commID.GetAddr(), commSign.GetAddr(), options);
if (!s_npTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
if (!context.IsGood())
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
if (options & (~(u64)1))
SCE_NP_TROPHY_ERROR_NOT_SUPPORTED;
// TODO: There are other possible errors
// TODO: Is the TROPHY.TRP file necessarily located in this path?
vfsDir dir("/app_home/TROPDIR/");
if(!dir.IsOpened())
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
// TODO: Following method will retrieve the TROPHY.TRP of the first folder that contains such file
for(const DirEntryInfo* entry = dir.Read(); entry; entry = dir.Read())
{
if (entry->flags & DirEntry_TypeDir)
{
std::shared_ptr<vfsFileBase> f(Emu.GetVFS().OpenFile("/app_home/TROPDIR/" + entry->name + "/TROPHY.TRP", vfsRead));
if (f && f->IsOpened())
{
sceNpTrophyInternalContext ctxt;
ctxt.trp_stream = f.get();
ctxt.trp_name = entry->name;
s_npTrophyInstance.contexts.push_back(ctxt);
f = nullptr;
return CELL_OK;
}
}
}
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
}