diff --git a/modules/libSceAjm/codes.h b/modules/libSceAjm/codes.h index f158822..4e5498c 100644 --- a/modules/libSceAjm/codes.h +++ b/modules/libSceAjm/codes.h @@ -1,4 +1,6 @@ #pragma once #include -namespace Err {} // namespace Err \ No newline at end of file +namespace Err {} // namespace Err + +constexpr uint64_t SCE_AJM_FLAG_SIDEBAND_STREAM = (1ULL << 47); \ No newline at end of file diff --git a/modules/libSceAjm/entry.cpp b/modules/libSceAjm/entry.cpp index 5c0fd63..6f32ec0 100644 --- a/modules/libSceAjm/entry.cpp +++ b/modules/libSceAjm/entry.cpp @@ -18,6 +18,46 @@ EXPORT SYSV_ABI int32_t sceAjmFinalize(const SceAjmContextId uiContext) { return Ok; } +void FixSideband(uint64_t uiFlags, void* pSidebandOutput, uint64_t szSidebandOutputSize) { + if ((uiFlags & SCE_AJM_FLAG_SIDEBAND_STREAM) != 0) { + SceAjmSidebandStreamResult* pResult = reinterpret_cast(pSidebandOutput); + pResult->sStream.iSizeConsumed = 1; + pResult->sStream.iSizeProduced = 1; + pResult->sStream.uiTotalDecodedSamples = 1; + } +} + +EXPORT SYSV_ABI int32_t sceAjmBatchJobControlBufferRa(void* pBatchPosition, SceAjmInstanceId uiInstance, uint64_t uiFlags, void* pSidebandInput, + uint64_t szSidebandInputSize, void* pSidebandOutput, uint64_t szSidebandOutputSize, + void** pReturnAddress) { + if (pSidebandOutput != nullptr) { + std::memset(pSidebandOutput, 0, szSidebandOutputSize); + FixSideband(uiFlags, pSidebandOutput, szSidebandOutputSize); + } + return 0; +} + +EXPORT SYSV_ABI int32_t sceAjmBatchJobRunBufferRa(void* pBatchPosition, SceAjmInstanceId uiInstance, uint64_t uiFlags, void* pDataInput, + uint64_t szDataInputSize, void* pDataOutput, uint64_t szDataOutputSize, void* pSidebandOutput, + uint64_t szSidebandOutputSize, void** pReturnAddress) { + if (pSidebandOutput != nullptr) { + std::memset(pSidebandOutput, 0, szSidebandOutputSize); + FixSideband(uiFlags, pSidebandOutput, szSidebandOutputSize); + } + + std::memset(pDataOutput, 0, szDataOutputSize); + return 0; +} + +EXPORT SYSV_ABI int32_t sceAjmBatchStartBuffer(SceAjmContextId uiContext, void* pBatchCommands, uint64_t szBatchSize, int iPriority, + SceAjmBatchError pBatchError, SceAjmBatchId pBatch) { + return Ok; +} + +EXPORT SYSV_ABI int32_t sceAjmBatchWait(SceAjmContextId uiContext, SceAjmBatchId uiBatch, uint32_t uiTimeout, SceAjmBatchError pBatchError) { + return Ok; +} + EXPORT SYSV_ABI int32_t sceAjmMemoryRegister(const SceAjmContextId uiContext, void* const pRegion, const size_t szNumPages) { return Ok; } diff --git a/modules/libSceAjm/types.h b/modules/libSceAjm/types.h index 10fa05b..cbb2204 100644 --- a/modules/libSceAjm/types.h +++ b/modules/libSceAjm/types.h @@ -4,4 +4,21 @@ typedef unsigned int SceAjmContextId; typedef unsigned int SceAjmCodecType; typedef unsigned int SceAjmInstanceId; -typedef unsigned int SceAjmBatchId; \ No newline at end of file +typedef unsigned int SceAjmBatchId; + +struct SceAjmSidebandStreamResult { + struct { + int iSizeConsumed; + int iSizeProduced; + unsigned int uiTotalDecodedSamples; + } sStream; +}; + +struct SceAjmBatchError { + int iErrorCode; + int align1; + void* pJobAddress; + int uiCommandOffset; + int align2; + void* pJobOriginRa; +}; \ No newline at end of file diff --git a/modules/libSceFace/CMakeLists.txt b/modules/libSceFace/CMakeLists.txt new file mode 100644 index 0000000..e9afd40 --- /dev/null +++ b/modules/libSceFace/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.24) +include(../setupModule.cmake) + +set(libName libSceFace) +project(${libName}) + +add_library(${libName} SHARED entry.cpp) + +setupModule(${libName}) \ No newline at end of file diff --git a/modules/libSceFace/codes.h b/modules/libSceFace/codes.h new file mode 100644 index 0000000..882826a --- /dev/null +++ b/modules/libSceFace/codes.h @@ -0,0 +1,11 @@ +#pragma once +#include + +namespace Err {} // namespace Err + +constexpr int AGE_BIN_SIZE = 81; +constexpr int IDENTIFY_FEATURE_SIZE = 4096; +constexpr int IDENTIFY_LITE_FEATURE_SIZE = 256; +constexpr int IDENTIFY_EX_FEATURE_SIZE = 1024; +constexpr int SHAPE_POINT_NUM_MAX = 46; +constexpr int PARTS_NUM_MAX = 4; \ No newline at end of file diff --git a/modules/libSceFace/entry.cpp b/modules/libSceFace/entry.cpp new file mode 100644 index 0000000..0eb40d9 --- /dev/null +++ b/modules/libSceFace/entry.cpp @@ -0,0 +1,171 @@ +#include "common.h" +#include "logging.h" +#include "types.h" + +LOG_DEFINE_MODULE(libSceFace); + +namespace {} // namespace + +extern "C" { + +EXPORT const char* MODULE_NAME = "libSceFace"; + +EXPORT SYSV_ABI int sceFaceDetection(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFaceDetectionDictPtr detectDictPtr, + float magBegin, float magStep, float magEnd, int xScanStep, int yScanStep, float thresholdScore, int resultPrecision, + SceFaceDetectionResult resultFaceArray[], int resultFaceArraySize, int* resultFaceNum, void* workMemory, + int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceDetectionEx(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFaceDetectionDictPtr detectDictPtr, + const SceFaceDetectionParam* detectParam, SceFaceDetectionResult resultFaceArray[], int resultFaceArraySize, + int* resultFaceNum, void* workMemory, int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceDetectionLocal(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFaceDetectionDictPtr detectDictPtr, + float magStep, float xExpandRegion, float yExpandRegion, int xScanStep, int yScanStep, float thresholdScore, + const SceFaceDetectionResult referenceFaceArray[], int referenceFaceArraySize, + SceFaceDetectionResult resultFaceArray[], int resultFaceArraySize, int* resultFaceNum, void* workMemory, + int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceDetectionGetDefaultParam(SceFaceDetectionParam* detectParam) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceDetectionGetWorkingMemorySize(int width, int height, int rowstride, const SceFaceDetectionDictPtr detectDictPtr) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceParts(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFacePartsDictPtr partsDictPtr, int xScanStep, + int yScanStep, const SceFaceDetectionResult* detectedFace, SceFacePartsResult resultPartsArray[], int resultPartsArraySize, + int* resultPartsNum, void* workMemory, int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFacePartsEx(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFacePartsDictPtr partsDictPtr, + const SceFacePartsCheckDictPtr partsCheckDictPtr, int xScanStep, int yScanStep, const SceFaceDetectionResult* detectedFace, + SceFacePartsResult resultPartsArray[], int resultPartsArraySize, int* resultPartsNum, void* workMemory, int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceAllParts(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFacePartsDictPtr partsDictPtr, + const SceFaceShapeDictPtr shapeDictPtr, int xScanStep, int yScanStep, const SceFaceDetectionResult* detectedFace, + SceFacePartsResult resultPartsArray[], int resultPartsArraySize, int* resultPartsNum, void* workMemory, + int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceEstimatePoseRegion(int width, int height, const SceFaceDetectionResult* detectedFace, const SceFacePartsResult detectedPartsArray[], + int detectedPartsNum, SceFacePose* resultFacePose, SceFaceRegion* resultFaceRegion) { + return Ok; +} + +EXPORT SYSV_ABI int sceFacePartsResultCheck(const SceFaceDetectionResult* detectedFace, const SceFacePartsResult detectedPartsArray[], int detectedPartsNum, + const SceFacePartsCheckDictPtr partsCheckDictPtr, bool* good) { + return Ok; +} + +EXPORT SYSV_ABI int sceFacePartsGetWorkingMemorySize(int width, int height, int rowstride, const SceFacePartsDictPtr partsDictPtr) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceAllPartsGetWorkingMemorySize(int width, int height, int rowstride, const SceFacePartsDictPtr partsDictPtr) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceAttribute(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFaceAttribDictPtr attribDictPtr, + const SceFaceDetectionResult* detectedFace, const SceFacePartsResult detectedPartsArray[], int detectedPartsNum, + SceFaceAttribResult resultAttribArray[], int resultAttribArraySize, int* resultAttribNum, void* workMemory, + int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceAgeRangeEstimate(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFaceAgeDictPtr ageDictPtr, + const SceFaceDetectionResult* detectedFace, const SceFacePartsResult detectedPartsArray[], int detectedPartsNum, + SceFaceAgeRangeResult* resultAge, void* workMemory, int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceAgeRangeIntegrate(const SceFaceAgeRangeResult* ageRange, SceFaceAgeDistrData* ageDistrData, int* ageResult) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceAttributeGetWorkingMemorySize(int width, int height, int rowstride, const SceFaceAttribDictPtr attribDictPtr) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceAgeGetWorkingMemorySize(int width, int height, int rowstride, const SceFaceAgeDictPtr ageDictPtr) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifyGetFeature(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFaceIdentifyDictPtr identifyDictPtr, + const SceFaceDetectionResult* detectedFace, const SceFacePartsResult detectedPartsArray[], int detectedPartsNum, + SceFaceIdentifyFeature* resultFeature, void* workMemory, int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifyLiteGetFeature(const unsigned char* imgPtr, int width, int height, int rowstride, + const SceFaceIdentifyLiteDictPtr identifyDictPtr, const SceFaceDetectionResult* detectedFace, + const SceFacePartsResult detectedPartsArray[], int detectedPartsNum, + SceFaceIdentifyLiteFeature* resultFeature, void* workMemory, int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifyExGetFeature(const unsigned char* imgPtr, int width, int height, int rowstride, + const SceFaceIdentifyExDictPtr identifyDictPtr, const SceFaceDetectionResult* detectedFace, + const SceFacePartsResult detectedPartsArray[], int detectedPartsNum, + const SceFaceAttribResult detectedAttribArray[], int detectedAttribNum, SceFaceIdentifyExFeature* resultFeature, + void* workMemory, int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifySimilarity(const SceFaceIdentifyFeature* extractedFeature, const SceFaceIdentifyFeature registeredFeatureArray[], + int registeredFeatureNum, const SceFaceIdentifyDictPtr identifyDictPtr, float* maxScore, int* maxScoreId, + float resultScoreArray[]) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifyLiteSimilarity(const SceFaceIdentifyLiteFeature* extractedFeature, const SceFaceIdentifyLiteFeature registeredFeatureArray[], + int registeredFeatureNum, const SceFaceIdentifyLiteDictPtr identifyDictPtr, float* maxScore, int* maxScoreId, + float resultScoreArray[]) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifyExSimilarity(const SceFaceIdentifyExFeature* extractedFeature, const SceFaceIdentifyExFeature registeredFeatureArray[], + int registeredFeatureNum, const SceFaceIdentifyExDictPtr identifyDictPtr, float* maxScore, int* maxScoreId, + float resultScoreArray[]) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifyGetWorkingMemorySize(int width, int height, int rowstride, const SceFaceIdentifyDictPtr identifyDictPtr) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifyLiteGetWorkingMemorySize(int width, int height, int rowstride, const SceFaceIdentifyLiteDictPtr identifyDictPtr) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceIdentifyExGetWorkingMemorySize(int width, int height, int rowstride, const SceFaceIdentifyExDictPtr identifyDictPtr) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceShapeFit(const unsigned char* imgPtr, int width, int height, int rowstride, const SceFaceShapeModelDictPtr shapeDictPtr, + SceFaceShapeResult* shape, float lostThreshold, const SceFaceDetectionResult* detectedFace, + const SceFacePartsResult detectedPartsArray[], int detectedPartsNum, void* workMemory, int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceShapeTrack(const unsigned char* imgPtrCur, const unsigned char* imgPtrPrv, int width, int height, int rowstride, + const SceFaceShapeModelDictPtr shapeDictPtr, SceFaceShapeResult* shape, float lostThreshold, void* workMemory, + int workMemorySize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceShapeGetWorkingMemorySize(int width, int height, int rowstride, const SceFaceShapeModelDictPtr shapeDictPtr, int maxFaceWidth, + int maxFaceHeight, bool isVideoInput) { + return Ok; +} +} \ No newline at end of file diff --git a/modules/libSceFace/types.h b/modules/libSceFace/types.h new file mode 100644 index 0000000..78f3d59 --- /dev/null +++ b/modules/libSceFace/types.h @@ -0,0 +1,105 @@ +#pragma once +#include "codes.h" + +typedef void* SceFaceAttribDictPtr; +typedef void* SceFaceAgeDictPtr; +typedef void* SceFaceDetectionDictPtr; +typedef void* SceFacePartsDictPtr; +typedef void* SceFacePartsCheckDictPtr; +typedef void* SceFaceShapeDictPtr; +typedef void* SceFaceIdentifyDictPtr; +typedef void* SceFaceIdentifyLiteDictPtr; +typedef void* SceFaceIdentifyExDictPtr; +typedef void* SceFaceShapeModelDictPtr; + +struct SceFaceAgeDistrData { + float score[AGE_BIN_SIZE]; + int numIntegrated; +}; + +struct SceFaceAttribResult { + unsigned int attribId; + float score; +}; + +struct SceFaceAgeRangeResult { + unsigned char maxAge; + unsigned char minAge; +}; + +struct SceFaceDetectionResult { + float faceX; + float faceY; + float faceW; + float faceH; + float faceRoll; + float facePitch; + float faceYaw; + float score; +}; + +struct SceFacePartsResult { + unsigned int partsId; + float partsX; + float partsY; + float score; +}; + +struct SceFaceDetectionParam { + int version; + int size; + float magBegin; + float magStep; + float magEnd; + int xScanStart; + int yScanStart; + int xScanStep; + int yScanStep; + float xScanOver; + float yScanOver; + float thresholdScore; + int resultPrecision; + int searchType; +}; + +struct SceFaceIdentifyFeature { + unsigned char data[IDENTIFY_FEATURE_SIZE]; +}; + +struct SceFaceIdentifyLiteFeature { + unsigned char data[IDENTIFY_LITE_FEATURE_SIZE]; +}; + +struct SceFaceIdentifyExFeature { + unsigned char data[IDENTIFY_EX_FEATURE_SIZE]; +}; + +struct SceFaceShapeResult { + int modelID; + int pointNum; + float pointX[SHAPE_POINT_NUM_MAX]; + float pointY[SHAPE_POINT_NUM_MAX]; + int isLost[SHAPE_POINT_NUM_MAX]; + float fourPointX[PARTS_NUM_MAX]; + float fourPointY[PARTS_NUM_MAX]; + float rectCenterX; + float rectCenterY; + float rectWidth; + float rectHeight; + float faceRoll; + float facePitch; + float faceYaw; + float score; + unsigned char data[4096]; +}; + +struct SceFacePose { + float faceRoll; + float facePitch; + float faceYaw; +}; + +struct SceFaceRegion { + float faceRegionX[4]; + float faceRegionY[4]; +}; \ No newline at end of file diff --git a/modules/libSceFaceTracker/CMakeLists.txt b/modules/libSceFaceTracker/CMakeLists.txt new file mode 100644 index 0000000..42f6b56 --- /dev/null +++ b/modules/libSceFaceTracker/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.24) +include(../setupModule.cmake) + +set(libName libSceFaceTracker) +project(${libName}) + +add_library(${libName} SHARED entry.cpp) + +setupModule(${libName}) \ No newline at end of file diff --git a/modules/libSceFaceTracker/codes.h b/modules/libSceFaceTracker/codes.h new file mode 100644 index 0000000..a191645 --- /dev/null +++ b/modules/libSceFaceTracker/codes.h @@ -0,0 +1,6 @@ +#pragma once +#include + +namespace Err {} // namespace Err + +constexpr int PARTS_NUM_MAX = 4; \ No newline at end of file diff --git a/modules/libSceFaceTracker/entry.cpp b/modules/libSceFaceTracker/entry.cpp new file mode 100644 index 0000000..992b48a --- /dev/null +++ b/modules/libSceFaceTracker/entry.cpp @@ -0,0 +1,90 @@ +#include "common.h" +#include "logging.h" +#include "types.h" + +LOG_DEFINE_MODULE(libSceFaceTracker); + +namespace {} // namespace + +extern "C" { + +EXPORT const char* MODULE_NAME = "libSceFaceTracker"; + +EXPORT SYSV_ABI int sceFaceTrackerInitialize(int width, int height, int rowstride, int maxTrackingNum, uint32_t* threadFuncMutex, + const SceFaceTrackerConfig* pConfig, void* work, int workSize) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerFinalize(void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerUpdate(const unsigned char* imageData, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerSearchTarget(uint32_t* threadFuncMutex, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerGetResult(int trackId, SceFaceTrackerResult* result, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerStartTracking(int trackId, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerStopTracking(int trackId, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerReset(bool isClearRegisterUser, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerAddUserFeature(int userId, const void* featureData, int featureDataSize, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerRegisterUser(int userId, const void* featureData, int featureDataSize, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerUnregisterUser(int userId, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerGetUserFeature(int userId, const void** featureData, int* featureDataSize, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerGetUserIdByTrackId(int trackId, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerGetTrackIdByUserId(int trackId, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerRegisterStartTrackingCallback(SceFaceTrackerStartTrackingCallbackFunc func, void* callbackParam, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerRegisterFixUserIdCallback(SceFaceTrackerFixUserIdCallbackFunc func, void* callbackParam, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerRegisterLostTargetCallback(SceFaceTrackerLostTargetCallbackFunc func, void* callbackParam, void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerRegisterRecoveryFromLostTargetCallback(SceFaceTrackerRecoveryFromLostTargetCallbackFunc func, void* callbackParam, + void* work) { + return Ok; +} + +EXPORT SYSV_ABI int sceFaceTrackerRegisterStopTrackingCallback(SceFaceTrackerStopTrackingCallbackFunc func, void* callbackParam, void* work) { + return Ok; +} +} \ No newline at end of file diff --git a/modules/libSceFaceTracker/types.h b/modules/libSceFaceTracker/types.h new file mode 100644 index 0000000..8bc7662 --- /dev/null +++ b/modules/libSceFaceTracker/types.h @@ -0,0 +1,108 @@ +#pragma once +#include "codes.h" + +enum class SceFaceTrackerFaceDetectDictionary { + FACE_FRONTAL_DICT = 0, + FACE_ROLL_DICT = 1, + FACE_YAW_DICT = 2, + FACE_PITCH_DICT = 3, + FACE_ROLL_YAW_DICT = 4, + FACE_ROLL_YAW_PITCH_DICT = 5, + FACE_DICT_MAX = 6, + FACE_DICT_UNDEF = 0xFFFF, +}; + +typedef void* SceFaceTrackerStartTrackingCallbackFunc(void* callbackParam); + +typedef void* SceFaceTrackerFixUserIdCallbackFunc(int trackId, int userId, const void* featureData, int featureDataSize, void* callbackParam); + +typedef void* SceFaceTrackerLostTargetCallbackFunc(int trackId, int userId, void* callbackParam); + +typedef void* SceFaceTrackerRecoveryFromLostTargetCallbackFunc(int trackId, int userId, void* callbackParam); + +typedef void* SceFaceTrackerStopTrackingCallbackFunc(int trackId, int userId, void* callbackParam); + +struct SceFaceTrackerAttributeScores { + float smile; + float gender; + float baby; + float adult; + float elder; + float leyeopen; + float reyeopen; + float glasses; +}; + +struct SceFacePartsResult { + unsigned int partsId; + float partsX; + float partsY; + float score; +}; + +struct SceFaceTrackerResult { + int status; + int trackId; + int userId; + float posX; + float posY; + float faceWidth; + float faceHeight; + float faceRoll; + float facePitch; + float faceYaw; + float score; + float partsX[PARTS_NUM_MAX]; + float partsY[PARTS_NUM_MAX]; + SceFacePartsResult partsResult[PARTS_NUM_MAX]; + int partsCheckFlag; + SceFaceTrackerAttributeScores attributeScores; +}; + +struct SceFaceTrackerGlobalSearchConfig { + float magBegin; + float magEnd; + float magStep; + int xScanStart; + int yScanStart; + int xScanStep; + int yScanStep; + float xScanOver; + float yScanOver; + float thresholdScore; + int resultPrecision; + int searchType; + int maxFaceNum; + SceFaceTrackerFaceDetectDictionary dictionary; +}; + +struct SceFaceTrackerLocalSearchConfig { + float magStep; + float xExpandRegion; + float yExpandRegion; + int xScanStep; + int yScanStep; + float thresholdScore; + SceFaceTrackerFaceDetectDictionary dictionary; +}; + +struct SceFaceTrackerIdentifyConfig { + float fixUserIdThresholdScore; + int fixUserIdIdentifyCount; + float unknownUserThresholdScore; + int unknownUserIdentifyCount; + bool enableFeatureUpdate; +}; + +struct SceFaceTrackerConfig { + SceFaceTrackerGlobalSearchConfig globalSearchConfig; + SceFaceTrackerLocalSearchConfig localSearchConfig; + SceFaceTrackerIdentifyConfig identifyConfig; + int framesToLost; + float trackThresholdScore; + int localSearchInterval; + int userIdentifyInterval; + int attributeInterval; + bool enableUserIdentify; + bool enableAttribute; +}; \ No newline at end of file diff --git a/modules/libSceGraphicsDriver/entry.cpp b/modules/libSceGraphicsDriver/entry.cpp index 9fb4c13..25497bb 100644 --- a/modules/libSceGraphicsDriver/entry.cpp +++ b/modules/libSceGraphicsDriver/entry.cpp @@ -342,6 +342,14 @@ uint32_t SYSV_ABI sceGnmDrawInitDefaultHardwareState350(uint32_t* cmdOut, uint64 return 2; } +uint32_t SYSV_ABI sceGnmDrawInitToDefaultContextState400(uint32_t* cmdOut, uint64_t size) { + LOG_USE_MODULE(libSceGraphicsDriver); + LOG_DEBUG(L"%S", __FUNCTION__); + + cmdOut[0] = Pm4::create(2, Pm4::Custom::R_DRAW_RESET); + return 2; +} + uint32_t SYSV_ABI sceGnmDispatchInitDefaultHardwareState(uint32_t* cmdOut, uint64_t size) { LOG_USE_MODULE(libSceGraphicsDriver); LOG_DEBUG(L"%S", __FUNCTION__); diff --git a/modules/libSceNpWebApi/entry.cpp b/modules/libSceNpWebApi/entry.cpp index 25d0467..a72b6de 100644 --- a/modules/libSceNpWebApi/entry.cpp +++ b/modules/libSceNpWebApi/entry.cpp @@ -70,6 +70,10 @@ EXPORT SYSV_ABI int32_t sceNpWebApiDeleteRequest(int64_t requestId) { return Ok; } +EXPORT SYSV_ABI int32_t sceNpWebApiSendRequest(int64_t requestId, const void* pData, size_t dataSize, SceNpWebApiResponseInformationOption* pRespInfoOption) { + return Ok; +} + EXPORT SYSV_ABI int32_t sceNpWebApiSendRequest2(int64_t requestId, const void* pData, size_t dataSize, SceNpWebApiResponseInformationOption* pRespInfoOption) { return Ok; } @@ -103,6 +107,10 @@ EXPORT SYSV_ABI int32_t sceNpWebApiGetHttpResponseHeaderValue(int64_t requestId, return Ok; } +EXPORT SYSV_ABI int32_t sceNpWebApiGetHttpStatusCode(int64_t requestId, int32_t* pStatusCode) { + return Ok; +} + EXPORT SYSV_ABI int32_t sceNpWebApiAbortRequest(int64_t requestId) { return Ok; } diff --git a/modules/libScePadTracker/CMakeLists.txt b/modules/libScePadTracker/CMakeLists.txt new file mode 100644 index 0000000..4678b89 --- /dev/null +++ b/modules/libScePadTracker/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.24) +include(../setupModule.cmake) + +set(libName libScePadTracker) +project(${libName}) + +add_library(${libName} SHARED entry.cpp) + +setupModule(${libName}) \ No newline at end of file diff --git a/modules/libScePadTracker/codes.h b/modules/libScePadTracker/codes.h new file mode 100644 index 0000000..8616aec --- /dev/null +++ b/modules/libScePadTracker/codes.h @@ -0,0 +1,7 @@ +#pragma once +#include + +namespace Err {} // namespace Err + +constexpr int TRACKER_CONTROLLER_MAX = 4; +constexpr int TRACKER_IMAGE_MAX = 2; \ No newline at end of file diff --git a/modules/libScePadTracker/entry.cpp b/modules/libScePadTracker/entry.cpp new file mode 100644 index 0000000..3ffe64e --- /dev/null +++ b/modules/libScePadTracker/entry.cpp @@ -0,0 +1,36 @@ +#include "common.h" +#include "logging.h" +#include "types.h" + +LOG_DEFINE_MODULE(libScePadTracker); + +namespace {} // namespace + +extern "C" { + +EXPORT const char* MODULE_NAME = "libScePadTracker"; + +EXPORT SYSV_ABI int32_t scePadTrackerCalibrate(int32_t* onionSize, int32_t* garlicSize) { + return Ok; +} + +EXPORT SYSV_ABI int32_t scePadTrackerGetWorkingMemorySize(int32_t* onionSize, int32_t* garlicSize) { + return Ok; +} + +EXPORT SYSV_ABI int32_t scePadTrackerInit(void* onionMemory, void* garlicMemory, int pipeId, int queueId) { + return Ok; +} + +EXPORT SYSV_ABI int32_t scePadTrackerReadState(int32_t handle, ScePadTrackerData* data) { + return Ok; +} + +EXPORT SYSV_ABI int32_t scePadTrackerTerm() { + return Ok; +} + +EXPORT SYSV_ABI int32_t scePadTrackerUpdate(ScePadTrackerInput input) { + return Ok; +} +} \ No newline at end of file diff --git a/modules/libScePadTracker/types.h b/modules/libScePadTracker/types.h new file mode 100644 index 0000000..54466d4 --- /dev/null +++ b/modules/libScePadTracker/types.h @@ -0,0 +1,32 @@ +#pragma once +#include "codes.h" + +enum class ScePadTrackerStatus { + TRACKER_TRACKING = 0, + TRACKER_NOT_TRACKING = 1, + TRACKER_ROOM_CONFLICT = 2, + TRACKER_CALIBRATING = 3, +}; + +struct ScePadTrackerImageCoordinates { + ScePadTrackerStatus status; + float x; + float y; +}; + +struct ScePadTrackerImage { + int exposure; + int gain; + int width; + int height; + void* data; +}; + +struct ScePadTrackerInput { + int32_t handles[TRACKER_CONTROLLER_MAX]; + ScePadTrackerImage images[TRACKER_IMAGE_MAX]; +}; + +struct ScePadTrackerData { + ScePadTrackerImageCoordinates imageCoordinates[TRACKER_IMAGE_MAX]; +}; \ No newline at end of file diff --git a/modules/libSceRudp/CMakeLists.txt b/modules/libSceRudp/CMakeLists.txt new file mode 100644 index 0000000..c87b4d8 --- /dev/null +++ b/modules/libSceRudp/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.24) +include(../setupModule.cmake) + +set(libName libSceRudp) +project(${libName}) + +add_library(${libName} SHARED entry.cpp) + +setupModule(${libName}) \ No newline at end of file diff --git a/modules/libSceRudp/codes.h b/modules/libSceRudp/codes.h new file mode 100644 index 0000000..f158822 --- /dev/null +++ b/modules/libSceRudp/codes.h @@ -0,0 +1,4 @@ +#pragma once +#include + +namespace Err {} // namespace Err \ No newline at end of file diff --git a/modules/libSceRudp/entry.cpp b/modules/libSceRudp/entry.cpp new file mode 100644 index 0000000..21270e5 --- /dev/null +++ b/modules/libSceRudp/entry.cpp @@ -0,0 +1,140 @@ +#include "common.h" +#include "logging.h" +#include "types.h" + +LOG_DEFINE_MODULE(libSceRudp); + +namespace {} // namespace + +extern "C" { + +EXPORT const char* MODULE_NAME = "libSceRudp"; + +EXPORT SYSV_ABI int sceRudpInit(void* memPool, int memPoolSize) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpEnableInternalIOThread(uint32_t stackSize, uint32_t priority) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpEnableInternalIOThread2(uint32_t stackSize, uint32_t priority, uint32_t affinityMask) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetMaxSegmentSize(uint16_t* mss) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpSetEventHandler(SceRudpEventHandler handler, void* arg) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpSetMaxSegmentSize(uint16_t mss) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpCreateContext(SceRudpContextEventHandler handler, void* arg, int* ctxId) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetOption(int ctxId, int option, void* optVal, size_t optLen) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpSetOption(int ctxId, int option, void const* optVal, size_t optLen) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetContextStatus(int ctxId, SceRudpContextStatus* status, size_t statusSize) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetLocalInfo(int ctxId, int* soc, struct SceNetSockaddr* addr, SceNetSocklen_t* addrLen, uint16_t* vport, uint8_t* muxMode) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetRemoteInfo(int ctxId, struct SceNetSockaddr* addr, SceNetSocklen_t* addrLen, uint16_t* vport) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetStatus(SceRudpStatus* status, size_t statusSize) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpFlush(int ctxId) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpNetFlush(void) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetNumberOfPacketsToRead(int ctxId) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetSizeReadable(int ctxId) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpGetSizeWritable(int ctxId) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpRead(int ctxId, void* data, size_t len, uint8_t flags, SceRudpReadInfo* info) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpWrite(int ctxId, void const* data, size_t len, uint8_t flags) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpPollCancel(int pollId) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpPollControl(int pollId, int op, int ctxId, uint16_t events) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpPollCreate(size_t size) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpPollDestroy(int pollId) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpPollWait(int pollId, SceRudpPollEvent* events, size_t eventLen, uint32_t timeout) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpEnd(void) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpActivate(int ctxId, struct SceNetSockaddr const* to, SceNetSocklen_t toLen) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpBind(int ctxId, int soc, uint16_t vport, uint8_t muxMode) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpInitiate(int ctxId, struct SceNetSockaddr const* to, SceNetSocklen_t toLen, uint16_t vport) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpNetReceived(int soc, uint8_t const* data, size_t dataLen, struct SceNetSockaddr const* from, SceNetSocklen_t fromLen) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpProcessEvents(uint32_t timeout) { + return Ok; +} + +EXPORT SYSV_ABI int sceRudpTerminate(int ctxId) { + return Ok; +} +} \ No newline at end of file diff --git a/modules/libSceRudp/types.h b/modules/libSceRudp/types.h new file mode 100644 index 0000000..3a7e362 --- /dev/null +++ b/modules/libSceRudp/types.h @@ -0,0 +1,98 @@ +#pragma once +#include "codes.h" + +typedef int SceNetSocklen_t; +typedef uint8_t SceNetSaFamily_t; + +struct SceNetSockaddr { + uint8_t sa_len; + SceNetSaFamily_t sa_family; + char sa_data[14]; +}; + +typedef int* SceRudpEventHandler(int eventId, int soc, uint8_t const* data, size_t dataLen, struct SceNetSockaddr const* addr, SceNetSocklen_t addrLen, + void* arg); + +typedef void* SceRudpContextEventHandler(int ctxId, int eventId, int errorCode, void* arg); + +struct SceRudpContextStatus { + uint32_t state; + int parentId; + uint32_t children; + uint32_t lostPackets; + uint32_t sentPackets; + uint32_t rcvdPackets; + uint64_t sentBytes; + uint64_t rcvdBytes; + uint32_t retransmissions; + uint32_t rtt; +}; + +struct SceRudpStatus { + uint64_t sentUdpBytes; + uint64_t rcvdUdpBytes; + uint32_t sentUdpPackets; + uint32_t rcvdUdpPackets; + uint64_t sentUserBytes; + uint32_t sentUserPackets; + uint64_t rcvdUserBytes; + uint32_t rcvdUserPackets; + uint32_t sentLatencyCriticalPackets; + uint32_t rcvdLatencyCriticalPackets; + uint32_t sentSynPackets; + uint32_t rcvdSynPackets; + uint32_t sentUsrPackets; + uint32_t rcvdUsrPackets; + uint32_t sentPrbPackets; + uint32_t rcvdPrbPackets; + uint32_t sentRstPackets; + uint32_t rcvdRstPackets; + uint32_t lostPackets; + uint32_t retransmittedPackets; + uint32_t reorderedPackets; + uint32_t currentContexts; + uint64_t sentQualityLevel1Bytes; + uint64_t rcvdQualityLevel1Bytes; + uint32_t sentQualityLevel1Packets; + uint32_t rcvdQualityLevel1Packets; + uint64_t sentQualityLevel2Bytes; + uint64_t rcvdQualityLevel2Bytes; + uint32_t sentQualityLevel2Packets; + uint32_t rcvdQualityLevel2Packets; + uint64_t sentQualityLevel3Bytes; + uint64_t rcvdQualityLevel3Bytes; + uint32_t sentQualityLevel3Packets; + uint32_t rcvdQualityLevel3Packets; + uint64_t sentQualityLevel4Bytes; + uint64_t rcvdQualityLevel4Bytes; + uint32_t sentQualityLevel4Packets; + uint32_t rcvdQualityLevel4Packets; + uint32_t allocs; + uint32_t frees; + uint32_t memCurrent; + uint32_t memPeak; + uint32_t establishedConnections; + uint32_t failedConnections; + uint32_t failedConnectionsReset; + uint32_t failedConnectionsRefused; + uint32_t failedConnectionsTimeout; + uint32_t failedConnectionsVersionMismatch; + uint32_t failedConnectionsTransportTypeMismatch; + uint32_t failedConnectionsQualityLevelMismatch; +}; + +struct SceRudpReadInfo { + uint8_t size; + uint8_t retransmissionCount; + uint16_t retransmissionDelay; + uint8_t retransmissionDelay2; + uint8_t flags; + uint16_t sequenceNumber; + uint32_t timestamp; +}; + +struct SceRudpPollEvent { + int ctxId; + uint16_t reqEvents; + uint16_t rtnEvents; +}; \ No newline at end of file diff --git a/modules/libkernel/aio.cpp b/modules/libkernel/aio.cpp index f6450f7..0bdbe79 100644 --- a/modules/libkernel/aio.cpp +++ b/modules/libkernel/aio.cpp @@ -91,7 +91,21 @@ EXPORT SYSV_ABI int sceKernelAioSubmitWriteCommandsMultiple(SceKernelAioRWReques EXPORT SYSV_ABI void sceKernelAioInitializeParam(SceKernelAioParam* param) { LOG_USE_MODULE(aio); - LOG_ERR(L"todo %S", __FUNCTION__); + (param->low).schedulingWindowSize = 0x20; + (param->low).delayedCountLimit = 0x20; + (param->low).enableSplit = 1; + (param->low).splitSize = 0x100000; + (param->low).splitChunkSize = 0x100000; + (param->mid).schedulingWindowSize = 0x20; + (param->mid).delayedCountLimit = 0x20; + (param->mid).enableSplit = 1; + (param->mid).splitSize = 0x100000; + (param->mid).splitChunkSize = 0x100000; + (param->high).schedulingWindowSize = 0x20; + (param->high).delayedCountLimit = 0x20; + (param->high).enableSplit = 0; + (param->high).splitSize = 0; + (param->high).splitChunkSize = 0; } EXPORT SYSV_ABI int sceKernelAioSetParam(SceKernelAioSchedulingParam* param, int schedulingWindowSize, int handleelayedCountLimit, uint32_t enableSplit,