diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp index e191eea5e0..b354b86f5e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.cpp @@ -3,7 +3,9 @@ #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/Modules.h" - +#include "Emu/SysCalls/lv2/sys_cond.h" +#include "Emu/SysCalls/lv2/sys_mutex.h" +#include "cellSpurs.h" #include "cellSail.h" Module *cellSail = nullptr; diff --git a/rpcs3/Emu/SysCalls/Modules/cellSail.h b/rpcs3/Emu/SysCalls/Modules/cellSail.h index 924567b65b..89a3155e7b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSail.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSail.h @@ -3,16 +3,579 @@ // Error Codes enum { - CELL_SAIL_ERROR_INVALID_ARG = 0x80610701, - CELL_SAIL_ERROR_INVALID_STATE = 0x80610702, + CELL_SAIL_ERROR_INVALID_ARG = 0x80610701, + CELL_SAIL_ERROR_INVALID_STATE = 0x80610702, CELL_SAIL_ERROR_UNSUPPORTED_STREAM = 0x80610703, CELL_SAIL_ERROR_INDEX_OUT_OF_RANGE = 0x80610704, - CELL_SAIL_ERROR_EMPTY = 0x80610705, - CELL_SAIL_ERROR_FULLED = 0x80610706, - CELL_SAIL_ERROR_USING = 0x80610707, - CELL_SAIL_ERROR_NOT_AVAILABLE = 0x80610708, - CELL_SAIL_ERROR_CANCEL = 0x80610709, - CELL_SAIL_ERROR_MEMORY = 0x806107F0, - CELL_SAIL_ERROR_INVALID_FD = 0x806107F1, - CELL_SAIL_ERROR_FATAL = 0x806107FF, + CELL_SAIL_ERROR_EMPTY = 0x80610705, + CELL_SAIL_ERROR_FULLED = 0x80610706, + CELL_SAIL_ERROR_USING = 0x80610707, + CELL_SAIL_ERROR_NOT_AVAILABLE = 0x80610708, + CELL_SAIL_ERROR_CANCEL = 0x80610709, + CELL_SAIL_ERROR_MEMORY = 0x806107F0, + CELL_SAIL_ERROR_INVALID_FD = 0x806107F1, + CELL_SAIL_ERROR_FATAL = 0x806107FF, }; + +struct CellSailAudioFormat +{ + s8 coding; + s8 chNum; + be_t sampleNum; + be_t fs; + be_t chLayout; + be_t reserved0; // Specify both -1 + be_t reserved1; +}; + +struct CellSailAudioFrameInfo +{ + be_t pPcm; + be_t status; + be_t pts; + be_t reserved; // Specify 0 +}; + +struct CellSailVideoFormat +{ + s8 coding; + s8 scan; + s8 bitsPerColor; + s8 frameRate; + be_t width; + be_t height; + be_t pitch; + be_t alpha; + s8 colorMatrix; + s8 aspectRatio; + s8 colorRange; + s8 reserved1; // Specify all three -1 + be_t reserved2; + be_t reserved3; +}; + +struct CellSailVideoFrameInfo +{ + be_t pPic; + be_t status; + be_t pts; + be_t reserved; // Specify both 0 + be_t interval; + u8 structure; + s8 repeatNum; + u8 reserved2[4]; +}; + +struct CellSailSourceBufferItem +{ + u8 pBuf; + be_t size; + be_t sessionId; + be_t reserved; // Specify 0 +}; + +struct CellSailSourceStartCommand +{ + be_t startFlags; + be_t startArg; + be_t lengthArg; + be_t optionalArg0; + be_t optionalArg1; +}; + +struct CellSailSourceStreamingProfile +{ + be_t reserved0; // Specify 0 + be_t numItems; + be_t maxBitrate; + be_t reserved1; // Specify 0 + be_t duration; + be_t streamSize; +}; + +union CellSailEvent +{ + struct u32x2 { + be_t major; + be_t minor; + }; + + struct ui64 { + be_t value; + }; +}; + +typedef void(*CellSailMemAllocatorFuncAlloc)(u32 pArg, u32 boundary, u32 size); +typedef void(*CellSailMemAllocatorFuncFree)(u32 pArg, u32 boundary, u32 pMemory); + +typedef int(*CellSailSoundAdapterFuncMakeup)(u32 pArg); +typedef int(*CellSailSoundAdapterFuncCleanup)(u32 pArg); +typedef void(*CellSailSoundAdapterFuncFormatChanged)(u32 pArg, mem_ptr_t pFormat, u32 sessionId); + +typedef int(*CellSailGraphicsAdapterFuncMakeup)(u32 pArg); +typedef int(*CellSailGraphicsAdapterFuncCleanup)(u32 pArg); +typedef void(*CellSailGraphicsAdapterFuncFormatChanged)(u32 pArg, mem_ptr_t pFormat, u32 sessionId); +typedef int(*CellSailGraphicsAdapterFuncAllocFrame)(u32 pArg, u32 size, s32 num, u8 ppFrame); +typedef int(*CellSailGraphicsAdapterFuncFreeFrame)(u32 pArg, s32 num, u8 ppFrame); + +typedef int(*CellSailSourceFuncMakeup)(u32 pArg, s8 pProtocolNames); +typedef int(*CellSailSourceFuncCleanup)(u32 pArg); +typedef void(*CellSailSourceFuncOpen)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, mem_ptr_t pProfile); +typedef void(*CellSailSourceFuncClose)(u32 pArg); +typedef void(*CellSailSourceFuncStart)(u32 pArg, mem_ptr_t pCommand, u32 sessionId); +typedef void(*CellSailSourceFuncStop)(u32 pArg); +typedef void(*CellSailSourceFuncCancel)(u32 pArg); +typedef int(*CellSailSourceFuncCheckout)(u32 pArg, mem_ptr_t ppItem); +typedef int(*CellSailSourceFuncCheckin)(u32 pArg, mem_ptr_t pItem); +typedef int(*CellSailSourceFuncClear)(u32 pArg); +typedef int(*CellSailSourceFuncRead)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, u64 offset, u8 pBuf, u32 size, u64 pTotalSize); +typedef int(*CellSailSourceFuncReadSync)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, u64 offset, u8 pBuf, u32 size, u64 pTotalSize); +typedef int(*CellSailSourceFuncGetCapabilities)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, u64 pCapabilities); +typedef int(*CellSailSourceFuncInquireCapability)(u32 pArg, s32 streamType, u32 pMediaInfo, s8 pUri, mem_ptr_t pCommand); +typedef void(*CellSailSourceCheckFuncError)(u32 pArg, s8 pMsg, s32 line); + +typedef int(*CellSailFsFuncOpen)(s8 pPath, s32 flag, s32 pFd, u32 pArg, u64 size); +typedef int(*CellSailFsFuncOpenSecond)(s8 pPath, s32 flag, s32 fd, u32 pArg, u64 size); +typedef int(*CellSailFsFuncClose)(s32 fd); +typedef int(*CellSailFsFuncFstat)(s32 fd, mem_ptr_t pStat); +typedef int(*CellSailFsFuncRead)(s32 fd, u32 pBuf, u64 numBytes, u64 pNumRead); +typedef int(*CellSailFsFuncLseek)(s32 fd, s64 offset, s32 whence, u64 pPosition); +typedef int(*CellSailFsFuncCancel)(s32 fd); + +typedef int(*CellSailRendererAudioFuncMakeup)(u32 pArg); +typedef int(*CellSailRendererAudioFuncCleanup)(u32 pArg); +typedef void(*CellSailRendererAudioFuncOpen)(u32 pArg, mem_ptr_t pInfo, u32 frameNum); +typedef void(*CellSailRendererAudioFuncClose)(u32 pArg); +typedef void(*CellSailRendererAudioFuncStart)(u32 pArg, bool buffering); +typedef void(*CellSailRendererAudioFuncStop)(u32 pArg, bool flush); +typedef void(*CellSailRendererAudioFuncCancel)(u32 pArg); +typedef int(*CellSailRendererAudioFuncCheckout)(u32 pArg, mem_ptr_t ppInfo); +typedef int(*CellSailRendererAudioFuncCheckin)(u32 pArg, mem_ptr_t pInfo); + +typedef int(*CellSailRendererVideoFuncMakeup)(u32 pArg); +typedef int(*CellSailRendererVideoFuncCleanup)(u32 pArg); +typedef void(*CellSailRendererVideoFuncOpen)(u32 pArg, mem_ptr_t pInfo, u32 frameNum, u32 minFrameNum); +typedef void(*CellSailRendererVideoFuncClose)(u32 pArg); +typedef void(*CellSailRendererVideoFuncStart)(u32 pArg, bool buffering); +typedef void(*CellSailRendererVideoFuncStop)(u32 pArg, bool flush, bool keepRendering); +typedef void(*CellSailRendererVideoFuncCancel)(u32 pArg); +typedef int(*CellSailRendererVideoFuncCheckout)(u32 pArg, mem_ptr_t ppInfo); +typedef int(*CellSailRendererVideoFuncCheckin)(u32 pArg, mem_ptr_t pInfo); + +typedef void(*CellSailPlayerFuncNotified)(u32 pArg, mem_ptr_t event, u64 arg0, u64 arg1); + +struct CellSailMemAllocatorFuncs +{ + CellSailMemAllocatorFuncAlloc pAlloc; + CellSailMemAllocatorFuncFree pFree; +}; + +struct CellSailMemAllocator +{ + CellSailMemAllocatorFuncs callbacks; + be_t pArg; +}; + +struct CellSailFuture +{ + u32 mutex_id; + u32 cond_id; + volatile be_t flags; + be_t result; + be_t userParam; +}; + +struct CellSailSoundAdapterFuncs +{ + CellSailSoundAdapterFuncMakeup pMakeup; + CellSailSoundAdapterFuncCleanup pCleanup; + CellSailSoundAdapterFuncFormatChanged pFormatChanged; +}; + +struct CellSailSoundFrameInfo +{ + be_t pBuffer; + be_t sessionId; + be_t tag; + be_t status; + be_t pts; +}; + +struct CellSailSoundAdapter +{ + be_t internalData[32]; +}; + +struct CellSailGraphicsAdapterFuncs +{ + CellSailGraphicsAdapterFuncMakeup pMakeup; + CellSailGraphicsAdapterFuncCleanup pCleanup; + CellSailGraphicsAdapterFuncFormatChanged pFormatChanged; + CellSailGraphicsAdapterFuncAllocFrame pAlloc; + CellSailGraphicsAdapterFuncFreeFrame pFree; +}; + +struct CellSailGraphicsFrameInfo +{ + be_t pBuffer; + be_t sessionId; + be_t tag; + be_t status; + be_t pts; +}; + +struct CellSailGraphicsAdapter +{ + be_t internalData[32]; +}; + +struct CellSailAuInfo +{ + be_t pAu; + be_t size; + be_t status; + be_t sessionId; + be_t pts; + be_t dts; + be_t reserved; // Specify 0 +}; + +struct CellSailAuReceiver +{ + be_t internalData[64]; +}; + +struct CellSailRendererAudioFuncs +{ + CellSailRendererAudioFuncMakeup pMakeup; + CellSailRendererAudioFuncCleanup pCleanup; + CellSailRendererAudioFuncOpen pOpen; + CellSailRendererAudioFuncClose pClose; + CellSailRendererAudioFuncStart pStart; + CellSailRendererAudioFuncStop pStop; + CellSailRendererAudioFuncCancel pCancel; + CellSailRendererAudioFuncCheckout pCheckout; + CellSailRendererAudioFuncCheckin pCheckin; +}; + +struct CellSailRendererAudioAttribute +{ + be_t thisSize; + CellSailAudioFormat pPreferredFormat; +}; + +struct CellSailRendererAudio +{ + be_t internalData[32]; +}; + +struct CellSailRendererVideoFuncs +{ + CellSailRendererVideoFuncMakeup pMakeup; + CellSailRendererVideoFuncCleanup pCleanup; + CellSailRendererVideoFuncOpen pOpen; + CellSailRendererVideoFuncClose pClose; + CellSailRendererVideoFuncStart pStart; + CellSailRendererVideoFuncStop pStop; + CellSailRendererVideoFuncCancel pCancel; + CellSailRendererVideoFuncCheckout pCheckout; + CellSailRendererVideoFuncCheckin pCheckin; +}; + +struct CellSailRendererVideoAttribute +{ + be_t thisSize; + CellSailVideoFormat *pPreferredFormat; +}; + +struct CellSailRendererVideo +{ + be_t internalData[32]; +}; + +struct CellSailSourceFuncs +{ + CellSailSourceFuncMakeup pMakeup; + CellSailSourceFuncCleanup pCleanup; + CellSailSourceFuncOpen pOpen; + CellSailSourceFuncClose pClose; + CellSailSourceFuncStart pStart; + CellSailSourceFuncStop pStop; + CellSailSourceFuncCancel pCancel; + CellSailSourceFuncCheckout pCheckout; + CellSailSourceFuncCheckin pCheckin; + CellSailSourceFuncClear pClear; + CellSailSourceFuncRead pRead; + CellSailSourceFuncReadSync pReadSync; + CellSailSourceFuncGetCapabilities pGetCapabilities; + CellSailSourceFuncInquireCapability pInquireCapability; +}; + +struct CellSailSource +{ + be_t internalData[20]; +}; + +struct CellSailSourceCheckStream +{ + be_t streamType; + be_t pMediaInfo; + s8 pUri; +}; + +struct CellSailSourceCheckResource +{ + CellSailSourceCheckStream ok; + CellSailSourceCheckStream readError; + CellSailSourceCheckStream openError; + CellSailSourceCheckStream startError; + CellSailSourceCheckStream runningError; +}; + +struct CellSailMp4DateTime +{ + be_t second; + be_t minute; + be_t hour; + be_t day; + be_t month; + be_t year; + //be_t reserved0; + //be_t reserved1; +}; + +struct CellSailMp4Movie +{ + be_t internalData[16]; +}; + +struct CellSailMp4MovieInfo +{ + CellSailMp4DateTime creationDateTime; + CellSailMp4DateTime modificationDateTime; + be_t trackCount; + be_t movieTimeScale; + be_t movieDuration; + //be_t reserved[16]; +}; + +struct CellSailMp4Track +{ + be_t internalData[6]; +}; + +struct CellSailMp4TrackInfo +{ + bool isTrackEnabled; + u8 reserved0[3]; + be_t trackId; + be_t trackDuration; + be_t layer; + be_t alternateGroup; + be_t reserved1[2]; + be_t trackWidth; + be_t trackHeight; + be_t language; + be_t reserved2; + be_t mediaType; + //be_t reserved3[3]; +}; + +struct CellSailAviMovie +{ + be_t internalData[16]; +}; + +struct CellSailAviMovieInfo +{ + be_t maxBytesPerSec; + be_t flags; + be_t reserved0; + be_t streams; + be_t suggestedBufferSize; + be_t width; + be_t height; + be_t scale; + be_t rate; + be_t length; + //be_t reserved1; + //be_t reserved2; +}; + +struct CellSailAviMainHeader +{ + be_t microSecPerFrame; + be_t maxBytesPerSec; + be_t paddingGranularity; + be_t flags; + be_t totalFrames; + be_t initialFrames; + be_t streams; + be_t suggestedBufferSize; + be_t width; + be_t height; + //be_t reserved[4]; +}; + +struct CellSailAviExtendedHeader +{ + be_t totalFrames; +}; + +struct CellSailAviStream +{ + be_t internalData[2]; +}; + +struct CellSailAviMediaType +{ + be_t fccType; + be_t fccHandler; + union u { + struct audio { + be_t formatTag; + be_t reserved; // Specify 0 + union u { + struct mpeg { + be_t headLayer; // Specify 0 + be_t reserved; // Specify 0 + }; + }; + }; + struct video { + be_t compression; + be_t reserved; // Specify 0 + }; + }; +}; + +struct CellSailAviStreamHeader +{ + be_t fccType; + be_t fccHandler; + be_t flags; + be_t priority; + be_t initialFrames; + be_t scale; + be_t rate; + be_t start; + be_t length; + be_t suggestedBufferSize; + be_t quality; + be_t sampleSize; + struct frame { + be_t left; + be_t top; + be_t right; + be_t bottom; + }; +}; + +struct CellSailBitmapInfoHeader +{ + be_t size; + be_t width; + be_t height; + be_t planes; + be_t bitCount; + be_t compression; + be_t sizeImage; + be_t xPelsPerMeter; + be_t yPelsPerMeter; + be_t clrUsed; + be_t clrImportant; +}; + +struct CellSailWaveFormatEx +{ + be_t formatTag; + be_t channels; + be_t samplesPerSec; + be_t avgBytesPerSec; + be_t blockAlign; + be_t bitsPerSample; + be_t cbSize; +}; + +struct CellSailMpeg1WaveFormat +{ + CellSailWaveFormatEx wfx; + be_t headLayer; + be_t headBitrate; + be_t headMode; + be_t headModeExt; + be_t headEmphasis; + be_t headFlags; + be_t PTSLow; + be_t PTSHigh; +}; + +struct CellSailMpegLayer3WaveFormat +{ + CellSailWaveFormatEx wfx; + be_t ID; + be_t flags; + be_t blockSize; + be_t framesPerBlock; + be_t codecDelay; +}; + +struct CellSailDescriptor +{ + be_t internalData[32]; +}; + +struct CellSailStartCommand +{ + be_t startType; + be_t seekType; + be_t terminusType; + be_t flags; + be_t startArg; + be_t reserved; + be_t seekArg; + be_t terminusArg; +}; + +struct CellSailFsReadFuncs +{ + CellSailFsFuncOpen pOpen; + CellSailFsFuncOpenSecond pOpenSecond; + CellSailFsFuncClose pClose; + CellSailFsFuncFstat pFstat; + CellSailFsFuncRead pRead; + CellSailFsFuncLseek pLseek; + CellSailFsFuncCancel pCancel; + be_t reserved[2]; // Specify 0 +}; + +struct CellSailFsRead +{ + be_t capability; + CellSailFsReadFuncs funcs; +}; + +struct CellSailPlayerAttribute +{ + be_t preset; + be_t maxAudioStreamNum; + be_t maxVideoStreamNum; + be_t maxUserStreamNum; + be_t queueDepth; + be_t reserved0; // All three specify 0 + be_t reserved1; + be_t reserved2; +}; + +struct CellSailPlayerResource +{ + CellSpurs pSpurs; + be_t reserved0; // All three specify 0 + be_t reserved1; + be_t reserved2; +}; + +struct CellSailPlayer +{ + be_t internalData[128]; +}; \ No newline at end of file