mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 08:21:29 +12:00
Improved ID manager.
Improved MemoryBlock.
This commit is contained in:
parent
159b6ecea3
commit
ab41540064
27 changed files with 813 additions and 767 deletions
|
@ -1,116 +1,12 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
||||
#include "cellPngDec.h"
|
||||
#include "stblib/stb_image.h"
|
||||
|
||||
void cellPngDec_init();
|
||||
Module cellPngDec(0x0018, cellPngDec_init);
|
||||
|
||||
//Return Codes
|
||||
enum
|
||||
{
|
||||
CELL_PNGDEC_ERROR_HEADER = 0x80611201,
|
||||
CELL_PNGDEC_ERROR_STREAM_FORMAT = 0x80611202,
|
||||
CELL_PNGDEC_ERROR_ARG = 0x80611203,
|
||||
CELL_PNGDEC_ERROR_SEQ = 0x80611204,
|
||||
CELL_PNGDEC_ERROR_BUSY = 0x80611205,
|
||||
CELL_PNGDEC_ERROR_FATAL = 0x80611206,
|
||||
CELL_PNGDEC_ERROR_OPEN_FILE = 0x80611207,
|
||||
CELL_PNGDEC_ERROR_SPU_UNSUPPORT = 0x80611208,
|
||||
CELL_PNGDEC_ERROR_SPU_ERROR = 0x80611209,
|
||||
CELL_PNGDEC_ERROR_CB_PARAM = 0x8061120a,
|
||||
};
|
||||
|
||||
enum CellPngDecColorSpace
|
||||
{
|
||||
CELL_PNGDEC_GRAYSCALE = 1,
|
||||
CELL_PNGDEC_RGB = 2,
|
||||
CELL_PNGDEC_PALETTE = 4,
|
||||
CELL_PNGDEC_GRAYSCALE_ALPHA = 9,
|
||||
CELL_PNGDEC_RGBA = 10,
|
||||
CELL_PNGDEC_ARGB = 20,
|
||||
};
|
||||
|
||||
enum CellPngDecDecodeStatus
|
||||
{
|
||||
CELL_PNGDEC_DEC_STATUS_FINISH = 0, //Decoding finished
|
||||
CELL_PNGDEC_DEC_STATUS_STOP = 1, //Decoding halted
|
||||
};
|
||||
|
||||
enum CellPngDecStreamSrcSel
|
||||
{
|
||||
CELL_PNGDEC_FILE = 0,
|
||||
CELL_PNGDEC_BUFFER = 1
|
||||
};
|
||||
|
||||
struct CellPngDecDataOutInfo
|
||||
{
|
||||
be_t<u32> chunkInformation;
|
||||
be_t<u32> numText;
|
||||
be_t<u32> numUnknownChunk;
|
||||
be_t<u32> status;
|
||||
};
|
||||
|
||||
struct CellPngDecDataCtrlParam
|
||||
{
|
||||
be_t<u64> outputBytesPerLine;
|
||||
};
|
||||
|
||||
struct CellPngDecInfo
|
||||
{
|
||||
be_t<u32> imageWidth;
|
||||
be_t<u32> imageHeight;
|
||||
be_t<u32> numComponents;
|
||||
be_t<u32> colorSpace; // CellPngDecColorSpace
|
||||
be_t<u32> bitDepth;
|
||||
be_t<u32> interlaceMethod; // CellPngDecInterlaceMode
|
||||
be_t<u32> chunkInformation;
|
||||
};
|
||||
|
||||
struct CellPngDecSrc
|
||||
{
|
||||
be_t<u32> srcSelect; // CellPngDecStreamSrcSel
|
||||
be_t<u32> fileName; // const char*
|
||||
be_t<u64> fileOffset; // int64_t
|
||||
be_t<u32> fileSize;
|
||||
be_t<u32> streamPtr;
|
||||
be_t<u32> streamSize;
|
||||
be_t<u32> spuThreadEnable; // CellPngDecSpuThreadEna
|
||||
};
|
||||
|
||||
struct CellPngDecInParam
|
||||
{
|
||||
be_t<u32> commandPtr;
|
||||
be_t<u32> outputMode; // CellPngDecOutputMode
|
||||
be_t<u32> outputColorSpace; // CellPngDecColorSpace
|
||||
be_t<u32> outputBitDepth;
|
||||
be_t<u32> outputPackFlag; // CellPngDecPackFlag
|
||||
be_t<u32> outputAlphaSelect; // CellPngDecAlphaSelect
|
||||
be_t<u32> outputColorAlpha;
|
||||
};
|
||||
|
||||
struct CellPngDecOutParam
|
||||
{
|
||||
be_t<u64> outputWidthByte;
|
||||
be_t<u32> outputWidth;
|
||||
be_t<u32> outputHeight;
|
||||
be_t<u32> outputComponents;
|
||||
be_t<u32> outputBitDepth;
|
||||
be_t<u32> outputMode; // CellPngDecOutputMode
|
||||
be_t<u32> outputColorSpace; // CellPngDecColorSpace
|
||||
be_t<u32> useMemorySpace;
|
||||
};
|
||||
|
||||
struct CellPngDecSubHandle //Custom struct
|
||||
{
|
||||
u32 fd;
|
||||
u64 fileSize;
|
||||
CellPngDecInfo info;
|
||||
CellPngDecOutParam outParam;
|
||||
CellPngDecSrc src;
|
||||
};
|
||||
|
||||
int cellPngDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(cellPngDec);
|
||||
|
@ -164,12 +60,10 @@ int cellPngDecClose(u32 mainHandle, u32 subHandle)
|
|||
{
|
||||
cellPngDec.Warning("cellPngDecClose(mainHandle=0x%x,subHandle=0x%x)", mainHandle, subHandle);
|
||||
|
||||
ID sub_handle_id_data;
|
||||
if(!cellPngDec.CheckId(subHandle, sub_handle_id_data))
|
||||
CellPngDecSubHandle* subHandle_data;
|
||||
if(!cellPngDec.CheckId(subHandle, subHandle_data))
|
||||
return CELL_PNGDEC_ERROR_FATAL;
|
||||
|
||||
auto subHandle_data = (CellPngDecSubHandle*)sub_handle_id_data.m_data;
|
||||
|
||||
cellFsClose(subHandle_data->fd);
|
||||
Emu.GetIdManager().RemoveID(subHandle);
|
||||
|
||||
|
@ -179,12 +73,10 @@ int cellPngDecClose(u32 mainHandle, u32 subHandle)
|
|||
int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo> info)
|
||||
{
|
||||
cellPngDec.Warning("cellPngDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info_addr=0x%llx)", mainHandle, subHandle, info.GetAddr());
|
||||
ID sub_handle_id_data;
|
||||
if(!cellPngDec.CheckId(subHandle, sub_handle_id_data))
|
||||
CellPngDecSubHandle* subHandle_data;
|
||||
if(!cellPngDec.CheckId(subHandle, subHandle_data))
|
||||
return CELL_PNGDEC_ERROR_FATAL;
|
||||
|
||||
auto subHandle_data = (CellPngDecSubHandle*)sub_handle_id_data.m_data;
|
||||
|
||||
const u32& fd = subHandle_data->fd;
|
||||
const u64& fileSize = subHandle_data->fileSize;
|
||||
CellPngDecInfo& current_info = subHandle_data->info;
|
||||
|
@ -238,12 +130,10 @@ int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo
|
|||
int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const mem_ptr_t<CellPngDecDataCtrlParam> dataCtrlParam, mem_ptr_t<CellPngDecDataOutInfo> dataOutInfo)
|
||||
{
|
||||
dataOutInfo->status = CELL_PNGDEC_DEC_STATUS_STOP;
|
||||
ID sub_handle_id_data;
|
||||
if(!cellPngDec.CheckId(subHandle, sub_handle_id_data))
|
||||
CellPngDecSubHandle* subHandle_data;
|
||||
if(!cellPngDec.CheckId(subHandle, subHandle_data))
|
||||
return CELL_PNGDEC_ERROR_FATAL;
|
||||
|
||||
auto subHandle_data = (CellPngDecSubHandle*)sub_handle_id_data.m_data;
|
||||
|
||||
const u32& fd = subHandle_data->fd;
|
||||
const u64& fileSize = subHandle_data->fileSize;
|
||||
const CellPngDecOutParam& current_outParam = subHandle_data->outParam;
|
||||
|
@ -306,12 +196,10 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m
|
|||
|
||||
int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_t<CellPngDecInParam> inParam, mem_ptr_t<CellPngDecOutParam> outParam)
|
||||
{
|
||||
ID sub_handle_id_data;
|
||||
if(!cellPngDec.CheckId(subHandle, sub_handle_id_data))
|
||||
CellPngDecSubHandle* subHandle_data;
|
||||
if(!cellPngDec.CheckId(subHandle, subHandle_data))
|
||||
return CELL_PNGDEC_ERROR_FATAL;
|
||||
|
||||
auto subHandle_data = (CellPngDecSubHandle*)sub_handle_id_data.m_data;
|
||||
|
||||
CellPngDecInfo& current_info = subHandle_data->info;
|
||||
CellPngDecOutParam& current_outParam = subHandle_data->outParam;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue