本文整理汇总了C++中mem_ptr_t::IsGood方法的典型用法代码示例。如果您正苦于以下问题:C++ mem_ptr_t::IsGood方法的具体用法?C++ mem_ptr_t::IsGood怎么用?C++ mem_ptr_t::IsGood使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mem_ptr_t
的用法示例。
在下文中一共展示了mem_ptr_t::IsGood方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sys_lwmutex_unlock
int sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
{
sc_lwmutex.Log("sys_lwmutex_unlock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
if (!lwmutex.IsGood()) return CELL_EFAULT;
//ConLog.Write("*** unlocking mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, (u32)lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
return lwmutex->unlock(GetCurrentPPUThread().GetId());
}
示例2: cellSpursSetGlobalExceptionEventHandler
int cellSpursSetGlobalExceptionEventHandler(mem_ptr_t<CellSpurs> spurs,
mem_func_ptr_t<CellSpursGlobalExceptionEventHandler> eaHandler, mem_ptr_t<void> arg)
{
cellSpurs.Error("cellSpursEnableExceptionEventHandler(spurs_addr=0x%x, eaHandler_addr=0x%x, arg_addr=0x%x,)",
spurs.GetAddr(), eaHandler.GetAddr(), arg.GetAddr());
if(!spurs.IsGood() || eaHandler.IsGood())
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
return CELL_OK;
}
示例3: _cellSpursEventFlagInitialize
int _cellSpursEventFlagInitialize(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpursTaskset> taskset, mem_ptr_t<CellSpursEventFlag> eventFlag, u32 flagClearMode, u32 flagDirection)
{
cellSpurs->Warning("_cellSpursEventFlagInitialize(spurs_addr=0x%x, taskset_addr=0x%x, eventFlag_addr=0x%x, flagClearMode=%u, flagDirection=%u)", spurs.GetAddr(), taskset.GetAddr(), eventFlag.GetAddr(), flagClearMode, flagDirection);
if ((taskset.GetAddr() % 128 != 0) || (eventFlag.GetAddr() % 128 != 0))
{
cellSpurs->Error("_cellSpursEventFlagInitialize : CELL_SPURS_TASK_ERROR_ALIGN");
return CELL_SPURS_TASK_ERROR_ALIGN;
}
if ((!spurs.IsGood() && !taskset.IsGood()) || !eventFlag.IsGood())
{
cellSpurs->Error("_cellSpursEventFlagInitialize : CELL_SPURS_TASK_ERROR_NULL_POINTER");
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
}
eventFlag->eventFlag = new SPURSManagerEventFlag(flagClearMode, flagDirection);
return CELL_OK;
}
示例4: cellSpursInitializeWithAttribute2
int cellSpursInitializeWithAttribute2(mem_ptr_t<CellSpurs2> spurs, const mem_ptr_t<CellSpursAttribute> attr)
{
cellSpurs->Warning("cellSpursInitializeWithAttribute2(spurs_addr=0x%x, spurs_addr=0x%x)", spurs.GetAddr(), attr.GetAddr());
if ((spurs.GetAddr() % 128 != 0) || (attr.GetAddr() % 8 != 0))
{
cellSpurs->Error("cellSpursInitializeWithAttribute2 : CELL_SPURS_CORE_ERROR_ALIGN");
return CELL_SPURS_CORE_ERROR_ALIGN;
}
if (!spurs.IsGood() || !attr.IsGood())
{
cellSpurs->Error("cellSpursInitializeWithAttribute2 : CELL_SPURS_CORE_ERROR_NULL_POINTER");
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
}
spurs->spurs = new SPURSManager(attr->attr);
return CELL_OK;
}
示例5: sys_lwmutex_lock
int sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
{
sc_lwmutex.Log("sys_lwmutex_lock(lwmutex_addr=0x%x, timeout=%lld)", lwmutex.GetAddr(), timeout);
if (!lwmutex.IsGood()) return CELL_EFAULT;
//ConLog.Write("*** lock mutex (addr=0x%x, attr=0x%x, Nrec=%d, owner=%d, waiter=%d)",
//lwmutex.GetAddr(), (u32)lwmutex->attribute, (u32)lwmutex->recursive_count, lwmutex->vars.parts.owner.GetOwner(), (u32)lwmutex->waiter);
return lwmutex->lock(GetCurrentPPUThread().GetId(), timeout ? ((timeout < 1000) ? 1 : (timeout / 1000)) : 0);
}
示例6: cellPamfReaderGetNumberOfEp
int cellPamfReaderGetNumberOfEp(mem_ptr_t<CellPamfReader> pSelf)
{
cellPamf.Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x (stream=%d))",
pSelf.GetAddr(), pSelf->stream);
if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr))
return CELL_PAMF_ERROR_INVALID_ARG;
const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr);
return pAddr->stream_headers[pSelf->stream].ep_num;
}
示例7: cellFontGetFontIdCode
int cellFontGetFontIdCode(mem_ptr_t<CellFont> font, u32 code, mem32_t fontId, mem32_t fontCode)
{
cellFont->Log("cellFontGetFontIdCode(font_addr=0x%x, code=0x%x, fontId_addr=0x%x, fontCode_addr=0x%x",
font.GetAddr(), code, fontId.GetAddr(), fontCode.GetAddr());
if (!font.IsGood() || !fontId.IsGood()) //fontCode isn't used
return CELL_FONT_ERROR_INVALID_PARAMETER;
// TODO: ?
return CELL_FONT_OK;
}
示例8: cellFontSetEffectSlant
int cellFontSetEffectSlant(mem_ptr_t<CellFont> font, float slantParam)
{
slantParam = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments
cellFont->Log("cellFontSetEffectSlant(font_addr=0x%x, slantParam=%f)", font.GetAddr(), slantParam);
if (!font.IsGood() || slantParam < -1.0 || slantParam > 1.0)
return CELL_FONT_ERROR_INVALID_PARAMETER;
font->slant = slantParam;
return CELL_FONT_OK;
}
示例9: cellFontOpenFontMemory
int cellFontOpenFontMemory(mem_ptr_t<CellFontLibrary> library, u32 fontAddr, u32 fontSize, u32 subNum, u32 uniqueId, mem_ptr_t<CellFont> font)
{
cellFont->Warning("cellFontOpenFontMemory(library_addr=0x%x, fontAddr=0x%x, fontSize=%d, subNum=%d, uniqueId=%d, font_addr=0x%x)",
library.GetAddr(), fontAddr, fontSize, subNum, uniqueId, font.GetAddr());
if (!s_fontInternalInstance->m_bInitialized)
return CELL_FONT_ERROR_UNINITIALIZED;
if (!library.IsGood() || !font.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER;
if (!Memory.IsGoodAddr(fontAddr))
return CELL_FONT_ERROR_FONT_OPEN_FAILED;
if (!stbtt_InitFont(&(font->stbfont), (unsigned char*)Memory.VirtualToRealAddr(fontAddr), 0))
return CELL_FONT_ERROR_FONT_OPEN_FAILED;
font->renderer_addr = 0;
font->fontdata_addr = fontAddr;
font->origin = CELL_FONT_OPEN_MEMORY;
return CELL_FONT_OK;
}
示例10: cellSpursFinalize
int cellSpursFinalize(mem_ptr_t<CellSpurs> spurs)
{
cellSpurs.Warning("cellSpursFinalize(spurs_addr=0x%x)", spurs.GetAddr());
if(!spurs.IsGood())
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
spurs->spurs->Finalize();
return CELL_OK;
}
示例11: cellSpursAttributeSetSpuThreadGroupType
int cellSpursAttributeSetSpuThreadGroupType(mem_ptr_t<CellSpursAttribute> attr, int type)
{
cellSpurs.Warning("cellSpursAttributeSetSpuThreadGroupType(attr_addr=0x%x, type=%u)", attr.GetAddr(), type);
if(!attr.IsGood())
return CELL_SPURS_CORE_ERROR_NULL_POINTER;
attr->attr->_setSpuThreadGroupType(type);
return CELL_OK;
}
示例12: cellFontRenderCharGlyphImage
int cellFontRenderCharGlyphImage(mem_ptr_t<CellFont> font, u32 code, mem_ptr_t<CellFontRenderSurface> surface, float x, float y, mem_ptr_t<CellFontGlyphMetrics> metrics, mem_ptr_t<CellFontImageTransInfo> transInfo)
{
x = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments
y = GetCurrentPPUThread().FPR[2]; // TODO: Something is wrong with the float arguments
cellFont->Log("cellFontRenderCharGlyphImage(font_addr=0x%x, code=0x%x, surface_addr=0x%x, x=%f, y=%f, metrics_addr=0x%x, trans_addr=0x%x)",
font.GetAddr(), code, surface.GetAddr(), x, y, metrics.GetAddr(), transInfo.GetAddr());
if (!font.IsGood() || !surface.IsGood() || !metrics.IsGood() || !transInfo.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER;
if (!font->renderer_addr)
return CELL_FONT_ERROR_RENDERER_UNBIND;
// Render the character
int width, height, xoff, yoff;
float scale = stbtt_ScaleForPixelHeight(&(font->stbfont), font->scale_y);
unsigned char* box = stbtt_GetCodepointBitmap(&(font->stbfont), scale, scale, code, &width, &height, &xoff, &yoff);
if (!box) return CELL_OK;
// Get the baseLineY value
int baseLineY;
int ascent, descent, lineGap;
stbtt_GetFontVMetrics(&(font->stbfont), &ascent, &descent, &lineGap);
baseLineY = ascent * scale;
// Move the rendered character to the surface
unsigned char* buffer = (unsigned char*)Memory.VirtualToRealAddr(surface->buffer_addr);
for (u32 ypos = 0; ypos < (u32)height; ypos++){
if ((u32)y + ypos + yoff + baseLineY >= surface->height)
break;
for (u32 xpos = 0; xpos < (u32)width; xpos++){
if ((u32)x + xpos >= surface->width)
break;
// TODO: There are some oddities in the position of the character in the final buffer
buffer[((int)y + ypos + yoff + baseLineY)*surface->width + (int)x+xpos] = box[ypos*width + xpos];
}
}
stbtt_FreeBitmap(box, 0);
return CELL_FONT_OK;
}
示例13: cellFontUnbindRenderer
int cellFontUnbindRenderer(mem_ptr_t<CellFont> font)
{
cellFont.Warning("cellFontBindRenderer(font_addr=0x%x)", font.GetAddr());
if (!font.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER;
if (!font->renderer_addr)
return CELL_FONT_ERROR_RENDERER_UNBIND;
font->renderer_addr = NULL;
return CELL_FONT_OK;
}
示例14: cellFontSetScalePixel
int cellFontSetScalePixel(mem_ptr_t<CellFont> font, float w, float h)
{
h = GetCurrentPPUThread().FPR[1]; // TODO: Something is wrong with the float arguments
cellFont.Warning("cellFontSetScalePixel(font_addr=0x%x, w=%f, h=%f)", font.GetAddr(), w, h);
if (!font.IsGood())
return CELL_FONT_ERROR_INVALID_PARAMETER;
font->scale_x = w;
font->scale_y = h;
return CELL_FONT_OK;
}
示例15: cellSpursCreateTaskset
int cellSpursCreateTaskset(mem_ptr_t<CellSpurs> spurs, mem_ptr_t<CellSpursTaskset> taskset, u64 args, mem8_t priority, u32 maxContention)
{
cellSpurs->Todo("cellSpursCreateTaskset(spurs_addr=0x%x, taskset_addr=0x%x, args=0x%x, priority_addr=0x%x, maxContention=%u)", spurs.GetAddr(), taskset.GetAddr(), args, priority.GetAddr(), maxContention);
if ((spurs.GetAddr() % 128 != 0) || (taskset.GetAddr() % 128 != 0))
{
cellSpurs->Error("cellSpursCreateTaskset : CELL_SPURS_TASK_ERROR_ALIGN");
return CELL_SPURS_TASK_ERROR_ALIGN;
}
if (!spurs.IsGood() || !taskset.IsGood())
{
cellSpurs->Error("cellSpursCreateTaskset : CELL_SPURS_TASK_ERROR_NULL_POINTER");
return CELL_SPURS_TASK_ERROR_NULL_POINTER;
}
SPURSManagerTasksetAttribute *tattr = new SPURSManagerTasksetAttribute(args, priority, maxContention);
taskset->taskset = new SPURSManagerTaskset(taskset.GetAddr(), tattr);
return CELL_OK;
}