(PS3) Texture is now loaded

This commit is contained in:
TwinAphex51224 2012-01-26 02:28:54 +01:00 committed by Themaister
parent b89554d11a
commit 15c5c69241
5 changed files with 9 additions and 32 deletions

View File

@ -25,7 +25,11 @@ struct texture_image
{
unsigned width;
unsigned height;
#ifdef __CELLOS_LV2__
uint8_t *pixels;
#else
uint32_t *pixels;
#endif
};
bool texture_image_load(const char *path, struct texture_image* img);

View File

@ -94,10 +94,7 @@ static bool ps3graphics_load_jpeg(const char * path, struct texture_image *out_i
ret_jpeg = cellJpgDecCreate(&mHandle, &InParam, &OutParam);
if (ret_jpeg != CELL_OK)
{
SSNES_ERR("cellJpgDecCreate\n");
goto error;
}
memset(&src, 0, sizeof(CellJpgDecSrc));
src.srcSelect = CELL_JPGDEC_FILE;
@ -112,18 +109,12 @@ static bool ps3graphics_load_jpeg(const char * path, struct texture_image *out_i
ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo);
if (ret != CELL_OK)
{
SSNES_ERR("cellJpgDecOpen\n");
goto error;
}
ret = cellJpgDecReadHeader(mHandle, sHandle, &info);
if (ret != CELL_OK)
{
SSNES_ERR("cellJpgDecReadHeader\n");
goto error;
}
inParam.commandPtr = NULL;
inParam.method = CELL_JPGDEC_FAST;
@ -134,19 +125,13 @@ static bool ps3graphics_load_jpeg(const char * path, struct texture_image *out_i
ret = cellJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam);
if (ret != CELL_OK)
{
SSNES_ERR("cellJpgDecSetParameter\n");
goto error;
}
dCtrlParam.outputBytesPerLine = outParam.outputWidth * 4;
ret = cellJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
ret = cellJpgDecDecodeData(mHandle, sHandle, out_img->pixels, &dCtrlParam, &dOutInfo);
if (ret != CELL_OK || dOutInfo.status != CELL_JPGDEC_DEC_STATUS_FINISH)
{
SSNES_ERR("cellJpgDecDecodeData\n");
goto error;
}
out_img->width = outParam.outputWidth;
out_img->height = outParam.outputHeight;
@ -198,10 +183,7 @@ static bool ps3graphics_load_png(const char * path, struct texture_image *out_im
ret_png = cellPngDecCreate(&mHandle, &InParam, &OutParam);
if (ret_png != CELL_OK)
{
SSNES_ERR("cellPngDecCreate\n");
goto error;
}
memset(&src, 0, sizeof(CellPngDecSrc));
src.srcSelect = CELL_PNGDEC_FILE;
@ -217,19 +199,13 @@ static bool ps3graphics_load_png(const char * path, struct texture_image *out_im
if (ret != CELL_OK)
{
SSNES_ERR("cellPngDecOpen\n");
goto error;
}
ret = cellPngDecReadHeader(mHandle, sHandle, &info);
if (ret != CELL_OK)
{
SSNES_ERR("cellPngDecReadheader\n");
goto error;
}
inParam.commandPtr = NULL;
inParam.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM;
@ -240,20 +216,14 @@ static bool ps3graphics_load_png(const char * path, struct texture_image *out_im
ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam);
if (ret != CELL_OK)
{
SSNES_ERR("cellPngDecSetParameter\n");
goto error;
}
dCtrlParam.outputBytesPerLine = outParam.outputWidth * 4;
ret = cellPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
ret = cellPngDecDecodeData(mHandle, sHandle, out_img->pixels, &dCtrlParam, &dOutInfo);
if (ret != CELL_OK || dOutInfo.status != CELL_PNGDEC_DEC_STATUS_FINISH)
{
SSNES_ERR("cellPngDecDecodeData\n");
goto error;
}
out_img->width = outParam.outputWidth;
out_img->height = outParam.outputHeight;

View File

@ -492,6 +492,7 @@ int main(int argc, char *argv[])
// Initialize 6 SPUs but reserve 1 SPU as a raw SPU for PSGL
sys_spu_initialize(6, 1);
cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME);
cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 267 KiB

View File

@ -1143,6 +1143,8 @@ bool ps3_setup_texture(void)
glGenTextures(1, &menu_texture_id);
SSNES_LOG("Loading texture image for menu...\n");
menu_texture.pixels = memalign(128, 2048 * 2048 * 4);
memset(menu_texture.pixels, 0, (2048 * 2048 * 4));
if(!texture_image_load(DEFAULT_MENU_BORDER_FILE, &menu_texture))
{
SSNES_ERR("Failed to load texture image for menu\n");