cellGifDec, cellPngDec: small update

This commit is contained in:
Nekotekina 2015-06-13 21:16:19 +03:00
parent a77a75660b
commit 8c62a893a9
4 changed files with 121 additions and 159 deletions

View File

@ -119,16 +119,19 @@ void execute_ppu_func_by_index(PPUThread& CPU, u32 index)
if (old_last_syscall)
{
CPU.m_last_syscall = func->id;
throw "Unfortunately, this function cannot be called from the callback.";
}
if (!func->lle_func)
{
CPU.m_last_syscall = func->id;
throw "Wrong usage: LLE function not set.";
}
if (func->flags & MFF_FORCED_HLE)
{
CPU.m_last_syscall = func->id;
throw "Wrong usage: Forced HLE enabled.";
}
@ -139,6 +142,7 @@ void execute_ppu_func_by_index(PPUThread& CPU, u32 index)
if (index & EIF_PERFORM_BLR)
{
CPU.m_last_syscall = func->id;
throw "TODO: Branch with link";
// CPU.LR = CPU.PC + 4;
}

View File

@ -18,23 +18,35 @@ extern "C"
extern Module cellGifDec;
s32 cellGifDecCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam)
s32 cellGifDecCreate(
vm::ptr<CellGifDecMainHandle> mainHandle,
vm::ptr<const CellGifDecThreadInParam> threadInParam,
vm::ptr<CellGifDecThreadOutParam> threadOutParam)
{
UNIMPLEMENTED_FUNC(cellGifDec);
return CELL_OK;
}
s32 cellGifDecExtCreate(u32 mainHandle, u32 threadInParam, u32 threadOutParam, u32 extThreadInParam, u32 extThreadOutParam)
s32 cellGifDecExtCreate(
vm::ptr<CellGifDecMainHandle> mainHandle,
vm::ptr<const CellGifDecThreadInParam> threadInParam,
vm::ptr<CellGifDecThreadOutParam> threadOutParam,
vm::ptr<const CellGifDecExtThreadInParam> extThreadInParam,
vm::ptr<CellGifDecExtThreadOutParam> extThreadOutParam)
{
UNIMPLEMENTED_FUNC(cellGifDec);
return CELL_OK;
}
s32 cellGifDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellGifDecSrc> src, vm::ptr<CellGifDecOpnInfo> openInfo)
s32 cellGifDecOpen(
CellGifDecMainHandle mainHandle,
vm::ptr<CellGifDecSubHandle> subHandle,
vm::ptr<const CellGifDecSrc> src,
vm::ptr<CellGifDecOpnInfo> openInfo)
{
cellGifDec.Warning("cellGifDecOpen(mainHandle=0x%x, subHandle=*0x%x, src=*0x%x, openInfo=*0x%x)", mainHandle, subHandle, src, openInfo);
auto current_subHandle = std::make_shared<CellGifDecSubHandle>();
auto current_subHandle = std::make_shared<GifStream>();
current_subHandle->fd = 0;
current_subHandle->src = *src;
@ -62,11 +74,14 @@ s32 cellGifDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellGifDecSrc
return CELL_OK;
}
s32 cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo> info)
s32 cellGifDecReadHeader(
CellGifDecMainHandle mainHandle,
CellGifDecSubHandle subHandle,
vm::ptr<CellGifDecInfo> info)
{
cellGifDec.Warning("cellGifDecReadHeader(mainHandle=0x%x, subHandle=0x%x, info=*0x%x)", mainHandle, subHandle, info);
const auto subHandle_data = Emu.GetIdManager().get<CellGifDecSubHandle>(subHandle);
const auto subHandle_data = Emu.GetIdManager().get<GifStream>(subHandle);
if (!subHandle_data)
{
@ -83,7 +98,7 @@ s32 cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo>
switch(subHandle_data->src.srcSelect.data())
{
case se32(CELL_GIFDEC_BUFFER):
memmove(buffer.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), buffer.size());
memmove(buffer.begin(), subHandle_data->src.streamPtr.get_ptr(), buffer.size());
break;
case se32(CELL_GIFDEC_FILE):
@ -116,11 +131,15 @@ s32 cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo>
return CELL_OK;
}
s32 cellGifDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellGifDecInParam> inParam, vm::ptr<CellGifDecOutParam> outParam)
s32 cellGifDecSetParameter(
CellGifDecMainHandle mainHandle,
CellGifDecSubHandle subHandle,
vm::ptr<const CellGifDecInParam> inParam,
vm::ptr<CellGifDecOutParam> outParam)
{
cellGifDec.Warning("cellGifDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam=*0x%x, outParam=*0x%x)", mainHandle, subHandle, inParam, outParam);
const auto subHandle_data = Emu.GetIdManager().get<CellGifDecSubHandle>(subHandle);
const auto subHandle_data = Emu.GetIdManager().get<GifStream>(subHandle);
if (!subHandle_data)
{
@ -148,13 +167,18 @@ s32 cellGifDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellGifD
return CELL_OK;
}
s32 cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellGifDecDataCtrlParam> dataCtrlParam, vm::ptr<CellGifDecDataOutInfo> dataOutInfo)
s32 cellGifDecDecodeData(
CellGifDecMainHandle mainHandle,
CellGifDecSubHandle subHandle,
vm::ptr<u8> data,
vm::ptr<const CellGifDecDataCtrlParam> dataCtrlParam,
vm::ptr<CellGifDecDataOutInfo> dataOutInfo)
{
cellGifDec.Warning("cellGifDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data=*0x%x, dataCtrlParam=*0x%x, dataOutInfo=*0x%x)", mainHandle, subHandle, data, dataCtrlParam, dataOutInfo);
dataOutInfo->status = CELL_GIFDEC_DEC_STATUS_STOP;
const auto subHandle_data = Emu.GetIdManager().get<CellGifDecSubHandle>(subHandle);
const auto subHandle_data = Emu.GetIdManager().get<GifStream>(subHandle);
if (!subHandle_data)
{
@ -171,7 +195,7 @@ s32 cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::pt
switch(subHandle_data->src.srcSelect.data())
{
case se32(CELL_GIFDEC_BUFFER):
memmove(gif.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), gif.size());
memmove(gif.begin(), subHandle_data->src.streamPtr.get_ptr(), gif.size());
break;
case se32(CELL_GIFDEC_FILE):
@ -269,11 +293,11 @@ s32 cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::pt
return CELL_OK;
}
s32 cellGifDecClose(u32 mainHandle, u32 subHandle)
s32 cellGifDecClose(CellGifDecMainHandle mainHandle, CellGifDecSubHandle subHandle)
{
cellGifDec.Warning("cellGifDecClose(mainHandle=0x%x, subHandle=0x%x)", mainHandle, subHandle);
const auto subHandle_data = Emu.GetIdManager().get<CellGifDecSubHandle>(subHandle);
const auto subHandle_data = Emu.GetIdManager().get<GifStream>(subHandle);
if (!subHandle_data)
{
@ -286,7 +310,7 @@ s32 cellGifDecClose(u32 mainHandle, u32 subHandle)
return CELL_OK;
}
s32 cellGifDecDestroy(u32 mainHandle)
s32 cellGifDecDestroy(CellGifDecMainHandle mainHandle)
{
UNIMPLEMENTED_FUNC(cellGifDec);
return CELL_OK;

View File

@ -13,43 +13,96 @@ enum
CELL_GIFDEC_ERROR_CB_PARAM = 0x80611307,
};
enum CellGifDecStreamSrcSel
enum CellGifDecStreamSrcSel : s32
{
CELL_GIFDEC_FILE = 0, // Input from a file
CELL_GIFDEC_BUFFER = 1, // Input from a buffer
};
enum CellGifDecSpuThreadEna
enum CellGifDecSpuThreadEna : s32
{
CELL_GIFDEC_SPU_THREAD_DISABLE = 0, // Do not use SPU threads
CELL_GIFDEC_SPU_THREAD_ENABLE = 1, // Use SPU threads
};
enum CellGifDecRecordType
enum CellGifDecRecordType : s32
{
CELL_GIFDEC_RECORD_TYPE_IMAGE_DESC = 1, // Image data block
CELL_GIFDEC_RECORD_TYPE_EXTENSION = 2, // Extension block
CELL_GIFDEC_RECORD_TYPE_TERMINATE = 3, // Trailer block
};
enum CellGifDecColorSpace
enum CellGifDecColorSpace : s32
{
CELL_GIFDEC_RGBA = 10, // RGBA
CELL_GIFDEC_ARGB = 20, // ARGB
};
enum CellGifDecCommand
enum CellGifDecCommand : s32
{
CELL_GIFDEC_CONTINUE = 0, // Continue decoding
CELL_GIFDEC_STOP = 1, // Force decoding to stop
};
enum CellGifDecDecodeStatus
enum CellGifDecDecodeStatus : s32
{
CELL_GIFDEC_DEC_STATUS_FINISH = 0, // Decoding finished
CELL_GIFDEC_DEC_STATUS_STOP = 1, // Decoding was stopped
};
// Handles
using CellGifDecMainHandle = vm::ptr<struct GifDecoder>;
using CellGifDecSubHandle = u32; // vm::ptr<struct GifStream>;
// Callbacks for memory management
using CellGifDecCbControlMalloc = func_def<vm::ptr<void>(u32 size, vm::ptr<void> cbCtrlMallocArg)>;
using CellGifDecCbControlFree = func_def<s32(vm::ptr<void> ptr, vm::ptr<void> cbCtrlFreeArg)>;
// Structs
struct CellGifDecThreadInParam
{
be_t<s32> spuThreadEnable; // CellGifDecSpuThreadEna
be_t<u32> ppuThreadPriority;
be_t<u32> spuThreadPriority;
vm::bptr<CellGifDecCbControlMalloc> cbCtrlMallocFunc;
vm::bptr<void> cbCtrlMallocArg;
vm::bptr<CellGifDecCbControlFree> cbCtrlFreeFunc;
vm::bptr<void> cbCtrlFreeArg;
};
struct CellGifDecThreadOutParam
{
be_t<u32> gifCodecVersion;
};
struct CellGifDecExtThreadInParam
{
vm::bptr<struct CellSpurs> spurs;
u8 priority[8];
be_t<u32> maxContention;
};
struct CellGifDecExtThreadOutParam
{
be_t<u64> reserved;
};
struct CellGifDecSrc
{
be_t<s32> srcSelect; // CellGifDecStreamSrcSel
vm::bptr<const char> fileName;
be_t<s64> fileOffset;
be_t<u32> fileSize;
vm::bptr<void> streamPtr;
be_t<u32> streamSize;
be_t<s32> spuThreadEnable; // CellGifDecSpuThreadEna
};
struct CellGifDecOpnInfo
{
be_t<u32> initSpaceAllocated;
};
struct CellGifDecInfo
{
be_t<u32> SWidth;
@ -62,21 +115,10 @@ struct CellGifDecInfo
be_t<u32> SPixelAspectRatio;
};
struct CellGifDecSrc
{
be_t<u32> srcSelect;
vm::bptr<const char> fileName;
be_t<s64> fileOffset;
be_t<u64> fileSize;
be_t<u32> streamPtr;
be_t<u32> streamSize;
be_t<u32> spuThreadEnable;
};
struct CellGifDecInParam
{
be_t<u32> commandPtr;
be_t<u32> colorSpace; // CellGifDecColorSpace
vm::bptr<volatile s32> commandPtr; // CellGifDecCommand
be_t<s32> colorSpace; // CellGifDecColorSpace
u8 outputColorAlpha1;
u8 outputColorAlpha2;
u8 reserved[2];
@ -89,7 +131,7 @@ struct CellGifDecOutParam
be_t<u32> outputHeight;
be_t<u32> outputComponents;
be_t<u32> outputBitDepth;
be_t<u32> outputColorSpace; // CellGifDecColorSpace
be_t<s32> outputColorSpace; // CellGifDecColorSpace
be_t<u32> useMemorySpace;
};
@ -101,14 +143,9 @@ struct CellGifDecExtension
struct CellGifDecDataOutInfo
{
be_t<u32> recordType;
be_t<s32> recordType; // CellGifDecRecordType
CellGifDecExtension outExtension;
be_t<u32> status;
};
struct CellGifDecOpnInfo
{
be_t<u32> initSpaceAllocated;
be_t<s32> status; // CellGifDecDecodeStatus
};
struct CellGifDecDataCtrlParam
@ -117,7 +154,11 @@ struct CellGifDecDataCtrlParam
};
//Custom structs
struct CellGifDecSubHandle
struct GifDecoder
{
};
struct GifStream
{
u32 fd;
u64 fileSize;

View File

@ -6,9 +6,6 @@ enum : u32
PNGDEC_CODEC_VERSION = 0x00420000,
};
using CellPngDecMainHandle = vm::ptr<struct PngDecoder>;
using CellPngDecSubHandle = vm::ptr<struct PngStream>;
// Return Codes
enum
{
@ -83,9 +80,13 @@ enum CellPngDecDecodeStatus : s32
CELL_PNGDEC_DEC_STATUS_STOP = 1,
};
// Handles
using CellPngDecMainHandle = vm::ptr<struct PngDecoder>;
using CellPngDecSubHandle = vm::ptr<struct PngStream>;
// Callbacks for memory management
typedef vm::ptr<void>(CellPngDecCbControlMalloc)(u32 size, vm::ptr<void> cbCtrlMallocArg);
typedef s32(CellPngDecCbControlFree)(vm::ptr<void> ptr, vm::ptr<void> cbCtrlFreeArg);
using CellPngDecCbControlMalloc = func_def<vm::ptr<void>(u32 size, vm::ptr<void> cbCtrlMallocArg)>;
using CellPngDecCbControlFree = func_def<s32(vm::ptr<void> ptr, vm::ptr<void> cbCtrlFreeArg)>;
// Structs
struct CellPngDecThreadInParam
@ -179,47 +180,6 @@ struct CellPngDecDataOutInfo
be_t<s32> status; // CellPngDecDecodeStatus
};
// Functions
s32 cellPngDecCreate(
vm::ptr<CellPngDecMainHandle> mainHandle,
vm::ptr<const CellPngDecThreadInParam> threadInParam,
vm::ptr<CellPngDecThreadOutParam> threadOutParam);
s32 cellPngDecExtCreate(
vm::ptr<CellPngDecMainHandle> mainHandle,
vm::ptr<const CellPngDecThreadInParam> threadInParam,
vm::ptr<CellPngDecThreadOutParam> threadOutParam,
vm::ptr<const CellPngDecExtThreadInParam> extThreadInParam,
vm::ptr<CellPngDecExtThreadOutParam> extThreadOutParam);
s32 cellPngDecOpen(
CellPngDecMainHandle mainHandle,
vm::ptr<CellPngDecSubHandle> subHandle,
vm::ptr<const CellPngDecSrc> src,
vm::ptr<CellPngDecOpnInfo> openInfo);
s32 cellPngDecReadHeader(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<CellPngDecInfo> info);
s32 cellPngDecSetParameter(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<const CellPngDecInParam> inParam,
vm::ptr<CellPngDecOutParam> outParam);
s32 cellPngDecDecodeData(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<u8> data,
vm::ptr<const CellPngDecDataCtrlParam> dataCtrlParam,
vm::ptr<CellPngDecDataOutInfo> dataOutInfo);
s32 cellPngDecClose(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle);
s32 cellPngDecDestroy(CellPngDecMainHandle mainHandle);
// Defines for decoding partial streams
enum CellPngDecBufferMode : s32
{
@ -288,8 +248,8 @@ struct CellPngDecExtOutParam
};
// Callbacks for decoding partial streams
typedef s32(CellPngDecCbControlStream)(vm::ptr<CellPngDecStrmInfo> strmInfo, vm::ptr<CellPngDecStrmParam> strmParam, vm::ptr<void> cbCtrlStrmArg);
typedef s32(CellPngDecCbControlDisp)(vm::ptr<CellPngDecDispInfo> dispInfo, vm::ptr<CellPngDecDispParam> dispParam, vm::ptr<void> cbCtrlDispArg);
using CellPngDecCbControlStream = func_def<s32(vm::ptr<CellPngDecStrmInfo> strmInfo, vm::ptr<CellPngDecStrmParam> strmParam, vm::ptr<void> cbCtrlStrmArg)>;
using CellPngDecCbControlDisp = func_def<s32(vm::ptr<CellPngDecDispInfo> dispInfo, vm::ptr<CellPngDecDispParam> dispParam, vm::ptr<void> cbCtrlDispArg)>;
struct CellPngDecCbCtrlStrm
{
@ -303,73 +263,6 @@ struct CellPngDecCbCtrlDisp
vm::bptr<void> cbCtrlDispArg;
};
// Functions for decoding partial streams
s32 cellPngDecExtOpen(
CellPngDecMainHandle mainHandle,
vm::ptr<CellPngDecSubHandle> subHandle,
vm::ptr<const CellPngDecSrc> src,
vm::ptr<CellPngDecOpnInfo> openInfo,
vm::ptr<const CellPngDecCbCtrlStrm> cbCtrlStrm,
vm::ptr<const CellPngDecOpnParam> opnParam);
s32 cellPngDecExtReadHeader(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<CellPngDecInfo> info,
vm::ptr<CellPngDecExtInfo> extInfo);
s32 cellPngDecExtSetParameter(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<const CellPngDecInParam> inParam,
vm::ptr<CellPngDecOutParam> outParam,
vm::ptr<const CellPngDecExtInParam> extInParam,
vm::ptr<CellPngDecExtOutParam> extOutParam);
s32 cellPngDecExtDecodeData(
CellPngDecMainHandle mainHandle,
CellPngDecSubHandle subHandle,
vm::ptr<u8> data,
vm::ptr<const CellPngDecDataCtrlParam> dataCtrlParam,
vm::ptr<CellPngDecDataOutInfo> dataOutInfo,
vm::ptr<const CellPngDecCbCtrlDisp> cbCtrlDisp,
vm::ptr<CellPngDecDispParam> dispParam);
// Functions for accessing ancillary chunks
s32 cellPngDecGetTextChunk(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<u32> textInfoNum, vm::ptr<vm::bptr<CellPngTextInfo>> textInfo);
s32 cellPngDecGetPLTE(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPLTE> plte);
s32 cellPngDecGetgAMA(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngGAMA> gama);
s32 cellPngDecGetsRGB(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSRGB> srgb);
s32 cellPngDecGetiCCP(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngICCP> iccp);
s32 cellPngDecGetsBIT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSBIT> sbit);
s32 cellPngDecGettRNS(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTRNS> trns);
s32 cellPngDecGethIST(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngHIST> hist);
s32 cellPngDecGettIME(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngTIME> time);
s32 cellPngDecGetbKGD(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngBKGD> bkgd);
s32 cellPngDecGetsPLT(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSPLT> splt);
s32 cellPngDecGetoFFs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngOFFS> offs);
s32 cellPngDecGetpHYs(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPHYS> phys);
s32 cellPngDecGetsCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngSCAL> scal);
s32 cellPngDecGetcHRM(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngCHRM> chrm);
s32 cellPngDecGetpCAL(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<CellPngPCAL> pcal);
s32 cellPngDecGetUnknownChunks(CellPngDecMainHandle mainHandle, CellPngDecSubHandle subHandle, vm::ptr<vm::bptr<CellPngUnknownChunk>> unknownChunk, vm::ptr<u32> unknownChunkNumber);
// Custom structs
struct PngDecoder
{
@ -392,4 +285,4 @@ struct PngStream
CellPngDecStrmInfo streamInfo;
CellPngDecStrmParam streamParam;
};
};