Merge pull request #283 from raven02/patch-26

Implement cellPngDecCreate/Destroy()
This commit is contained in:
B1ackDaemon 2014-05-30 21:17:33 +03:00
commit f09a358ea5
2 changed files with 39 additions and 3 deletions

View file

@ -3,19 +3,48 @@
#include "Emu/SysCalls/SC_FUNC.h"
#include "cellPngDec.h"
#include "stblib/stb_image.h"
#include <map>
void cellPngDec_init();
Module cellPngDec(0x0018, cellPngDec_init);
static std::map<u32, CellPngDecMainHandle *> cellPngDecMap;
CellPngDecMainHandle *getCellPngDecCtx(u32 mainHandle) {
if (cellPngDecMap.find(mainHandle) == cellPngDecMap.end())
return NULL;
return cellPngDecMap[mainHandle];
}
int cellPngDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam)
{
UNIMPLEMENTED_FUNC(cellPngDec);
cellPngDec.Error("cellPngDecCreate(mainHandle=0x%x, threadInParam=0x%x, threadOutParam=0x%x)", mainHandle, threadInParam, threadOutParam);
CellPngDecMainHandle *ctx = new CellPngDecMainHandle;
if (cellPngDecMap.find(mainHandle) != cellPngDecMap.end()) {
delete cellPngDecMap[mainHandle];
cellPngDecMap.erase(mainHandle);
}
cellPngDecMap[mainHandle] = ctx;
ctx->threadInParam = threadInParam;
ctx->threadOutParam = threadOutParam;
return CELL_OK;
}
int cellPngDecDestroy(u32 mainHandle)
{
UNIMPLEMENTED_FUNC(cellPngDec);
cellPngDec.Error("cellPngDecDestroy(mainHandle=0x%x)", mainHandle);
CellPngDecMainHandle *ctx = getCellPngDecCtx(mainHandle);
if (!ctx) {
cellPngDec.Warning("cellPngDecCreate(mainHandle=0x%x): bad handle", mainHandle);
return -1;
}
delete ctx;
cellPngDecMap.erase(mainHandle);
return CELL_OK;
}

View file

@ -116,4 +116,11 @@ struct CellPngDecSubHandle
CellPngDecInfo info;
CellPngDecOutParam outParam;
CellPngDecSrc src;
};
};
struct CellPngDecMainHandle
{
u32 mainHandle;
u32 threadInParam;
u32 threadOutParam;
};