(PS3) Redefine macros used for two SDKs

This commit is contained in:
Twinaphex 2012-07-16 23:30:13 +02:00
parent 7ba26db5e7
commit a3b0f3164d
2 changed files with 80 additions and 121 deletions

View File

@ -82,18 +82,18 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im
#ifndef __PSL1GHT__
CtrlMallocArg MallocArg;
CtrlFreeArg FreeArg;
pJpgDecDataCtrlParam dCtrlParam;
CellJpgDecDataCtrlParam dCtrlParam;
#endif
pJpgDecMainHandle mHandle = PTR_NULL;
pJpgDecSubHandle sHandle = PTR_NULL;
pJpgDecThreadInParam InParam;
pJpgDecThreadOutParam OutParam;
pJpgDecSrc src;
pJpgDecOpnInfo opnInfo;
pJpgDecInfo info;
pJpgDecInParam inParam;
pJpgDecOutParam outParam;
pJpgDecDataOutInfo dOutInfo;
CellJpgDecMainHandle mHandle = PTR_NULL;
CellJpgDecSubHandle sHandle = PTR_NULL;
CellJpgDecThreadInParam InParam;
CellJpgDecThreadOutParam OutParam;
CellJpgDecSrc src;
CellJpgDecOpnInfo opnInfo;
CellJpgDecInfo info;
CellJpgDecInParam inParam;
CellJpgDecOutParam outParam;
CellJpgDecDataOutInfo dOutInfo;
InParam.spu_enable = CELL_JPGDEC_SPU_THREAD_ENABLE;
InParam.ppu_prio = 1001;
@ -113,12 +113,12 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im
#endif
int ret_jpeg, ret = -1;
ret_jpeg = pJpgDecCreate(&mHandle, &InParam, &OutParam);
ret_jpeg = cellJpgDecCreate(&mHandle, &InParam, &OutParam);
if (ret_jpeg != CELL_OK)
goto error;
memset(&src, 0, sizeof(pJpgDecSrc));
memset(&src, 0, sizeof(CellJpgDecSrc));
src.stream_select = CELL_JPGDEC_FILE;
#ifdef __PSL1GHT__
src.file_name = __get_addr32(path);
@ -132,12 +132,12 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im
src.spu_enable = CELL_JPGDEC_SPU_THREAD_ENABLE;
ret = pJpgDecOpen(mHandle, &sHandle, &src, &opnInfo);
ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo);
if (ret != CELL_OK)
goto error;
ret = pJpgDecReadHeader(mHandle, sHandle, &info);
ret = cellJpgDecReadHeader(mHandle, sHandle, &info);
if (ret != CELL_OK)
goto error;
@ -148,17 +148,17 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im
inParam.color_space = CELL_JPG_ARGB;
inParam.down_scale = 1;
inParam.color_alpha = 0xfe;
ret = pJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam);
ret = cellJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam);
if (ret != CELL_OK)
goto error;
#ifdef __PSL1GHT__
uint64_t output_bytes_per_line = outParam.output_width * 4;
ret = pJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &output_bytes_per_line, &dOutInfo);
ret = cellJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &output_bytes_per_line, &dOutInfo);
#else
dCtrlParam.output_bytes_per_line = outParam.output_width * 4;
ret = pJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
ret = cellJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
#endif
if (ret != CELL_OK || dOutInfo.status != CELL_JPGDEC_DEC_STATUS_FINISH)
@ -167,17 +167,17 @@ static bool ps3graphics_load_jpeg(const char *path, struct texture_image *out_im
out_img->width = outParam.output_width;
out_img->height = outParam.output_height;
pJpgDecClose(mHandle, sHandle);
pJpgDecDestroy(mHandle);
cellJpgDecClose(mHandle, sHandle);
cellJpgDecDestroy(mHandle);
return true;
error:
RARCH_ERR("ps3graphics_load_jpeg(): error.\n");
if (mHandle && sHandle)
pJpgDecClose(mHandle, sHandle);
cellJpgDecClose(mHandle, sHandle);
if (mHandle)
pJpgDecDestroy(mHandle);
cellJpgDecDestroy(mHandle);
return false;
}
@ -190,18 +190,18 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img
#ifndef __PSL1GHT__
CtrlMallocArg MallocArg;
CtrlFreeArg FreeArg;
pPngDecDataCtrlParam dCtrlParam;
CellPngDecDataCtrlParam dCtrlParam;
#endif
pPngDecMainHandle mHandle = PTR_NULL;
pPngDecSubHandle sHandle = PTR_NULL;
pPngDecThreadInParam InParam;
pPngDecThreadOutParam OutParam;
pPngDecSrc src;
pPngDecOpnInfo opnInfo;
pPngDecInfo info;
pPngDecInParam inParam;
pPngDecOutParam outParam;
pPngDecDataOutInfo dOutInfo;
CellPngDecMainHandle mHandle = PTR_NULL;
CellPngDecSubHandle sHandle = PTR_NULL;
CellPngDecThreadInParam InParam;
CellPngDecThreadOutParam OutParam;
CellPngDecSrc src;
CellPngDecOpnInfo opnInfo;
CellPngDecInfo info;
CellPngDecInParam inParam;
CellPngDecOutParam outParam;
CellPngDecDataOutInfo dOutInfo;
InParam.spu_enable = CELL_PNGDEC_SPU_THREAD_ENABLE;
InParam.ppu_prio = 512;
@ -221,12 +221,12 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img
#endif
int ret_png, ret = -1;
ret_png = pPngDecCreate(&mHandle, &InParam, &OutParam);
ret_png = cellPngDecCreate(&mHandle, &InParam, &OutParam);
if (ret_png != CELL_OK)
goto error;
memset(&src, 0, sizeof(pPngDecSrc));
memset(&src, 0, sizeof(CellPngDecSrc));
src.stream_select = CELL_PNGDEC_FILE;
#ifdef __PSL1GHT__
src.file_name = __get_addr32(path);
@ -240,12 +240,12 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img
src.spu_enable = CELL_PNGDEC_SPU_THREAD_ENABLE;
ret = pPngDecOpen(mHandle, &sHandle, &src, &opnInfo);
ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo);
if (ret != CELL_OK)
goto error;
ret = pPngDecReadHeader(mHandle, sHandle, &info);
ret = cellPngDecReadHeader(mHandle, sHandle, &info);
if (ret != CELL_OK)
goto error;
@ -256,17 +256,17 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img
inParam.bit_depth = 8;
inParam.pack_flag = CELL_PNGDEC_1BYTE_PER_1PIXEL;
inParam.alpha_select = CELL_PNGDEC_STREAM_ALPHA;
ret = pPngDecSetParameter(mHandle, sHandle, &inParam, &outParam);
ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam);
if (ret != CELL_OK)
goto error;
#ifdef __PSL1GHT__
uint64_t output_bytes_per_line = outParam.output_width * 4;
ret = pPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &output_bytes_per_line, &dOutInfo);
ret = cellPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &output_bytes_per_line, &dOutInfo);
#else
dCtrlParam.output_bytes_per_line = outParam.output_width * 4;
ret = pPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
ret = cellPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
#endif
if (ret != CELL_OK || dOutInfo.status != CELL_PNGDEC_DEC_STATUS_FINISH)
@ -275,8 +275,8 @@ static bool ps3graphics_load_png(const char *path, struct texture_image *out_img
out_img->width = outParam.output_width;
out_img->height = outParam.output_height;
pPngDecClose(mHandle, sHandle);
pPngDecDestroy(mHandle);
cellPngDecClose(mHandle, sHandle);
cellPngDecDestroy(mHandle);
return true;
@ -284,9 +284,9 @@ error:
RARCH_ERR("ps3graphics_load_png(): error.\n");
if (mHandle && sHandle)
pPngDecClose(mHandle, sHandle);
cellPngDecClose(mHandle, sHandle);
if (mHandle)
pPngDecDestroy(mHandle);
cellPngDecDestroy(mHandle);
return false;
}

View File

@ -189,28 +189,28 @@
#ifdef __PSL1GHT__
/* define all of the JPEG/PNG structs */
#define pJpgDecMainHandle int
#define pPngDecMainHandle int
#define pJpgDecSubHandle int
#define pPngDecSubHandle int
#define pJpgDecThreadInParam jpgDecThreadInParam
#define pPngDecThreadInParam pngDecThreadInParam
#define pJpgDecThreadOutParam jpgDecThreadOutParam
#define pPngDecThreadOutParam pngDecThreadOutParam
#define pJpgDecSrc jpgDecSource
#define pPngDecSrc pngDecSource
#define pJpgDecOpnInfo uint32_t
#define pPngDecOpnInfo uint32_t
#define pJpgDecInfo jpgDecInfo
#define pPngDecInfo pngDecInfo
#define pJpgDecInParam jpgDecInParam
#define pPngDecInParam pngDecInParam
#define pJpgDecOutParam jpgDecOutParam
#define pPngDecOutParam pngDecOutParam
#define pJpgDecDataOutInfo jpgDecDataInfo
#define pPngDecDataOutInfo pngDecDataInfo
#define pJpgDecDataCtrlParam uint64_t
#define pPngDecDataCtrlParam uint64_t
#define CellJpgDecMainHandle int
#define CellPngDecMainHandle int
#define CellJpgDecSubHandle int
#define CellPngDecSubHandle int
#define CellJpgDecThreadInParam jpgDecThreadInParam
#define CellPngDecThreadInParam pngDecThreadInParam
#define CellJpgDecThreadOutParam jpgDecThreadOutParam
#define CellPngDecThreadOutParam pngDecThreadOutParam
#define CellJpgDecSrc jpgDecSource
#define CellPngDecSrc pngDecSource
#define CellJpgDecOpnInfo uint32_t
#define CellPngDecOpnInfo uint32_t
#define CellJpgDecInfo jpgDecInfo
#define CellPngDecInfo pngDecInfo
#define CellJpgDecInParam jpgDecInParam
#define CellPngDecInParam pngDecInParam
#define CellJpgDecOutParam jpgDecOutParam
#define CellPngDecOutParam pngDecOutParam
#define CellJpgDecDataOutInfo jpgDecDataInfo
#define CellPngDecDataOutInfo pngDecDataInfo
#define CellJpgDecDataCtrlParam uint64_t
#define CellPngDecDataCtrlParam uint64_t
#define spu_enable enable
#define stream_select stream
@ -222,21 +222,21 @@
#define output_height height
/* define all of the JPEG/PNG functions */
#define pJpgDecCreate jpgDecCreate
#define pJpgDecOpen jpgDecOpen
#define pJpgDecReadHeader jpgDecReadHeader
#define pJpgDecSetParameter jpgDecSetParameter
#define pJpgDecDecodeData jpgDecDecodeData
#define pJpgDecClose jpgDecClose
#define pJpgDecDestroy jpgDecDestroy
#define cellJpgDecCreate jpgDecCreate
#define cellJpgDecOpen jpgDecOpen
#define cellJpgDecReadHeader jpgDecReadHeader
#define cellJpgDecSetParameter jpgDecSetParameter
#define cellJpgDecDecodeData jpgDecDecodeData
#define cellJpgDecClose jpgDecClose
#define cellJpgDecDestroy jpgDecDestroy
#define pPngDecCreate pngDecCreate
#define pPngDecOpen pngDecOpen
#define pPngDecReadHeader pngDecReadHeader
#define pPngDecSetParameter pngDecSetParameter
#define pPngDecDecodeData pngDecDecodeData
#define pPngDecClose pngDecClose
#define pPngDecDestroy pngDecDestroy
#define cellPngDecCreate pngDecCreate
#define cellPngDecOpen pngDecOpen
#define cellPngDecReadHeader pngDecReadHeader
#define cellPngDecSetParameter pngDecSetParameter
#define cellPngDecDecodeData pngDecDecodeData
#define cellPngDecClose pngDecClose
#define cellPngDecDestroy pngDecDestroy
/* define all of the JPEG/PNG defines */
#define CELL_PNGDEC_SPU_THREAD_ENABLE 1
@ -257,30 +257,6 @@
#define PTR_NULL 0
#else
/* define all of the JPEG/PNG structs */
#define pJpgDecMainHandle CellJpgDecMainHandle
#define pPngDecMainHandle CellPngDecMainHandle
#define pJpgDecSubHandle CellJpgDecSubHandle
#define pPngDecSubHandle CellPngDecSubHandle
#define pJpgDecThreadInParam CellJpgDecThreadInParam
#define pPngDecThreadInParam CellPngDecThreadInParam
#define pJpgDecThreadOutParam CellJpgDecThreadOutParam
#define pPngDecThreadOutParam CellPngDecThreadOutParam
#define pJpgDecSrc CellJpgDecSrc
#define pPngDecSrc CellPngDecSrc
#define pJpgDecOpnInfo CellJpgDecOpnInfo
#define pPngDecOpnInfo CellPngDecOpnInfo
#define pJpgDecInfo CellJpgDecInfo
#define pPngDecInfo CellPngDecInfo
#define pJpgDecInParam CellJpgDecInParam
#define pPngDecInParam CellPngDecInParam
#define pJpgDecOutParam CellJpgDecOutParam
#define pPngDecOutParam CellPngDecOutParam
#define pJpgDecDataOutInfo CellJpgDecDataOutInfo
#define pPngDecDataOutInfo CellPngDecDataOutInfo
#define pJpgDecDataCtrlParam CellJpgDecDataCtrlParam
#define pPngDecDataCtrlParam CellPngDecDataCtrlParam
/* define the JPEG/PNG struct member names */
#define spu_enable spuThreadEnable
#define ppu_prio ppuThreadPriority
@ -308,23 +284,6 @@
#define pack_flag outputPackFlag
#define alpha_select outputAlphaSelect
/* define all the JPEG/PNG functions */
#define pJpgDecCreate cellJpgDecCreate
#define pJpgDecOpen cellJpgDecOpen
#define pJpgDecReadHeader cellJpgDecReadHeader
#define pJpgDecSetParameter cellJpgDecSetParameter
#define pJpgDecDecodeData cellJpgDecDecodeData
#define pJpgDecClose cellJpgDecClose
#define pJpgDecDestroy cellJpgDecDestroy
#define pPngDecCreate cellPngDecCreate
#define pPngDecOpen cellPngDecOpen
#define pPngDecReadHeader cellPngDecReadHeader
#define pPngDecSetParameter cellPngDecSetParameter
#define pPngDecDecodeData cellPngDecDecodeData
#define pPngDecClose cellPngDecClose
#define pPngDecDestroy cellPngDecDestroy
#define PTR_NULL NULL
#endif