kernel: macos/linux Implement sceKernelUuidCreate (#2923)

* kernel: macos/linux Implement sceKernelUuidCreate

* Fix clang-format

* Fix Linux build

* Fix Linux build (2)

---------

Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
This commit is contained in:
Roman 2025-05-13 12:10:33 +07:00 committed by GitHub
parent 6bbb424c28
commit 2a3a701115
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 4 deletions

View file

@ -1094,11 +1094,15 @@ if (ENABLE_DISCORD_RPC)
target_compile_definitions(shadps4 PRIVATE ENABLE_DISCORD_RPC)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
# Optional due to https://github.com/shadps4-emu/shadPS4/issues/1704
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ENABLE_USERFAULTFD)
if (ENABLE_USERFAULTFD)
target_compile_definitions(shadps4 PRIVATE ENABLE_USERFAULTFD)
endif()
target_link_libraries(shadps4 PRIVATE uuid)
endif()
if (APPLE)
# Include MoltenVK, along with an ICD file so it can be found by the system Vulkan loader if used for loading layers.
if (ENABLE_QT_GUI)

View file

@ -28,6 +28,8 @@
#ifdef _WIN64
#include <Rpc.h>
#else
#include <uuid/uuid.h>
#endif
#include <common/singleton.h>
#include "aio.h"
@ -164,7 +166,17 @@ int PS4_SYSV_ABI sceKernelUuidCreate(OrbisKernelUuid* orbisUuid) {
orbisUuid->node[i] = uuid.Data4[2 + i];
}
#else
LOG_ERROR(Kernel, "sceKernelUuidCreate: Add linux");
uuid_t uuid;
uuid_generate(uuid);
orbisUuid->timeLow =
((u32)uuid[0] << 24) | ((u32)uuid[1] << 16) | ((u32)uuid[2] << 8) | (u32)uuid[3];
orbisUuid->timeMid = ((u16)uuid[4] << 8) | uuid[5];
orbisUuid->timeHiAndVersion = ((u16)uuid[6] << 8) | uuid[7];
orbisUuid->clockSeqHiAndReserved = uuid[8];
orbisUuid->clockSeqLow = uuid[9];
for (int i = 0; i < 6; i++) {
orbisUuid->node[i] = uuid[10 + i];
}
#endif
return 0;
}