mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-21 12:01:53 +00:00
(PSL1GHT) Start to make PS3 port compatible with PSL1GHT too
This commit is contained in:
parent
0930ff1269
commit
b5753c1d8a
59
Makefile.psl1ght
Normal file
59
Makefile.psl1ght
Normal file
@ -0,0 +1,59 @@
|
||||
###
|
||||
##
|
||||
# Makefile for RetroArch PSL1GHT.
|
||||
##
|
||||
|
||||
DEBUG = 0
|
||||
HAVE_LOGGER = 0
|
||||
HAVE_FILE_LOGGER = 0
|
||||
|
||||
PC_DEVELOPMENT_IP_ADDRESS = "192.168.1.7"
|
||||
PC_DEVELOPMENT_UDP_PORT = 3490
|
||||
|
||||
CC = $(PS3DEV)/ppu/bin/ppu-gcc
|
||||
LD = $(PS3DEV)/ppu/bin/ppu-ld
|
||||
|
||||
ELF_TARGET := retroarch_psl1ght.elf
|
||||
|
||||
INCLUDE := -I. -I$(PS3DEV)/ppu/include
|
||||
LIBDIRS := -L$(PS3DEV)/ppu/lib -L.
|
||||
|
||||
MACHDEP := -D__CELLOS_LV2__ -D__PSL1GHT__
|
||||
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
|
||||
LDFLAGS := $(MACHDEP)
|
||||
LIBS := -lretro_psl1ght
|
||||
|
||||
OBJ = console/griffin/griffin.o console/rzlib/rzlib.o
|
||||
|
||||
ifeq ($(HAVE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_LOGGER
|
||||
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
|
||||
OBJ += console/logger/logger.o
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_FILE_LOGGER), 1)
|
||||
CFLAGS += -DHAVE_FILE_LOGGER
|
||||
endif
|
||||
|
||||
CFLAGS += -std=gnu99 -DHAVE_DEFAULT_RETROPAD_INPUT -DRARCH_CONSOLE -DHAVE_CONFIGFILE=1 -DHAVE_ZLIB -DHAVE_RARCH_MAIN_WRAP -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"0.9.6\" -Dmain=rarch_main -Wno-char-subscripts
|
||||
|
||||
ifeq ($(DEBUG), 1)
|
||||
CFLAGS += -O0 -g
|
||||
else
|
||||
CLFAGS += -O3
|
||||
endif
|
||||
|
||||
all: $(ELF_TARGET)
|
||||
|
||||
$(ELF_TARGET): $(OBJ)
|
||||
$(CC) -o $@ $(LDFLAGS) $(LIBDIRS) $(OBJ) $(LIBS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f $(ELF_TARGET)
|
||||
rm -f $(OBJ)
|
||||
|
||||
.PHONY: clean
|
||||
|
@ -98,7 +98,7 @@ VIDEO DRIVER
|
||||
FONTS
|
||||
============================================================ */
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
#include "../../gfx/fonts/ps3_libdbgfont.c"
|
||||
#elif defined(_XBOX360)
|
||||
#include "../../gfx/fonts/xdk360_fonts.cpp"
|
||||
@ -107,7 +107,7 @@ FONTS
|
||||
/*============================================================
|
||||
INPUT
|
||||
============================================================ */
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
#include "../../ps3/ps3_input.c"
|
||||
#elif defined(_XBOX360)
|
||||
#include "../../360/xdk360_input.c"
|
||||
@ -153,7 +153,7 @@ AUDIO UTILS
|
||||
/*============================================================
|
||||
AUDIO
|
||||
============================================================ */
|
||||
#if defined(__CELLOS_LV2__)
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
#include "../../ps3/ps3_audio.c"
|
||||
#elif defined(_XBOX360)
|
||||
#include "../../360/xdk360_audio.cpp"
|
||||
|
@ -27,7 +27,7 @@
|
||||
PLAYSTATION3
|
||||
============================================================ */
|
||||
|
||||
#ifdef __CELLOS_LV2__
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
#define video_init_func(video_info, input, input_data) \
|
||||
gl_init(video_info, input, input_data)
|
||||
#define video_frame_func(data, width, height, pitch, msg) \
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "audio/ext/rarch_dsp.h"
|
||||
#include "compat/strl.h"
|
||||
|
||||
#ifdef __CELLOS_LV2__
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
#include <sys/timer.h>
|
||||
#include "ps3/ps3_input.h"
|
||||
#endif
|
||||
@ -257,7 +257,7 @@ struct console_settings
|
||||
char default_sram_dir[PATH_MAX];
|
||||
char launch_app_on_exit[PATH_MAX];
|
||||
float menu_font_size;
|
||||
#ifdef __CELLOS_LV2__
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
oskutil_params oskutil_handle;
|
||||
#endif
|
||||
};
|
||||
@ -600,7 +600,7 @@ static inline uint16_t swap_if_little16(uint16_t val)
|
||||
|
||||
static inline void rarch_sleep(unsigned msec)
|
||||
{
|
||||
#ifdef __CELLOS_LV2__
|
||||
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
|
||||
sys_timer_usleep(1000 * msec);
|
||||
#elif defined(_WIN32)
|
||||
Sleep(msec);
|
||||
|
365
ps3/image.c
365
ps3/image.c
@ -25,8 +25,152 @@
|
||||
#include <stddef.h>
|
||||
#include "../general.h"
|
||||
|
||||
#if defined(__CELLOS_LV2__)
|
||||
|
||||
#ifdef __PSL1GHT__
|
||||
#include <ppu-asm.h>
|
||||
#include <ppu-types.h>
|
||||
#include <jpgdec/jpgdec.h>
|
||||
#include <pngdec/pngdec.h>
|
||||
|
||||
#define pJpgDecCreate jpgDecCreate
|
||||
#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 spu_enable enable
|
||||
#define stream_select stream
|
||||
#define color_alpha alpha
|
||||
#define color_space space
|
||||
#define output_mode mode
|
||||
#define output_bytes_per_line bytes_per_line
|
||||
#define output_width width
|
||||
#define output_height height
|
||||
|
||||
#define pJpgDecOpen jpgDecOpen
|
||||
#define pJpgDecReadHeader jpgDecReadHeader
|
||||
#define pJpgDecSetParameter jpgDecSetParameter
|
||||
#define pJpgDecDecodeData jpgDecDecodeData
|
||||
#define pJpgDecClose jpgDecClose
|
||||
#define pJpgDecDestroy jpgDecDestroy
|
||||
|
||||
#define pPngDecCreate pngDecCreate
|
||||
#define pPngDecOpen pngDecOpen
|
||||
#define pPngDecReadHeader pngDecReadHeader
|
||||
#define pPngDecSetParameter pngDecSetParameter
|
||||
#define pPngDecDecodeData pngDecDecodeData
|
||||
#define pPngDecClose pngDecClose
|
||||
#define pPngDecDestroy pngDecDestroy
|
||||
|
||||
#define CELL_PNGDEC_SPU_THREAD_ENABLE 1
|
||||
#define CELL_JPGDEC_SPU_THREAD_ENABLE 1
|
||||
#define CELL_JPGDEC_FILE JPGDEC_FILE
|
||||
#define CELL_PNGDEC_FILE PNGDEC_FILE
|
||||
#define CELL_JPGDEC_SPU_THREAD_ENABLE 1
|
||||
#define CELL_JPGDEC_FAST JPGDEC_LOW_QUALITY
|
||||
#define CELL_JPGDEC_TOP_TO_BOTTOM JPGDEC_TOP_TO_BOTTOM
|
||||
#define CELL_PNGDEC_TOP_TO_BOTTOM PNGDEC_TOP_TO_BOTTOM
|
||||
#define CELL_JPG_ARGB JPGDEC_ARGB
|
||||
#define CELL_PNGDEC_ARGB PNGDEC_ARGB
|
||||
#define CELL_JPGDEC_DEC_STATUS_FINISH 0
|
||||
#define CELL_PNGDEC_DEC_STATUS_FINISH 0
|
||||
#define CELL_PNGDEC_1BYTE_PER_1PIXEL 1
|
||||
#define CELL_PNGDEC_STREAM_ALPHA 1
|
||||
#define CELL_OK 0
|
||||
#define PTR_NULL 0
|
||||
|
||||
#else
|
||||
#include <cell/codec.h>
|
||||
|
||||
#define pJpgDecCreate cellJpgDecCreate
|
||||
#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 spu_enable spuThreadEnable
|
||||
#define ppu_prio ppuThreadPriority
|
||||
#define spu_prio spuThreadPriority
|
||||
#define malloc_func cbCtrlMallocFunc
|
||||
#define malloc_arg cbCtrlMallocArg
|
||||
#define free_func cbCtrlFreeFunc
|
||||
#define free_arg cbCtrlFreeArg
|
||||
#define stream_select srcSelect
|
||||
#define file_name fileName
|
||||
#define file_offset fileOffset
|
||||
#define file_size fileSize
|
||||
#define stream_ptr streamPtr
|
||||
#define stream_size streamSize
|
||||
#define down_scale downScale
|
||||
#define color_alpha outputColorAlpha
|
||||
#define color_space outputColorSpace
|
||||
#define cmd_ptr commandPtr
|
||||
#define quality method
|
||||
#define output_mode outputMode
|
||||
#define output_bytes_per_line outputBytesPerLine
|
||||
#define output_width outputWidth
|
||||
#define output_height outputHeight
|
||||
#define bit_depth outputBitDepth
|
||||
#define pack_flag outputPackFlag
|
||||
#define alpha_select outputAlphaSelect
|
||||
|
||||
#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
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
Image decompression - structs
|
||||
********************************************************************************/
|
||||
@ -43,17 +187,23 @@ typedef struct CtrlFreeArg
|
||||
|
||||
void *img_malloc(uint32_t size, void * a)
|
||||
{
|
||||
#ifndef __PSL1GHT__
|
||||
CtrlMallocArg *arg;
|
||||
arg = (CtrlMallocArg *) a;
|
||||
arg->mallocCallCounts++;
|
||||
#endif
|
||||
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
static int img_free(void *ptr, void * a)
|
||||
{
|
||||
#ifndef __PSL1GHT__
|
||||
CtrlFreeArg *arg;
|
||||
arg = (CtrlFreeArg *) a;
|
||||
arg->freeCallCounts++;
|
||||
#endif
|
||||
|
||||
free(ptr);
|
||||
return 0;
|
||||
}
|
||||
@ -64,87 +214,105 @@ static int img_free(void *ptr, void * a)
|
||||
|
||||
static bool ps3graphics_load_jpeg(const char * path, struct texture_image *out_img)
|
||||
{
|
||||
#ifndef __PSL1GHT__
|
||||
CtrlMallocArg MallocArg;
|
||||
CtrlFreeArg FreeArg;
|
||||
CellJpgDecMainHandle mHandle = NULL;
|
||||
CellJpgDecSubHandle sHandle = NULL;
|
||||
CellJpgDecThreadInParam InParam;
|
||||
CellJpgDecThreadOutParam OutParam;
|
||||
CellJpgDecSrc src;
|
||||
CellJpgDecOpnInfo opnInfo;
|
||||
CellJpgDecInfo info;
|
||||
CellJpgDecInParam inParam;
|
||||
CellJpgDecOutParam outParam;
|
||||
CellJpgDecDataOutInfo dOutInfo;
|
||||
CellJpgDecDataCtrlParam dCtrlParam;
|
||||
pJpgDecDataCtrlParam 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;
|
||||
|
||||
InParam.spu_enable = CELL_JPGDEC_SPU_THREAD_ENABLE;
|
||||
InParam.ppu_prio = 1001;
|
||||
InParam.spu_prio = 250;
|
||||
#ifdef __PSL1GHT__
|
||||
InParam.malloc_func = __get_addr32(__get_opd32(img_malloc));
|
||||
InParam.free_func = __get_addr32(__get_opd32(img_free));
|
||||
InParam.malloc_arg = 0;
|
||||
InParam.free_arg = 0;
|
||||
#else
|
||||
MallocArg.mallocCallCounts = 0;
|
||||
FreeArg.freeCallCounts = 0;
|
||||
InParam.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE;
|
||||
InParam.ppuThreadPriority = 1001;
|
||||
InParam.spuThreadPriority = 250;
|
||||
InParam.cbCtrlMallocFunc = img_malloc;
|
||||
InParam.cbCtrlMallocArg = &MallocArg;
|
||||
InParam.cbCtrlFreeFunc = img_free;
|
||||
InParam.cbCtrlFreeArg = &FreeArg;
|
||||
InParam.malloc_func = img_malloc;
|
||||
InParam.free_func = img_free;
|
||||
InParam.malloc_arg = &MallocArg;
|
||||
InParam.free_arg = &FreeArg;
|
||||
#endif
|
||||
|
||||
int ret_jpeg, ret = -1;
|
||||
ret_jpeg = cellJpgDecCreate(&mHandle, &InParam, &OutParam);
|
||||
ret_jpeg = pJpgDecCreate(&mHandle, &InParam, &OutParam);
|
||||
|
||||
if (ret_jpeg != CELL_OK)
|
||||
goto error;
|
||||
|
||||
memset(&src, 0, sizeof(CellJpgDecSrc));
|
||||
src.srcSelect = CELL_JPGDEC_FILE;
|
||||
src.fileName = path;
|
||||
src.fileOffset = 0;
|
||||
src.fileSize = 0;
|
||||
src.streamPtr = NULL;
|
||||
src.streamSize = 0;
|
||||
memset(&src, 0, sizeof(pJpgDecSrc));
|
||||
src.stream_select = CELL_JPGDEC_FILE;
|
||||
#ifdef __PSL1GHT__
|
||||
src.file_name = __get_addr32(path);
|
||||
#else
|
||||
src.file_name = path;
|
||||
#endif
|
||||
src.file_offset = 0;
|
||||
src.file_size = 0;
|
||||
src.stream_ptr = PTR_NULL;
|
||||
src.stream_size = 0;
|
||||
|
||||
src.spuThreadEnable = CELL_JPGDEC_SPU_THREAD_ENABLE;
|
||||
src.spu_enable = CELL_JPGDEC_SPU_THREAD_ENABLE;
|
||||
|
||||
ret = cellJpgDecOpen(mHandle, &sHandle, &src, &opnInfo);
|
||||
ret = pJpgDecOpen(mHandle, &sHandle, &src, &opnInfo);
|
||||
|
||||
if (ret != CELL_OK)
|
||||
goto error;
|
||||
|
||||
ret = cellJpgDecReadHeader(mHandle, sHandle, &info);
|
||||
ret = pJpgDecReadHeader(mHandle, sHandle, &info);
|
||||
|
||||
if (ret != CELL_OK)
|
||||
goto error;
|
||||
|
||||
inParam.commandPtr = NULL;
|
||||
inParam.method = CELL_JPGDEC_FAST;
|
||||
inParam.outputMode = CELL_JPGDEC_TOP_TO_BOTTOM;
|
||||
inParam.outputColorSpace = CELL_JPG_ARGB;
|
||||
inParam.downScale = 1;
|
||||
inParam.outputColorAlpha = 0xfe;
|
||||
ret = cellJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam);
|
||||
inParam.cmd_ptr = PTR_NULL;
|
||||
inParam.quality = CELL_JPGDEC_FAST;
|
||||
inParam.output_mode = CELL_JPGDEC_TOP_TO_BOTTOM;
|
||||
inParam.color_space = CELL_JPG_ARGB;
|
||||
inParam.down_scale = 1;
|
||||
inParam.color_alpha = 0xfe;
|
||||
ret = pJpgDecSetParameter(mHandle, sHandle, &inParam, &outParam);
|
||||
|
||||
if (ret != CELL_OK)
|
||||
goto error;
|
||||
|
||||
dCtrlParam.outputBytesPerLine = outParam.outputWidth * 4;
|
||||
ret = cellJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
|
||||
#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);
|
||||
#else
|
||||
dCtrlParam.output_bytes_per_line = outParam.output_width * 4;
|
||||
ret = pJpgDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
|
||||
#endif
|
||||
|
||||
if (ret != CELL_OK || dOutInfo.status != CELL_JPGDEC_DEC_STATUS_FINISH)
|
||||
goto error;
|
||||
|
||||
out_img->width = outParam.outputWidth;
|
||||
out_img->height = outParam.outputHeight;
|
||||
out_img->width = outParam.output_width;
|
||||
out_img->height = outParam.output_height;
|
||||
|
||||
cellJpgDecClose(mHandle, sHandle);
|
||||
cellJpgDecDestroy(mHandle);
|
||||
pJpgDecClose(mHandle, sHandle);
|
||||
pJpgDecDestroy(mHandle);
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
RARCH_ERR("ps3graphics_load_jpeg(): error.\n");
|
||||
if (mHandle && sHandle)
|
||||
cellJpgDecClose(mHandle, sHandle);
|
||||
pJpgDecClose(mHandle, sHandle);
|
||||
if (mHandle)
|
||||
cellJpgDecDestroy(mHandle);
|
||||
pJpgDecDestroy(mHandle);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -154,79 +322,96 @@ error:
|
||||
|
||||
static bool ps3graphics_load_png(const char * path, struct texture_image *out_img)
|
||||
{
|
||||
#ifndef __PSL1GHT__
|
||||
CtrlMallocArg MallocArg;
|
||||
CtrlFreeArg FreeArg;
|
||||
CellPngDecMainHandle mHandle = NULL;
|
||||
CellPngDecSubHandle sHandle = NULL;
|
||||
CellPngDecThreadInParam InParam;
|
||||
CellPngDecThreadOutParam OutParam;
|
||||
CellPngDecSrc src;
|
||||
CellPngDecOpnInfo opnInfo;
|
||||
CellPngDecInfo info;
|
||||
CellPngDecInParam inParam;
|
||||
CellPngDecOutParam outParam;
|
||||
CellPngDecDataOutInfo dOutInfo;
|
||||
CellPngDecDataCtrlParam dCtrlParam;
|
||||
pPngDecDataCtrlParam 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;
|
||||
|
||||
InParam.spu_enable = CELL_PNGDEC_SPU_THREAD_ENABLE;
|
||||
InParam.ppu_prio = 512;
|
||||
InParam.spu_prio = 200;
|
||||
#ifdef __PSL1GHT__
|
||||
InParam.malloc_func = __get_addr32(__get_opd32(img_malloc));
|
||||
InParam.free_func = __get_addr32(__get_opd32(img_free));
|
||||
InParam.malloc_arg = 0;
|
||||
InParam.free_arg = 0;
|
||||
#else
|
||||
MallocArg.mallocCallCounts = 0;
|
||||
FreeArg.freeCallCounts = 0;
|
||||
InParam.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE;
|
||||
InParam.ppuThreadPriority = 512;
|
||||
InParam.spuThreadPriority = 200;
|
||||
InParam.cbCtrlMallocFunc = img_malloc;
|
||||
InParam.cbCtrlMallocArg = &MallocArg;
|
||||
InParam.cbCtrlFreeFunc = img_free;
|
||||
InParam.cbCtrlFreeArg = &FreeArg;
|
||||
FreeArg.freeCallCounts = 0;
|
||||
InParam.malloc_func = img_malloc;
|
||||
InParam.malloc_arg = &MallocArg;
|
||||
InParam.free_func = img_free;
|
||||
InParam.free_arg = &FreeArg;
|
||||
#endif
|
||||
|
||||
int ret_png, ret = -1;
|
||||
ret_png = cellPngDecCreate(&mHandle, &InParam, &OutParam);
|
||||
ret_png = pPngDecCreate(&mHandle, &InParam, &OutParam);
|
||||
|
||||
if (ret_png != CELL_OK)
|
||||
goto error;
|
||||
|
||||
memset(&src, 0, sizeof(CellPngDecSrc));
|
||||
src.srcSelect = CELL_PNGDEC_FILE;
|
||||
src.fileName = path;
|
||||
src.fileOffset = 0;
|
||||
src.fileSize = 0;
|
||||
src.streamPtr = 0;
|
||||
src.streamSize = 0;
|
||||
memset(&src, 0, sizeof(pPngDecSrc));
|
||||
src.stream_select = CELL_PNGDEC_FILE;
|
||||
#ifdef __PSL1GHT__
|
||||
src.file_name = __get_addr32(path);
|
||||
#else
|
||||
src.file_name = path;
|
||||
#endif
|
||||
src.file_offset = 0;
|
||||
src.file_size = 0;
|
||||
src.stream_ptr = 0;
|
||||
src.stream_size = 0;
|
||||
|
||||
src.spuThreadEnable = CELL_PNGDEC_SPU_THREAD_ENABLE;
|
||||
src.spu_enable = CELL_PNGDEC_SPU_THREAD_ENABLE;
|
||||
|
||||
ret = cellPngDecOpen(mHandle, &sHandle, &src, &opnInfo);
|
||||
ret = pPngDecOpen(mHandle, &sHandle, &src, &opnInfo);
|
||||
|
||||
if (ret != CELL_OK)
|
||||
goto error;
|
||||
|
||||
ret = cellPngDecReadHeader(mHandle, sHandle, &info);
|
||||
ret = pPngDecReadHeader(mHandle, sHandle, &info);
|
||||
|
||||
if (ret != CELL_OK)
|
||||
goto error;
|
||||
|
||||
inParam.commandPtr = NULL;
|
||||
inParam.outputMode = CELL_PNGDEC_TOP_TO_BOTTOM;
|
||||
inParam.outputColorSpace = CELL_PNGDEC_ARGB;
|
||||
inParam.outputBitDepth = 8;
|
||||
inParam.outputPackFlag = CELL_PNGDEC_1BYTE_PER_1PIXEL;
|
||||
inParam.outputAlphaSelect = CELL_PNGDEC_STREAM_ALPHA;
|
||||
ret = cellPngDecSetParameter(mHandle, sHandle, &inParam, &outParam);
|
||||
inParam.cmd_ptr = PTR_NULL;
|
||||
inParam.output_mode = CELL_PNGDEC_TOP_TO_BOTTOM;
|
||||
inParam.color_space = CELL_PNGDEC_ARGB;
|
||||
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);
|
||||
|
||||
if (ret != CELL_OK)
|
||||
goto error;
|
||||
|
||||
dCtrlParam.outputBytesPerLine = outParam.outputWidth * 4;
|
||||
ret = cellPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
|
||||
|
||||
#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);
|
||||
#else
|
||||
dCtrlParam.output_bytes_per_line = outParam.output_width * 4;
|
||||
ret = pPngDecDecodeData(mHandle, sHandle, (uint8_t*)out_img->pixels, &dCtrlParam, &dOutInfo);
|
||||
#endif
|
||||
|
||||
if (ret != CELL_OK || dOutInfo.status != CELL_PNGDEC_DEC_STATUS_FINISH)
|
||||
goto error;
|
||||
|
||||
out_img->width = outParam.outputWidth;
|
||||
out_img->height = outParam.outputHeight;
|
||||
out_img->width = outParam.output_width;
|
||||
out_img->height = outParam.output_height;
|
||||
|
||||
cellPngDecClose(mHandle, sHandle);
|
||||
cellPngDecDestroy(mHandle);
|
||||
pPngDecClose(mHandle, sHandle);
|
||||
pPngDecDestroy(mHandle);
|
||||
|
||||
return true;
|
||||
|
||||
@ -234,9 +419,9 @@ error:
|
||||
RARCH_ERR("ps3graphics_load_png(): error.\n");
|
||||
|
||||
if (mHandle && sHandle)
|
||||
cellPngDecClose(mHandle, sHandle);
|
||||
pPngDecClose(mHandle, sHandle);
|
||||
if (mHandle)
|
||||
cellPngDecDestroy(mHandle);
|
||||
pPngDecDestroy(mHandle);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -19,8 +19,14 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#ifdef HAVE_OSKUTIL
|
||||
#include <sysutil/sysutil_oskdialog.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYSUTILS
|
||||
#include <sysutil/sysutil_common.h>
|
||||
#endif
|
||||
|
||||
#define MAX_PADS 7
|
||||
|
||||
@ -127,6 +133,8 @@ cell_input_state_t cell_pad_input_poll_device(uint32_t id);
|
||||
|
||||
void ps3_input_map_dpad_to_stick(uint32_t map_dpad_enum, uint32_t controller_id);
|
||||
|
||||
#ifdef HAVE_OSKUTIL
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int osk_memorycontainer;
|
||||
@ -153,5 +161,6 @@ void oskutil_finished(oskutil_params *params);
|
||||
void oskutil_close(oskutil_params *params);
|
||||
void oskutil_unload(oskutil_params *params);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user