From 41505117a7f4c5c495c6d2adbefcb48d546fce5e Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sat, 16 Nov 2019 23:31:23 +0100 Subject: [PATCH] HLE: stub cellCelpEnc and cellCelp8Enc --- rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp | 59 +++++++++++------- rpcs3/Emu/Cell/Modules/cellCelp8Enc.h | 74 ++++++++++++++++++++--- rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp | 61 ++++++++++++------- rpcs3/Emu/Cell/Modules/cellCelpEnc.h | 80 +++++++++++++++++++++---- 4 files changed, 213 insertions(+), 61 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp b/rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp index b6c91acdb9..0c240c3fa8 100644 --- a/rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp +++ b/rpcs3/Emu/Cell/Modules/cellCelp8Enc.cpp @@ -1,63 +1,80 @@ -#include "stdafx.h" -#include "Emu/System.h" +#include "stdafx.h" #include "Emu/Cell/PPUModule.h" #include "cellCelp8Enc.h" LOG_CHANNEL(cellCelp8Enc); - -s32 cellCelp8EncQueryAttr() +template <> +void fmt_class_string::format(std::string& out, u64 arg) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + format_enum(out, arg, [](CellCelp8EncError value) + { + switch (value) + { + STR_CASE(CELL_CELP8ENC_ERROR_FAILED); + STR_CASE(CELL_CELP8ENC_ERROR_SEQ); + STR_CASE(CELL_CELP8ENC_ERROR_ARG); + STR_CASE(CELL_CELP8ENC_ERROR_CORE_FAILED); + STR_CASE(CELL_CELP8ENC_ERROR_CORE_SEQ); + STR_CASE(CELL_CELP8ENC_ERROR_CORE_ARG); + } + + return unknown; + }); +} + +error_code cellCelp8EncQueryAttr(vm::ptr attr) +{ + cellCelp8Enc.todo("cellCelp8EncQueryAttr(attr=*0x%x)", attr); return CELL_OK; } -s32 cellCelp8EncOpen() +error_code cellCelp8EncOpen(vm::ptr res, vm::pptr handle) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + cellCelp8Enc.todo("cellCelp8EncOpen(res=*0x%x, handle=*0x%x)", res, handle); return CELL_OK; } -s32 cellCelp8EncOpenEx() +error_code cellCelp8EncOpenEx(vm::ptr res, vm::pptr handle) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + cellCelp8Enc.todo("cellCelp8EncOpenEx(res=*0x%x, handle=*0x%x)", res, handle); return CELL_OK; } -s32 cellCelp8EncClose() +error_code cellCelp8EncClose(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + cellCelp8Enc.todo("cellCelp8EncClose(handle=*0x%x)", handle); return CELL_OK; } -s32 cellCelp8EncStart() +error_code cellCelp8EncStart(vm::ptr handle, vm::ptr param) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + cellCelp8Enc.todo("cellCelp8EncStart(handle=*0x%x, param=*0x%x)", handle, param); return CELL_OK; } -s32 cellCelp8EncEnd() +error_code cellCelp8EncEnd(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + cellCelp8Enc.todo("cellCelp8EncEnd(handle=*0x%x)", handle); return CELL_OK; } -s32 cellCelp8EncEncodeFrame() +error_code cellCelp8EncEncodeFrame(vm::ptr handle, vm::ptr frameInfo) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + cellCelp8Enc.todo("cellCelp8EncEncodeFrame(handle=*0x%x, frameInfo=*0x%x)", handle, frameInfo); return CELL_OK; } -s32 cellCelp8EncWaitForOutput() +error_code cellCelp8EncWaitForOutput(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + cellCelp8Enc.todo("cellCelp8EncWaitForOutput(handle=*0x%x)", handle); return CELL_OK; } -s32 cellCelp8EncGetAu() +error_code cellCelp8EncGetAu(vm::ptr handle, vm::ptr outBuffer, vm::ptr auItem) { - UNIMPLEMENTED_FUNC(cellCelp8Enc); + cellCelp8Enc.todo("cellCelp8EncGetAu(handle=*0x%x, outBuffer=*0x%x, auItem=*0x%x)", handle, outBuffer, auItem); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellCelp8Enc.h b/rpcs3/Emu/Cell/Modules/cellCelp8Enc.h index 09b4eecaab..d242ea6fa8 100644 --- a/rpcs3/Emu/Cell/Modules/cellCelp8Enc.h +++ b/rpcs3/Emu/Cell/Modules/cellCelp8Enc.h @@ -1,11 +1,13 @@ -#pragma once - +#pragma once +struct CellSpurs; // libCelp8Enc = 0x806140a1 - 0x806140bf +// typedef void* CellCelp8EncHandle; + // Return Codes -enum +enum CellCelp8EncError : u32 { CELL_CELP8ENC_ERROR_FAILED = 0x806140a1, CELL_CELP8ENC_ERROR_SEQ = 0x806140a2, @@ -16,12 +18,8 @@ enum }; // Definitions -enum +enum CELL_CELP8ENC_MPE_CONFIG { - CELL_CELP8ENC_FS_8kHz = 1, - - CELL_CELP8ENC_EXCITATION_MODE_MPE = 0, - CELL_CELP8ENC_MPE_CONFIG_0 = 0, CELL_CELP8ENC_MPE_CONFIG_2 = 2, CELL_CELP8ENC_MPE_CONFIG_6 = 6, @@ -32,6 +30,66 @@ enum CELL_CELP8ENC_MPE_CONFIG_21 = 21, CELL_CELP8ENC_MPE_CONFIG_24 = 24, CELL_CELP8ENC_MPE_CONFIG_26 = 26, +}; +enum CELL_CELP8ENC_SAMPEL_RATE +{ + CELL_CELP8ENC_FS_8kHz = 1, +}; + +enum CELL_CELP8ENC_EXCITATION_MODE +{ + CELL_CELP8ENC_EXCITATION_MODE_MPE = 0, +}; + +enum CELL_CELP8ENC_WORD_SZ +{ CELL_CELP8ENC_WORD_SZ_FLOAT, }; + +struct CellCelp8EncAttr +{ + be_t workMemSize; + be_t celpEncVerUpper; + be_t celpEncVerLower; +}; + +struct CellCelp8EncResource +{ + be_t totalMemSize; + vm::bptr startAddr; + be_t ppuThreadPriority; + be_t spuThreadPriority; + be_t ppuThreadStackSize; +}; + +struct CellCelp8EncParam +{ + be_t excitationMode; + be_t sampleRate; + be_t configuration; + be_t wordSize; + vm::bptr outBuff; + be_t outSize; +}; + +struct CellCelp8EncAuInfo +{ + vm::bptr startAddr; + be_t size; +}; + +struct CellCelp8EncPcmInfo +{ + vm::bptr startAddr; + be_t size; +}; + +struct CellCelp8EncResourceEx +{ + be_t totalMemSize; + vm::bptr startAddr; + vm::bptr spurs; + u8 priority[8]; + be_t maxContention; +}; diff --git a/rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp b/rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp index f9a61d817f..246c62351c 100644 --- a/rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp +++ b/rpcs3/Emu/Cell/Modules/cellCelpEnc.cpp @@ -1,67 +1,86 @@ -#include "stdafx.h" +#include "stdafx.h" #include "Emu/Cell/PPUModule.h" #include "cellCelpEnc.h" LOG_CHANNEL(cellCelpEnc); -s32 cellCelpEncQueryAttr() +template <> +void fmt_class_string::format(std::string& out, u64 arg) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + format_enum(out, arg, [](CellCelpEncError value) + { + switch (value) + { + STR_CASE(CELL_CELPENC_ERROR_FAILED); + STR_CASE(CELL_CELPENC_ERROR_SEQ); + STR_CASE(CELL_CELPENC_ERROR_ARG); + STR_CASE(CELL_CELPENC_ERROR_CORE_FAILED); + STR_CASE(CELL_CELPENC_ERROR_CORE_SEQ); + STR_CASE(CELL_CELPENC_ERROR_CORE_ARG); + } + + return unknown; + }); +} + +error_code cellCelpEncQueryAttr(vm::ptr attr) +{ + cellCelpEnc.todo("cellCelpEncQueryAttr(attr=*0x%x)", attr); return CELL_OK; } -s32 cellCelpEncOpen() +error_code cellCelpEncOpen(vm::ptr res, vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncOpen(res=*0x%x ,attr=*0x%x)", res, handle); return CELL_OK; } -s32 cellCelpEncOpenEx() +error_code cellCelpEncOpenEx(vm::ptr res, vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncOpenEx(res=*0x%x ,attr=*0x%x)", res, handle); return CELL_OK; } -s32 cellCelpEncOpenExt() +error_code cellCelpEncOpenExt() { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncOpenExt()"); return CELL_OK; } -s32 cellCelpEncClose() +error_code cellCelpEncClose(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncClose(handle=*0x%x)", handle); return CELL_OK; } -s32 cellCelpEncStart() +error_code cellCelpEncStart(vm::ptr handle, vm::ptr param) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncStart(handle=*0x%x, attr=*0x%x)", handle, param); return CELL_OK; } -s32 cellCelpEncEnd() +error_code cellCelpEncEnd(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncEnd(handle=*0x%x)", handle); return CELL_OK; } -s32 cellCelpEncEncodeFrame() +error_code cellCelpEncEncodeFrame(vm::ptr handle, vm::ptr frameInfo) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncEncodeFrame(handle=*0x%x, frameInfo=*0x%x)", handle, frameInfo); return CELL_OK; } -s32 cellCelpEncWaitForOutput() +error_code cellCelpEncWaitForOutput(vm::ptr handle) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncWaitForOutput(handle=*0x%x)", handle); return CELL_OK; } -s32 cellCelpEncGetAu() +error_code cellCelpEncGetAu(vm::ptr handle, vm::ptr outBuffer, vm::ptr auItem) { - UNIMPLEMENTED_FUNC(cellCelpEnc); + cellCelpEnc.todo("cellCelpEncGetAu(handle=*0x%x, outBuffer=*0x%x, auItem=*0x%x)", handle, outBuffer, auItem); return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellCelpEnc.h b/rpcs3/Emu/Cell/Modules/cellCelpEnc.h index 2becd0afdb..4e4be899c4 100644 --- a/rpcs3/Emu/Cell/Modules/cellCelpEnc.h +++ b/rpcs3/Emu/Cell/Modules/cellCelpEnc.h @@ -1,11 +1,13 @@ -#pragma once - +#pragma once +struct CellSpurs; // libCelpEnc = 0x80614001 - 0x806140ff +// typedef void* CellCelpEncHandle; + // Return Codes -enum +enum CellCelpEncError : u32 { CELL_CELPENC_ERROR_FAILED = 0x80614001, CELL_CELPENC_ERROR_SEQ = 0x80614002, @@ -16,17 +18,73 @@ enum }; // Definitions -enum +enum CELL_CELPENC_RPE_CONFIG { - CELL_CELPENC_FS_16kHz = 2, - - CELL_CELPENC_EXCITATION_MODE_RPE = 1, - CELL_CELPENC_RPE_CONFIG_0, CELL_CELPENC_RPE_CONFIG_1, CELL_CELPENC_RPE_CONFIG_2, CELL_CELPENC_RPE_CONFIG_3, - - CELL_CELPENC_WORD_SZ_INI16_LE, - CELL_CELPENC_WORD_SZ_FLOAT, +}; + +enum CELL_CELPENC_SAMPEL_RATE +{ + CELL_CELPENC_FS_16kHz = 2, +}; + +enum CELL_CELPENC_EXCITATION_MODE +{ + CELL_CELPENC_EXCITATION_MODE_RPE = 1, +}; + +enum CELL_CELPENC_WORD_SZ +{ + CELL_CELPENC_WORD_SZ_INT16_LE, + CELL_CELPENC_WORD_SZ_FLOAT +}; + +struct CellCelpEncAttr +{ + be_t workMemSize; + be_t celpEncVerUpper; + be_t celpEncVerLower; +}; + +struct CellCelpEncResource +{ + be_t totalMemSize; + vm::bptr startAddr; + be_t ppuThreadPriority; + be_t spuThreadPriority; + be_t ppuThreadStackSize; +}; + +struct CellCelpEncParam +{ + be_t excitationMode; + be_t sampleRate; + be_t configuration; + be_t wordSize; + vm::bptr outBuff; + be_t outSize; +}; + +struct CellCelpEncAuInfo +{ + vm::bptr startAddr; + be_t size; +}; + +struct CellCelpEncPcmInfo +{ + vm::bptr startAddr; + be_t size; +}; + +struct CellCelpEncResourceEx +{ + be_t totalMemSize; + vm::bptr startAddr; + vm::bptr spurs; + u8 priority[8]; + be_t maxContention; };