int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, u32 src_addr, mem_struct_ptr_t<CellJpgDecOpnInfo> openInfo) { //u32 srcSelect = Memory.Read32(src_addr); u32 fileName = Memory.Read32(src_addr+4); //u32 fileOffset = Memory.Read32(src_addr+8); //u32 fileSize = Memory.Read32(src_addr+12); //u32 streamPtr = Memory.Read32(src_addr+16); //u32 streamSize = Memory.Read32(src_addr+20); //u32 spuThreadEnable = Memory.Read32(src_addr+24); CellJpgDecSubHandle *current_subHandle = new CellJpgDecSubHandle; // Get file descriptor MemoryAllocator<be_t<u32>> fd; int ret = cellFsOpen(fileName, 0, fd, NULL, 0); current_subHandle->fd = fd->ToLE(); if(ret != CELL_OK) return CELL_JPGDEC_ERROR_OPEN_FILE; // Get size of file MemoryAllocator<CellFsStat> sb; // Alloc a CellFsStat struct ret = cellFsFstat(current_subHandle->fd, sb); 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 = cellJpgDec.GetNewId(current_subHandle); return CELL_OK; }
int cellJpgDecOpen(u32 mainHandle, mem32_t subHandle, mem_ptr_t<CellJpgDecSrc> src, mem_ptr_t<CellJpgDecOpnInfo> openInfo) { cellJpgDec.Warning("cellJpgDecOpen(mainHandle=0x%x, subHandle=0x%x, src_addr=0x%x, openInfo=0x%x)", mainHandle, subHandle.GetAddr(), src.GetAddr(), openInfo); if (!subHandle.IsGood() || !src.IsGood() || !openInfo.IsGood()) return CELL_JPGDEC_ERROR_ARG; CellJpgDecSubHandle *current_subHandle = new CellJpgDecSubHandle; // Get file descriptor MemoryAllocator<be_t<u32>> fd; int ret = cellFsOpen(src->fileName, 0, fd, NULL, 0); current_subHandle->fd = fd->ToLE(); if(ret != CELL_OK) return CELL_JPGDEC_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 = cellJpgDec.GetNewId(current_subHandle); return CELL_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 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; }