本文整理汇总了C++中mem32_t::IsGood方法的典型用法代码示例。如果您正苦于以下问题:C++ mem32_t::IsGood方法的具体用法?C++ mem32_t::IsGood怎么用?C++ mem32_t::IsGood使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mem32_t
的用法示例。
在下文中一共展示了mem32_t::IsGood方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cellFsSdataOpen
int cellFsSdataOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
{
const std::string& path = Memory.ReadString(path_addr);
sys_fs.Warning("cellFsSdataOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)",
path.c_str(), flags, fd.GetAddr(), arg.GetAddr(), size);
if (!fd.IsGood() || (!arg.IsGood() && size))
return CELL_EFAULT;
if (flags != CELL_O_RDONLY)
return CELL_EINVAL;
std::string suffix = path.substr(path.length() - 5, 4);
if (suffix != ".sdat" && suffix != ".SDAT")
return CELL_ENOTSDATA;
std::string::size_type last_slash = path.rfind('/'); //TODO: use a filesystem library to solve this more robustly
last_slash = last_slash == std::string::npos ? 0 : last_slash+1;
std::string unpacked_path = "/dev_hdd1/"+path.substr(last_slash,path.length()-last_slash)+".unpacked";
int ret = sdata_unpack(path, unpacked_path);
if (ret) return ret;
fd = sys_fs.GetNewId(Emu.GetVFS().OpenFile(unpacked_path, vfsRead), flags);
return CELL_OK;
}
示例2: cellGameBootCheck
int cellGameBootCheck(mem32_t type, mem32_t attributes, mem_ptr_t<CellGameContentSize> size, mem_list_ptr_t<u8> dirName)
{
cellGame.Warning("cellGameBootCheck(type_addr=0x%x, attributes_addr=0x%x, size_addr=0x%x, dirName_addr=0x%x)",
type.GetAddr(), attributes.GetAddr(), size.GetAddr(), dirName.GetAddr());
if (!type.IsGood() || !attributes.IsGood() || !size.IsGood() || !dirName.IsGood())
{
cellGame.Warning("cellGameBootCheck returns CELL_GAME_ERROR_PARAM. As a result size->hddFreeSizeKB may be 0.");
return CELL_GAME_ERROR_PARAM;
}
// TODO: Only works for HDD games
type = CELL_GAME_GAMETYPE_HDD;
attributes = 0;
size->hddFreeSizeKB = 40000000; //40 GB, TODO: Use the free space of the computer's HDD where RPCS3 is being run.
size->sizeKB = CELL_GAME_SIZEKB_NOTCALC;
size->sysSizeKB = 0;
// TODO: Locate the PARAM.SFO. The following path may be wrong.
vfsFile f("/app_home/PARAM.SFO");
PSFLoader psf(f);
if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE;
std::string titleId = psf.GetString("TITLE_ID");
Memory.WriteString(dirName.GetAddr(), titleId);
return CELL_OK;
}
示例3: cellSpursGetSpuThreadId
int cellSpursGetSpuThreadId(mem_ptr_t<CellSpurs> spurs, mem32_t thread, mem32_t nThreads)
{
cellSpurs.Error("cellSpursGetSpuThreadId(spurs_addr=0x%x, thread_addr=0x%x, nThreads_addr=0x%x)",
spurs.GetAddr(), thread.GetAddr(), nThreads.GetAddr());
if(!spurs.IsGood() || !thread.IsGood() || nThreads.IsGood())
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
return CELL_OK;
}
示例4: sys_spu_thread_group_join
//178
s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
{
sc_spu.Warning("sys_spu_thread_group_join(id=%d, cause_addr=0x%x, status_addr=0x%x)", id, cause.GetAddr(), status.GetAddr());
SpuGroupInfo* group_info;
if(!Emu.GetIdManager().GetIDData(id, group_info))
{
return CELL_ESRCH;
}
if (cause.GetAddr() && !cause.IsGood())
{
return CELL_EFAULT;
}
if (status.GetAddr() && !status.IsGood())
{
return CELL_EFAULT;
}
if (group_info->lock.exchange(1)) // acquire lock
{
return CELL_EBUSY;
}
if (cause.GetAddr()) cause = SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT;
if (status.GetAddr()) status = 0; //unspecified because of ALL_THREADS_EXIT
for (u32 i = 0; i < group_info->list.size(); i++)
{
while (CPUThread* t = Emu.GetCPU().GetThread(group_info->list[i]))
{
if (!t->IsRunning())
{
break;
}
if (Emu.IsStopped())
{
LOG_WARNING(Log::SPU, "sys_spu_thread_group_join(id=%d, ...) aborted", id);
return CELL_OK;
}
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
group_info->lock = 0; // release lock
return CELL_OK;
}
示例5: sceNpTrophyUnlockTrophy
int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, mem32_t platinumId)
{
sceNpTrophy.Warning("sceNpTrophyUnlockTrophy(context=%d, handle=%d, trophyId=%d, platinumId_addr=0x%x)",
context, handle, trophyId, platinumId.GetAddr());
if (!s_npTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
if (!platinumId.IsGood())
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
// TODO: There are other possible errors
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
if (trophyId >= ctxt.tropusr->GetTrophiesCount())
return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID;
if (ctxt.tropusr->GetTrophyUnlockState(trophyId))
return SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED;
u64 timestamp1 = get_system_time(); // TODO: Either timestamp1 or timestamp2 is wrong
u64 timestamp2 = get_system_time(); // TODO: Either timestamp1 or timestamp2 is wrong
ctxt.tropusr->UnlockTrophy(trophyId, timestamp1, timestamp2);
std::string trophyPath = "/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPUSR.DAT";
ctxt.tropusr->Save(trophyPath);
platinumId = SCE_NP_TROPHY_INVALID_TROPHY_ID; // TODO
return CELL_OK;
}
示例6: sceNpTrophyGetTrophyUnlockState
int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, mem_ptr_t<SceNpTrophyFlagArray> flags, mem32_t count)
{
sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState(context=%d, handle=%d, flags_addr=0x%x, count_addr=0x%x)",
context, handle, flags.GetAddr(), count.GetAddr());
if (!s_npTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
if (!flags.IsGood() || !count.IsGood())
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
// TODO: There are other possible errors
sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context];
count = ctxt.tropusr->GetTrophiesCount();
if (count.GetValue() > 128)
ConLog.Warning("sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!");
// Pack up to 128 bools in u32 flag_bits[4]
for (u32 id=0; id<count.GetValue(); id++)
{
if (ctxt.tropusr->GetTrophyUnlockState(id))
flags->flag_bits[id/32] |= 1<<(id%32);
else
flags->flag_bits[id/32] &= ~(1<<(id%32));
}
return CELL_OK;
}
示例7: cellAudioPortOpen
int cellAudioPortOpen(mem_ptr_t<CellAudioPortParam> audioParam, mem32_t portNum)
{
cellAudio.Warning("cellAudioPortOpen(audioParam_addr=0x%x, portNum_addr=0x%x)", audioParam.GetAddr(), portNum.GetAddr());
if(!audioParam.IsGood() || !portNum.IsGood())
{
return CELL_AUDIO_ERROR_PARAM;
}
if (m_config.m_port_in_use >= m_config.m_ports.GetCount())
{
return CELL_AUDIO_ERROR_PORT_FULL;
}
for (u32 i = 0; i < m_config.m_ports.GetCount(); i++)
{
if (m_config.m_ports[i] == nullptr)
{
CellAudioPortParam& ref = (m_config.m_ports[i] = new AudioPortConfig)->m_param;
ref.nChannel = audioParam->nChannel;
ref.nBlock = audioParam->nBlock;
ref.attr = audioParam->attr;
ref.level = audioParam->level;
portNum = i;
cellAudio.Warning("*** audio port opened(nChannel=%lld, nBlock=0x%llx, attr=0x%llx, level=%f): port = %d",
(u64)ref.nChannel, (u64)ref.nBlock, (u64)ref.attr, (float)ref.level, portNum.GetValue());
//TODO: implementation of ring buffer
return CELL_OK;
}
}
return CELL_AUDIO_ERROR_PORT_FULL;
}
示例8: sys_mmapper_allocate_memory
s32 sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id)
{
sys_mmapper.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.GetAddr());
if(!mem_id.IsGood())
return CELL_EFAULT;
// Check page granularity.
u32 addr;
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
{
case SYS_MEMORY_PAGE_SIZE_1M:
if(size & 0xfffff)
return CELL_EALIGN;
addr = Memory.Alloc(size, 0x100000);
break;
case SYS_MEMORY_PAGE_SIZE_64K:
if(size & 0xffff)
return CELL_EALIGN;
addr = Memory.Alloc(size, 0x10000);
break;
default:
return CELL_EINVAL;
}
if(!addr)
return CELL_ENOMEM;
// Generate a new mem ID.
mem_id = sys_mmapper.GetNewId(new mmapper_info(addr, size, flags));
return CELL_OK;
}
示例9: sys_raw_spu_create_interrupt_tag
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag)
{
sc_spu.Error("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.GetAddr());
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
if (!t)
{
return CELL_ESRCH;
}
if (class_id != 0 && class_id != 2)
{
return CELL_EINVAL;
}
if (!intrtag.IsGood())
{
return CELL_EFAULT;
}
if (t->m_intrtag[class_id].enabled)
{
return CELL_EAGAIN;
}
t->m_intrtag[class_id].enabled = 1;
intrtag = (id & 0xff) | (class_id << 8);
return CELL_OK;
}
示例10: cellGameGetParamInt
int cellGameGetParamInt(u32 id, mem32_t value)
{
cellGame.Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.GetAddr());
if(!value.IsGood())
return CELL_GAME_ERROR_PARAM;
// TODO: Locate the PARAM.SFO. The following path is in most cases wrong.
vfsFile f("/app_home/PARAM.SFO");
PSFLoader psf(f);
if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE;
switch(id)
{
case CELL_GAME_PARAMID_PARENTAL_LEVEL: value = psf.m_info.parental_lvl; break;
case CELL_GAME_PARAMID_RESOLUTION: value = psf.m_info.resolution; break;
case CELL_GAME_PARAMID_SOUND_FORMAT: value = psf.m_info.sound_format; break;
default:
return CELL_GAME_ERROR_INVALID_ID;
}
return CELL_OK;
}
示例11: sys_rwlock_create
int sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr)
{
sys_rwlock.Warning("sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.GetAddr(), attr.GetAddr());
if (!rw_lock_id.IsGood() || !attr.IsGood()) return CELL_EFAULT;
switch (attr->attr_protocol.ToBE())
{
case se(attr->attr_protocol, SYS_SYNC_PRIORITY): sys_rwlock.Warning("TODO: SYS_SYNC_PRIORITY attr"); break;
case se(attr->attr_protocol, SYS_SYNC_RETRY): sys_rwlock.Error("Invalid SYS_SYNC_RETRY attr"); break;
case se(attr->attr_protocol, SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT attr"); break;
case se(attr->attr_protocol, SYS_SYNC_FIFO): break;
default: return CELL_EINVAL;
}
if (attr->attr_pshared.ToBE() != se32(0x200))
{
sys_rwlock.Error("Invalid attr_pshared(0x%x)", (u32)attr->attr_pshared);
return CELL_EINVAL;
}
rw_lock_id = sys_rwlock.GetNewId(new RWLock((u32)attr->attr_protocol, attr->name_u64));
sys_rwlock.Warning("*** rwlock created [%s] (protocol=0x%x): id = %d",
wxString(attr->name, 8).wx_str(), (u32)attr->attr_protocol, rw_lock_id.GetValue());
return CELL_OK;
}
示例12: cellGameGetParamInt
int cellGameGetParamInt(u32 id, mem32_t value)
{
cellGame.Warning("cellGameGetParamInt(id=%d, value_addr=0x%x)", id, value.GetAddr());
if(!value.IsGood())
return CELL_GAME_ERROR_PARAM;
// TODO: Locate the PARAM.SFO. The following path may be wrong.
vfsFile f("/app_home/PARAM.SFO");
PSFLoader psf(f);
if(!psf.Load(false))
return CELL_GAME_ERROR_FAILURE;
switch(id)
{
case CELL_GAME_PARAMID_PARENTAL_LEVEL: value = psf.GetInteger("PARENTAL_LEVEL"); break;
case CELL_GAME_PARAMID_RESOLUTION: value = psf.GetInteger("RESOLUTION"); break;
case CELL_GAME_PARAMID_SOUND_FORMAT: value = psf.GetInteger("SOUND_FORMAT"); break;
default:
return CELL_GAME_ERROR_INVALID_ID;
}
return CELL_OK;
}
示例13: sys_cond_create
int sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute> attr)
{
sys_cond.Log("sys_cond_create(cond_id_addr=0x%x, mutex_id=%d, attr_addr=0x%x)",
cond_id.GetAddr(), mutex_id, attr.GetAddr());
if (!cond_id.IsGood() || !attr.IsGood())
{
return CELL_EFAULT;
}
if (attr->pshared.ToBE() != se32(0x200))
{
sys_cond.Error("Invalid pshared attribute(0x%x)", (u32)attr->pshared);
return CELL_EINVAL;
}
Mutex* mutex;
if (!Emu.GetIdManager().GetIDData(mutex_id, mutex))
{
return CELL_ESRCH;
}
if (mutex->is_recursive)
{
sys_cond.Warning("*** condition on recursive mutex(%d)", mutex_id);
}
Cond* cond = new Cond(mutex, attr->name_u64);
u32 id = sys_cond.GetNewId(cond);
cond_id = id;
mutex->cond_count++;
sys_cond.Warning("*** condition created [%s] (mutex_id=%d): id = %d", wxString(attr->name, 8).wx_str(), mutex_id, cond_id.GetValue());
return CELL_OK;
}
示例14: cellFsAioRead
int cellFsAioRead(mem_ptr_t<CellFsAio> aio, mem32_t aio_id, mem_func_ptr_t<void (*)(mem_ptr_t<CellFsAio> xaio, int error, int xid, u64 size)> func)
{
sys_fs.Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.GetAddr(), aio_id.GetAddr(), func.GetAddr());
if (!aio.IsGood() || !aio_id.IsGood() || !func.IsGood())
{
return CELL_EFAULT;
}
if (!aio_init)
{
return CELL_ENXIO;
}
vfsFileBase* orig_file;
u32 fd = aio->fd;
if (!sys_fs.CheckId(fd, orig_file)) return CELL_EBADF;
//get a unique id for the callback (may be used by cellFsAioCancel)
const u32 xid = g_FsAioReadID++;
aio_id = xid;
{
thread t("fsAioRead", std::bind(fsAioRead, fd, aio, xid, func));
t.detach();
}
return CELL_OK;
}
示例15: sys_process_get_number_of_object
int sys_process_get_number_of_object(u32 object, mem32_t nump)
{
sc_p.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
object, nump.GetAddr());
if (!nump.IsGood())
return CELL_EFAULT;
switch(object)
{
case SYS_MEM_OBJECT: nump = procObjects.mem_objects.size(); break;
case SYS_MUTEX_OBJECT: nump = procObjects.mutex_objects.size(); break;
case SYS_COND_OBJECT: nump = procObjects.cond_objects.size(); break;
case SYS_RWLOCK_OBJECT: nump = procObjects.rwlock_objects.size(); break;
case SYS_INTR_TAG_OBJECT: nump = procObjects.intr_tag_objects.size(); break;
case SYS_INTR_SERVICE_HANDLE_OBJECT: nump = procObjects.intr_service_handle_objects.size(); break;
case SYS_EVENT_QUEUE_OBJECT: nump = procObjects.event_queue_objects.size(); break;
case SYS_EVENT_PORT_OBJECT: nump = procObjects.event_port_objects.size(); break;
case SYS_TRACE_OBJECT: nump = procObjects.trace_objects.size(); break;
case SYS_SPUIMAGE_OBJECT: nump = procObjects.spuimage_objects.size(); break;
case SYS_PRX_OBJECT: nump = procObjects.prx_objects.size(); break;
case SYS_SPUPORT_OBJECT: nump = procObjects.spuport_objects.size(); break;
case SYS_LWMUTEX_OBJECT: nump = procObjects.lwmutex_objects.size(); break;
case SYS_TIMER_OBJECT: nump = procObjects.timer_objects.size(); break;
case SYS_SEMAPHORE_OBJECT: nump = procObjects.semaphore_objects.size(); break;
case SYS_FS_FD_OBJECT: nump = procObjects.fs_fd_objects.size(); break;
case SYS_LWCOND_OBJECT: nump = procObjects.lwcond_objects.size(); break;
default:
return CELL_EINVAL;
}
return CELL_OK;
}