diff --git a/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp b/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp index a1efb70795..ec4eaba667 100644 --- a/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp +++ b/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp @@ -1,70 +1,83 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Emu/Cell/PPUModule.h" +#include "cellPngEnc.h" LOG_CHANNEL(cellPngEnc); -// Error Codes -enum +template <> +void fmt_class_string::format(std::string& out, u64 arg) { - CELL_PNGENC_ERROR_ARG = 0x80611291, - CELL_PNGENC_ERROR_SEQ = 0x80611292, - CELL_PNGENC_ERROR_BUSY = 0x80611293, - CELL_PNGENC_ERROR_EMPTY = 0x80611294, - CELL_PNGENC_ERROR_RESET = 0x80611295, - CELL_PNGENC_ERROR_FATAL = 0x80611296, -}; + format_enum(out, arg, [](CellPngEncError value) + { + switch (value) + { + STR_CASE(CELL_PNGENC_ERROR_ARG); + STR_CASE(CELL_PNGENC_ERROR_SEQ); + STR_CASE(CELL_PNGENC_ERROR_BUSY); + STR_CASE(CELL_PNGENC_ERROR_EMPTY); + STR_CASE(CELL_PNGENC_ERROR_RESET); + STR_CASE(CELL_PNGENC_ERROR_FATAL); + STR_CASE(CELL_PNGENC_ERROR_STREAM_ABORT); + STR_CASE(CELL_PNGENC_ERROR_STREAM_SKIP); + STR_CASE(CELL_PNGENC_ERROR_STREAM_OVERFLOW); + STR_CASE(CELL_PNGENC_ERROR_STREAM_FILE_OPEN); + } -s32 cellPngEncQueryAttr() + return unknown; + }); +} + +error_code cellPngEncQueryAttr(vm::cptr config, vm::ptr attr) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncQueryAttr(config=*0x%x, attr=*0x%x)", config, attr); return CELL_OK; } -s32 cellPngEncOpen() +error_code cellPngEncOpen(vm::cptr config, vm::cptr resource, vm::pptr handle) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncOpen(config=*0x%x, resource=*0x%x, handle=*0x%x)", config, resource, handle); return CELL_OK; } -s32 cellPngEncOpenEx() +error_code cellPngEncOpenEx(vm::cptr config, vm::cptr resourceEx, vm::pptr handle) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncOpenEx(config=*0x%x, resourceEx=*0x%x, handle=*0x%x)", config, resourceEx, handle); return CELL_OK; } -s32 cellPngEncClose() +error_code cellPngEncClose(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncClose(handle=*0x%x)", handle); return CELL_OK; } -s32 cellPngEncWaitForInput() +error_code cellPngEncWaitForInput(vm::ptr handle, b8 block) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncWaitForInput(handle=*0x%x, block=%d)", handle, block); return CELL_OK; } -s32 cellPngEncEncodePicture() +error_code cellPngEncEncodePicture(vm::ptr handle, vm::cptr picture, vm::cptr encodeParam, vm::cptr outputParam) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncEncodePicture(handle=*0x%x, picture=*0x%x, encodeParam=*0x%x, outputParam=*0x%x)", handle, picture, encodeParam, outputParam); return CELL_OK; } -s32 cellPngEncWaitForOutput() +error_code cellPngEncWaitForOutput(vm::ptr handle, vm::ptr streamInfoNum, b8 block) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncWaitForOutput(handle=*0x%x, streamInfoNum=*0x%x, block=%d)", handle, streamInfoNum, block); return CELL_OK; } -s32 cellPngEncGetStreamInfo() +error_code cellPngEncGetStreamInfo(vm::ptr handle, vm::ptr streamInfo) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncGetStreamInfo(handle=*0x%x, streamInfo=*0x%x)", handle, streamInfo); return CELL_OK; } -s32 cellPngEncReset() +error_code cellPngEncReset(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellPngEnc); + cellPngEnc.todo("cellPngEncReset(handle=*0x%x)", handle); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellPngEnc.h b/rpcs3/Emu/Cell/Modules/cellPngEnc.h new file mode 100644 index 0000000000..9940795f0c --- /dev/null +++ b/rpcs3/Emu/Cell/Modules/cellPngEnc.h @@ -0,0 +1,169 @@ +#pragma once + +// Error Codes +enum CellPngEncError +{ + CELL_PNGENC_ERROR_ARG = 0x80611291, + CELL_PNGENC_ERROR_SEQ = 0x80611292, + CELL_PNGENC_ERROR_BUSY = 0x80611293, + CELL_PNGENC_ERROR_EMPTY = 0x80611294, + CELL_PNGENC_ERROR_RESET = 0x80611295, + CELL_PNGENC_ERROR_FATAL = 0x80611296, + CELL_PNGENC_ERROR_STREAM_ABORT = 0x806112A1, + CELL_PNGENC_ERROR_STREAM_SKIP = 0x806112A2, + CELL_PNGENC_ERROR_STREAM_OVERFLOW = 0x806112A3, + CELL_PNGENC_ERROR_STREAM_FILE_OPEN = 0x806112A4, +}; + +enum CellPngEncColorSpace +{ + CELL_PNGENC_COLOR_SPACE_GRAYSCALE = 1, + CELL_PNGENC_COLOR_SPACE_RGB = 2, + CELL_PNGENC_COLOR_SPACE_PALETTE = 4, + CELL_PNGENC_COLOR_SPACE_GRAYSCALE_ALPHA = 9, + CELL_PNGENC_COLOR_SPACE_RGBA = 10, + CELL_PNGENC_COLOR_SPACE_ARGB = 20 +}; + +enum CellPngEncCompressionLevel +{ + CELL_PNGENC_COMPR_LEVEL_0, + CELL_PNGENC_COMPR_LEVEL_1, + CELL_PNGENC_COMPR_LEVEL_2, + CELL_PNGENC_COMPR_LEVEL_3, + CELL_PNGENC_COMPR_LEVEL_4, + CELL_PNGENC_COMPR_LEVEL_5, + CELL_PNGENC_COMPR_LEVEL_6, + CELL_PNGENC_COMPR_LEVEL_7, + CELL_PNGENC_COMPR_LEVEL_8, + CELL_PNGENC_COMPR_LEVEL_9 +}; + +enum CellPngEncFilterType +{ + CELL_PNGENC_FILTER_TYPE_NONE = 0x08, + CELL_PNGENC_FILTER_TYPE_SUB = 0x10, + CELL_PNGENC_FILTER_TYPE_UP = 0x20, + CELL_PNGENC_FILTER_TYPE_AVG = 0x40, + CELL_PNGENC_FILTER_TYPE_PAETH = 0x80, + CELL_PNGENC_FILTER_TYPE_ALL = 0xF8 +}; + +enum CellPngEncChunkType +{ + CELL_PNGENC_CHUNK_TYPE_PLTE, + CELL_PNGENC_CHUNK_TYPE_TRNS, + CELL_PNGENC_CHUNK_TYPE_CHRM, + CELL_PNGENC_CHUNK_TYPE_GAMA, + CELL_PNGENC_CHUNK_TYPE_ICCP, + CELL_PNGENC_CHUNK_TYPE_SBIT, + CELL_PNGENC_CHUNK_TYPE_SRGB, + CELL_PNGENC_CHUNK_TYPE_TEXT, + CELL_PNGENC_CHUNK_TYPE_BKGD, + CELL_PNGENC_CHUNK_TYPE_HIST, + CELL_PNGENC_CHUNK_TYPE_PHYS, + CELL_PNGENC_CHUNK_TYPE_SPLT, + CELL_PNGENC_CHUNK_TYPE_TIME, + CELL_PNGENC_CHUNK_TYPE_OFFS, + CELL_PNGENC_CHUNK_TYPE_PCAL, + CELL_PNGENC_CHUNK_TYPE_SCAL, + CELL_PNGENC_CHUNK_TYPE_UNKNOWN +}; + +enum CellPngEncLocation +{ + CELL_PNGENC_LOCATION_FILE, + CELL_PNGENC_LOCATION_BUFFER +}; + +//typedef void *CellPngEncHandle; + +struct CellPngEncExParam +{ + be_t index; + vm::bptr value; +}; + +struct CellPngEncConfig +{ + be_t maxWidth; + be_t maxHeight; + be_t maxBitDepth; + b8 enableSpu; + be_t addMemSize; + vm::bptr exParamList; + be_t exParamNum; +}; + +struct CellPngEncAttr +{ + be_t memSize; // size_t + u8 cmdQueueDepth; + be_t versionUpper; + be_t versionLower; +}; + +struct CellPngEncResource +{ + vm::bptr memAddr; + be_t memSize; // size_t + be_t ppuThreadPriority; + be_t spuThreadPriority; +}; + +struct CellPngEncResourceEx +{ + vm::bptr memAddr; + be_t memSize; // size_t + be_t ppuThreadPriority; + vm::bptr spurs; // CellSpurs + u8 priority[8]; +}; + +struct CellPngEncPicture +{ + be_t width; + be_t height; + be_t pitchWidth; + be_t colorSpace; // CellPngEncColorSpace + be_t bitDepth; + b8 packedPixel; + vm::bptr pictureAddr; + be_t userData; +}; + +struct CellPngEncAncillaryChunk +{ + be_t chunkType; // CellPngEncChunkType + vm::bptr chunkData; +}; + +struct CellPngEncEncodeParam +{ + b8 enableSpu; + be_t encodeColorSpace; // CellPngEncColorSpace + be_t compressionLevel; // CellPngEncCompressionLevel + be_t filterType; + vm::bptr ancillaryChunkList; + be_t ancillaryChunkNum; +}; + +struct CellPngEncOutputParam +{ + be_t location; // CellPngEncLocation + vm::bcptr streamFileName; + vm::bptr streamAddr; + be_t limitSize; // size_t +}; + +struct CellPngEncStreamInfo +{ + be_t state; + be_t location; // CellPngEncLocation + vm::bcptr streamFileName; + vm::bptr streamAddr; + be_t limitSize; // size_t + be_t streamSize; // size_t + be_t processedLine; + be_t userData; +}; diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index a0c2e9e06c..2c0d5802b6 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -509,6 +509,7 @@ + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 0a600642ae..6f4a6621c5 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -1357,6 +1357,9 @@ Emu\Cell\Modules + + Emu\Cell\Modules + Emu\Cell\Modules