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()); }
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; }
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; }
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; }
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); }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
int sys_lwcond_destroy(mem_ptr_t<sys_lwcond_t> lwcond) { sys_lwcond.Warning("sys_lwcond_destroy(lwcond_addr=0x%x)", lwcond.GetAddr()); if (!lwcond.IsGood()) return CELL_EFAULT; LWCond* lwc; u32 id = (u32)lwcond->lwcond_queue; if (!sys_lwcond.CheckId(id, lwc)) return CELL_ESRCH; Emu.GetIdManager().RemoveID(id); return CELL_OK; }
int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, mem_ptr_t<SceNpTrophyDetails> details, mem_ptr_t<SceNpTrophyData> data) { sceNpTrophy.Warning("sceNpTrophyGetTrophyInfo(context=%u, handle=%u, trophyId=%d, details_addr=0x%x, data_addr=0x%x)", context, handle, trophyId, details.GetAddr(), data.GetAddr()); if (!s_npTrophyInstance.m_bInitialized) return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; if (!details.IsGood() || !data.IsGood()) return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; // TODO: There are other possible errors // sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; // TODO: This data is faked, implement a XML reader and get it from TROP.SFM memcpy(details->name, "Some Trophy", SCE_NP_TROPHY_NAME_MAX_SIZE); memcpy(details->description, "Hey! Implement a XML reader, and load the description from TROP.SFM", SCE_NP_TROPHY_DESCR_MAX_SIZE); details->hidden = false; details->trophyId = trophyId; details->trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; return CELL_OK; }
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.Error("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.IsGood()) return CELL_SPURS_TASK_ERROR_NULL_POINTER; return CELL_OK; }
int cellPamfReaderGetEpIteratorWithIndex(mem_ptr_t<CellPamfReader> pSelf, u32 epIndex, mem_ptr_t<CellPamfEpIterator> pIt) { cellPamf.Error("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x (stream=%d), epIndex=%d, pIt_addr=0x%x)", pSelf.GetAddr(), pSelf->stream, epIndex, pIt.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) return CELL_PAMF_ERROR_INVALID_ARG; const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr); //TODO: return CELL_OK; }
int cellPamfReaderGetStreamTypeAndChannel(mem_ptr_t<CellPamfReader> pSelf, mem8_t pType, mem8_t pCh) { cellPamf.Warning("cellPamfReaderGetStreamTypeAndChannel(pSelf=0x%x (stream=%d), pType_addr=0x%x, pCh_addr=0x%x", pSelf.GetAddr(), pSelf->stream, pType.GetAddr(), pCh.GetAddr()); if (!pSelf.IsGood() || !pCh.IsGood()) return CELL_PAMF_ERROR_INVALID_ARG; pType = pamfGetStreamType(pSelf, pSelf->stream); pCh = pamfGetStreamChannel(pSelf, pSelf->stream); return CELL_OK; }
int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellPngDecInParam> inParam, mem_ptr_t<CellPngDecOutParam> outParam) { if (!inParam.IsGood() || !outParam.IsGood()) return CELL_PNGDEC_ERROR_ARG; CellPngDecSubHandle* subHandle_data; if(!cellPngDec.CheckId(subHandle, subHandle_data)) return CELL_PNGDEC_ERROR_FATAL; CellPngDecInfo& current_info = subHandle_data->info; CellPngDecOutParam& current_outParam = subHandle_data->outParam; current_outParam.outputWidthByte = (current_info.imageWidth * current_info.numComponents * current_info.bitDepth) / 8; current_outParam.outputWidth = current_info.imageWidth; current_outParam.outputHeight = current_info.imageHeight; current_outParam.outputColorSpace = inParam->outputColorSpace; switch ((u32)current_outParam.outputColorSpace) { case CELL_PNGDEC_PALETTE: case CELL_PNGDEC_GRAYSCALE: current_outParam.outputComponents = 1; break; case CELL_PNGDEC_GRAYSCALE_ALPHA: current_outParam.outputComponents = 2; break; case CELL_PNGDEC_RGB: current_outParam.outputComponents = 3; break; case CELL_PNGDEC_RGBA: case CELL_PNGDEC_ARGB: current_outParam.outputComponents = 4; break; default: return CELL_PNGDEC_ERROR_ARG; // Not supported color space } current_outParam.outputBitDepth = inParam->outputBitDepth; current_outParam.outputMode = inParam->outputMode; current_outParam.useMemorySpace = 0; // Unimplemented *outParam = current_outParam; return CELL_OK; }
int sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond) { sys_lwcond.Log("sys_lwcond_signal_all(lwcond_addr=0x%x)", lwcond.GetAddr()); if (!lwcond.IsGood()) return CELL_EFAULT; LWCond* lwc; u32 id = (u32)lwcond->lwcond_queue; if (!sys_lwcond.CheckId(id, lwc)) return CELL_ESRCH; lwc->signal_all(); return CELL_OK; }
int sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_attribute_t> attr) { sc_lwmutex.Log("sys_lwmutex_create(lwmutex_addr=0x%x, lwmutex_attr_addr=0x%x)", lwmutex.GetAddr(), attr.GetAddr()); if (!lwmutex.IsGood() || !attr.IsGood()) return CELL_EFAULT; switch (attr->attr_recursive.ToBE()) { case se32(SYS_SYNC_RECURSIVE): break; case se32(SYS_SYNC_NOT_RECURSIVE): break; default: sc_lwmutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->attr_recursive); return CELL_EINVAL; } switch (attr->attr_protocol.ToBE()) { case se32(SYS_SYNC_PRIORITY): break; case se32(SYS_SYNC_RETRY): break; case se32(SYS_SYNC_PRIORITY_INHERIT): sc_lwmutex.Error("Invalid SYS_SYNC_PRIORITY_INHERIT protocol attr"); return CELL_EINVAL; case se32(SYS_SYNC_FIFO): break; default: sc_lwmutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->attr_protocol); return CELL_EINVAL; } lwmutex->attribute = attr->attr_protocol | attr->attr_recursive; lwmutex->waiter = 0; lwmutex->mutex.initialize(); //lwmutex->waiter = lwmutex->owner.GetOwner(); lwmutex->pad = 0; lwmutex->recursive_count = 0; u32 sq_id = sc_lwmutex.GetNewId(new SleepQueue(attr->name_u64)); lwmutex->sleep_queue = sq_id; procObjects.lwmutex_objects.insert(sq_id); sc_lwmutex.Warning("*** lwmutex created [%s] (attribute=0x%x): sq_id = %d", std::string(attr->name, 8).c_str(), (u32) lwmutex->attribute, sq_id); return CELL_OK; }
int sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id) { sys_lwcond.Log("sys_lwcond_signal_to(lwcond_addr=0x%x, ppu_thread_id=%d)", lwcond.GetAddr(), ppu_thread_id); if (!lwcond.IsGood()) return CELL_EFAULT; LWCond* lwc; u32 id = (u32)lwcond->lwcond_queue; if (!sys_lwcond.CheckId(id, lwc)) return CELL_ESRCH; if (!lwc->signal_to(ppu_thread_id)) return CELL_EPERM; return CELL_OK; }
int _cellSpursAttributeInitialize(mem_ptr_t<CellSpursAttribute> attr, int nSpus, int spuPriority, int ppuPriority, bool exitIfNoWork) { cellSpurs.Warning("_cellSpursAttributeInitialize(attr_addr=0x%x, nSpus=%u, spuPriority=%u, ppuPriority=%u, exitIfNoWork=%u)", attr.GetAddr(), nSpus, spuPriority, ppuPriority, exitIfNoWork); if(!attr.IsGood()) return CELL_SPURS_CORE_ERROR_NULL_POINTER; attr->attr = new SPURSManagerAttribute(nSpus, spuPriority, ppuPriority, exitIfNoWork); return CELL_OK; }
int cellFontBindRenderer(mem_ptr_t<CellFont> font, mem_ptr_t<CellFontRenderer> renderer) { cellFont.Warning("cellFontBindRenderer(font_addr=0x%x, renderer_addr=0x%x)", font.GetAddr(), renderer.GetAddr()); if (!font.IsGood() || !renderer.GetAddr()) return CELL_FONT_ERROR_INVALID_PARAMETER; if (font->renderer_addr) return CELL_FONT_ERROR_RENDERER_ALREADY_BIND; font->renderer_addr = renderer.GetAddr(); return CELL_FONT_OK; }
int cellGifDecOpen(u32 mainHandle, mem32_t subHandle, const mem_ptr_t<CellGifDecSrc> src, mem_ptr_t<CellGifDecOpnInfo> openInfo) { if (!subHandle.IsGood() || !src.IsGood()) return CELL_GIFDEC_ERROR_ARG; /* vfsStream* stream; switch(src->srcSelect) { case CELL_GIFDEC_FILE: stream = Emu.GetVFS().Open(src->fileName.GetString(), vfsRead); stream->Seek(src->fileOffset); src->fileSize; break; case CELL_GIFDEC_BUFFER: if(src->streamSize < 5) return CELL_GIFDEC_ERROR_ARG; stream = new vfsStreamMemory(src->streamPtr.GetAddr(), src->streamSize); break; default: return CELL_GIFDEC_ERROR_ARG; } if(!stream->IsOpened()) { return CELL_GIFDEC_ERROR_OPEN_FILE; } */ CellGifDecSubHandle *current_subHandle = new CellGifDecSubHandle; // Get file descriptor MemoryAllocator<be_t<u32>> fd; int ret = cellFsOpen(src->fileName, 0, fd, 0, 0); current_subHandle->fd = fd->ToLE(); if(ret != CELL_OK) return CELL_GIFDEC_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 // From now, every u32 subHandle argument is a pointer to a CellPngDecSubHandle struct. subHandle = cellGifDec->GetNewId(current_subHandle); return CELL_OK; }
int cellPamfReaderSetStreamWithTypeAndIndex(mem_ptr_t<CellPamfReader> pSelf, u8 streamType, u8 streamIndex) { cellPamf.Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", pSelf.GetAddr(), streamType, streamIndex); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) return CELL_PAMF_ERROR_INVALID_ARG; const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr); u32 found = 0; for (u8 i = 0; i < pAddr->stream_count; i++) { const u8 type = pamfGetStreamType(pSelf, i); if (type == streamType) { found++; } else switch(streamType) { case CELL_PAMF_STREAM_TYPE_VIDEO: if (type == CELL_PAMF_STREAM_TYPE_AVC || type == CELL_PAMF_STREAM_TYPE_M2V) { found++; } break; case CELL_PAMF_STREAM_TYPE_AUDIO: if (type == CELL_PAMF_STREAM_TYPE_ATRAC3PLUS || type == CELL_PAMF_STREAM_TYPE_AC3 || type == CELL_PAMF_STREAM_TYPE_PAMF_LPCM) { found++; } break; default: if (streamType > 5) { return CELL_PAMF_ERROR_INVALID_ARG; } } if (found > streamIndex) { pSelf->stream = i; return i; } } return CELL_PAMF_ERROR_STREAM_NOT_FOUND; }
int cellPamfReaderGetPresentationEndTime(mem_ptr_t<CellPamfReader> pSelf, mem_ptr_t<CellCodecTimeStamp> pTimeStamp) { cellPamf.Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.GetAddr(), pTimeStamp.GetAddr()); if (!pSelf.IsGood() || !Memory.IsGoodAddr(pSelf->pAddr)) return CELL_PAMF_ERROR_INVALID_ARG; const mem_ptr_t<PamfHeader> pAddr(pSelf->pAddr); const u32 upper = (u16)pAddr->end_pts_high; pTimeStamp->upper = upper; pTimeStamp->lower = pAddr->end_pts_low; return CELL_OK; }
int cellSpursInitialize(mem_ptr_t<CellSpurs> spurs, int nSpus, int spuPriority, int ppuPriority, bool exitIfNoWork) { cellSpurs.Warning("cellSpursInitialize(spurs_addr=0x%x, nSpus=%u, spuPriority=%u, ppuPriority=%u, exitIfNoWork=%u)", spurs.GetAddr(), nSpus, spuPriority, ppuPriority, exitIfNoWork); if(!spurs.IsGood()) return CELL_SPURS_CORE_ERROR_NULL_POINTER; SPURSManagerAttribute *attr = new SPURSManagerAttribute(nSpus, spuPriority, ppuPriority, exitIfNoWork); spurs->spurs = new SPURSManager(attr); return CELL_OK; }